Skip to content

Instantly share code, notes, and snippets.

View ianb's full-sized avatar

Ian Bicking ianb

View GitHub Profile
$ cat packages.txt
minimock
formencode
sqlobject
tempita
initools
zptkit
pastewebkit
deliverance
httpencode
function onButtonClicked() {
console.log("yay, click!");
}
document.getElementById("button").addEventListener("click", function () {
TogetherJS.send({type: "myButtonClick"});
onButtonClicked();
}, false);
TogetherJS.hub.on("myButtonClick", function () {
import decorator
def multiplier(n):
def decorator(fn):
return Multiplier(fn, n)
return decorator
class Multiplier(object):
def __init__(self, func, n):
self.func = func
Traceback (most recent call last):
File "/usr/local/share/silverlining/mgr-scripts/master-runner.py", line 44, in application
return found_app(environ, start_response)
File "/var/www/zamboni.2010-04-01_003/lib/python/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/var/www/zamboni.2010-04-01_003/lib/python/django/core/handlers/base.py", line 143, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)
File "/var/www/zamboni.2010-04-01_003/lib/python/django/core/handlers/base.py", line 101, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/zamboni.2010-04-01_003/src/zamboni-src/zamboni/apps/addons/views.py", line 225, in home
## Descriptors
## Anything with __get__ and __set__:
class classinstancemethod(object):
def __init__(self, func):
self.func = func
def __get__(self, obj, type=None):
def repl(*args, **kw):
return self.func(obj, type, *args, **kw)
## Descriptors
## Anything with __get__ and optionally __set__:
class classinstancemethod(object):
def __init__(self, func):
self.func = func
def __get__(self, obj, type=None):
def repl(*args, **kw):
return self.func(obj, type, *args, **kw)
<body>
<div id="header">stuff...</div>
<div id="body">
</div>
<div id="templates" style="display: none">
<div class="page-main">
Template for the main page...
</div>
<div class="page-view">
Template for the view page...
templateDirectives = {
'page-main': {
...
},
'page-view': {
...
}
};
templates = {};
var app = $.sammy(function () {
this.element_selector = '#body';
this.get('#/', function (context) {
... stuff to do for the URL /#/ ...
});
this.get('#/view/:id', function (context) {
... stuff for e.g., /#/view/10 ...
... use this.params.id to get "10" ...
});
});
this.get('#/view/:id', function (context) {
$.ajax({
url: './api/view/'+this.params.id,
dataType: 'json',
success: function (result) {
renderPage('page-view', result);
}
});
});