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 run = (fn, ...args) => { | |
return new Worker(URL.createObjectURL(new Blob([`(${fn})(${args})`]))); | |
} |
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 lock from 'pointer-lock'; | |
const movement = {}; | |
const USER_SPEED = 0.15; | |
const handleMove = (initial, camera, move) => { | |
initial.x += move.dx / 3; | |
if (initial.y + move.dy < 90 && initial.y + move.dy > -90) { |
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
/** | |
* Convert map object to multidimensional array | |
* @param {Object} object map object | |
* @return {Array} map array | |
*/ | |
const mapObjectToArray = object => | |
Object.keys(object).map((key) => { | |
if (typeof object[key] === 'object') { | |
return mapObjectToArray(object[key]); | |
} else if (typeof object[key] === 'number') { |
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 normalizeMap = (map, min, max) => { | |
const keys = Object.keys(map); | |
const values = Object.values(map); | |
let normalizedValues; | |
if (typeof values[0] === "object") { | |
normalizedValues = values.map(v => normalizeMap(v, min, max)); | |
} else { | |
normalizedValues = normalizeArray(values, min, max); |
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 functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const request = require('request').defaults({ encoding: null }); | |
const cors = require('cors')({ origin: true }); | |
admin.initializeApp(functions.config().firebase); | |
const bucket = admin.storage().bucket(); | |
exports.uploadImageByURL = functions.https.onRequest((req, res) => { |
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 webpack = require('webpack'); | |
const path = require('path'); | |
const config = { | |
entry: [ | |
'babel-polyfill', './src/index' | |
], | |
output: { | |
path: path.join(__dirname, 'bundle'), | |
filename: 'bundle.js' |
NewerOlder