Skip to content

Instantly share code, notes, and snippets.

@isao
isao / rangecheck.js
Created September 13, 2012 20:12
manually check semver's handling of '>x.x' style ranges
var semver = require('semver')
function gettest(range) {
return function(version) {
var isok = semver.satisfies(version, range) ? 'is' : 'is not'
console.log('v%s %s supported for range %s', version, isok, range)
}
}
['0.2.0',
@isao
isao / person.js
Created October 5, 2012 19:20
extend eventemitter w/ Object.create and mixin
var Event = require('events').EventEmitter;
function Person(name) {
this.name = name
}
function getname() {
return this.name
}
@isao
isao / gist:3915260
Created October 18, 2012 23:03
bz 5472979
/**
* Calculates the static handler URL for the resource.
* @private
* @method _calcResourceURL
* @param {object} res the resource for which to calculate the URL
* @param {object} mojitRes the resource for the mojit
* @return {nothing}
*/
_calcResourceURL: function(res, mojitRes) {
var fs = res.source.fs,
@isao
isao / cloc.txt
Created October 29, 2012 22:29
mojito all vs cli cloc
% cloc --exclude-dir=tests lib/
129 text files.
115 unique files.
739 files ignored.
http://cloc.sourceforge.net v 1.56 T=2.0 s (46.0 files/s, 10662.5 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Javascript 87 3327 5012 12925
#!/usr/bin/perl
# Copyright (c) William Uther ([email protected]) 2001
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
@isao
isao / bberrors.py
Created November 2, 2012 19:57 — forked from jlieske/bberrors.py
Script to display compiler output messages in BBEdit browser window
#!/usr/bin/python
# -*- coding: utf-8 -*-
# BBErrors: Script to display compiler output messages in BBEdit browser window
# Copyright Jay Lieske Jr.
# 14 July 2012
import sys, re, os
if sys.stdin.isatty():
@isao
isao / funcsimple.js
Created December 4, 2012 00:08
minimal cli func test with shelljs
#!/usr/bin/env node
var assert = require('assert'),
shell = require('shelljs'),
path = require('path'),
BASEDIR = path.resolve(__dirname, '../') + '/',
NEWSAPP = BASEDIR + 'examples/newsboxes/';
@isao
isao / repl-client.js
Created December 4, 2012 05:10 — forked from TooTallNate/repl-client.js
Running a "full-featured" REPL using a net.Server and net.Socket
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)
@isao
isao / bbs.js
Created December 4, 2012 05:10 — forked from TooTallNate/bbs.js
Running a node.js REPL over `curl`
/**
* Requires node v0.7.7 or greater.
*
* To connect: $ curl -sSNT. localhost:8000
*/
var http = require('http')
, repl = require('repl')
, buf0 = new Buffer([0])
@isao
isao / 1 shell session
Created December 12, 2012 22:12
debugging `mojito build hybdridapp` for 0.5.x the following is a sample hybrid app build after the updating the app/hybrid archetype here: https://github.com/isao/mojito/commit/f1faf282c38ef378ea386c0507607b558539fbe3
% mojito create app hybrid hyb
creating app type named 'hyb'
(using "hybrid" archetype)
✔ app: hyb created!
✔ mojito done.
% ( cd hyb && mojito build hybridapp ../hyb-bld -r -n name -t tag --context build:debug )
warn: (mojito-perf): microtime not found. Recorded times will not have microsecond accuracy
debug: (mojito-dispatcher): Dispatcher created
warn: (mojito-resource-store): Url collision for /favicon.ico. Choosing: /Users/isao/Repos/mojito/apps/hyb/assets/favicon.ico over /Users/isao/Repos/mojito/myfork/lib/app/assets/favicon.ico