Skip to content

Instantly share code, notes, and snippets.

View serby's full-sized avatar
😃
Joyful

Paul Serby serby

😃
Joyful
View GitHub Profile
var request = require('supertest')
, express = require('express')
, app = express()
app.get('/', function (req, res) {
res.end()
})
var server = app.listen(function () {
var jade = require('jade')
, browserify = require('browserify')
, fs = require('fs')
module.exports = function (inputFile, outputFile, options) {
var b = browserify(options)
b.register('.jade', function (body, file) {
var options = { client: true, compileDebug: true, filename: file }
body = 'module.exports = ' + jade.compile(body, options).toString() + ';'
// If the model has changed, warn user.
var formData = mapFormToObject(this.model.schema)
, newModel = _.extend({}, this.model.attributes, formData)
if (_.isEqual(this.initialModel, newModel)
|| confirm('You have unsaved changes. Are you sure you want to cancel?')) {
this.trigger('cancel')
}
@serby
serby / robot.js
Created December 6, 2012 16:43
Serby
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;

Reversibles

Set by Tom Smith and Michael Cronnelly

Languages Allowed

  • JavaScript
  • PHP
  • Java
  • C#
  • Ruby
insert query update delete getmore command flushes mapped vsize res faults locked % idx miss % qr|qw ar|aw netIn netOut conn set repl time
0 35 22 0 27 3 0 6.36g 13.9g 1.35g 0 0.8 0 0|0 1|0 14k 12m 21 itvladbrokes M 21:09:57
0 46 24 0 22 1 0 6.36g 13.9g 1.35g 0 0.2 0 0|0 0|0 15k 2m 21 itvladbrokes M 21:09:58
0 46 31 0 36 3 0 6.36g 13.9g 1.35g 0 0.7 0 0|0 1|0 19k 11m 21 itvladbrokes M 21:09:59
0 50 29 0 31 1 0 6.36g 13.9g 1.35g 0 0.3 0 0|0 1|0 18k 10m 21 itvladbrokes M 21:10:00
0 41 27 0 26 3 0 6.36g 13.9g 1.35g 0 0.5 0 0|0 1|0 17k 10m 21 itvladbrokes M 21:10:01
0 58
module.exports = function(maid) {
maid.files('js', ['**/*.js'])
maid.files('stylus', ['public/css/**/*.styl'])
maid('test', function(done) {
maid.exec('@./node_modules/.bin/mocha -r should -R spec', done)
})
@serby
serby / piler.js
Created November 10, 2012 09:07 — forked from bengourley/piler.js
var stylus = require('stylus')
, nib = require('nib')
, uglify = require('uglifyjs')
function processStylus(input, cb) {
fs.readFile(input.src, function (err, data) {
if (err) return cb(err)
․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․PID 13544 received SIGSEGV for address: 0x0
0 segvhandler_native.node 0x0000000100cde4f7 _ZL16segfault_handleriP9__siginfoPv + 423
1 libsystem_c.dylib 0x00007fff8e60e8ea _sigtramp + 26
2 ??? 0x0000321f55700000 0x0 + 55110158778368
3 contextify.node 0x00000001009f8c8a _ZN17ContextifyContext20GlobalPropertyGetterEN2v85LocalINS0_6StringEEERKNS0_12AccessorInfoE + 136
4 node 0x000000010024b5c2 _ZN2v88internal8JSObject26GetPropertyWithInterceptorEPNS0_10JSReceiverEPNS0_6StringEP18PropertyAttributes + 530
5 node 0x000000010024b05e _ZN2v88internal6Object11GetPropertyENS0_6HandleIS1_EES3_PNS0_12LookupResultENS2_INS0_6StringEEEP18PropertyAttributes + 126
6 node 0x00000001001fc21f _ZN2v88internal6LoadIC4LoadENS0_16InlineCacheStateENS0_6HandleINS0_6ObjectE
@serby
serby / gist:4037755
Created November 8, 2012 09:30
wordBurglar errinfo output
$ sudo errinfo -p 6687
EXEC SYSCALL ERR DESC
node kevent 4 Interrupted system call
node sigreturn -2
node wait4 10 No child processes
node __semwait_signal 60 Operation timed out