Skip to content

Instantly share code, notes, and snippets.

View boneskull's full-sized avatar
💀

Christopher Hiller boneskull

💀
View GitHub Profile
@boneskull
boneskull / typed.js
Created May 7, 2016 07:00
wraps stampit and provides a schema check for check-more-types
import './mixins';
import stampit from 'stampit';
import is from 'check-more-types';
import {camelCase, forEach, mapValues, assign} from 'lodash';
const checks = [
is.stamp,
is.array,
is.map,
is.weakMap,
@boneskull
boneskull / README.md
Last active June 24, 2023 13:42
syntax highlighting for Vagrantfile in non-RubyMine JetBrains IDEs
  1. Add this file to /path/to/prefs/filetypes/
  2. Restart IDE

This page will help you find the correct directory.

@boneskull
boneskull / README.md
Last active March 20, 2016 08:41
wallaby failure weirdness

This gist demonstrates a problem wherein tests run under Wallaby will fail while pass on command line.

Prereq

  • Node.js v4 or v5
  • Globally installed Mocha @ v2.4.5

Setup

  1. Download this gist, untarball it, ensure the two (2) .js files are in your wd
@boneskull
boneskull / index.js
Created February 5, 2016 05:27
map/filter vs. reduce benchmarks
compare("map/filter/reduce", function() {
var arr = [{
foo: true,
bar: 'a'
}, {
foo: false,
bar: 'b'
}, {
foo: false,
bar: 'c'
@boneskull
boneskull / proxy
Created January 26, 2016 00:43
example nginx config to reverse proxy a node-red server (websocket support)
server {
listen 80;
server_name your_server_name;
access_log /var/log/nginx/access.log;
location / {
proxy_pass http://localhost:1880;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@boneskull
boneskull / raspbian-setup-script.md
Last active August 21, 2017 22:17
raspbian setup script (jessie lite)

This is a note to myself about what I need to do to setup a Raspbian box.

  1. Username is pi and pw is raspberry. osmc/osmc if OSMC.
  2. apt-get update
  3. apt-get dist-upgrade -y
  4. apt-get install nfs-kernel-server openvpn software-properties-common vim git dnsutils -y
  • software-properties-common for adding PPAs
  1. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 249AD24C
  • we can't use apt-add-repository because the Deluge PPA only has Ubuntu builds
  • key info is found here
@boneskull
boneskull / eslintrc.json
Last active January 28, 2017 08:42
monkeypatch eslint from config to avoid peerDependencies; just "npm install eslint eslint-config-your-config" and the rest happens by evil magic
{
"extends": "semistandard",
"parser": "babel-eslint",
"plugins": [
"lodash3",
"no-class",
"mocha-only",
"prototype-chain"
],
"rules": {
@boneskull
boneskull / .bash_profile
Created October 21, 2015 08:06
Open any man page (using "man") in Dash.app
function encodeuri {
local string="${@}"
local strlen=${#string}
local encoded=""
for (( pos = 0; pos < strlen; pos ++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9]) o="${c}" ;;
*) printf -v o '%%%02x' "'$c"
@boneskull
boneskull / temp.lua
Created October 5, 2015 22:31
lua one-wire temp module
temp = {}
function getTemp(pin, addr)
return function(callback)
ow.reset(pin)
ow.select(pin, addr)
ow.write(pin, 0x44, 1)
local data
tmr.alarm(5, 1000, 0, function()
ow.reset(pin)
@boneskull
boneskull / stub-transform.js
Created June 23, 2015 20:42
Browserify transform to stub a module exporting a function.
'use strict';
var minimatch = require('minimatch'),
transformify = require('transformify'),
through2 = require('through2');
var tx = transformify(stubber);
function stubber() {
return 'module.exports = function() {};';