(from a scratch install). Kinda, I imported my user home (~) from a Time Machine backup.
sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
| #!/bin/sh -e | |
| # Usage: license | |
| # Prints an MIT license appropriate for totin' around. | |
| # | |
| # $ license > COPYING | |
| #!/bin/sh | |
| echo "Copyright (c) `date +%Y` Chris Wanstrath | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the |
| #!/bin/sh -e | |
| # Usage: license | |
| # Prints an MIT license appropriate for totin' around. | |
| # | |
| # $ license > COPYING | |
| #!/bin/sh | |
| echo "Copyright (c) `date +%Y` Chris Wanstrath | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the |
| var A_reduce = [].reduce; | |
| Array.prototype.reduce = function reduce (callback, initialValue) { | |
| var operator = callback; | |
| return typeof operator == 'string' && /^[ +*/%-><!&|^?,.]/.test(operator) | |
| ? eval(this.join(operator)) | |
| : A_reduce.apply(this, arguments) | |
| }; | |
| [1,2,3,4].reduce('+') // 10 | |
| [1,2,3,4].reduce('*') // 24 |
| require 'parse_tree' | |
| require 'ruby2ruby' | |
| require 'parse_tree_extensions' | |
| require 'shellwords' | |
| class Proc | |
| def to_sh | |
| ruby = `which ruby`.strip | |
| command = Shellwords.shellescape(to_ruby.gsub(/\Aproc \{(.*)\}\Z/m, '\1').strip) | |
| paths = $LOAD_PATH.map {|p| Shellwords.shellescape("-I" + p)}.join(" ") |
| # Newbie Programmer | |
| def factorial(x) | |
| if x == 0 | |
| return 1 | |
| else | |
| return x * factorial(x - 1) | |
| end | |
| end | |
| puts factorial(6) | |
| puts factorial(0) |
| // | |
| // JS Prompt - a Talker plugin <http://talkerapp.com> | |
| // | |
| // to activate/deactivate the js prompt: /prompt | |
| // to share variables amongst users: this.foo = 1; | |
| // | |
| plugin.usage = '/prompt'; | |
| plugin.command = 'prompt'; | |
| plugin.evalMode = false; | |
| # generate random sequence | |
| #SecureRandom also has methods for: base64, hex, bytes, random_number | |
| #see: http://api.rubyonrails.org/classes/ActiveSupport/SecureRandom.html | |
| require 'active_support/secure_random' | |
| ActiveSupport::SecureRandom.hex(16) | |
| # outputs: 6dc19d21e958e04645cddadb96e9c927 |
| .gmap.map-preview | |
| :width 540px | |
| :height 400px | |
| :margin 5px auto | |
| :border 5px solid #DDD | |
| :background #F1F1F1 url('/images/map-placeholder.jpg') center center no-repeat |
| # Put this content to ~/.irbrc file (no extension) | |
| require "rubygems" | |
| begin | |
| require "ap" | |
| rescue LoadError => err | |
| puts "Cannot find awesome_print gem. Please run 'gem install awesome_print' to install it." | |
| end |