Fork me on GitHub
#clojurescript
<
2015-06-26
>
Oliver George06:06:21

Hi All, Is there a CLJS library to humanize numbers? Something like django.contrib.humanize or HubSpot/humanize. I'm mostly interested in natural numbers and plurals.

colin.yates10:06:44

hi all, when using reagent (actually re-frame), what do you use for cross-browser widgets like draggable divs, flash messages, date input dialogs etc. Do you jquery-ui, roll your own with inspiration from https://github.com/reagent-project/reagent-cookbook/ or the google closure?

zoldar11:06:06

@colin.yates: re-com provides some basic widgets that interface nicely with re-frame

colin.yates11:06:28

@zoldar: I know, but they are Chrome only

colin.yates11:06:40

@zoldar: they are nice though :0

zoldar11:06:03

@colin.yates: well, then I'm joining the question. There are a couple bootstrap wrappers spread around the net but mostly abandoned and/or out of date afaik

michaelr11:06:22

colin.yates: when I need some ui control I would usually search first for a react component and wrap it..

acron11:06:40

@michaelr I'd always prepare for this scenario, it any networked application

michaelr11:06:10

@acron: you are about sente?

zoldar11:06:36

@colin.yates, @michaelr: yeah, that's an option but it would be nice to have a consistent library of widgets, like om-bootstrap

michaelr11:06:03

zoldar: well, someone has to it simple_smile

zoldar11:06:44

@michaelr: and maintain it

michaelr11:06:01

acron: i dono about "any networked application".. there are many different cases, you know

acron11:06:00

@michaelr: I'm speculating but I doubt sente adds any provision for ordering messages and I'm fairly sure it's not done at the websocket. Definitely not at the transport layer.

acron11:06:43

I realise it's a broad statement, but my advise is just to never assume you're going to get messages in order.

michaelr11:06:46

acron: thanks

peyotz12:06:23

hey guys, anyone every play around with clojure on coils? - https://github.com/zubairq/coils any thoughts?

bostonou12:06:41

@olivergeorge: use the built in cljs.pprint

bostonou12:06:52

@olivergeorge: not sure of the best docs for it, but this is a good starting point: https://clojuredocs.org/clojure.pprint/cl-format. Cljs version is mostly equivalent to clj

jrychter12:06:34

@zoldar: I'm currently "wrapping" a number of Semantic UI components using Rum. My impressions are that it is very difficult to create a reusable and universal component, because there are no "standard web widgets": every component needs to have slightly different behavior. I ended up having components like "input+button", but they tend to grow over time, as I add more and more options for customization.

zoldar12:06:52

@jrychter: true, no way for one-size-fits-all and it's hard to make them composable

zoldar12:06:20

@jrychter: btw, I've stumbled upon an attempt to adapt om-bootstrap to rum https://github.com/pleasetrythisathome/blackstrap/ . However, seems like the author ported only a part of them (the ones he needed probably)

jrychter13:06:18

@zoldar: I am not that desperate looking for libraries, because as it turned out, wrapping Semantic UI components using Rum isn't that bad or hard.

michaelr13:06:41

I wonder what's the point in om-bootstrap, why not just use bootstrap css classes..

andrewmcveigh13:06:11

@michaelr: Well, if you want the js dependent stuff, but don’t want to include jQuery/etc.

zoldar13:06:38

@jrychter: sure, just got reminded of it

zoldar13:06:25

@jrychter: are you going to make your wrappers public in foreseeable future? simple_smile

michaelr13:06:56

andrewmcveigh: i think you have to include jQuery anyway for the bootstrap js stuff to work.. you mean it wraps the js bootstrap stuff I guess

jrychter13:06:58

@zoldar: No, I don't think so, it wouldn't make sense: they are too app-specific. And I'm not sure if universal ones can really be made. Perhaps with a behavior mixin architecture.

andrewmcveigh13:06:57

@michaelr: Really? I thought it was an implementation of bootstrap components using OM.

andrewmcveigh13:06:04

Could be wrong…

zoldar13:06:26

@jrychter: semantic ui looks really nice. and it seems to be less markup-heavy than bootstrap

andrewmcveigh13:06:30

Didn’t ever use it because it didn’t have a datepicker

jrychter13:06:39

@zoldar: I use it because it gets you up and running in no time with a rich collection of components. The semantic markup fits very nicely with sablono/hiccup-style coding. But it isn't ideal: it's JavaScript is something I try to avoid as much as I can.

jrychter13:06:06

Also, 500kB of CSS, as nobody seems to have invented a CSS whole-program optimizer yet.

zoldar13:06:24

@jrychter: yeah, just noticed, enormous

zoldar13:06:19

@jrychter: right, fonts are embedded in the css, that may account for a sizable chunk of the total size

Petrus Theron13:06:47

How should I set the browser URL to trigger my secretary routes using ClojureScript?

andrewmcveigh13:06:24

@petrus: What do you mean by set?

Petrus Theron13:06:46

I want to change the URL in the address bar from a re-frame event, not an anchor click.

Petrus Theron13:06:51

specifically, I want to change the URL token to match the route that I am sending the user to

andrewmcveigh13:06:08

I think you can do something with js/history.replaceState, but it’s limited

andrewmcveigh13:06:17

@petrus: in js you can do something like history.replaceState('Object', 'location', '/test’)

andrewmcveigh13:06:57

You’d likely have to re-call your routing after that.

michaelr13:06:54

I use this function

Petrus Theron13:06:49

where does nav-history come from?

michaelr13:06:35

btw, there is this blog post in my 'to read' list, looks pretty comprehensive http://www.lispcast.com/mastering-client-side-routing-with-secretary-and-goog-history

bostonou14:06:43

The other day someone (not sure who) asked about using apply with console.log. (.apply js/console.log js/console args) works.

bostonou14:06:18

Still working on it but I'll try to write up an explanation.

mikethompson15:06:45

Full code turned out to be:

(defn my-log
  [& args]
  (.apply js/console.log js/console (into-array args))

noprompt16:06:29

tired of writing the same clj-http/cljs-https boilerplate? want an easy way to express the notion of talking to an endpoint or a service? check out remote: https://github.com/outpace/remote

gadfly36123:06:17

If I am making a function that takes a map and destructures by keys, is there a way to *require certain keys to exist in the map?

timothypratley23:06:27

(defn picky [{:keys [must-have]}]
  {:pre [must-have]}
  (println "Everything is fine"))

timothypratley23:06:49

Or use schema or typed clojure

timothypratley23:06:34

(picky {:do-not-have :it}) ;; assert failed