Skip to content

Instantly share code, notes, and snippets.

# 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" ]
Net::HTTP.post_form URI.parse('http://github.com/repositories'),
'login' => github_username,
'token' => github_token,
'repository[description]' => summary,
'repository[name]' => project_name
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
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)
puts 'testing gist commandline'
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
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
ol.nav {
padding: 0;
}
ol.nav li {
display: inline;
}
h1.name {
font-size: 4em;
<h1 class='name'>Hotel California</h1>
<ol class='nav'>
<li><%= link_to 'Hotel', hotels_path %></li>
<li><%= link_to 'Rooms', rooms_path %></li>
</ol>
<%= 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>