Skip to content

Instantly share code, notes, and snippets.

@ibdknox
ibdknox / gist:8701135
Created January 30, 2014 01:45
osx 0.9.0 nodewebkit crash on startup
Process: node-webkit [8612]
Path: /Users/USER/*/node-webkit.app/Contents/MacOS/node-webkit
Identifier: com.intel.nw
Version: 32.0.1700.77 (1700.77)
Code Type: X86 (Native)
Parent Process: launchd [272]
Responsible: node-webkit [8612]
User ID: 501
Date/Time: 2014-01-29 17:35:04.919 -0800
@ibdknox
ibdknox / ducky.clj
Created November 2, 2010 02:41
proof
(def ducky {})
(nil? (ducky :excitement))
@ibdknox
ibdknox / alephpost.clj
Created November 6, 2010 09:07
Trying to use aleph with compojure routes, but the post params never make it through on the aleph server, while they are working fine on the jetty one.
(ns wl.simple
(:use compojure.core, aleph.http, hiccup.core, hiccup.form-helpers, ring.adapter.jetty)
(:gen-class))
(defn show-params [values]
(println (str values))
(html [:p (str values)]))
(defroutes myroutes
(GET "/" [] (html (form-to [:post "/"]
@ibdknox
ibdknox / welcome.clj
Created June 21, 2011 19:59
clj-noir welcome block
(defpartial layout [& content]
(html5
[:head
[:title "Noir"]]
[:body
content]))
(defpage "/welcome" []
(layout
[:h1 "Welcome to Noir!"]))
@ibdknox
ibdknox / lein-noir.sh
Created June 21, 2011 20:47
get started step 1
lein plugin install lein-noir 1.2.1
lein noir new my-website
cd my-website
lein run
@ibdknox
ibdknox / step4.clj
Created June 21, 2011 23:06
get started step 4
;; add a value to the session
(defpage "/login" {}
(session/put! :admin true)
(layout
[:p "Are you loggedin? "]
[:p (session/get :admin)]))
;; set a cookie and get its value
(defpage "/cookie" []
(cookie/put! :noir "stuff")
@ibdknox
ibdknox / step2.clj
Created June 21, 2011 21:30
get started step 2
(defpartial todo-item [{:keys [id title due]}]
[:li {:id id} ;; maps define HTML attributes
[:h3 title]
[:span.due due]]) ;; add a class
(defpartial todos-list [items]
[:ul#todoItems ;; set the id attribute
(map todo-item items)])
(todos-list [{:id "todo1"
@ibdknox
ibdknox / todos.clj
Created June 21, 2011 22:20
get started step3
;;Create a page that lists out all our todos
(defpage "/todos" {}
(let [items (all-todos)]
(layout
[:h1 "Todo list!"]
(todos-list items))))
;; Handle an HTTP POST to /todos, returning a
;; json object if successful
(defpage [:post "/todos"] {:keys [title due]}
@ibdknox
ibdknox / welcome.clj
Created June 22, 2011 08:17
alternate welcome block
(ns my-app
(:use noir.core)
(:require [noir.server :as server]))
(defpage "/welcome" []
"Welcome to Noir!")
(server/start 8080)
@ibdknox
ibdknox / hiccup.clj
Created June 27, 2011 20:58
generating html in noir
(use 'hiccup.core)
;; ****************************************************************
;; The basics
;; ****************************************************************
(html [:p])
=> "<p />"
;; Any elements after that become the content of the tag