Skip to content

Instantly share code, notes, and snippets.

function updateData(data,callback){
var funcs = {
agent: function(data,cb){data.agent = 123; cb(null,data)},
advisor: function(data,cb){data.advisor = 'coolname'; cb(null,data)},
amount: function(data,cb){data.amount = data.amount+1; cb(null,data)}
};
//async.series eller något istället för _.each
_.each(_.keys(data),function(changedKey){
funcs[changedKey](data,function(){})
@peny
peny / gist:0c93bdd7241538ce13a5
Created September 24, 2014 16:09
keybase.md
### Keybase proof
I hereby claim:
* I am peny on github.
* I am peny (https://keybase.io/peny) on keybase.
* I have a public key whose fingerprint is C904 82A6 DD2F C538 000B CA22 30B2 012C C254 DA54
To claim this, I am signing this object:
@peny
peny / travelogue_trouble.md
Last active August 29, 2015 14:01
OpenID auth request contains an unregistered domain

So, you're using hapi and travelogue with passport-google and nothing is working? It probably works fine with passport.js and express.js but that's not what we want.

It worked fine with localhost as your hostname but now we're doing it for real and everything breaks.

Google is helpful enough to give you: OpenID auth request contains an unregistered domain

Unregistered where? In the dev console? It's not even linked to so it can't be that. (It's here by the way.)

Just use passport-google-oauth!

@peny
peny / optitwitter.js
Created November 12, 2012 15:57
Optimal twitter post time
var fs = require('fs');
var http = require('http');
var _ = require('underscore');
function getTimeline(screen_name, callback) {
//Create an array with one array for each hour of the week
var hours = [];
_.each(_.range(168), function(hour) {
hours.push([]);
@peny
peny / JSONfieldtotxt.js
Created October 30, 2012 15:33
qod json field to .txt file
var filename = 'file.json';
var fs = require('fs');
var underscore = require('underscore');
var data = fs.readFileSync(filename).toString();
data = JSON.parse(data);
data = underscore.map(data,function(d){
//change this
return d.field;
});
data = underscore.uniq(data);