Skip to content

Instantly share code, notes, and snippets.

@davidszotten
davidszotten / webadmin_hack.js
Last active August 29, 2015 13:55
neo4j webadmin bookmarklet
// 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;
}
@davidszotten
davidszotten / iterxml.py
Created August 22, 2013 21:40
socket server for parsing streaming xml
""" 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
@davidszotten
davidszotten / verify_pull_requests.sh
Created November 1, 2012 10:26
Verify that a list of pull requests have been merged into a given branch
#!/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)" ]
"""
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
@davidszotten
davidszotten / gist:1091866
Created July 19, 2011 09:51
fabric bash completion
# 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}) )
@davidszotten
davidszotten / external.js
Created May 12, 2011 09:17
draft coding standards
(function() {
})();