This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-23
Channels
- # aws-lambda (1)
- # beginners (11)
- # boot (456)
- # cider (3)
- # cljsrn (7)
- # clojure (340)
- # clojure-berlin (6)
- # clojure-dev (207)
- # clojure-germany (12)
- # clojure-greece (3)
- # clojure-italy (3)
- # clojure-russia (12)
- # clojure-spec (42)
- # clojure-uk (29)
- # clojured (7)
- # clojurescript (125)
- # datascript (1)
- # datomic (47)
- # defnpodcast (4)
- # emacs (30)
- # events (7)
- # hoplon (13)
- # instaparse (64)
- # jobs (13)
- # jobs-discuss (1)
- # lein-figwheel (1)
- # leiningen (10)
- # luminus (1)
- # lumo (14)
- # off-topic (10)
- # om (16)
- # om-next (3)
- # onyx (1)
- # pedestal (3)
- # protorepl (5)
- # re-frame (17)
- # reagent (66)
- # ring (1)
- # ring-swagger (13)
- # spacemacs (12)
- # specter (4)
- # untangled (272)
- # vim (4)
- # yada (24)
well here's one problem, which i expect we all recognize: we end up with defx for a thousand different xs. i don't know what to do about it, my own lib has it's own defx stuff. but it doesn't seem like a good thing.
@mobileink i’ve usually written my defx macros with a x* function that does the work, that way you can write your defx+y macro by just composing their x* & y* functions
well… assuming they can compose like that, some defx macros may need to emit incompatible code with other defx's
DevTools failed to parse SourceMap: httpsL//localhost:8000/main.out/cljsjs/showdown/development/showdown.js.map
Something from cljsjs has it.
Technically, a package repo. And a namespace.
I tried to run js code compiled from ClojureScript in Weex, and (pr-str {})
returns [object Object]
. In theory, Weex is using V8. But is there any chance that pr-str
returns [object Object]
in V8?
recorded here http://stackoverflow.com/questions/42409547/weex-handles-string-object-differently-from-node-js
@jiyinyiyong it would be much simpler to debug with :simple
optimizations. but my guess would be that console
is different in Weex. It is not an object natively support by V8. Node.js provides a different one from the V8 embedded in Chrome.
Hi everyone, is there anybody who generated csrf-token in clojurescript? In SPA style, I’m new at SPA style, I use ajax to send data from client (cljs) to backend (pedestal), and I don’t have any idea on how or best practice to do it, Been googling and found : https://gist.github.com/coyotespike/aca29bdeca1eea1e8648 But that doesn’t seem to work on my machine Any advice/help will be appreciated, thank you in advance!
@dsapoetra you normally generate the token on the server side, in Clojure.
Do lein new luminus example
and analyse that. It works.
@not-raspberry how do we merge it in ajax request from client-side(cljs) to backend?
You normally add some middleware. Really, check that luminus template out. It's in src/cljs/<project name>/ajax.cljs. On the clojure side it also uses ring.
Xhr libraries in clojurescript normally have some middleware for that
No, multispec is to create an open spec
At the moment, spec doesn't work with multimethods
publicly, no
but there is a private var at clojure.spec.test/instrumented-vars
@#‘clojure.spec.test/instrumented-vars
should let you snoop
I heard from their developers that they freeze global objects for performance and security purpose.
And my js code is throwing error TypeError: Cannot assign to read only property 'toString' of [object Object]
Very likely that the prototype
in goog.math.Integer.prototype.toString = function()
is broken
And somehow the console in the debugger handle it silently, so it calls native toString
method, then I got ({}).toString()
which is exactly [object Object]
.
@jiyinyiyong it shouldn't be too hard to get this working properly. If you are compiling with :target :nodejs
the bootstrap that happens expect to be running node, which you are not.
only saw docs for the JS parts you are supposed to use but no details about the runtime
js
var My = function() {}
My.prototype.toString = function() {
return 'My Thing'
}
var a = new My
console.log('result:', a.toString())
https://github.com/alibaba/weex_v8core doesn't help much
but I still feed bad that ClojureScript is depending on it. I barely use such thing. And I'm actually happy with my life powered up by Webpack.
well I kinda question the fact that they disallow overriding toString
, there are gonna be tons of JS libs that expect to use that
They said they are reusing the same Weex instance in Android and iOS, but found problems, even memory leaks, which are caused by strange things on global objects..
/**
* Freeze the prototype of javascript build-in objects.
*/
/* istanbul ignore next */
export function freezePrototype () {
Object.freeze(Object)
Object.freeze(Array)
Object.freeze(Object.prototype)
Object.freeze(Array.prototype)
Object.freeze(String.prototype)
Object.freeze(Number.prototype)
Object.freeze(Boolean.prototype)
Object.freeze(Error.prototype)
Object.freeze(Date.prototype)
Object.freeze(RegExp.prototype)
}
yeah no idea, looks questionable to me. can't think of a simple way to work around it as many things in closure have toString fns
maybe my friends from Weex team will see my messages and give me advices, like never use ClojureScript, still cool...
@jiyinyiyong just had an idea, write a Closure Compiler pass that removes all .prototype.toString
assignments
that would actually be really simple, well Java is involved so not that simple but still doable
Dumb question: what is the difference between clojure and clojurescript?
are they the same syntax?
thanks!
can i understand as clojure is more targeting cloud computing, while clojurescript is more for web dev front end and server?
Clojure runs on the jvm so the jvm runs on lots of servers so I wouldn’t say clojrue isn’t for cloud. Anywhere you would use java you can use clojure. Also node.js is used in AWS Lambda so you could use clojurescript there which would be cloud
I see.. thanks for the detail explanation!! clojure is for java, and clojurescript is for javascript....
what is the story/motivation of the invention of clojure/clojurescript?
This talk can probably explain why better than I can https://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
Thanks!
And this is his talk on clojurescript https://www.youtube.com/watch?v=tVooR-dF_Ag
Great! I will watch them!
are there any good resources for learning how dependencies work in ClojureScript? I would ideally like to get to the point where I can port over an npm package (which uses other npm dependencies) for use in ClojureScript
how do people normally run multiple clojurescript projects at the same time?
I mean you can change the figwheel port in the settings
but it would be even nicer if it would just try the next port if 3449 is already busy
otherwise I could always just use an env variable so I can change it more easily without touching the code
I have 16G of ram and spin many figwheels.
If you have many cljs targets in 1 tree, then lein profiles come handy. lein with-profile
@andrea.crotti It's pretty rare that I need that. Different ports for both figwheel & nrepl would be a reliable solution.
ah ok cool
another question, this variable in cider `cider-cljs-lein-repl is a variable defined in ‘cider.el’. Its value is "(cemerick.piggieback/cljs-repl (cljs.repl.rhino/repl-env))" `
defaults to that, however various projects suggest to use this instead
"(do (user/run) (user/browser-repl))")
if I understand correctly as long as I use figwheel this second form should always work?
I’m walking my state atom to strip it of non-cljs constructs e.g. goog listener keys etc. I was hoping I could differentiate with type
but that doesn’t seem to cut it. any suggestions?
Hello all, how do I call fade from :
var MaterialUIUtils = {
colorManipulator : {
convertColorToString : function() {},
convertHexToRGB : function() {},
darken : function() {},
decomposeColor : function() {},
emphasize : function() {},
fade : function() {},
getContrastRatio : function() {},
getLuminance : function() {},
lighten : function() {}
}
};
@hlolli cljs.core/==
is much faster than cljs.core/=
for numbers
the fact that 1 === 1.0
is just a JS quirk
cljs.user> (time (dotimes [_ 1000000] (= 1 1)))
"Elapsed time: 206.890000 msecs"
nil
cljs.user> (time (dotimes [_ 1000000] (== 1 1)))
"Elapsed time: 1.150000 msecs"
nil
lt
and gt
are also equally fast, wonder what slows =
down so much, since its comparing floats to integer like they are euqal (like ==
).