Skip to content

Instantly share code, notes, and snippets.

View mklabs's full-sized avatar

Mickael Daniel mklabs

View GitHub Profile
@mklabs
mklabs / docs.js
Created September 19, 2012 10:00
Grunt markdown task, compiling down to html, triggering reload
var path = require('path');
var hogan = require('hogan');
var marked = require('marked');
module.exports = function(grunt) {
// Basic grunt task to use along watch task, possibly the reload task
// of yeoman server. Designed to work with any given webserver, as
// long as the LiveReload extension for your favorite browser is used
// (http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-).
@mklabs
mklabs / client.js
Created May 23, 2012 22:08
node script experiments at driving chrome via ws
var nopt = require('nopt'),
parse = require('url').parse,
WebSocket = require('faye-websocket');
//
// All based and derived on: http://www.igvita.com/2012/04/09/driving-google-chrome-via-websocket-api
//
// The remote debugging protocol is... I don't have words right now.
// Other than thanks thanks thanks thanks x10e901920
#!/bin/sh
#
# A word about this shell script:
#
# It must work only on systems with a /bin/bash.
#
# cat readme.md || exit 1
@mklabs
mklabs / test.txt
Created March 25, 2012 23:22
test
# cucumberjs + zombiejs + grunt
# this makes testing easier than ever
> node-build-script@0.0.1 pretest /Users/mk/Temp/dev/mklabs/node-build-script
> git submodule update --init && rm -rf .test && mkdir .test && cp -r test/h5bp/* test/h5bp/.htaccess .test/
> node-build-script@0.0.1 test /Users/mk/Temp/dev/mklabs/node-build-script
> node test --log && cd test && node ../node_modules/cucumber/bin/cucumber.js
@mklabs
mklabs / app.js
Created March 14, 2012 16:57
Backbone handy walk the application object to bridge event triggered to function calls
(function(exports) {
// change app to whatever.
var app = exports.app = Object.create(_.extend({}, Backbone.Events, {
// map over the backbone api to an EventEmitter like one
emit: Backbone.Events.trigger
}));
// top-level application namespaces
app.controllers = {};
@mklabs
mklabs / .md
Created February 13, 2012 19:09
browserify windows

Got some issue running browserify on windows. Some notes and the corresponding files patched. Not ran the browserify tests (should do) but tested on a rather complex build, working on both win32, osx.


  • browserify: lib/wrap.js wrappers/prelude.js
  • resolve: index.js

might issue a pull request, this needs tests, I need time (and sleeeeeeeep)

var fs = require('fs'),
path = require('path'),
url = require('url'),
socketio = require('socket.io'),
connect = require('connect'),
mime = connect.static.mime,
// one time-hit, get the file content of the socket.io client side script
ioScript = underscore.template(fs.readFileSync(path.join(__dirname, 'util/socket-enable.js'), 'utf8'));
//
@mklabs
mklabs / build.js
Created January 2, 2012 22:01
markdown to prez thing
// simple markdown to prez converter
// this uses the really neat impress.js as a presentation framework support.
// slides are delimited by h3 level title.
@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@mklabs
mklabs / pre-commit
Created November 15, 2011 17:28
run jshint as git/hg hooks, NO COMMIT IF NO LINT FREE.
#!/usr/bin/env node
// todo: try to require jshint here, instead of spawning process, then fallback to spawning process.
var jshint = nrequire('jshint');
if (jshint) return process.exit(0);
// jshint not installed locally, spawn process instead.
// basically the same, but less pretty.
var exec = require('child_process').exec;