Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
lmiller1990 / README.md
Created September 19, 2025 11:16
Dead code elimination
npm install
npx rollup -c rollup.config.js

Output is

{
  console.log('someCode ran');
}
@lmiller1990
lmiller1990 / debruijn.py
Last active December 21, 2024 13:26
debruijn
from typing import Optional
class Node:
def __init__(self, label: str):
self.label = label
self.edge: Optional["Edge"] = None
class Edge:
@lmiller1990
lmiller1990 / readme.md
Created December 16, 2024 04:33
devcontainers

I am getting started with devcontainers - I have too many projects, and managing dependencies and versions is getting too tiring. We can automate it with devcontainers.

Example: With Java

I work with Java lately, let's start with that. Let's create a project

mkdir HelloWorld
mkdir -p com/example/HelloWorld
touch com/example/HelloWorld/Main.java
@lmiller1990
lmiller1990 / init.lua
Last active September 15, 2024 11:33
Neovim
vim.cmd("set expandtab")
vim.cmd("set number")
vim.cmd("set tabstop=2")
vim.cmd("set shiftwidth=2")
vim.cmd("set expandtab")
vim.g.mapleader = " "
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
@lmiller1990
lmiller1990 / code.py
Last active August 12, 2024 11:24
Pandas / Python / R
import pandas as pd
import json
from camel_converter import to_snake
def read(jsonfile):
with open(jsonfile, "r") as f:
return json.loads(f.read())
@lmiller1990
lmiller1990 / week1.py
Created July 24, 2024 10:10
Binf7000
import random
standardTranslation = {
"TTT": "F",
"TCT": "S",
"TAT": "Y",
"TGT": "C",
"TTC": "F",
"TCC": "S",
"TAC": "Y",
@lmiller1990
lmiller1990 / content.md
Created January 30, 2024 21:39
Questions for Basarat

Congrats!

You had your 20K sub special 3 months ago. You are now at 141K. Holy smokes! The growth is exponential.

Congrats, well deserved. You are one of my favorite creators - I don't watch every video, only so many hours in a day, but I always have a good time when I do! I first found you via your TypeScript handbook, that was very useful, thanks!

On Content

Looking at your videos, some are hugely popular (50K+) and others are sub 1K. The algorithm is fickle. I do see many other creators getting much more consistent view counts. Any thoughts on this, what they might be doing different?

@lmiller1990
lmiller1990 / lib.es5.d.ts
Created January 29, 2024 10:58
awaited.ts
type Awaited<T> = T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
T extends object & { then(onfulfilled: infer F, ...args: infer _): any; } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument
Awaited<V> : // recursively unwrap the value
never : // the argument to `then` was not callable
T; // non-object or non-thenable
@lmiller1990
lmiller1990 / Form.vue
Created January 20, 2024 01:44
Vaildation
<template>
<input v-model="formData.name" />
<p v-if="!formStatus.name.valid">{{ formStatus.name.message }}</p>
</template>
<script setup lang="ts'>
const formData = reactive({
name
})
@lmiller1990
lmiller1990 / promise.js
Created November 24, 2023 20:51
Improved Solution
import pdefer from "https://unpkg.com/[email protected]/index.js";
/** @returns {Promise<Record<string, boolean>} */
async function fetchAllFeatures() {
console.log("Making network call...");
return new Promise((res, rej) => {
setTimeout(() => {
res({});
}, 500);
});