Skip to content

Instantly share code, notes, and snippets.

View ponzao's full-sized avatar

Vesa Marttila ponzao

  • Helsinki, Finland
View GitHub Profile
(ns spreads
(:use zeder))
(def legal-cards
[:🂡 :🂱 :🃁 :🃑
:🂢 :🂲 :🃂 :🃒
:🂣 :🂳 :🃃 :🃓
@gigasquid
gigasquid / mary.clj
Created February 6, 2013 14:02
Mary had a little lamb in overtone
(ns overtone-tutorial.mary)
(use 'overtone.core)
(boot-external-server)
(definst saw-wave [freq 440 attack 0.01 sustain 0.4 release 0.1 vol 0.4]
(* (env-gen (lin-env attack sustain release) 1 1 0 1 FREE)
(saw freq)
vol))
@stuarthalloway
stuarthalloway / Datomic News Updates
Created June 18, 2012 14:53
Datomic update examples against a social news database
;; Datomic example code
;; demonstrates various update scenarios, using a news database
;; that contains stories, users, and upvotes
;; grab an in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))
@alexander-yakushev
alexander-yakushev / tetris.clj
Created September 10, 2011 00:28
Tetris implementation in Clojure
(ns tetris.core
(:import (java.awt Color Dimension BorderLayout)
(javax.swing JPanel JFrame JOptionPane JButton JLabel)
(java.awt.event KeyListener))
(:use clojure.contrib.import-static deflayout.core
clojure.contrib.swing-utils)
(:gen-class))
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_DOWN VK_UP VK_SPACE)
@alandipert
alandipert / fb.clj
Last active December 20, 2017 03:17
FizzBuzz, the fib of pattern matching
;; FizzBuzz, the fib of pattern matching
;; with https://github.com/clojure/core.match
(require '[clojure.core.match :refer [match]])
(doseq [n (range 1 101)]
(println (match [(mod n 3) (mod n 5)]
[0 0] "FizzBuzz"
[0 _] "Fizz"
[_ 0] "Buzz"
@weavejester
weavejester / gist:1001206
Created May 31, 2011 20:27
Clojure on Heroku
~/$ lein new ring-on-heroku
Created new project in: /home/jim/Development/ring-on-heroku
~/$ cd ring-on-heroku
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj
(ns ring-on-heroku.core
(:use ring.util.response
ring.adapter.jetty))
(defn app [req]
; The New Year in Snowflakes
; A Clojure doodle by Chouser
(import '(java.awt Color Graphics Frame RenderingHints))
(defonce draw-agent (agent nil))
(defonce halt (atom false))
(defmacro ui-thread [& body]
`(javax.swing.SwingUtilities/invokeAndWait (fn [] ~@body)))
@ayourtch
ayourtch / gist:752460
Created December 23, 2010 02:19
Programming Challange from Erann Gat
-- Andrew Yourtchenko - Programming Challange from Erann Gat:
-- http://www.flownet.com/ron/papers/lisp-java/
-- Given a list of words and a list of phone numbers, find all the ways that
-- each phone number can be expressed as a list of words.
-- No batteries included. We have to define our own split() function.
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
@stevedonovan
stevedonovan / StringAccessor.lua
Created December 20, 2010 08:38
A Lua class for accessing individual characters in a string
--[[ Example:
sa = StringAccessor 'hello'
for c in sa:iter() do
print(c)
end
print(sa[1],sa[3])
print('end',sa[-1])
--]]
@netzpirat
netzpirat / 0_README.md
Created November 12, 2010 10:42
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard