Fork me on GitHub
#clojure-uk
<
2017-11-27
>
thomas08:11:30

moin moin :rain_cloud: morning :umbrella_with_rain_drops:

guy10:11:06

Morning all, Happy monday 😄

yogidevbear10:11:34

That's better, first dose of caffeine down the hatch

maleghast11:11:15

Morning everyone 🙂

yogidevbear11:11:59

Speaking of Christmas, we decorated our tree over the weekend. Feels a little early, but it's really pretty 🎄

matttylr11:11:59

Hi @yogidevbear, I saw the other day that you posted about a functional programmers group in Horsham. I'm in Horsham and would be happy to help. Are you planning a meeting or get together soon?

yogidevbear11:11:12

Hi Matt 🙂 I was actually thinking of reaching out to you anyway. Jon mentioned that you were in Horsham before. I definitely want to get something arranged. Even if it's just an afternoon coffee somewhere like Stookes with anyone on the group that is interested or a meetup at a pub like The Black Jug.

yogidevbear11:11:56

I think it would be awesome to get an experienced Clojure dev to share some of their insights with the group

matttylr11:11:06

Hmm, what has Jon told you?

matttylr11:11:01

Sounds really good, shall we meet up sometime this week and put some thoughts together? I have an idea for a venue as well but would need to check with them first.

jasonbell11:11:39

@yogidevbear <<Speaking of Christmas, we decorated our tree over the weekend.>> ………… hmmmmmm 😕

yogidevbear11:11:15

What? A little too early? troll

jasonbell12:11:52

The general law is you can play Christmas Wrapping by The Waitresses on any of the 365 days of the year, other than that the rest is totally off limits. 🙂

thomas12:11:48

my mum would only put up the Christmas tree on Christmas Eve..... and not earlier!

dominicm12:11:35

We wait until the 14th

yogidevbear12:11:28

Traditionally I think it's meant to be something like 10 days for and 10 days after, can't really remember

yogidevbear12:11:15

Secretly wants to open the PS4Pro present that Santa dropped off a month early and start playing

thomas12:11:06

@yogidevbear hmmm.... that is NOT a secret... that is actually a well known fact 😉

yogidevbear12:11:05

Last time I owned a "decent" gaming console was a PS1 in 19.... (voice trails off to hide my age)

yogidevbear12:11:58

That must have been around the mid 90s?

thomas12:11:07

I never really owned a gaming console.... my son will get an X-box though.

yogidevbear12:11:51

Yeeees... You "son" 😉

yogidevbear12:11:15

Prior to that PS1 it was a SEGA genisis (/ mega drive)

dominicm12:11:41

@yogidevbear I'm doing the same with my psvr.

yogidevbear12:11:36

What it is to be a child again 👦

thomas13:11:11

@yogidevbear of course.... 😉

yogidevbear13:11:44

@thomas is "he" getting the Xbox One X?

thomas13:11:00

One S I think

yogidevbear13:11:10

Tough decision

yogidevbear13:11:02

Every time I see the One X ad come on the TV I become very... what's a word for jealous, but not jealous

yogidevbear13:11:31

Can't explain why, but the Xbox series appeals to me more

yogidevbear13:11:45

Guess there's always next Christmas

yogidevbear13:11:08

(And slowly but surely my wife loses her husband and son into the land of gaming)

thomas13:11:09

st. nicholas is earlier.... 5 Dec.

yogidevbear13:11:24

:thinking_face:

thomas13:11:57

here in Dutchland we tend to celebrate st. nicholas more than Christmas...

seancorfield16:11:22

We only just finished Thanksgiving so I won't want to see another turkey until Easter!

seancorfield16:11:08

Our crowd of friends here is mostly pagan so Yule/Winter Solstice is our next celebration, rather than Christmas proper.

maleghast19:11:28

Hello everyone… Has anyone in here added custom markers to LeafletJS maps under ClojureScript..?

dominicm19:11:07

@U08ABGP70 What have you managed? What have you tried?

maleghast19:11:56

I have switched over to markers and the code I have throw no errors, but equally, none of the markers on the map are anything but the default ones…

maleghast19:11:05

Hang on I will gist some code…

maleghast19:11:55

So, the data / node that the case is using exists, and even if it didn’t I would expect to get all green, custom markers. But I get standard markers. It’s as if the attempt to add custom stuffs is simply being ignored.

maleghast19:11:07

This is from the LeafletJS docs:

