Skip to content

Instantly share code, notes, and snippets.

View sjl's full-sized avatar

Steve Losh sjl

View GitHub Profile
Index: templatetags/fb_versions.py
===================================================================
--- templatetags/fb_versions.py (revision 692)
+++ templatetags/fb_versions.py (working copy)
@@ -11,6 +11,7 @@
# filebrowser imports
from filebrowser.settings import MEDIA_ROOT, MEDIA_URL, VERSIONS
+from filebrowser.fields import FileBrowseField
from filebrowser.functions import path_to_url, get_version_path, version_generator
@sjl
sjl / filebrowser.diff
Created June 1, 2011 19:59
Allow empty values in FileBrowseField's with blank=True, null=False
diff --git a/filebrowser/fields.py b/filebrowser/fields.py
--- a/filebrowser/fields.py
+++ b/filebrowser/fields.py
@@ -96,10 +96,12 @@
return FileObject(url_to_path(value))
def get_db_prep_value(self, value, connection, prepared=False):
if value is None:
return None
+ if not value:
@sjl
sjl / gist:1020132
Created June 11, 2011 01:07
threesome.vim documention

Threesome is a Vim plugin for resolving conflicts during three-way merges. It's designed to be used as a merge tool for version control systems like Mercurial and Git.

  • Basic Usage
  • Key Bindings
  • Modes
  • Configuration
  • Contributing
  • Changelog
(defn palindrome? [coll]
(= coll
(reverse coll)))
(defn n-digit-ints [n]
(range (expt 10 (- n 1))
(expt 10 n)))
(defn p4 [n]
(defn- read-packet-playerpositionlook [bot conn]
(let [payload (assoc {}
:x (-read-double conn)
:stance (-read-double conn)
:y (-read-double conn)
:z (-read-double conn)
:yaw (-read-float conn)
:pitch (-read-float conn)
:onground (-read-bool conn))]
(dosync (alter (:player bot) merge {:location payload}))
Allow me to add a link to a "sub data file" into any other data file, along with its password.
That way I can access all the passwords inside with only my own password.
Steve's password +-------> Dumbwaiter's Password
| | |
V | V
Stevelosh.data +-------> Dumbwaiter Design.data
| | |
+- Stored passwords | +- Stored Passwords
| |
[merge-tools]
keepthat.executable = sh
keepthat.args = -c 'cp $local $output.original && cp $other $output'
keepthat.premerge = True
[alias]
merge-preferring-theirs = merge --tool keepthat
@sjl
sjl / jquerytest.cljs
Created July 21, 2011 14:05 — forked from ryancrum/jquerytest.cljs
How to use jQuery from ClojureScript
(ns jquerytest.core)
(def jquery (js* "$"))
; Can you not use the short form?
(jquery
(fn []
(-> (jquery "div.meat")
(.html "This is a test.")
(.append "<div>Look here!</div>"))))
@sjl
sjl / gist:1118817
Created August 1, 2011 19:26
OS X Text Editor Waves

Pre- OS X

  • BBEdit
  • Vim
  • Emacs

2003/2004

  • TextMate
  • SubEthaEdit
class Vi < Plugin
@mode = 'normal'
class << self; attr_accessor :mode; end
def self.normal?
lambda { return Vi.mode == 'normal'}
end
def self.insert?
lambda { return Vi.mode == 'insert'}