Making one for Nexus:
Purpose:Grabbing css values of widths/heights, etc and turning them into numbers
Requirements:none
Code:_clean = function(n) {
if (typeof n !== 'string') { return n }
var x = Number( n.replace(/[^-\d\.]/g,''))
return x }<br>
Output:Turns '
394px' into
393 (integer)
"All we have to decide is what to do with the time that is given to us."
Comments
Pads strings with extra characters
Requirements:
none
Code:
Output:
_lpad('tornado', 12, '.') == '.....tornado'
Prints out Javascript onto the main window
Requirements:
none
Code:
Output:
As described
Finding the interval between two Date objects
Requirements:
none
Code:
Output:
Turns DateA - DateB into {days:0, hrs:4, mins: 35, secs:12, msecs: 140} for instance.
Download data onto computer.
Requirements:
none
Code:
Output:
Turns data into strings and saves it into a file as filename without need for mouse navigation.