Skip to content

Instantly share code, notes, and snippets.

View ovaillancourt's full-sized avatar

Olivier Vaillancourt ovaillancourt

  • Montreal, QC, Can
View GitHub Profile
@TooTallNate
TooTallNate / transcode.js
Last active April 6, 2024 14:03
Transcode an OGG Vorbis audio file to an MP3 using node-ogg, node-vorbis and node-lame
/**
* Module dependencies.
*/
var fs = require('fs');
var ogg = require('ogg');
var lame = require('lame');
var vorbis = require('vorbis');
/**
* Very simple Mealy style finite state machine relying on a nodejs event emitter. Absolutely not tested
* and contains absolutely no fancy feature. You can put multiple "from" and "to" states by separating
* them with a space. Putting no "from" or "to" amounts to setting them as "undefined", a supported state.
*/
// Example:
/*
var fsm = new Fsm([
{ name : 'wakingup' , from: 'sleeping' , to : 'awake' },
function git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \(\1\)/'
}
PS1=" λ \W\$(git_branch): "
PS2=" | "
@ovaillancourt
ovaillancourt / index.html
Created May 29, 2012 23:15
Socket io + static file serving with connect
<!-- This should be served by your server -->
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost');
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
</script>
@Enome
Enome / route.js
Created April 18, 2012 09:27
Express: basic route that verifies BrowserId
// This route can be used to complete the tutorial at:
// https://developer.mozilla.org/en/BrowserID/Quick_Setup
app.post('/api/login', function( req, res, next ) {
var options = {
host: 'browserid.org',
path: '/verify',
method: 'POST'
};
@cowboy
cowboy / HEY-YOU.md
Last active April 9, 2024 15:54
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.