Skip to content

Instantly share code, notes, and snippets.

View HipsterBrown's full-sized avatar

Nick Hehr HipsterBrown

View GitHub Profile
@HipsterBrown
HipsterBrown / .bash_profile
Last active April 30, 2019 17:55
Some handy bash functions for working in a git repo
# usage: load your local environment with a .env file or point to another file
# dotenv // load .env by default
# dotenv .env.staging // load the environment variables in .env.staging
dotenv() {
export $(cat ${1:-.env} | xargs);
}
# dynamically generate branch completion list
_list_branch_completions() {
COMPREPLY=($(compgen -W "$(git branch --list --sort=refname | tr -d '*')" "${COMP_WORDS[1]}"))
@HipsterBrown
HipsterBrown / .gitignore
Last active November 19, 2019 15:17
Minimal nw.js app using node-serialport
node_modules/
dist/
@HipsterBrown
HipsterBrown / nimbus-controller.js
Created August 14, 2017 03:29
Using node-hid and robotjs to map the Nimbus Bluetooth controller buttons / joystick to keyboard buttons (Node 8)
const HID = require('node-hid')
const robot = require('robotjs')
const throttle = require('lodash.throttle')
const devices = HID.devices()
const emptyBuffer = Buffer.allocUnsafe(17).fill(0)
const toggleMap = new Map([['LU', false], ['LR', false], ['LD', false], ['LL', false], ['RU', false], ['RR', false], ['RD', false], ['RL', false]])
const nimbusData = devices.filter(({ product }) => product === 'Nimbus')[0]
@HipsterBrown
HipsterBrown / template-stream.js
Created June 17, 2017 21:51
Tiny Streaming Templates
'use strict';
const { Transform } = require('stream');
const eachBlockRegex = /{{\s*#each\s*(.*)}}([\S\s]*?){{\s*\/each\s*}}/g;
module.exports = (data = {}) => (
new Transform({
writableObjectMode: true,
transform(chunk, encoding, callback) {
@HipsterBrown
HipsterBrown / index.html
Last active June 16, 2017 13:45
Quick Tessel Webcam Server
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tessel-Cam</title>
<style>
body {
font-family: Helvetica, sans-serif;
text-align: center;
}
@HipsterBrown
HipsterBrown / wdw-eats.md
Last active April 7, 2016 01:53
Where to eat at Walt Disney World parks (from a former Orlando resident and Annual Passholder)

Where to eat at Walt Disney World (from a former Orlando resident and Annual Passholder)

  • [R] = Reservation
  • [QS] = Quick Service

Breakfast

Magic Kingdom:

  • [R] Crystal Palace (Character Dining!!)
  • [QS] Main Street Bakery (grab some coffee, pastries, and a bench to enjoy the Main Street entertainment as the park opens)
@HipsterBrown
HipsterBrown / teasel-update-firmware
Created January 2, 2016 20:28
Update Tessel Node module on the device
scp -i ~/.tessel/id_rsa node/tessel-export.js root@oogie_boogie.local:/usr/lib/node
@HipsterBrown
HipsterBrown / Gulpfile.js
Last active November 4, 2015 14:17
Browsery-Sync Proxy Config
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserSync = require('browser-sync');
// Asset Server
var bsAssets = browserSync.create('assets');
// Rails Views Proxy Server
var bsRails = browserSync.create('rails');
gulp.task('serve', function() {
@HipsterBrown
HipsterBrown / collection.md
Last active September 30, 2015 19:37
What is Nick looking at now? (the wwwtf.berlin collection)
@HipsterBrown
HipsterBrown / gist:f17dcc85be545781e451
Created October 24, 2014 17:57
Reference 'this' in requestAnimationFrame
function scrollTo() {
var steps = this.endPos - this.windowTop;
var total = (this.options.speed / 1000) * 60;
this.currentVal = steps * this.count / total + this.windowTop;
window.scrollBy(0, this.currentVal);
if(this.count < total) {
this.count++;