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
# Timesheet logging | |
# Just install ts (from moreutils) & add to your ~/.bash_profile or ~/.bashrc, | |
# Usage: | |
# $ tsl 'setting up staging server'. | |
# NB message must be enclosed in quotes to include shell chars (>, >>, | and friends) | |
# $ tsl | |
# Mar 27 11:29:49 'setting up staging server' | |
tsl() { | |
if [ -z "$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
Net::HTTP.post_form URI.parse('http://github.com/repositories'), | |
'login' => github_username, | |
'token' => github_token, | |
'repository[description]' => summary, | |
'repository[name]' => project_name |
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
def euclidean_distance(p1,p2) | |
sum_of_squares = 0 | |
p1.each_with_index do |p1_coord,index| | |
sum_of_squares += (p1_coord - p2[index]) ** 2 | |
end | |
Math.sqrt( sum_of_squares ) | |
end | |
require 'test/unit' | |
class EuclideanDistanceTest < Test::Unit::TestCase |
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 NestedOpenStruct < OpenStruct | |
def initialize(hash=nil) | |
@table = {} | |
if hash | |
for k,v in hash | |
# handle nested hashes | |
if v.is_a? Hash | |
@table[k.to_sym] = NestedOpenStruct.new(v) | |
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
puts 'testing gist commandline' |
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 'socket' | |
require 'psych' | |
class StreamClient | |
def initialize user, pass | |
@ba = ["#{user}:#{pass}"].pack('m').chomp | |
end | |
def listen listener | |
socket = TCPSocket.new 'stream.twitter.com', 80 |
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
kmcd@shinobi culture $ bundle exec cucumber features/ | |
/home/kmcd/.rvm/gems/ruby-1.9.2-p180/bundler/gems/railroad3-54ee4f46ec75/rake.gemspec:2: warning: already initialized constant SPEC | |
/home/kmcd/.rvm/gems/ruby-1.9.2-p180/bundler/gems/railroad3-54ee4f46ec75/rake.gemspec:2: warning: already initialized constant SPEC | |
/home/kmcd/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.1/lib/json/common.rb:66: [BUG] unknown type 0x22 (0xc given) | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] | |
-- control frame ---------- | |
c:0027 p:---- s:0080 b:0080 l:000079 d:000079 CFUNC :initialize | |
c:0026 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC :new | |
c:0025 p:0099 s:0075 b:0073 l:000072 d:000072 METHOD /home/kmcd/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.1/lib/json/common.rb:66 |
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
ol.nav { | |
padding: 0; | |
} | |
ol.nav li { | |
display: inline; | |
} | |
h1.name { | |
font-size: 4em; |
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
<h1 class='name'>Hotel California</h1> | |
<ol class='nav'> | |
<li><%= link_to 'Hotel', hotels_path %></li> | |
<li><%= link_to 'Rooms', rooms_path %></li> | |
</ol> |
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
<%= form_tag(availability_path, :method => :delete) do |form|%> | |
Start: <%= select_date(@start_date, :prefix => :start_date) %> <br/> | |
End: <%= select_date(@end_date, :prefix => :end_date) %> <br/> | |
<%= submit_tag("Check availability") %> | |
<% end %> | |
<table class='availability'> | |
<tr> | |
<th>Date</th> |
OlderNewer