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
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
#!/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
# 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
import py | |
def pytest_generate_tests(metafunc): | |
fargs = {} | |
if 'static' in metafunc.funcargnames: | |
fargs['static'] = 'stays the same' | |
if 'different' in metafunc.funcargnames: | |
for variant in (1,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
def subclass(Cls, name=None): | |
class _(Cls):pass | |
_.__name__ = name or 'subclass' | |
return _ |
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 BaseScreen extends Ext.Panel | |
title: 'Base panel' | |
iconCls: 'info' | |
class Screen1 extends BaseScreen | |
title: 'First screen' | |
html: 'Content of one screen' | |
class Screen2 extends BaseScreen | |
title: 'Second screen' |
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
# Just added a subprocess call to rsync to one of rb-fsevent's example | |
# scripts. Spookily easy. | |
require 'rubygems' | |
require 'rb-fsevent' | |
require 'open3' | |
include Open3 | |
fsevent = FSEvent.new |
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
// Log as many events as possible, with event names grabbed from | |
// webkit sources: | |
// http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/dom/EventNames.h | |
known = [ | |
'abort', | |
'beforecopy', | |
'beforecut', | |
'beforeload', | |
'beforepaste', |
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
<!-- Assumes Weinre running on localhost, and the file accessed via --> | |
<!-- another webserver also running on localhost. Accessing this file --> | |
<!-- locally (file://[..] protocol) doesn't provoke the issue. --> | |
<!-- Tried on OS X and Linux (recent Ubuntu) --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Weinre & Sencha Touch</title> | |
<script src="sencha-touch-1.0.1a.js"></script> | |
<script src="sencha-weinre.js"></script> |