Skip to content

Instantly share code, notes, and snippets.

View dlants's full-sized avatar

dlants dlants

View GitHub Profile
// Types to make the code more readable and type-safe
type StudentResponse = number[][]
type AnswerKey = number[][]
type CardPair = [number, number]
type PairCount = { pair: CardPair; count: number }
/**
* Finds incorrectly grouped card pairs across all student responses,
* sorted by frequency (most frequent first)
*/
Consider the following story:
Jack was an enforcer in an organized crime unit in Moscow lead by a man called Yuri. Arriving seemingly out of nowhere, Jack quickly gained a reputation as someone who could get things done. He tracked down people, and squeezed money out of them in seemingly impossible circumstances, where everyone else failed. Due to his success, he was invited to come along on an assignment to Prague. Yuri informed Jack that they were getting into some serious business now, and assigned him to be a body guard to a Russian diplomat who was going to be making some business arrangements. But Jack and the diplomat vanished. Shortly after, Yuri and the rest of the crew were seized at the border by a CIA agent who bared an uncanny resemblance to Jack.
Please answer the following questions about the story:
* Why did Jack come to Moscow?
* What likely happened to Jack and the diplomat?
* Was Jack good or evil?
* Who was the CIA agent at the end of the story?
* How did Yuri likely feel when meeting t
@dlants
dlants / neovim-lsp-config-tsserver-debug.lua
Created April 14, 2023 19:27
How to debug neovim lsp-config's interaction w/ tsserver / typescript-language-server
require("lspconfig").tsserver.setup {
cmd = {"typescript-language-server", "--stdio", "--log-level", "4"},
init_options = {
hostInfo = "neovim",
maxTsServerMemory = 4096,
tsserver = {
logDirectory = <path>,
logVerbosity = "verbose"
}
},
@dlants
dlants / Dockerfile
Created March 9, 2023 01:02
yarn in docker build dockerfile w/ private github repo & cache mount
# for yarn berry
FROM --platform=linux/amd64 node:14.21-bullseye
# install node_module packages needed to build
WORKDIR /app
COPY .yarnrc.yml .
COPY .yarn/releases/yarn-3.4.1.cjs .yarn/releases/yarn-3.4.1.cjs
COPY package.json .
COPY yarn.lock .
2020-09-16T20:45:36.498+0000 checking options
2020-09-16T20:45:36.498+0000 dumping with object check disabled
2020-09-16T20:45:36.498+0000 will listen for SIGTERM, SIGINT, and SIGKILL
2020-09-16T20:45:36.500+0000 connected to node type: standalone
2020-09-16T20:45:36.500+0000 standalone server: setting write concern w to 1
2020-09-16T20:45:36.500+0000 using write concern: w='1', j=false, fsync=false, wtimeout=0
2020-09-16T20:45:36.538+0000 archive prelude source-db.collection1
2020-09-16T20:45:36.538+0000 archive prelude source-db.collection2
2020-09-16T20:45:36.538+0000 archive prelude source-db.collection3
2020-09-16T20:45:36.538+0000 archive prelude source-db.collection4
This is a sticker pack. It does not collect, store, transmit, or share any personal information.
This privacy policy was last updated in April 2019.
a
abandon
ability
able
abortion
about
above
abroad
absence
absolute

Here's a great question from an essay by mathematician Paul Lockheart called "Mathematician's Lament" https://www.maa.org/external_archive/devlin/LockhartsLament.pdf

One interesting way to think about numbers is as piles of stones. So, instead of thinking of the number 3, you can imagine three stones in your mind, or draw three dots on a piece of paper.

Thinking about numbers in this way can be useful because of the different ways we can arrange the stones. A 3 can be arranged with all stones in a row ..., or as a triangle :.. By considering these arrangements, we have a different way of thinking about the number.

So, for instance -- if you take an even number, you'll be able to arrange the stones into two equal rows. For an odd number, one of the rows will have a stone that doesn't have a match:

6 :::
9 ::::.
@dlants
dlants / resize.md
Created August 24, 2017 04:01
Adding a Window Resize signal to a purescript pux webapp

As I mentioned at the start of our time with Snap, there were two primary goals in working through these first few labs, and that is to get acquainted with repetition statements (repeat, forever...) and to learn about defining your own custom blocks and parameters. This ability to group and name pieces of code is the foundation of computer science, and starts to get at the idea of what it truly means to build abstractions.

If I had to summarize computer science in one sentence it would be "To notice and exploit structure to solve problems". I think this will sound familiar to a math educator - this is how we solve problems in any field, after all. Even so, I think it is useful to consider how this idea relates to this particular context.

  1. Modularity (or, orthogonality). Programmers seek to separate problems into small, independent pieces. In a large system, you want to be able to modify an individual piece of code without having to grasp the entire system. This is the only way to solve complic