Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash -e
if [[ $# -ne 1 ]]; then
echo "Simultaneous SSH session in tmux panes, courtesy of knife search"
echo "Usage: knifemux [knife search expression]"
exit 1
fi
tmux start-server
tmux new-session -d -s knifemux
rbenv-use() { rbenv shell `rbenv versions | sed 's/\*/ /' | awk '{print $1}' | grep "$1" | head -1`; }
# coding: utf-8
# Can ruby have method names have newlines/be crazy?
class BadKitty
FACE = "
|\\_/|
/ @ @ \\
( > º < )
`>>x<<´
@rafer
rafer / file1.txt
Created June 11, 2013 19:26
Test from Api
The content
@rafer
rafer / file1.txt
Created June 11, 2013 19:25
Test from Api
The content
@rafer
rafer / file1.txt
Created June 11, 2013 19:24
Test from Api
The content
class Thing
include Mongoid::Document
field :integer_field, :type => Integer
field :big_decimal_field, :type => BigDecimal
field :date_field, :type => Date
end
thing = Thing.new
class Product
def list_price=(price)
write_price(:list_price, price)
end
def sales_price=(price)
write_price(:sales_price, price)
end
private
require "open-uri"
loop do
begin
open("http://google.com", :read_timeout => 5)
rescue
puts "Timed out at #{Time.now}"
next
end
@rafer
rafer / question_18.rb
Created April 14, 2011 20:41
ROB 4/14/2011 Trivia: Question 18
# Question 18A. What happens when the following is run?
lambda { |i,j| }.call(1,2,3)
# Question 18B. What happens when the following is run?
Proc.new { |i,j| }.call(1,2,3)