This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-24
Channels
- # admin-announcements (1)
- # aleph (3)
- # announcements (4)
- # beginners (30)
- # boot (296)
- # cider (21)
- # cljsjs (2)
- # cljsrn (18)
- # clojure (124)
- # clojure-poland (23)
- # clojure-russia (4)
- # clojurescript (73)
- # core-async (58)
- # css (3)
- # datomic (31)
- # editors (4)
- # emacs (35)
- # euroclojure (3)
- # hoplon (104)
- # immutant (8)
- # jobs (3)
- # jobs-discuss (1)
- # keechma (1)
- # ldnclj (33)
- # leiningen (5)
- # liberator (1)
- # mount (20)
- # off-topic (2)
- # om (104)
- # onyx (54)
- # parinfer (80)
- # proton (1)
- # re-frame (59)
- # remote-jobs (1)
- # ring-swagger (9)
- # slack-help (15)
- # spacemacs (7)
- # yada (12)
so if I have a clojurescript library and I want to include cljs source only, can I just use lein deploy clojars
?
@richiardiandrea: You’ll also end up with some other META-INF
directory structure in the jar
Ah… fixtures that seems like a valid path
Has anyone written an http client api that works the same way on both node and the browser?
(defresource route :available-media-types ["application/json"] :allowed-methods [:post] :authorized? #(contains? #{:user :admin} (-> % :request :basic-authentication :role)) :known-content-type? #(check-content-type % ["application/json"]) :malformed? #(parse-json % ::data) :post! #(let [id (str (java.util.UUID/randomUUID)) problem (::data %) cust (-> % :request :basic-authentication :cust) ] (j/insert! db-conn :job (assoc {} :idjob id :problem problem :submitted (timec/to-timestamp (java.util.Date.)) :idcustomer cust :status "pending")) (log/info "posting to " @jobq) (sqs/send sqs-client @jobq id) {::id id})
https://www.reddit.com/r/Clojurescript/comments/42x27h/reactgridlayout_in_clojurescript/
@kingoftheknoll: there is a #C08LK2DH7 channel as well.
the error seems related to a type error (undefined is not a function), and not so much to the async nature of the code.
@bensu looks like that channel is empty.
For anyone using Bootstrapped CLJS with :dump-core false, then loading the analysis cache later - I was previously using the analysis cache produced by lein cljsbuild (per https://github.com/clojure/clojurescript/wiki/Optional-Self-hosting), but this cache is missing macro data. This morning I tried printing the output of (cljs.js/dump-core) to console (encoded with transit) - this cache contains the missing macro data & has also resolved some other macro resolution problems I was having. Below is a gist of how I did it (I copy/pasted the result into a file) but this will be even easier when the next CLJS release is cut and we can (require [cljs.js]) from Planck. https://gist.github.com/mhuebert/c9fffa98812e6627c2a8
@mhuebert: I can’t recall the details surrounding this, but FWIW Planck definitely handles cljs.core
macros cache as a separate thing, grabbing it from out/cljs/core$macros.cljc.cache.edn
.
yes http://clojurescript.io does the same 😉
@mfikes: Somewhat off topic from the current conversation, but have you looked at into the possibility of running Planck (or what would be required to have something similar) on Windows?
@shaun-mahood: Yes. High level thoughts are to either convert the Objective-C portion to a more portable language like C, or perhaps even using http://www.cocotron.org
@shaun-mahood: Actually, Planck has become somewhat stable now that most of the main bits work, so it makes it more palatable to consider doing such things. If anyone want’s to take a look at Cocotron, it might be trivial, or it might be a pain in the you-know-what.
Another thought is for someone to build something atop Node, and get the portability for free.
@mfikes: Cool! I figure you'll get bored now that you've run out of bugs in bootstrapped and will probably get to it before anyone else
@mfikes: I see. sometimes when I looked for core$macros cache, I couldn’t find it, but I see it now, so I’m a bit confused. maybe due to different compiler options i’ve been using
@kul: There are definitely people using it with nodejs for server side development in production.
Trying to get started building a dashboard type thing in clojurescript should I jump straight into om/om-next or take a more elementary approach. I’m already familiar with the clojure(script) syntax
But thought I should start with clojurescript and played around with just figwheel but it seemed daunting to build anything with that little.
@7h3kk1d: I am only a beginner, but I found Om a bit unintuitive at first, and then I happened to glance at Reagent, and I've never looked back. I might look at Om Next at some point, but right now I am fine in Reagent.
@7h3kk1d: Same as straistra here, I started with Reagent then added re-frame on that. It might be a good choice if you want something more minimal maybe
How do I add a custom comparator to a record I'm defining?
@danielcompton: IComparable
(defrecord Foo [x]
IComparable
(-compare [_ o] (compare x (.-x o))))
(sort [(Foo. :a) (Foo. :x) (Foo. :m)])
; => (#cljs.user.Foo{:x :a} #cljs.user.Foo{:x :m} #cljs.user.Foo{:x :x})
Awesome, wasn't sure if there was such a thing after reading https://github.com/clojure/clojurescript/wiki/Comparators
@mfikes thanks!
@danielcompton: (I added a quick note to the top of that page, in case anyone else treads down that path.)
@mfikes: how does IComparable handle comparing objects of different type?
@danielcompton: I was wondering the same. It probably doesn’t handle partial orders, etc. hrm.
Fail (test-daymask-sorting) (Error:NaN:NaN)
Expected (= (sort [(daymask "1000000") "abc" (daymask "1000000")]) [(daymask "1000000") (daymask "1000000") "abc"])
Actual: #object[Error Error: No protocol method WeekdayMask.sort-value defined for type string: abc]
@danielcompton: My guess: Throw: (throw (js/Error. (str "Cannot compare " x " to " y))))))
is in the impl of compare
Fail (test-daymask-sorting) (Error:NaN:NaN)
Expected (= (sort [(daymask "1000000") "abc" (daymask "1000000")]) [(daymask "1000000") (daymask "1000000") "abc"])
Actual: #object[Error Error: Cannot compare abc to [object Object]]
does look like it doesn't it
@danielcompton: Just be careful, it may be comparing string to your object by chance and not the other way around
yeah, in our case I think if we're ever comparing any other type with our custom record type then we should be throwing an exception anyway
@danielcompton: Yeah, it will just go into your defrecord
IComparable
impl, I think you’d need to test types and throw there.
@danielcompton: (This is my guess by looking at the source for compare
.)
all makes sense, thanks for your help
what's the best way to enable custom dev flags in cljs?
example: (if (we-are-in-dev-mode) enable-super-secret-logging disable-secret-logging)
any way to define the we-are-in-dev-mode
?
@iwankaramazow: I wonder if a dynamic var is what a lot of people use for that.
@mfikes: Ah ok, Thanks!
You can use goog-define
along with clousre-defines
http://www.martinklepsch.org/posts/parameterizing-clojurescript-builds.html`
@iwankaramazow: I’ve done that. In my case (iOS app), the app itself knows that it is a DEBUG build or not, and then it sets the dynamic var on the ClojureScript side.
Awesome, thanks!
I'm just looking for a way to comment out requires
in prod, because of dynamic module loading
There isn't a way (yet) to combine figwheel/dynamic module loading at runtime during development
@iwankaramazow: If I understand you correctly, for that kind of thing, I’ve resorted to using two extra source paths, one for dev and one for prod. Each path contains the same namespace, where one side is stubbed to do nothing and the other pulls in deps. All code can refer to the “chameleon” namespace.
@iwankaramazow: Here is a lein project.clj
that illustrates what I’m talking about: https://github.com/mfikes/shrimp/blob/5a7659da52a85b3ac6b7016186f483a13cf46e05/ClojureScript/project.clj
@mfikes: oh wow, interesting! I'm using a more cavemen style approach with commenting-out stuff
For example, in that project ”dev-src”
had a namespace that initialized Weasel, which I didn’t wan’t in prod. So, both sides had a namespace (say env.core
, with an init
fn), with the dev init
setting up Weasel, and the prod init
being empty.
@iwankaramazow: Yeah, the problem is trying to figure out how to dynamically comment out things in :require
. I think ns
forms are pretty static—just data, no logic. But I could be wrong.
Thanks a lot for the response