Opinions are like assholes, every one has got one.
This one is mine.
Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.
| function params(fn) { | |
| var str = fn.toString(); | |
| var sig = str.match(/\(([^)]*)\)/)[1]; | |
| if (!sig) return []; | |
| return sig.split(', '); | |
| } | |
| console.api = function(obj){ | |
| console.log(); | |
| var proto = Object.getPrototypeOf(obj); |
| # uncomment this line to use Consumer Home in offline mode | |
| export SUPPORT_OFFLINE=false | |
| # Ruby 1.9.3 Ruby GC settings | |
| export RUBY_GC_MALLOC_LIMIT=800000000 # 800,000,000 (100x 8,000,000) | |
| export RUBY_HEAP_FREE_MIN=4960 # 4,960 (11x 4,096) | |
| export RUBY_HEAP_MIN_SLOTS=5000000 # 5,000,000 (500x 10,000) | |
| export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 # 1 | |
| export RUBY_HEAP_SLOTS_INCREMENT=5000000 # 5,000,000 (500x 10,000) |
| # Update `/etc/my.cnf` file to add these two lines | |
| [mysqld] | |
| # | |
| # * Basic Settings | |
| # | |
| skip-external-locking | |
| skip-name-resolve |
| # In the model | |
| class Foo < ActiveRecord::Base | |
| default_scope Hash.new {|hash, key| key == :conditions ? {:baz => I18n.locale.to_s } : nil } | |
| named_scope :bar, lambda { { :conditions => { :bar => 1..10 } } } | |
| end | |
| # In action | |
| ree-1.8.7-2010.02 > I18n.locale = 'fr' | |
| => "fr" | |
| ree-1.8.7-2010.02 > Foo.bar |
| # Solution to Vagrant's ["hostonlyif", "create"] problem: | |
| sudo /Library/StartupItems/VirtualBox/VirtualBox restart |
| (function (root) { | |
| var type = function (o) { | |
| // handle null in old IE | |
| if (o === null) { | |
| return 'null'; | |
| } | |
| // handle DOM elements |
| #!/usr/bin/perl | |
| use Mysql; | |
| use strict; | |
| use vars qw($school_name); | |
| use vars qw($pass); | |
| require "./cgi-lib.pl"; |
| gifify() { | |
| if [[ -n "$1" ]]; then | |
| if [[ $2 == '--good' ]]; then | |
| ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png | |
| time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif | |
| rm out-static*.png | |
| else | |
| ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif | |
| fi | |
| else |
| #!/usr/bin/env bash | |
| repo=$1 | |
| rm -fr /tmp/gpm \ | |
| && mkdir /tmp/gpm \ | |
| && cd /tmp/gpm \ | |
| && curl -#L https://github.com/$repo/tarball/master \ | |
| | tar zx --strip 1 \ | |
| && make install |