View gist:1529115
#!/usr/bin/env bats
load test_helper
setup() {
load_fixture rehash
}
teardown() {
destroy_fixture
View relative_prefix.c
#include <string.h>
#include <stdio.h>
#include <sys/param.h>
#include <stdlib.h>
char *relative_prefix(char *argv0, char *prefix) {
char *file_name, *result;
size_t size;
if (argv0 == NULL) {
View gist:1299584
$ time rbenv install 1.9.2-p290
Downloading https://github.com/downloads/sstephenson/ruby-packages/1.9.2-p290.x86_64-darwin.rubypackage...
Installing 1.9.2-p290...
Installed 1.9.2-p290 to /Users/sam/.rbenv/versions/1.9.2-p290
real 0m18.979s
user 0m1.211s
sys 0m3.334s
View sanitize-variables.bash
#!/usr/bin/env bash
# Reads lines from stdin in the format `VAR=value` and escapes
# them for the shell, prepending each line with `export`.
# Parameter substitution is allowed in `value` with `$VAR` and
# `${VAR}` syntax. You can escape `$` and `\` with a backslash.
sed \
-e "/^[ "$'\t'"]*[A-Za-z_][0-9A-Za-z_]*=/ !d" \
-e "s/'/'\\\\''/g" \
View gist:1143900
# RubyGems has this functionality built-in. Just specify
# the particular version you want to use as the first argument
# of the command, surrounded by underscores.
$ gem install rails --version 3.0.9
...
$ gem install rails --pre
...
$ rbenv rehash
$ rails --version
View date_parse.coffee
# Older browsers do not support ISO8601 (JSON) timestamps in Date.parse
if isNaN Date.parse "2011-01-01T12:00:00-05:00"
parse = Date.parse
iso8601 = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/
Date.parse = (dateString) ->
dateString = dateString.toString()
if matches = dateString.match iso8601
[_, year, month, day, hour, minute, second, zone] = matches
offset = zone.replace(":", "") if zone isnt "Z"
View gist:1120938
# Clone rbenv into ~/.rbenv
git clone git@github.com:sstephenson/rbenv.git ~/.rbenv
# Add rbenv to your PATH
# NOTE: rbenv is *NOT* compatible with rvm, so you'll need to
# remove rvm from your profile if it's present. (This is because
# rvm overrides the `gem` command.)
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile
exec $SHELL
View underpants.coffee
# Extend jQuery objects with Underscore collection methods.
#
# Each collection method comes in two flavors: one prefixed
# with _, which yields a bare DOM element, and one prefixed
# with $, which yields a jQuery-wrapped element.
#
# So if `this` is a jQuery object, instead of:
#
# _.max @, (el) -> $(el).height()
#
View gist:921992
ree-1.8.7-2010.02
-----------------
units: Finished in 0.930402 seconds.
functionals: Finished in 12.241386 seconds.
integration: Finished in 1.648589 seconds.
rake 20.19s user 4.96s system 98% cpu 25.588 total
ruby-1.9.2p180
--------------
units: Finished in 1.504977 seconds.
View config.ru
require File.dirname(__FILE__) + '/config/environment'
run ActionController::Dispatcher.new