Skip to content

Instantly share code, notes, and snippets.

01:21 <schacon> well like, lets say you use Emacs, and someone
posts an extension on gists, like this: http://gist.github.com/290
01:22 <schacon> you use it and think it's cool, but add some
features, so you can fork it, make your change and even email
the original author, who can add you as a remote and merge your
change in, or several peoples changes and push back
01:23 <schacon> you have a list of all the gists you've ever made,
and can always go back and edit or update them: http://gist.github.com/mine
01:24 <schacon> if you have a multi-file project, like a little
sinatra app that maybe doesn't warrant it's own github project,
class String
# ANSI-colored version of the string
def colorize(color)
n = case color
when :black: 30
when :red: 31
when :green: 32
when :yellow: 33
when :blue: 34
when :magenta: 35
@sr
sr / Rakefile.rb
Created August 26, 2008 21:40
make a git mirror of an hg repository
RemoteHgRepository = 'http://code.suckless.org/hg/dwm'
RemoteGitRepository = 'git@github.com:sr/dwm.git'
__DIR__ = File.dirname(__FILE__)
Repository = __DIR__ + '/dwm'
GitRepository = __DIR__ + '/dwm-git'
StateFile = __DIR__ + '/hg-to-git-state'
ImportScript = __DIR__ + '/hg-to-git.py'
task :default => :mirror
function is-git? {
git status &> /dev/null
[ $? != 128 ]
}
function git-init-remote {
name=$(basename $PWD).git
path=~/repositories/$name
if is-git?; then
ssh bearnaise.net -t "mkdir $path && cd $path && git --bare init" ||
require File.dirname(__FILE__) + '/code/git-wiki/vendor/sinatra/lib/sinatra'
class Foo < Exception;
error RuntimeError do
"hey!"
end
error Foo do
"fooooo"
@sr
sr / gist:7870
Created August 29, 2008 00:57 — forked from al3x/al3x_ubiquity.js
CmdUtils.CreateCommand({
name: "bitly",
takes: {"url to shorten": noun_arb_text},
preview: "Replaces the selected URL with a bit.ly-shortened URL.",
description: "Replaces the selected URL with a bit.ly-shortened URL.",
icon: "http://bit.ly/favicon.png",
execute: function( urlToShorten ) {
var baseUrl = "http://bit.ly/api";
var params = {url: urlToShorten.text};
jQuery.get(baseUrl, params, function(shortenedUrl) {
@sr
sr / app.rb
Created August 29, 2008 11:50
$rest = RestClient.new('http://foo.org')
get '/' do
$rest.put '/foo'
'hey'
end
all: rdf html
rdf: card.n3
cwm.py card.n3 --rdf > card.rdf
html: head.html foot.html card.n3 foaf2html.n3
cat head.html > index.html
cwm.py card.n3 foaf2html.n3 --think --strings >> index.html
cat foot.html >> index.html
clean:
rm -f card.rdf
rm -f index.html
CmdUtils.CreateCommand(
{
name: "ruby",
takes: {"function": noun_arb_text},
icon: "http://ruby-doc.org/favicon.ico",
homepage: "http://jackndempsey.blogspot.com",
author: {name: "Jack Dempsey", email: "jack.dempsey@gmail.com"},
license: "MPL,GPL",
description: "Search ruby functions documentation",
help: "Select a ruby function",
require 'rubygems'
require 'json'
require 'rest_client'
$:.unshift File.dirname(__FILE__) + '/couch_rest'
module CouchRest
autoload :Server, 'server'
autoload :Database, 'database'
autoload :Pager, 'pager'