Skip to content

Instantly share code, notes, and snippets.

bhauman / core.cljs
Last active Aug 29, 2015
The code from the Devcards introduction video
View core.cljs
(ns hello-there.core
[devcards.core :as dc :include-macros true]
[sablono.core :as sab :include-macros true]
[om.core :as om :include-macros true])
[devcards.core :refer [defcard is are= are-not=]])
View gist:f954c4ee3611cf51494d
{:optimizations :none
:output-dir "samples/hello/out"
:output-to "samples/hello/out/hello.js"
:source-map true}
Currently print-mapped-stacktrace takes a path from the root of the project.
[{:file "samples/hello/out/hello/core.js" <-- path from project root
:function "first"
bhauman / nginx.conf
Last active Aug 29, 2015
nginx proxy
View nginx.conf
# sudo apt-get install nginx jed
# sudo crontab -e ;; 0 24 * * * service nginx restart >/dev/null 2>&1
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/;
events {
bhauman / project.clj
Last active Aug 29, 2015
figwheel test runner with red/green favicon
View project.clj
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src" "dev_src"]
:compiler {:output-to "resources/public/js/compiled/slides.js"
:output-dir "resources/public/js/compiled/out"
:optimizations :none
:asset-path "js/compiled/out"
:source-map true
:source-map-timestamp true
bhauman / sonic_pi_music.rb
Created Jun 13, 2015
My first sonic pi creation.
View sonic_pi_music.rb
define :bass do |notes|
in_thread do
with_synth :pretty_bell do
n = if one_in(4) then choose(notes) else notes.first end
2.times do
with_synth :pretty_bell do
play (n - 8), amp: 0.1, release: 0.5
with_synth :sine do
bhauman /
Last active Aug 29, 2015
Composable cljs build scripts

Independent composable build scripts for cljs

There is a need more complex build scripts for ClojureScript. It would be nice to have a minmal interface and method for composing these scripts. Somehting like:

(-> (watch-cljs ["src"])
    (watch-sass [""])
    (watch-css [""])
    (mark-macro-affected-source build-options)
bhauman / cljs-react-reload.cljs
Last active Aug 29, 2015
cljs React Hot loader - keeping local state stable across React class changes
View cljs-react-reload.cljs
(ns cljs-react-reload.core
[cljs.env :as env]))
(defmacro def-react-class [vname body]
`(def ~vname (js/React.createClass ~body)))
(defmacro defonce-react-class
"Patches stable base react class on reload."
[vname body]
View using body tag class to set state for css rendering
module ApplicationHelper
def body_tag_class(more_class = "")
"#{params[:controller]}_cont #{params[:action]}_action #{'logged_in' if logged_in?} #{more_class}"
%body{:class => open_body_tag}
View css that plays off of state in the body tag
.user_controls { display:none; }
body.logged_in .user_controls { display:block; }
View lark_template.rb
# download and git methods swiped from
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
puts "Can't get #{from} - Internet down?"
You can’t perform that action at this time.