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 merge | |
| * | |
| * @param {object} object The object to merge with | |
| * @param {object} source The object to merge | |
| * @return {object} merge result | |
| */ | |
| export const merge = (object = {}, source = {}) => { | |
| // deep assign | |
| for (const key of Object.keys(object)) { |
Uni Routing
- window.location
- window.onhashchange // catch hashes, usefull when hashbanging
- browser history (https://developer.mozilla.org/en-US/docs/Web/API/History_API)
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 {readFile} = require('fs'); | |
| readFile('path/to/some/file', (error, buffer) => { | |
| const arrayBuffer = new ArrayBuffer(buffer.length) | |
| const bufferView = new Uint8Array(arrayBuffer); | |
| for (var i=0, length=buffer.length; i < length; i++) { | |
| bufferView[i] = buffer[i]; | |
| } | |
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 ipfsdNode from 'ipfsd-node'; | |
| (async () => { | |
| const ipfsd = await ipfsdNode({ | |
| bootstrap: 'earth', | |
| sharding: true, | |
| relayHop: true, | |
| flags: ['--enable-pubsub-experiment'], | |
| repoPath: 'path/to/repo', | |
| cleanup: false |
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 define from '../../node_modules/backed/src/utils/define'; | |
| import RenderMixin from '../../node_modules/custom-renderer-mixin/src/render-mixin'; | |
| import './party-slider'; | |
| import lines from './../utils/lines'; | |
| export default define(class PartyMixer extends RenderMixin(HTMLElement) { | |
| constructor() { | |
| super(); | |
| this.attachShadow({mode: 'open'}) | |
| this._change = this._change.bind(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
| export default params => { | |
| const store = {}; | |
| let string = ''; | |
| if (params === undefined) { | |
| params = {count: 6, substract: 0, width: 12, height: 3, substractHeight: 0}; | |
| } | |
| let {count, substract, width, height, substractHeight} = params; | |
| if (count === undefined) count = 6; | |
| if (substract === undefined) substract = 0; | |
| if (substractHeight === undefined) substractHeight = 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
| For my own sanity ;) Scraped from a variety of places, including: http://stackoverflow.com/questions/14130560/nodejs-udp-multicast-how-to?utm_medium=twitter&utm_source=twitterfeed | |
| !Server | |
| var news = [ | |
| "Borussia Dortmund wins German championship", | |
| "Tornado warning for the Bay Area", | |
| "More rain for the weekend", | |
| "Android tablets take over the world", | |
| "iPad2 sold out", |
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
| class ProgressRing extends HTMLElement { | |
| constructor() { | |
| super(); | |
| const stroke = this.getAttribute('stroke'); | |
| const radius = this.getAttribute('radius'); | |
| const normalizedRadius = radius - stroke * 2; | |
| this._circumference = normalizedRadius * 2 * Math.PI; | |
| this._root = this.attachShadow({mode: 'open'}); | |
| this._root.innerHTML = ` |
OlderNewer
