Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@acutmore
acutmore / README.md
Last active January 21, 2024 20:30
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 March 22, 2024 11:19
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 August 9, 2020 18:50
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>
@Hypercubed
Hypercubed / directive.js
Last active June 3, 2016 16:01
Use systemjs/plugin-text to import html directly to $routeProvider or $templateCache, works great with jspm bundle.
import somethingHTML from './something.html!text';
angular.module('myApp',[])
.directive('myDirective', function() {
return {
template: somethingHTML
}
});