Fork me on GitHub
#clojurescript
<
2016-01-18
>
samueldev07:01:45

what are folks' preferred method if debugging your local db in re-frame?

samueldev07:01:44

i think im setting up a handler correctly but it doesn't seem to be correct, and trying to simply see the current state of my db is leading me down a rabbit hole šŸ˜›

serce08:01:47

@samueldev: https://github.com/binaryage/cljs-devtools might also be helpful, especially when you print big datastructures in chrome consle

nashio08:01:29

anyone know what the standard html5 canvas library is for clojurescript,

nashio08:01:46

I saw ā€œmonetā€ not sure if its the only one

jimmy09:01:34

hi guys, what is the correct way to use this in nested react component

(column
      #js {:header (cell #js {:children ["test"]})
           :cell (custom-cell {:data table-test
                               :index js/this.props.index ;; << this is not correct
                               :col :first})
           :width 100})

jimmy09:01:58

I'm trying to integrate the fixed data table to clojurescript. The current one on cljsjs is a bit outdated.

jaen09:01:03

@nxqd: a) what wrapper are you using?

jimmy09:01:32

@jaen: I use om next

jimmy09:01:59

and I create plain javascript element like so

(def table (js/React.createFactory js/FixedDataTable.Table))
(def column (js/React.createFactory js/FixedDataTable.Column))
(def cell (js/React.createFactory js/FixedDataTable.Cell))
(def column-group (js/React.createFactory js/FixedDataTable.ColumnGroup))

jaen09:01:39

I don't use om.next, but in general - something.props.index translates to (.. something -props -index) or (-> jomething (oget "props") (oget "index"))

jaen09:01:00

The question is how would you access the component (`this` in your example) and that's wrapper-specific usually.

jaen09:01:24

Ah, you get this as an argument in om.next

jaen09:01:43

So (.. this -props -index) or (-> this (oget "props") (oget "index")) should probably work

jaen09:01:08

Also, forgot to mention, by oget I refer to goog.object.get that for some inexplicable reason isn't imported by default : V

jimmy09:01:18

ah ok, let me try it then.

jimmy09:01:16

I even find the example from fixed data table a bit weird. Maybe you can have another look: https://github.com/facebook/fixed-data-table/blob/master/examples/FilterExample.js

jimmy09:01:40

the TextCell doesn't have any props called rowIndex passed through. Where does it get it ?

jaen09:01:38

I'd hazard a guess Column component injects it.

jimmy09:01:55

in case of clojurescript, it is nil šŸ˜ž

jimmy09:01:25

ah yeah I seem to find a way. It was that the cell passed in should be a function and its parameter is generated like we discuss above. Then we can create custom cell from it

(column #js {:cell (fn [x] ;; << we have rowIndex here
                                         (cel ...))

jaen09:01:09

This seems to be consistent with this example here - https://github.com/facebook/fixed-data-table#basic-example

jaen09:01:27

Specifically this:

<Column
      header={<Cell>Col 3</Cell>}
      cell={({rowIndex, ...props}) => (
        <Cell {...props}>
          Data for column 3: {rows[rowIndex][2]}
        </Cell>
      )}
      width={2000}
    />

jimmy09:01:30

yeah exactly

jaen09:01:49

Anyway, glad you've got this figured out.

jimmy10:01:37

thanks for helping though šŸ˜„

jimmy10:01:44

finally got the table going šŸ˜„

tragiclifestories13:01:41

having some cider/figwheel issues

tragiclifestories13:01:12

