This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-13
Channels
- # admin-announcements (8)
- # beginners (28)
- # boot (2)
- # bristol-clojurians (4)
- # cider (12)
- # clojure (177)
- # clojure-android (23)
- # clojure-canada (1)
- # clojure-dev (21)
- # clojure-italy (27)
- # clojure-korea (1)
- # clojure-russia (20)
- # clojure-spain (1)
- # clojurebridge (11)
- # clojurescript (156)
- # core-matrix (1)
- # cursive (2)
- # datomic (39)
- # events (1)
- # hoplon (13)
- # immutant (4)
- # javascript (2)
- # jobs (1)
- # ldnclj (13)
- # luminus (2)
- # melbourne (25)
- # off-topic (9)
- # onyx (13)
- # re-frame (110)
- # reagent (5)
Presented a talk on ClojureScript at the University of Cape Town yesterday during which we built a snake game. Slides, audio and gameplay now up: http://petrustheron.com/posts/sota-front-end-development-clojurescript.html Hopefully this is useful to others for teaching Clojure, especially the code (< 100 sloc).
:thumbsup: thanks, @asyncsrc. Regretfully no video recording. Audio and slides unsynchronised, but I'll post compiled game soon
ah, I saw the screen recording videos within the slides of intellij, which was the most important part for me personally. It would be nice to get a video recording of the presentation, but in most cases it seems like i need to follow along manually with slides anyhow since they’re hardly ever in focus in the video. But yeah, this is definitely awesome. Thanks again
If i've got
(ns something.here (:require [goog.userAgent :as ua]))
(.log js/console (ua/getUserAgentString))
Will I need an extern?Also, what are some good resources for learning the parts of google closure that are useful from cljs?
Has anybody ever tried running ClojureScript on the server to return a pre-rendered single-page-application on the first request?
@pupeno: Reagent does this for it’s homepage IIRC
what's a good option for a typeahead when you're already using Reagent and Bootstrap?
@borkdude: there’s some autocomplete stuff in goog
+ twitter’s typeahead.js has recently been added to cljsjs
@martinklepsch: thanks
In re-frame, how do I deal with a handler depending on another? Something like having a handler called get-user that request the user from the server, another got-user, that gets the data and puts it in the state, but now I have one called get-friends. Get-friends should only be run after get-user/got-user finished but I don’t want got-user to run get-friends as it’s not needed most of the time? Should get-friends do a dispatch-sync of get-user?
@escherize: for google closure: http://www.amazon.com/Closure-Definitive-Guide-Michael-Bolin/dp/1449381871
Thanks @greywolve - will check it out.
The latest Java update seems to have broken my cljs compiler. anyone else experience this?
I’m using cljs.pprint but (pprint {:a {:b 1}})
does not generate any newlines.
I’ve bound print-pretty to true
tools.reader currently cannot read the number literal 0 in clojurescript. not sure if this is worth making a ticket since it’s not a stable release yet though.
@sekao: Under what circumstances? It’s tested here >> https://github.com/clojure/tools.reader/blob/master/src/test/cljs/cljs/tools/reader_test.cljs#L20 , and works for me.
What version of cljs/tools.reader are you using? What platform, etc.?
i’m just doing (read-string “0”)
and getting “Invalid number format [0]”. other digits work fine.
@andrewmcveigh: it must be an issue with my project because i can’t reproduce it in a new one
Yeah, not sure which read-string your calling, but (cljs.tools.reader/read-string "0”)
is working for me.
Is it possible to include a figwheel live-reload server into an existing app?
@rickmoynihan: You want to compose figwheel into an existing process?
I have an existing server project - with no client side js yet... I want to add client side clojurescript to that project
@rickmoynihan: oh yeah that is straightforward
so I've added lein-fighweel
and lein-cljsbuild
to the project.clj and put a cljsbuild section -- which appears to work (i.e. I can throw a cljs alert box up onto my page that is served when I run lein repl.
What I don't have figured out yet is the live reload workflow
Am I best doing something like this? https://github.com/bhauman/lein-figwheel#using-figwheel-from-the-repl
yeah that seems easier
when I tried it though it didn't seem to work
presumably I need to include a figwheel script onto the page?
you don't have to load your compiled assets from figwheel you can load them from the server.
when in the :dev
env?
yeah I have compiled assets working
ok missed the quick start link - thought it was the README.md - thanks
this looks like what I was expecting to do... thanks
yeah I should have given you the link, and not assumed that you were wanting a short cut
damn - turns I already had it working
I hadn't seen the figwheel process had actually connected...
@yogthos: is it possible to generate in the reagent-forms typeahead in inside the list items an anchor? our bootstrap css expects that
@borkdude: in general reagent-forms should be layout agnostic, it’s also possible to do multiple bind-fields calls binding to the same atom within a component, for example if you wanted to show different forms conditionally
@yogthos: that works when you do arrow up and down, should it also work with mouse hover?
i think i found a way to lock up safari with cljs.js/eval
by evaling a form defining a variadic function. if someone could try my test code in safari i would appreciate it https://github.com/oakes/boot-cljs-example/blob/master/src/app/core.cljs
@sekao: boot serve -d target/ watch speak reload cljs-repl cljs -sO none
?
ah cool. didn’t know there’s an alias in the example proj
@sekao: beachballs 😉
@martinklepsch: and if you remove the &
and try it again it loads fine?
@sekao: yes — logs nil
once
I just created a re-frame project and it’s using figwheel but there’s no server side routing in the project. How do I make the server send the app when serving different URLs instead of just /
pupeno: easy way is to use # in your paths so everything gets to the same server path — otherwise, you’ll need to do some sort of path mapping — depends on server stuff how to do that, technically can just rewrite in apache etc.
nullptr: I just replaced secretary with silk and pushy to get rid of the #. In my main project, with compojure, it’s very easy to server the app no matter the URL and let the client do the routing. But for a blog post about this that I’m writing I’m using the re-frame template, which using figwheel with no server side, hence my question, how do I make figwheel serve the app for any URL that gets requested.
oh, in figwheel’s server you can pass it a ring handler which can basically do whatever it wants
Hey, I'm trying to set up modules. Right now I have
{:optimizations :simple
:modules {
:foo {:output-to "resources/public/js/foo.js"
:entries #{example.foo}}
:bar {:output-to "resources/public/js/bar.js"
:entries #{example.bar}}}}
. example.foo depends on library1 and example.bar depends on library2. Both library1 and library2 end up in cljs_base.js, is that right? I expected foo.js to include library1 and bar.js to include library2. The other problem I'm having is that example.bar ends up in cljs_base.js instead of bar.js. Any ideas what's going on?@mattparker: I don't have any experience with modules, but if I remember correctly, in the example there are three parts: example.bar
, example.foo
, and common.code-to-both
@bensu: check this out http://swannodette.github.io/2015/02/23/hello-google-closure-modules/
yeah I remember that, but I'm just pointing you to the wiki in case the :depends
option applies to your situation.
nah none of the namespaces depend on each other. Thanks though!
fwiw your expectations of the end result appear correct. at least that’s how closure modules have worked for me via JS build paths (plovr).
@sekao: There can be subtle problems with reading 0
related to *uncheked-if*
. See https://github.com/mfikes/replete/issues/8#issuecomment-119052347
hi guys! I'm looking for a persistent collection for clojurescript that acts as a ring-buffer or sliding-buffer
any ideas?
so far I found https://github.com/amalloy/ring-buffer
but I would need to migrate that to cljc and replace a couple of things
@jpmonettas: Clojure (and cljs) has queues if that works for you
but I need a fixed length one
so if a push one more than supported size, it drops the first
something like core.async sliding-buffer
exactly like amalloy ring-buffer but that works on cljs
@sekao: If you evaluate (do (ns foo.bar) (def x 3))
then x
will not be defined in foo.bar
in ClojureScript. In your “lock up Safari” example, that code complains a lot for me in things like Planck and Replete in the analyzer, perhaps as a consequence of the use of &
. One suggestion would be to ensure cljs.user
is created before doing the eval.
@jpmonettas: Closure has something (likely non-persistent). Never used it: https://google.github.io/closure-library/api/class_goog_structs_CircularBuffer.html
@mfikes i pushed a change to the example that evals them separately but Safari still locks up https://github.com/oakes/boot-cljs-example/blob/master/src/app/core.cljs
@mfikes the weird part about the (read-string “0”)
problem is that it seems to work fine when i build with advanced optimizations, it only seems to fail when i’m in dev mode. but since i can’t reproduce it in other projects i am just ignoring it for now...
yes, there is an item in activity monitor called Safari Web Content with high cpu usage
There was a small perf problem we discovered with defn
and Safari for cljs.js
that can be worked around via :static-fns true
: http://dev.clojure.org/jira/browse/CLJS-1381
@mfikes: yeah i noticed it is quite slow with defn in general but it seems like variadic defn is a separate issue, as it locks up indefinitely
@sekao: It ultimately exhausted memory for me https://gist.github.com/mfikes/a6a35895cc38b9ab853c
@sekao: The good thing is the WebKit team already know about the defect (it has been known for a good chunck of a year.
i just cleared my cache and the non-variadic defn worked fine, so it may have been using my variadic test just now
@sekao: Planck (which is also based on JavaScriptCore) cannot evaluate (defn hello [& args])
unless I build it with :static-fns true
to work around the JavaScriptCore bug.
i actually recall testing it on http://clojurescript.net and it worked fine in safari. i thought they were using bootstrapped cljs
Joel Martin updated http://clojurescript.net to reflecct what we learned about :static-fns true
@sekao: Sweet. I updated https://github.com/clojure/clojurescript/wiki/Optional-Self-hosting
@jpmonettas: BOOM! https://github.com/amalloy/ring-buffer/pull/6. Hope it helps
@mfikes: I'll check that. Thanks!
@nberger: Hey, that was quick! Thanks a lot
@nberger: cool! I skimmed over the PR and I would recommend a project like ring-buffer to test on node (not only it's more likely to be installed but it's also a better fit)
@bensu: Thanks. Why do you think it's a better fit? Agree with the likelihood of node being available, but don't think it's something critical... Anyways, I'll wait until @amalloy reviews the PR.
@nberger: not critical at all. Node is faster (both upstart and runtime), more stable, and has fewer quirks than Phantom. The only reason not to use Node is when you need a dom to manipulate (which I'm guessing ring-buffer doesn't).
@bensu: well, that's not the only reason: another reason could be for example if you simply started using phantom because you consider it won't be much difference using node in that particular project. For example in this case, I'm really not worried by phantom being slower in running a test suite that takes 0.11 secs to run in my machine.
I agree, when I say the only reason I mean: "if you want to take the time to decide, node will be a better fit". In many cases, such as this one, the decision might not be worth it, as you just said
@bensu: I'd be very happy to change the cljs test config to node if the project maintainer considers it is important. Feel free to chime in the PR to add your point of view, that would be very helpful for the maintainer to take a decision.
@nberger: sure, I'll give it a go after the PR settles. the project looks cool and I've been thinking about something like this to implement a somewhat generic undo component.
@nberger: when you include the lein startup time, the difference is so small is in the rounding error
the upside is that it worked only by changing the compiler's config, which is always a relief for a library author
the short of it being that whenever I edit a non-test file to add new symbols they get added but an old version of the tests is run against them
@tel: faced a very similar problem with boot-cljs; i created a simple repro here: https://github.com/pandeiro/cljs-test-issue