This file contains 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 -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 |
This file contains 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
rbenv-use() { rbenv shell `rbenv versions | sed 's/\*/ /' | awk '{print $1}' | grep "$1" | head -1`; } |
This file contains 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
# coding: utf-8 | |
# Can ruby have method names have newlines/be crazy? | |
class BadKitty | |
FACE = " | |
|\\_/| | |
/ @ @ \\ | |
( > º < ) | |
`>>x<<´ |
This file contains 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
The content |
This file contains 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
The content |
This file contains 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
The content |
This file contains 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 Thing | |
include Mongoid::Document | |
field :integer_field, :type => Integer | |
field :big_decimal_field, :type => BigDecimal | |
field :date_field, :type => Date | |
end | |
thing = Thing.new |
This file contains 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 Product | |
def list_price=(price) | |
write_price(:list_price, price) | |
end | |
def sales_price=(price) | |
write_price(:sales_price, price) | |
end | |
private |
This file contains 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 "open-uri" | |
loop do | |
begin | |
open("http://google.com", :read_timeout => 5) | |
rescue | |
puts "Timed out at #{Time.now}" | |
next | |
end |
This file contains 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
# 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) |
NewerOlder