Skip to content

Instantly share code, notes, and snippets.

# myapp.rb
require 'rubygems'
require 'sinatra'
get '/' do
'Hello world!'
end
irb(main):011:0> a = "abcd"
=> "abcd"
irb(main):012:0> a[1,1] = a[2,1]
=> "c"
irb(main):013:0> a
=> "accd"
def debug_line(*list)
ret = "Debug: "
0.step(list.length - 2, 2) do |x|
label, value = list[x,x+2]
ret += "#{label} = '#{value}', "
end
puts ret
end
debug_line("a", 10, "b", 20)
require 'rubygems'
require 'sinatra'
configure do
set :data, "none"
end
before do
content_type 'text/plain', :charset => 'utf-8'
request.env['PATH_INFO'].gsub!(/\/$/,'')
gem "sinatra", "0.9.4"
gem "scrappy", "0.1", :git => "git://internal.com/scrappy/mainline.git"
class Jay
def a; puts 'a' end
end
class Jay
define_method(:b) { puts 'b' }
end
Jay.class.send(:define_method, :c) { puts 'c' }
class Jay
def talk
puts 'hi'
end
end
def make_say(msg, &b)
Jay.send(:alias_method, :orig_talk, :talk)
Jay.send(:define_method, :talk) { puts msg }
@jaydonnell
jaydonnell / emacs setup script
Created April 6, 2010 19:06
emacs setup script
#!/bin/bash
# run this from your home directory
mkdir -p projects
cd projects
git clone git://github.com/technomancy/emacs-starter-kit.git
cd ..
ln -s projects/emacs-starter-kit .emacs.d
$("mvn exec:exec -Dexec.args=\"jar $JOB_JAR com.attinteractive.hadoopjobs.searchtools.stage1.Stage1 $1 $2\"")
require 'magic_xml'
require 'trollop'
require 'open-uri'
require 'forkoff'
# Installation:
#
# gem install magic_xml trollop forkoff
#
# Get your delicious bookmark backup with: