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
(ns srepl.core | |
(:use [clojure.main :only [repl]] | |
[clojure.pprint :only [pprint with-pprint-dispatch code-dispatch]]) | |
(:import (jline.console ConsoleReader) | |
(jline.console.completer Completer)) | |
(:gen-class)) | |
(defmulti super-dispatch class) | |
(defmethod super-dispatch :default [thing] |
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
@echo off | |
setLocal EnableDelayedExpansion | |
if "%CLOJURESCRIPT_HOME%" == "" set CLOJURESCRIPT_HOME=%~dp0..\ | |
set CLASSPATH=%CLOJURESCRIPT_HOME%\src\clj;%CLOJURESCRIPT_HOME%\src\cljs;%CD%\src\cljs;%CD%\src\clj;%CD%\test\cljs;%CD%\test\clj" | |
for /R "%CLOJURESCRIPT_HOME%\lib" %%a in (*.jar) do ( | |
set CLASSPATH=!CLASSPATH!;%%a | |
) | |
for /R "%CD%\lib" %%a in (*.jar) do ( |
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
(require '[noir.server :as server]) | |
(use 'noir.core 'aleph.http 'lamina.core) | |
(defn async-response [response-channel request] | |
(enqueue response-channel | |
{:status 200 | |
:headers {"content-type" "text/plain"} | |
:body "async response"})) | |
(defpage "/" [] "hey from Noir!") |
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
# Commands to initialize a simple heroku noir app. You can cut and paste them together. | |
# Install latest version of noir. If an older version is installed, remove it first. | |
lein plugin install lein-noir "1.1.0-SNAPSHOT" | |
# Create new noir project. | |
lein noir new noir-mongo-heroku | |
cd noir-mongo-heroku | |
# Create instructions for heroku. | |
echo 'web: lein run' > Procfile | |
# Create git repository. |
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 finger-tree-stats | |
(:use [clojure.data.finger-tree])) | |
(defrecord stats [^double number ^double mean ^double variance]) | |
(def null-stats (stats. 0 0 Double/NaN)) | |
(defn make-stats | |
[^double x] | |
(stats. 1 x 0)) |
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
(import '(javax.sound.midi MidiSystem Synthesizer)) | |
(defn play-note [synth channel note-map] | |
(let [{:keys [note velocity duration] | |
:or {note 60 | |
velocity 127 | |
duration 1000}} note-map] | |
(. channel noteOn note velocity) | |
(Thread/sleep duration) | |
(. channel noteOff note))) |
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
(import 'org.apache.commons.mail.SimpleEmail) | |
(doto (SimpleEmail.) | |
(.setHostName "smtp.gmail.com") | |
(.setSslSmtpPort "465") | |
(.setSSL true) | |
(.addTo "[email protected]") | |
(.setFrom "[email protected]" "Lucky Clojurian") | |
(.setSubject "Hello from clojure") | |
(.setMsg "Wasn't that easy?") | |
(.setAuthentication "[email protected]" "yourpassword") |
NewerOlder