I hereby claim:
- I am fastest963 on github.
- I am jameshartig (https://keybase.io/jameshartig) on keybase.
- I have a public key whose fingerprint is 5425 C8A5 EE2F 158C 6AF4 E1A7 ACDE 6F5B 3F1F 0068
To claim this, I am signing this object:
<?php | |
function gcd($a, $b) { | |
$a = abs($a); | |
$b = abs($b); | |
if ($a < $b) { | |
$c = $a; | |
$a = $b; | |
$b = $c; | |
} | |
if ($b == 0) { |
<?php | |
function superDuperMerge($array1, $array2) | |
{ | |
if (!$array1 || $array1 instanceof stdClass) { | |
return $array2; | |
} else if (!$array2 || $array2 instanceof stdClass) { | |
return $array1; | |
} | |
$new = array(); |
I hereby claim:
To claim this, I am signing this object:
Verifying that +jameshartig is my Bitcoin username. You can send me #bitcoin here: https://onename.io/jameshartig |
var oldParse = GS.Models.ChatActivity.prototype.parse; | |
GS.Models.ChatActivity.prototype.parse = function() { | |
var attrs = oldParse.apply(this, Array.prototype.slice.call(arguments)); | |
if (attrs.type == 'message' && attrs.user && isIgnored(attrs.user.get('UserID'))) { | |
attrs.specialFlag == 'ignored'; | |
} | |
return attrs; | |
} |
//Straight from http://nodejs.org/api/cluster.html | |
var cluster = require('cluster'); | |
var http = require('http'); | |
var numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
// Fork workers. | |
for (var i = 0; i < numCPUs; i++) { | |
cluster.fork(); | |
} |
test('Do not allow duplicate models (with nonstandard id) to be `add`ed or `set`', function() { | |
var Stooge = Backbone.Model.extend({ | |
parse: function(a) { | |
var attrs = {}; | |
attrs._id = a.__id; | |
return attrs; | |
} | |
}); | |
Stooge.prototype.idAttribute = '_id'; |
// If a duplicate is found, prevent it from being added and | |
// optionally merge it into the existing model. | |
existing = this.get(attrs); | |
if (!existing) { | |
model = newModels[i] = this._prepareModel(attrs, options); | |
if (!model) continue; | |
existing = this.get(model); | |
} | |
if (existing) { | |
.... |
test("destroy models in each loop", 4, function() { | |
var collection = new Backbone.Collection([{id: 1}, {id: 2}, {id: 3}, {id: 4}]); | |
collection.each(function(model) { | |
notStrictEqual(model, undefined); | |
if (model !== undefined) { | |
model.destroy({url: function() {}}); | |
} | |
}); | |
}); |
var artistMap = new WeakMap(), | |
albumMap = new WeakMap(); | |
var Song = Backbone.Model.extend({ | |
parse: function(a) { | |
artistMap.set(this, a.artist); | |
delete a.artist; | |
albumMap.set(this, a.album); | |
delete a.album; | |
}, |