Skip to content

Instantly share code, notes, and snippets.

@pjstadig
pjstadig / widget.clj
Created February 25, 2022 13:58
Plain functions
(ns stadig.widget
(:require
[stadig.storage.s3 :as storage]))
(defn store-widget
[storage-conn widget-name]
(storage/put storage-conn
"widgets"
widget-name
(pr-str {:type :widget :name widget-name})))
@pjstadig
pjstadig / s3.clj
Created February 25, 2022 13:58
Plain functions
(ns stadig.storage.s3
(:refer-clojure :exclude [get])
(:require
[aws.sdk.s3 :as s3]))
(defn connect
[access-key secret-key]
{:access-key access-key :secret-key secret-key})
(defn get

Rich Hickey on becoming a better developer

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

  • Knowledge
  • Focus
with (import <nixpkgs> {});
stdenv.mkDerivation {
inherit openjdk11;
name = "myopenjdk11";
buildInputs = [ libsodium ];
}
{
allowUnfree = true;
myopenjdk11 = nixos.openjdk11.override { headless = true; };
packageOverrides = pkgs: {
openjdk11 = pkgs.openjdk11.overrideAttrs { buildInputs = pkgs.openjdk11.buildInputs ++ pkgs.libsodium; };
};
}
@pjstadig
pjstadig / transducers.md
Last active June 8, 2021 13:22
The secret feature of transducers that no one talks about!

The Pledge

One thing that always made me a little sad about transducers was how map lost its ability to iterate multiple collections in parallel. This is actually my favorite feature of map. For example:

(map + (range 5) (range 5 10))
=> (5 7 9 11 13)

One somewhat practical use of this is if you want to compare two sequences, pairwise, using a comparator. Though I wish that every? took multiple collections, this is an adequate substitute:

What is an ambitious project?

According to Jonathan Blow, an ambitious project (or "deep work" as he calls it) is something that changes you.[1] Afterwards you are better at what you do, not in an incremental way, but in a substantial and qualitative way, you become a unique specialist in your field.

Blow spent 3.5 years designing the game Braid, and it taught him small puzzle design. He spent 7 years designing the game The Witness, and learned how to create long arcs of rich, non-verbal communication through puzzles. These were

@pjstadig
pjstadig / core.clj
Created March 20, 2017 13:06
A little type hint hint
(ns typehint.core)
;; A little type hint hint...
(set! *warn-on-reflection* true)
;; There are two ways to type hint the return value of a function, but one is
;; (technically) wrong:
(defn ^String as-string0
@pjstadig
pjstadig / core.clj
Created March 6, 2017 16:28
In Clojure you can fetch items from a map three different ways. Which should you use when?
(ns maps.core)
;; In Clojure you can fetch items from a map three different ways. Which should
;; you use when?
(= "bar" ({:foo "bar"} :foo)) ; map as function
(= "bar" (:foo {:foo "bar"})) ; key as function
(= "bar" (get {:foo "bar"} :foo)) ; `get` as function
;; <INCIDENTALLY>

Keybase proof

I hereby claim:

  • I am pjstadig on github.
  • I am pjstadig (https://keybase.io/pjstadig) on keybase.
  • I have a public key ASC7G0cJXjSWTenyWMi5hn68ilcwYRhqwIw62FMzUNqbhAo

To claim this, I am signing this object: