Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am henryoswald on github.
  • I am henryoswald (https://keybase.io/henryoswald) on keybase.
  • I have a public key ASArUOniElnAauGcWjsBDBoe1YxQERXBA87JS7EjElW6kgo

To claim this, I am signing this object:

@henryoswald
henryoswald / profile.sh
Created June 6, 2017 16:03
profile redis data with rdb tools
#!/bin/bash
rdb -c memory $1 > memory.csv
sort -t"," -n -k4 memory.csv > sorted.csv
grep -a "sess" sorted.csv> sess.csv
grep -a "DocsWithHistoryOps" sorted.csv > DocsWithHistoryOps.csv
grep -a "DocOps" sorted.csv > DocOps.csv
grep -a "doclines" sorted.csv > doclines.csv
async = require("async")
Project = require('./app/js/models/Project').Project
_ = require("lodash")
warmup = "55928319efc30e705817817e"
smallproject = "561e86173cfc7400525834a6"
twokproject = "5637a97beafc8c7b5bfc487a"
fourkproject = "55ef4b39f5e895afbaf2085d"
realmassive = "57b1ea8674e706f567b5afe9"
twokimageproject = "55ef4b39f5e895afbaf2085f"
Only in web-api-sharelatex-blue/current/app/coffee/Features/Analytics: AnalyticsController.coffee
Only in web-api-sharelatex-blue/current/app/coffee/Features/Analytics: AnalyticsManager.coffee
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Authentication/AuthenticationController.coffee web-api-sharelatex-green/current/app/coffee/Features/Authentication/AuthenticationController.coffee
12,13d11
< UserSessionsManager = require("../User/UserSessionsManager")
< Analytics = require "../Analytics/AnalyticsManager"
18c16
<
---
>
@henryoswald
henryoswald / app.js
Last active August 16, 2016 15:19
passport.js example
var express = require('express');
var app = express();
var cookieParser = require("cookie-parser")
var bodyParser = require("body-parser")
var passport = require('passport');
var session = require('express-session');
var LocalStrategy = require('passport-local').Strategy;
app.use(cookieParser())
{
"_id" : ObjectId("56e6c9ddd6582f0f52a90684"),
"folders" : [
{
"_id" : ObjectId("56e81bc232d4148654cef0fe"),
"folders" : [ ],
"fileRefs" : [ ],
"docs" : [
{
"_id" : ObjectId("56e81bc232d4148654cef0ff"),
sinon = require('sinon');
chai = require('chai');
should = chai.should();
SandboxedModule = require('sandboxed-module');
modulePath = "./UserHandler";
describe('User Handler', function() {
var user_id = "12345"
request = require("request")
module.exports = {
getUserDetails: function(user_id, callback){
var url = "http://www.api.com/user/" + user_id
request.get(url, function(err, response, body){
callback(err, body)
})
}
}
fs = require("fs")
bib2json = require("./bib2json.js")
f = fs.readFileSync("../listb.bib", "utf-8")
_ = require("lodash")
json = bib2json(f)
j = _.map json.entries, (ent)->
return {key:ent.EntryKey, author:ent.Fields.author, journal: ent.Fields.journal, title:ent.Fields.title, year: ent.Fields.year}
@henryoswald
henryoswald / onlySingleClick.coffee
Last active December 11, 2015 04:08
simple way to prevent double clicks in a client side app but still register single clicks
cachedEvents: {}
onlySingleClick: (e, waitBetweenClicks = 500)->
foundTime = cachedEvents[e.target]
now = new Date().getTime()
difference = now - foundTime
cachedEvents[e.target] = now
return difference > waitBetweenClicks