Skip to content

Instantly share code, notes, and snippets.

@ethanniser
ethanniser / 1brc.exs
Last active March 18, 2024 14:54
1 billion row challenge in a SINGLE EXPRESSION WITH ELIXIR!!
Mix.install([
{:explorer, "~> 0.8.0"}
])
# Update to the filepath.
filepath = "./data/weather_stations.csv"
defmodule Challenge do
import Explorer.Series
[0] [905710] pas panic: deallocation did fail at 0x600000002: Large heap did not find object
[0] Illegal instruction
[0] bun run --hot src/main.ts exited with code 132
whatplan@GAMER:~/code/tests/beth-mvc-test$ bun dev
$ concurrently "bun run --hot src/main.ts" "bun run uno:dev" "bun run liveReload"
[1] $ bunx --bun unocss --watch
[2] $ bunx beth-stack
[0] [0.01ms] ".env"
[2] [0.03ms] ".env"
[1] [0.01ms] ".env"
[2] 🦊 Livereload running localhost:3001
[1] unocss v0.55.7
[1] ◐ UnoCSS in watch mode...
@ethanniser
ethanniser / base.ts
Last active September 15, 2023 00:28
Seperate Files in Elysia
export const ctx = new Elysia({
name: "@app/ctx",
})
.use(plugin())
.decorate("db", db)
.decorate("config", config)
import type {
DecoratorBase,
DefinitionBase,
Handler,
InputSchema,
LocalHook,
MergeSchema,
RouteBase,
RouteSchema,
UnwrapRoute,

Pipe + "Data-First/Last"

Improving Readability of Multiple Function Calls

Most of Effect's functions center around the first argument being the Effect or 'data' to be worked on. However, this can lead to readability issues when calling multiple functions in a row.

Take these 3 simple functions:

const increment = (x: number) => x + 1
const double = (x: number) => x * 2
const subtractTen = (x: number) => x - 10

Section Title

(internal description)

  • Top level page OR Dropdown
    • Inner Page (if dropdown)
      • Headings on Inner Page
enum Duration {
Ms(usize),
Sec(usize),
Min(usize),
Hour(usize),
Day(usize),
Week(usize),
Month(usize),
Year(usize),
}
@ethanniser
ethanniser / ci.yml
Created March 27, 2023 16:06
typecheck/lint on github not on vercel
name: CI
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env: