Skip to content

Instantly share code, notes, and snippets.

View indexzero's full-sized avatar
🌎
Always bet on Open Source

Charlie Robbins indexzero

🌎
Always bet on Open Source
View GitHub Profile
//
// Create our type
//
function PreLoader() {
this._queue = [];
this._mime = {};
this._handlers = {};
this._loaded = [];
};
PreLoader.prototype.addFileType = function addFileType(extension,mime) {
@indexzero
indexzero / git-commit-prefixes
Created April 20, 2011 22:09
Short list of Git commit prefixes used at Nodejitsu
[api]: New apis / changes to apis
[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[ux]: Updates to UX
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[merge]: Resolved git merge from upstream or otherwise
[refactor]: Refactor of existing code with no external API changes
@indexzero
indexzero / client.js
Created May 25, 2011 16:57
A simple "real-world" example of using socket.io
var socket = new io.Socket('localhost', { port: 8000 });
socket.connect();
socket.on('connect', function(client) {
});
socket.on('message', function (msg) {
console.log(msg);
});
@indexzero
indexzero / polynotes.sh
Created June 27, 2018 13:57
Get all the notes about all polyfills served by polyfill.io
#!/usr/bin/env bash
for FILE in ./*/**/config.json; do
PNAME=`dirname "$FILE"`;
PJSON=`cat "$FILE" | json notes`;
if [ ! -z "$PJSON" ]; then
echo "$PNAME $PJSON";
fi
done
@indexzero
indexzero / bench.log
Created September 27, 2017 05:37
winston@3 gets very close to pino
Benchmark: ""pino"" is the fastest.
- winston1 faster than winston2 by 1.1696
- winston3 faster than winston1 by 1.5686
- bunyan faster than winston1 by 1.0245
- pino faster than winston1 by 1.8904
- winston3 faster than winston2 by 1.8347
- bunyan faster than winston2 by 1.1983
- pino faster than winston2 by 2.2109
- winston3 faster than bunyan by 1.5311
- pino faster than winston3 by 1.2051
question:
- https://github.com/winstonjs/winston/issues/1107
- https://github.com/winstonjs/winston/issues/1119
- https://github.com/winstonjs/winston/issues/1088
- https://github.com/winstonjs/winston/issues/1148
- https://github.com/winstonjs/winston/issues/1167
- https://github.com/winstonjs/winston/issues/1192
- https://github.com/winstonjs/winston/issues/1201
- https://github.com/winstonjs/winston/issues/1275
- https://github.com/winstonjs/winston/issues/1226
test-maxsize in winstonjs/winston $ DEBUG=winston:file npx mocha test/transports/file-maxsize.test.js
winston:file ENOENT ok winstonjs/winston/test/fixtures/logs/testmaxsize.log
winston:file stat done: testmaxsize.log { size: 0 }
winston:file create stream start winstonjs/winston/test/fixtures/logs/testmaxsize.log { flags: 'a' }
winston:file create stream ok winstonjs/winston/test/fixtures/logs/testmaxsize.log
File (maxsize)
winston:file file open ok winstonjs/winston/test/fixtures/logs/testmaxsize.log
winston:file written true 0
@indexzero
indexzero / commits.md
Last active December 21, 2017 14:05
My thoughts on Git commit structure

Git commit prefixes

When possible it is preferable to break up your commits into smaller digestable chunks so that they are more readable during the peer review process. One way to accomplish this is by using a known set of git commit prefixes.

  • [api]: New apis / changes to apis
  • [test]: Update test/* files
  • [dist]: Changes to submodules, version bumps, updates to package.json
  • [tiny]: Small changes#
@indexzero
indexzero / injector.js
Created June 22, 2017 20:14
Use static class methods in ES6 to perform lightweight dependency injection / IOC
class Injector {
static register(key) {
this.Components = this.Components || {};
this.Components[key] = key;
console.log(this.Components);
}
passthru(key) {
Injector.register(key);
@indexzero
indexzero / helpers.js
Created June 22, 2011 03:05
A quick sample of how to use api-easy with `npm test`
/*
* helpers.js: Test macros for APIeasy.
*
* (C) 2011, Charlie Robbins
*
*/
var assert = require('assert'),
http = require('http'),
journey = require('journey');