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
# Not a real shell file (might work, tho..). I suggest copy-and | |
# paste the lines one by one into a terminal. You need to have | |
# installed the official OS X Python 2.7 from python.org, obviously. | |
cd /Library/Frameworks/Python.framework/Versions/2.7 | |
curl http://peak.telecommunity.com/dist/ez_setup.py -O | |
./bin/python2.7 ez_setup.py | |
./bin/easy_install readline |
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/sh | |
ME=$(dirname $0) | |
function abspath { | |
B=`basename "$1"` | |
echo "`cd \"$ME\" 2>/dev/null && pwd || echo \"$D\"`/$B" | |
} |
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
gen = (clsname, val) -> | |
C = class | |
C.prototype[val] = -> "#{clsname} says #{val}" | |
C | |
Cat = gen 'Cat', 'meow' | |
console.log Cat | |
c = new Cat | |
alert c.meow() |
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 StringIO import StringIO | |
from django.core.handlers.wsgi import WSGIRequest | |
def fake_get(path='/', user=None): | |
req = WSGIRequest({ | |
'REQUEST_METHOD': 'GET', | |
'PATH_INFO': path, | |
'wsgi.input': StringIO()}) | |
from django.contrib.auth.models import AnonymousUser | |
req.user = AnonymousUser() if user is None else user |
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 Expando(object): | |
def __init__(self, *args, **kw): | |
self.__dict__.update(kw) |
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 cms.plugin_pool import plugin_pool | |
# ..in production code: class YourPlugin(CMSPlugin)... | |
# This ensures that the system is aware of your plugin: | |
YrPluginCls = plugin_pool.plugins.get('YourPlugin', None) | |
# ..instantiate: | |
plugin = YrPluginCls() |
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
document.addEventListener('touchend', | |
function (e) { e.preventDefault() if e.target.localName == 'a') }, | |
true); |
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
# See http://braintostring.blogspot.com/2012/01/writing-javascript-modules-for-browser.html | |
foo = exports? and @ or @foo = {} | |
class foo.ExampleClass | |
method: -> 1 | |
foo.func = -> 2 |
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
foo = exports? and exports or @foo = {} | |
do(foo) -> | |
# Being at indent level 1 here makes me uneasy! | |
class foo.Cls | |
meth: -> 1 | |
foo.func = -> 2 |
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
# Doesn't work yet, have patience.. | |
fakeJqOb = new class FakeJqOb | |
constructor: (@els=[]) -> | |
append: (content) => | |
@ap or= [] | |
console.log "Adding #{content}" | |
@ap.push content | |
@ |