Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.
| #!/bin/bash | |
| set -euo pipefail | |
| trap 'echo "at line $LINENO, exit code $? from $BASH_COMMAND" >&2; exit 1' ERR | |
| # This is a Claude Code hook to stop it saying "you are right". | |
| # | |
| # Installation: | |
| # 1. Save this script and chmod +x it to make it executable. | |
| # 2. Within Claude Code, /hooks / UserPromptSubmit > Add a new hook (this file) | |
| # |
| #[optional] Installing Libsodium - ONLY if you do not want nix to handle this - otherwise skip | |
| git clone https://github.com/input-output-hk/libsodium | |
| cd libsodium | |
| git checkout 66f017f1 | |
| ./autogen.sh | |
| ./configure | |
| make | |
| sudo make install && cd .. | |
| #Export and source ~/.bashrc | |
| export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" |
| <code_scheme name="TW" version="173"> | |
| <ClojureCodeStyleSettings>{ | |
| :cljs.core/as-> :only-indent | |
| :cljs.core/assoc 0 | |
| :cljs.core/cond-> :only-indent | |
| :cljs.core/cond->> :only-indent | |
| :cljs.core/defonce :only-indent | |
| :cljs.core/with-meta :only-indent | |
| :cljs.core.async/go :only-indent | |
| :cljs.core.async/go-loop :only-indent |
| # THIS FILE HAS BEEN AUTO-GENERATED BY "PRISMA DEPLOY" | |
| # DO NOT EDIT THIS FILE DIRECTLY | |
| # | |
| # Model Types | |
| # | |
| type User implements Node { | |
| id: ID! | |
| name: String! |
| ;; Run using a local build of ClojureScript master, e.g.: | |
| ;; clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.155"}}}' -i build.clj | |
| (require '[cljs.build.api :as b]) | |
| (b/watch "src" | |
| {:output-dir "out" | |
| :output-to "out/main.js" | |
| :optimizations :none | |
| :verbose true |
These are some of the lessons I wish I had learned when I first picked up Elm, before I wrote a bunch of apps that are now more difficult to maintain than they need to be.
Breaking an Elm program up into multiple files just to reduce scrolling does not tend to work out optimally. Evan gave a really cool talk on this called "The life of a file". Files should split organically around data structures, not just to stay short. The reasons we want to keep JavaScript files as short as possible do not apply to Elm.
For example, I've created apps with a file structure like this:
| (require '[cemerick.url :as url] | |
| '[clojure.spec.alpha :as s] | |
| '[clojure.spec.gen.alpha :as gen] | |
| '[clojure.string :as string]) | |
| (def non-empty-string-alphanumeric | |
| "Generator for non-empty alphanumeric strings" | |
| (gen/such-that #(not= "" %) | |
| (gen/string-alphanumeric))) |
| /** | |
| * Making promises | |
| */ | |
| let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok")); | |
| /* Simpler promise creation for static values */ | |
| Js.Promise.resolve("easy"); | |
| Js.Promise.reject(Invalid_argument("too easy")); |