Fork me on GitHub
#clojurescript
<
2015-11-17
>
nullptr03:11:57

Thanks, it was a lot of fun!

dvcrn07:11:11

I know which talk I'm sending to a buddy 😛

dvcrn07:11:16

great talk!

dvcrn07:11:23

thanks for the link here

yusup08:11:22

why are comments disabled on Conj videos?

tiensonqin08:11:51

Anyone know how to using Static Image Resources in cljs? https://facebook.github.io/react-native/docs/images.html#content

ernestas12:11:57

Anyone got slow reloads with latest figwheel ? https://github.com/bhauman/lein-figwheel/issues/264

oahner12:11:07

@ernestas: Tried adding :recompile-dependents false to your :compiler settings?

ernestas12:11:11

works, thanks a lot

honza15:11:52

Anyone understand how piggieback works? Cemerick projects have incomprehensible documentation. I’m trying to use Emacs CIDER with a cljs nrepl and this is what I was told to use. I can’t help it but I feel like the docs just told me to go fuck myself.

jstew15:11:15

I'm interested in the same. I took a look at the README and put it on the back burner because I didn't understand it.

isak16:11:52

is there something like spyscope for clojurescript?

mrg16:11:33

@honza I assume you want to get a cljs repl within cider?

mrg16:11:49

I've been able to get that to work with the reagent template

mrg16:11:32

I'll tell you how and then you can pull it apart and see which parts are the parts that you are missing

mrg16:11:50

create a new reagent project with lein new reagent myapp

mrg16:11:03

then in the myapp directory, run lein figwheel

mrg16:11:28

once that's started up, go to "localhost:3449" in your browser

mrg16:11:52

then open the myapp/src/cljs/core.cljs file in Emacs

mrg16:11:12

do a cider connect (C-c M-c) to localhost:7002

mrg16:11:31

Once that's connected run (figwheel-sidecar.repl-api/cljs-repl)

honza16:11:51

@mrg Thanks! I'll try it out shortly

jstew16:11:30

That method works well for me also.

mrg16:11:48

It's a lot of black magic

mrg16:11:52

but it works. Mostly.

jstew16:11:02

You can do it with vanilla figwheel also by specifying the nrepl-port in the project.clj options for figwheel

jstew16:11:13

figwheel is one awesome piece of software.

mrg16:11:30

Anyways, I was wondering if anybody knew a good way to accumulate values from a bunch of core.async channels and then push the result out to another channel

mrg16:11:24

say i have channels s1, s2 and s3, which return :a, 😛, and :c respectively

mrg16:11:08

how do I write a function that takes [s1 s2 s3] and returns a channel that will eventually yield [:a 😛 :c] ?

mrg16:11:09

(i can assume that all channels will return just one value. Those are actually webservice calls)

jstew16:11:27

right off the top of my head, you could probably use alt!, add the value to a list, and recur until the number of values is equal to the number of chans you're alting on

jstew16:11:09

there may be a better way, but that's what my intuition gave me simple_smile

mrg16:11:09

yeah, but that doesn't seem nice, does it? simple_smile

mrg16:11:02

i tried async/merge and then async/reduce but that didn't work out. I suspect i was using them wrong

mrg16:11:46

actually, nevermind! I was an idiot

mrg16:11:53

I wasn't closing the channels

mrg16:11:57

so reduce didn't finish

mrg17:11:28

(defn get-all []
    (let [s1 (return-stuff :a)
          s2 (return-stuff :b)
          s3 (return-stuff :c)
          stuffs [s1 s2 s3]]
 
      (->> stuffs
           (async/merge)
           (async/reduce conj []))))

mrg17:11:47

This works! Thanks guys, sometimes you really need a rubber duck

honza17:11:09

@mrg Complaining about nrepl refactor

mrg17:11:26

for me too, and i can't figure out why

mrg17:11:29

it should still work though

mrg17:11:03

are you getting a repl, or is it a show stopper?

honza17:11:31

lein figwheel works fine, but cider-connect doesn't

mrg17:11:49

what exactly do you do, what does it say, and what doesn't work?

honza17:11:59

@mrg In the terminal, I run lein figwheel. Then, in Emacs, I open src/cljs/core.cljs and run M-x cider-connect, then interactively select localhost and 7002. I get an error saying that I should install nrepl-refactor. The bottom of the screen says that it’s not connected.

mrg17:11:55

ah, okay. Put these in your ~/.lein/profiles.clj:

mrg17:11:00

[refactor-nrepl "2.0.0-SNAPSHOT"]; helps with refactoring and is a dependency of clj-refactor
            [cider/cider-nrepl "0.10.0-SNAPSHOT"] ; needed for clj-refactor

mrg17:11:05

in the :plugins vector

mrg17:11:24

or if you'd rather try it out local first, put them in the project.clj of your try-out project

honza17:11:44

I have those but older versions. Let me try it with the ones you specified.

mrg17:11:03

they should match the one cider version you have

mrg17:11:14

when i start the repl, i get

honza17:11:17

no idea which version i have

mrg17:11:19

