A Pen by Johan Stenehall on CodePen.
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 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); |
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 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); | |
}); |
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:
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
<!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>"; |
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
int pin = A0; | |
void setup() { | |
} | |
void loop() { | |
int newVal = analogRead(A0); | |
if(newVal > 300) { |
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
# 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) |
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 stateCount = 0; | |
var timer; | |
var resetTimer; | |
var brewing = false; | |
app.post('/brew_hook', function(req, res) { | |
stateCount++; | |
clearTimeout(resetTimer); |
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
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}") |
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
$ 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.* . |