A circule buffer for firebase. Elements are dequeued and enqueue, and a callback function is run on their dataSnapshot.
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
"use strict"; | |
angular | |
.module('app', []) | |
.controller('HomeController', HomeController); | |
function HomeController ($scope) { | |
$scope.hello = "oh, hi" | |
} |
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
''' | |
Taken from: | |
http://stackoverflow.com/users/1074592/fakerainbrigand | |
http://stackoverflow.com/questions/15401815/python-simplehttpserver | |
''' | |
import SimpleHTTPServer, SocketServer | |
import urlparse, os | |
PORT = 3000 |
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
// ref.transaction() can be used in place of ref.set() | |
queueChildRef.transaction(function(theItem) { | |
dataToProcess = theItem; | |
if(theItem) { | |
return null; // if there is still a value, delete it and claim job | |
} else { | |
return; // if there is not a value, abort transaction. job already claimed | |
} | |
}, function(error, committed, snapshot, dummy) { | |
if (error) throw error; |
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
## prints create and insert SQL statements from a csv ## | |
# csv-to-table [path] [name] | |
# $ csv-to-table ./data.csv data_table | |
# create table adapted from John Swapceinski, | |
# http://dev.mysql.com/doc/refman/5.0/en/load-data.html#c12001 | |
path=$(pwd) |
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 collectionNames = db.getCollectionNames(), stats = []; | |
collectionNames.forEach(function (n) { stats.push(db[n].stats()); }); | |
stats = stats.sort(function(a, b) { return b['storageSize'] - a['storageSize']; }); | |
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['storageSize']); } |
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
# .env as used in https://github.com/bkeepers/dotenv | |
export $(cat .env) |
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 repl = require('repl'), | |
keystone = require('keystone'); | |
module.exports = function(done) { | |
var shell = repl.start({ | |
prompt: 'keystone > ' | |
}); | |
// expose keystone to the shell | |
shell.context.keystone = keystone; |
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
<!DOCTYPE html> | |
<html > | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/> | |
<title>chris bolin 2</title> | |
<link rel="stylesheet" href="css/normalize.css"> |
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
// quick and dirty populating ("joining") in Meteor | |
Mongo.Collection.prototype.findAndPopulate = function (selector, options, populates) { | |
/* | |
selector and options: from Mongo.Collection.prototype.find(selector, options) | |
populates: [Object] or Object | |
[{id, as, from}] or {id, as, from} | |
e.g. {id: 'userId', as: 'thisUser', from: Users} | |
will look up doc.userId in Users and assign to doc.thisUser | |
--> doc.thisUser = Users.findOne(doc.userId); | |
*/ |
OlderNewer