Fork me on GitHub
#clojurescript
<
2016-07-30
>
pdmct02:07:16

a newbie cljs question: Why is there no float? function? Is there some alternative I should/can use instead?

timothypratley02:07:15

@pdmct JavaScript numbers are always 64bit floats. Sorry if this doesn't help... what are you trying to test for floatiness?

timothypratley03:07:03

(number? 1) might be adequate?

pdmct03:07:33

I’m trying to write some cljs.spec predicates — some of my data are floats — just thought it was odd that it doesn’t exist — yes I am using number? but that is not as descriptive as I would like

timothypratley03:07:30

ah cool, yup well I think number? is as good as it gets in CLJS, as there is no finer type... what are you trying to describe?

pdmct03:07:53

ok thanks, just some stuff like this

(s/def ::latitude   (s/and number? #(<= -90.00 % 90.00)))     
(s/def ::longitude  (s/and number? #(<= -180.00 % 180.00)))

timothypratley03:07:05

:thumbsup: I see, nice. Yup seeing there is no other type than float for storage, you can't really be any more strict than that.

pdmct03:07:57

got it, thanks

odie11:07:59

Hi all, newbie question here. What is typically required to add a css framework into a clojurescript project? There are appears to be a lot of “*jar” repositories and it’s confusing me a bit. In particular, I’m trying to add the semantic-ui css framework to a project. Looking through some of the options, it looks like I can either: - Use webjars (but throws an dependency error regarding jquery) - Use clojars (isn’t at the latest version) - Use npm to pull the package and manage it with gulp (not sure how to integrate with clojurescript) Can anybody offer a few pointers?

pesterhazy11:07:36

@odie, you can just add it as a static file and add it to a vendor or assets directory

pesterhazy11:07:38

I'd just commit the .css to the repository and have it served as part of the static files of your project

pesterhazy11:07:29

unless you have a ton of dependencies like this, I feel this frees up a lot of headspace

pesterhazy11:07:27

although I hadn't heard of webjars before, that seems kinda neat

negcx17:07:16

I'm trying to do something seemingly trivial, which is on a textarea field (Reagent) on-input event, get the current scrollHeight... but for some reason this-as is returning this as the window object instead of the textarea object?

negcx17:07:11

[:textarea {:on-input #(this-as my-this (.log js/console my-this))}]

negcx17:07:34

Where am I going wrong here or is there some more idiomatic way to do this in ClojureScript?

negcx17:07:25

I was able to get it from .-target instead, although it seems there should be a way to use this