Skip to content

Instantly share code, notes, and snippets.

View sjl's full-sized avatar

Steve Losh sjl

View GitHub Profile
@sjl
sjl / fabfile.py
Created September 30, 2011 01:10
PASS_THROUGH = ('sudo password:', '[y/n]')
class CustomStringIO(StringIO):
def write(self, s, *args, **kwargs):
if any(pt in s.lower() for pt in PASS_THROUGH):
sys.__stdout__.write(s)
return super(CustomStringIO, self).write(s, *args, **kwargs)
_stored_out = CustomStringIO()
@sjl
sjl / slimv-verbosefile.log
Created October 2, 2011 00:16
SLIMV Segfault Logs
calling function SlimvConnectServer()
line 1: let repl_buf = bufnr( g:slimv_repl_file )
line 2: let repl_win = bufwinnr( repl_buf )
line 3: if repl_buf == -1 || ( g:slimv_repl_split && repl_win == -1 )
line 4: call SlimvOpenReplBuffer()
calling function SlimvConnectServer..SlimvOpenReplBuffer()
(ns unit02.trees)
; Tree ------------------------------------------------------------------------
;
; A tree is equivalent to a single node.
; A node is basically a map:
;
; {:label :foo :children [... nodes ...]}
@sjl
sjl / gist:1296686
Created October 18, 2011 20:50 — forked from aduston/gist:1296656
unisubs.streamer.StreamBox.prototype.transcriptScrolled_ = function(e) {
if (this.videoScrolling_) {
this.videoScrolling_ = false;
} else {
this.showResyncButton_(true);
this.ignoreVideoScrolling_ = true;
}
};
unisubs.streamer.StreamBox.prototype.scrollIntoView_ = function(streamSub) {
@sjl
sjl / html.vim
Created October 19, 2011 13:51
Tired of your Mustache/Underscore templates in <script type="text/html"> tags getting highlighted as Javascript in Vim? Change line 167 of /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/html.vim to this!
syn region javaScript start=+<script[^>]*type="text/javascript"[^>]*>+ keepend end=+</script>+me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc
diff --git a/README.markdown b/README.markdown
index d34e76b..42029fb 100644
--- a/README.markdown
+++ b/README.markdown
@@ -72,3 +72,12 @@ standard Django one, you just have to run (while the virtualenv is activated):
pip install werkzeug
And then use `./dev-runserver.sh plus` to run it.
+
+### bpython shell
@sjl
sjl / sane_time.py
Created December 26, 2011 20:15
a usable time() in Python
>>> with time(): TeamMember.objects.count()
...
4886
0.00641298294067 seconds
@sjl
sjl / Menlo-ForPowerline.ttc.zip
Created January 17, 2012 18:09
Patched Menlo for Powerline. This one includes the bold, italic, etc variants.
diff --git a/deploy/fabfile.py b/deploy/fabfile.py
index 8efb13b..7f77d67 100644
--- a/deploy/fabfile.py
+++ b/deploy/fabfile.py
@@ -259,6 +259,14 @@ def _git_checkout(commit):
run('chmod g+w -R .git 2> /dev/null; /bin/true')
_clear_permissions('.')
+def _git_checkout_branch_and_reset(commit, branch):
+ run('git fetch')
@sjl
sjl / ui.cljs
Created February 7, 2012 15:27 — forked from srid/ui.cljs
ClojureScript - prependChild implementation using Google Closure
(defn ^:export prependChild
[parent node]
(dom/insertChildAt parent node 0))