Skip to content

Instantly share code, notes, and snippets.

View lukeed's full-sized avatar

Luke Edwards lukeed

View GitHub Profile
@guest271314
guest271314 / javascript_engines_and_runtimes.md
Last active May 3, 2024 17:07
A list of JavaScript engines, runtimes, interpreters

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others. It implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

SpiderMonkey is Mozilla’s JavaScript and WebAssembly Engine, used in Firefox, Servo and various other projects. It is written in C++, Rust and JavaScript. You can embed it into C++ and Rust projects, and it can be run as a stand-alone shell. It can also be [compiled](https://bytecodealliance.org/articles/making-javascript-run-fast-on

@pesterhazy
pesterhazy / building-sync-systems.md
Last active May 3, 2024 20:03
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@ryandabler
ryandabler / Arithmetic.ts
Last active December 19, 2023 17:09
Complete example of an arithmetic system built inside TypeScript's type system for this article: https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f
// Utility types
type Length<T extends any[]> = T extends { length: infer L } ? L : never;
type BuildTuple<L extends number, T extends any[] = []> =
T extends { length: L }
? T
: BuildTuple<L, [...T, any]>;
type MultiAdd<N extends number, A extends number, I extends number> =
I extends 0
@developit
developit / *constant-locals-loader.md
Last active February 4, 2022 17:15
Inline Webpack CSS Modules classNames, reducing bundle size. https://npm.im/constant-locals-loader

constant-locals-loader for Webpack

This loader optimizes the output of mini-css-extract-plugin and/or css-loader, entirely removing the potentially large CSS classname mappings normally inlined into your bundle when using CSS Modules.

Run npm install constant-locals-loader, then make these changes in your Webpack config:

module.exports = {
 module: {
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=>
// arrays
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])):
// components
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=>
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):(
// create notes
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props
@frzi
frzi / index.d.ts
Last active September 19, 2019 19:56
Polka Typescript definitions
/**
* Potential candidate for @types/polka.
*/
// Type definitions for polka 1.0.0
// Project: https://github.com/lukeed/polka
// Definitions by: Freek Zijlmans <https://github.com/frzi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
@CodingDoug
CodingDoug / README.md
Last active August 3, 2023 16:41
Copying Data from a Google Sheet into Firebase Realtime Database in real time via Apps Script
@philmander
philmander / nav.jsx
Last active August 1, 2020 15:49
Simple Preact Unit Testing with Jest (with shallow rendering)
import { h, Component } from 'preact';
import { Link } from 'preact-router/match';
class Nav extends Component {
constructor() {
super();
this.state.title = 'Navigation'
}
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments: