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 schase(models, objects = {}) { | |
| function resolve(data) { | |
| for(const [ name, object ] of Object.entries(data)) { | |
| const [ _, base, ref ] = /(.*?)(_id|Id|Ids|_ids)?$/.exec(name) | |
| const [ plural ] = /es|s$/.exec(ref) || [] | |
| const model = base.replace(/es|s$/, '') | |
| if(!objects[model]) objects[model] = {} |
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
| self.setImmediate = cb => Promise.resolve().then(cb) | |
| var fsModule = new Blob([` | |
| module.exports = { | |
| readdirSync() { | |
| return [] | |
| }, | |
| readFileSync(file) { | |
| const xhr = new XMLHttpRequest() |
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 encoder = new TextEncoder() | |
| const decoder = new TextDecoder() | |
| const ALGORITHMS = { | |
| HS: { name: 'HMAC' }, | |
| ES: { name: 'ECDSA', namedCurve: 'P-256' }, | |
| RS: { name: 'RSASSA-PKCS1-v1_5', modulusLength: 2048, publicExponent: new Uint8Array([0x01, 0x00, 0x01]) }, | |
| PS: { name: 'RSA-PSS', saltLength: 128, modulusLength: 2048, publicExponent: new Uint8Array([0x01, 0x00, 0x01]) }, | |
| } |
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
| var structure = (function () { | |
| "use strict"; | |
| function BaseStruct(values) { | |
| for(var i= values.length-1; i>= 0; i--) { | |
| this[i] = values[i] | |
| } | |
| } | |
| BaseStruct.prototype.toJSON = function toJSON() { | |
| var array = new Array(this.length) | |
| for(var i = array.length-1; i >= 0; 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
| var {ARRAY, NUMBER, STRING, BOOLEAN, OBJECT} = { | |
| ARRAY: Symbol('array'), | |
| OBJECT: Symbol('object'), | |
| NUMBER: Symbol('number'), | |
| STRING: Symbol('string'), | |
| BOOLEAN: Symbol('boolean'), | |
| } | |
| function flatMap(list, callback) { | |
| const result = [] |
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
| var html = heredoc ` | |
| <section> | |
| <h1> title</h1> | |
| <p>content</p> | |
| </section> | |
| ` |
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 belongsto(Class, property, descriptor) { | |
| return { | |
| get() { | |
| return descriptor.get().find(this[property+'Id']) | |
| }, | |
| set(id) { | |
| return this[property+'Id'] = id.id || id | |
| } | |
| } | |
| } |
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
| var Peer = require('simple-peer') | |
| var client = new Peer({ initiator: true }) | |
| var server = new Peer() | |
| var IPADDRESS = /[0-9]+(?:\.[0-9]+){3}/g | |
| var addresses = [] | |
| function getIPs(signal) { | |
| var result = null | |
| Object.keys(signal||{}).forEach(function test(key) { | |
| while(result = IPADDRESS.exec(signal[key])) { |
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
| var through = require('through2'); | |
| var symbols = /¤([^\s,:;()\[\]{}=]+)/g | |
| function strings(string, match) { | |
| return "'" + match + "'" | |
| } | |
| module.exports = function (file) { | |
| return through(function (buffer, enc, next) { | |
| var input = buffer.toString('utf8') |
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
| <link rel="import" href="../polymer/polymer.html"> | |
| <polymer-element name="my-element" attributes="show left right open"> | |
| <template> | |
| <style> | |
| :host { | |
| display block; | |
| width: 100%; | |
| box-sizing: border-box; |
NewerOlder