Skip to content

Instantly share code, notes, and snippets.

@kmcd
kmcd / sratch.rb
Created August 31, 2012 09:55
Scratch
# Code goes here ...
127.0.0.1 local.leapanywhere.com
127.0.0.1 local.leapcr.com
127.0.0.1 leap.local.leapcr.com
127.0.0.1 test.local.leapcr.com
127.0.0.1 gla.local.leapcr.com
127.0.0.1 logica.local.leapcr.com
127.0.0.1 login.local.leapcr.com
127.0.0.1 demo.local.leapcr.com
127.0.0.1 tony.local.leapcr.com
127.0.0.1 charities.local.leapcr.com
<%= 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>
<h1 class='name'>Hotel California</h1>
<ol class='nav'>
<li><%= link_to 'Hotel', hotels_path %></li>
<li><%= link_to 'Rooms', rooms_path %></li>
</ol>
ol.nav {
padding: 0;
}
ol.nav li {
display: inline;
}
h1.name {
font-size: 4em;
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
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
puts 'testing gist commandline'
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)
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