Fork me on GitHub
#clojurescript
<
2017-03-14
>
qqq11:03:04

https://github.com/oakes/paren-soup <-- is it just me, or is this fucking brilliant ?

fernandohur16:03:33

Wow that is pretty impressive.

fernandohur16:03:03

That mixed with https://microsoft.github.io/monaco-editor/ could make for a very sweet clojure editor

qqq16:03:58

the same dev built it into an actual IDE

qqq16:03:22

yeah; I'm actually using it right now

qqq16:03:30

it doesn't ahve an extension system yet

qqq16:03:41

but once it does, it'll be possible to script it in cljs like one scripts emacs in elisp

fernandohur16:03:53

From the website: > Nightlight is an editor you run inside your Clojure projects. Instead of being a separate application like traditional editors and IDEs, it's just a library that you add to your project. It spins up a web server and provides a completely browser-based interface to edit your code. > By running inside your project, it has complete access to the running state of your program. The ambition is to create something that follows the Lisp and Smalltalk tradition, blurring the line between your tools and your code to provide unprecedented interactivity.

fernandohur16:03:08

I need to try this out!

qqq16:03:26

the instructions aren't completely clear, there's a few boot dependencies it doesn't list

qqq16:03:34

if you're familair with boot, it won't be a problem; if not, I can help you get it working

qqq16:03:42

