This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Anything you type in here will be executed | |
;; immediately with the results shown on the | |
;; right. | |
(def notes {\c 0 | |
\d 2 | |
\e 4 | |
\f 5 | |
\g 7 | |
\a 9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use 'midi) | |
;=> nil | |
(def keyboard (midi-in)) | |
;=> #'user/keyboard | |
(midi-handle-events keyboard (fn [a b] (do (println (format "%s --- %s" a b))))) | |
;=> nil | |
; on pressing the keyboard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(print "Please write 8 + or -: ") | |
(flush) | |
(def rules (seq (read-line))) | |
(def pos1 (atom (seq "++++----"))) | |
(def pos2 (atom (seq "++--++--"))) | |
(def pos3 (atom (seq "+-+-+-+-"))) | |
(defn ruler [x y z] | |
(cond |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; user=> | |
(clojure.string/replace | |
(clojure.string/join | |
(map | |
{ \0 "0000" \1 "0001" \2 "0010" \3 "0011" | |
\4 "0100" \5 "0101" \6 "0110" \7 "0111" | |
\8 "1000" \9 "1001" \a "1010" \b "1011" | |
\c "1100" \d "1101" \e "1110" \f "1111" } | |
(format "%x" 24) | |
)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (import 'java.net.URI) | |
java.net.URI | |
user=> (def a (java.net.URI. "http://writedown.eu/")) | |
#'user/a | |
user=> (.getHost a) | |
"writedown.eu" | |
user=> (.getScheme a) | |
"http" | |
user=> (.getPath a) | |
"/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project> | |
<property name="bin-dir" value="bin" /> | |
<property name="src-chess-dir" value="src/de/claddis/chess" /> | |
<property name="package-chess" value="de.claddis.chess" /> | |
<target name="clean"> | |
<delete dir="${bin-dir}" /> | |
</target> | |
<target name="compile"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns tictactoe) | |
; Gamefield | |
; \e empty | |
; \x x-player | |
; \o o-player | |
(def gamefield (atom '(\e \e \e \e \e \e \e \e \e))) | |
(def spaces '("|" "|" " 1 2 3\r\n-+-+-\r\n" "|" "|" " 4 5 6\r\n-+-+-\r\n" "|" "|" " 7 8 9")) | |
(def winner-combinations '([0 1 2] [3 4 5] [6 7 8] [0 3 6] [1 4 7] [2 5 8] [0 4 8] [2 4 6])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module X | |
protected | |
def mp | |
"protected method" | |
end | |
private | |
def mpriv | |
"private method" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require "cgi" | |
cgi = CGI.new | |
parameter = cgi.params | |
@search = { | |
'recursive' => "http://search.23g.eu/?search=%s", | |
'duck' => "https://duckduckgo.com/?q=%s", | |
'wiki' => "http://wikipedia.org/w/?search=%s", |