Skip to content

Instantly share code, notes, and snippets.

View mheiber's full-sized avatar

Max Heiber mheiber

View GitHub Profile
@mheiber
mheiber / ecs-notes.md
Last active June 26, 2020 10:09
Notes on Entity Component Systems

Entity Component Systems notes from someone who doesn't write games and didn't know what ECS was.

Why care?

Possible Maintainability Advantages of ECS Systems as Compared to OOP:

  • State shape is more explicit, so much more likely to make good sense as an app grows
  • ECS encourages much less plumbing for data flow between parts of an app, since systems can just read whatever they want.
    • For big stateful apps, OO seems to encourage an 8-to-1 ratio of data plumbing compared to biz logic
  • easier to safely share behavior
  • Supports state serialization for record/replay debugging
@mheiber
mheiber / jsconf-asia-autobang-talk.md
Last active January 24, 2019 02:41
JSConf.Asia Autobang (JS->strict TS) Talk

Summary: I describe why and how we built "Autobang", a tool that automatically converts JS projects to strict TypeScript. This is an unusual solution to a problem that previously seemed intractable for large projects.

We built a tool to automatically convert a JS codebase to strict TypeScript with some interesting trade-offs. This is a hard and interesting problem I've never heard discussed

Why TypeScript

@mheiber
mheiber / TypeScript's Type System as a Little Language.md
Last active April 28, 2019 19:16
2019 Conference Talk: TypeScript's Type System as a Little Language

TypeScript's Type System as a Little Language

Theme: Thinking of type-level TS as a programming language

It has all the pieces!

  • data:
    • objects, arrays, and tuples
  • functions
  • structured programming:

Should this error?

class Parent {
  #foo;
  copy(instance) {
    this.#foo = instance.foo;
  }
}
class Child extends Parent {}

Equality: Prior Art in Programming Languages

This document contains notes on how equality works in different programming languages, with a focus on immutable data types in functional languages.

OCaml

OCaml and Reason

OCaml has two equality primitives:

this content has moved! link coming soon

@mheiber
mheiber / count.erl
Created May 23, 2020 15:22
count.py, count.erl
-module(three).
-export([main/1]).
main(FileName) ->
{ok, Device} = file:open(FileName, [read]),
Cnt = device_counts(Device, maps:new()),
io:format("~p", [Cnt]).
device_counts(Device, Map) ->
case io:get_line(Device, "") of
set nocompatible
filetype off " required for Vundle
:set suffixesadd+=.js
nnoremap <leader><space> :noh<return>
nnoremap <leader><leader> :b#<CR>
nnoremap <leader>s :source ~/.vimrc<CR>
nnoremap <leader>q :xall<CR>
nnoremap <right> <C-w>10>
nnoremap <left> <C-w>10<
nnoremap <up> :resize -5<Cr>