Skip to content

Instantly share code, notes, and snippets.

View addisaden's full-sized avatar
🔍
Research Trip

addisaden addisaden

🔍
Research Trip
View GitHub Profile
;; 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
(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
(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
; 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)
))
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)
"/"
; 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.
<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">
(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]))
module X
protected
def mp
"protected method"
end
private
def mpriv
"private method"
end
end
@addisaden
addisaden / search-helper.cgi
Last active December 19, 2015 19:49
search - helper for the web. a simple cgi script. http://search.23g.eu/
#!/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",