Skip to content

Instantly share code, notes, and snippets.

Zach Oakes oakes

Block or report user

Report or block oakes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dueling_banjos.alda
guitar: o3 b8 > c8 d4 < b > c < a b g a %1
banjo: @1 o3 b8 > c8 d4 < b > c < a b g a %2
guitar: @2 o3 b8 > c8 d4 < b > c < a b g a %3
guitar: @3 d1 g4 g a b g b a1 %4
banjo: @4 g4 g a b g1 %5
View boot_deps.md

Boot and deps.edn

At some point, we all decided that scripting builds with executable code was a bad idea, so we tossed out makefiles in favor of specifying our builds in a data file (package.json, build.xml, project.clj, etc) and having a build tool do the heavy lifting. These data files could be leveraged by IDEs and other tools. When projects inevitably need to do things their build tool couldn't anticipate, they use plugins or bash scripts in order to...script their build with executable code. Oops.

The truth is, we never stopped scripting builds, we just made it more annoying. In Clojure land, the things Leiningen can't do just end up in a plugin or an ad hoc bash script. To make matters worse, the project.clj format isn't even technically static data, because it is very willing to execute code. It is the worst of both worlds: more restrictive and idiosyncratic than normal code,

View clojure_docs.md

How Clojure's documentation can leapfrog other languages

Summary

I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.

The Problem

Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."

@oakes
oakes / clojure_is_for_type_b_personalities.md
Created Jan 15, 2016
Clojure is for type B personalities
View clojure_is_for_type_b_personalities.md

The other day, I was wondering why Clojure fits my brain so well. I think I was relaxing on my old couch, drinking cheap beer, eating a gas station pastry, and drawing doodles on a stack of overdue bills I forgot to pay. Little did I realize, these things are all connected.

I have a hypothesis that people choose programming languages based on their personality. For the purposes of this write-up, I’ll use the well-known distinction between type A and type B people. This may be pop psychology stuff, but it’s convenient for my point so in the spirit of American politics I will treat it as fact.

Type A vs Type B

Type A people are very organized, competitive, punctual, and like to plan ahead. When I was a kid, these were the ones who had perfect grades, competed in track or swimming, and on top of that they were nice people so I couldn't even hate the fuckers. Type B people, on the other hand, are laid back and like to do things spontaneously. Like The Dude from The Big Lebowski, they are comfortable with

@oakes
oakes / digital_ocean.md
Last active Jul 10, 2018
Running a JAR on Digital Ocean
View digital_ocean.md
  • Create a Digital Ocean account
  • In the OS X terminal, run ssh-keygen, then hit enter until it is done
  • Create a droplet
    • Select Ubuntu 16.10 x64
    • In Finder, Go -> Go to Folder... then type ~/.ssh
    • Open id_rsa.pub with TextEdit
    • Copy the contents of the file and paste them in the "New SSH Key" text field
    • Click "Create"
  • In the Terminal app, run ssh root@YOUR_IP_ADDRESS
  • Run apt-get update
@oakes
oakes / core.clj
Last active May 28, 2016
Minimal 3D
View core.clj
(defscreen main-screen
:on-show
(fn [screen entities]
(update! screen
:renderer (model-batch)
:attributes (let [attr-type (attribute-type :color :ambient-light)
attr (attribute :color attr-type 0.8 0.8 0.8 1)]
(environment :set attr))
:camera (doto (perspective 75 (game :width) (game :height))
(position! 0 0 3)
@oakes
oakes / core.clj
Last active Jul 15, 2017
Standalone Nightmod Template
View core.clj
(ns my-game.core
(:require [clojure.edn :as edn]
[clojure.java.io :as io]
[play-clj.core :refer :all]
[play-clj.g2d :refer :all]
[play-clj.g3d :refer :all]
[play-clj.math :refer :all]
[play-clj.physics :refer :all]
[play-clj.ui :refer :all])
(:import [java.io StringWriter]))
@oakes
oakes / core.clj
Created May 27, 2014
3D Physics
View core.clj
(print "Click the screen to create a new block.")
(def ^:const mass 10)
(defn get-environment
[]
(let [attr-type (attribute-type :color :ambient-light)
attr (attribute :color attr-type 0.3 0.3 0.3 1)]
(environment :set attr)))
@oakes
oakes / core.clj
Last active Aug 29, 2015
2D Physics
View core.clj
(def ^:const pixels-per-tile 32)
(defn create-ball-body!
[screen radius]
(let [body (add-body! screen (body-def :dynamic))]
(->> (circle-shape :set-radius radius)
(fixture-def :density 1 :friction 0 :restitution 1 :shape)
(body! body :create-fixture))
body))
You can’t perform that action at this time.