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
(function() { | |
})(); |
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
# only load the commands when launching shell. | |
# if you make frequent edits to your fab file, consider moving this inside _fab() | |
_fab_commands=$(~/path/to/virtualenv/bin/fab --fabfile=~/path/to/fabfile/fabfile.py --shortlist) | |
_fab() | |
{ | |
local cur prev | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
COMPREPLY=( $(compgen -W "${_fab_commands}" -- ${cur}) ) |
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
""" | |
jQuery templates use constructs like: | |
{{if condition}} print something{{/if}} | |
This, of course, completely screws up Django templates, | |
because Django thinks {{ and }} mean something. | |
Wrap {% verbatim %} and {% endverbatim %} around those | |
blocks of jQuery templates and this will try its best |
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
#!/bin/bash | |
progname=$(basename $0) | |
if [ "$1" = "--setup" ] | |
then | |
origin=$(git config --get remote.origin.url) | |
git remote add pulls $origin | |
git config remote.pulls.fetch "+refs/pull/*/head:refs/remotes/pulls/pr/*" | |
elif [ -z "$(git config --get remote.pulls.url)" ] |
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
""" socket server for parsing streaming xml | |
based on | |
http://stackoverflow.com/a/2270249/105043 and | |
http://eventlet.net/doc/examples.html#echo-server | |
usage: | |
$ python iterxml.py & | |
# push two documents to make sure we can start over | |
$ cat sample.xml sample.xml |nc localhost 6000 |
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
// js to add shortcut to go directly to node view from graph browser | |
// use: got to graph view, and run bookmarklet. once enabled, | |
// hold down cmd and click a node to go to its edit view | |
javascript: (function(){ | |
require('webadmin').modules.browser.view.visualizedView.viz.sys.renderer.bind("node:click", function(node, ev) { | |
var data = node.data; | |
if (typeof data.neoNode === "undefined") { | |
return; | |
} |
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
from __future__ import print_function # want same code for py2/py3 | |
import inspect | |
import sys | |
has_signature = (sys.version_info[:2] >= (3, 3)) | |
BAD_ARGS, GOOD_ARGS = (1, 2) |
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
# `and` doesn't work unfortunately. | |
# python doesn't allow overriding `and` behaviour | |
>>> print Booking.id == 1 and Booking.id == 2 | |
bookings.id = :id_1 | |
>>> print and_(Booking.id == 1, Booking.id == 2) | |
bookings.id = :id_1 AND bookings.id = :id_2 |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <hiredis.h> | |
int main(int argc, char **argv) { | |
unsigned int j; | |
redisContext *conn; | |
redisReply *reply; |
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
Welcome to the profile statistics browser. | |
collection27.prof% sort cu | |
collection27.prof% stats 100 | |
Thu Oct 9 14:08:04 2014 collection27.prof | |
10266541 function calls (9856337 primitive calls) in 10.750 seconds | |
Ordered by: cumulative time | |
List reduced from 12086 to 100 due to restriction <100> |
OlderNewer