Skip to content

Instantly share code, notes, and snippets.

🥑
ArangoDB

Alan Plum pluma

🥑
ArangoDB
Block or report user

Report or block pluma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bl-explained.js
var DuplexStream = require('readable-stream').Duplex,
// A duplex stream is a combination of a read stream and a write stream
// For more on streams see http://nodeschool.io/#stream-adventure
util = require('util')
// The "util" module contains several node core utilities.
// In this case we're just using its inheritance helpers.
// See http://nodejs.org/api/util.html for API docs.
function BufferList(callback) {
// In JavaScript it is common to indicate that a function is a constructor by
@pluma
pluma / smart-transform.js
Created Sep 30, 2014
Smarter version of `omit` and `pick` that can handle prop paths including wildcards and escaping (with backslash).
View smart-transform.js
var wildcard = typeof Symbol === 'undefined' ? true : Symbol.for('wildcard');
function _tokenize(key) {
var tokens = [];
for (var i = 0; i < key.length; i++) {
var token = '';
if (key[i] === '*' && (i + 1 >= key.length || key[i + 1] === '.')) {
tokens.push(wildcard);
i++;
continue;
@pluma
pluma / webapp
Created Oct 15, 2014
Node init.d script with naught.
View webapp
#!/bin/bash
NAME=webapp
IPC=/var/run/naught/$NAME.ipc
DESC="my application server"
WORKERS=2
set -e
case "$1" in
start)
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Tree</title>
<style id="jsbin-css">
.tree {
width: 400px;
margin: 15px 0;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am pluma on github.
  • I am pluma (https://keybase.io/pluma) on keybase.
  • I have a public key whose fingerprint is 640F 5033 8989 39FE 8DEE 8619 D35D 69A8 5AB4 6833

To claim this, I am signing this object:

@pluma
pluma / knockout.tasty.js
Created Jul 10, 2012
Knockout->Tastypie Resource classes
View knockout.tasty.js
define(['ko', 'q-reqwest', 'q-tils', 'aug'], function(ko, qr, qt, aug) {
"use strict";
function propertyGetter(name) {
return function(obj) {
var prop = obj[name];
return (typeof prop === 'function' ? prop.call(obj) : prop);
}
}
function propertyFilter(name, value) {
View swagger.json
{
"swagger": "2.0",
"info": {
"description": "Enterprise Value Architect",
"version": "0.0.1",
"title": "EVA",
"license": {
"name": "inspired.org"
}
},
View es6-array-utils.js
const range1 = n => Array.from(Array(n).keys());
const range2 = (off, n) => Array.from(Array(n - off).keys()).map(i => i + off);
const range3 = (off, step, n) => Array.from(Array(Math.ceil((n - off) / step)).keys()).map(i => i * step + off);
const range = (...args) => args.length === 1 ? range1(...args) : args.length === 2 ? range2(...args) : range3(...args);
const repeat = (x, n) => Array.from(Array(n)).map(() => x);
@pluma
pluma / react-routing-dreamcode.js
Last active Nov 30, 2015
Dreamcode for a nested universal/isomorphic router with support for async prefetching and name-based URL generation
View react-routing-dreamcode.js
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {createHistory} from 'history';
import {Router} from '?';
import {Home, UserList, UserDetail, Admin, AdminDashboard} from './views';
import {ErrorView, NotFound, Forbidden, Login} from './views/error';
import {createStore} from './store';
// routes are defined as plain old objects
@pluma
pluma / vagrant_aliases.sh
Last active Dec 16, 2015
Bash functions I found useful when working with multiple vagrant projects.
View vagrant_aliases.sh
_vagrant_dirnames() {
if [[ $COMP_CWORD > 1 ]]; then
COMPREPLY=()
return 1
fi
local cur="${COMP_WORDS[COMP_CWORD]}"
pushd ~/vagrant/ > /dev/null
local opts=( $cur*/ )
popd > /dev/null
if [[ "$opts" == "$cur*/" ]]; then
You can’t perform that action at this time.