(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| package main | |
| import ( | |
| "crypto/rand" | |
| "encoding/base64" | |
| "fmt" | |
| "io" | |
| "math/big" | |
| ) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| from django.core.management.base import BaseCommand | |
| from mymodule import main | |
| import logging | |
| class Command(BaseCommand): | |
| help = 'Do foo' | |
| def handle(self, *args, **options): |
| /*! | |
| * JavaScript - loadGoogleMaps( version, apiKey, language, sensor ) | |
| * | |
| * - Load Google Maps API using jQuery Deferred. | |
| * Useful if you want to only load the Google Maps API on-demand. | |
| * - Requires jQuery 1.5 | |
| * | |
| * UPDATES by Gavin Foley | |
| * - Tidied JS & made it JSLint compliant | |
| * - Updated script request to Google Maps API to be protocol relative |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| (function() { | |
| Backbone.Model.prototype._save = Backbone.Model.prototype.save; | |
| Backbone.Model.prototype.save = function(attrs, options) { | |
| var that = this; | |
| if (!options) { options = {}; } | |
| if (this.savingNewRecord) { | |
| // store or replace last PUT request with the latest version, we can safely replace old PUT requests with new ones | |
| // but if there are callbacks from a previous PUT request, we need to make sure they are all called as well | |
| _(['success','error']).each(function(event) { | |
| // convert all callbacks to a single array of callbacks) |