Skip to content

Instantly share code, notes, and snippets.

View ahlusar1989's full-sized avatar
🏀
Let's Go!

Saran Ahluwalia ahlusar1989

🏀
Let's Go!
View GitHub Profile
@ahlusar1989
ahlusar1989 / livemap.py
Last active August 29, 2015 14:25 — forked from dbr/livemap.py
Live Google Map marker update with Tornado
"""Playing with tornado.websocket, to add markers to a Google Map using WebSockets
$ pip install tornado
$ python livemap.py --port=8888
Open http://localhost:8888 in one window
Each time http://localhost:8888/ping is opened in a second window, a
new marker is added to the map (at a random location)
@ahlusar1989
ahlusar1989 / README.md
Last active August 29, 2015 14:16 — forked from anonymous/README.md

Part 1

Proof of concept

Say, you want to save your D3 application in a CouchDB database. This is just a proof of concept that this is possible. I use the »Focus + Context« diagram by Mike Bostock (http://bl.ocks.org/1667367) as an example.

Prerequisites:

@ahlusar1989
ahlusar1989 / index.html
Last active August 29, 2015 14:16 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
margin: 0;
background: #222;
min-width: 960px;
}
# BEWD2 optimized solution for 99 bottles
def pluralize(word, count)
"#{count} #{word}#{'s' unless count == 1}"
end
def sing_bottles(count)
pluralized_count = pluralize("bottle", count)
puts "#{pluralized_count} of beer on the wall"
puts "#{pluralized_count} of beer"
puts "#{pluralize("bottle", count - 1)} of beer on the wall!"