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
| (defmacro roll [rolls _ sides & body] | |
| `(+ (if (nil? ~body) 0 ~body) (reduce + (repeatedly ~rolls #(+ 1 (rand-int ~sides)))))) | |
| (roll 1 d 4) ; dagger | |
| (roll 1 d 20 + 6) ; initiative | |
| (roll 4 d 4 + 4) ; 7th level magic missle |
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 tokenring.core | |
| (:require [lamina.core :as lamina]) | |
| (:require [aleph.tcp :as aleph]) | |
| (:require [gloss.core :as gloss])) | |
| (defn connect-and-send [message] | |
| (println (str "connecting and sending: " message)) | |
| (let [ch (lamina/wait-for-result | |
| (aleph/tcp-client {:host "192.168.48.35" | |
| ;;:host "localhost" |
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
| // Steve Phillips / elimisteve | |
| // 2013.01.03 | |
| // Programming Challenge: Launch 4 threads, goroutines, coroutines, or whatever your language uses for concurrency, | |
| // in addition to the main thread. In the first 3, add numbers together (see sample code below) and pass the results | |
| // to the 4th thread. That 4th thread should receive the 3 results, add the numbers together, format the results as | |
| // a string (see sample code), and pass the result back to `main` to be printed. | |
| // | |
| // Do this as succinctly and readably as possible. _Go!_ #golang #programming #concurrency #challenge | |
| package main |
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
| ;; Objective | |
| ;; 1. Learn Clojure by doing Clojure | |
| ;; | |
| ;; Pre-requisites | |
| ;; You need to have a running Clojure REPL | |
| ;; see: http://clojure.org/getting_started | |
| ; Hello World in Clojure | |
| (println "Hello World") |
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
| # How to perform a release with git & maven following the git flow conventions | |
| # ---------------------------------------------------------------------------- | |
| # Finding the next version: you can see the next version by looking at the | |
| # version element in "pom.xml" and lopping off "-SNAPSHOT". To illustrate, | |
| # if the pom's version read "0.0.2-SNAPSHOT", the following instructions would | |
| # perform the release for version "0.0.2" and increment the development version | |
| # of each project to "0.0.3-SNAPSHOT". | |
| # branch from develop to a new release branch | |
| git checkout develop |
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
| ~/$ 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] |
NewerOlder