Iā€™ve been following instructions here (https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl#setting-up-cider), starting from the standard lein new reagent template

tragiclifestories13:01:58

but when I call figwheel-sidecar.repl-api/start-figwheel!, I just get a 404 page when I go to localhost:3449

tragiclifestories13:01:06

and the repl never connects

tragiclifestories13:01:22

anyone else ever had that kind of problem? Googling doesnā€™t give me anything useful (although there was an old GH issue with a similar thing reported by a Cursive user)

cjmurphy14:01:00

@tragiclifestories: I probably had the same issue (or more likely set things up without (at least without me knowing) the Cursive REPL). You won't suffer any lack of productivity by not having everything in Cursive. Cursive is good for editing and managing the project files. (And probably many other things). With Figwheel development you might find you don't need the REPL that much anyway, whether it is in or outside of Cursive.

tragiclifestories14:01:40

Iā€™m actually having the issue with emacs & cider

tragiclifestories14:01:00

it just happens to be completely identical to the issue raised by the cursive user above

tragiclifestories14:01:39

Iā€™ve probably messed the same thing up, but since the issue was closed without further comment (presumably because he/she worked it out), Iā€™m a little in the dark

cjmurphy14:01:41

My experience has been that with Figwheel (and devcards too if you like) the REPL becomes less important - you don't really need it - I certainly don't use it anyway.

cjmurphy14:01:30

Not for ClojureScript. I use it more for Clojure.

tragiclifestories14:01:58

Iā€™m doing a clojure demo at work tomorrow, so was hoping to trigger a js/alert from the editor for a cheap ā€œwowā€ moment

tragiclifestories14:01:13

serious software engineering right here

tragiclifestories14:01:31

but I can do it from figwheel command line well enough

cjmurphy14:01:50

Don't want to impress them too much - save the something for later šŸ˜‰

grav14:01:02

i think figwheel repl integration in cursive is very very cool

grav14:01:13

the autocompletion is much better than what I have from cmd-line

grav14:01:02

Iā€™m missing being able to set a breakpoint and debugging the stackframe, but at least when I have some state in an atom, I can plauy around with it from the figwheel repl

cjmurphy14:01:59

I got out of memory errors last time tried to use REPL in Cursive. I'm sure it is great - anything better than what I have now with a REPL from Windows console. One day I'll try it and it will work (and by then I'll be on a Linux machine so it most certainly will work I would hope).

tord14:01:44

My workflow is apparently very different: I use the REPL all the time with ClojureScript and Figwheel.

artemyarulin16:01:18

Hi, Iā€™m writing code for Clojure and ClojureScript and as it looks because of http://dev.clojure.org/jira/browse/CLJS-324 I cannot write simple (format ā€œHello %sā€ ā€œworldā€)

artemyarulin16:01:42

Is there any other functions that can do simple formatting which is available on both platforms?

artemyarulin16:01:17

(str ā€œHello ā€ ā€œworld) is kinda ugly if big strings is involved

dnolen16:01:01

@artemyarulin: there is not a shared thing, you can use goog.string.format

darwin16:01:01

@grav: breakpoint and stackframe debugging should be addressed by dirac, Iā€™m also a Cursive user, later I want to integrate ā€œshared nREPL sessionā€ mode there, where your interaction with nREPL session in cursive would be echoed into Diracā€™s REPL. That way you could for example send forms from Cursive to evaluation into nREPL and they would appear in Dirac DevTools (in addition to your Cursive REPL)

artemyarulin16:01:56

@dnolen: Thanks, Iā€™ll check this one

minimal16:01:22

@artemyarulin there is also https://funcool.github.io/cuerdas/latest/#format which works with clj/cljs . Never used it myself.

artemyarulin16:01:15

@minimal: Thanks. For now I decided to go with simple (clojure.string/replace "Hello {0}" #"\{0\}" "worldā€). If it wouldnā€™t be enough then Iā€™ll use/require something else

btking18:01:04

hi all. any recommendations for image dropzone or fileupload components in clojurescript?

yogthos18:01:24

@ rm, @btking I was just playing with that recently with cljs-ajax and the following works pretty well:

rm18:01:20

@yogthos: thank you! I'll try tomorrow

jaredly19:01:48

is there a way to have advanced compilation just ignore all js/whatever calls?

tord19:01:14

@artemyarulin: I use cl-format, a port of the immensely powerful Common Lisp format function. For some strange reason, it's found in the clojure.pprint / cljs.pprint namespace.

tord19:01:31

It's a remarkably complete mini-language for formatted output. Here's a good intro (for Common Lisp, but everything should work equally well in Clojure with a few obvious modifications):

artemyarulin19:01:20

@tord: Thanks! Iā€™ll have a look

dnolen20:01:25

@artemyarulin: I would be careful with cljs.pprint - I believe it may have advanced compilation issues

dnolen20:01:36

yet another thing somebody should submit patches for

martinklepsch21:01:26

@btking: @rm totally take a look at the goog stuff

martinklepsch21:01:20

Also I've made this once which uploads straight to S3 https://github.com/martinklepsch/s3-beam

rm21:01:49

wow. google closure seems to be both enormous and awesome

rm21:01:10

martinklepsch: thank you!

rm21:01:00

just curious if someone knows it well

martinklepsch21:01:41

@rm: google closure?

martinklepsch21:01:21

@rm: I think it's too big to really "know it well" in every aspect. but generally when I have some non-trivial JS thing to do I look there for helpers etc

martinklepsch21:01:51

things usually have descriptive names so just searching their api docs turns up useful stuff most of the time

shaun-mahood21:01:48

@rm There's also a book that might help (it's available on Safari Books as well) http://shop.oreilly.com/product/0636920001416.do

rm21:01:29

shaun-mahood: I guess that documentation is good enough

meow21:01:29

I started working on a library based on all the useful things in Google Closure but never finished it and some of my ideas are likely not good enough: https://github.com/decomplect/ion/blob/master/src/ion/poly/core.cljs

artemyarulin21:01:22

@dnolen: thanks for the warning

meow21:01:22

some of what I came up with are pretty handy, I think, such as:

(defn request-animation-frame!
  "A delayed callback that pegs to the next animation frame."
  [callback]
  (.start (goog.async.AnimationDelay. callback)))

futuro21:01:22

When accessing properties/functions/constructors, which is better, (js/foo.bar.baz) or (.. js/foo -bar baz)?

dnolen21:01:38

@futuro: either is supported, but I would probably avoid the former idiom for anything that isnā€™t a JS global

futuro21:01:14

@dnolen: good to know, thank you.

martinklepsch21:01:59

@juhoteperi: lomakkeet.core looks very much like something I'm hamock'ing on currently ā€” whats the purpose of the initial-value key?

juhoteperi21:01:14

@martinklepsch: To keep track of the previous state of form, so it's easy to cancel all changes

martinklepsch21:01:10

so it's more like last-comitted @juhoteperi?

martinklepsch21:01:38

What's the usecase for cancelling all changes? (not sure I understand it's utility)

juhoteperi21:01:45

So that user can click cancel button to discard changes šŸ˜®

martinklepsch21:01:18

Ok. Guess something I haven't needed very often simple_smile

mfikes22:01:41

As far as I can tell, same speed as SpiderMonkey