Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Jensen acj

View GitHub Profile
@acj
acj / gist:3843841
Created Oct 6, 2012
Drawing a circumscribed triangle inside a known circle
View gist:3843841
// This implementation assumes that the origin is at the upper-left corner of the
// drawing surface.
//
// Sample usage:
//
// Paint paint = new Paint();
// paint.setStyle(Paint.Style.STROKE);
// float centerX = 200;
// float centerY = 200;
// float radius = 100;
@acj
acj / mergesort.clj
Created Oct 3, 2011
Merge sort in Clojure
View mergesort.clj
; Example usage: (mergesort [5 1 8 16 25 11 4])
(ns mergesort
(:use clojure.contrib.math))
(defn merge-two
"Merge two (already sorted) vectors"
[vec1 vec2]
(let [v1f (first vec1) v2f (first vec2)]
(cond
(empty? vec1) vec2