Skip to content

Instantly share code, notes, and snippets.

@edmundsmith
edmundsmith / writeup.md
Created Jul 7, 2019
Method for Emulating Higher-Kinded Types in Rust
View writeup.md

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 Jan 19, 2018
v86 VGA Implementation
View VGA Data Pipeline V2.txt
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
View Dockerfile
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 Apr 18, 2022
CustomSectionTextFormat.md
View 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 Aug 29, 2018
Pfft, crashes are for chumps
View Diabolical
static jmp_buf jmpEnv;
enum {
kPrepareBinaryAddress = 0x44dd,
kMutexBinaryAddress = 0x9090
};
void signal_handler(int n, siginfo_t *info, void *context)
{
longjmp(jmpEnv, 1);
View cstheory.txt
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 Sep 1, 2022
require-from-twitter
View README.md
@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active Oct 2, 2022
An Open Letter to Developers Everywhere (About Cryptography)
View crypto-wrong-answers.md
View kangax-es6-quiz-explained.md

@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 Oct 2, 2022
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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