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/bash | |
perl -pi -e 's#\s*\n#\n#g' $@ |
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/bash | |
git diff --name-only master db/migrate/ | sed "s/migrate\//migrate\n/" | grep -v migrate | sed "s/\_/\n/" | grep -v rb | xargs -I vnum rake db:migrate:down VERSION=vnum |
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
/* | |
* Simple JS subclassing, shamelessly stolen from | |
* http://kevinoncode.blogspot.com/2011/04/understanding-javascript-inheritance.html | |
*/ | |
function Super() { | |
this.value = 42; | |
} | |
function Sub(parent) { |
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
[diff "bz2"] | |
binary = true | |
textconv = /bin/bzcat | |
[diff "gzip"] | |
binary = true | |
textconv = /bin/zcat | |
[diff "tar"] | |
binary = true | |
textconv = tar --to-stdout -xf | |
[diff "tar-bz2"] |
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
# encoding: UTF-8 | |
module Kernel | |
alias_method :λ, :lambda | |
end | |
=begin | |
Allows code like this, using the actual Greek λ character: |
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 | |
# vehicle.rb | |
class Vehicle | |
MEDIUM = :ground | |
def self.medium; self::MEDIUM; end | |
# Using MEDIUM instead of self::MEDIUM makes Aircraft use the ground | |
end | |
class Car < Vehicle; 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
#!/usr/bin/env ruby | |
# liberal_sort_by.rb | |
class Array | |
def liberal_sort | |
liberal_sort_by { |x| x } | |
end | |
def liberal_sort_by(&block) | |
pertains, others = partition(&block) | |
pertains.sort_by(&block) + others |
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 | |
# libertarianism_made_easy.rb | |
module LibertarianismMadeEasy | |
attr_accessor :is_government | |
def acceptable_to?(some_action) | |
not is_government | |
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
:abbr teh the |
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
augroup filetypedetect | |
au! BufRead,BufNewFile *.asd setfiletype lisp | |
au! BufRead,BufNewFile *.cgi setfiletype ruby | |
au! BufRead,BufNewFile *.dbk setfiletype xml | |
au! BufRead,BufNewFile *.rb_txt setfiletype ruby | |
au! BufRead,BufNewFile *.rbx setfiletype ruby | |
au! BufRead,BufNewFile *.ly setfiletype tex | |
augroup END |
NewerOlder