Skip to content

Instantly share code, notes, and snippets.

View remstos's full-sized avatar

Rémi Santos remstos

View GitHub Profile
@ArnaudWopata
ArnaudWopata / understand_promises.js
Created July 7, 2014 15:28
Understand promises
var Q = require('kew');
function failureSync(){
throw new Error('sync failure');
};
function failureAsync(){
return Q.reject(new Error('async failure'));
};
@sgmurphy
sgmurphy / url_slug.js
Created July 12, 2012 02:05
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>