This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-24
Channels
- # announcements (12)
- # aws (11)
- # babashka (1)
- # beginners (73)
- # cider (4)
- # clj-kondo (2)
- # cljsrn (4)
- # clojars (2)
- # clojure (68)
- # clojure-europe (8)
- # clojure-nl (5)
- # clojure-spec (6)
- # clojure-sweden (1)
- # clojure-uk (29)
- # clojurescript (41)
- # conjure (22)
- # datomic (33)
- # docker (58)
- # duct (3)
- # emacs (8)
- # events (1)
- # expound (3)
- # figwheel-main (5)
- # fulcro (33)
- # graphql (2)
- # kaocha (2)
- # lambdaisland (39)
- # leiningen (1)
- # nrepl (49)
- # nyc (1)
- # off-topic (77)
- # pathom (1)
- # re-frame (33)
- # reagent (28)
- # reitit (1)
- # rewrite-clj (2)
- # shadow-cljs (195)
- # spacemacs (1)
- # sql (60)
- # tools-deps (13)
- # vim (18)
- # xtdb (46)
Which is the Rich talk where he shows the complexity and insanity of the HTTPRequest objects?
Text transcripts of many of his talks, which are more easily search/grep'able, are here: https://github.com/matthiasn/talk-transcripts
I am using a macro from a library which expects a value instead of a var so (third-party-macro [1 2 3])
works but the below fails -
(def data [1 2 3])
(third-party-macro data)
Is there a way I can pass the var in the macro ?macros work at the syntactic level, so the macro will only receive the symbol data
(not even the var). hopefully, the macro is just syntactic sugar and provides programmatic access to whatever functionality you're looking for
my editor has a keybinding to view source. so if that's easy, I would just peek at the source of the third-party-macro to figure out the non-sugared API. otherwise, hopefully the docs can help
yup there is no way to pass a resolved var, it will just take the symbol, thanks let me dig into the code.
Any libraries to extract dates from a text? The only one I found in clojure is deprecated (https://github.com/facebookarchive/duckling_old). I've also looked into java ones, but the one I found isn't maintained and crashes on some texts (https://github.com/joestelmach/natty). I'm also considered just using regexes, but there's a lot of date formats out there, and I'm afraid of missing some.
not sure if if this is the best place to ask but, lets say I have a jwt token, and id like to check its contents WITHOUT verifying its signature (it was handled from a trusted source)
how can I achieve that? took a look at buddy-sign
but all functions to decode take a secret as well
Just to add a little note, you might still want to verify the "exp" field on the result. Expired JWT tokens should be ignored.
Note that you should unbase64url the payload (and not just unbase64)
For example eyJ4eXoiOiAiTm9yc2sgaW5zdGl0dXR0IGZvciBiaW_DuGtvbm9taSDigJMgTklCSU8ifQ
is a valid base64-url string (and JWT), but not base64.
Each part contains a base64url-encoded value.
https://tools.ietf.org/html/rfc7519#section-3
We've been bitten by this on client side in ClojureScript. Tricky to reproduce as it only happened for a handful of users. 😉
https://github.com/funcool/buddy-sign/commit/877c1d6d3fb4028b28eeb467f4b6ffceed949f91
ill look more into the code to see how easy it is to do then create an issue, but thanks for the help 🙂
but thinking back, i thought signature checking was an explicit step. and you could just read the token either way
I wasnt able to find a function that would just returned the data without caring about secrets keys or whatever
that's why i had to do the patch. i wanted a jwt in the tests but it would always be expired
and the important part from unsign
is just verifying (and throwing) on header information and then (b64/decode payload)
its on the pipeline, im rewriting a python service in clojure, the current system does not verify the token, and folks dont know what is the secret when it gets sorted ill switch to the buddy-sign implementation
what's the best approach for adding metadata to a def
from a macro? something like:
(defmacro def-my-fn [name params & impls]
(let [name-with-meta (vary-meta name
assoc :arglists (list 'quote (list params)))]
`(def ~name-with-meta
(make-my-fn ~params ~@impls))))
I'm writing a pull request for a library I'm using.
i'm not sure I agree with you generally, and it's impractical to write a pull request for a library that removes the def forms they created
I guess I would start by looking at what the underlying def form you are expanding to (defn or def) supports as arguments
I think def is fairly simple, you might just want to support an optional docstring. But if you are adding arglists you may want to expand into a defn instead, if you did the arglists stuff would be handled for you, however defn supports a lot of optional arguments
for context, this is the pull request i ended up with, https://github.com/redplanetlabs/specter/pull/290.
the closest thing I can think of is a function calling is
, reused in various contexts
I can't think of anything with the same functionality that wouldn't be excessively clever / brittle
for example one could replace the function with one that validates the result using is
, via alter-var-root
but that seems very hackish
I'm monkey patching a bug in my dev environment, what's the best way to evaluate code in the context of another ns? I tried (in-ns 'xxx) (code)
but that didn't work :)
a namespace isn't really something you evaluate code in the context of, it only effects compilation (which is the first half of evaluation)
so for example in (let [] (in-ns 'xxx) (code))
the namespace change doesn't happen until the whole let is run, by which point code has been compiled using whatever the current value of *ns*
without the change of namespace
here's an example for future reference https://github.com/clojure/clojure-contrib/blob/b8d2743d3a89e13fc9deb2844ca2167b34aaa9b6/src/main/clojure/clojure/contrib/with_ns.clj#L20
(defmacro with-ns
"Evaluates body in another namespace. ns is either a namespace
object or a symbol. This makes it possible to define functions in
namespaces other than the current one."
[ns & body]
`(binding [*ns* (the-ns ~ns)]
~@(map (fn [form] `(eval '~form)) body)))
Would you say that clojure development workflows have a higher maintance and ceiling then other communities? e.g keeping a repl workflow where ever you go is both very powerful but also costly.
just to give an example for comparison, it's been a much bigger pain to maintain a running dev environment for the iOS and android apps that I work on