Skip to content

Instantly share code, notes, and snippets.

View fabiancook's full-sized avatar
🏠
Working on Open Source and some other bits!

Fabian Cook fabiancook

🏠
Working on Open Source and some other bits!
View GitHub Profile
@guest271314
guest271314 / buffer-bun-bundle.js
Last active January 20, 2024 04:00
feross/buffer bundled to Ecmascript Module
// git clone https://github.com/feross/buffer
// cd buffer
// bun install base64-js ieee754
// bun build ./index.js --target=browser --outfile=buffer.js
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
// node_modules/base64-js/index.js
var require_base64_js = __commonJS((exports) => {
var getLens = function(b64) {
@guest271314
guest271314 / javascript_engines_and_runtimes.md
Last active November 19, 2024 08:25
A list of JavaScript engines, runtimes, interpreters

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others. It implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

SpiderMonkey is Mozilla’s JavaScript and WebAssembly Engine, used in Firefox, Servo and various other projects. It is written in C++, Rust and JavaScript. You can embed it into C++ and Rust projects, and it can be run as a stand-alone shell. It can also be [compiled](https://bytecodealliance.org/articles/making-javascript-run-fast-on

@guest271314
guest271314 / javascript_stdio_unspecified.md
Last active November 16, 2023 06:22
JavaScript Standard Input/Output: Unspecified

JavaScript Standard Input/Output: Unspecified

Some definitions. One important point is stdin, stdout, stderr do not have to originate from a keyboard, or a TTY.

Let's hear what IBM has to say Understanding standard input, standard output, and standard error

Once a command begins running, it has access to three files:

  1. It reads from its standard input file. By default, standard input is the keyboard.
@ttesmer
ttesmer / AD.hs
Last active October 29, 2024 15:35
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v

My Stripe Tax Story

I've been debating for weeks whether or not I was going to write any of this down. I'm a dad with two kids and a house to take care of and a business to run. Adding story-telling like this to my plate is exhausting.

Until yesterday, I had decided to forget about the whole thing, until I received the email that broke the camels back, as it were.

The best way I can describe why I'm writing this email is for the same reason why you might spend two hours dealing with an uncooperative mobile phone carrier to get them to remove that $5 charge on your bill that shouldn't be there. Some combination of the feeling of frustration and injustice that really pushes my proverbial buttons.

In this particular case, the "$5 charge on my phone bill" turned out to be literally hundreds of recurring subscription invoices that Stripe disabled collection for because, apparently, those subscriptions required "location inputs".

Generally speaking, I don't blog much anymore, and the last thing I wa

@mrousavy
mrousavy / MEMOIZE.md
Last active September 26, 2024 13:19
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia
@bcherny
bcherny / designing-data-intensive-application-notes.md
Last active May 5, 2024 19:57
Notes: Designing Data-Intensive Applications

Notes on Martin Kleppmann's excellent Designing Data-Intensive Applications.

Chapter 1: Reliable, Scalable, and Maintainable Applications

  • Data Systems
    • Dimensions to consider when thinking about data systems: access patterns, performance characteristics, implementations.
    • Modern data systems often blur the lines between databases, caches, streams, etc.
  • Reliability
    • Systems should perform the expected function at a given level of performance, and be tolerant to faults and user mistakes
  • Fault: One component of a system deviating from its spec. Prefer tolerating faults over preventing them (except for things like security issues). Faults stem from hardware failures, software failures, and human error (in a study, config errors caused most outages).
@onlurking
onlurking / programming-as-theory-building.md
Last active November 13, 2024 17:31
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@bellydrum
bellydrum / clickBotChecker.js
Last active March 18, 2019 17:56
Checks if a bot is auto-clicking a specified DOM element.
/**
* clickBotChecker.js
* ------------------------------------------------------------------------------
* ABOUT:
* clickBotChecker.userIsBot() returns true if it thinks a bot is clicking your specified DOM element.
* METHOD
* .userIsBot() does the following to determine auto-clicking behavior:
* 1. Store the timestamp of every n clicks for analysis
* 2. Once three timestamps have been stored, every n clicks, find the absolute value of the difference between:
* a. ( (the average of the last three timestamps) * 3 )
//entry point
import Class1 from "./junk1";
import Class2 from "./junk2";
import Class3 from "./junk3";
export default function() {
let a = new Class1();
let b = new Class2();
let c = new Class3();