This file contains 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
#include <std/core.pat> | |
enum Tables : u16 { | |
name = 4, | |
}; | |
struct table_entry_t { | |
char name[4]; | |
u32 offset; | |
u64 length; |
This file contains 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 range = (min, max) => (min - max) * Math.random() + max; | |
class Particle { | |
constructor(x, y, canvas) { | |
this.setPhysics(); | |
this.setDimensions(); | |
this.setGraphics(); | |
this.x = x; | |
this.y = y; | |
this.canvas = canvas; |
This file contains 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
/*------------------------ | |
Libraries | |
------------------------*/ | |
const axios = require("axios"); | |
const fs = require("fs"); | |
const FormData = require("form-data"); | |
/*------------------------ | |
Download the file. | |
Good article on how to download a file and send with form data - https://maximorlov.com/send-a-file-with-axios-in-nodejs/ |
This file contains 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
// 22: class - creation | |
// To do: make all tests pass, leave the assert lines unchanged! | |
describe('class creation', () => { | |
it('is as simple as `class XXX {}`', function() { | |
class TestClass {} | |
const instance = new TestClass(); | |
assert.equal(typeof instance, 'object'); |
This file contains 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 Stack = (function module() { | |
const items = []; | |
function execute() { | |
for (let i = items.length - 1; i >= 0; i--) { | |
items[i](); | |
items.pop(); | |
} | |
} |
This file contains 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
/* eslint-disable no-undef */ | |
/* eslint-disable no-magic-numbers */ | |
const confusingBrowserGlobals = require('confusing-browser-globals'); | |
module.exports = { | |
env: { | |
browser: true, | |
es2021: true, | |
}, | |
parser: '@babel/eslint-parser', |
This file contains 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 './js/router'; | |
import a11y from './js/a11y' | |
import './styles/body.sass'; | |
import { createElement, createFragment } from 'createElement'; | |
import Home from './components/Home'; | |
import { Test3 } from './components/Test3'; | |
import { render, initialize } from './js/renderer'; | |
import Header from './components/Header'; | |
/** @jsx createElement */ | |
/** @jsxFrag createFragment */ |
This file contains 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 Router { | |
constructor() { | |
this.#init(); | |
} | |
#paths = {}; | |
#redirect(url) { | |
if (url === '/404') { | |
window.history.replaceState(null, null, url); |
This file contains 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 Router { | |
constructor() { | |
this.init(); | |
} | |
paths = {}; | |
handleError() { | |
console.error('Route pattern does not match url. Redirecting client to 404 page'); | |
} |
This file contains 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 { | |
app, BrowserWindow, TouchBar, nativeImage, ipcMain, | |
} = require('electron'); | |
const { TouchBarScrubber, TouchBarButton } = TouchBar; | |
const image = nativeImage.createFromPath('./m.png').resize({ height: 30 }); | |
app.on('ready', () => { | |
const win = new BrowserWindow({ |
NewerOlder