Paul Grenier AutoSponge

View utils.js
1 2 3 4 5 6 7 8 9 10
var part = require( 'part' );
var _push = part._create( Array.prototype.push );
 
// take, leave
var part = require( 'part' );
var slice_ = part.create_( Array.prototype.slice );
var take_ = slice_.bind( null, 0 );
var apply_ = part.create_( Function.prototype.apply );
var leave = function ( n ) {
return function ( fn ) {
View traverse-schema.js
1 2 3 4 5 6 7 8 9 10
var fs = require( "fs" );
var traverse = require( "traverse" );
var schemaName = process.argv[2];
var schemaPath = "./" + schemaName;
 
if ( !schemaName ) {
throw new ReferenceError( "unable to find schema file at '" + schemaPath + "'." );
}
 
var schema = require( schemaPath );
View array.js
1 2 3 4 5 6 7 8 9 10
(function (global, a, f) {
 
var list = ["map", "filter", "some", "every", "reduce", "reduceRight", "sort"];
 
function flip(fn) {
 
return function (that, arg) {
 
//use arguments length because arg could be falsey
return arguments.length > 1 ? fn.call( that, this, arg ) : fn.call( that, this );
View bash_profile
1 2 3 4 5 6 7 8 9 10
# allows bash-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
 
# displays the user, full path (next line) working directory and branch (if git repo)
export PS1='\u[\w]\n[\W]$(__git_ps1 "(%s)"): '
 
# ls shortcuts
alias ..='cd ..'
View maintainability.js
1 2 3 4 5 6 7 8 9
/*
 
starting code
 
Maintainability index: 103.291144930526
Physical LOC: 11
Logical LOC: 12
Aggregate cyclomatic complexity: 5
Functions:
View delegate.js
1 2 3 4 5 6 7 8 9 10
function s4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
function guid() {
return (s4() + s4() + "-" + s4() + s4() + "-" + s4() + "-" + s4() + s4() + s4()).toLowerCase();
}
function handle(scope, fnName, args, componentResult) {
return function (key) {
var component = scope.component = scope.composite.components[key];
if (fnName in component && typeof component[fnName] === "function") {
View #10.js
1 2 3 4 5 6 7 8 9 10
function isPrime(n) {
var a = Math.floor(Math.sqrt(n));
while (a > 1) {
if (!(n%a)) {
return false;
}
a -= 1;
}
return true;
}
View counter.js
1 2 3 4 5 6 7 8 9 10
function count(seed, d) {
var i = seed;
return function counter(n) {
i += (n || d);
return function () {
return i;
};
};
}
var i = count(1, 2);
View #1.js
1 2 3 4 5
(function (n) {
return Array.prototype.join.call({length: n + 1}, 0).split("").reduce(function (prev, curr, i, arr, undef) {
return (!(i%3) || !(i%5)) && i > 0 ? prev.push(i) && prev : prev;
}, []).reduce(function (a, b) {return a + b;});
}(1000)) //233168
View _fake_ajax.html
1 2 3 4 5 6 7 8 9
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>fake ajax</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="fake.js"></script>
<script src="config.js"></script>
<script>
Something went wrong with that request. Please try again.