This file contains hidden or 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
| /* | |
| * Full example here: http://jsfiddle.net/jboesch26/3SKsL/1/ | |
| */ | |
| $.fn.outerHTML = function(){ | |
| // IE, Chrome & Safari will comply with the non-standard outerHTML, all others (FF) will have a fall-back for cloning | |
| return (!this.length) ? this : (this[0].outerHTML || ( | |
| function(el){ | |
| var div = document.createElement('div'); |
This file contains hidden or 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 | |
| function usage { | |
| echo "Usage: distractions [on/off]" | |
| exit | |
| } | |
| if [ $# -eq 0 ]; then | |
| usage | |
| fi |
This file contains hidden or 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
| Vows: http://vowsjs.org/ | |
| SASS: http://sass-lang.com/ | |
| SSHGuard (pretty decent layout): http://www.sshguard.net/ | |
| Django Haystack: http://haystacksearch.org/ | |
| twelvesouth (products not project, but still): http://www.twelvesouth.com/ |
This file contains hidden or 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 | |
| # simple shmsetup script | |
| page_size=`getconf PAGE_SIZE` | |
| phys_pages=`getconf _PHYS_PAGES` | |
| shmall=`expr $phys_pages / 2` | |
| shmmax=`expr $shmall \* $page_size` | |
| echo kernel.shmmax = $shmmax | |
| echo kernel.shmall = $shmall |
This file contains hidden or 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
| # Class that can help django-piston process multiple types of authentication | |
| # Example usage: | |
| # | |
| # from piston.authentication import HttpBasicAuthentication | |
| # from somewhere import OtherCustomAuthModule | |
| # | |
| # httpAuth = HttpBasicAuthentication(realm="CycleCloud") | |
| # otherAuth = OtherCustomAuthModule() | |
| # | |
| # auth = MultiAuthentication([httpAuth, otherAuth]) |
This file contains hidden or 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
| """ | |
| Straight Include template tag by @HenrikJoreteg | |
| Django templates don't give us any way to escape template tags. | |
| So if you ever need to include client side templates for ICanHaz.js (or anything else that | |
| may confuse django's templating engine) You can is this little snippet. | |
| Just use it as you would a normal {% include %} tag. It just won't process the included text. |
This file contains hidden or 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 django.db.models.signals import post_init | |
| def track_data(*fields): | |
| """ | |
| Tracks property changes on a model instance. | |
| The changed list of properties is refreshed on model initialization | |
| and save. | |
| >>> @track_data('name') |
This file contains hidden or 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
| GitHub.TreeSlider = function () { | |
| if (window.history && window.history.pushState) { | |
| function a() { | |
| if (e.sliding) { | |
| e.sliding = false; | |
| $(".frame-right").hide(); | |
| $(".frame-loading:visible").removeClass("frame-loading") | |
| } | |
| } | |
| if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { |
This file contains hidden or 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
| au BufNewFile,BufRead *.js set makeprg=gjslint\ % | |
| " The ^G at the end is an actual <Ctrl-G> char. | |
| " Gist won't let me include it, so you'll have to delete the last two characters | |
| " and insert it yourself with <Ctrl-V><Ctrl-G> | |
| au BufNewFile,BufRead *.js set errorformat=%-P-----\ FILE\ \ :\ \ %f\ -----,Line\ %l\\,\ E:%n:\ %m,%-Q,%-GFound\ %s,%-GSome\ %s,%-Gfixjsstyle%s,%-Gscript\ can\ %s,%-G^G |
This file contains hidden or 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
| import simplejson | |
| from django.contrib.sessions.backends.base import SessionBase, CreateError | |
| from django_ext.redis_helper import get_redis | |
| class SessionStore(SessionBase): | |
| """ | |
| A Redis-based session store. |