Skip to content

Instantly share code, notes, and snippets.

@schacon
schacon / showme
Created February 17, 2011 18:26 — forked from maddox/showme
#!/usr/bin/env ruby
#
# SHOW ME
# Takes X pictures of you via your iSight, animates them, uploads them to CloudApp, and puts
# the url in your clipboard
#
# This uses a bunch of projects to make the magic happen, mostly thanks
# to Zach Holman: http://github.com/holman
#
#
@schacon
schacon / ruby_c_ext.txt
Created December 19, 2010 06:46
Ruby C Extension Articles
README.ext
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_8_6/README.EXT?revision=12055
Extending Ruby - Pickaxe
http://ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html
Extending Ruby on O'Reilly
http://onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html
Ruby C Extensions - Mark Volkman
@schacon
schacon / README.txt
Created December 16, 2010 23:37
cijoe hooks
cijoe hooks
@schacon
schacon / classy_git.md
Created November 12, 2010 20:48
RubyConf Talk

!SLIDE title-slide .notes first slide

First Slide

!SLIDE bullets incremental transition=fade .notes something something something something something something something something something something something something something something something dark side

Second Slide

@schacon
schacon / bitbucket.js
Created November 4, 2010 04:20
BitBucket FireSheep Handler
register({
name: "BitBucket",
domains: [ "bitbucket.org" ],
sessionCookieNames: [ "sessionid" ],
identifyUser: function () {
var resp = this.httpGet(this.siteUrl);
this.userName = resp.body.querySelectorAll('#main-nav ul li a span')[1].innerHTML.replace(/\(/, "").replace(/\)/, "");
var resp2 = this.httpGet(this.siteUrl + this.userName + '/');
this.userAvatar = resp2.body.querySelector('dl.userinfo dd img').src
git filter-branch --index-filter 'git rm --cached --ignore-unmatch -r -- dir1 dir2 fileA fileB'
#! /usr/bin/env ruby
# this script takes your current commit, finds all the submodules in it,
# makes them static files in a new tree and updates a branch called 'heroku'
# - this way you can push a project with submodules to heroku easily
# just run this, then run "git push heroku heroku:master"
current_commit = `git rev-parse HEAD`
current_tree = `git rev-parse HEAD^{tree}`
puts "Starting at tree #{current_tree}"
@schacon
schacon / author_stats.rb
Created July 22, 2010 21:37
used to see how much outside contribution we have from gitstats output
#! /usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'pp'
exclude = ["Author", "defunkt", "Chris Wanstrath", "Kyle Neath", "PJ Hyett", "Scott Chacon", "Tom Preston-Werner", "tekkub", "Tekkub", "Ryan Tomayko"]
Dir.glob("*").each do |d|
if !File.file?(d)
puts d
stats = {:authors => 0, :percent => 0.0, :commits => 0, :lines => 0}
/* Facebook-style buttons by @DHS */
.inputbutton {
background: #3b5998;
color: white;
padding: 2px 18px 3px 18px;
border-top: 1px white solid;
border-left: 1px white solid;
border-right: 1px #000033 solid;
border-bottom: 1px #000033 solid;