Skip to content

Instantly share code, notes, and snippets.

View danvk's full-sized avatar

Dan Vanderkam danvk

View GitHub Profile
<script src="http://fb.me/react-0.11.2.js"></script>
<script src="http://fb.me/JSXTransformer-0.11.2.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<div id="content"></div>
<script type="text/jsx;harmony=true">
/** @jsx React.DOM */
var Root = React.createClass({
<script src="http://fb.me/react-0.11.2.js"></script>
<script src="http://fb.me/JSXTransformer-0.11.2.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<div id="content"></div>
<script type="text/jsx;harmony=true">
/** @jsx React.DOM */
var Root = React.createClass({
nav.navigation {
font-size: 12px;
position: absolute;
top: 0; left: 0; right: 0;
background: #fefefe;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
nav.navigation ul {
margin: 0;
padding: 0;
#!/usr/bin/env python
'''
DEPENDENCIES:
$ brew install ffmpeg
$ brew install imagemagick
$ python ./mov2gif.py input.mov output.gif 15
'''
class IgnoreSubtree(Exception):
pass
def preorder_traversal(obj):
try:
yield obj
except IgnoreSubtree:
return
if isinstance(obj, dict):
#!/usr/bin/env python
import sys
class IgnoreSubtree(Exception):
pass
def preorder_traversal(obj):
try:
yield obj
except IgnoreSubtree:
#!/usr/bin/env python
class IgnoreSubtree(Exception):
pass
def preorder_traversal(obj):
try:
yield obj
except IgnoreSubtree:
return
else:
import struct
class Square(object):
def __init__(self, char):
self.char = char
self.down = None
self.across = None
def __repr__(self):
return self.char
#!/usr/bin/env python
'''Print out start:stop locations for each reference in a BAI file.'''
import json
import struct
import sys
# -- helper functions --
def unpack(stream, fmt):
size = struct.calcsize(fmt)
@danvk
danvk / wc.py
Created October 24, 2014 20:36
import sys
si = sys.stdin
CHUNK_SIZE = 100000
n = 0
while True:
b = si.read(CHUNK_SIZE)
if not b: