Skip to content

Instantly share code, notes, and snippets.

View froderik's full-sized avatar

Fredrik Rubensson froderik

View GitHub Profile
func extractLatLng(data []byte) (float64, float64) {
res := make(map[string][]map[string]map[string]map[string]interface{}, 0)
json.Unmarshal(data, &res)
lat, _ := res["results"][0]["geometry"]["location"]["lat"].(float64)
lng, _ := res["results"][0]["geometry"]["location"]["lng"].(float64)
return lat, lng
}
@froderik
froderik / pomo.rb
Created September 13, 2011 07:58
tiny pomodoro clock
#!/usr/bin/ruby
STDOUT.sync = true #makes print flush
now = Time.new
twentyfive = now + 25*60
puts "pomodoro ends #{twentyfive}"
while now < twentyfive do
sleep 1
now = Time.new
print "."
end
@froderik
froderik / application.haml
Created May 12, 2011 15:09
typical layout file for a rails app with tiny mce and jquery
%html
%head
%title
Inline Tiny MCE example
= stylesheet_link_tag :all
= javascript_include_tag 'jquery'
= javascript_include_tag 'rails'
= javascript_include_tag 'application'
= include_tiny_mce_if_needed
= csrf_meta_tag