Skip to content

Instantly share code, notes, and snippets.

View ovaillancourt's full-sized avatar

Olivier Vaillancourt ovaillancourt

  • Montreal, QC, Can
View GitHub Profile
@ovaillancourt
ovaillancourt / Perferences.sublime-settings
Created November 4, 2016 21:48
Sublime text 3 settings
{
"ignored_packages":
[
"Vintage"
],
"theme": "Soda Dark 3.sublime-theme",
"soda_classic_tabs": true,
"font-family" : "Inconsolata",
@ovaillancourt
ovaillancourt / 0_reuse_code.js
Created October 11, 2016 13:32
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
var steps = [
function step1(){
console.log('step1');
this();
},
function step2(){
console.log('step2');
this();
function Parent(){
this.value = 'Parent';
}
Parent.staticMethod = function(){
console.log( 'staticMethod called on Parent' );
}
function Child(){
Parent.call(this);
var EventEmitter = require( 'events' ).EventEmitter;
var emitter = new EventEmitter();
// SECTION-NAME
////////////////////////////////////////////////////////////////////////////////
function emitterClass(){
EventEmitter.call( this );
}
^.*(?:\.\$)([a-zA-Z0-9_]+)\s*.*$
function add( x,y ){
return x + y;
}
function staticAdd( x ){
return function( y ){
return x + y;
}
}
// Template loading code
////////////////////////////////////////////////////////////////////////////////
// Reload the cached files when it changes.
function onFileChange( filename, filePath, cb ){
function exec( event ){
if( process.env.NODE_ENV !== 'production' ){
console.error( 'Loading template:'.yellow, filePath.grey );
}
function wrap( middleware, trigger ){
return function( req, res, next ){
// The trigger can be a function that gets dynamically evaluated every time
// or a static truthy/falsy variable
if( typeof trigger === 'function' ? trigger() : trigger ){
middleware( req, res, next )
}
else{
next();
}
@ovaillancourt
ovaillancourt / gist:4392412
Created December 27, 2012 21:56
Separator snippet for sublime text 2
<snippet>
<content><![CDATA[
// ${1:SECTION-NAME}
////////////////////////////////////////////////////////////////////////////////
$2
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>sep</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->