Skip to content

Instantly share code, notes, and snippets.

View lbradstreet's full-sized avatar

Lucas Bradstreet lbradstreet

View GitHub Profile
if exists("g:loaded_syntastic_clojure_nrepl_checker")
finish
endif
let g:loaded_syntastic_clojure_nrepl_checker=1
function! SyntaxCheckers_clojure_nrepl_IsAvailable()
return executable('lein') && filereadable('project.clj')
endfunction
function! SyntaxCheckers_clojure_nrepl_GetLocList()
@lbradstreet
lbradstreet / ux.cljs
Created January 22, 2014 02:39 — forked from anonymous/ux.cljs
;;; TODO - drag-enter and -exit events : Right now, a component doesn't receive events for other components
;;; If a component responds to drag-over, it won't "revert" state until the drag ends.
;; NOTE - compiles with om 0.1.7. Needs updating to 0.2+
(ns omdnd.ux
(:require-macros
[cljs.core.async.macros :refer [go alt!]]
)
{:user {:aliases {"slamhound" ["run" "-m" "slam.hound"]}
:plugins [[cider/cider-nrepl "0.6.1-SNAPSHOT"]
; swap to actual versions and then use lein ancient instead
[lein-git-deps "0.0.1-SNAPSHOT"]
[lein-bikeshed "RELEASE"]
[lein-kibit "RELEASE"]
[jonase/eastwood "RELEASE"]
(defn popover
"wrapper for the ReactBootstrap/Popover component"
[{:keys [content
title
data]} owner opts]
(reify
om/IRender
(render [this]
(ReactBootstrap/OverlayTrigger #js {:trigger "hover"
:placement "top"
(defmacro defntraced
"Define a function with it's inputs and output logged to the console."
[sym & body]
(let [[_ _ [_ & specs]] (macroexpand `(defn ~sym ~@body))
new-specs (map
(fn [[args body]]
(let [prns (for [arg args]
`(js/console.log (str '~arg) "=" (pr-str ~arg)))]
(list
args
@lbradstreet
lbradstreet / clojure-uuid-test-check
Last active August 29, 2015 14:04
Clojure test check uuid
(ns test-check-contrib.gen-uuid
(:require [clojure.string]
[clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[clojure.test.check.clojure-test :refer [defspec]])
(:import [java.util UUID])
(:require [clojure.core :as core]))
(def gen-uuid-simple
@lbradstreet
lbradstreet / multipart upload
Last active August 29, 2015 14:06
multipart upload
[:div
[:b "Now that you've submitted your message, you can upload an image of your own, or read the messages"]
[:form.form-horizontal {:action "/upload" :method "post" :encType "multipart/form-data"}
[:div.form-group
[:input.form-control {:name "file"
:on-change (fn [e] (om/set-state! owner :can-upload-image true))
:type "file"
:size "20"}]
[:label.control-label "Who are you?"]
[:input.form-control {:name "person"}]
(ns onyx-timeline-example.onyx.component
(:require [clojure.core.async :as a :refer [go-loop pipe chan >!! <!! close!]]
[clojure.data.fressian :as fressian]
[clojure.core.match :as match :refer (match)]
[clojure.tools.logging :as log]
[com.stuartsierra.component :as component]
[onyx.peer.task-lifecycle-extensions :as l-ext]
[onyx.extensions :as extensions]
[onyx.api]
[onyx.plugin.core-async]
(filter even? (range 10))
;; equals
(new clojure.lang.LazySeq
(fn []
(when-let
[s (. clojure.lang.RT
(seq (new clojure.lang.LazySeq
#(let [b (clojure.lang.ChunkBuffer. 32)
@lbradstreet
lbradstreet / BootTime
Created January 29, 2015 16:48
Boot hello-world startup time
#!/usr/bin/env boot
(require '[clojure.string :refer [join]])
(defn -main [& args]
(println (join " " ["hello," "world!"]))
(System/exit 0))
./hello.boot 8.64s user 0.46s system 383% cpu 2.375 total