- GitHub Staff
- http://zerowidth.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming you have the +bash_completion variant of git installed (macports) | |
# and are including bash completion's setup: | |
if [ -f /opt/local/etc/bash_completion ]; then | |
. /opt/local/etc/bash_completion | |
fi | |
TEXT_BLACK='\[\e[0;30m\]' # Black - Regular | |
TEXT_RED='\[\e[0;31m\]' # Red | |
TEXT_GREEN='\[\e[0;32m\]' # Green | |
TEXT_YELLOW='\[\e[0;33m\]' # Yellow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "servolux" | |
require "net/http" | |
require "uri" | |
# see: http://github.com/aniero/rack-streaming-proxy for the latest code | |
# or: sudo gem install rack-streaming-proxy --source http://gemcutter.org | |
module Rack | |
class StreamingProxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
>> module A; end | |
=> nil | |
>> module B; end | |
=> nil | |
>> module C; end | |
=> nil | |
>> module B; include A; end | |
=> B | |
>> class X; include B; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentDocument | |
include MongoMapper::Document | |
# parent document has ... well, whatever. | |
timestamps! | |
many :nodes do | |
# root documents only | |
def roots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def foo | |
"foo!" | |
end | |
end | |
class B < A | |
def foo | |
lambda { super } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as of 2010-04-01 | |
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/mysql/bin:$PATH:/Users/nathan/scripts | |
export PATH=/Users/nathan/bin:/Users/nathan/bin/gitflow:/opt/local/lib/postgresql84/bin:$PATH | |
export LD_LIBRARY_PATH=/opt/local/lib | |
# export EDITOR="/Users/nathan/bin/mate_wait" | |
# export EDITOR="/Users/nathan/bin/mvim -f" # -f means don't fork, wait for changes | |
export EDITOR="/opt/local/bin/vim -f" | |
# export EDITOR="/opt/local/bin/mvim -f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Force ActiveRecord to insert the 'DEFAULT' literal for columns which | |
# are non-null but do not have a default that AR understands. | |
# | |
# MySQL is lenient in that if you insert a NULL in something with a default, | |
# the database will just insert the default anyway. Postgres is not so kind: | |
# it'll do exactly what you told it, causing an error. | |
# Usually AR can figure out the default for a column, but if it's a default | |
# value that the connection adapter can't figure out, it'll insert a NULL. | |
# So: allow explicit 'DEFAULT' literals (which is SQL standard) to be used instead | |
# where appropriate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# try out cloning and pushing using a working copy in git | |
# | |
function log() { | |
echo | |
echo "***** $1" | |
echo | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# git post-receive hook that posts the log messages to pivotal tracker | |
# for automatic updates of stories. | |
# See http://www.pivotaltracker.com/help/api?version=v3#scm_post_commit | |
# for more information | |
require "cgi" | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A rough example of how I'm putting module method overrides to use. | |
# This allows me to add functionality to methods without having to | |
# do method aliasing, and it's easy to enable/disable things too. | |
module Search | |
def search(query, opts={}) | |
request("search", :query => query).results | |
end | |
end |