Skip to content

Instantly share code, notes, and snippets.

product_table = Table('product', metadata,
Column('id', Integer, primary_key=True),
Column('name', String, ...)
unifiedproduct_table = Table('unifiedproduct', metadata,
Column('id', Integer, primary_key=True))
product_unifiedproduct_table = Table('product_unifiedproduct', metadata,
Column('product_id', Integer, ForeignKey('product.id'), primary_key=True),
Column('unifiedproduct_id', Integer, ForeignKey('unifiedproduct.id'), primary_key=True),
#Fast Little IRC Robot Toolkit
#Copyright (C) 2005 Jonathan Rosebaugh
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
CPNotificationQueueTest..2010-02-08 11:08:13.307 Cappuccino [error]: addError test=[CPNotificationQueueTest testEnqueueNotificationWithDefaultOptions] error=ReferenceError: Can't find variable: hasDOMImageElement
.2010-02-08 11:08:13.309 Cappuccino [warn]: addFailure test=[CPNotificationQueueTest testDefaultCoalescing] failure=AssertionFailedError: expected:<1> but was:<0>
..2010-02-08 11:08:13.311 Cappuccino [warn]: addFailure test=[CPNotificationQueueTest testNoCoalescing] failure=AssertionFailedError: expected:<2> but was:<0>
comet(Req) ->
Body = Req:recv_body(),
io:format("~nBody: ~p~n", [Body]),
Socket = Req:get(socket),
inet:setopts(Socket, [{active, once}]),
Response = connection:handle_json(Body),
inet:setopts(Socket, [{active, false}]),
io:format("~nSending Response: ~s~n", [Response]),
Req:ok({"application/json", [], Response}).
var make_callback = function (ingredient_id) {
return function (ingredient_data) {
// do stuff with the data here
alert("Ingredient #" + ingredient_id + " chosen with ingredient: " + ingredient_data.text);
};
};
// use this by doing
{
onSelect:make_callback(1); // or 2, or 3, or whatever
def register_X_browsers():
# The default GNOME browser
if "GNOME_DESKTOP_SESSION_ID" in os.environ and _iscommand("gnome-open"):
register("gnome-open", None, BackgroundBrowser("gnome-open"))
# The default KDE browser
if "KDE_FULL_SESSION" in os.environ and _iscommand("kfmclient"):
register("kfmclient", Konqueror, Konqueror("kfmclient"))
# The following lines are in my ~/.profile and are active in the shell:
export NARWHAL_ENGINE=jsc
export CAPP_BUILD=/Users/jon/code/gridomatic/capp-build/capp
export PATH="/Users/jon/code/gridomatic/capp-build/bin:$PATH"
# Then I ran jake and jake install in my local git repo (on jake branch, at 204df993753aaa41c56e29de751fb0afdff10b6a)
# It failed with an error about a path.
jon@euterpe:~/code/gridomatic/capp-repo$ jake
(in /Users/jon/code/gridomatic/capp-repo)
@decorator
def deco(f, *a, **kw):
# set a default keyword arg
if 'foo' not in kw:
kw['foo'] = 'bar'
return f(*a, **kw)
jon@euterpe:~/code/gridomatic/capp-repo$ jake install
(in /Users/jon/code/gridomatic/capp-repo)
(in /Users/jon/code/gridomatic/capp-repo)
(in /Users/jon/code/gridomatic/capp-repo/Objective-J)
Build took 1 second
(in /Users/jon/code/gridomatic/capp-repo/CommonJS)
Build took 101 millseconds
(in /Users/jon/code/gridomatic/capp-repo/Foundation)
Compiling [ObjJ] CPArray+KVO.j...
Compiling [ObjJ] CPArray.j...
import pytz
class TzDateTimeProperty(db.DateTimeProperty):
def get_value_for_datastore(self, model_instance):
if model_instance.posted_at.tzinfo is None:
model_instance.posted_at = model_instance.posted_at.replace(tzinfo=pytz.utc)
else:
model_instance.posted_at = model_instance.posted_at.astimezone(pytz.utc)
return super(TzDateTimeProperty, self).get_value_for_datastore(model_instance)
def make_value_from_datastore(self, value):