This file contains hidden or 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
# myapp.rb | |
require 'rubygems' | |
require 'sinatra' | |
get '/' do | |
'Hello world!' | |
end |
This file contains hidden or 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
irb(main):011:0> a = "abcd" | |
=> "abcd" | |
irb(main):012:0> a[1,1] = a[2,1] | |
=> "c" | |
irb(main):013:0> a | |
=> "accd" |
This file contains hidden or 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
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) |
This file contains hidden or 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
require 'rubygems' | |
require 'sinatra' | |
configure do | |
set :data, "none" | |
end | |
before do | |
content_type 'text/plain', :charset => 'utf-8' | |
request.env['PATH_INFO'].gsub!(/\/$/,'') |
This file contains hidden or 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
gem "sinatra", "0.9.4" | |
gem "scrappy", "0.1", :git => "git://internal.com/scrappy/mainline.git" |
This file contains hidden or 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
class Jay | |
def a; puts 'a' end | |
end | |
class Jay | |
define_method(:b) { puts 'b' } | |
end | |
Jay.class.send(:define_method, :c) { puts 'c' } |
This file contains hidden or 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
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 } | |
This file contains hidden or 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 | |
# 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 |
This file contains hidden or 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
$("mvn exec:exec -Dexec.args=\"jar $JOB_JAR com.attinteractive.hadoopjobs.searchtools.stage1.Stage1 $1 $2\"") |
This file contains hidden or 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
require 'magic_xml' | |
require 'trollop' | |
require 'open-uri' | |
require 'forkoff' | |
# Installation: | |
# | |
# gem install magic_xml trollop forkoff | |
# | |
# Get your delicious bookmark backup with: |