This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!#/usr/bin/node | |
var _ = require('underscore'); | |
var duplicates, uniques, temp; | |
var original = [ | |
{"tags": [{_id: ObjectId(1), name: "tag1"}, {_id: ObjectId(2), name: "tag2"}, {_id: ObjectId(3), name: "tag3"}]}, | |
{"tags": [{_id: ObjectId(2), name: "tag2"}, {_id: ObjectId(4), name: "tag4"}, {_id: ObjectId(3), name: "tag3"}]}, | |
{"tags": [{_id: ObjectId(1), name: "tag1"}, {_id: ObjectId(3), name: "tag3"}, {_id: ObjectId(2), name: "tag2"}]} | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function() { | |
var _fetch = Backbone.Collection.prototype.fetch; | |
var _reset = Backbone.Collection.prototype.reset; | |
_.extend(Backbone.Collection.prototype, { | |
fetching: false | |
}); | |
Backbone.Collection.prototype.fetch = function(options) { | |
this.fetching = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function() { | |
var proxied = window.XMLHttpRequest.prototype.open; | |
window.XMLHttpRequest.prototype.open = function() { | |
console.log( arguments ); | |
return proxied.apply(this, [].slice.call(arguments)); | |
}; | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.killWhiteSpace = function() { | |
return this.replace(/\s/g, ''); | |
}; | |
String.prototype.reduceWhiteSpace = function() { | |
return this.replace(/\s+/g, ' '); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var maxStackSize = function(i){try{(function m(){++i&&m()}())}catch(e){return i}}(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.erase = function(item) { | |
for( var i = this.length; i--; ) { | |
if( this[i] === item ) { | |
this.splice(i, 1); | |
} | |
} | |
return this; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ig.game.* are global objects being used to store results | |
var findGemBlocks = function () { | |
var connectedGems = [], | |
finalGemBlocks = [], | |
getConnectedGems = function (gem) { | |
if (!_.include(connectedGems, gem)) { | |
connectedGems.push(gem); | |
if (_.include(_.flatten(finalGemBlocks), gem)) return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Bar class | |
-- LGPL Juan Belón Pérez | |
-- videojuegos.ser3d.es | |
-- 2011 | |
Bar = class() | |
function Bar:init() | |
self.bgems = {} | |
self.time = 0 | |
for i=1,maxGemsRow do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function roundNumber(num, dec) { | |
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); | |
return result; | |
} |