Compressing 4 bundles with Pound (npm view pound) with JavaScript production code from https://redsmin.com
- times: 37720ms 36971ms
- output size: 533Ko, 479Ko, 120Ko, 538Ko
// Mix async (request) + sync (writeFile) style | |
var request = require('request') | |
, async = require('async') | |
, fs = require('fs') | |
, friends = require('./friends'); | |
function getImgPath(friend){ | |
return './public/'+friend.uid+".jpg"; | |
} |
#!/bin/sh | |
git checkout gh-pages | |
git rebase master | |
git checkout master |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
/** | |
* Add the following code just after UnderscoreJS declaration to find | |
* where _.template calls are run against empty templates. | |
*/ | |
(function(old){ | |
_.template = function(str, data) { | |
if(!str){ | |
console.error("Could not load template", new Error().stack); |
Compressing 4 bundles with Pound (npm view pound) with JavaScript production code from https://redsmin.com
-- table.filter({"a", "b", "c", "d"}, function(o, k, i) return o >= "c" end) --> {"c","d"} | |
-- | |
-- @FGRibreau - Francois-Guillaume Ribreau | |
-- @Redsmin - A full-feature client for Redis http://redsmin.com | |
table.filter = function(t, filterIter) | |
local out = {} | |
for k, v in pairs(t) do | |
if filterIter(v, k, t) then out[k] = v end | |
end |
-- strpad(input, pad_length, [pad_string], [pad_type]) | |
-- (php-style) implemented in LUA (inspired from https://gist.github.com/2625581) | |
-- @FGRibreau - Francois-Guillaume Ribreau | |
-- @Redsmin - A full-feature client for Redis http://redsmin.com | |
local function strpad(input, pad_length, pad_string, pad_type) | |
local output = input | |
if not pad_string then pad_string = ' ' end | |
if not pad_type then pad_type = 'STR_PAD_RIGHT' end |
/** | |
* September 20 night: 1 hour code rush | |
* @FGRibreau | |
* | |
* Requirements | |
* ------------ | |
* The aim of this code rush is to enable developers to define a "range hash map" | |
* in a very expressive way (without if/then/else). | |
* | |
* Data-set |
/** | |
* Patch the console methods in order to provide timestamp information | |
* | |
* Usage: | |
* > console.log('ok') | |
* 2012-09-06T11:52:56.769Z ok true | |
* | |
* Note: | |
* The patch will only be applied with the first call. | |
* |
Object.defineProperty(Array.prototype, 'until',{ | |
/** | |
* Return the array elements until a selector is matched | |
* @param {Number|String|Function} selector | |
* @return {Array} A new array that goes from the first element to `selector` | |
* | |
* Usage: | |
* deepEqual([1,2,3,4,5].until(4), [1, 2, 3, 4]) | |
* deepEqual(['a','b','c','d','e'].until('c'), ['a', 'b', 'c']) | |
* deepEqual([{t:'a'},{t:'b'},{t:'c'},{t:'d'}].until(function(o){return o.t == 'c';}), [{t:'a'},{t:'b'},{t:'c'}]) |