Skip to content

Instantly share code, notes, and snippets.

View msaglietto's full-sized avatar

Mauricio Saglietto msaglietto

View GitHub Profile
var fs = require('fs'),
readCache = {},
Y = require('yui/handlebars'),
templates = require('./templates'),
partials = templates.getRaw();
function read(path, options, fn) {
var str = readCache[path];
// cached (only if cached is a string and not a compiled template function)
@msaglietto
msaglietto / gist:de7a0132612c6c7e980f
Created March 15, 2015 22:55
Simple route parser to extract parameters from a url given a format
var SimpleRouteParser = function(format) {
var namedParam = /\/(:(\w+))/g,
names,
route,
setFormat = function(format) {
if (!format) throw new Error('Please specify the url format');
names = [];
route = format.replace(namedParam, function(match, param, name) {
@msaglietto
msaglietto / esnextbin.md
Created June 30, 2016 16:20
esnextbin sketch
@msaglietto
msaglietto / esnextbin.md
Created August 29, 2016 15:15
esnextbin sketch
((global) => {
//
// GLOBAL VARS AND CONFIGS
//
let waitTime = 5;
let waitForAnswer = true;
const ignoreLastMsg = {};
const jokeList = [