Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import functools | |
import unittest2 | |
import os | |
from google.appengine.api import datastore_errors | |
from google.appengine.ext.ndb import model | |
from google.appengine.ext.ndb import tasklets | |
from google.appengine.ext import testbed | |
#--------------------------------------- |
Components.Router = Backbone.Router.extend({ | |
// @todo also support unnamed params | |
// 'page/edit/(?<language>[a-z]{2})/(?<entityId>[a-z0-9]{24})/(.*)' | |
route: function(route, name, callback) { | |
Backbone.history || (Backbone.history = new Backbone.History); | |
if (!XRegExp.isRegExp(route)) route = this._routeToRegExp(route); | |
if (!callback) callback = this[name]; | |
Backbone.history.route(route, _.bind(function(fragment) { | |
var routeParams = XRegExp.exec(fragment, route), |
""" | |
Simple task farm, with routed replies in pyzmq | |
For http://stackoverflow.com/questions/7809200/implementing-task-farm-messaging-pattern-with-zeromq | |
Note that things are run in threads to keep stuff in one file, there is no | |
reason they need to be. | |
License: Public Domain |
/* | |
* Copyright (c) 2004 Novell, Inc. | |
* Copyright (c) 2005 Manuel Amador <[email protected]> | |
* Copyright (c) 2009-2011 Forest Bond <[email protected]> | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a | |
* copy of this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, including without limitation | |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
from wtforms.form import Form | |
from wtforms.fields import TextField, TextAreaField, FieldFist, FormField | |
class PluginForm(Form): | |
tags = TextField('Some random tags',) | |
files = TextField('Some random files',) | |
mongoose = require("mongoose") | |
Schema = mongoose.Schema | |
languages = ['de', 'en', 'es'] | |
defaultLanguage = 'de' | |
getLanguage = () -> | |
return 'de' | |
class MultilingualSchema extends Schema | |
<?php | |
/* | |
Author: Jim Westergren & Jeedo Aquino | |
File: index-with-redis.php | |
Updated: 2012-10-25 | |
This is a redis caching system for wordpress. | |
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/ |
// this is a locale bundle | |
var locale = {"en-US":"<locale xml:lang=\"en\" xmlns=\"http://purl.org/net/xbiblio/csl\"> <style-options punctuation-in-quote=\"true\"/> <date form=\"text\"> <date-part name=\"month\" suffix=\" \"/> <date-part name=\"day\" suffix=\", \"/> <date-part name=\"year\"/> </date> <date form=\"numeric\"> <date-part name=\"year\"/> <date-part name=\"month\" form=\"numeric\" prefix=\"-\" range-delimiter=\"/\"/> <date-part name=\"day\" prefix=\"-\" range-delimiter=\"/\"/> </date> <terms> <term name=\"document-number-label\">No.</term> <term name=\"document-number-authority-suffix\">Doc.</term> <term name=\"un-sales-number-label\">U.N. Sales No.</term> <term name=\"collection-number-label\">No.</term> <term name=\"open-quote\">\u201c</term> <term name=\"close-quote\">\u201d</term> <term name=\"open-inner-quote\">\u2018</term> <term name=\"close-inner-quote\">\u2019</term> <term name=\"ordinal-01\">st</term> <term name=\"ordinal-02\">nd</ter |
# http://forum.xbian.org/thread-370.html | |
sudo su #default password = 'raspberry' | |
service xbmc stop | |
apt-get update | |
apt-get install libcurl3 libva1 | |
cd /opt | |
rm -rf xbian | |
git clone -b xbian-alpha5 git://github.com/xbianonpi/xbian.git | |
cd xbian |