Skip to content

Instantly share code, notes, and snippets.

@joakin
joakin / nil.odin
Created August 7, 2023 22:57
Odin confusion with nil
package main
import "core:fmt"
Test :: struct {
test: int
}
EnumTest :: enum {
Int,
@joakin
joakin / watch-compile.sh
Last active July 25, 2023 11:20
Watch and compile elm files
#!/usr/bin/env bash
COLOR_OFF="\e[0m";
DIM="\e[2m";
function compile {
# Customize the elm make command as needed
elm make src/elm/Main.elm src/elm/Stories/**/*.elm && rm elm.js
}
@joakin
joakin / DebugJson.elm
Created January 26, 2023 16:19
Debug Json decoders helpers
log : String -> Json.Decode.Decoder a -> Json.Decode.Decoder a
log message =
Json.Decode.map (Debug.log message)
debug : String -> Json.Decode.Decoder a -> Json.Decode.Decoder a
debug message decoder =
Json.Decode.value
|> Json.Decode.andThen (debugHelper message decoder)
@joakin
joakin / ElmBenchmarks.elm
Created January 2, 2023 18:11
Elm benchmarking the best way to encode things to JSON and a few other things
module Main exposing (suite)
import Array exposing (Array)
import Benchmark as B exposing (..)
import Benchmark.Runner exposing (..)
import Dict
import Json.Encode as E
object =
@joakin
joakin / MaybeUnwrap.elm
Created December 20, 2021 07:39
Un safely unwrap a Maybe in production
unwrap : Maybe a -> a
unwrap maybeA =
case maybeA of
Just a ->
a
Nothing ->
unwrap maybeA
@joakin
joakin / countdown.js
Created May 22, 2021 18:12
Countdown minutes and write them to a file, useful for OBS or other programs that want to read files.
let fs = require("fs");
let [, , time] = process.argv;
if (!time) throw new Error("Define a countdown in minutes");
let minutes = Number(time);
if (!minutes || minutes <= 0)
throw new Error(`${time} parsed as ${minutes} which is not a valid time");`);
@joakin
joakin / .gitmodules
Last active October 26, 2021 07:41
Custom webgl-playground program type that handles touch events
[submodule "vendor/webgl-playground"]
path = vendor/webgl-playground
url = https://github.com/justgook/webgl-playground.git
@joakin
joakin / Why using free products made by VC funded companies is a bad idea.md
Last active August 28, 2020 15:07
Why using free products made by VC funded companies is a bad idea

Why using free products made by VC funded companies is a bad idea

Venture capitalits (VCs) fund companies with the expectation of having very high return on investment. These companies that borrow a lot of money have then the expectation of hyper aggressive growth in order to monetize a huge market later and give enormous returns on investment to such VCs.

Often, for those reasons, they make the product free and hire very aggressively, in order to maximize user acquisition and quickly building a product.

After such growth, they find themselves having to find alternative business models instead of just charging people, because if you charge users for something that was free before they will leave.

How do they earn money back for the investors?

@joakin
joakin / habits.md
Created July 14, 2020 11:08
Making & breaking habits

From "Atomic Habits"

4 stages of performing habits

  1. Cue
  2. Craving
  3. Response
  4. Reward

4 laws to make or break behaviors

@joakin
joakin / Hey.md
Created July 3, 2020 10:26
Hey email workflow

Email workflow:

Hey

  • Imbox
    • Unseen
    • Seen
  • Feed
  • Paper trail
  • Reply later