Comden: How to center image in ckeditor?
Godnick: Hello guys, Im learning JS and create this file and would like some suggestion to start using more OO. till now I just used Namespace in top of my file, Im wondering which good practices I would be using in this script. Just some tips so I can try. Here’s my gist: https://gist.github.com/osnysantos/7f61c8887cb740c78e27
Monson: Nettoweb_, re namespaces: the best is to use real modules, but that requires a build process see e.g. browserify
Urquiza: You’re using html strings when you should be using e.g. ${‘span’, {cl***: ‘label .’}.textvalue.repla.
Span: And using .html when you should use .text
Damerell: Your function names don’t make sense, you’re using jQuery’s $.eachxs, fn when you could just use xs.forEachfn, and other small issues
Mosseri: GreenJello any other suggestion about a more OO way to build these things
Craigo: Strive for simple, I’m not even sure what makes code more or less OO
Carpinteyro: Hello, maybe somebody know is there any way to prittytize scripts before debug them in google chrome?
Wildeman: Maybe there is some kind of addon or something?
Kopplin: Hmmm, I have a look-up table from a PDF that has y-coordinates as keys and an array of strings on that y-coordinate as a value. However, unfortunately, there is a certain margin for error when looking up the y-coordinates; it might be up to 0.01 more or less than the y-coordinate in the lookup table. I could account for this by using Array.prototype.findIndex on the look-up table, but I imagine this makes the lot more expens
Boken: Does es6 have named parameters support?
Pardy: Boken: ecmascript will never have named parameter support don’t quote me on that
Drowne: Diamonds: https://www.youtube.com/watch?v=Tl3euCXhpaQ
Renz: Boken: I recall reading something about it a couple years ago
Boken: Maybe I’m just thinking in other languages. What do you do when you have to p*** “many” parameters to a function or a cl*** constructor?
Shadow: Boken: the usual pattern in JS is to p*** an options OBJECT
Condina: Boken: and have small functions that do one thing and one thing only
Boken: Impaloo: eh, yeah. That can’t happen with model constructors.
Hambleton: Not with that attitude!
Boken: They do one thing: initialize the model
Wiland: Alternately, if you want to be fancy pantsy & make a prettier but possibly more confusing API, you can allow variable # or types of arguments by testing argument types
Boken: Though it makes it reaaaaally crappy on the other hand, because clients have no idea what your function expects
Bancourt: So if your fn takes a Function argument and OPTIONALLY an options object, you can function foooptions, fn{ if typeof options === ‘function’ {function = options;} /*.*/}
Zabik: So they can call foo{a:1},myFn or just foomyFn
Snider: For better or worse this pattern is someone common in the node world
Boken: You guys must love reading do***entation for everything
Ervay: Boken: you can use ES6 object destructuring like; http://pastebin.com/dH53Hr9Y
Mozee: ES6 object destruct AND default param values*
Boken: Js seems like a toddler compared to other languages tbh
Demario: Boken: do. DO. DONT YOU
Leib: Http://expressjs.com/api.html#app.use
Plato: Https://github.com/strongloop/express/blob/master/lib/application.js#L200-L203
Boken: Diamonds: yeah, awesome. You’d totally be able to figure out what it does without resourcing to docs or source code
Eckenrode: Boken: it was designed initially for a pretty small scope & has grown somewhat organically over the years
Reidel: Boken: http://pastebin.com/dH53Hr9Y will give you what you want, sorta
Gechas: Boken: that one can take: fn, str, fn, or str, fn, , fn. ;
Cozby: But you’ll need babel