(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
# 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 |
// | |
// 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; | |
# Newbie Programmer | |
def factorial(x) | |
if x == 0 | |
return 1 | |
else | |
return x * factorial(x - 1) | |
end | |
end | |
puts factorial(6) | |
puts factorial(0) |
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(" ") |
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 |
#!/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 |
#!/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 |
namespace :deploy do | |
def config(key) | |
(@config ||= YAML.load_file("config/deploy.yml").symbolize_keys)[key.to_sym] | |
end | |
# Hooks as needed | |
task :local_before do | |
end |