This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-10
Channels
- # aleph (1)
- # aws-lambda (1)
- # beginners (80)
- # boot (20)
- # cider (75)
- # cljs-dev (45)
- # cljsjs (1)
- # cljsrn (11)
- # clojure (428)
- # clojure-dusseldorf (13)
- # clojure-italy (4)
- # clojure-russia (153)
- # clojure-spec (47)
- # clojure-taiwan (1)
- # clojure-uk (62)
- # clojurescript (84)
- # cursive (19)
- # datascript (96)
- # datomic (75)
- # dirac (9)
- # docs (3)
- # emacs (19)
- # jobs (5)
- # jobs-discuss (20)
- # jobs-rus (17)
- # lein-figwheel (5)
- # leiningen (1)
- # liberator (4)
- # luminus (12)
- # off-topic (4)
- # om (31)
- # onyx (102)
- # pamela (1)
- # parinfer (3)
- # pedestal (3)
- # proton (1)
- # protorepl (14)
- # re-frame (54)
- # reagent (22)
- # rum (40)
- # spacemacs (2)
- # specter (8)
- # test-check (5)
- # unrepl (110)
- # untangled (80)
- # vim (3)
- # yada (46)
I want to take user input and make sure it doesn't contain anything malicious like javascript, SQL or other problematic strings
@tmayse goog.string/htmlEscape
, maybe?
@tmayse commonly that's done via using transport protocols that aren't weak to such attacks. For SQL that's parameterized queries, for JSON that's using something that escapes properly, ditto for HTML. There isn't really a one-size-fits-all way of sanitizing strings
every time I have a choice between function vs macro -- and I pick macro -- I've come to regret my decision
I have 200 simple elements updating according to a dispatch every second (as a proof of concept), and on each second it lags. Can re-frame handle this sort of updating, and I just did something inefficiently?
@josh.freckleton: Can you share example code? I'd be curious to see it, though I don't know that I can help.
@josh.freckleton in these cases it's best to look at what's actually changing, In some pathological cases React will try to destroy all 200 elements and recreate them. A few log statements in your render functions should tell you what's going on.
@josh.freckleton I had 2000 elements updated every 150 ms and that went fine on most devices, even on a few years old cheap chromebook
Hey, you guys know a good way to convert time into a date? Not sure if I should even be doing so or better yet how to comapare time to see one is greater than another
cljs-time is good, but moment.js is in my opinion really powerful too (can be used from cljsjs/moment
)
what’s the purpose of IndexedSeq
type in ClojureScript? Array-like structure and faster conversion between types?
@dnolen wonder why IndexedSeq
doesn’t implement -assoc
since it is an indexed collection type?
@dnolen does it mean that IndexedSeq
is like the most low-level collection type in ClojureScript on top of which everything is built?
it exists so that you can coerce some JS thing into a value you can use the standard lib on
oh, I get it now, thanks
can you explain this?
((fn [& args] (type args)) 1 2 3) ;; cljs.core/IndexedSeq
prior to transducers, how were you going to map
a String or filter
an Array or reduce
a NodeList?
agree, that is very useful
@roman01la an implementation detail, but extra args is often an array (copied from arguments
)
@dnolen makes sense, thanks for clarifying!
@roman01la to your other question - we don’t use wrappers internally much unless there’s a good reason because there is an overhead to doing that
understood
Any recent changes relating to source maps in latest cljs? Mine are not generated anymore.
@danielstockton not that I’m aware and no one else has reported anything
Ok thanks.
I started to like modularity and data-oriented libs.. ^_^ Who can point to any plain-js lib like https://github.com/juxt/bidi to simply get data back, no express-webserver-style like .on(’/’, fn) please
answering own question https://github.com/tildeio/route-recognizer looks ok
hey folks, running up against a problem importing a google closure lib namespace. I’m trying to use the static method goog.html.testing.newSafeHtmlForTest
(https://google.github.io/closure-library/api/goog.html.testing.html) to pass in a value to the setSafeHtml
method on a Tooltip
(https://google.github.io/closure-library/api/goog.ui.Tooltip.html)
I get a runtime type error when I try to call this static method: TypeError: goog.html.testing is undefined
I’ve tried including it a variety of ways, but nothing seems to work. Do I have to do something else to use this namespace in ClojureScript?
(hi Gordon!)
@ddellacosta that worked at a cljs repl for me
cool let me give that a shot. I’ve been using import
but haven’t tried require
yet, or giving it an alias like that
with Closure at least you should be able to use the require
semantics you're used to, so no need to alias if you don't want to, you can :refer
as well
gotcha
I have to admit I’m pretty fuzzy on how exactly google closure libraries work in terms of including them
I have the java import model stuck in my brain, and this seems to work differently
nice, that worked—thanks!
huh, also, on a hunch tried one way of using import
I hadn’t yet—`[goog.html testing]`
and that also seems to work
not sure why I’d choose one over the other—any idea?
I guess it’s nice to use require
exclusively for simplicity’s sake, at least
I don't work in cljs enough for it to stick with me either. there's a page on the cljs wiki that links to a blog post that may be of interest https://github.com/clojure/clojurescript/wiki/Dependencies#closure-library
oh, this is the page I always forget about! haha
bookmarked, thanks
ah okay
@ddellacosta @gws: The up to date docs are for that are at https://clojurescript.org/reference/google-closure-library - I started an issue related to it at https://github.com/clojure/clojurescript-site/issues/60 - I had a lot more difficulty than I expected figuring out how things should work. If you have any thoughts on what would improve the clarity or areas you struggled with, I'm going to attempt a PR at some point to improve things there.
@shaun-mahood ah okay, thanks—much appreciated
oh hey look http://clojurescriptmadeeasy.com/blog/when-do-i-use-require-vs-import.html
echoes what Gordon just said but nice to have it all in one place
@ddellacosta: Not sure how relevant it is to what else you're doing, but I also refer to http://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/ about as often as those pages
@shaun-mahood not relevant to what I’m doing right now, but I forget tons of stuff on this page on a regular basis so I bookmarked it immediately
I wish the official docs were more comprehensive here
anyways, great link, thank you!
@ddellacosta: Open an issue and I would love to work on improving them over time - as long as you signed your CA you can help!
I’ll think on it 😄
I think I sent in my CA a while back
Related to the http://clojurescript.org site, is there any plan or timeline to remove info from the wiki and point to the official docs as they are migrated so that people will update their old bookmarks and so forth? Or is it kind of sitting in deprecated limbo until further notice? I'd be happy to help with clean-up and linking if that's at all useful.
@shaun-mahood I’ve been putting deprecation notices on the big pages that moved over
@dnolen: Ok, I'll copy that message for any that are missing it - might only be the G Closure one but I'll see what else I can do to help with migrating other pages as well.
Can someone help me with my cljs compile linking?
Currently, I have an SPA that can be reached at: localhost:3449/things/1/things/2
. Routing things/1/things/2
to 'index.html'
Unfortunately, the javascript dependencies are referenced with: js/compiled/out/{a.js, b.js, c.js}
which the browser tries to fetch: localhost:3449/things/1/things/2/js/compiled/out/{a.js, b.js, c.js}
. However, I would like to absolute paths.
For example, localhost:3449/js/compiled/out/{a.js, b.js, c.js}
@macroz bindings don't really exist in ClojureScript
@macroz not an easy thing to do: https://github.com/binaryage/cljs-zones
I was digging through old code and was disappointed that they don't work and rediscovered this http://dev.clojure.org/display/design/Dynamic+Binding
@darwin from that link "The simple reasoning is: Clojure has threads, but ClojureScript does not." That's not really true
CLJS doesn't have vars, that's why we can't have bindings
@tbaldridge ok, thanks, I will update it. btw. while I have you reading it, look at the FAQ question "Does it work with core.async?” there. Maybe you could shed some light on it