Fork me on GitHub
#clojurescript
<
2017-03-09
>
qqq07:03:24

https://github.com/binaryage/cljs-oops is probably one of the mostunderrated libs of all time

qqq07:03:11

pre https://github.com/binaryage/cljs-oops I keep 6 emacs windows open {boot client, boot server, gae} * {dev, prod} so that after hcekcin things work in dev :optimizations :none, I look over at prod :optimizations :advanced

qqq07:03:32

but now, there's no longer need to keep prod open with ocall/oget/oset!, so I can kill the prods most of the time

qqq07:03:46

this speeds up compile time and also reduces heat generated toward global warming

urbanslug09:03:43

What does the error "Feature should be a keyword" mean?

urbanslug09:03:04

I've not even used a keyword in that part of the code

gklijs10:03:17

Probably your using a function from maybe a library which expects a keyword to get something from a map?

rc114011:03:39

hi all , has anyone experianced this error or know what it indicates when using sente DEBUG [taoensso.sente:208] - Bad package: , then it outputs the map that i was trying to send , it seems like its an issue with the size of the data but im not sure

rc114011:03:49

closest i found was this , http://ptaoussanis.github.io/sente/taoensso.sente.html , but it doesnt explain what it means

nha11:03:38

@urbanslug I see that in cljc files. Just put one form under :clj or :cljs or wrap it in a do

rc114011:03:28

ok so the actual exception seems to be "Reader tag must be a symbol" , though that doesnt seem to explain much more

xsyn11:03:38

Can you share what you’re sending

urbanslug11:03:24

If I add a depend like [cljsjs/moment "2.10.6-4"] in my project.clj is there anything special I need to make this work in my cljs code?

urbanslug11:03:18

With a funtion like

(defn format-date
  [date]
  #?(:cljs (if (or (js/isNaN (new js/Date date))
                   (= (new js/Date date) "Invalid Date"))
             date
             (-> date js/moment (.format "ll")))))

xsyn11:03:44

you just need to require the namespace as usual

urbanslug11:03:07

hmmm it doesn't seem to be required in other places. It's used with js/moment

xsyn11:03:08

I think you can do a #?(:cljs (require …) )

urbanslug11:03:34

Funny is that it's working in another piece of code that doesn't require it.

urbanslug11:03:46

requiring it worked

urbanslug11:03:03

Damn typing that name is hard

xsyn11:03:32

It’s 4 characters ?

xsyn11:03:58

Err… and cool 🙂

qqq12:03:25

PvNP is also only 4 chars 🙂

gordon14:03:55

@urbanslug it might work from other namespaces that don't require it, it just depends on if it was required from another ns "before" the ns in question (think about the compiled js)

gordon14:03:04

best bet is to require it.

qqq16:03:45

with lumo (or anything else) is it possible to run *.cljs files as shell scripts under node.js?

qqq16:03:03

(main concern is somehow firing up the compiler, compiling the cljs and running it) --- or straight up interpreting the cljs file

qqq16:03:09

shell scripting in cljs would be amazing

richiardiandrea16:03:24

@qqq yes it is already possible

qqq16:03:39

@richiardiandrea : awesome ; what do I need to install to make this happen?

richiardiandrea16:03:44

Lumo for Node.js 😀 or Planck, one sec I am fetching some samples from our meetup

richiardiandrea16:03:29

In the repo you will find other examples of how we were playing around with it 😀

mfikes16:03:46

Yes, you can just, for example do lumo foo.cljs and it will run it. If you do lumo -h you will see that it follows the same command-line argument patterns used in the regular Clojure REPL.

tech_hutch16:03:32

I notice, in the CLJS API, there's a "special form" called let*. It doesn't have any documentation for it, though, and it doesn't seem to be in "normal" Clojure. What does it do?

richiardiandrea16:03:00

darwin: this is very good! I was wondering if it could be reused for figwheel/boot-reload as well. We should maintain it in a repo 😉

darwin16:03:18

well, it is not general enough, it would need some kind of configuration for source folders and maybe other projects will have different structure not really working with this matching scheme

darwin16:03:28

I definitely don’t want to support something like this 🙂

darwin16:03:40

that’s why it is provided just as an example

darwin16:03:25

anyways, feel free to grab it and use it anywhere

richiardiandrea16:03:05

Ok fair, I will use it for sure, maintaining we'll see, too many things to maintain at the moment 😀

darwin16:03:25

oh, you didn’t look? 😉

qqq16:03:08

@darwin: I did look, which is where I got the name "lumo" from

qqq16:03:37

@darwin: which then led me to believ "either @darwin is an idiot; or somehow it's magically possible to run cljs files as shell scripts with no downtime; despite cljs itself being slow"

tech_hutch16:03:23

As one might imagine, it's difficult to search the internet for let*.

tech_hutch16:03:42

Okay, thanks. So I guess it's just a low-level compiler thing, then.

tech_hutch16:03:57

It would be nice if they mentioned this in the documentation.

qqq16:03:30

(trying to install lumo) is "npm install -g" supposed to require root? (newcomer to node.js)

tech_hutch16:03:36

I think it just installs for your account, so it shouldn't.

tech_hutch16:03:10

If it errors out, you could try root.

darwin16:03:02

@qqq use brew if you are on a mac

darwin16:03:39

