Skip to content

Instantly share code, notes, and snippets.

View stenehall's full-sized avatar
🧗‍♂️

Johan Stenehall stenehall

🧗‍♂️
View GitHub Profile
var passport = require('passport');
var util = require('util');
var GitHubStrategy = require('passport-github').Strategy;
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(obj, done) {
done(null, obj);
var pg = require('pg');
var db = new pg.Client(process.env.DATABASE_URL);
db.connect();
var getSingle = exports.getSingle = function getSingle(id, callback) {
db.query('SELECT ...', [id], function(err, result) {
if(err) throw err
callback(err, result);
});
@stenehall
stenehall / A-Pen-by-Johan-Stenehall.markdown
Created February 17, 2014 18:11
A Pen by Johan Stenehall.
@stenehall
stenehall / keybase.md
Created April 18, 2014 21:39
keybase.md

Keybase proof

I hereby claim:

  • I am stenehall on github.
  • I am stenehall (https://keybase.io/stenehall) on keybase.
  • I have a public key whose fingerprint is 4F87 EC42 F15A 130F BC5F DE22 280C DD00 03FE 0F81

To claim this, I am signing this object:

@stenehall
stenehall / test.html
Last active August 29, 2015 14:17
Websockets on Safari ios 8.2 - Home screen not working
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes">
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
var server = "<replace with your server - for example weechat.mydomain.tld>";
var port = "<replace with your port - most likely 9001>";
int pin = A0;
void setup() {
}
void loop() {
int newVal = analogRead(A0);
if(newVal > 300) {
# Description
# Web hook for the Stockholm coffee brewer
#
# Commands
# there's no commands.
# Author:
# Johan Stenehall <johan@narrativeteam.com> (https://github.com/stenehall)
#
# Contributors:
# Joakim Berglund <joakim@getnarrative.com> (https://github.com/Berglund)
@stenehall
stenehall / app.js
Created April 22, 2015 14:09
Express app for Narratives coffeemaker
var stateCount = 0;
var timer;
var resetTimer;
var brewing = false;
app.post('/brew_hook', function(req, res) {
stateCount++;
clearTimeout(resetTimer);
@stenehall
stenehall / profile_helper.sh
Created June 22, 2015 07:14
profile_helper.sh working for zsh
script_dir=${0%/*}
for script in $script_dir/base16*.sh; do
script_name=$(basename $script .sh)
theme=${script_name#*-}
variation=${theme#*.}
theme=${theme%.*}
base16_${theme}_${variation}() {
parts=("${(@s/_/)0}")
$ cd ~/Desktop $ sudo mv /Library/Preferences/com.apple.Bluetooth.plist .
$ sudo mv ~/Library/Preferences/com.apple.Bluetooth.plist .
$ sudo mv ~/Library/Preferences/ByHost/com.apple.Bluetooth.* .