This file contains 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
// Define a router for the games sub-application | |
var GamesRouter = Backbone.Router.extend({ | |
routes: { | |
"": "root", | |
"games": "index", | |
"games/:id": "showGame" | |
}, | |
root : function() { /*...*/ }, | |
index : function() { /*...*/ }, | |
showGame : function(id) { /*...*/ } |
This file contains 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 BackboneViewExtensions = { | |
mixin : function(from) { | |
var to = this.prototype; | |
// we add those methods which exists on `from` but not on `to` to the latter | |
_.defaults(to, from); | |
// ...and we do the same for events and triggers | |
_.defaults(to.events, from.events); |
This file contains 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
db.events.aggregate( | |
{'$group' : {_id : "$platform", devices: {"$addToSet" : "$device_id"} } }, | |
{"$unwind" : "$devices" }, | |
{"$group" : {_id : "$_id", count: {"$sum" : 1}}} | |
) |
This file contains 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 interval = setInterval(function() { | |
var expandPoints = $(".octicon.octicon-unfold"); | |
expandPoints ? expandPoints.click() : clearInterval(interval); | |
}, 2000); |
This file contains 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/env bash | |
# | |
# An example init script for running a Node.js process as a service | |
# using Strongloop's slc as the process monitor. For more configuration options | |
# associated with slc, see: http://docs.strongloop.com/display/public/SLC/slc+run. | |
# This script assumes you've installed slc globally with `npm install -g strongloop`. | |
# | |
# You will need to set the environment variables noted below to conform to | |
# your use case, and change the init info comment block. | |
# |
This file contains 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
{ | |
"currencyPacks" : [ | |
{ | |
"purchasableItem" : { | |
"marketItem" : { | |
"consumable" : 1, | |
"price" : 1.99, | |
"androidId" : "com.my.game.packs.bag_of_coins", | |
"iosId" : "com.my.game.packs.bag_of_coins" | |
}, |
This file contains 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
{ | |
"name": "unity-mass-labeler", | |
"version": "0.0.1", | |
"description": "", | |
"main": "mass-labeler.js", | |
"dependencies": { | |
"lodash": "^3.5.0", | |
"recursive-readdir": "^1.2.0" | |
}, | |
"devDependencies": {}, |
This file contains 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
db.users.find({created_at: {$gt: new ISODate('2015-03-29 00:53:55.997Z')}}).sort({_id: 1}).forEach(function(d) { | |
var firstName = d.name.split(/\s+/)[0]; | |
var match = d.name.match(/.*\s+(.*)/); | |
var lastName = match ? match[1] : ''; | |
print(d.email + '\t' + firstName + '\t' + lastName); | |
}); |
This file contains 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
db.users.aggregate( | |
{ | |
"$match": { | |
created_at: { $gte: ISODate("2014-09-01T00:00:00Z") } | |
} | |
}, | |
{ | |
"$project": { | |
_id: 0, | |
"isoDate": { $substr: [ "$created_at", 0, 10 ] } |
This file contains 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 emails = {}; | |
db.users.find().sort({_id: -1}).forEach(function(d) { | |
var email = d.email.split('@')[1]; | |
emails[email] |= 0; | |
emails[email]++; | |
}); | |
var sortable = []; | |
for (var email in emails) | |
sortable.push([email, emails[email]]) |