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 path = require('path'), | |
express = require('express'), | |
crypto = require('crypto'), | |
CryptoJS = require("crypto-js"), | |
uuid = require('uuid'), | |
cloudant = null, | |
tokensdb = null, | |
envoydb = null, | |
cfenv = require('cfenv'), | |
appEnv = cfenv.getAppEnv(), |
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 path = require('path'), | |
express = require('express'), | |
uuid = require('uuid'), | |
cloudant = null, | |
cfenv = require('cfenv'), | |
appEnv = cfenv.getAppEnv(), | |
appurl = (appEnv.app.application_uris)?'https://'+appEnv.app.application_uris[0]:'http://localhost:'+appEnv.port, | |
router = express.Router(); | |
var getOrCreateUser = function(profile, callback) { |
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
// setup Envoy to serve out our static files | |
var opts = { | |
static: require('path').join(__dirname, './public') | |
}; | |
// start up the web server | |
var envoy = require('cloudant-envoy')(opts); |
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 uuid = require('uuid'), | |
express = require('express'), | |
CryptoJS = require("crypto-js"), | |
cloudant = null, | |
tokensdb = null, | |
router = express.Router(); | |
var encrypt = function(str, key) { | |
return CryptoJS.AES.encrypt(str, key).toString(); | |
}; |
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 uuid = require('uuid'), | |
express = require('express'), | |
CryptoJS = require("crypto-js"), | |
router = express.Router(); | |
var encrypt = function(str, key) { | |
return CryptoJS.AES.encrypt(str, key).toString(); | |
}; | |
var decrypt = function(str, key) { |
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
// setup Envoy to serve out our static files | |
var opts = { | |
static: require('path').join(__dirname, './public') | |
}; | |
// start up the web server | |
var envoy = require('cloudant-envoy')(opts); |
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 dash_button = require('node-dash-button'); | |
var dash = dash_button(MYMACADDRESS, null, null, 'all'); | |
var request = require('request'); | |
dash.on("detected", function () { | |
var r = { | |
method: 'post', | |
url: 'https://maker.ifttt.com/trigger/button_pressed/with/key/MYKEY' | |
}; | |
request(r, function(e, req, b) { | |
console.log(b); |
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/python | |
# reads a sequence of REDIS commands from stdin e.g. | |
# SET mykey "hello world | |
# into Redis protocol e.g. | |
# *3 | |
# $3 | |
# SET | |
# $5 | |
# mykey |
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/python | |
# based on code from http://www.hannahfry.co.uk/blog/2012/02/01/converting-british-national-grid-to-latitude-and-longitude-ii | |
#This code converts lat lon (WGS84) to british national grid (OSBG36) | |
from scipy import * | |
from itertools import imap | |
import sys | |
import csv |
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
// points played by player name | |
function (doc) { | |
emit(doc.Player1, 1); | |
} | |
// points played by player name - second iteration | |
function (doc) { | |
emit(doc.Player1, 1); | |
emit(doc.Player2, 1); |