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
### Push | |
git subtree push --prefix dist origin gh-pages | |
### Force | |
git subtree split --prefix dist -b gh-pages; git push -f origin gh-pages:gh-pages; git branch -D gh-pages; | |
### Force (detailed) | |
git checkout master # you can avoid this line if you are in master... | |
git subtree split --prefix dist -b gh-pages # create a local gh-pages branch containing the splitted output folder | |
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin |
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
export default class Queue { | |
constructor () { | |
this.id = this.newid() | |
this.queue = [] | |
} | |
add (callback) { | |
this.queue.push({ | |
id: this.id, | |
callback | |
}) |
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
export function map (n, start1, stop1, start2, stop2) { | |
return ((n - start1) / (stop1 - start1)) * (stop2 - start2) + start2 | |
} | |
export function constrain (n, low, high) { | |
return Math.max(Math.min(n, high), low) | |
} | |
export function mapConstrain (n, start1, stop1, start2, stop2) { | |
const start = start2 !== undefined ? start2 : start1 |
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
/* | |
css(element, { | |
backgroundColor: 'red', | |
}) | |
*/ | |
export function css (el, styles) { | |
for (var style in styles) { | |
el.style[style] = styles[style] | |
} | |
} |
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 {x,y,width,height} = Cover (elements-width, elements-height, container-width, container-height) | |
element.style.top = y + 'px' | |
element.style.left = x + 'px' | |
element.style.width = width + 'px' | |
element.style.height = height + 'px' | |
* Element will fill out the container like css {background-size: cover} | |
* make container desired dimensions and set to overflow:hidden |
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 sliderA, sliderB | |
var dim = 20 | |
function setup() { | |
createCanvas(600, 600) | |
sliderA = createSlider(0, dim, dim * 0.75, 1); | |
sliderA.position(600, 0); | |
sliderB = createSlider(0, dim * 2, dim * 0.25, 1); | |
sliderB.position(600, 20); | |
} |