Skip to content

Instantly share code, notes, and snippets.

View subfuzion's full-sized avatar

Tony Pujals subfuzion

View GitHub Profile
@subfuzion
subfuzion / tracing-with-pegjs.md
Last active March 6, 2021 12:56
Tracing with peg.js

PEG.js is a simple parser generator for JavaScript that produces fast parsers with excellent error reporting. You can use it to process complex data or computer languages and build transformers, interpreters, compilers and other tools easily.

PEG.js offers tracing support to help analyze parser issues with a grammar. The feature is very helpful, but it's not available yet on the version that's published to npm, it's not well-advertised, and not well-documented. This gist explains how to take advantage of PEG.js tracing support.

When you generate your parser, make sure you supply the trace option set to true. If using gulp, do something like this:

var peg = require('gulp-peg');

var paths = {
@subfuzion
subfuzion / aerospike-quick-start-for-node.md
Last active September 1, 2015 23:47
Aerospike Quick Start for Node

Aerospike Quick Start for Node.js

Aerospike is a high-performance (flash-optimized), distributed key-value NoSQL database. I've just begun to explore it. These are my "quick-and-dirty" getting started notes. I'll augment them as I continue my evaluation.

Prerequisites

Docker

@subfuzion
subfuzion / docker-machine-ssh-command.md
Last active September 21, 2016 01:00
docker-machine ssh command for mongodump backup

Set up

Create a Docker data volume container

$ docker create --name dbdata -v /dbdata mongo /bin/true

Start mongo, expose port to connect

$ docker run -d --name mongo --volumes-from dbdata mongo
@subfuzion
subfuzion / docker-orientation-for-node-developers.md
Last active April 3, 2023 11:58
Docker Orientation for Node Developers

Docker quick start for Node.js developers

Install Dependencies

Install Docker Toolbox

For Mac and Windows users, just install Docker Toolbox. It provides what you need to get started, including:

@subfuzion
subfuzion / docker-for-fun-and-profit.md
Last active December 29, 2015 22:31
Docker for Fun and Profit
@subfuzion
subfuzion / index.js
Last active January 19, 2016 20:31
requirebin sketch
// don't forget to open console to see output
var mm = require('minimatch');
var pattern = '**/src/**/*.js';
var options = {};
var tests = [
{ file: 'src', expect: true },
{ file: 'src/app.js', expect: true },
@subfuzion
subfuzion / .watch.js
Last active January 20, 2016 22:22
Using watch and glob - package.json example
var glob = require('glob');
var path = require('path');
// ===== files to watch =====
// this is just a simple glob example that could be done far more
// easily by using the following run script in package.json:
// "watch": "watch '<cmd>' ./src"
var pattern = './src/**/*';
var options = {};
@subfuzion
subfuzion / .babelrc
Created January 20, 2016 20:13
Babel configuration
{
"presets": ["es2015"],
"plugins": ["syntax-async-functions","transform-regenerator"]
}
@subfuzion
subfuzion / curl.md
Last active April 16, 2025 09:14
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@subfuzion
subfuzion / .tmux.conf
Last active March 25, 2016 05:46
My .tmux.conf for tmux < v2.1
# Inspirations:
# http://mutelight.org/practical-tmux
# http://zanshin.net/2013/09/05/my-tmux-configuration/
# http://files.floriancrouzat.net/dotfiles/.tmux.conf
# http://stackoverflow.com/questions/9628435/tmux-status-bar-configuration
# https://github.com/Lokaltog/powerline
# https://github.com/remiprev/teamocil
# http://superuser.com/questions/74492/whats-the-best-prefix-escape-sequence-for-screen-or-tmux
set -g default-terminal "screen-256color"