> ; CIDER 0.10.0snapshot (package: 20151025.1201) (Java 1.8.0_25, Clojure 1.7.0, nREPL 0.2.12)

mrg17:11:48

you should see something like that too when you start a repl in cider

mrg17:11:04

or easier, just update cider to the newest version from melpa

mrg17:11:11

that one is 0.10.0-snapshot

honza17:11:03

M-x cider-version

honza17:11:43

I upgraded everything, still can’t find refactor nrepl. Lol.

mrg17:11:26

just looked around, and it seems that fighweel likes to ignore some leiningen config

mrg17:11:38

but are you certain that under all the warnings there isn't a repl?

mrg17:11:10

i get all the stupid warnings, but ALSO the repl prompt

honza17:11:36

To be honest, I never use the repl buffer. I just C-c C-c and C-c C-k

mrg17:11:46

well, you might wanna check that

honza17:11:48

I’m using spacemacs (maybe that makes a difference)

mrg17:11:54

because you have to start the cljs-repl from the repl buffer

honza17:11:06

there is no repl buffer in the listing

mrg17:11:26

cider-connect doesn't open one?

honza17:11:26

doesn’t lein figwheel start a cljs-repl?

mrg17:11:34

yes but you want to connect to it from emacs

mrg17:11:37

isn't that the whole point?

honza17:11:48

cider-connect gives me an error about a missing dependency

mrg17:11:59

an error, not a warning?

jstew18:11:07

What color theme is that? Very nice! #ot.

mrg18:11:27

slightly modified version of spacegray

jstew18:11:15

Pretty. I have moe-dark but sometimes it's not very readable.

honza18:11:42

> yes but you want to connect to it from emacs --- isn't that the whole point? Yes. But you said that I need to start the cljs-repl from the repl buffer. Why? It’s already running in my shell.

honza18:11:46

So confused

mrg18:11:39

i want to keep the stuff in emacs

mrg18:11:52

that way i can eval expressions and can check state and all that

mrg18:11:14

plus that's the way to get jump-to-expression etc working

mrg18:11:33

and for that, you need to jack into the cljs shell

mrg18:11:37

and for that you need the repl buffer

honza18:11:47

i’m so confused

mrg18:11:05

I'm not sure how to help you there. Sorry, buddy

honza18:11:24

I think there is a disconnect in my brain about how this whole thing works.

mrg18:11:54

emacs/cider query the repl for all sorts of stuff

mrg18:11:06

"where is that function defined? what's the doc string?"

mrg18:11:16

so if you want those things to work, you need a repl connection within emacs

honza18:11:42

In my regular Clojure workflow, I start a lein repl and connect to it from Emacs. Then I can compile the current file, and eval an expression with C-c C-k and C-c C-c.

honza18:11:05

Emacs talks to the repl process started in my shell

mrg18:11:37

that's close to what you need to do, except that the clojure repl needs to connect to the clojurescript repl

honza18:11:42

or, if i don’t want to bother wih lein repl, i can get emacs to start it for me with cider-jack-in

honza18:11:02

This is what I get after running lein figwheel in the regeant template.

honza18:11:16

It seems to start a cljs repl. How do I connect to it from emacs?

chris18:11:26

M-x cider-connect

chris18:11:56

and then run (figwheel-sidecar.repl-api/cljs-repl)

chris18:11:49

the cljs repl isn’t an nrepl by default

chris18:11:23

I actually don’t know how nrepl works, exactly, but piggieback wraps the cljs repl in an nrepl so that you can use nrepl functions and still connect to your cljs process

noonian18:11:21

figwheel takes an :nrepl-port option

noonian18:11:33

to make it serve nrepl

ul18:11:18

noticed that cljs stopped to recompile if files changed inside directory linked into source (by ln -s)

ul18:11:45

it's cljs-build plugin responsibility to perform such watch?

honza18:11:43

investigating :nrepl-port

honza18:11:48

what arguments/params do you give to cider-connect?

mrg18:11:30

localhost

honza18:11:26

ok, i got it to work

honza18:11:36

this is so dumb

honza18:11:47

i now have two cljs repls running

honza18:11:00

hm, maybe not

honza18:11:37

I don’t understand why I need to start the cljs repl inside of emacs when it’s already running. It doesn’t actually start a new process, it just seems to tell emacs that it exists.

honza18:11:51

Thanks everyone for you patience and help!

borkdude19:11:17

@honza: You can also use inf-clojure to interact with lein figwheel, but then you need to start lein figwheel from inferior-lisp

borkdude19:11:46

@honza: I used to do it that way.

honza19:11:55

I understand some of those words simple_smile

borkdude19:11:34

@honza: steps to reproduce: 1) install inf-clojure package. 2) C-u M-x inferior-lisp RET lein figwheel RET, 3) enable inf-clojure inside your .cljs buffer, and interact you can.

borkdude19:11:26

but if you can use nrepl, that's cool too. I'm not sure how that works if you have backend code to interact with too.

isak23:11:17

it seems like an extern for Element.prototype.closest does not get respected for (.closest e.target ...), anyone else experienced this issue?