Skip to content

Instantly share code, notes, and snippets.

View djhworld's full-sized avatar

Daniel Harper djhworld

View GitHub Profile
@djhworld
djhworld / seesaw-repl-tutorial.clj
Created December 8, 2011 15:59 — forked from daveray/seesaw-repl-tutorial.clj
Seesaw REPL Tutorial
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
@djhworld
djhworld / haskjure.clj
Created September 25, 2011 18:27
useful haskell functions that I can't seem to find in clojure
(defn group [xs]
"splits its sequence argument into a list of lists of equal, adjacent elements."
(partition-by identity xs))
(defn zip [xs ys]
"makes a list of vector tuples, each tuple containing elements of both sequences occuring at the same position"
(map vector xs ys))
(defn lines [str]
"For a given string, split it into a vector using a newline terminator as a delimiter"
@djhworld
djhworld / clojure_one_liners.clj
Created September 21, 2011 09:25
clojure one liners
; double everything in a list
(map #(* 2 %) (range 1 10))
; sum a list of numbers
(reduce + (range 1 1000))
; read a file
(clojure.string/split (slurp "cl.clj") #"\n")
@djhworld
djhworld / pragprogmagazine-downloader.rb
Created January 24, 2011 22:54
downloads the latest edition of the excellent magazine from the guys at pragprog and pushes it to your kindle
#!/usr/bin/env ruby
# Quick rough and dirty script to push new issues of the excellent
# free monthly magazine from the guys at PragProg to your kindle
#
# Will download the latest magazine from the list and then will only
# download magazines when a new issue comes out
#
require 'date'
require 'fileutils'
require 'nokogiri'