Fork me on GitHub
#beginners
<
2018-03-03
>
nakiya00:03:34

Is there a re-frame + compojure-api sample app I can look at? I’m having a hard time getting these two to work together.

derpocious02:03:14

can anyone recommend a good way to upgrade dependencies in a lein project?

derpocious02:03:28

for example, if I scaffolded a project for clojurescript clojurescript "1.8.51" but want to use clojurescript 1.9.6+

Ryan Radomski02:03:00

I can vouch for lein ancient

sova-soars-the-sora07:03:25

hi what's a transducer and why would i ever use one? 😄

xlevus08:03:15

Is there a guide/standard for documenting libraries? Python has styleguide for docstrings. And sphinx for generating API documentation. But I'm at a loss on how to write clojure documentation. (probably because I haven't read enough of it)

eskos08:03:09

@xlevus codox is used quite often to generate api docs; looking through its featured example projects should give you relatively good set of pointers on style. For the most part, documentation is written markdown(ish) syntax https://github.com/weavejester/codox

xlevus08:03:36

Is there a way to document data structures? Eg. The required/optional keys?

xlevus08:03:52

or, just chuck it in the docstring?

gklijs08:03:14

Another option would be to create a spec for it.

eskos08:03:40

Or use plumatic schema, depending a bit on which angle you want to approach the problem from. If you're new, spec I suppose is the primary thing to learn.

eskos08:03:05

Although it is also worth mentioning that you shouldn't focus on documenting data structures in text, but rather have a way to generate the documentation from actual code. Eg. if you're working in Web context, you could use spec as base for generating Swagger/OpenAPI docs using https://github.com/metosin/spec-tools#swagger2-integration

magra09:03:56

Hi, I have a working luminus app on the default immutant setup. I build a fulcro app that does xhr calls to an /api route. It works except that the json delivered from the server to the client is ISO-8859 instead of uft8. Can anybody point me in a direction which level of the stack to debug?

magra09:03:12

@sova A transducer is a function that allows you to compose/chain it with other transducers to process data without producing intermediary datastructures. They can be used to improve performance or handle a stream/channel.

agigao14:03:25

Hello Clojurians, I’m playing with Clojurescript and when I use (:body response) it returns a plain string, thus I’m unable to parse it further using keywords.

sundarj17:03:09

if your response is JSON you can use https://github.com/clojure/data.json to parse it

sundarj17:03:25

or if it's in the browser, use (.parse js/JSON (:body response))

agigao06:03:57

Thank you! But the latter one creates Javascript object which is not accessible using keyword, or am I doing something wrong? for example (:name body)

sundarj20:03:37

yeah for JavaScript objects you have to use (.-name obj) or (goog.object/get obj "name")

sundarj20:03:54

keywords are only for Clojure hash-maps

derpocious17:03:09

hi. can someone help me convert this javascript statement to clojurescript?

derpocious17:03:24

const Twitter = new twit({
    consumer_key:         'dsfsdfdsf7',
    consumer_secret:      'sdfsdfsdfsdf',
    access_token:         'sdf-sdfsdfasdfsdf',
    access_token_secret:  'werwerwere',
});

derpocious17:03:40

i have twit already required in the cljs file

Ryan Radomski17:03:40

whoops I edited a typo, should be good to go now

mathpunk22:03:58

I'm building a very simple REST api. I've required ring, put in a :ring {:handler my-app.server/handler} line in my project, and got a hello world out of it. So far so good. Now I need to handle a few routes. I introduced compojure but, I'm looking at the docs and not understanding how to connect a route definition with the handler that the server uses. What do I need to change in my code?

mathpunk22:03:03

I started thinking, oh compojure must provide a function that makes a handler that the ring plugin can call. However, when I look at http://weavejester.github.io/compojure/compojure.handler.html it says that the ns is deprecated and links me to.... a page I'm not experienced enough to understand

sundarj22:03:27

so i think you should be able to do {:handler certainty-derivative.server/app}?

mathpunk22:03:59

It looks like that does it --- I knew it had to be a case of something so easy that I was looking right past it. Thanks @U61HA86AG!

sundarj22:03:09

no worries!