https://orm.drizzle.team/docs/relations
Use Case: Each employee has exactly one desk, and each desk is assigned to only one employee.
Table Definitions
import ws from "ws" | |
import { Pool as PgPool } from "pg" | |
import { drizzle as drizzlePg } from "drizzle-orm/node-postgres" | |
import { Pool as NeonPool, neonConfig } from "@neondatabase/serverless" | |
import { drizzle as drizzleNeon } from "drizzle-orm/neon-serverless" | |
import { getEnvVar } from "@/lib/utils" | |
import * as schema from "./schema" | |
import type { NodePgDatabase } from "drizzle-orm/node-postgres" | |
import type { NeonDatabase } from "drizzle-orm/neon-serverless" |
https://orm.drizzle.team/docs/relations
Use Case: Each employee has exactly one desk, and each desk is assigned to only one employee.
Table Definitions
// 1. Create new expense report and add items to it | |
// 2. Click on Details and set Workspace equal to Drive Social Media | |
// 3. Click on the first line item to open up the Edit Expense modal | |
// 4. Right click on the page and click on Inspect to open the browser devtools | |
// 5. In the devtools, open the Console tab | |
// 6. Paste the code below into the console and hit enter | |
// 7. Type the following and hit enter to start automating your report... automateReport() | |
const automateReport = async () => { | |
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) |
I'm using uv now. I'm also still using pyenv, but uv may replace the need for this in the future.
Setting up a development environment for Python can be a bit confusing, mainly stemming from the fact that there are multiple competing standards for package management.
Compared with JavaScript and Node.js, which indeed have several different popular package managers such as npm
, yarn
, and pnpm
, they at least all agree on a common manifest format (package.json
) and they are largely all interoperable with each other. In addition, it's very clear to new JS developers that npm
is where you ought to start.
export function debounce(delay, callback, accumulateData) { | |
let timeout = null | |
let data = [] | |
return function () { | |
if (accumulateData) { | |
const arr = [] | |
for (let i = 0; i < arguments.length; ++i) { | |
arr.push(arguments[i]) | |
} | |
data.push(arr) |
const getRandomBool = () => Math.random() >= 0.5 | |
const getJitterMultiplier = (min: number, max: number): number => { | |
const percent = (Math.random() * (max - min) + min) / 100 | |
return getRandomBool() ? 1 + percent : 1 - percent | |
} | |
const asyncRetry = async (fn, opts = {}) => { | |
const defaultOpts = { retries: 5, interval: 100, exponential: false, jitter: false } | |
opts = { ...defaultOpts, ...opts } |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/epzio/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, | |
# to know which specific one was loaded, run: echo $RANDOM_THEME | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes |
[Info - 2:32:46 PM] Loading Elm tree-sitter syntax from ../.vscode/extensions/elmtooling.elm-ls-vscode-0.10.2/server/out/tree-sitter-elm.wasm | |
[Info - 2:32:47 PM] Found 1 elm.json files for workspace /Users/epzio/PhotoGroove | |
[Info - 2:32:47 PM] Found 1 unique elmWorkspaces for workspace /Users/epzio/PhotoGroove | |
[Info - 2:32:47 PM] Starting language server for folder: file:///Users/epzio/PhotoGroove | |
[Info - 2:32:47 PM] Elm version 0.19.1 detected. | |
[Info - 2:32:47 PM] Reading elm.json from /Users/epzio/PhotoGroove/elm.json | |
[Info - 2:32:47 PM] 2 source-dirs and test folders found | |
[Info - 2:32:47 PM] Found 35 files to add to the project | |
[Info - 2:32:47 PM] Adding /Users/epzio/PhotoGroove/src/PhotoGroove.elm | |
[Info - 2:32:47 PM] Adding /Users/epzio/.elm/0.19.1/packages/elm/browser/1.0.2/src/Browser.elm |
#!/bin/bash | |
# | |
# Inspects branch name and checks if it contains a Jira ticket number (i.e. ABC-123). | |
# If yes, commit message will be automatically prepended with [ABC-123]. | |
# | |
# Useful for looking through git history and relating a commit or group of commits | |
# back to a user story. | |
# |
const pMap = require('p-map') | |
const Chance = require('chance') | |
const chance = new Chance() | |
const userIds = [ 52, 84, 71, 66, 12, 39, 18, 99, 7, 48 ] | |
// Simulate a network call | |
const getUser = async (id) => { | |
await new Promise(resolve => setTimeout(resolve, 1000)) |