Skip to content

Instantly share code, notes, and snippets.

View quephird's full-sized avatar

danielle quephird

View GitHub Profile
@quephird
quephird / penny-backsplash.clj
Created November 26, 2012 22:02
penny-backsplash
; Pseudocode for the procedure I used to create a backsplash
; composed of pennies for the kitchen
(ns com.quephird.penny-backsplash
(:gen-class)
)
(def oak-moulding
{:product-desc "http://www.lowes.com/pd_35579-1487-105_0__?productId=3041880"
:purpose "To cover up gaps between the countertop and the walls"}
@quephird
quephird / fizzbuzz.clj
Created January 4, 2013 17:34
FizzBuzz comes up from time to time on technical fora and so I wanted to see if I could come up with an optimal solution. I also wanted to see if I could make it somewhat extensible, being partially inspired by this blog post: http://dave.fayr.am/posts/2012-10-4-finding-fizzbuzz.html
(ns fizzbuzz)
(defn divides? [n d]
(zero? (rem n d)))
(defn fizz [n]
(if (divides? n 3) "fizz"))
(defn buzz [n]
(if (divides? n 5) "buzz"))
@quephird
quephird / untitled-20130106.clj
Last active December 10, 2015 17:38
Playing around with alphas
(ns untitled-20130106
(:use quil.core clojure.pprint))
(def screen-w 1920)
(def screen-h 1050)
(defn- random-rgba []
[0
(random 255)
(random 255)
@quephird
quephird / balls-of-fire.clj
Created January 22, 2013 22:35
An attempt at reproducing a drawing on deviantART here: http://stebev.deviantart.com/art/Balls-of-fire-Pong-332-349019003
(ns balls-of-fire-inspiration
(:use quil.core quil.applet))
(def screen-w 1920)
(def screen-h 1080)
(defn- star [c l w]
(let [graphics (current-applet)
lobe-count 8
control-point-length (* l 0.8)]
@quephird
quephird / Painful.java
Created January 26, 2013 22:40
Just seeing how painful it is to try to be functional in Java
class Painful {
public static void main(String[] args) {
int[] firstTenIntegers = {1,2,3,4,5,6,7,8,9,10};
Functional squareFunction = new Functional() {
public int apply(int x) {
return x*x;
}};
Functional cubeFunction = new Functional() {
@quephird
quephird / 10-print.clj
Last active December 12, 2015 03:48
Just silliness inspired by the first chapter of this book: http://mitpress.mit.edu/books/10-print-chr2055rnd1-goto-10-0
(doseq [s (map
(fn [cs] (apply str cs))
(partition 40
(map
(fn [n] (str (char (int (+ 9581 (rand-int 3))))))
(range 1 1001))))]
(println s))
╮╭╯╭╮╮╰╮╮╮╭╮╰╰╯╭╮╮╰╮╯╰╰╭╰╰╮╮╭╮╮╭╯╯╰╮╮╮╯╰
╭╰╮╰╰╯╯╭╭╮╮╯╰╭╰╮╯╯╰╭╭╮╰╭╯╯╭╮╭╮╭╯╯╯╭╮╯╯╭╭
@quephird
quephird / animated-gif-from-noaa-images.clj
Created February 19, 2013 20:30
This isn't exactly the most useful code in the world but I was annoyed that I couldn't save satellite imagery on the NOAA site as a local video file. I know... first world problems. Anyway... after spelunking in the browser source, I saw that the images are fetched individually by either a Java or Flash applet. I figured that this was a good opp…
(ns animated-gif-from-noaa-images
(:require [clojure.string :as string]
[clj-http.client :as client])
(:import [java.io File]
[java.net URL]
[java.awt.image BufferedImage]
[javax.imageio IIOImage ImageIO ImageTypeSpecifier ImageWriter ImageWriteParam]
[javax.imageio.metadata IIOMetadata IIOMetadataNode]))
; Satellite image names are listed in the vis_names.txt file
@quephird
quephird / ford-circles.clj
Last active December 14, 2015 15:39
Somewhat rough implementation to generate Ford circles, http://en.wikipedia.org/wiki/Farey_sequence#Ford_circles.
(ns ford-circles
(:use quil.core quil.applet))
(def screen-w 1920)
(def screen-h 1080)
; This would likely be deemed a hack by a seasoned mathematician;
; I am sure there is a more efficient incantation to produce these numbers.
(defn farey-seq [n]
(apply sorted-set
@quephird
quephird / easter-eggs.clj
Created April 1, 2013 19:01
first time playing with 3d primitives in quil and processing
(ns easter-eggs
(:use quil.core quil.applet))
(def screen-w 1920)
(def screen-h 1080)
(def easter-colors
[[255 170 255] ; pink
[253 198 137] ; orange
[255 255 170] ; yellow
@quephird
quephird / fire_blossom.wxm
Last active November 2, 2024 01:30
This is a super hacky program to generate a picture that I hope will resemble the one here: http://felifee.deviantart.com/art/fire-blossom-364662404. I'm not too familiar with Maxima, so I'm just slapping stuff together until I better understand how the "language" works until I attempt to refactor this code.
load(draw);
draw_polar(expr,range) :=
block([theta_var: range[1]],
draw2d(background_color = black,
xtics = 'none,
ytics = 'none,
axis_top = false,
axis_bottom = false,
axis_left = false,