Skip to content

Instantly share code, notes, and snippets.

View codeactual's full-sized avatar

David Smith codeactual

  • Found Apparatus
View GitHub Profile
var cache = new clientsiiide('MyFeedWidget');
// Asynchronous with read-through.
cache.get({
ns: 'tags',
keys: ['key1', 'key2'],
expires: 3600,
onDone: function(results) {
// Process key/value pairs in "results".
},
@codeactual
codeactual / mainevent_nginx_access.js
Created April 14, 2012 01:11
mainevent's nginx access log parser module (JS)
'use strict';
var extend = require(__dirname + '/../../prototype.js').extend;
exports.NginxAccessParser = extend({name: 'NginxAccess', humanName: 'nginx access'}, {
parse: function(log) {
// From fluentd-0.10.9/lib/fluent/parser.rb:
return this.namedCapture(log, '^(?<host>[^ ]*) [^ ]+ (?<user>[^ ]+) \\[(?<time>[^\\]]+)\\] "(?<method>\\S+) (?<path>[^ ]+) \\S+ (?<code>[^ ]+) (?<size>[^ ]+) ("(?<referer>[^\\"]+)")? ("(?<agent>[^\\"]+)")?$');
},
@codeactual
codeactual / mainevent_nginx_access_event.html
Created April 15, 2012 05:30
mainevent's nginx access log parser module (Event HTML)
{>event_header/}
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Field</th>
<th>Value</th>
</tr>
</thead>
<tbody>
@codeactual
codeactual / mainevent_nginx_access_preview.html
Created April 15, 2012 05:31
mainevent's nginx access log parser module (Preview HTML)
<span class="label label-{__codeClass}">{code}</span> {host} {method} {path}
{?referer}
<i class="icon-arrow-left"></i><a title="Referer" href="{referer}">{__refererMin}</a>
{/referer}
module.exports = function(grunt) {
return {
middleware: {
files: {
src: ['middleware/**/*.js']
}
}
};
};
module.exports = function(grunt) {
require('grunt-horde')
.create(grunt)
.loot('module-one')
.loot('module-two')
.loot('./config/grunt')
.attack();
};
module.exports = function(grunt) { // Intent: extend patterns seeded by a more universal module ...
this.demand(
'initConfig.jshint.src.files.src',
this.learn('initConfig.jshint.src.files.src').concat('bin/cli.js')
);
};
module.exports = function(grunt) { // Intent: ... or redefine them
return {
src: {
module.exports = function(grunt) {
'use strict';
require('grunt-horde')
.create(grunt)
.demand('initConfig.projName', 'conjure')
.demand('initConfig.instanceName', 'conjure')
.demand('initConfig.klassName', 'Conjure')
.loot('node-component-grunt')
.loot('node-lib-grunt')
@codeactual
codeactual / Concurrent map benchmarks
Created January 24, 2016 03:21 — forked from donovanhide/Concurrent map benchmarks
Benchmarks for different implementations of a concurrent map
To benchmark:
go test -bench=".*" > machine_description.txt
@codeactual
codeactual / trace-to-mp4.js
Created March 4, 2017 02:32 — forked from krisselden/trace-to-mp4.js
Make an mp4 out of a Chrome DevTools trace with screenshots.
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const execSync = require('child_process').execSync;
if (process.argv.length < 3) {
console.log(`node ${path.relative('.', process.argv[1])} [DevToolsProfile]`);
process.exit(1);
}
let traceFile = path.resolve(process.argv[2])