This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Python Template Markup Language | |
# Simple Python DSL for HTML and (a little) CSS templating. | |
# | |
# Example: | |
# | |
# from ptml import * | |
# | |
# with html5 as out: | |
# with head: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Next and Last {{{ | |
" Motion for "next/last object". "Last" here means "previous", not "final". | |
" Unfortunately the "p" motion was already taken for paragraphs. | |
" | |
" Next acts on the next object of the given type in the current line, last acts | |
" on the previous object of the given type in the current line. | |
" | |
" Currently only works for (, [, {, b, r, B, ', and ". | |
" |
Tested against the WebKit git repo by entering the repo with 1 file dirty.
git diff --quiet --ignore-submodules HEAD
# Will tell if there are any uncomitted changes, staged or not.
0.6 sec
git diff-index --quiet HEAD
# Only tracked
2 sec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var empty_list = function(selector) { | |
return selector(undefined, undefined, true); | |
}; | |
var prepend = function(el, list) { | |
return function(selector) { | |
return selector(el, list, false); | |
}; | |
}; | |
var head = function(list) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Passes https://gist.github.com/mrocklin/5722155 | |
def groupby(f, coll): | |
""" Group elements in collection by ``f`` """ | |
d = dict() | |
for item in coll: | |
key = f(item) | |
if key not in d: | |
d[key] = [] | |
d[key].append(item) |
OlderNewer