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 router from 'redshirt'; | |
| import { admin, body } from '../middleware'; | |
| import { db, slugify } from '../util'; | |
| const NEW = 'new'; | |
| router.group('/forums/categories') | |
| .get('/', async () => { | |
| const categories = await db.forums.categories.all(); |
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 Plugin from '../core/plugin'; | |
| import Component from '../core/component'; | |
| import System from '../core/system'; | |
| import quantity from '../core/components/quantity'; | |
| import texture from '../core/components/texture'; | |
| const particle = new Component({ | |
| all: Component.types.array, | |
| color: Component.types.string, |
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 router from 'redshirt'; | |
| import { admin, body } from '../middleware'; | |
| import { db, json, slugify } from '../util'; | |
| router.group('/forums/categories') | |
| .get('/', async () => { | |
| return json(await db.forums.categories.all()); | |
| }) | |
| .post('/', [ admin, body ], async request => { |
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 engine from '../engine'; | |
| import system from '../system'; | |
| import input from '../components/input'; | |
| import position from '../components/position'; | |
| import velocity from '../components/velocity'; | |
| export default system([ input, position, velocity ], entity => { | |
| const { keyboard } = engine; | |
| const { controls } = input.of(entity); |
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 { execFileSync } from 'child_process'; | |
| import { JSDOM } from 'jsdom'; | |
| const { Promise } = global; | |
| const options = { resources: 'usable', runScripts: 'dangerously' }; | |
| const server = execFileSync('node', [ './dist/server/index.js' ], { cwd: process.cwd() }); | |
| const browser = { }; | |
| beforeAll(async () => { |
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 { execFile } from 'child_process'; | |
| import { JSDOM } from 'jsdom'; | |
| const { Promise } = global; | |
| const options = { resources: 'usable', runScripts: 'dangerously' }; | |
| const server = execFile('node', [ './dist/server/index.js' ], { cwd: process.cwd() }); | |
| const browser = { }; | |
| beforeAll(async () => { |
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 { Server } from 'uws'; | |
| import actions from './actions'; | |
| import messenger from './messenger'; | |
| import router from './router'; | |
| import state from './state'; | |
| const { PORT, TEST_PORT } = process.env; | |
| actions.register(); |
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 function query () { | |
| let cql = ''; | |
| return { | |
| insert (table, data) { | |
| const keys = Object.keys(data).join(', '); | |
| const values = Object.values(data).join(', '); | |
| cql += `INSERT INTO ${ table } (${ keys }) VALUES (${ values }) `; |
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 vm from 'vm'; | |
| export default { | |
| [ '>' ] (input) { | |
| const context = { | |
| Array, | |
| Boolean, | |
| Buffer, | |
| Date, |
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 arithmetic (input) { | |
| let expression = input.replace(/\s/g, ''); | |
| const numbers = /((?:\d|\.)+)/; | |
| const groups = /\(([^(]+?)\)/; | |
| const methods = [ | |
| { op: /(\^|\*{2})/, fn: (x, o, y) => x ** y }, | |
| { op: /(\*|\/|\%)/, fn: (x, o, y) => { | |
| if (o === '*') return x * y; | |
| if (o === '/') return x / y; |