Skip to content

Instantly share code, notes, and snippets.

@edmundsmith
edmundsmith / writeup.md
Created July 7, 2019 20:47
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

@ErnWong
ErnWong / VGA Data Pipeline V2.txt
Last active January 19, 2018 01:49
v86 VGA Implementation
Same as V1 except we do complete redraws instead of using the color-use linked list. Simplifies the pipeline and code significantly.
Host Memory Write ________ Host Memory Read
| _|______ | ^
write | _|______ | | | read
logic | _|______ | |_| | logic
`-------->| | |_| ------------`
| Planes |_| ^ PLOT: Calculates 4 bit / 8 bit color data
|________| | from planes and plots them at the correct
256KiB | | pixel address. Full replots are rare, and
@copy
copy / Dockerfile
Last active February 20, 2021 20:02
FROM i386/alpine:latest
# https://wiki.gentoo.org/wiki/OpenRC/Baselayout_1_to_2_migration#Boot_runlevel
# https://wiki.alpinelinux.org/wiki/Installing_Alpine_Linux_in_a_chroot#Entering_your_chroot
RUN apk update && \
apk upgrade && \
apk add --no-cache linux-vanilla vim openrc && \
rc-update add devfs sysinit && \
rc-update add root boot && \
@binji
binji / CustomSectionTextFormat.md
Last active April 18, 2022 07:26
CustomSectionTextFormat.md

Custom sections in the text format

This page describes a proposal for representing custom sections in the text format.

Rationale

Currently it is impossible to round-trip a WebAssembly module between the binary and text formats without loss of information because there is no way to

@Benjamin-Dobell
Benjamin-Dobell / Diabolical
Last active August 29, 2018 05:57
Pfft, crashes are for chumps
static jmp_buf jmpEnv;
enum {
kPrepareBinaryAddress = 0x44dd,
kMutexBinaryAddress = 0x9090
};
void signal_handler(int n, siginfo_t *info, void *context)
{
longjmp(jmpEnv, 1);
1.1 Practical Programming - An Introduction to Computer Science Using Python 3
1.2 K&R C
1.3 The C++ Programming Language - Bjarne Stroustrup
1.4 Deitel's Java - How to Program
1.5.1 The Little Schemer
1.5.2 The Reasoned Schemer
1.5.3 The Seasoned Schemer
2.1 Computer Organization and Design - Patterson & Hennessy
3.1 Introduction to Algorithms - Cormen
3.2 Algorithms - Sedgewick
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active April 21, 2024 23:48
An Open Letter to Developers Everywhere (About Cryptography)

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () => x) {
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent