Skip to content

Instantly share code, notes, and snippets.

@tom-parker
tom-parker / SassMeister-input.scss
Created September 30, 2015 09:31
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.message {
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
var pm2 = require('pm2');
var metrics = require('next-metrics');
pm2.start({
name : "max_mem",
script : "big-array.js",
max_memory_restart : "20M"
}, function(err, proc) {
metrics.count('app.memory_restart', 1);
});
// Basic mechanic
// Fetch Jobs from usergrid
// For each job
// push uuid to expiry queue with expiry time
// push full job to fullJobs queue
// When key expires
// push expired key to workerq list
// OnTick
@tom-parker
tom-parker / gist:3600072
Created September 2, 2012 14:59
Javascript new
function newObject(func) {
// get an Array of all the arguments except the first one
var args = Array.prototype.slice.call(arguments, 1);
// create a new object with its prototype assigned to func.prototype
var object = Object.create(func.prototype);
// invoke the constructor, passing the new object as 'this'
// and the rest of the arguments as the arguments
func.apply(object, args);
@tom-parker
tom-parker / gist:3450936
Created August 24, 2012 14:04
Backbone collection stream
//From http://weblog.bocoup.com/backbone-live-collections/
// Create a StreamCollection
var StreamCollection = Backbone.Collection.extend({
stream: function(options) {
// Cancel any potential previous stream
this.unstream();
var _update = _.bind(function() {