This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ? | |
{ | |
padleft=""; padright=""; title="$(pwd)" | |
padleftcount="$(( ($COLUMNS - ${#title})/2 ))" | |
while [ ${#padleft} -lt $padleftcount ] ; do padleft+=" "; done | |
function progress { echo $((${#padleft} + ${#title} + ${#padright})); } | |
while [ $(progress) -lt $COLUMNS ] ; do padright+=" " ; done | |
echo -e "\n\e[1;4;37;40m${padleft}${title}${padright}\e[0m" | |
ls "$@" && echo ""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sw/bin/js | |
function euler(firstPoint) { | |
print("Curr is:" + firstPoint) | |
function inner(passedPoint) { | |
var prevAsOuter = passedPoint | |
return function(currInner) { | |
print("\nPrev was:" + prevAsOuter) | |
print("Curr is:" + currInner) | |
//Rewrite the fn yet again so prev will be stored 4 next time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
//While creating a 'trim' we get a 'remove' for free | |
//remove('cat','c') === 'at'; //true | |
remove = apply(flip(String.prototype.replace)('')), | |
//trim(' c ') === 'c'; //true | |
trim = flip(remove)([/^\s+|\s+$/g]), | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
chain = flipAll(compose), | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
contains = function (haystack,needle) { | |
//NOTE: Case-Insensitive | |
return new RegExp(needle,'i').test(haystack); | |
}, | |
containedBy = flip(contains), | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
clock = clockwise = function (fn) { | |
//WHY: Turns this: | |
// function (o,k,f) {}; | |
// Into something which behaves like this: | |
// function (k,f,o) {}; | |
return args(function (args) { | |
var last = args.pop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = 1, | |
l = proxy(console.log,console), | |
data = { a: { d: 1,b: { c: 3,e: 4 } } }, | |
att = curry(function (a,o,v) { | |
//the following should also work | |
//return o[a] = v || o[a]; | |
return v ? (o[a] = v) : o[a]; | |
},2), | |
id = function (x) { return x; }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
unQuery = function (fn) { | |
//Allows the usual context-style chaining | |
//but between all libraries. | |
return compose(flip(apply(fn)),arrayWrap); | |
}, | |
// ... | |
$.fn.options = function (list) { | |
//PURPOSE: This plugin provides a useful | |
// abstraction for populating <select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
//AJAX DEFAULTS | |
basicAjax = addDefaults($.ajax,{ | |
type: "GET", | |
dataType: 'json', | |
contentType: 'application/json', | |
error: function (jqXHR,textStatus,errorThrown) { | |
/* do some default error handling */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
use = curry(function (obj,fn) { | |
//WHY: Implements qualified references in Javascript, | |
// without using Javascript's 'with'. | |
// Javascript doesn't allow us to alter the scope | |
// of a given piece of code programmatically without | |
// using 'with'. But 'with' has been labeled a 'bad | |
// part'. Because it is inefficient, and in some |
OlderNewer