Fork me on GitHub
#clojurescript
<
2016-09-19
>
richiardiandrea02:09:45

Cross-posting from #announcements: New replumb 0.2.4: :file in the ast is actually pointing to a real file thanks to CLJS-1515! Bumps Clojurescript - https://github.com/Lambda-X/replumb/releases/tag/0.2.4

dev-hartmann10:09:26

hey fellow clojurians, i am getting an error when requiring specter in one of my namspaces

dev-hartmann10:09:40

ERROR: any? already refers to: cljs.core/any? being replaced by: com.rpl.specter.impl/any? at line 530 resources/public/js/compiled/out/com/rpl/specter/impl.cljc Compilation aborted Subprocess failed

dev-hartmann10:09:30

i tried [com.rpl.specter :as specter :rename {any? core-any?}]

dev-hartmann10:09:52

but then i get: clojure.lang.ExceptionInfo: Renamed symbol any? not referred at line

nathanmarz10:09:29

@dev-hartmann fixed in 0.13.1-SNAPSHOT, try that

dev-hartmann10:09:08

@nathanmarz will try, thank you!

dev-hartmann10:09:59

@nathanmarz could i ask a question specific to using specter?

nathanmarz10:09:38

sure, but maybe that would be more appropriate in #specter

dev-hartmann10:09:39

@nathanmarz i am trying to add to a list inside a map of maps if the if the id matches. my code looks like that: (def same-id? (specter/comp-paths (specter/paramsfn [id-key id] [item] (= id (get item id-key)))))

dev-hartmann10:09:48

sry, you're right

artur10:09:47

How would I fetch the last portion of url, for example "http://www.mydomain.com/item/12345" I want to obtain 12345

credulous10:09:40

I’ve spent the weekend deploying my first-ever clojure/script webapp. I started with a vanilla app and gradually added deps, but transitioned to luminus because in the future I want a fast and known setup.

credulous10:09:37

I just want to say, luminus has amazing documentation. Every time I hit a small hitch, I’d google it, the luminus docs themselves would have the best answer… so within about an hour I was not googling at all.

credulous10:09:00

@yogthos’s docs literally never let me down all weekend. Thanks.

artur10:09:08

Just like clojure docs 😊

credulous10:09:34

Totally. 🙂 But luminus makes better assumptions about how smart I am.

credulous10:09:58

(jk - clojure docs are amazing. What I’m impressed about with Luminus is how conscientious @yogthos or his collaborators are in covering every detail. Here’s how you migrate the db in production. Here’s how you set up an nginx proxy. Here’s the SSL recipe. Stuff orthogonal to Luminus but important for a newb.)

hlolli11:09:47

@artur look at [com.cemerick/url "0.1.1"]

jhyu021012:09:25

om exercise answer?

jhyu021012:09:35

where can i find?

dnolen12:09:58

@jasonjckn could probably accomplish that with a macro

credulous13:09:30

Deploying a uberjar to ec2 (ubuntu 14.1, openjdk 8), and I get this error which I didn’t get locally or on another local server: Failed to get driver instance for jdbcUrl=jdbc:

credulous13:09:08

These are the deps in project.clj:

credulous13:09:13

:dependencies [
                  [ring "1.5.0"]
                  [metosin/compojure-api "1.1.8"]
                  [cheshire "5.6.3"]
                  [clj-time "0.12.0"]
                  [im.chit/cronj "1.4.4"]
                  [hiccup "1.0.5"]
                  [cljs-ajax "0.5.8"]
                  [secretary "1.2.3"]
                  [reagent-utils "0.2.0"]
                  [reagent "0.6.0"]
                  [org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "1.9.229" :scope "provided" :exclusions [org.clojure/clojure]]
                  [selmer "1.0.7"]
                  [markdown-clj "0.9.89"]
                  [ring-middleware-format "0.7.0"]
                  [metosin/ring-http-response "0.8.0"]
                  [bouncer "1.0.0"]
                  [org.webjars/bootstrap "4.0.0-alpha.3"]
                  [org.webjars/font-awesome "4.6.3"]
                  [org.webjars.bower/tether "1.3.3"]
                  [org.clojure/tools.logging "0.3.1"]
                  [compojure "1.5.1"]
                  [ring-webjars "0.1.1"]
                  [ring/ring-defaults "0.2.1"]
                  [mount "0.1.10"]
                  [buddy "1.1.0"]
                  [cprop "0.1.9"]
                  [org.clojure/tools.cli "0.3.5"]
                  [luminus-nrepl "0.1.4"]
                  [abengoa/clj-stripe "1.0.4"]
                  [luminus-migrations "0.2.6"]
                  [conman "0.6.0"]
                  [org.postgresql/postgresql "9.4.1209"]
                  [org.webjars/webjars-locator-jboss-vfs "0.1.0"]
                  [com.novemberain/monger "3.0.2" :exclusions [com.google.guava/guava]]
                  [luminus-immutant "0.2.2"]]

