Skip to content

Instantly share code, notes, and snippets.

@bensu
bensu / import_names.clj
Last active August 29, 2015 14:21
Compiles without warnings even though there is a potential name conflict.
(ns import-names.core
(:import (java.util Date)))
(def Date "Should this compile?")
(defn -main []
(println Date))
;; Throws:
@bensu
bensu / event-handling.clj
Last active August 29, 2015 14:21
Draft for Event Handling in Om
;; Problem
;; Event Handling in UIs. We only care about some of the events fired
;; by the user or IO and it is not always possible to handle them at
;; the point where we pick them up from the DOM.
;; Thus a messaging/piping infrastructure is need to take the events
;; from the place where they are interpreted from the DOM to the place
;; that handles them. Each application rolls it's own messaging
;; infrastructure, can we do any better?
carlos@login: lein clean & lein cljsbuild auto production
[1] 11434
Compiling ClojureScript.
Compiling "resources/public/js/cljs/app.js" from ["src/cljs" "src/cljc" "src/frontend/src" "env/prod"]...
WARNING: ->ValidationError at line 68 is being replaced at line 80 file:/home/carlos/.m2/repository/prismatic/schema/0.4.0/schema-0.4.0.jar!/schema/utils.cljs
WARNING: ->NamedError at line 89 is being replaced at line 101 file:/home/carlos/.m2/repository/prismatic/schema/0.4.0/schema-0.4.0.jar!/schema/utils.cljs
WARNING: update already refers to: #'clojure.core/update in namespace: plumbing.core, being replaced by: #'plumbing.core/update
WARNING: update already refers to: cljs.core/update being replaced by: plumbing.core/update at line 53 file:/home/carlos/.m2/repository/prismatic/plumbing/0.4.0/plumbing-0.4.0.jar!/plumbing/core.cljs
WARNING: ->ValidationError at line 68 is being replaced at line 80 resources/public/js/cljs/production/schema/utils.cljs
WARNING: ->NamedError at line 89 is being replaced at line 101
@bensu
bensu / fresh-clone
Last active August 29, 2015 14:23
Command output from trying lein test for cljc files
carlos@leiningen: git status
# On branch ft-reader-conditionals
nothing to commit, working directory clean
carlos@leiningen: cd leiningen-core/
carlos@leiningen-core: lein bootstrap
Retrieving bultitude/bultitude/0.2.7/bultitude-0.2.7.pom from clojars
Retrieving bultitude/bultitude/0.2.7/bultitude-0.2.7.jar from clojars
Created /home/carlos/OpenSource/cljc-test/leiningen/leiningen-core/target/leiningen-core-2.5.2-SNAPSHOT.jar
Wrote /home/carlos/OpenSource/cljc-test/leiningen/leiningen-core/pom.xml
Installed jar and pom into local repo.
@bensu
bensu / lein deps :tree
Created July 14, 2015 21:36
circleci clojurescript update
Possibly confusing dependencies found:
[org.clojars.dwwoelfel/stefon "0.5.0-3198d1b33637d6bd79c7415b01cff843891ebfd4" :exclusions [org.clojure/clojurescript org.clojure/clojure]] -> [ring/ring-core "1.2.0"]
overrides
[ring "1.2.2" :exclusions [org.clojure/clojurescript org.clojure/clojure]] -> [ring/ring-jetty-adapter "1.2.2"] -> [ring/ring-servlet "1.2.2"] -> [ring/ring-core "1.2.2"]
and
[ring "1.2.2" :exclusions [org.clojure/clojurescript org.clojure/clojure]] -> [ring/ring-servlet "1.2.2"] -> [ring/ring-core "1.2.2"]
and
[ring "1.2.2" :exclusions [org.clojure/clojurescript org.clojure/clojure]] -> [ring/ring-jetty-adapter "1.2.2"] -> [ring/ring-core "1.2.2"]
and
[ring "1.2.2" :exclusions [org.clojure/clojurescript org.clojure/clojure]] -> [ring/ring-devel "1.2.2"] -> [ring/ring-core "1.2.2"]
@bensu
bensu / var-expr.clj
Created July 19, 2015 18:14
Var naming for cljs-1343 refactoring
;; 1 - The var associated to a def, (def my-var ...) - L1142
(DefExpr. :def env form var-name
;; TODO: check if this map should be a VarExpr - Sebastian
(assoc (analyze (-> env (dissoc :locals)
(assoc :context :expr)
(assoc :def-var true))
sym)
:op :var)
doc (:jsdoc sym-meta) init-expr
@bensu
bensu / lein deps :tree
Last active August 29, 2015 14:25
lein clojure version trouble
Possibly confusing dependencies found:
[s3-wagon-private "1.1.2"] -> [org.springframework.build.aws/org.springframework.build.aws.maven "3.0.0.RELEASE"] -> [commons-httpclient "3.1"] -> [commons-logging "1.0.4"]
overrides
[s3-wagon-private "1.1.2"] -> [org.springframework.build.aws/org.springframework.build.aws.maven "3.0.0.RELEASE"] -> [net.java.dev.jets3t/jets3t "0.7.2"] -> [commons-logging "1.1.1"]
Consider using these exclusions:
[s3-wagon-private "1.1.2" :exclusions [commons-logging]]
[s3-wagon-private "1.1.2"] -> [org.springframework.build.aws/org.springframework.build.aws.maven "3.0.0.RELEASE"] -> [commons-httpclient "3.1"] -> [commons-codec "1.2"]
overrides
@bensu
bensu / maps.cljs
Last active February 1, 2016 21:33
google maps config
(ns component.maps
(:require [google.maps])
(defn map-opts []
"Default initial map options."
{:zoom 3
:mapTypeId google.maps.MapTypeId.ROADMAP
:center (google.maps.LatLng. 59, 18)
:mapTypeControl false
:styles [{:stylers [{:visibility "on"}]}]})
@bensu
bensu / seq-error-diff.clj
Last active August 29, 2015 14:26
Shows a regression (?) in the ClojureScript compiler after 1.7
;; Works
(ns seq-error.core)
(defrecord SomeRecord [_])
@bensu
bensu / Dropdown.elm
Created August 19, 2015 19:52
Dropdown Component in Elm
module Dropdown where
import List exposing (..)
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick, onBlur)
-- MODEL