Skip to content

Instantly share code, notes, and snippets.

@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
@dlants
dlants / generic-deriving.purs
Last active April 19, 2021 15:54
Generic deriving with purescript
-- an example of how to derive a show instance for a Maybe type
-- not totally sure why `derive instance showMyMaybe :: (Show a) => Show (MyMaybe a)` errors with...
-- error: CannotDerive :
-- Cannot derive a type class instance for Data.Show.Show (MyMaybe a) since instances of this type class are not derivable.
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
@dlants
dlants / denite.md
Last active March 5, 2021 06:13
denite setup with interactive ag pattern-search of project contents

Files

First things first, I want to use ag to search through my project files. Coming from fzf, I like to have two bindings for this -- one that respects my projects .gitignore and one that does not. The latter is helpful if I want to examine a built file or look at a node_module dependency while working on my js project.

I use an alias for file_rec source to toggle the -u flag on ag. Now, <C-P> searches in my git files, and <C-O> searches everything.

" denite file search (c-p uses gitignore, c-o looks at everything)
map <C-P> :DeniteProjectDir -buffer-name=git -direction=top file_rec/git<CR>
map  :DeniteProjectDir -buffer-name=files -direction=top file_rec