code

From IndieWeb

code in the context of the indieweb, refers to source code, code files, typically in a revision control system, like Git, hosted on an indieweb site. Code is also often hosted on the GitHub silo.

Why

Hosting your own code lets you share your code with URLs you control on your own domain.

IndieWeb Examples

Christian Weiske

Christian Weiske uses GitWeb to post his source code at http://git.cweiske.de/ since 2007

Mirror setup

On indieweb server:

$ git init --bare project.git
$ cd project.git
$ git remote add github git@github.com:cweiske/project.git
$ git config remote.github.mirror true

On Github, add the mirror user as collaborator for the project. Now test it:

$ cd /path/to/project.git
$ git push github

If that works, the post-receive hook can be setup:

$ printf '#!/bin/sh\ngit push --quiet github\n' > hooks/post-receive
$ chmod +x hooks/post-receive

This force-pushes the code got github, which means any changes on github that are not on my server get overwritten. Thus cannot use the merge button on github, but have to merge manually.

Tantek

Tantek Çelik manually hosts the latest live version of CASSIS at: http://tantek.com/cassis.js (without revision control) and manually POSSEs it to https://github.com/tantek/cassis/blob/master/cassis.js (with revision history) since YYYY-MM-DD.

Aaron Parecki

Aaron Parecki uses a Gogs instance to host some private repositories on aaronparecki.com since 2016-02-13. Previously, he ran an instance of Gitlab but migrated away from it after some time.

  • Some of these projects are shared with a few other people who are able to log in and contribute.
  • All Aaron's public code is on GitHub, because it makes it easier to share and get contributions from others.

Ray Schulz

Ray Schulz uses cgit for the web interface and gitolite for the backend of http://git.rascul.io/ since YYYY-MM-DD.

Dmitri Shuralyov

Dmitri Shuralyov hosts Go packages created after 2017-09-13 on his personal website. His website is a custom Go package host, written in Go and fully open-source, implementing features such as git repository serving, issue tracking, notifications, history viewing, etc. As of 2021-12-27, it also supports performing code review on changes before submitting them.

Software

Software you can use to host your own Git repository:

Code Snippet

Similar to source code hosting, but simpler and often used for examples rather than actual running code, code snippet hosting is a way of sharing bits of code from your site instead of an entire file.

Services like pastebin or gist allow people to quickly post snippets of code without organizing into a repository or project.

IndieWeb Examples

cweiske

Christian Weiske uses phorkie to self-host code snippets on a separate subdomain.

aaronpk

Aaron Parecki posts code snippets to his site since 2018-01-06

pstuifzand

Peter Stuifzand posts code snippets to his site since 2018-03-21

Source Code Embedding

Some blog/CMS systems do not support syntax highlighting of source code, so users embed highlighted code from pastebins like gist.github.com or phorkie.

Pastebin sites often provide JavaScript embed code to make it as easy as possible to embed code in own HTML documents.

Differences between pastebin views and embeds

It can be necessary to have different markup for embedded source code and the source code display in the pastebin tool.


Pastebin software