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
| nodejs: | |
| pkg.installed: | |
| version: 'whatevers' |
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
| ############################################################################### | |
| # MY CODE | |
| ############################################################################### | |
| class Command(object): | |
| command = None | |
| def __init__(self, arg=None): | |
| self.arg = arg | |
| def get_command(self): |
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 sqlalchemy import ForeignKeyConstraint | |
| from sqlalchemy.ext.compiler import compiles | |
| @compiles(ForeignKeyConstraint, 'mysql') | |
| def ignore_foreign_keys_for_mysql(constraint, compiler, **kw): | |
| pass |
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 flask import Flask | |
| from flask.ext.sqlalchemy import SQLAlchemy | |
| app = Flask(__name__) | |
| app.config['SQLALCHEMY_BINDS'] = { | |
| 'postgres': 'postgresql+psycopg2://wazinit:wazinit@localhost/test_binds', | |
| 'mysql': 'mysql://hivelocity:test@localhost/hivelocity_shared', | |
| } | |
| db = SQLAlchemy(app) |
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
| """An extensible system for building a SQLAlchemy query based on GET params | |
| Design principles: | |
| - Database operations should be easy to identify | |
| - User input (GET params) should be loosely coupled from models | |
| - Not all operations are valid on all columns (icontains is invalid for FLOAT) | |
| Example: | |
| >>> query = Token.query.with_entities(Token.id) |
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
| // Helper to simplify incremental generation and storage of paths | |
| var Path = function Path(_path) { | |
| this.value = _path; | |
| }; | |
| Path.prototype = { | |
| 'toString': function() { | |
| return this.value; | |
| }, | |
| 'join': function() { |
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 re | |
| def search(d, pattern, name='root'): | |
| if not hasattr(pattern, 'match'): | |
| pattern = re.compile(re.escape(pattern), re.I) | |
| results = [] | |
| _keystr = lambda key, item: '%s[%r]' % (key, item) | |
| def _value(v, key): |
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 gevent | |
| from django.core.cache import cache | |
| class CacheLock(object): | |
| """A lock backed by redis""" | |
| def __init__(self, lock_id, expiry=60 * 5): | |
| """ | |
| :param lock_id: unique key for lock (unique through Django cache) |
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
| Routing / AJAX: | |
| http://visionmedia.github.io/superagent/ | |
| https://github.com/visionmedia/page.js | |
| https://github.com/flatiron/director | |
| Utilities: | |
| https://lodash.com/ | |
| http://momentjs.com/ | |
| http://browserify.org/ | |
| http://julian.com/research/velocity/ |
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
| In [19]: \ | |
| ....: | |
| In [20]: \\ | |
| ....: | |
| ....: | |
| ....: | |
| In [21]: \\\ | |
| ....: |