This file contains 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 "you@gmail.com") | |
(.setFrom "you@gmail.com" "Lucky Clojurian") | |
(.setSubject "Hello from clojure") | |
(.setMsg "Wasn't that easy?") | |
(.setAuthentication "you@gmail.com" "yourpassword") |
This file contains 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 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 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 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 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
(defn vec->tree [calls] | |
(-> (reduce (fn [tree [op was-ret?]] | |
(if was-ret? | |
(-> tree | |
(z/append-child op) | |
(z/up)) | |
(-> tree | |
(z/append-child [op]) | |
(z/down) | |
(z/rightmost)))) |
This file contains 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 '[datomic.api :only [db q] :as d]) | |
(def schema | |
[{:db/doc "A persons name" | |
:db/id #db/id[:db.part/db] | |
:db/ident :name | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db.install/_attribute :db.part/db} | |
This file contains 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
commit 8e51c34ca4d97e48750850d5ba09956f89783b4e | |
Author: Kyle Kingsbury <aphyr@aphyr.com> | |
Date: Wed May 7 19:06:15 2014 -0700 | |
Improve Keyword.intern performance | |
Keyword interning is an expensive factor in many Clojure | |
serialization/deserialization paths, especially where the same set of | |
keywords are created and freed repeatedly; e.g. iterating over records | |
with similar structure. There are two principle costs to keyword |
This file contains 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 '[datomic.api :only [q db] :as d]) | |
(def uri "datomic:mem://accounts") | |
;; create database | |
(d/create-database uri) | |
;; connect to database | |
(def conn (d/connect uri)) |
This file contains 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. |
OlderNewer