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
// map_reduce, based on http://code.google.com/p/mapreduce-js/ | |
var map_reduce = function (data, map, reduce) { | |
var mapResult = [], reduceResult = []; | |
var mapIx, reduceKey; | |
var mapEmit = function(key, value) { | |
if (!mapResult[key]) { | |
mapResult[key] = []; | |
} | |
mapResult[key].push(value); |
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
// Route Declaration | |
server.get('/users', usersController.index, authService.middleware); |
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
// Check whether user is Authenticated | |
var _verifyAuthToken = function (authToken) { | |
var deferred = require('q').defer() | |
, usersService = require(__dirname + '/../services/users.js'); | |
// Check we have an authToken object | |
if (authToken) { | |
// Check for relevent properties | |
if ( authToken.username && authToken.key ) { | |
// Check key against HMAC |
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
function aclChecker() { | |
function checkAcl(req, res, next) { | |
var promise = function () { | |
var deferred = require('q').defer(); | |
deferred.resolve(); | |
return deferred.promise; | |
} |
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 Metalib = require('fluent-ffmpeg').Metadata; | |
var ffmpeg = require('fluent-ffmpeg'); | |
var q = require('q'); | |
var filename = process.argv[2] || null; | |
if (!filename) { | |
console.log('No source file provided'); | |
return; | |
} |
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 assert = require('assert'); | |
var path = require('path'); | |
var protractor = require('protractor'); | |
var webdriver = require('selenium-webdriver'); | |
var browser = process.env.browser || 'chrome'; | |
var driver = new webdriver.Builder() | |
.usingServer('http://localhost:4444/wd/hub') | |
.withCapabilities(webdriver.Capabilities[browser]()) | |
.build(); |
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 assert = require('assert'); | |
var path = require('path'); | |
var protractor = require('protractor'); | |
var webdriver = require('selenium-webdriver'); | |
var browser = process.env.browser || 'chrome'; | |
var driver = new webdriver.Builder() | |
.usingServer('http://localhost:4444/wd/hub') | |
.withCapabilities(webdriver.Capabilities[browser]()) | |
.build(); |
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 filesystem = require('fs'); | |
var _ = require('lodash'); | |
var models = {}; | |
var relationships = {}; | |
var orm = function orm() { | |
var Sequelize = require('sequelize'); | |
var sequelize = null; |
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
#!/bin/sh | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' |
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
<html> | |
<body> | |
<video id="v" width="300" height="300"></video> | |
<input id="b" type="button" disabled="true" value="Take Picture"></input> | |
<canvas id="c" style="display:none;" width="300" height="300"></canvas> | |
</body> | |
<script> | |
navigator.getUserMedia({video: true}, function(stream) { | |
var video = document.getElementById("v"); | |
var canvas = document.getElementById("c"); |
OlderNewer