Skip to content

Instantly share code, notes, and snippets.

@schacon
schacon / gist:1
Created July 15, 2008 18:17
the meaning of gist
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
@schacon
schacon / gist:20
Created July 20, 2008 19:17 — forked from mojombo/wtf.rb
.,mlkmlkml
#!/bin/sh
git stash
git symbolic-ref HEAD refs/heads/$1
rm .git/index
git clean -f -d
# (via johnw)
@schacon
schacon / GitUseCases.txt
Created July 21, 2008 23:30 — forked from sr/GitUseCases.txt
formatted nicer
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,
@schacon
schacon / gistie.rb
Created July 22, 2008 14:17 — forked from anonymous/gistie
create a gist on the command line
#!/usr/bin/env ruby
require "tempfile"
GIST_URL = 'http://gist.github.com/gists'
if ARGV.include? "-p"
text = `pbpaste`
elsif !ARGV.empty?
@filename = ARGV.shift
text = File.read(File.expand_path(@filename))
;; Issac Trotts' demonstration of pattern matching in Nu
(function people-to-string (people)
(match people
(() "no people")
((p1) "one person: #{p1}")
((p1 p2) "two people: #{p1} and #{p2}")
(else "too many people: #{(people length)}")))
(assert_equal "no people"
From 1feae123089ec8c205c805edbe58f63f4c3cfe14 Mon Sep 17 00:00:00 2001
From: Scott Chacon <schacon@gmail.com>
Date: Wed, 6 Aug 2008 12:35:34 -0700
Subject: [PATCH] updated grit to use the working directory for status
---
vendor/gems/grit/lib/grit/repo.rb | 2 ++
vendor/gems/grit/lib/grit/status.rb | 32 +++++++++++++++++---------------
2 files changed, 19 insertions(+), 15 deletions(-)
@schacon
schacon / example_gist_create.rb
Created August 6, 2008 20:29
gist example api post
require 'net/http'
require 'uri'
# /api/v1/:format/new
# /api/v1/:format/gists/:user
# /api/v1/:format/:gist_id
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'),
{ 'files[file1.ab]' => 'CONTNETS',
'files[file2.ab]' => 'contents' })
test gist
test gist