Skip to content

Instantly share code, notes, and snippets.

View benchristel's full-sized avatar

Ben Christel benchristel

  • Khan Academy
  • Palo Alto, CA
View GitHub Profile
@benchristel
benchristel / README.md
Last active October 14, 2023 19:44
Setting up a JavaScript Development Environment

Setting up a JavaScript Development Environment

Welcome to the wonderful world of JavaScript development! I hope you find it enjoyable and rewarding.

The basic tools of the JS trade these days are:

  • node, which runs JavaScript code.
  • nvm (Node Version Manager), which updates node and lets you switch between different versions.
  • yarn, a package manager for installing projects' dependencies.
@benchristel
benchristel / index.html
Created July 3, 2022 18:34
Using taste in codepen.io
<div id="results"/>
@benchristel
benchristel / index.html
Last active June 28, 2021 04:23
Aqua (Mac OS) scrollbars in Webkit
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>yo</title>
<style>
::-webkit-scrollbar {
background: linear-gradient(to right, #ccc, #fff 20%, #ddd);
cursor: default;
}
@benchristel
benchristel / userChrome.css
Last active August 22, 2021 18:15
Fix Firefox 91 tabs
/*
On Mac, paste this into ~/Library/Application Support/Firefox/Profiles/5a6b7cx1.default-release/chrome/userChrome.css
The random ID before default-release will be different for you.
You will have to create the chrome directory and the userChrome.css file.
To tell Firefox to use userChrome.css, follow the instructions here:
https://www.howtogeek.com/334716/how-to-customize-firefoxs-user-interface-with-userchrome.css/
You must restart Firefox for changes to this file to take effect.
*/
/* Remove rounded corners from everything */
@benchristel
benchristel / leechblock.txt
Last active April 28, 2021 03:23
Blocker config for YouTube
+youtube.com/*/videos
+youtube.com/c
+youtube.com/channel
+youtube.com/feed/history
+youtube.com/feed/subscriptions
+youtube.com/results
+youtube.com/user
+youtube.com/watch
youtube.com/
@benchristel
benchristel / bench_test.go
Created February 11, 2021 19:15
Benchmark for IsSubset in Go: O(n) vs O(n^2) algos
package main
// run with go test -bench=.
// My (oversimplified) conclusions are:
// - if you have less than 64 items in each slice, it's faster to do an O(n^2) nested loop
// - if you have more than 64 items, it's worth using a map as an index
import "testing"
import "math/rand"
// prevent the compiler from optimizing away the function under test
@benchristel
benchristel / fifth.peg
Created December 15, 2020 01:22
PEG.js grammar for Fifth
// Paste this into https://pegjs.org/online
Program = _ ts: TermSequence {
return ts
}
TermSequence = terms: Term* _ {
return terms
}
@benchristel
benchristel / memory.md
Created April 22, 2020 16:33
Computers: A Memory

COMPUTERS: A MEMORY

I have a lot to say and not much time to say it. I hope, therefore, that you'll forgive the somewhat rambling structure of this book. I have chosen not to hew to a particular structure or group topics around particular themes. This may be the only book I write on the subject of computing, so I want it to capture everything I have to say.

The most important thing is this: Computing should be

@benchristel
benchristel / main.js
Created October 31, 2019 15:53
Verse GCF
define({
'test greatest common factor of primes is 1'() {
assert(gcf(1, 3), is, 1)
assert(gcf(7, 3), is, 1)
assert(gcf(7, 57), is, 1)
},
'test gcf of 0 and 0 is NaN'() {
assert(gcf(0, 0), isNaN)
},
@benchristel
benchristel / README.md
Created September 8, 2019 16:15
Phrasebook generator spec

Panglossia

Goals

The purpose of this project is to produce phrasebooks in computer-generated languages to add flavor to role-playing games or other media.

Anti-goals

This project does not aim to produce comprehensive grammars, dictionaries, or other