This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-23
Channels
- # admin-announcements (11)
- # announcements (1)
- # beginners (80)
- # boot (152)
- # cider (22)
- # clojure (141)
- # clojure-berlin (57)
- # clojure-india (2)
- # clojure-italy (18)
- # clojure-japan (4)
- # clojure-russia (27)
- # clojurescript (96)
- # datomic (6)
- # dunaj (29)
- # editors (1)
- # euroclojure (63)
- # instaparse (2)
- # ldnclj (28)
- # off-topic (36)
- # onyx (4)
- # overtone (1)
- # reagent (8)
@edbond @sveri @rauh @andrewmcveigh - many thanks for generously helping me sort through CSRF - I understand the mechanism much better now!
I'm now working on implementation. Here's a gist with the method "put the token in the page template, then grab and POST on client side." https://gist.github.com/anonymous/99f176f41aff7b9977b7
And here's my attempted implementation of the method "GET and then POST the CSRF token": https://gist.github.com/anonymous/27302db67a819eb36292
Any comments/suggestions greatly appreciated
I'm getting a compile error when trying to compile the following code:
(defn number->hex-padded [n]
(if (<= n 0xFFF)
(.substr (str "0000" (.toString n 16)) -4)
(.toString n 16)))
Caused by: clojure.lang.ExceptionInfo: Unknown dot form of (. nil toString nil) with classification
[:cljs.analyzer/error :cljs.analyzer/symbol ()] at line 522 src\cljs\instaparse\gll.cljs {:file "src
\\cljs\\instaparse\\gll.cljs", :line 522, :column 3, :tag :cljs/analysis-error}
In the REPL that code works just fine.
Nvm, false alarm.
@rui.yang: No. Om will continue to exist and I think David said he wants to provide a migration path from one to the other.
@arohner: make sure your table content is inside [:tbody] in your [:table]
@arohner: I have an example of a hiccup table with tbody (and thead) over at http://hiccup.space
@coyotespike: check out this: https://github.com/pillarjs/understanding-csrf It explains it pretty well
Is there a reason why
do
isn't included on http://cljs.info/cheatsheet/?it's something i use pretty often in practice, more than a lot of stuff in the existing cheat sheet
bocaj: sounds like more trouble than it's worth since you have to parse/eval the entire standard library to do anything
I'm having a hard time remembering swap! versus reset! Is that just a familiarity thing or are those terms commonly used elsewhere? (I guess that's more of a newbie question.)
Familiarity, I suspect. I just look at the verb in this case: one for another vs. start from scratch.
@rauh: thanks, that's a very clear explanation!
If one were creating a very thin wrapper over some functions in a js library, like Google Closure, what are the tradeoffs between these two forms?
(defn get-document []
(dom/getDocument))
(def get-document-b dom/getDocument)
you probably wanted the first one to be:
function getDocument() {
return getDocumuent;
}
This is more confusing since you're using camelcased names in your JS transliteration, which causes a naming collision.
@roberto: unless I've lost my mind, the code I posted works - its powering an app running in my browser right now
I was just wondering about the difference between wrapping a js function inside a cljs function vs aliasing the same function when you don't need to modify any of the input arguments or output values.
also, the 2nd form could be ‘more performant’, because you are doing one less function call.
I prefer the 2nd as well. I’d go with the first only if I had to do some pre-processing first.
Then the question is how far one can take this when the js function has multiple optional arguments and so forth
is there a way to get auto completion in the "lein figwheel" repl?
gcc advanced compilation would probably inline that, negating the performance argument
@meow: I encountered it in Haskell. Just wandering what people call it in the Clojure community. Perhaps the same…
Most of these functions benefit from argument mangling so they need to be wrapped. I'm just trying to keep things to a bare minimum. I'm trying to wrap the parts of Google Closure that I'm using in my app and that I've seen others use. But I want to keep this simple and only wrap the most common and most basic stuff.
@meow: the second form loses out on ClojureScript fn validation if your intention is to provide an idiomatic interface.
just use the Closure thing directly. Wrapping stuff is not idiomatic in Clojure(Script) unless you are adding significant value.
If this were python I could load up that namespace and then change all the names on the fly, but it isn't...
the only time I ever feel any need to wrap Closure is when dealing with core.async since you have to lift callbacks into channel ops
@dnolen: I hear what you are saying. Some of my examples have come from your code as well. Some isn't Closure but just simple things like (defn now [] (js/Date.))
right little helpers, I tend to write these as I go. Even then I would prefer the first over the second and I would probably write out the signature so I get some compile time validation.
multi-arity fns don't inline as well, but it's kinda of a moot point given the inlining done at the VM level.
Yeah, most of what I have are little helpers like
(defn get-viewport-width []
(.-width (dom/getViewportSize)))
I was toying with supporting synonyms since there aren't always canonical names for some stuff because people have been exposed to various frameworks, so I have some code like
(def by-id get-element)
(def find-by-id get-element)
(def get-element-by-id get-element)
I assume that's okay, though debatable as to whether or not there should be support for synonyms like this or just a single name.In Om, are there any requirements that app-state be e.g. serializable? Can I stick a fn in appstate?
whenever i do something like (def my-alias-to some-other-function)
i make sure to add the arglists
meta data too it as part of my practice.
(def ^{:arglists '([n])} double (comp inc inc))
for people using emacs or something which can display that information it's very helpful.
@noprompt: I made a list of projects that I want to look into for use on my cljs apps and 4 out of 6 of them were yours: ankha, clairvoyant, phalanges, and shodan (and I already use garden, of course)
any recommendations for a real-time graph on a web application? i'm thinking clojure -> clojurescript (via aleph) -> javascript (d3.js)
@bmay for real time graphing, you can check out http://riemann.io/dashboard.html