code

From IndieWeb
Jump to: navigation, search

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.

Contents

Source Code hosting

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.

Software

Software you can use to host your own Git repository:

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

phorkie paste.png

Use case: Work with and modify the paste. Single files have edit and "raw" view buttons, maybe more. File names are important and are shown before the code itself.

Example: http://p.cweiske.de/160


Embeds

Use case: Show a bit of colorful source code, but don't get in the way. No edit buttons. File names are unimportant, so show them after the code.

Example: http://cweiske.de/tagebuch/phorkie-0.5.0.htm#embed

phorkie embed.png

See Also

Brainstorming

Cross-site fork buttons

Cweiske.de 13:00, 20 March 2014 (PDT)

Instead of the usual "fork me on github" buttons, projects should use a more general "fork me" button.

It should fork the code onto the user's preferred git server instead of a silo. The button could either work like subtome, showing a list of services that support remote forking, or simply use a custom protocol like "web+fork://" that web sites can register itself as HTML5 protocol handler.

The URL syntax could be like the feed uri syntax:

web+fork:https://example.org/project.htm

The linked URL could be the homepage of the project, with embedded rel-vcs links that provide the git:// or http:// URLs to the git repository. Or it could be the git repository URL itself. phorkie supports remote forking via rel-vcs since version 0.3.1. See the blog post for a description of the process.

Retrieved from "http://indieweb.org/code"
Personal tools
Namespaces
Variants
Actions
Recent & Upcoming
Resources
Toolbox