Skip to content

Instantly share code, notes, and snippets.

View lancejpollard's full-sized avatar
😍
Lots of coding

Lance Pollard lancejpollard

😍
Lots of coding
View GitHub Profile
@VictorTaelin
VictorTaelin / towards_an_optimal_computer.md
Last active November 8, 2024 20:28
Higher-Order Company: Towards an Optimal Computer

Higher-Order Company: Towards an Optimal Computer

What is the true nature of computation?

A hundred years ago, humanity answered that very question, twice. In 1936, Alan invented the Turing Machine, which, highly inspired by the mechanical trend of the 20th century, distillated the common components of early computers into a single universal machine that, despite its simplicity, was capable of performing every computation conceivable. From simple numerical calculations to entire

@VictorTaelin
VictorTaelin / implementing_fft.md
Last active November 12, 2024 09:06
Implementing complex numbers and FFT with just datatypes (no floats)

Implementing complex numbers and FFT with just datatypes (no floats)

In this article, I'll explain why implementing numbers with just algebraic datatypes is desirable. I'll then talk about common implementations of FFT (Fast Fourier Transform) and why they hide inherent inefficiencies. I'll then show how to implement integers and complex numbers with just algebraic datatypes, in a way that is extremely simple and elegant. I'll conclude by deriving a pure functional implementation of complex FFT with just datatypes, no floats.

@lancejpollard
lancejpollard / readme.md
Last active January 13, 2022 04:21
Universal Language Encoding (ULE)

Universal Language Encoding (ULE)

An alternative to the UTF encodings to handle more languages in a more compact way.

<language><characters><language><characters>...

Everything is in bytes.

@zmts
zmts / imageSize.md
Created June 6, 2020 16:48
Get image width and height with JavaScript

Get image width and height with JavaScript

function imageSize (image) {
  return new Promise((resolve, reject) => {
    try {
      const fileReader = new FileReader()

      fileReader.onload = () => {
 const img = new Image()
@IGJoshua
IGJoshua / lo me mi moi jbobau.org
Last active August 12, 2023 05:33
The lojban I speak

The lojban I speak

coi ro do mi’e la saski’o tu’a dei cu ve ciksi tu’a lo me mi moi jbobau

Introduction

let xn = (x, n) => x ** (n - 1n); // TODO: has a probably O(n!) complexity. More efficient algorithm needed.
function mod(x, n) {
const _xn = xn(x, n);
return (_xn - 1n) % n === 0n;
}
function withTimer(fn, timeName = 'Run time') {
return (...args) => {
console.time(timeName);
@rumkin
rumkin / chacha20.js
Last active May 29, 2020 10:50
Chacha20-Poly1305.js
/* chacha20 - 256 bits */
// Written in 2014 by Devi Mandiri. Public domain.
//
// Implementation derived from chacha-ref.c version 20080118
// See for details: http://cr.yp.to/chacha/chacha-20080128.pdf
function U8TO32_LE(x, i) {
return x[i] | (x[i+1]<<8) | (x[i+2]<<16) | (x[i+3]<<24);
}
@fnky
fnky / ANSI.md
Last active November 15, 2024 17:29
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
page ,132
title memcpy - Copy source memory bytes to destination
;***
;memcpy.asm - contains memcpy and memmove routines
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;Purpose:
; memcpy() copies a source memory buffer to a destination buffer.
; Overlapping buffers are not treated specially, so propogation may occur.
@yelouafi
yelouafi / algebraic-effects-series-4.md
Last active March 1, 2024 15:31
Implementing Algebraic Effects and Handlers

Algebraic Effects in JavaScript part 4 - Implementing Algebraic Effects and Handlers

This is the final part of a series about Algebraic Effects and Handlers.

So we've come to the core topic. The reality is that we've already covered most of it in the previous parts. Especially, in the third part, where we saw delimited continuations at work.