var greenIcon = L.icon({
    iconUrl: 'leaf-green.png',
    shadowUrl: 'leaf-shadow.png',

    iconSize:     [38, 95], // size of the icon
    shadowSize:   [50, 64], // size of the shadow
    iconAnchor:   [22, 94], // point of the icon which will correspond to marker's location
    shadowAnchor: [4, 62],  // the same for the shadow
    popupAnchor:  [-3, -76] // point from which the popup should open relative to the iconAnchor
});

maleghast19:11:55

There are JS instructions to reduce code repetition after that in the LeafletJS docs, but when I started there I got all kinds of errors about “X is not a function” so I pared it back to the simplest possible implementation, and that’s where I am now… I have got LeafletJS default markers, and no errors, but the custom markers stuff seems to simply be being ignored.

maleghast20:11:02

I have spent a couple of hours trying to get it to work, by trying to transpose the JavaScript instructions into ClojureScript, basically to no avail… I am pretty sure that I am simply not aware of how to properly “speak” ClojureScript for this kind of thing, where in Javascript you “var greenmarker = L.icon …” but that does not translate non-opaquely into CLJS (for me at this point, I am sure that it will as / when I get better at this)

dominicm20:11:52

Generally speaking, when you interop you need to create a javascript map by using #js https://gist.github.com/maleghast/386abf921d54840f06682e27d81223e5#file-markers-cljs-L10

dominicm20:11:07

I'm also not sure what you're trying to achieve with:

(-> (some-js-object)
     {:cljs :map }
But it looks wrong

dominicm20:11:27

I imagine you have misplaced a parenthesis

maleghast21:11:03

OK, I am not sure what you mean about any of this… I will go and look at the bit of the Gist you highlighted first…

maleghast21:11:19

Ah, ok… I’ve tried wrapping the result of the (case …) in a call to (clj->js …) but that gets me an error about the iconUrl not being set in the options. Also the “(->” part you are referring to came from assistance from mccraigmccraig - it works, it places the markers on the map as expected, they just aren’t the custom markers that I wanted. That bit was previously placing circles on the map.

dominicm21:11:55

I'm certain that's wrong

dominicm21:11:58

cljs.user=> (macroexpand-1 '(-> (array 1 2) {:a :b}))
({:a :b} (array 1 2))

dominicm21:11:04

I don't think that's what you're trying to do

dominicm21:11:18

(Replace (array 1 2) with any bit of code)

dominicm21:11:58

Looking at the LeafletJS docs, I think it should be:

(-> (L.Marker (array 1 2) #js {:marker opts})
    (.addTo mapinst)
    (.bindPopup (:name marker)))

maleghast21:11:42

Ooh, cool - thanks, I will try that

dominicm21:11:13

Let me know how you get on

maleghast21:11:37

I’ve updated the Gist to what you suggested, and my code. The up-side is still no errors. The down-side is that it doesn’t do the custom markers 😞

maleghast21:11:43

but changing the :marker for :icon

maleghast21:11:13

AMAZING! Thanks so much - it was just a case of me not speaking ClojureScript properly

maleghast21:11:21

*does a little dance*

maleghast21:11:44

What I have discovered, however, is that my custom markers are SHITE

maleghast21:11:59

(that’ll teach me to try and make graphics myself…)

maleghast21:11:22

But I’ve fixed that too!

maleghast21:11:35

(Just got them the right size and killed the shadows)

dominicm21:11:39

Btw, if you know all the keys in your map, prefer #js

dominicm21:11:54

Clj->js is slow

maleghast22:11:04

That’s really useful to know 🙂

maleghast22:11:55

I can just put JSON Arrays that I’ve turned into Vectors straight into JS calls, though yeah? Or should I #js them as well?

maleghast22:11:08

(I am now drawing borders)

dominicm22:11:18

I'd think you need to do #js []

maleghast22:11:35

OK, that’s good to know as well - thanks 🙂

maleghast22:11:44

The GeoJSON for Ghana’s border is HUGE

maleghast22:11:05

(So I am reading it in from a file, rather than having it in my code 😉 )

maleghast19:11:43

I am having some trouble getting the damn thing to do what I want… 😞

dominicm20:11:03

Cool idea: Some kind of in-browser cljs playground which can load in cljsjs packages.

maleghast21:11:30

@dominicm - That is__ a cool idea.

maleghast21:11:45

I have no idea how to even start to make that possible, but I like it as a plan