- Get Boot
- Copy the above file to
$HOME/app.boot
$ chmod a+x $HOME/app.boot
$ cd && ./app.boot
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 on-changes | |
"Middleware factory which acts a bit like \"reaction\" (but it flows into db , rather than out) | |
It observes N inputs (paths into db) and if any of them change (as a result of the | |
handler being run) then it runs 'f' to compute a new value, which is | |
then assoced into the given out=path within app-db. | |
Usage: | |
(defn my-f | |
[a-val b-val] |
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
#Tribute to Dr Who coded by Robin Newman, February 2015 | |
#Better on a Pi2 or Mac. A bit scratchy on B+ but just about OK | |
use_synth :prophet #synth for bass part | |
s=0 #to set the scope of the variable redefined in the next function | |
define :usebpm do |n| #setup own bpm definition | |
s=1.0/8*120/n | |
end | |
usebpm(200) #set required bpm |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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
@Grab("org.grails:gorm-hibernate4-spring-boot:1.0.0.RC2") | |
@Grab("com.h2database:h2:1.3.173") | |
import grails.persistence.* | |
import org.springframework.http.* | |
import static org.springframework.web.bind.annotation.RequestMethod.* | |
@RestController | |
class GreetingController { | |
@RequestMapping(value="/person/greet", method = GET) |
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 midi-parser.core | |
(:use clojure.java.data) | |
#_(:use utils.utils) | |
#_(:use vendors.debug-repl) | |
(:import (java.io File) | |
#_(java.util Arrays) | |
#_(java.nio ByteBuffer) | |
(javax.sound.midi MidiSystem Sequence MidiMessage MidiEvent ShortMessage MetaMessage Track))) | |
;***************** Utils ******************** |
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
;;;; Super top secret talk stuff nobody should ever see. Shhh. | |
(in-ns 'user) | |
(defmacro bench [& body] | |
`((re-find #"\"(.*)\"" (with-out-str (time (do ~@body)))) 1)) | |
*ns* | |
(require 'clojure.walk) |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.