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() |
| #!/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 |
| #!comment: This allegedly waa a list of "the top 100,000 most frequently-used English words", see the repo I forked for more provenance. | |
| #!comment: But it was very un-sanitized. I had a specific purpose in mind, and thought it might be somewhat more generally useful to have/share in the future, so here's how I sanitized the list: | |
| #!comment: 0) put a number on each word (I should note that somehow it only included 98,913 to start with) | |
| #!comment: 1) change all words to lower-case | |
| #!comment: 2) blank out any words with characters other than a-z | |
| #!comment: 3) remove any duplicates, keeping the lower (more frequent) number | |
| #!comment: Now the list is 62916 words long, and still contains a lot of non-English words, but I think it is more useful. | |
| #!comment: | |
| #!comment: Format: Rank (original rank) Word | |
| 1 (1) the |