This file contains hidden or 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 fetchStream(url) { | |
| const req = new Request(url) | |
| return fetch(req).then(rs => { | |
| const reader = rs.body.getReader() | |
| return reader.read().then(({ done, value }) => { | |
| const decoder = new TextDecoder('utf-8') | |
| return decoder.decode(value) | |
| }).catch(err => console.log(`Could not fetch from ${url}!`, err)) |
This file contains hidden or 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 date = new Date() | |
| const day = date.getDate() | |
| const month = date.getMonth() + 1 | |
| const year = date.getFullYear() | |
| const time = `${month}/${day}/${year}` |
This file contains hidden or 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
| String.prototype.trunc = String.prototype.trunc || function(n) { | |
| return (this.length > n) ? this.substr(0, n-1) + '…' : this; | |
| }; |
This file contains hidden or 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
| import wait from './wait'; | |
| //... | |
| save(formData) { | |
| //... | |
| upload(formData) | |
| .then(wait(1500)) // DEV ONLY: wait for 1.5s | |
| .then(x => { | |
| this.uploadedFiles = [].concat(x); |
This file contains hidden or 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 const easings = { | |
| linear(t) { | |
| return t; | |
| }, | |
| easeInQuad(t) { | |
| return t * t; | |
| }, | |
| easeOutQuad(t) { | |
| return t * (2 - t); | |
| }, |
This file contains hidden or 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 const serve = (path, cache) => express.static(resolve(path), { | |
| maxAge: cache && isProd ? 60 * 60 * 24 * 30 : 0 | |
| }) |
This file contains hidden or 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
| //https://developer.mozilla.org/en-US/docs/Web/Events/resize | |
| (function() { | |
| var throttle = function(type, name, obj_) { | |
| var obj = obj_ || window; | |
| var running = false; | |
| var func = function() { | |
| if (running) { | |
| return; | |
| } |
This file contains hidden or 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
| .brdr-envelope { | |
| background-image: url(envelope-border.png); | |
| background-position: 0 100%; | |
| background-repeat: repeat-x; | |
| background-size: 40px 3px; | |
| } |
This file contains hidden or 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
| NODE_ENV=development |
This file contains hidden or 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 REPO_NAME=repo | |
| export RELEASE=release-or-branch | |
| curl -L https://github.com/user-or-org/$REPO_NAME/archive/$RELEASE.tar.gz | tar xz \ | |
| && mv $REPO_NAME-$RELEASE/* ./ |