or jump into another rabbit hole: https://github.com/creationix/nvm

shaunlebron16:03:54

@tech_hutch what made you look for let*?

tech_hutch16:03:13

I just happened to see it in the API.

tech_hutch16:03:56

^ Linked to from the ClojureScript website

shaunlebron16:03:56

i’ll add a note to it

mfikes16:03:57

@tech_hutch If you do (source let) you can at least see how the let macro is built atop the let* special form.

tech_hutch16:03:46

The repl at http://clojurescript.net/ doesn't seem to have source. Maybe it was added after it was created.

anmonteiro16:03:27

@qqq if you’re on a Mac you can brew install lumo

anmonteiro16:03:51

or npm install -g lumo-cljs otherwise

qqq16:03:08

@darwin: just got lumo working -- it's amazing, every time I study dirac, I end up learning something new (besides the choice of lein vs boot and cursive vs emacs)

qqq16:03:16

@anmonteiro : thanks; just got it working

tech_hutch16:03:26

I just tried (source let) at http://clojurescript.io/ and it returned nil. :thinking_face:

richiardiandrea17:03:57

tech_hutch: just to clarify here, the project used to be well maintained but then I changed jobs and other people did the same, and unfortunately things are not keeping up with the fast pace of cljs development. It is a self-host repl that shares a lot of code with Planck and uses replumb, a library I (try to) maintain for creating self-host repls 😀

tech_hutch17:03:01

Okay, I understand. It's running really slowly for me, in Firefox, though. Is it supposed to be that slow? I'm running it on an average PC.

tech_hutch17:03:24

There's like a half-second delay for entering a character.

richiardiandrea17:03:10

Yeah we found that firefox was kind of slow, definitely, but as I said, it is a pity that that after I changed jobs things were left as they were...the project is oss and I can still merge PRs, but I don't know if Jenkins still pushes the release version up, you can find it here: https://github.com/Lambda-X/cljs-repl-web

anmonteiro16:03:03

@tech_hutch that’s not an officially supported REPL

anmonteiro16:03:29

source is a REPL special that different REPLs need to implement

anmonteiro16:03:49

the ClojureScript REPL that ships with the CLJS compiler will have source

anmonteiro16:03:32

@tech_hutch answering your question, let* is an internal thing which is not meant to be used

anmonteiro16:03:57

it’s one of the special forms that the analyzer needs to parse separately

shaunlebron16:03:00

may need a refresh, but you can submit docs in the details page, click “edit here” at bottom

tech_hutch16:03:07

I saw, thanks. 🙂

anmonteiro16:03:09

just like def, loop*, ns, etc

tech_hutch16:03:18

Oh, you can submit docs? That's nice.

shaunlebron16:03:29

I added this so I could get myself to start writing more docs: http://cljs.github.io/api/#progress

shaunlebron16:03:40

color-coded by documentation progress

shaunlebron16:03:57

we’ll get there

robert-stuttaford17:03:41

hey folks, what are y’all doing to automate browser testing? clj-webdriver is unmaintained 😞

nikki17:03:43

Anyone use Lumo to make a server?

nikki17:03:58

Thinking about using it to make a game server ish situation

darwin17:03:42

@robert-stuttaford I had to vendor clj-webdriver in dirac for latest selenium updates, feel free to grab my patches: https://github.com/binaryage/dirac/commits/master/test/src/webdriver/clj_webdriver

robert-stuttaford18:03:30

@nwjsmith nice find — what did you search for to find that?

robert-stuttaford18:03:33

thanks @darwin! given this, would you consider clj-webdriver to still be a viable foundation to base long-lived tests on?

nwjsmith18:03:15

I think it came up here on one of the channels and I starred it on GH, not sure actually.

nha18:03:46

Starred it as well, pretty sure it was on slack 🙂

robert-stuttaford18:03:31

@darwin do you know if the clj-webdriver you have can be used with http://browserstack.com?

igrishaev19:03:45

@robert-stuttaford I'm working on my own Webdriver implementation: https://github.com/igrishaev/etaoin Today I released a new version. Here are autodoc pages: http://grishaev.me/etaoin/ There are also unit tests as example.

igrishaev19:03:24

In our company, we did try to use clj-webdriber but faced some troubles.

grav20:03:11

I found a large list on HN about small js libs/frameworks (https://news.ycombinator.com/item?id=13830148). A lot of them implement some kind of virtual DOM like React. I wonder if there are any attempts doing the same in plain cljs?

grav20:03:32

Cool! Seems it’s a bit abandoned though.

anmonteiro21:03:37

@tech_hutch you probably want cond

anmonteiro21:03:03

cond-> threads the first argument, so it actually becomes (let (count choices) [...])

tech_hutch21:03:40

Really? I thought it only threaded the conditions?

anmonteiro21:03:47

it doesn’t thread the conditions 🙂

anmonteiro21:03:51

so they’re also wrong

anmonteiro21:03:21

I mean, the logic is wrong, because (> 1) will always return true

tech_hutch21:03:44

Oh, I see. Thanks.

tech_hutch21:03:30

I just wanted to avoid the repetition of (count choices).

tech_hutch21:03:44

I guess I'll put the whole thing in a let.

tmayse23:03:17

is there a widely-used library for sanitizing human input for cljs? I haven't found anything terribly useful.