Flow charts (Also coming soon is Wireframes and Stickies)
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
const truncate = function(fullStr, strLen, separator) { | |
if (fullStr.length <= strLen) return fullStr; | |
separator = separator || '…'; | |
const sepLen = separator.length; | |
const charsToShow = strLen - sepLen; | |
const frontChars = Math.ceil(charsToShow/2); | |
const backChars = Math.floor(charsToShow/2); |
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
// LOOP ARRAY KEYS and INDEXES | |
let myArray = ['fruit', 'fish', 'seahorses', 'mudslides']; | |
for (let [index, value] of myArray.entries()) { | |
console.log(index, value); | |
} | |
/* | |
0 "fruit" | |
1 "fish" |
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
Name Character Entity | |
Copyright © © | |
Registered ® ® | |
Trademark ™ ™ | |
Curly Open Double Quote “ “ | |
Curly Closed Double Quote ” ” | |
Curly Open Single Quote ‘ ‘ | |
Curly Closed Single Quote ’ ’ | |
Big Bullet/Dot • • |
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
cd /path/to/directory/ | |
/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py --output collated.pdf *.pdf |
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
// My preferred method | |
let obj = {"one" : 1, "two" : 2, "three": 3 } | |
for (let k of Object.keys(obj)) { | |
console.log(k, obj[k]) | |
} |
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
/* | |
Timer | |
- utilises animation frames (with a fallback to setTimeout when using the polyfill, below) | |
- returns remaining (or running) time | |
- pass a callback [fn], with an optional duration [ms] and autotart [bool], to the constructor or 'init' method | |
eg. new Timer(foo, 1000) *or* (new Timer()).init(foo, 0, true) | |
- for uniform x-browser support combine with the requestAnimationFrame polyfill from Erik Möller, et. al. | |
[https://github.com/darius/requestAnimationFrame] | |
*/ |
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
// From here: | |
// https://stackoverflow.com/questions/1420881/how-to-extract-base-url-from-a-string-in-javascript/26708573#26708573 | |
const parseUrl = (string, prop) => { | |
const a = document.createElement('a'); | |
a.setAttribute('href', string); | |
const {host, hostname, pathname, port, protocol, search, hash} = a; | |
const origin = `${protocol}//${hostname}${port.length ? `:${port}`:''}`; | |
return prop ? eval(prop) : {origin, host, hostname, pathname, port, protocol, search, hash} | |
} |
NewerOlder