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 example.core | |
(:require [bidi.bidi :as bidi] | |
[goog.events :as events] | |
[clojure.string :as cstr])) | |
(defn start! [on-set-page routes] | |
(letfn [(handle-route [] | |
(let [uri (cstr/replace js/location.hash "#" "")] | |
(->> (if-not (empty? uri) 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
(defproject sessiontest "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[compojure "1.1.8"] | |
[ring/ring-json "0.3.1"] ;; <= add this | |
] | |
:plugins [[lein-ring "0.8.10"]] | |
:ring {:handler sessiontest.handler/app} | |
:profiles |
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
;; block 1 | |
(ns sessiontest.handler | |
(:require [compojure.core :refer :all] | |
[compojure.route :as route] | |
[ring.middleware.defaults :refer [wrap-defaults site-defaults]])) | |
;; block 2 | |
;; this is the route part | |
(defroutes app-routes | |
(GET "/" [] "Hello World") ;; for / | |
(route/not-found "Not Found")) ;; 404 |
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
;; block 1 | |
(ns sessiontest.handler | |
(:use [ring.middleware.json :only (wrap-json-response)] | |
;; use json response | |
ring.middleware.session | |
;; use session | |
[ring.util.response :only (response)] | |
;; use response | |
[hiccup.middleware :only (wrap-base-url)]) | |
;; use hiccup |
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 draw-state [state] | |
(q/background 51) | |
(let | |
[max-scale-h (- 1 (/ 1 12)) ;; get percentage of current hour, range value from 0-1 | |
max-scale-m (- 1 (/ 1 60)) ;; get percentage of current minute, range value from 0-1 | |
max-scale-s (- 1 (/ 1 60)) ;; get percentage of current seconds, range value from 0-1 | |
;; above values are half of the actual values, so we need to multiply it with 2π | |
;; mappings |
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 figwheel-garden.core | |
(:require | |
[reagent.core :as r])) | |
(defn my-app [] | |
[:div | |
[:h1 "Hello Reagent!"] | |
[:p "Hello Garden!"] | |
[:p.my-class "Hello My-Class!"]]) |
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 my.core | |
(:require [quil.core :as q :include-macros true] | |
[quil.middleware :as m])) | |
(def c 6) | |
(defn setup [] | |
(q/frame-rate 60) | |
(q/color-mode :hsb) | |
(q/background 255) |
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
{:paths ["."] | |
:deps {clansi {:mvn/version "1.0.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
#!/usr/bin/env bash | |
# Utility to suggest a new package to try from Homebrew | |
# Simply run and it will give you a new package to try out | |
files=(/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/*) | |
total=${#files[@]} | |
rando=$((RANDOM % total)) | |
package=$(basename "${files[rando]}" .rb) | |
printf "\\nTry out a random homebrew package!\\n\\n" | |
brew info "${package}" |
OlderNewer