Skip to content

Instantly share code, notes, and snippets.

@Klaster1
Klaster1 / wait.ts
Created March 9, 2026 11:48
Angular Vitest convertion helpers
/**
* Wraps a set of Jasmine expects in a retry loop until they pass or a timeout is reached.
*
* Usage notes:
* * Do not wrap non-idempotent side effects with this.
* * Always runs the body at least twice: once to determine stability, one to delegate back to Jasmine.
* * To not waste time, try to wrap as few expression as necessary.
*
* Example:
@acutmore
acutmore / README.md
Last active December 23, 2025 02:44
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@developit
developit / *valoo.md
Last active November 13, 2023 08:39
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.

@matthewp
matthewp / programming-language.md
Last active March 28, 2016 07:19
programming-language.md

Motivation

Writing JavaScript libraries that are stable is hard, too hard. The extreme level of modularity we practice has only made things worse, as it's become very easy to depend on quirks/bugs that exist in other libraries.

The approach that is most often taken to increase stability in a programming language is to introduce Types. That is, trade expressiveness for better static reasoning. The point being, the compiler should be able to find bugs in your program.

I'm interested in another approach; make it easier for the developer to find bugs themselves. To that end, the motivation for this language is to be easy to test. What if everything within a programs closure was available to be mocked.

exports.getName = function(person){
@bterlson
bterlson / mod.js
Last active January 26, 2017 15:25
Module export forms have subtle differences
// exporter1.js
let foo = 1;
export { foo as default }; // exports the foo binding
foo = 2;
// exporter2.js
let foo = 1;
export default foo; // creates a new binding named *default* and initializes it to 1.
foo = 2; // assigns to the foo binding which is not exported
@shannonmoeller
shannonmoeller / multiline-regexp.js
Last active April 12, 2021 22:16
Multiline Regular Expressions using ES6 Template Strings
/**
* Inspired by XRegExp via 2ality
* http://www.2ality.com/2012/12/template-strings-xregexp.html
* http://xregexp.com/
*/
import test from 'ava';
export function rx(flags) {
const trailingComments = /\s+#.*$/gm;
@bishboria
bishboria / springer-free-maths-books.md
Last active February 27, 2026 02:50
Springer made a bunch of books available for free, these were the direct links
@Hypercubed
Hypercubed / .gitignore
Last active December 11, 2015 08:45
plotly-jspm
jspm_packages
@syntagmatic
syntagmatic / README.md
Last active March 22, 2025 02:46
Hypersolids
@zachlysobey
zachlysobey / ng-directive-inline-multi-line-template-string.es6.js
Last active March 3, 2016 11:17
Angular 1 Directive with ES6 Multi-line string template inline.
(function() {
'use strict';
angular
.module('myModule')
.directive('myDirective', myDirective);
const template = `
<div class="my-directive-template">
<h1>Using multi-line Strings for templates</h1>