This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-02
Channels
- # aws-lambda (1)
- # beginners (46)
- # boot (190)
- # cider (12)
- # clara (6)
- # cljs-dev (9)
- # cljsjs (8)
- # clojure (152)
- # clojure-austin (3)
- # clojure-berlin (3)
- # clojure-finland (2)
- # clojure-france (5)
- # clojure-italy (3)
- # clojure-russia (92)
- # clojure-serbia (4)
- # clojure-spec (7)
- # clojure-uk (190)
- # clojurescript (115)
- # cursive (20)
- # datomic (20)
- # dirac (4)
- # emacs (9)
- # gsoc (5)
- # hoplon (1)
- # jobs (1)
- # klipse (4)
- # lein-figwheel (1)
- # leiningen (6)
- # lumo (2)
- # mount (18)
- # off-topic (57)
- # om (68)
- # om-next (14)
- # onyx (33)
- # perun (32)
- # portland-or (4)
- # re-frame (21)
- # reagent (85)
- # ring (6)
- # ring-swagger (23)
- # schema (1)
- # uncomplicate (1)
- # untangled (13)
- # vim (7)
I need to check if a valid date is given to me in a GET request. I know I can use the Validateur library, but is this something that Spec might handle now?
Not directly, but you can write a conforming spec that would attempt to parse the date (it comes in as a string) and produce either an #inst
(`java.util.Date`) or :clojure.spec/invalid
.
So you’ll still need to write some date parsing code (based on either clj-time
or date-clj
probably).
yeah at the moment, i do a lil regex to make sure it comes in the right format, but I should check to make sure its a real date. i haven't explored spec yet and wasn't sure if it would be somethjing I should use here.
I wasn't having much luck with protorepl and cljs/figwheel. But I enjoyed using it in conjuction with the proton plugin for Atom. Made atom feel like spacemacs.
Someone who have worked with ez-web. as a example they said I could do this
(= (paginate (range 101) 10 5)
I always find that looking at tests is very constructive https://github.com/emil0r/ez-web/blob/8c1d9762824bcdac9b1e3afaf02fdd290c13b595/test/ez_web/test/paginator.clj
especially the one that starts a line 15/16 seems clear enough to me at least
@eslachance so
(paginate (range 15) 1 7)
gives [6 5 4 3 2 1]
the example from the readme
(= (paginate (range 101) 10 5)
gives this as I understand it well {:prev-seq (4 3 2 1), :next-seq (6 7 8 9 10 11), :pages 11, :page 5, :next 6, :prev 4}
with this code :
` "But watch out if you try to pop nothing"
(= "No dice!" (try)
(pop '())
(catch IllegalStateException e
"No dice!"))
the last ) is supposed to as last but on some way atom parinfer places it right after the try part
i don't believe any packages will move things for you but rather let you move them in structural ways
Then you do not believe it, I saw it myself, I transfer the ) to the last position and saw that the ) was placed back after the try part
I have this html part :
<ul class="pagination">
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
</ul>
when the current page is between 6 and 466 then I want to display 4 numbers before it , the number itself and 4 numbers behind it
How can I make it work that I use the html part once instead of 3 copies in a big if then part ?
or can I do something like this in selmer :
(defn boundries
[pagenumber]
(if (pagenumber < 6)
range(1 - 10)
else (if pagenumber >= 6 and pagenumber <= 466)
range((- pagenumber 4) (+ pagenumber 4))
else
range(460 470))))
<ul class="pagination">
(for [x [(boundries)]
<li><a href="localhost/page?="+str(x) > x </a></li> [)
</ul>
@roelof @dpsutton Sounds like you have parinfer turned on, roelof. It will insert parentheses in the "right" places based on indentation https://shaunlebron.github.io/parinfer/