Fork me on GitHub
#clojurescript
<
2016-05-01
>
jimmy03:05:59

hi guys I'm looking for a currency formatter lib in cljs. Do you guys have any recommendation ?

ezmiller07:05:58

Hi all, looking at the following func for casting a string to an int:

(defn parse-int [s]
  (Integer/parseInt (re-find #"\A-?\d+" s)))

ezmiller08:05:44

I am writing clojurescript, and so perhaps don’t have access to the Integer class. Is that right?

paradoxquine08:05:26

@ezmiller: yea, try (js/parseInt (re-find #"\A-?\d+" s) 10)

paradoxquine08:05:00

i'm not sure if GCL has its own parseInt, but js has a native one. the extra arg is the base, which you should always include because javascript's parseInt does stupid things if you don't give it a base

ezmiller08:05:00

@paradoxquine: thanks! That worked. And thanks for the tip about the xtra argument as well.

ezmiller08:05:00

What’s the best way to do a simple redirect in clojurescript? I’m using reagent have a route setup for page at /thankyou.

borkdude09:05:03

@ezmiller: I use a function for that, let me look it up

borkdude09:05:52

@ezmiller:

(defn redirect
  [path]
  (set! (.-hash (.-location js/document)) path))

borkdude09:05:37

you might want to change it a bit if you're not using the hash

risto11:05:32

The routing step, git checkout step3, fails with string.cljs:38 Uncaught Invalid match arg: /^#/ when going to localhost:5050

risto11:05:08

I don't see how that's possible since the dependencies are frozen. Am I doing something wrong?

ezmiller13:05:26

@borkdude thanks. I ended up using a shorthand version of that, just calling (set! js/window.location.href “/thankyou”) This worked, but I didn’t look to see whether it maintained the history. I’ve seen some stuff about using the secretary module.

bojan.matic14:05:46

anyone using atom and protorepl? i'm not sure how to set it up for figwheel

niwinz17:05:33

@risto: that tutorial is pretty deprecated, I have done it some time ago..., I don't know why that errors is happens...

niwinz17:05:54

I have plans for update it but I don't found enough time for it 😞

risto18:05:29

@niwinz: I'm surprised though that's it's breaking, because the dependencies are frozen. Or is it something that changed with the google closure compiler?

niwinz18:05:22

things have changed, and clourescript compiler has evolved, I don't know at this moment why is broken