This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-03
Channels
- # admin-announcements (7)
- # beginners (30)
- # boot (181)
- # cbus (1)
- # cider (55)
- # cljs-dev (8)
- # clojure (104)
- # clojure-dev (3)
- # clojure-japan (1)
- # clojure-russia (70)
- # clojurescript (139)
- # core-logic (4)
- # cursive (23)
- # datomic (25)
- # devcards (10)
- # events (11)
- # funcool (1)
- # hoplon (39)
- # jobs (10)
- # ldnclj (19)
- # lein-figwheel (21)
- # off-topic (4)
- # om (174)
- # onyx (46)
- # re-frame (25)
- # reagent (3)
- # yada (7)
@bhauman: I tried 0.5.0-SNAPSHOT
and I noticed that the sidecar
bootstrapping for connect through cider is broken, just wanted to report it but probably you know already
cider hasn't been part of figwheel for a while now. Are you saying the nrepl-middleware key isn't working?
oh yes I know, but before the following was working for me on top of nrepl:
(require 'figwheel-sidecar.repl-api)
(figwheel-sidecar.repl-api/cljs-repl)
No problem though, I know that is kind of a hack š@bhauman: I will have a look at the changes as well, good job btw
in the docs, https://clojuredocs.org/clojure.test/deftest, there is a line "If you compose tests, you should also define a function named test-ns-hook; run-tests will call test-ns-hook instead of testing all vars."
We are doing some front end testing with webdriver - what I want to do is to hook in additional functionality to any ^:web deftest forms so that when a test has failed or an exception has occurred, it will take a screenshot of the browser.
Iām wondering how it will be possible to hook this in without changing any of the current test code
hoping to get some help from the author (@stuartsierra) but any advice would be appreciate.
My attempt to automate particular refactor tasks http://ul.mantike.pro/automating-clojure-refactor-with-rewrite-clj/ Any critics/suggestions are very appreciated!
using http-kit and compojure.route/resources
to serve a media file but the Content-Length is always 0. anyone see this problem before?
$ curl -I
HTTP/1.1 200 OK
Content-Length: 0
Last-Modified: Tue, 03 Nov 2015 06:19:46 GMT
Content-Type: video/mp4
Server: http-kit
Date: Tue, 03 Nov 2015 06:55:52 GMT
I want to update-in a value into a collection but if the collection is nil, I want it to be a set, not a list. Is this the best way: (update-in {} [:foo :bar] #(into (or %1 #{}) #{%2}) :value)
You could just do (update-in {} [:foo :bar] #(conj (or %1 #{}) %2) :value) -- I don't know if it's best, but I'm not sure you really need to use into, conj would be more clear if you're adding a single item to a collection.
taylor.sando: ah, yes.
I am making Web/Mobile app and I liked the idea of GraphQL/Falcore so much I decided to start writing my own system like this.
My idea is to have a DSL where you program route-like thingies in a tree structure, and it either compiles Compojure routes or to an object you can query with an EDN, so I can just wrap it with sente instead of doing bijillions of AJAX calls: https://github.com/ptaoussanis/sente
I was discussing my idea with a friend and he declared "Somebody must have already made this" so I am asking around here before I go hog-wild with this thing
It is still very initial development, but you can read the documentation and everything related in recently merged PR in catacumba: https://github.com/funcool/catacumba/pull/33
Is something less "frameworky" than relay and friends and it leaves to the user the responsability of build the needed abstraction for communicate with the server, such as sending datomic like pull queries (as om-next does) or just build more traditional rpc communication
postal (client + server) solves the communication/transport part of relay like architecture, allowing you send messages with better semantics than http and allow use your own messages. It is very similar to something om-next-tutorial does for communicate with backend; using very simple messages such as query
and novelty
(analogous to read
and mutation
from om-next...), it not implies any coupling with a concrete framework, so if you don't want use om-next aproach you can build your own.
Later, we are working in a "query" abstraction for aggregate and join different queries for efficient fetching from the backend (https://github.com/funcool/muse) that will work together with postal out of the box.
The main objective is not build a big magical framework like graphql/relay, instead build little (easy replaceable) libraries for solve that kind of problems š
@zcaudate: clojure.test doesn't do anything special with metadata on test definitions. If you want to do any custom coding around how your tests are run, the easiest thing to do will be to create your own test runner, maybe using clojure.test/test-vars
. The test-ns-hook stuff is rarely used and not well-defined.
clojure.test's test runner is a bit basic. It would be great to have a more configurable alternative that still uses clojure.test's api
@xcthulhu: Without knowing the specifics of what you want to implement, Om.next seems to be pretty close. It solves some of the same problems that relay, falcor, and graphql solve.
@xcthulhu: Also, there's a lot of activity in the #C03S1L9DN channel here, and some of us may be able to help you even further in there.
Looking at @bozhidar's clojure style guide. The line " Vertically align function (macro) arguments spanning multiple lines", sometimes it makes sense to not do this and stick to an indent of two spaces. I.e. code could made a lot terser if commonly used macros/fns were whitelisted - is there any 'official' standard verbage on this?
What are your thoughts, i.e. I'm seeing some clojurescript using dom/div a lot, which results in very long cljs lines. Using two spaces would be aesthetically more pleasing
@pesterhazy: clojure.test tests are just functions, it's pretty easy to write your own runner.
@stuartsierra: agree. I appreciate that clojure.test is so simple that you can write your own runner in a day
thanks
I'll be the first to admit it has some sub-optimal design decisions that were locked in too early (e.g. tying execution to reporting).
Is there anyone who could answer questions on New Clojurians: Ask Anything? https://www.reddit.com/r/Clojure/comments/3rcjus/new_clojurians_ask_anything/
Who is maintaining the http://clojurians.net page? They need to add a link to the login page. I had to ask a question on reddit https://www.reddit.com/r/Clojure/comments/3rcjus/new_clojurians_ask_anything/ to find where the login page was as I had deleted the email.
launchpad: No. Not unless the specifics of your data depend on the order that the results of the processing. In that case, IMO, core.async may not be a great fit. Or if your problem really can't be solved asynchronously.
Thanks for the quick response. Iāve done an implementation of my logic in core.async, reducers, and regular reducing. Trying to understand the best approach to the problem.
pupeno: regarding making something default to a set - (fnil conj #{})
is conj, except if the first arg is nil it is replaced by an empty set
eg. ((fnil conj #{}) #{1 2} 3)
=> #{3 1 2}
((fnil conj #{}) nil 3)
=> #{3}
noisesmith: cool
pupeno: I frequently find use for (fnil + 0)
or (fnil inc 0)
I found a resource for browser-testing in clojure using https://github.com/semperos/clj-webdriver. Does anyone have any resources/tutorials/libraries for capturing the browser's console.log(x) and console.error(x) logs in clojure? Specifically using Selenium would be great. Basically I've been tasked for writing some tests that just query a bunch of urls and make sure that the console doesn't have any errors in it (an angular application that I don't have access to the production code of) Thanks!
@loganmac We do something like
(doseq [entry (.. t/*driver* webdriver manage logs (get "browser"))]
(log/info entry))
also, @snoe is there a way to use that to filter out only errors, and not just all logs?
@loganmac: I wrote a fairly hacky library for hooking up clj-webdriver
to things like SauceLabs http://conan.is/webdriver/selenium/testing/clojure/2014/12/09/the-green-cross-code.html
iāve found, it doesnāt matter how much Lisp you rub on it, maintainable selenium test suites are near impossible to have
I'm open to alternatives to selenium. What I really want to do is spin up a headless browser (phantomjs), then just look for console.errors in it
I don't even need it to click or interact with elements. Just wait for the page to render, then look for errors
@stuartsierra: ahh okayā¦ thanks for the clarification. I may have to go with another option.
hey @zcaudate! iām a big fan of cronj - thanks for that
i will admit i still struggle with the time spec syntax, though
love that you can simulate it
itās all good
Iām in the process of merging cronj into haraā¦ so there is no dependency on clj-time and it uses the java time api instead
ah, thatās good to know
ah, section 3.4 is what i need
the rules
is there anything like a ātoggleā conj
/ disj
kind of function for sets? if something exists it conj
s it on, otherwise disj
s it...
easy enough to write but just curious if Iām missing something
@ddellacosta: think you have that backwards
if something exists in a set, conj
won't do anything
oh yeah bostonaholic, sorry had that reversed
so Iām guessing nothing like that exists though huh
Is there a better way to do email polling then what I have going here: https://gist.github.com/taylorSando/979ab571923286b96662 -- I noticed that I had a Maximum number of connections from user+IP exceeded error. I hadn't seen that error before, but it occurred in a program that had been running for about a week.
I have a library organized as src/clj
, src/cljs
, src/cljc
and I have :source-paths ["src/clj" "src/cljc" "src/cljsā]
but when I run lein jar
I get jar only with src/cljc
files. what am I missing?
@razum2um: are you using lein-cljsbuild
?
@bostonaholic: yep, but nevermind, i just misslooked some files that being collected under projname
directory
I read somewhere that using dev/user.clj
was a bad idea - something about the name user.clj
? Anyone else seen this, or have I been dreaming?
@magnars: Clojure always loads user.clj
on startup. If your user.clj
tries to load a file with a syntax error, the REPL won't start.
I typically use dev.clj
instead.
Curiosity question: So when doing a lein new compojure
it creates a dev-resources
directory, that I swear I've never seen before... I can't find reference to it anywhere - does anyone know what it's for?
@markmandel It is for resource files you don't want in production. Think files that can be loaded in tests, or at repl. I suspect a recent lein change may be creating the directory when it used to just use it when it existed. https://github.com/technomancy/leiningen/issues/2010
Aaah, that makes sense. Thanks!