First, warm up system.
$ easy_install pip
$ pip install virtualenv
$ pip install django
$ gem install heroku| from django.db.models.signals import post_init | |
| def track_data(*fields): | |
| """ | |
| Tracks property changes on a model instance. | |
| The changed list of properties is refreshed on model initialization | |
| and save. | |
| >>> @track_data('name') |
| // includes bindings for fetching/fetched | |
| var PaginatedCollection = Backbone.Collection.extend({ | |
| initialize: function() { | |
| _.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage', 'filtrate', 'sort_by'); | |
| typeof(options) != 'undefined' || (options = {}); | |
| typeof(this.limit) != 'undefined' || (this.limit = 20); | |
| typeof(this.offset) != 'undefined' || (this.offset = 0); | |
| typeof(this.filter_options) != 'undefined' || (this.filter_options = {}); | |
| typeof(this.sort_field) != 'undefined' || (this.sort_field = ''); |
| """ | |
| jQuery templates use constructs like: | |
| {{if condition}} print something{{/if}} | |
| or like: | |
| {% if condition %} print {%= object.something %} {% endif %} | |
| This, of course, completely screws up Django templates, |
| from fabric.api import env, local, require | |
| def deploy(): | |
| """fab [environment] deploy""" | |
| require('environment') | |
| maintenance_on() | |
| push() | |
| syncdb() | |
| migrate() |
| import random | |
| envs = [10.0, 20.0] | |
| rounds = 10000 | |
| total_stay = 0 | |
| for x in xrange(rounds): | |
| t_envs = envs[:] | |
| random.shuffle(t_envs) | |
| choice = t_envs.pop() |
| #!/usr/bin/perl | |
| use Mysql; | |
| use strict; | |
| use vars qw($school_name); | |
| use vars qw($pass); | |
| require "./cgi-lib.pl"; |
| function make_shipping_rates(id, low, mid, high) { | |
| $.post('/admin/price_based_shipping_rates.json', { | |
| price_based_shipping_rate: { | |
| country_id: id, | |
| min_order_subtotal: "0", | |
| max_order_subtotal: "500", | |
| name: "DHL Premiumversand", | |
| offsets: [], | |
| price: low | |
| } |
| SHOPIFY_API_KEY = 'my-key' | |
| SHOPIFY_PASSWORD = 'my-pass' | |
| STORE_NAME = 'my-store' |
| function sync() { | |
| // ID(s) of personal calendar(s) | |
| var secondary_calendars = [ | |
| 'xxxxxxx', | |
| ]; | |
| var today=new Date(); | |
| var enddate=new Date(); | |
| enddate.setDate(today.getDate()+90); // how many days in advance to monitor and block off time |