This file contains 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 decorator | |
def multiplier(n): | |
def decorator(fn): | |
return Multiplier(fn, n) | |
return decorator | |
class Multiplier(object): | |
def __init__(self, func, n): | |
self.func = func |
This file contains 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
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 |
This file contains 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
## 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) |
This file contains 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
## 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) |
This file contains 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
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 file contains 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
<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... |
This file contains 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
templateDirectives = { | |
'page-main': { | |
... | |
}, | |
'page-view': { | |
... | |
} | |
}; | |
templates = {}; |
This file contains 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
<div> | |
Person: <span class="name">Person's Name</span> | |
<span class="is-admin">ADMIN</span> | |
<br> | |
Addresses: | |
<ul> | |
<li class="address"> | |
<span class="street">1234 Main St.</span><br> | |
<span class="city">City</span> |
This file contains 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
{"name": "bob", | |
"admin": 1, | |
"addresses": [ | |
{"street": "19 Park Lane", | |
"city": "Heresville"} | |
] | |
} |
This file contains 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
{ | |
".name": "name", | |
"li.address": { | |
"address<-addresses": { | |
".street": "address.street", | |
".city": "address.city" | |
} | |
}, | |
".is-admin": function (ctx) { | |
return ctx.admin ? 'ADMIN' : null; |
OlderNewer