(I want more ppl to use this so there's more devs)

fernandohur16:03:36

I use leiningen. It worked out of the box. Setup took literally 4 minutes.

qqq16:03:50

Awesome! One issue I ran into with boot (not sure if leiningen has this problem) is that if you don't provide an index.html, it'll just say "Not Found" instead of "hey, provide a index.html"

qqq11:03:12

this entire base appears to also only be 1000 LOC

grounded_sage11:03:35

anyone doing anything with the Serverless framework?

thheller11:03:10

FWIW lots of the implementation is hidden in the deps 😉

thheller11:03:17

pretty sure its CodeMirror under the hood (maybe not though)

si1412:03:38

hey folks, anyone tried Bazel for CLJS?

martinklepsch13:03:05

I’m toying with module processing and Mobiledoc-kit — are there any known limitations with regards to cyclic require() statements? (these two reqiure each other: https://github.com/bustlelabs/mobiledoc-kit/blob/master/src/js/utils/cursor/position.js & https://github.com/bustlelabs/mobiledoc-kit/blob/master/src/js/utils/cursor/range.js)

martinklepsch13:03:54

@si14 not that I’m aware of but I’d be curious to see what that looks like

ihana-clojure14:03:54

Hello 🙂 I'm Hyesoo. I would like to apply GSoC 2017 Clojure project based on idea "Add cool features to KLIPSE" from (http://clojure-gsoc.org/project-ideas.html). I wrote a proposal for KLIPSE project.(https://groups.google.com/forum/#!topic/clojure/-V6YdOdoNdU) Could anybody check out and give me feedback? I am happy and open to listen any advice or ideas. Thank you very much. Have a happy day 🙂

thheller16:03:17

sounds like you are missing externs for the gapi stuff

thheller16:03:54

create a my-externs.js and add gapi.signin2.render = function(a,b) {};

thheller16:03:06

and add that to the :externs config of your build

tomaas16:03:16

@thheller, thanks. Where do I have to put the my-externs.js?

tomaas16:03:40

on the same level as src as I can see?

thheller16:03:15

uhm the compiler expects a path

tomaas16:03:16

and then reference it in :externs ["my-externs.js"] in project.clj

thheller16:03:29

I think it will although check the classpath though

thheller16:03:32

not entirely sure

thheller16:03:15

I have mine in PROJECT_ROOT/lib/externs.js with lib/externs.js as the config option

kah0ona16:03:54

question: can i dispatch on multimethods for showing different reagent components according to some dispatch function? It doesn't seem to work, or i'm doing something wrong... is it supported at all?

kah0ona16:03:16

ie. the (defmethod ....) is a reagent component

not-raspberry16:03:33

reagent wasn't build to work like that

kah0ona16:03:41

so it's a no :0

kah0ona16:03:46

but that's fine then i refactor it

kah0ona16:03:55

at least i dont have to keep on trying then 🙂

not-raspberry16:03:19

you can just use a case (or similar) with components

kah0ona16:03:30

will do, thanks for the swift reply

ghadi17:03:51

Help an old clojurist out: What's the current state of the art for running clojurescript scripts on the linux command line? I work in devops and would like to have some Clojurescript available for little one-off scripts. cljs->node or planck on linux?

ghadi17:03:00

Or something else entirely

mfikes17:03:22

Lumo or Planck are worth trying

ghadi17:03:35

Need access to an http lib and a fs abstraction, that's probably 99% of it

mfikes17:03:44

Planck has both of those

mfikes17:03:55

And Lumo is based on V8 / Node which has lots of stuff

ghadi17:03:15

what's the deployment story for Planck?

ghadi17:03:37

Do I have to make a binary available in addition to the script I'm running

mfikes17:03:11

Planck and Lumo can both run as interpreters, and will execute your scriopt

ghadi17:03:35

as in #!/usr/bin/planck ?

mfikes17:03:46

Yeah, shebang works

anmonteiro17:03:42

@ghadi Lumo doesn’t have nearly as much docs as Planck

anmonteiro17:03:14

but it shares most command line opts

mfikes17:03:20

But... Lumo is based on Node, so there's plenty of docs for that stuff 🙂

ghadi17:03:00

Thanks for all the advice guys. Do you have to do a lot more async things to use fs abstractions in node? Or is there a way to do stuff like tree-seq to enumerate directories?

mfikes17:03:11

I don't know about the Lumo / Node side, but Planck has planck.core/file-seq which acts like the Clojure one.

anmonteiro17:03:23

@ghadi every fs function in Node has a synchronous counterpart

anmonteiro17:03:07

(ignore js/$$LUMO_GLOBALS.)

ghadi17:03:16

seems straightforward

anmonteiro17:03:39

fs and path would be (js/require “fs”) and (js/require “path")

qqq17:03:49

https://github.com/oakes/html-soup <-- anyone have a set of css files to use with html-soup for formatting cljs data as hiccup ?

johnnyillinois18:03:19

Anyone working with re-frame know a good pattern to bootstrap the initial db depending on different build profiles?

johnnyillinois18:03:58

I'll check thanks!

johnnyillinois18:03:16

I think this would work @qqq

qqq18:03:13

@johnnyillinois : awesome! @martinklepsch writes good stuff

hlolli21:03:06

Has this bug already been reported? TypeError: goog.string.format is not a function? This function works in the second last release of cljs.

anmonteiro21:03:30

@hlolli probably not a bug, can you show what you’re requiring and importing?

anmonteiro21:03:11

works for me:

cljs.user=> (require '[goog.string :as str])
nil
cljs.user=> (import '[goog.string format])
nil
cljs.user=> (format "%s" "foo")
"foo"

hlolli21:03:08

yes this works for me too @anmonteiro, I guess the cause was that I did not require it, and then probably the older version was more foriging then.

hlolli21:03:31

it happend twice today for me that I couldn't use this funciton, so I got confused

anmonteiro21:03:35

that’s the wrong explanation for what you’re seeing

anmonteiro21:03:33

the fact that something works if you don’t require it may happen if your dependency order allows it

anmonteiro21:03:59

once you add a new namespace your dependency order may shuffle around which causes the error you’re seeing now

hlolli21:03:15

yes, well I see this as a good thing then, that it prevents me from using unimported functions. But sadly much code hangs on this (very) bad habit.

ddellacosta21:03:43

folks, my google-fu is failing me, and I don’t see anything relevant in the CLJS google group: does anyone know how to resolve the (I assume common?) issue with phantomjs crashing when using async cljs.test tests?

Ran 7 tests containing 22 assertions.
0 failures, 0 errors.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

darwin21:03:26

@ddellacosta are you running the latest phantomjs?

ddellacosta21:03:41

oh, let me confirm @darwin

ddellacosta21:03:12

yeah, looks like I’m on the latest

ddellacosta21:03:42

note that I only see the crashing behavior when I add a test using the async feature of cljs.test

darwin21:03:48

I’m also using async tests with phantomjs and it does not crash on me, so it must be something more specific

ddellacosta21:03:54

huh okay, that’s a clue

ddellacosta21:03:33

are you using it with core.async in particular (as I am) or just to test async behavior otherwise?

ddellacosta21:03:56

if the former, any chance I could persuade you to paste in an example test?

ddellacosta21:03:29

(cutting out some wrapping code) mine looks like this:

37│        (test/async done
 38│          (go
 39│            (d/page* c
 40│              (-> app-state-fixture
 41│                  (assoc-in [:dashboard :initialized?] false)
 42│                  (assoc-in [:authenticated :hostnames] [”"])
 43│                  (assoc :websocket-ready? true)))
 44│            (is (= m/LoadDashboard
 45│                   (type (async/<! c))))
 46│            (done))))

ddellacosta21:03:08

c is a core.async channel, but I suppose that’s obvious

ddellacosta22:03:20

huh okay, not different overall but I wonder if the fact that I’m defining/initializing the channel outside of the async block is signficant

ddellacosta22:03:34

it’s a bit of a cargo-cult hunch but let’s see

darwin22:03:08

bisect the code by commenting out parts

ddellacosta22:03:13

huh, okay, well I guess I’ll review your code further and see if maybe there’s some cleanup you’re doing that I’m not

ddellacosta22:03:34

sorry, what do you mean? Are you referring to mine or yours?

ddellacosta22:03:19

oh well in any case guess it makes sense for me to whittle it down until I can isolate what causes it, if that’s what you meant. Thanks @darwin! I think this should get me a lot closer

darwin22:03:43

yes, locate exact line/call causing it

darwin22:03:05

I would bet that empty (test/async done (done)) works

ddellacosta22:03:11

yeah, basically trying that now

ddellacosta22:03:14

it does for the record, but simply adding in go to the mix breaks things

isak22:03:15

there seem to be a ton of mistakes in closure i18n (number format, at least). Is this known? https://github.com/google/closure-library/blob/master/closure/goog/i18n/numberformatsymbols.js#L1889

ddellacosta22:03:17

so something weird is going on

darwin22:03:19

@isak have you tried to actually clone closure-library repo and look at it in a decent UTF-8 supporting text editor?

darwin22:03:42

I woudn’t trust github web view in this case

isak22:03:54

@darwin no, but i tried it in the console, and it seems not even close

isak22:03:48

@darwin and if you try to give the correct format manually, it chokes. (`.` as thousands sep)

darwin22:03:40

I barely remember I used to have similar problems and it turned out I didn’t include javascript file with proper UTF-8 encoding in <script> tag

grav22:03:28

Is it possible to get a different macro evaluated depending on clj/cljs? So if I build with cljsbuild, then one macro is used, with clj, another one.

isak22:03:35

ah, interesting

darwin22:03:04

@isak now I recall that the fix was proper UTF-8 in some meta in html header

darwin22:03:17

if that was missing, unicode stuff went bad

darwin22:03:38

something like <meta http-equiv="Content-Type" content="text/html;charset=UTF-8”>

darwin22:03:40

but not sure

isak22:03:50

@darwin i will give that a shot. Thanks!

grav22:03:21

My use case is, that I have some code that uses conditional reads for a function, but now I’d actually want to use a macro instead of the function

darwin22:03:17

@grav inside macro you can definitely detect if you are in clojure, cljs or self-hosted cljs, and emit code depending on it

grav22:03:38

Ah, nice. How do I detect that?

grav22:03:47

@jr cool, thanks!

tomjkidd22:03:20

Is there any way to access the js/Error message when using thrown? for clojure.test?

darwin22:03:05

thrown-with-msg? ?

tomjkidd22:03:24

that sounds promising!

darwin22:03:07

just open clojure.test source code and read it, not that hard and I’m pretty sure you will find other useful stuff there 🙂

isak22:03:25

@darwin you were right 🙂 thanks again.