Skip to content

Instantly share code, notes, and snippets.

View wisniewski94's full-sized avatar
🏇

Wiktor wisniewski94

🏇
View GitHub Profile
#include <std/core.pat>
enum Tables : u16 {
name = 4,
};
struct table_entry_t {
char name[4];
u32 offset;
u64 length;
@wisniewski94
wisniewski94 / definition.js
Created November 10, 2022 21:02
Declarative Shadow DOM Experiment
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;
@wisniewski94
wisniewski94 / generateTree.js
Created July 3, 2019 23:21
N-ary Tree Generator
class Node {
constructor(parent, id) {
this.id = id;
this.child = [];
this.parent = parent;
}
setChild(child) {
this.child.push(child);
}
/*------------------------
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/
@wisniewski94
wisniewski94 / ES6 Class creation
Created November 29, 2021 00:36 — forked from jchavarri/ES6 Class creation
Some tests to play with ES6 classes
// 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');
const Stack = (function module() {
const items = [];
function execute() {
for (let i = items.length - 1; i >= 0; i--) {
items[i]();
items.pop();
}
}
/* 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',
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 */
class Router {
constructor() {
this.#init();
}
#paths = {};
#redirect(url) {
if (url === '/404') {
window.history.replaceState(null, null, url);
class Router {
constructor() {
this.init();
}
paths = {};
handleError() {
console.error('Route pattern does not match url. Redirecting client to 404 page');
}