Skip to content

Instantly share code, notes, and snippets.

@camshaft
camshaft / start
Last active August 29, 2015 14:01
erlang start script
#!/bin/bash
erlang="./otp/bin/erl"
! [ -f "$erlang" ] && erlang="erl"
# Default to 64 threads
if [ -z "$THREAD_COUNT" ]
then
THREAD_COUNT="64"
fi
.
├── default
│   ├── default
│   ├── test
│   └── local
├── types
│   ├── ui
│   │   ├── default
│ │ ├── test
@camshaft
camshaft / Makefile
Created April 3, 2014 03:39
circular dependency include fix
-include erlang.mk
ifndef PKG_FILE
task = $(firstword $(MAKECMDGOALS))
$(task):
@curl https://raw.github.com/extend/erlang.mk/master/erlang.mk -o erlang.mk
@make $(MAKECMDGOALS)
.PHONY: $(task)
endif
/*
* Module dependencies.
*/
var rework = require('rework');
var mixins = require('rework-mixins');
var calc = require('rework-calc');
var breakpoints = require('rework-breakpoints');
var modules = require('rework-modules');
var myth = require('myth');
@camshaft
camshaft / input.md
Last active January 2, 2016 15:59
Angular input directive problem

Purpose

I'm wanting to create a directive that renders an input based on the response from an api:

<input data-hyper-input="input.birthday" />

with the api response:

style.
body {
font-family: Helvetica, Arial, san-serif;
padding: 40px;
}
[id^="hyper-"] {
display: block;
margin: 20px;
}
@camshaft
camshaft / riak-dt.sh
Created November 14, 2013 22:08
bootstrap riak with the datatype bucket types
#!/bin/bash
: ${TYPES:="map set counter"}
for TYPE in $TYPES
do
./bin/riak-admin bucket-type create $TYPE '{"props": {"datatype": "'$TYPE'", "allow_mult": true}}'
./bin/riak-admin bucket-type activate $TYPE
done
@camshaft
camshaft / jsonview.css
Created August 22, 2013 03:14
JSONView Colors
body {
white-space: pre;
font-family: monospace;
background: #0F323D;
color: #83948F;
}
.property {
font-weight: bold;
}
@camshaft
camshaft / compress.js
Last active December 18, 2015 19:39
Enum compression
/**
* Compress scopes with an emum into an efficient integer
*/
function compressScope(scopes, scopesEnum) {
var value = scopesEnum.map(function(scope) {
return (!!~scopes.indexOf(scope)) ? '1' : '0';
}).join('');
return parseInt(value, 2);
};
@camshaft
camshaft / secret.js
Created May 17, 2013 20:33
Simple-secret command line tool
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander')
, secrets = require('simple-secrets');
program