Breton Breton

View mustachec
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env php
<?php
// Command line utility to compile MUSTACHE to STDOUT
// I bastardised this based on lessc by:
// Leaf Corcoran <leafot@gmail.com>, 2012
// which is licensed by MIT/GPL according to his website.
// Additionally, this requires mustache.php to be in the same directory
// Mustache.php can be "compiled" to be in a single file
// following these instructions https://twitter.com/bobthecow/status/319159329578180609
// (quoted below)
View hairlip.js
1 2 3 4 5 6 7 8 9 10
// Hairlip is
// a very tiny version of mustache that only does variable replacement
// and nothing else.
String.prototype.hairlip = function (o) {
return this.replace(/{{([^{}]*)}}/g,
function (a, b) {
return {string:true,number:true}[typeof o[b]] ? o[b] : "";
}
);
};
View twixel.js
1 2 3 4 5 6 7 8 9 10
(function () {
var base64URLAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
var baseRevMap = {};
var IDCounter = 0;
var pixelratio=1; //let's deal with the retina display bugs.
 
function ID (){
return IDCounter++;
}
base64URLAlphabet.split("").forEach(function (o, i) {
View glob.js
1 2 3 4 5 6 7 8 9 10
//based on fnmatch.py
String.prototype.escape = function () {
"use strict";
 
 
var escapable = /[.\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
View ngram.js
1 2 3 4 5 6 7 8 9 10
//**@snippet ngramcount
//model utilities
ngramcount = {
sort: function () {
var keys = Object.keys(this.table),
g = this.table,
sorted;
keys = keys.filter(function (o) {
return typeof g[o] !== 'string';
});
View string.template.js
1 2 3 4 5 6 7 8 9 10
//**@snippet String.prototype.template
/* A simple templating method based on Douglas Crockford's supplant. */
/* This method replaces all instances of the ${key} pattern with the */
/* corresponding key's value on the object passed into it. it also uses */
/* the pattern [key: text ${key} text] to signify repetition */
/* patterns. The inner text of the pattern is repeated N times, where N */
/* is the number of items at the key. A zero length array, null, */
/* undefined or empty string on the key removes the pattern entirely. */
/* Otherwise an array containing strings or objects gets applied */
/* recursively to the inner text pattern. */
Something went wrong with that request. Please try again.