credulous13:09:00

so it does have [org.postgresql/postgresql "9.4.1209”] … not sure how to diagnose this, Google only suggests I put the postgres dependency in.

dnolen13:09:46

@credulous probably not quite the right channel for that question, I would try #clojure as well

credulous13:09:16

OK, thanks… thought since it was a webapp cljs was relevant.

dnolen13:09:34

it just seems to be about JDBC config to me

mac14:09:39

Shouldn't

(-> (js/fetch "" (clj->js {:method "GET"}))
    (.then #(.json %))
    (.then js->clj)
    (.then print)
    (.catch print))
print the result of the api call to a cljs REPL? I get #object[Promise [object Object]]

pesterhazy14:09:10

print is called asynchronously of course

mac14:09:28

@pesterhazy I get that, but should't it eventually print the result to the REPL

pesterhazy14:09:28

it'd be neat to be able to run planck with a fetch polyfill included to try things out easily

pesterhazy14:09:41

it should yes 🙂

mac14:09:56

@pesterhazy Still just prints the promise object.

pesterhazy14:09:36

try `js/console.log" instead of print

mac14:09:15

@pesterhazy Same result. I sould understand if the output ended somewhere else, but weird that I get the promise object back.

anmonteiro14:09:43

@pesterhazy probably worth raising an issue or talking about it in #planck

anmonteiro14:09:23

here’s the supposedly “best” polyfill: https://github.com/github/fetch

pesterhazy14:09:31

@anmonteiro joined that channel now

grounded_sage15:09:53

I'm getting a bit stuck on the Figwheel quickstart. This is the exception being thrown

No ns form found in src/hello_seymore/core.cljs

grounded_sage15:09:23

I'm stumped because I have the namespace and have followed everything according to the instructions.

pesterhazy16:09:09

what's in your core.cljs ?

bostonaholic16:09:16

@grounded_sage is the namespace of the file src/hello_seymore/core.cljs -> (ns hello-seymore.core)?

bostonaholic16:09:35

be sure that _ in files are - in namespaces

lxsameer17:09:31

hey guys, what do you guys use for navigation, ( I mean navigator replica for clojurescript ) ?

dnolen17:09:51

@lxsameer you mean history support?

lxsameer17:09:44

@dnolen history support and something like routing through different scene of a react native app

lxsameer17:09:57

ow I'm using reagent

dnolen18:09:17

@lxsameer hrm, in the browser goog.History

yury.solovyov18:09:33

Am I getting it right that go block only runs once unless it is go-loop ?

lxsameer18:09:57

@dnolen thanks man, that can me helpful for my first web app which I'm going to start using clojurescript

lxsameer18:09:43

@dnolen so there is no alternative in clojurescript for navigator in om or reagent, right ?

dnolen18:09:26

@lxsameer I don’t know about navigator

dnolen18:09:28

so no idea

lxsameer18:09:48

@dnolen also I watched you talk about clojurescript on ClojuTRE 2016, kudos

jorda0mega18:09:41

@lxsameer I think some people in the #cljsrn channel have mentioned this https://github.com/vikeri/re-navigate

tomas.casas18:09:14

Hey, good afternoon, brand new to clojurians and clojurescript. I am trying to port a regex from javascript to cljs

/^((?:not\s+)?included)(?=\s?:)/gim”
which is meant to match all the included and not included in a multiline string like:
test
Included:
Not included:
test

tomas.casas18:09:16

for that I am using re-seq hopping it would match js' g qualifier but for some reason I get nil on my repl using:

(def a “test\nIncluded:\nNot Included\ntest”)
(re-seq #"(?im)((?:not\\s+)?included)(?=\\s?:)" a)

dnolen18:09:43

@tomas.casas if you’re not doing something simple you will probably run into trouble

darwin18:09:49

@tomas.casas I would go with this: (js/RegExp. "^((?:not\\s+)?included)(?=\\s?:” “gim”) and then use that native regexp for matching

dnolen18:09:01

just write the regex that you want call the RegExp constructor directly

tomas.casas18:09:05

Yeah, I was thinking that as a last resource, wanted to be able to use cljs functions

tomas.casas18:09:16

perhaps I can break my problem in smaller pieces

tomas.casas18:09:44

is there an equivalent to the g qualifier in cljs?

darwin18:09:49

many cljs re-something functions accept native regexps (created by re-pattern under the hood)

darwin18:09:22

re-seq accepts it as well, so you can still use it with your custom-made regexp

tomas.casas18:09:14

thanks @dnolen & @darwin , will share the result

liamd18:09:15

what do i require in my project.clj to get spec in clojurescript?

liamd18:09:41

a little cursory googling didn't turn up a quick answer

darwin18:09:36

either 1.9-alpha12 or 1.8 + backported version

darwin18:09:55

and latest cljs of course

liamd19:09:12

and then (require '[clojure.spec :as s]) or different namespace?

darwin19:09:08

clojure.spec will be aliased to cljs.spec (assuming you are using latest clojurescript)

liamd19:09:25

excellent, thanks!

tomas.casas19:09:18

it seems this is the only way to accomplish the same results as in js:

(def a
"test
not included:
included:
test")
(.match a (js/RegExp "^(?:not[ \\u00a0\\u2000\\u200a\\u202f\\u3000\\ufeff]+)?included(?=:)" "gim"))
cljs.user=> #js ["not included" "included"]

darwin19:09:23

ah, that’s quite ugly, have you tried to double escape the backslashes?

darwin19:09:12

you could watch generated code, and tinker with the source string until you get the same result as you would write in js

tomas.casas19:09:42

can I see generated code in the cljs repl? where?

tomas.casas19:09:52

or do you mean the js generated in my project?

darwin19:09:14

you have :output-dir

darwin19:09:35

and you should find relevant files there, under namespace folders

tomas.casas19:09:10

checking! thanks a lot!

liamd20:09:29

can i use my om/next components as functions and just pass them props for testing or do they need to be all hooked up with a reconciler and all that?

dnolen20:09:10

@liamd there is an #om specific channel

liamd20:09:34

ah sorry i just misclickd on the sidebar

dnolen20:09:35

and yes you can do some testing in that way

tomas.casas22:09:56

is there a way from the repl to output which is current :output-dir?

dnolen22:09:17

@tomas.casas from the REPL itself - not really

darwin22:09:31

@tomas.casas you can call .toString on a function, this way you can quickly print generated cljs code for fns at hand

darwin22:09:52

but be careful with escaping again, I wouldn’t trust it 100%, because repl could print it in some fancy way

tomas.casas22:09:35

it was reading leiningen profiles to be able to hack this project’s profile.clj

tomas.casas22:09:29

I am running ATOM proto repl (Ctrl+Alt+ , j) to get a cljs env, since lein repl runs a clojure environment (used for integration tests)

tomas.casas22:09:49

not sure what triggers the switch, think profiles.clj should give me some answers, though I still need to get familiar with its structure/contents

tomas.casas22:09:54

again, thanks!

tomas.casas23:09:20

@darwin one thing I found is that cljs does not support g flag

tomas.casas23:09:46

the flags I see there are the ones java supports not js (ie: idmsux vs gimuy)