Skip to content

Instantly share code, notes, and snippets.

View quephird's full-sized avatar

danielle quephird

View GitHub Profile
@quephird
quephird / wavey-thingy.clj
Created August 22, 2014 21:02
This is an attempt at gaining a slightly deeper understanding of the code presented here: http://codegolf.stackexchange.com/questions/35569/tweetable-mathematical-art#35689
(ns fun-with-quil.wavey-thingy
(:use quil.core))
(def screen-w 1024)
(def screen-h screen-w)
(defn make-wave-fn []
"[x1 y1] specifies the epicenter of the waves
[x2 y2] specifies an anti-epicenter of sorts
l controls the length between waves
@quephird
quephird / breezy.clj
Last active August 29, 2015 14:05
This is another adaptation from a wonderful thread on SO: http://codegolf.stackexchange.com/questions/35569/tweetable-mathematical-art
(ns fun-with-quil.breezy
(:use quil.core))
(def ^:constant screen-w 1920)
(def ^:constant screen-h 1080)
(defn r ^double [^long x ^long y]
(loop [k 0 i 0.0 j 0.0]
(let [si (sin i)
cj (cos j)]
@quephird
quephird / tennis_ball.clj
Created August 31, 2014 16:03
Once again, I'm riffing off/stealing from Bees and Bombs.
(ns fun-with-quil.tennis-ball
(:use quil.core))
(def screen-w 800)
(def screen-h 800)
(defn seam [θ w]
[(* 300 (sin (radians θ)) (cos (* w (cos (radians θ)))))
(* 300 (sin (radians θ)) (sin (* w (cos (radians θ)))))
(* 300 (cos (radians θ)))])
@quephird
quephird / splats.clj
Created October 10, 2014 00:27
First cut at simulating paint splatters.
(ns fun-with-quil.splats
(:require [quil.core :as q :include-macros true]))
; TODO: Introduce paint streaks
(defn splat [x y d h]
(let [lobes (+ 5 (rand-int 10))]
(q/fill h 127 255)
(q/translate x y)
(q/ellipse 0 0 d d)
(q/rotate (q/random q/PI))
(ns circle-race
(:require [quil.core :as q :include-macros true]))
(defn setup []
(q/smooth)
(q/color-mode :hsb))
(defn draw []
(let [fc (q/frame-count)
w (q/width)
@quephird
quephird / orb-sprial.clj
Created October 28, 2014 22:23
A re-interpretation of this post by the venerable Bees & Bombs: http://beesandbombs.tumblr.com/post/96776703769/orb-spiral
(ns orb-spiral
(:use quil.core))
(def screen-w 800)
(def screen-h screen-w)
(defn setup []
(smooth)
; (fill 250)
(color-mode :hsb 1)
(ns fake-cubes
(:require [quil.core :as q :include-macros true]))
(defn fake-cube [x y s]
(let [h (q/random 30 100)
sa (q/random 127 255)]
(q/push-matrix)
(q/translate x y)
(dotimes [i 3]
(q/fill h sa (/ 255 (inc i)))

The struggle I'm having isn't that I can't do I/O; it's that I can! ;P

Seriously, though, it's that I can do so in places that I'm pretty sure that I shouldn't. That is, my understanding is that things that are dirty, like anything involving I/O, should be sectioned off from everything else that is pure, as much as possible. This makes more of your code understandable, testable, and reusable.

Indeed, I have striven to do that but there are places where I have taken the easy way out in the middle of routines that "update" state. Below is an example from my game (you can look at the entire source here, https://github.com/quephird/space-invaders/blob/master/src/space_invaders/core.clj):

(defn key-pressed [{{sound :sound} :player-bullets :as state}
                    {key           :key
                     key-code      :key-code       :as event}]

"Primary hook to return new version of game state taking into account:

@quephird
quephird / Things_that_make_everything_better.txt
Last active January 3, 2025 02:25
Things that make everything better
Things that make everything better:
• 🟪 Purple
• 🍫 Chocolate
• 🧱 LEGO
• ✨ Glitter
• () LISP
• 👗 Velvet
• ❌ Cancelled meetings
• 🌶 Spicy food
@quephird
quephird / twitter_names.txt
Last active April 25, 2025 03:44
A critical document listing the display names I've used on Twitter. Hey, this is important stuff.
pɹoɟɟǝʞ ǝןןǝıuɐp
ⅅ₳ℕⅈⅇℒℒⅇ Ҝⅇℱℱʘℝⅅ
danielleᵏᵉᶠᶠᵒʳᵈ
ᗝ ᗉ Z — Ш ⅃ ⅃ Ш
ᗰ Γ Γ ᗰ — Z ᗆ ᗜ
java -XmsMerry
⣏⡱⡮⢵⡗⢼⡇⣟⣋⣇⣀⣇⣀⣟⣋
ḋäṅïëḷḷë ḳëḟḟöṙḋ
刀丹れ工モㄥㄥモ ケモ下下ロ尺刀
(cons danielle butt)