Skip to content

Instantly share code, notes, and snippets.

lucasfais / gist:1207002
Created Sep 9, 2011
Sublime Text 2 - Useful Shortcuts
View gist:1207002

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
hrldcpr /
Last active Jun 9, 2021
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

signed0 / gist:2031157
Created Mar 13, 2012
Google Polyline encoder & decoder
View gist:2031157
'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
for more information.
akhenakh /
Created Jun 19, 2012
flask jsonify with support for MongoDB from tools import jsonify
import simplejson as json
except ImportError:
import json
except ImportError:
raise ImportError
import datetime
from bson.objectid import ObjectId
from werkzeug import Response
mbostock / .block
Last active Feb 25, 2020
Margin Convention
View .block
license: gpl-3.0
springmeyer / re-concoct.xml
Created Aug 27, 2012
Re-implement the visualization from in one fell swoop using Mapnik 2.1
View re-concoct.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- compositing mode: -->
<!ENTITY comp_op "darken">
<!-- leave blank to render all data or set to some integer to render faster -->
<!ENTITY row_limit "">
<!-- size of marker ellipse -->
tylermenezes / remove-rdio-garbage.js
Created Dec 9, 2012
Removes unavailable and preview albums from rdio. This is particularly useful after using the "Sync" feature, since it's useless and generates hundreds of "Unavailable" albums. Scroll to the bottom of your collection first, since it's lazy loaded.
View remove-rdio-garbage.js
var i = 0;
var count = $('.Album.unavailable,.Album.preview').length;
console.log('Found ' + count + ' albums to remove');
var timeout = 0;
var instance_i = i++;
var album = $(this);
mbostock / .block
Last active Sep 26, 2018
Projected TopoJSON
View .block
license: gpl-3.0
height: 800
jdiscar / gist:9144764
Last active Nov 11, 2020
RGB Value to Nearest Color Name (Python)
View gist:9144764
Original Author Ernesto P. Adorio, Ph.D
Original Source:
Modifed By: JDiscar
This class maps an RGB value to the nearest color name it can find. Code is modified to include
ImageMagick names and WebColor names.
1. Modify the minimization criterion to use least sum of squares of the differences.
2. Provide error checking for input R, G, B values to be within the interval [0, 255].
gka / index.html
Last active Dec 10, 2019
Parliament seating diagrams
View index.html
<!DOCTYPE html>
<script src=""></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
path { stroke: red; fill: none; stroke-width:2; opacity: 0.4}