Skip to content

Instantly share code, notes, and snippets.

View vpalos's full-sized avatar

Valeriu Paloş vpalos

View GitHub Profile
@vpalos
vpalos / class.js
Last active September 26, 2015 03:38
JS: Simple Class implementation supporting deep inheritance and augmentation.
/**
* Class.js: A class factory.
* (http://vpalos.com/1194/js-classes-for-the-masses/)
*/
function Class(members) {
// setup proxy
var Proxy = function() {};
Proxy.prototype = (members.base || Class).prototype;
@vpalos
vpalos / options.js
Created May 20, 2011 07:29
JS: CLI argument parser.
/** Command-line options parser (http://valeriu.palos.ro/1026/).
Copyright 2011 Valeriu Paloş (valeriu@palos.ro). All rights reserved.
Released as Public Domain.
Expects the "schema" array with options definitions and produces the
"options" object and the "arguments" array, which will contain all
non-option arguments encountered (including the script name and such).
Syntax:
[«short», «long», «attributes», «brief», «callback»]