Guest User

Untitled

a guest
Sep 18th, 2015
377
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sep 17 09:17:58 <nettoweb_> 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
  2. Sep 17 09:28:40 <pr0tocol> hello, everyone.
  3. Sep 17 09:32:46 <GreenJello> nettoweb_, re namespaces: the best is to use real modules, but that requires a build process (see e.g. browserify)
  4. Sep 17 09:35:08 <GreenJello> you're using html strings when you should be using e.g. ${'<span>', {class: 'label ...'}).text(value.repla...
  5. Sep 17 09:35:16 <GreenJello> and using .html when you should use .text
  6. Sep 17 09:36:26 <GreenJello> your function names don't make sense, you're using jQuery's $.each(xs, fn) when you could just use xs.forEach(fn), and other small issues
  7. Sep 17 09:44:43 <nettoweb_> GreenJello thank you
  8. Sep 17 09:45:05 <nettoweb_> GreenJello any other suggestion about a more OO way to build these things
  9. Sep 17 09:46:10 <GreenJello> strive for simple, I'm not even sure what makes code more or less OO
  10. Sep 17 09:59:41 <loa> hello, maybe somebody know is there any way to prittytize scripts before debug them in google chrome?
  11. Sep 17 10:00:02 <loa> maybe there is some kind of addon or something?
  12. Sep 17 10:01:01 <ThePendulum> 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 expen
  13. Sep 17 10:06:58 <autrilla> Does es6 have named parameters support?
  14. Sep 17 10:07:49 <Impaloo> autrilla: ecmascript will never have named parameter support (don't quote me on that)
  15. Sep 17 10:07:58 <autrilla> Why is that?
  16. Sep 17 10:10:01 <diamonds> "ecmascript will never have named parameter support" - Impaloo, 2015
  17. Sep 17 10:11:11 <Impaloo> diamonds: https://www.youtube.com/watch?v=Tl3euCXhpaQ
  18. Sep 17 10:11:36 <Impaloo> autrilla: I recall reading something about it a couple years ago
  19. Sep 17 10:12:56 <autrilla> Maybe I'm just thinking in other languages. What do you do when you have to pass "many" parameters to a function or a class constructor?
  20. Sep 17 10:13:44 <diamonds> lol
  21. Sep 17 10:14:03 <diamonds> autrilla: the usual pattern in JS is to pass an options OBJECT
  22. Sep 17 10:14:16 <Impaloo> autrilla: and have small functions that do one thing and one thing only
  23. Sep 17 10:14:18 <Impaloo> and do it well
  24. Sep 17 10:14:22 <Impaloo> and is well tested
  25. Sep 17 10:14:32 <autrilla> Impaloo: eh, yeah. That can't happen with model constructors.
  26. Sep 17 10:14:41 <Impaloo> not with that attitude!
  27. Sep 17 10:14:42 <Impaloo> jk
  28. Sep 17 10:14:45 <autrilla> They do one thing: initialize the model
  29. Sep 17 10:15:02 <diamonds> 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
  30. Sep 17 10:15:23 <autrilla> Object sounds better
  31. Sep 17 10:15:50 <autrilla> Though it makes it reaaaaally crappy on the other hand, because clients have no idea what your function expects
  32. Sep 17 10:16:34 <diamonds> so if your fn takes a Function argument and OPTIONALLY an options object, you can function foo(options, fn){ if( typeof options === 'function') {function = options;} /*...*/}
  33. Sep 17 10:16:53 <diamonds> so they can call foo({a:1},myFn) or just foo(myFn)
  34. Sep 17 10:17:03 <diamonds> for better or worse this pattern is someone common in the node world
  35. Sep 17 10:17:10 <autrilla> crappy api
  36. Sep 17 10:17:31 <autrilla> You guys must love reading documentation for everything
  37. Sep 17 10:18:32 <Impaloo> autrilla: you can use ES6 object destructuring like; http://pastebin.com/dH53Hr9Y
  38. Sep 17 10:18:55 <Impaloo> it's... something
  39. Sep 17 10:19:11 <Impaloo> ES6 object destruct AND default param values*
  40. Sep 17 10:19:15 <autrilla> js seems like a toddler compared to other languages tbh\
  41. Sep 17 10:19:22 <Impaloo> autrilla: do.. DO.. DONT YOU
  42. Sep 17 10:19:28 <diamonds> http://expressjs.com/api.html#app.use
  43. Sep 17 10:19:35 <Impaloo> ./votekick autrilla
  44. Sep 17 10:19:42 <diamonds> https://github.com/strongloop/express/blob/master/lib/application.js#L200-L203
  45. Sep 17 10:20:03 <autrilla> diamonds: yeah, awesome. You'd totally be able to figure out what it does without resourcing to docs or source code
  46. Sep 17 10:20:05 <diamonds> autrilla: it was designed initially for a pretty small scope & has grown somewhat organically over the years
  47. Sep 17 10:20:22 <Impaloo> autrilla: http://pastebin.com/dH53Hr9Y will give you what you want, sorta
  48. Sep 17 10:20:44 <diamonds> autrilla: that one can take: (fn), (str, fn), or ([str], fn, [, fn...]) ;)
  49. Sep 17 10:20:50 <Impaloo> but you'll need babel
  50. Sep 17 10:20:53 <autrilla> Impaloo: nah. That function asks for an object... which is totally unclear, because almost everything is an object
  51. Sep 17 10:20:55 <autrilla> I have babel
  52. Sep 17 10:20:56 <diamonds> but wait, there's more!!
  53. Sep 17 10:21:43 <Impaloo> i can't find any discussion about named parameter proposals though
  54. Sep 17 10:21:43 <autrilla> Impaloo: like, if I have to pass an object, what's the point of having a class in es6?
  55. Sep 17 10:21:59 <Impaloo> autrilla: wat
  56. Sep 17 10:22:14 <baxx> what's the way you put numbers in a string in JS? Python it's "something something {}".format(thing)
  57. Sep 17 10:22:29 <cjohnson> you can just concat them with plus
  58. Sep 17 10:22:35 <diamonds> http://expressjs.com/api.html#router.METHOD < app.get([str], fn) defines an app route...
  59. Sep 17 10:22:52 <baxx> cjohnson: ah right, cool I'll try that
  60. Sep 17 10:22:56 <ThePendulum> express is fantastic stuff after coming from PHP frameworks
  61. Sep 17 10:23:04 <diamonds> but app.get(str) gets a configuration setting!! http://expressjs.com/api.html#app.get
  62. Sep 17 10:23:24 <diamonds> app.get: lookup config setting or maybe set a route handler :)
  63. Sep 17 10:23:26 <autrilla> so, class Student { constructor(name, age, sex, classes, professors, isMinority, isVegetarian, eatsFoobar) {}.... /wrists
  64. Sep 17 10:23:36 <diamonds> ThePendulum: yeah I like it p well
  65. Sep 17 10:23:42 <autrilla> And now you have to remember the param order FOREVER!
  66. Sep 17 10:24:21 <ThePendulum> diamonds: I was fearing the worst trying to get a variable from the URL... nope! app.get('/yourpage/:yourvar')
  67. Sep 17 10:24:26 <diamonds> autrilla: ABA: Always Be Abstracting. just add more abstraction layers so you don't have to remember arg order :)
  68. Sep 17 10:24:30 <diamonds> more and more layers
  69. Sep 17 10:24:40 <autrilla> diamonds: eh.
  70. Sep 17 10:24:45 <autrilla> You still have to know it.
  71. Sep 17 10:24:47 <ThePendulum> and the query string is neatly there as well
  72. Sep 17 10:24:58 <autrilla> diamonds: how would you abstract that?
  73. Sep 17 10:25:22 <autrilla> You can't abstract models. You can break them into pieces, not abstract them, you'll have to know every detail when you create a new model.
  74. Sep 17 10:25:42 <ThePendulum> I'm wondering what the best way would be to make a look-up table if I have fuzzy keys :/
  75. Sep 17 10:26:53 <diamonds> autrilla: I'm sort of joking... some frameworks add a million abstraction layers "so you can change the underlying [class] w/o having to update all your code"
  76. Sep 17 10:27:16 <manners13> hey guys i wonder if someone could tell me how to do this
  77. Sep 17 10:27:22 <manners13> ive got his
  78. Sep 17 10:27:24 <manners13> https://jsfiddle.net/3tnk4ong/
  79. Sep 17 10:27:29 <diamonds> ThePendulum: that .get would look up a config var named /yourpage/:yourvar yes?
  80. Sep 17 10:27:40 <autrilla> I profoundly dislike how badly js works with tooling because it's type system sucks.
  81. Sep 17 10:27:57 <diamonds> manners13: what's your goal?
  82. Sep 17 10:28:06 <manners13> but i need the data from the text area to be posted to the contactlog.php script
  83. Sep 17 10:28:25 <manners13> im new to javascript and ajax so please be gentle
  84. Sep 17 10:28:27 <yansanmo> manners13, you need to send the value in the send()
  85. Sep 17 10:28:50 <manners13> yes but how lol with get it was this.value then +str
  86. Sep 17 10:29:10 <yansanmo> xmlhttp.send("contactlog=" + encodeURIComponent(arguments[0]));
  87. Sep 17 10:29:19 <manners13> but how do i do it with post when i have to declare what to send before the textarea input
  88. Sep 17 10:29:27 <diamonds> manners13: tbh don't even bother learn to write XHR requests by hand unless you have some good reason to. there are a zillion good AJAX libs to make this easier & fetch api will replace XHR in the future anyway
  89. Sep 17 10:29:30 <yansanmo> also, you have xmlhttp and contactlogpost variable in your code
  90. Sep 17 10:29:39 <diamonds> !g superagent @ manners13
  91. Sep 17 10:29:40 <ecmabot> manners13: visionmedia/superagent · GitHub <https://github.com/visionmedia/superagent>
  92. Sep 17 10:29:47 <ThePendulum> diamonds: hmm, I was aiming at sending parameters with the URL
  93. Sep 17 10:29:57 <autrilla> So you have to write stuff like this? https://www.irccloud.com/pastebin/WGfYMZmK/
  94. Sep 17 10:30:01 <yansanmo> manners13, you can't use both variable name
  95. Sep 17 10:30:03 <diamonds> ThePendulum: you'd need a handler fn as final arg there
  96. Sep 17 10:30:12 <diamonds> ThePendulum: with just .get(str) it looks up config
  97. Sep 17 10:30:39 <ThePendulum> diamonds: app.get('/hello/:what', function(req, res) { console.log(req.params.what); } would tell you what you were greeting in your URL for whatever obscure greeting because this is not how you should be doing hello worlds
  98. Sep 17 10:30:54 <ThePendulum> diamonds: what do you mean, look up config?
  99. Sep 17 10:31:04 <manners13> kk sorry that was a mistake
  100. Sep 17 10:31:20 <diamonds> ThePendulum: http://expressjs.com/api.html#app.get < "Returns the value of name app setting, where name is one of strings in the app settings table. "
  101. Sep 17 10:31:29 <diamonds> anyway #express :)
  102. Sep 17 10:31:43 <yansanmo> manners13, like that: https://jsfiddle.net/3tnk4ong/1/
  103. Sep 17 10:31:46 <ThePendulum> well yes, you'd want to use it at some point, lol
  104. Sep 17 10:39:36 <autrilla> Ok, why should I use actual classes instead of just doing stuff like this? https://www.irccloud.com/pastebin/v5LFa46E/
  105. Sep 17 10:43:00 <morenoh149> autrilla: that's a json object
  106. Sep 17 10:43:00 <DannyFritz> autrilla: essentially the same thing. class just has some sugar.
  107. Sep 17 10:43:20 <morenoh149> there's also no methods in that example
  108. Sep 17 10:43:31 <DannyFritz> for data though, i would keep it to just a plain old object
  109. Sep 17 10:43:32 <autrilla> morenoh149: I could put some method in them, sure
  110. Sep 17 10:44:04 <autrilla> js objects are just the same thing as python dictionaries, you just give it a key and whatever value you want
  111. Sep 17 10:44:10 <morenoh149> Class is just js sugar for a js closure
  112. Sep 17 10:45:13 <autrilla> Heh, so there's my API mock done, I guess.
  113. Sep 17 10:47:37 <morenoh149> yeah, unless you need state or variable encapsulation I see no reason to use a Class-class
  114. Sep 17 10:49:52 <renlo> Class-class?
  115. Sep 17 10:50:03 <morenoh149> es6 Class syntax
  116. Sep 17 10:50:57 <renlo> public class JavaScript implements ES6
  117. Sep 17 10:56:26 <pikajude> what the heck. flow is written in ocaml?
  118. Sep 17 10:56:29 <pikajude> of all the languages to use
  119. Sep 17 10:56:45 <deniska> should've used erlang
  120. Sep 17 10:57:44 <morenoh149> should've use haskell
  121. Sep 17 10:57:59 <morenoh149> or ML
  122. Sep 17 10:58:03 <pikajude> should've used haskell
  123. Sep 17 10:58:19 <pikajude> all type systems are an imperfect attempt to be haskell
  124. Sep 17 11:00:10 <fred1807> how can I make this script points to a external local file? https://github.com/ariya/phantomjs/raw/master/examples/technews.js (This example is pointing to http://google.../news....) I want to make it point to a local file, and read the url form that file
  125. Sep 17 11:03:28 <Alex112358> Have a handlebars question, anyone here able to possibly provide some assistance?
  126. Sep 17 11:05:16 <morenoh149> Alex112358: don't ask to ask. also node.js is probably more appropriate channel
  127. Sep 17 11:07:45 <kegdev> yay i'm registered
  128. Sep 17 11:17:06 <MikeD_> if I want the first character from a string, is there any reason i should not use mystring[0] ?
  129. Sep 17 11:18:32 <baxx> is there a way to see a variables type in the firefox debugger?
  130. Sep 17 11:18:37 <natrixnatrix89> Hi there.
  131. Sep 17 11:19:16 <natrixnatrix89> I'm wondering - Am I the only JS developer, who thinks Mean.js is crap?
  132. Sep 17 11:19:20 <laserco> baxx: typeof() ?
  133. Sep 17 11:20:24 <MikeD_> why do you think that?
  134. Sep 17 11:20:27 <natrixnatrix89> It just feels so tangled..
  135. Sep 17 11:21:44 <natrixnatrix89> and the acl.. var roles = (req.user) ? req.user.roles : ['guest']; It just checks data passed in the request, to determine whether user can access
  136. Sep 17 11:22:20 <natrixnatrix89> or was it already handled in the middleware?
  137. Sep 17 11:24:50 <laserco> natrixnatrix89: yes its pretty well understood now that angular and mongo are stinky doo doo, but unfortunately many companies are too invested in it already
  138. Sep 17 11:25:28 <tejasmanohar> hey all! anyone here worked w/ CI services? i'm trying to evaluate codeship vs CircleCI?
  139. Sep 17 11:25:42 <natrixnatrix89> Well it's obvious about mongo and angular. I do like express.js but the architecture of mean.js seems just so bizzare
  140. Sep 17 11:25:59 <natrixnatrix89> has anyone seen a successful project built on meanjs?
  141. Sep 17 11:26:01 <morenoh149> tejasmanohar: I like codeship
  142. Sep 17 11:26:09 <morenoh149> but circleci has a free tier
  143. Sep 17 11:26:23 <morenoh149> natrixnatrix89: freecodecamp.com
  144. Sep 17 11:26:41 <baxx> laserco: yeah that's like a console.log() output (has to be done from the code?) I was wondering if one could just view a variables type by clicking on it some how in the debugger
  145. Sep 17 11:26:48 <tejasmanohar> yea i guess codeship can be a bit pricy morenoh149
  146. Sep 17 11:27:22 <tejasmanohar> morenoh149: if you don't mind me asking, what do you prefer about codeship to circleci?
  147. Sep 17 11:27:24 <laserco> natrixnatrix89: yeah, I have. It's fast and easy, but isn't scaleable/maintainable.
  148. Sep 17 11:27:26 <morenoh149> tejasmanohar: I like the ui but I was on the free tier they since removed
  149. Sep 17 11:27:34 <tejasmanohar> ah
  150. Sep 17 11:27:38 <tejasmanohar> yeah i don't like circle's UI
  151. Sep 17 11:28:38 <laserco> baxx: I sensed that's what you meant. I belive the output is color coded. green = number, orange = string, etc
  152. Sep 17 11:28:40 <natrixnatrix89> > It's fast and easy, but isn't scaleable/maintainable.
  153. Sep 17 11:28:42 <natrixnatrix89> I agree
  154. Sep 17 11:29:11 <natrixnatrix89> But the "fast and easy" part isn't that fast and easy either.. There's still a learning curve to follow the tangled architecture
  155. Sep 17 11:29:21 <natrixnatrix89> and still there's that code repetition etc..
  156. Sep 17 11:29:42 <natrixnatrix89> "fast and easy" just stands for the part where you don't have to do oauth yourself.
  157. Sep 17 11:30:49 <laserco> natrixnatrix89: I suppose, I only new javascript at the time, so in that sense it was easier than learning ruby, clojure, or whatever
  158. Sep 17 11:31:33 <natrixnatrix89> heh, right
  159. Sep 17 11:31:51 <morenoh149> natrixnatrix89: I'd do MERN, mongo express react and node
  160. Sep 17 11:32:54 <natrixnatrix89> Yes, that would be interesting.. But still I'd like to see more sanity in how the expressjs is handled
  161. Sep 17 11:33:37 <natrixnatrix89> Ok. I'm relieved I'm not alone.. Let's get back to work
  162. Sep 17 11:34:36 <morenoh149> natrixnatrix89: try hapi or strongloop if you want more architectural guidance above express
  163. Sep 17 11:34:49 <morenoh149> express is more like sinatra or flask
  164. Sep 17 11:34:58 <morenoh149> hapi/strongloop are more like rails or django
  165. Sep 17 11:35:14 <morenoh149> gah he left
  166. Sep 17 11:35:56 <laserco> morenoh149: don't worry I enjoyed your analogy
  167. Sep 17 11:37:17 <Drewery> I definitely enjoyed it too ! :)
  168. Sep 17 11:37:29 <Drewery> I mean if there is more you would want to add I am definitely ears!
  169. Sep 17 11:38:08 <morenoh149> that's all folks 😸
  170. Sep 17 11:40:13 <wdbl> How important is bundling for performance? I'm getting obsessed with the perfect build system (using gulp) - the next part I have to do is bundling and I want to just start working on the actual freaking app at this point... Is downloading one huge js file *always* better than say 9 or 10 individual ones?
  171. Sep 17 11:42:04 <holodoc> wbdl: There is no such thing as "always better".
  172. Sep 17 11:42:16 <wdbl> I see gulp-bundle-assets - is that pretty standard for gulp users?
  173. Sep 17 11:42:21 <morenoh149> wdbl: just make the app. I too sometimes get stuck on over optimizing
  174. Sep 17 11:42:22 <wdbl> holodoc: true
  175. Sep 17 11:42:52 <laserco> wdbl: bundling isn't about performance, it's for organization in development.
  176. Sep 17 11:42:55 <holodoc> wdbl: Do your app first, then think about optimization. Otherwise you will never finish.
  177. Sep 17 11:43:10 <wdbl> Is bundling usually easy for everyone? (JS devs...) I'm kind of an old but new JS dev (all this new stuff keeps making me feel like a newb)
  178. Sep 17 11:43:37 <holodoc> wbdl: At the end do performance tests. It's easier to otpimize when you have the final product. If you start doing it upfront you are making assumptions about the final product.
  179. Sep 17 11:43:41 <wdbl> I just wonder if I'm making a mountain out of a mole-hill
  180. Sep 17 11:43:50 <wdbl> ok
  181. Sep 17 11:44:04 <manners13> ok i must still be doing something wrong
  182. Sep 17 11:44:08 <manners13> https://jsfiddle.net/3tnk4ong/3/
  183. Sep 17 11:44:12 <wdbl> holodoc, laserco - thanks for your advice
  184. Sep 17 11:44:31 <wdbl> I will get it out of my head that I *neeeeeed* bundling to be in place before getting to work
  185. Sep 17 11:44:36 <Rabbles> wdbl, I'd prefer 20 javascript files. It's easier to debug, and they get cached
  186. Sep 17 11:44:46 <manners13> returns this as print_r ($_POST)
  187. Sep 17 11:44:48 <manners13> Array ( [contactlog] => undefined )
  188. Sep 17 11:45:04 <morenoh149> wdbl: you just uglify then pipe to concat. done.
  189. Sep 17 11:45:05 <wdbl> ok great, I actually prefer NOT bundling too because I like things to be simple
  190. Sep 17 11:45:21 <Rabbles> wdbl, Don't worry about bundling unless you have huge images and assets to send over. 20 javascript files is nothing. Let the browser handle the details there.
  191. Sep 17 11:45:50 <wdbl> sweet guys. Thanks so much for your support
  192. Sep 17 11:45:52 <morenoh149> to get debugging you generate a sourcemap as well wdbl https://github.com/mikach/gulp-concat-sourcemap
  193. Sep 17 11:46:28 <wdbl> I work alone all the time and I'm sick of not having anyone to lean on for stuff like this
  194. Sep 17 11:47:16 <netameta> what does {,*/} means in grunt file ?
  195. Sep 17 11:47:56 <laserco> the ideal performance scenario is that the user supplies the libraries. This is what Stallman proposes.
  196. Sep 17 11:48:29 <laserco> same idea as cachine, but more like homebrew
  197. Sep 17 11:48:33 <laserco> caching*
  198. Sep 17 11:58:33 <fcanela> hello, I have a doubt about scopes and binding
  199. Sep 17 11:59:55 <fcanela> I have have created a "scope object" like this: var scope = { 'context' : context }, then used that object to bind a function: var func = otherfunc.bind(scope);
  200. Sep 17 12:00:25 <fcanela> in otherfunc, if I call 'context' it's not found, but if I call 'this.context', it works nice
  201. Sep 17 12:00:59 <fcanela> why? I though that when a undeclared variable is found, JS search in first available scope (this) and then goes up the chain
  202. Sep 17 12:01:20 <fcanela> but somehow, it doesn't link 'context' to 'this.context'
  203. Sep 17 12:01:28 <ThePendulum> >> !!(test)
  204. Sep 17 12:01:29 <ecmabot> ThePendulum: ReferenceError: test is not defined
  205. Sep 17 12:01:36 <ThePendulum> I wish that returned false :(
  206. Sep 17 12:01:42 <ThePendulum> >> test ? true : false
  207. Sep 17 12:01:42 <ecmabot> ThePendulum: ReferenceError: test is not defined
  208. Sep 17 12:01:49 <ThePendulum> huh, hmmm
  209. Sep 17 12:02:13 <ThePendulum> >> var test = {'hello': 'world'}; test.world ? true : false;
  210. Sep 17 12:02:13 <ecmabot> ThePendulum: (boolean) false
  211. Sep 17 12:02:29 <ThePendulum> >> var test = {'hello': 'world'}; !!test.world;
  212. Sep 17 12:02:29 <ecmabot> ThePendulum: (boolean) false
  213. Sep 17 12:02:30 <ThePendulum> interesting
  214. Sep 17 12:03:16 <ThePendulum> >> if(test) { console.log(':)', ':('); }
  215. Sep 17 12:03:16 <ecmabot> ThePendulum: ReferenceError: test is not defined
  216. Sep 17 12:03:40 <ThePendulum> oki
  217. Sep 17 12:07:34 <L8D> ThePendulum: what were you trying to do?
  218. Sep 17 12:07:53 <L8D> |> var test; !!(test)
  219. Sep 17 12:07:58 <L8D> >> ;
  220. Sep 17 12:07:58 <ecmabot> L8D: (boolean) false
  221. Sep 17 12:08:16 <stickperson> is the “=>” operator an es6 think? i’ve seen it in functions but don’t know what it does here: “return next => action =>”
  222. Sep 17 12:08:29 <L8D> >> var test; if (test) { console.log(':)', ':('); }
  223. Sep 17 12:08:29 <ecmabot> L8D: undefined
  224. Sep 17 12:08:44 <L8D> stickperson: yes, the 'x => y' syntax is a feature of ES6
  225. Sep 17 12:09:17 <stickperson> L8D: what is it doing in this bit of code? https://github.com/gaearon/redux-thunk/blob/master/src/index.js
  226. Sep 17 12:09:22 <L8D> stickperson: (next => action => ...) is the same as writing: (function(next) { return function(action) { return ...; }; })
  227. Sep 17 12:09:34 <stickperson> ah, ok
  228. Sep 17 12:10:12 <stiang> can someone help me figure out what I need to change to be able to call a method in baseClass from *another* method in baseClass? https://jsfiddle.net/rpaxjqak/
  229. Sep 17 12:10:17 <L8D> stickperson: although I think using that syntax in that case was a bad idea. The code gets a little hard to follow
  230. Sep 17 12:10:43 <ThePendulum> L8D: I was imagining it would allow to try if a variable exist
  231. Sep 17 12:10:48 <ThePendulum> but apparently that only works for object properties
  232. Sep 17 12:10:53 <ThePendulum> hmm
  233. Sep 17 12:10:59 <ThePendulum> >> test; !!(test);
  234. Sep 17 12:10:59 <ecmabot> ThePendulum: ReferenceError: test is not defined
  235. Sep 17 12:11:06 <L8D> stickperson: you don't want to use prototypal inheritance?
  236. Sep 17 12:11:06 <stickperson> L8D: agreed. so when you see “=>”, it’s an anonymous function with whatever the words are (“next” and “action”) as parameters
  237. Sep 17 12:11:30 <stickperson> L8D: not my code. just tryng to understand someone else’s
  238. Sep 17 12:11:48 <L8D> stickperson: well if it's just a single variable name, that'll be the first parameter, otherwise you need parenthases for multiple parameters
  239. Sep 17 12:12:01 <L8D> b> ((x, y) => x + y))(1, 2)
  240. Sep 17 12:12:04 <babelbot> L8D: (error) /usr/lib/node_modules/babel/node_modules/babel-core/lib/babel/transformation/fil ... https://git.io/vnUsN
  241. Sep 17 12:12:12 <stickperson> L8D: gotcha. do you know where “next” and “action” come from in that code?
  242. Sep 17 12:12:16 <L8D> stickperson: with the next => action => ... it's returning a functio from a function
  243. Sep 17 12:12:37 <L8D> stickperson: so 'next' and 'action' are arguments, but they're for two different functions
  244. Sep 17 12:12:47 <stickperson> L8D: yup, that part makes sense
  245. Sep 17 12:12:53 <L8D> stickperson: just like writing: (function(next) { return function(action) { return ...; }; })
  246. Sep 17 12:12:58 <stickperson> yup
  247. Sep 17 12:13:31 <r0x0rZ> what are some bigger open source projects that I could contribute to that use JS as their main language?
  248. Sep 17 12:14:11 <L8D> r0x0rZ: https://github.com/rackt/react-router
  249. Sep 17 12:14:27 <r0x0rZ> L8D: will check it out thanks
  250. Sep 17 12:14:38 <stickperson> L8D: thanks for the help
  251. Sep 17 12:18:10 <stiang> did anybody get a chance to look at my fiddle? https://jsfiddle.net/rpaxjqak/ - been stuck at it for hours. I would like for methods in baseClass to be able to call each other, just can’t figure out how.
  252. Sep 17 12:19:05 <jimminimy> Hey there. I need to apply a -ms-behavior in ie8 from a cross origin domain. I've figured out how to get the contents of the .htc file using XDomainRequest() - is there a way to apply this as a data uri?
  253. Sep 17 12:22:31 <deltab> jimminimy: get a Blob and pass it to Object.createURL
  254. Sep 17 12:22:49 <deltab> URL.createForObject? something like that
  255. Sep 17 12:23:01 <wsieroci__> what do you think about using node.js and postgres? Is there some production ready ORM?
  256. Sep 17 12:23:42 <jimminimy> deltab: i need to do this in ie 8
  257. Sep 17 12:27:08 <deltab> !this @ stiang
  258. Sep 17 12:27:08 <ecmabot> stiang: If a function call is of the form `a.b()`, `this` will be the object you accessed the "b" property from. Otherwise, if it's of the form `a()`, `this` will be `undefined`, which is turned into the global object if the function wasn't defined in strict mode. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this http://javascriptweblog.wordpress.com/2010/08/30/understanding-javascripts-this/
  259. Sep 17 12:27:48 <deltab> stiang: https://jsfiddle.net/rpaxjqak/1/
  260. Sep 17 12:28:08 <deltab> jimminimy: sorry, no idea
  261. Sep 17 12:28:27 <jak2000> http://postimg.org/image/juabep2i7/ <--- why selectted item is false? can anyone explain me? thanks
  262. Sep 17 12:29:29 <L8D> jak2000: if you switch to the console at that break point, you can type in expressions there
  263. Sep 17 12:29:50 <L8D> jak2000: I would simply try "this.text == $myProd" first
  264. Sep 17 12:30:02 <deltab> sharkhat: hi
  265. Sep 17 12:30:05 <deltab> ThePendulum: hi
  266. Sep 17 12:30:23 <jak2000> L8D OK testing
  267. Sep 17 12:31:24 <jak2000> this.text == $myProd is false not know why
  268. Sep 17 12:31:41 <L8D> jak2000: from there, you can try to just copy the two strings and compare then as literals, to make sure there isn't any getter magic going on
  269. Sep 17 12:31:52 <jak2000> this.text = "[AGROFRUTAS] AGROFRUTAS" and $myProd = "[AGROFRUTAS] AGROFRUTAS"
  270. Sep 17 12:32:01 <L8D> jak2000: my guess is that there are weird UTF-8 characters messing things up
  271. Sep 17 12:32:21 <L8D> jak2000: those aren't normal brackets from what I see
  272. Sep 17 12:32:26 <jak2000> [AGROFRUTAS] AGROFRUTAS" == "[AGROFRUTAS] AGROFRUTAS" false :(
  273. Sep 17 12:32:44 <deltab> jak2000: I see two spaces in the latter
  274. Sep 17 12:32:50 <jak2000> how to fix?
  275. Sep 17 12:32:54 <jak2000> oo i seee
  276. Sep 17 12:32:56 <jak2000> deltab
  277. Sep 17 12:32:57 <jak2000> :)
  278. Sep 17 12:32:59 <jak2000> checking
  279. Sep 17 12:32:59 <L8D> jak2000: https://en.wikipedia.org/wiki/Chinese_punctuation
  280. Sep 17 12:33:19 <L8D> well that's not chinese, but whatev
  281. Sep 17 12:33:28 <L8D> my guess is it's some utf-8 whitespace black-magic
  282. Sep 17 12:33:32 <ThePendulum> 'lo deltab
  283. Sep 17 12:33:47 <deltab> ThePendulum: do you work out your fuzzy matching problem?
  284. Sep 17 12:34:19 <deltab> jak2000: console.log(encodeURIComponent(this.text))
  285. Sep 17 12:34:35 <ThePendulum> deltab: not efficiently. I'm overthinking the entire logic again anyway
  286. Sep 17 12:34:47 <hashtag__> ThePendulum, deltab: What should be fuzzily matched? :)
  287. Sep 17 12:34:51 <deltab> jak2000: (or as a watch, however you want to do it)
  288. Sep 17 12:35:41 <deltab> ThePendulum: maybe round the number used as the key, and check the two closest
  289. Sep 17 12:37:08 <hashtag__> ThePendulum: what are you trying to achieve?
  290. Sep 17 12:37:22 <persina> I keep forgetting...how do I write this if graph is a variable> "results.append("<img src='graph'>");"
  291. Sep 17 12:39:20 <ThePendulum> hashtag__: I have a lookup object with exact coordinates as keys and I need to find the exact keys with a rough y-coordinate
  292. Sep 17 12:39:24 <ThePendulum> there is a 0.01 margin
  293. Sep 17 12:39:36 <hashtag__> ThePendulum: google maps api and such?
  294. Sep 17 12:39:43 <ThePendulum> I guess I could round them
  295. Sep 17 12:39:44 <ThePendulum> oh no
  296. Sep 17 12:39:46 <hashtag__> don't the open street maps and similar geo databases got this kind of look up supported?
  297. Sep 17 12:39:48 <ThePendulum> PDFs
  298. Sep 17 12:39:50 <hashtag__> oh
  299. Sep 17 12:40:03 <hashtag__> so you got x,y coords and you want to find out the element the coords point to?
  300. Sep 17 12:40:09 <hashtag__> or an element roughly next to it?
  301. Sep 17 12:40:16 <hashtag__> ah, this is for the pdf email software you told me, right?
  302. Sep 17 12:40:22 <ThePendulum> yeah
  303. Sep 17 12:40:29 <hashtag__> there is existing commercial software that does exactly this with pdfs
  304. Sep 17 12:40:35 <ThePendulum> oh?
  305. Sep 17 12:40:45 <ThePendulum> which is?
  306. Sep 17 12:41:32 <hashtag__> http://www.pdf-tools.com/pdf/pdf-extract-content-metadata-text.aspx
  307. Sep 17 12:42:11 <ThePendulum> that tool won't know what it's reading either
  308. Sep 17 12:42:22 <ThePendulum> all it can tell me is that the text exists at x,y which I already know
  309. Sep 17 12:42:27 <deltab> ggVGc: hmm? you can listen for an event at any time
  310. Sep 17 12:42:32 <hashtag__> http://www.interhacktives.com/2014/03/12/extract-data-pdf/
  311. Sep 17 12:42:35 <ThePendulum> the challenge here is to tell my tool that the text at x,y is an address or an order quantity
  312. Sep 17 12:43:02 <hashtag__> ThePendulum: you got database table fields, so you clean up the element text and then you insert it?
  313. Sep 17 12:43:05 <R13ose> How do I reverse the slideshow images so they slide to the right instead of the left on this page: http://smtc.com/ ?
  314. Sep 17 12:43:24 <ThePendulum> hashtag__: first I need to find the right text in the huge stack of texts :P
  315. Sep 17 12:43:37 <hashtag__> ThePendulum: regexp :)
  316. Sep 17 12:43:42 <ThePendulum> hashtag__: and Tabula is not useful here because it's a manual tool
  317. Sep 17 12:43:50 <ThePendulum> I'm not sure how regex can help me here
  318. Sep 17 12:43:51 <deltab> ggVGc: I'm probably missing what you mean
  319. Sep 17 12:44:07 <hashtag__> ThePendulum: there must be a pattern in the data - otherwise it isn't automatable anyway (which I don't think)
  320. Sep 17 12:44:15 <ThePendulum> not in the text
  321. Sep 17 12:44:19 <hashtag__> why not?
  322. Sep 17 12:44:20 <ThePendulum> there is a pattern in the coordinates
  323. Sep 17 12:44:23 <ThePendulum> but regex can't help me with that
  324. Sep 17 12:44:36 <deltab> sharkhat: see that 'data:' at the start? the whole PDF is in the URL, encoded in base64
  325. Sep 17 12:44:38 <ThePendulum> because when you order a car, it won't have the same order description as when I order a pot of peanutbutter
  326. Sep 17 12:44:47 <hashtag__> so there is only one element which contains lots of text - so now you need to extract the text
  327. Sep 17 12:44:52 <ThePendulum> and the quantity '20' could also be part of a phone number
  328. Sep 17 12:44:55 <hashtag__> from this one element
  329. Sep 17 12:44:56 <hashtag__> aha
  330. Sep 17 12:45:09 <deltab> sharkhat: is that a page you're generating?
  331. Sep 17 12:45:13 <hashtag__> so the only pattern is the position of the text of this single element
  332. Sep 17 12:45:18 <ThePendulum> the only way for me to know what text has what meaning is by looking at the original PDF, and establishing a profile with exact coordinates
  333. Sep 17 12:45:38 <ThePendulum> "between 20 and 40 y you will find orders with each row starting at 7.49 x"
  334. Sep 17 12:45:41 <hashtag__> the easiest thing which comes to mind would be probably macroing the mouse to drag-select at that position
  335. Sep 17 12:45:56 <ThePendulum> that requires a manual action
  336. Sep 17 12:46:01 <hashtag__> ThePendulum: the pdf lib API you are using doesn't offer a method for this?
  337. Sep 17 12:46:10 <ThePendulum> well, no
  338. Sep 17 12:46:20 <hashtag__> could there be a better suited pdf api?
  339. Sep 17 12:46:23 <ThePendulum> no
  340. Sep 17 12:46:27 <hashtag__> oh damn
  341. Sep 17 12:46:32 <ThePendulum> this is already very useful
  342. Sep 17 12:46:43 <ThePendulum> I just need to find the most efficient way to search the stack
  343. Sep 17 12:46:49 <hashtag__> so you get the text of that element and now you have to find out where the part of text is that wold be on that position
  344. Sep 17 12:46:59 <ThePendulum> I have absolutely no issue finding these elements, it already works in v1 of this tool
  345. Sep 17 12:47:16 <ThePendulum> but now there are a few more variables to take into account
  346. Sep 17 12:47:20 <hashtag__> hm
  347. Sep 17 12:47:24 <ThePendulum> hashtag__: I have the text and the position
  348. Sep 17 12:47:30 <ThePendulum> and I have a profile that tells me the position and its meaning
  349. Sep 17 12:47:35 <hashtag__> so you have to find out what kind of combination it is ?
  350. Sep 17 12:47:43 <ThePendulum> so I need to compare this huge stack of random texts to the profile
  351. Sep 17 12:47:44 <hashtag__> like two text fields with this kind of text means bill of this kind
  352. Sep 17 12:47:57 <hashtag__> aha
  353. Sep 17 12:48:10 <hashtag__> you iterate over the elements and check whether they are the elements for the given position?
  354. Sep 17 12:48:10 <ThePendulum> I have a profile that tells me the phone number is at [12.04, 13.564] for example
  355. Sep 17 12:48:15 <ThePendulum> yeah
  356. Sep 17 12:48:17 <hashtag__> o
  357. Sep 17 12:48:19 <hashtag__> ok
  358. Sep 17 12:48:25 <ThePendulum> which isn't too hard for things like single phone numbers
  359. Sep 17 12:48:30 <hashtag__> and the pdf api got no such function "give me element at position xy"
  360. Sep 17 12:48:35 <hashtag__> you have to make it yourself
  361. Sep 17 12:48:35 <ThePendulum> because that's 1 item at a fixed position for every single invoice
  362. Sep 17 12:48:49 <ThePendulum> well that's not hard
  363. Sep 17 12:48:51 <hashtag__> hm, a for loop over the items and checking the position?
  364. Sep 17 12:48:52 <hashtag__> ok
  365. Sep 17 12:48:56 <ThePendulum> the fun part is orders
  366. Sep 17 12:48:59 <morenoh149> does anyone think phantomjs is good enough. Or do you really want to test your site against real browsers?
  367. Sep 17 12:49:06 <ThePendulum> because there might be 1 order, there might be 20 orders
  368. Sep 17 12:49:14 <hashtag__> morenoh149: a real end to end test would involve real browsers the end users are using
  369. Sep 17 12:49:14 <ThePendulum> and they might be on 1 row or 2
  370. Sep 17 12:49:19 <ThePendulum> and they might be in columns or not
  371. Sep 17 12:49:23 <hashtag__> ThePendulum: oh god
  372. Sep 17 12:49:49 <ThePendulum> so what I do at the moment is find the x-coordinate of any order, which is the same for every order but otherwise unique in the invoice
  373. Sep 17 12:50:03 <hashtag__> I see
  374. Sep 17 12:50:06 <ThePendulum> then I'll also know its y-coordinate, and I know the rest of the row will have the same y-coordinate
  375. Sep 17 12:50:12 <ThePendulum> so I need to search the stack for that y-coordinate
  376. Sep 17 12:50:17 <deltab> morenoh149: it's not one or the other: use one for speed, and the other for accuracy
  377. Sep 17 12:50:18 <hashtag__> for loop?
  378. Sep 17 12:50:29 <hashtag__> nested foor lop? :P
  379. Sep 17 12:50:31 <hashtag__> loop
  380. Sep 17 12:50:32 <ThePendulum> hashtag__: yes, I could just go through the original stack a million times until I have all the data
  381. Sep 17 12:50:36 <ThePendulum> but that's very expensive
  382. Sep 17 12:50:40 <hashtag__> aha
  383. Sep 17 12:50:45 <hashtag__> you can use a hash or something like that
  384. Sep 17 12:50:51 <ThePendulum> so I'm trying to figure out how to reduce the amount of lookups and the expense of each lookup
  385. Sep 17 12:50:52 <hashtag__> for a cheap look up of a particular field
  386. Sep 17 12:50:59 <hashtag__> a small internal database may help
  387. Sep 17 12:51:04 <morenoh149> I guess accuracy trumps in my case. it's just such a hassle to set up selenium
  388. Sep 17 12:51:15 <hashtag__> morenoh149: true, though there are paid services for this
  389. Sep 17 12:52:17 <ThePendulum> hashtag__: the lovely thing I just discovered is also that an order may have optional fields. so I can't just say "grab all items from this row" and map them to the meaning of those items. I have to check whether there are optional fields
  390. Sep 17 12:52:31 <ThePendulum> because if there is data missing in a row it'll offset the entire map
  391. Sep 17 12:53:31 <ThePendulum> it's all not very difficult to pull off
  392. Sep 17 12:53:37 <ThePendulum> but it's tricky to do it efficiently
  393. Sep 17 12:53:41 <hassoon> anyone who can tell me why isn't that said bootstrap modal with the id #myModal hiding when i ask it hide ? http://pastebin.ca/3163906
  394. Sep 17 12:54:05 <ThePendulum> come again?
  395. Sep 17 12:54:07 <R13ose> Any thoughts on my question?
  396. Sep 17 12:54:41 <ThePendulum> R13ose: why do you want them sliding to the right? that'd feel a bit unnatural
  397. Sep 17 12:54:51 <ThePendulum> R13ose: none the least, what library are you using for it?
  398. Sep 17 12:56:01 <morenoh149> ah it's not so bad. selenium delivers a jar with all the browsers bundled
  399. Sep 17 12:56:36 <ThePendulum> a physical jar?
  400. Sep 17 12:56:39 <ThePendulum> oh, java?
  401. Sep 17 12:56:59 <hashtag__> R13ose: ah hi
  402. Sep 17 12:57:08 <hashtag__> morenoh149: docker may be your friend
  403. Sep 17 12:58:09 <L8D> ThePendulum: they package all the browsers up into a mason jar and ship it to your home
  404. Sep 17 12:58:32 <R13ose> ThePendulum: Bootstrap. This is what is asked of me, " slides now auto slide to left. need to reverse to slides to right."
  405. Sep 17 12:58:37 <R13ose> hashtag__: hi
  406. Sep 17 12:58:42 <graphettion> Can someone help me out? I'm not sure exactly how to put this string back together. - https://jsfiddle.net/ekt2ee0z/1/
  407. Sep 17 12:58:51 <ThePendulum> R13ose: but that's not how it works
  408. Sep 17 12:58:54 <hashtag__> mason jar :O
  409. Sep 17 12:58:59 <ThePendulum> that's not how any of this works
  410. Sep 17 12:59:52 <R13ose> ThePendulum: Thanks for letting me know and I will let people know that but can this be reversed anyways?
  411. Sep 17 12:59:54 <ThePendulum> R13ose: There should be a cycle function somewhere in Bootstrap
  412. Sep 17 13:00:01 <hassoon> anyone who can tell me why isn't that said bootstrap modal with the id #myModal hiding when i ask it to hide ? http://pastebin.ca/3163906 :p
  413. Sep 17 13:00:08 <L8D> graphettion: you can do: strArray[i] = firstLetters + strArray[i].slice(1);
  414. Sep 17 13:00:18 <ThePendulum> R13ose: You can copy it and change 'next' to 'prev' and vice versa I think
  415. Sep 17 13:00:23 <deltab> graphettion: concatenate the capital with the rest of the word
  416. Sep 17 13:00:38 <ThePendulum> R13ose: not how to let it start at the right slide though
  417. Sep 17 13:00:40 <sharkhat> deltab: yes it is autogenerating, sorry i was away
  418. Sep 17 13:01:08 <L8D> graphettion: or: strArray[i] = firstLetters + strArray[i].slice(1).toLowerCase();
  419. Sep 17 13:01:18 <ThePendulum> R13ose: you want it to actually cycle the other way, right? not just reverse the order of the images?
  420. Sep 17 13:01:46 <R13ose> ThePendulum: Give me a sec
  421. Sep 17 13:01:58 <ThePendulum> R13ose: http://responsivebp.com/javascript/carousel/
  422. Sep 17 13:02:04 <ThePendulum> R13ose: this plugin allows you to reverse direction by the looks of it
  423. Sep 17 13:02:08 <ThePendulum> natively
  424. Sep 17 13:02:28 <L8D> "natively"
  425. Sep 17 13:02:34 <ThePendulum> although
  426. Sep 17 13:02:42 <ThePendulum> I think it actually just reverses the way the buttons work
  427. Sep 17 13:02:50 <deltab> sharkhat: what sort of URL do you want it to have?
  428. Sep 17 13:02:54 <ThePendulum> so > moves the slide to the right
  429. Sep 17 13:03:04 <sharkhat> name of the product would be nice
  430. Sep 17 13:03:15 <R13ose> ThePendulum: This is what I found: http://getbootstrap.com/javascript/#carousel Client asked to reverse the auto direction of slideshow.
  431. Sep 17 13:03:20 <ThePendulum> I wonder if it wouldn't be easier to just swap your left and right brain halfs
  432. Sep 17 13:03:28 <ThePendulum> I don't think it works like that either but it might be easier to try
  433. Sep 17 13:03:52 <deltab> sharkhat: I mean is it to be served over http or what?
  434. Sep 17 13:03:58 <R13ose> ThePendulum: are you saying I shouldn't do this and tell the client not to do this?
  435. Sep 17 13:03:59 <sharkhat> yes
  436. Sep 17 13:04:13 <ThePendulum> R13ose: that, yes, even if you do end up finding a way
  437. Sep 17 13:04:19 <ThePendulum> I'd really urge them not to
  438. Sep 17 13:04:33 <ThePendulum> because it's rather unnatural, the lack of support in these modules gives a clue as well
  439. Sep 17 13:04:34 <deltab> sharkhat: so the server will have to generate it?
  440. Sep 17 13:04:44 <sharkhat> client side generated
  441. Sep 17 13:04:58 <jerv_> What is a reasonable way to test if a string contains at least one tab?
  442. Sep 17 13:05:03 <ThePendulum> R13ose: but if they're like "m8 I'll throw another $100 at you" then consider to ignore your instinct
  443. Sep 17 13:05:17 <ThePendulum> but they'll probably want you to pay for not doing it the wrong way right away
  444. Sep 17 13:05:25 <R13ose> ThePendulum: did you look at events direction in the page I showed you?
  445. Sep 17 13:05:47 <deltab> sharkhat: the client can only make data: and blob: urls
  446. Sep 17 13:05:48 <ThePendulum> R13ose: well, does it work?
  447. Sep 17 13:05:57 <ThePendulum> R13ose: eh
  448. Sep 17 13:06:00 <ThePendulum> R13ose: no, that won't do what you want
  449. Sep 17 13:06:14 <ThePendulum> R13ose: that just tells you whether the carousel is sliding to the left or the right
  450. Sep 17 13:06:25 <ThePendulum> it doesn't affect anything, it's an event
  451. Sep 17 13:06:25 <R13ose> ThePendulum: I thought so, just was checking.
  452. Sep 17 13:06:58 <ThePendulum> you can slide it from right to left manually hence the indication in the event
  453. Sep 17 13:07:00 <graphettion> deltab, L8D: Thank you! I just needed to know to concatenate them.
  454. Sep 17 13:07:06 <ThePendulum> but the automatic cycle doesn't seem configurable
  455. Sep 17 13:08:12 <jimminimy> Does anyone know how I can apply text as a behavior in IE8 at runtime? Rather than -ms-behavior: url(behavior.htc); I have the contents of the file as a string. Is there anyway to get it in there?
  456. Sep 17 13:09:23 <deltab> jimminimy: does it support data:?
  457. Sep 17 13:09:24 <Impaloo> graphettion: http://goo.gl/Z20clV
  458. Sep 17 13:09:45 <Impaloo> es6 gives me the tingles
  459. Sep 17 13:10:02 <jimminimy> deltab: I've been trying to figure it out for a while. Looks like IE8 does support data - I haven't been able to get the format right
  460. Sep 17 13:11:00 <R13ose> ThePendulum: from what the client said, what do you assume they mean?
  461. Sep 17 13:12:44 <ThePendulum> R13ose: what did they tell you exactly?
  462. Sep 17 13:14:21 <jimminimy> deltab: -ms-behavior: url(data:text/x-component;base64,...) that's what it looks like in the style
  463. Sep 17 13:16:15 <persina> Is there a javascript method that converts a string to a valid url?
  464. Sep 17 13:16:51 <R13ose> ThePendulum: the above what I said to you
  465. Sep 17 13:17:32 <samssh> persina, A valid URL is stored as a string. What is the format of the data you want to convert into a URL?
  466. Sep 17 13:18:10 <persina> samssh: Like it converts spaces into "%20" and things like that
  467. Sep 17 13:18:48 <sunya7a> I would like to drag an object (let's say rectangle) over some text and then have that text highlighted over which I drop the rectangle. Any suggestions on how I might be able to accomplish this?
  468. Sep 17 13:18:54 <samssh> persina, So you need it encoded. I think there is a method to suit.
  469. Sep 17 13:18:58 <samssh> !mdn url encode
  470. Sep 17 13:18:59 <ecmabot> samssh: encodeURIComponent() - JavaScript | MDN <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent>
  471. Sep 17 13:19:14 <Impaloo> sunya7a: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Drag_and_drop is a good start
  472. Sep 17 13:19:59 <Impaloo> sunya7a: basically, you define an element to be "draggable" through HTMl5 attribute, then there are native browser events when an element is being dragged over
  473. Sep 17 13:20:21 <Impaloo> so you can document.querySelector('.my-text').on('dragover', function () { // omg! })
  474. Sep 17 13:20:32 <samssh> persina, It's that or https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI
  475. Sep 17 13:20:38 <sunya7a> Impaloo, thank you. I will give that a read
  476. Sep 17 13:20:46 <samssh> persina, I honestly don't remember the difference right now.
  477. Sep 17 13:24:32 <ThePendulum> R13ose: I'm not sure what you're referring to
  478. Sep 17 13:24:36 <ThePendulum> would you mind repeating it?
  479. Sep 17 13:25:21 <R13ose> ThePendulum: this is what they asked "to reverse the auto direction of slideshow."
  480. Sep 17 13:25:53 <ThePendulum> yes, that's going to require you to rewrite bootstrap's cycle function by the looks of it
  481. Sep 17 13:26:01 <R13ose> ThePendulum: thanks.
  482. Sep 17 13:26:09 <ThePendulum> and I'd recommend discouraging your client
  483. Sep 17 13:26:20 <R13ose> ThePendulum: I am doing that now.
  484. Sep 17 13:28:51 <loa> hello, how i can debug js code running from as3 flash? i have chromium, all my tries to set some breakpoints no working.
  485. Sep 17 13:29:27 <R13ose> ThePendulum: what about http://stackoverflow.com/questions/16877562/twitter-bootstrap-carousel-cycle-items-right-to-left-rtl-reversed Would that help me in anyway?
  486. Sep 17 13:30:53 <ThePendulum> R13ose: that's what I'm saying, rewrite the cycle function to do what you want :P
  487. Sep 17 13:31:01 <ThePendulum> that's the accepted answer there as well
  488. Sep 17 13:31:37 <ThePendulum> it's a 2½ year old answer though, so I wouldn't just copy that
  489. Sep 17 13:32:18 <ThePendulum> R13ose: copy that function, add it back as cycleReversed or something, and make the necessary changes
  490. Sep 17 13:32:28 <R13ose> ThePendulum: the updated answer is from Feb 22.
  491. Sep 17 13:32:33 <ThePendulum> thus reverse the image order and call .next and .prev the other way round
  492. Sep 17 13:32:43 <ThePendulum> still, carefully assess the method as it is in your source
  493. Sep 17 13:33:26 <R13ose> ThePendulum: You are saying this will work in the end?
  494. Sep 17 13:33:50 <ThePendulum> it probably will, it'll just feel unnatural to use
  495. Sep 17 13:33:58 <ThePendulum> hence disregarding, I'd discourage your client to use it
  496. Sep 17 13:34:13 <ThePendulum> don't get me started on carousels in general :P
  497. Sep 17 13:34:15 <R13ose> ThePendulum: great
  498. Sep 17 13:34:22 <R13ose> ThePendulum: I want to hear
  499. Sep 17 13:34:44 <ThePendulum> afaik there have been multiple studies literally no one actually sees the information they provide
  500. Sep 17 13:34:58 <ThePendulum> http://shouldiuseacarousel.com/
  501. Sep 17 13:35:41 <ThePendulum> so yeah, use them if you get paid for it
  502. Sep 17 13:36:16 <R13ose> ThePendulum: I have seen that site before. What should I use instead?
  503. Sep 17 13:37:11 <ThePendulum> I imagine a gallery that makes all items visible at once
  504. Sep 17 13:37:20 <ThePendulum> might want to consult #design or #web for that
  505. Sep 17 13:37:34 <cjohnson> just show the content all on the page
  506. Sep 17 13:37:43 <ThePendulum> webshops and the like aren't really my expertise
  507. Sep 17 13:37:59 <cjohnson> there's really no reason to "slide through" content. people have scrollbars for a reason
  508. Sep 17 13:38:18 <cjohnson> if it must be broken up, use actual pagination
  509. Sep 17 13:39:40 <jimminimy> After doing some googling, I came across this: http://stackoverflow.com/questions/1145861/has-anyone-gotten-ie8-to-read-dhtml-behaviors-encoded-as-base64d-data-uris
  510. Sep 17 13:39:59 <jimminimy> Is that to say there's no way to do what I want to do?
  511. Sep 17 13:40:25 <cjohnson> did you read the answer? sounds like it's pretty clear
  512. Sep 17 13:40:43 <jimminimy> Since apparently it won't work even if I figure out how to inject it dynamically.
  513. Sep 17 13:43:38 <Fleuv> Hixon10, Could some one tell me why my element doesn't give away certain css properties (height in this case).
  514. Sep 17 13:43:44 <Fleuv> HI***
  515. Sep 17 13:44:18 <cjohnson> Fleuv: and your code is...?
  516. Sep 17 13:44:29 <Fleuv> cjohnson, let me make an example :D
  517. Sep 17 13:49:00 <Fleuv> Sorry guys (cjohnson), I hope this clears things up: http://jsfiddle.net/vzwfcpt6/
  518. Sep 17 13:49:18 <Fleuv> height is 0.
  519. Sep 17 13:49:33 <Fleuv> or null..
  520. Sep 17 13:50:27 <ThePendulum> >> 0 === null
  521. Sep 17 13:50:27 <ecmabot> ThePendulum: (boolean) false
  522. Sep 17 13:50:52 <tcsc> Fleuv: needs to be '.element'
  523. Sep 17 13:50:59 <R13ose> ThePendulum: thanks for all the help. The person who is talking to the client said they will consult the client.
  524. Sep 17 13:51:36 <ThePendulum> xD
  525. Sep 17 13:52:07 <ThePendulum> reminds me of that game you'd play in elementary school where you'd tell a fib to someone next to you and let it go round a circle of kids
  526. Sep 17 13:52:13 <ThePendulum> and by the end of it you'd get a completely different message
  527. Sep 17 13:52:41 <Fleuv> tcsc, thanks I guess I screamed to early ;)
  528. Sep 17 13:54:35 <R13ose> afk
  529. Sep 17 14:00:26 <samssh> ThePendulum, Telephone!
  530. Sep 17 14:02:17 <samssh> But there's always that kid who says the wrong thing on purpose.
  531. Sep 17 14:08:05 <Rabbles> << ([1,2,3] === [1,2,3])
  532. Sep 17 14:08:54 <Rabbles> >> ([1,2,3] === [1,2,3])
  533. Sep 17 14:08:54 <ecmabot> Rabbles: (boolean) false
  534. Sep 17 14:09:06 <Rabbles> Why isn't that true?
  535. Sep 17 14:09:39 <deltab> Impaloo: what's the content of http://goo.gl/Z20clV ?
  536. Sep 17 14:09:43 <Rabbles> >> ([] === [])
  537. Sep 17 14:09:43 <ecmabot> Rabbles: (boolean) false
  538. Sep 17 14:09:45 <Rabbles> :(
  539. Sep 17 14:10:32 <ThePendulum> samssh: yeah we'd consistently get "Mrs. Robin is a cunt" at the end, it was suspicious
  540. Sep 17 14:11:01 <ThePendulum> >> [] === []
  541. Sep 17 14:11:01 <ecmabot> ThePendulum: (boolean) false
  542. Sep 17 14:11:02 <samssh> !
  543. Sep 17 14:11:06 <ThePendulum> I mean why would it be true
  544. Sep 17 14:11:16 <ThePendulum> >> 'hello' === 'hello'
  545. Sep 17 14:11:16 <ecmabot> ThePendulum: (boolean) true
  546. Sep 17 14:11:54 <Rabbles> ThePendulum, Because they're both empty arrays? Why is it false is my question
  547. Sep 17 14:11:59 <samssh> Rabbles, === doesn't compare the objects, it compares the reference to the objects.
  548. Sep 17 14:12:00 <Rabbles> >> ([] == [])
  549. Sep 17 14:12:00 <ecmabot> Rabbles: (boolean) false
  550. Sep 17 14:12:05 <ThePendulum> Rabbles: but you're creating a new array
  551. Sep 17 14:12:14 <ThePendulum> even if it's empty, they're not the same array
  552. Sep 17 14:12:19 <samssh> (arrays are objects BTW)
  553. Sep 17 14:12:20 <ThePendulum> you can compare the values and conclude it is
  554. Sep 17 14:12:33 <ThePendulum> >> {} === {}
  555. Sep 17 14:12:33 <ecmabot> ThePendulum: SyntaxError: syntax error
  556. Sep 17 14:12:34 <samssh> >>{} === {}
  557. Sep 17 14:12:34 <ecmabot> samssh: SyntaxError: syntax error
  558. Sep 17 14:12:36 <ThePendulum> xD
  559. Sep 17 14:12:39 <ThePendulum> >> [] == []
  560. Sep 17 14:12:39 <ecmabot> ThePendulum: (boolean) false
  561. Sep 17 14:12:44 <Havvy> >> ({} === {})j
  562. Sep 17 14:12:44 <ecmabot> Havvy: SyntaxError: missing ; before statement
  563. Sep 17 14:12:45 <samssh> ThePendulum, High five!
  564. Sep 17 14:12:46 <Havvy> >> ({} === {})
  565. Sep 17 14:12:46 <ecmabot> Havvy: (boolean) false
  566. Sep 17 14:12:57 <ThePendulum> >> [O]__[O]
  567. Sep 17 14:12:57 <ecmabot> ThePendulum: SyntaxError: missing ; before statement
  568. Sep 17 14:13:15 <Havvy> `{} === {}` parses as `[empty block, triple equality operator, empty object]`
  569. Sep 17 14:13:17 <Rabbles> Ok sure but with 'hello' === 'hello' you're creating two separate string objects aren't you?
  570. Sep 17 14:13:36 <Rabbles> why wouldn't == work?
  571. Sep 17 14:13:36 <deltab> Rabbles: not objects, no
  572. Sep 17 14:13:42 <samssh> Rabbles, Strings are treated as primitives unless you specify otherwise.
  573. Sep 17 14:13:44 <ThePendulum> >> samssh === 'sassy'
  574. Sep 17 14:13:44 <ecmabot> ThePendulum: (boolean) true
  575. Sep 17 14:13:50 <samssh> You know it
  576. Sep 17 14:13:58 <Rabbles> lmao
  577. Sep 17 14:14:51 <Rabbles> Is there a way to quickly compare two arrays?
  578. Sep 17 14:15:33 <ThePendulum> Array.prototype.every() might be able to help out
  579. Sep 17 14:15:36 <ThePendulum> if you want to know if they're equal
  580. Sep 17 14:15:42 <ThePendulum> if you're looking for the difference, that won't help
  581. Sep 17 14:16:14 <ThePendulum> however, Array.prototype.filter() would :P
  582. Sep 17 14:16:39 <samssh> Rabbles, It also depends on what he array contains. And array of objects would need to be compared recursively.
  583. Sep 17 14:16:45 <samssh> *An
  584. Sep 17 14:16:51 <Rabbles> Ew :(
  585. Sep 17 14:17:05 <samssh> Yeah
  586. Sep 17 14:18:12 <samssh> Rabbles, So it depends on the context for the compare. Sometimes using .every() might be fine with numbers, string, or objects that define an .equal method (or similar).
  587. Sep 17 14:18:30 <Rabbles> I'm surprised there isn't a way to shallowly compare two arrays that doesn't involve a callback.
  588. Sep 17 14:18:37 <Rabbles> Not that it's a big inconvenience, just surprising
  589. Sep 17 14:18:41 <samssh> I usually just try to avoid comparing arrays in JS.
  590. Sep 17 14:19:01 <ThePendulum> yeah I'm writing a shallow compare function
  591. Sep 17 14:19:10 <Drewery> anybody opinionated on grunt vs gulp
  592. Sep 17 14:19:11 <steven10172> Is this the most efficient way to go about resetting an object to some default values while keep reference? http://pastebin.com/ddm1J6UM
  593. Sep 17 14:19:12 <ThePendulum> why would it involve a callback?
  594. Sep 17 14:19:18 <ThePendulum> Drewery: pick whatever makes the most sense to you
  595. Sep 17 14:19:24 <ThePendulum> it's an endless debate
  596. Sep 17 14:19:39 <Drewery> ThePendulum: agreed I was just bored, I am sorry :\
  597. Sep 17 14:19:42 <samssh> Drewery, I like gulp
  598. Sep 17 14:19:54 <Drewery> yeah so far I like gulp as well
  599. Sep 17 14:20:19 <edgarjoya> Hey
  600. Sep 17 14:20:26 <edgarjoya> everyone
  601. Sep 17 14:20:38 <edgarjoya> has anyone done in-context paypal integration popup with meteor
  602. Sep 17 14:20:49 <edgarjoya> https://developer.paypal.com/docs/classic/express-checkout/in-context/integration/
  603. Sep 17 14:22:36 <deltab> Rabbles: http://es5.github.io/x11.html#x11.9.3
  604. Sep 17 14:22:37 <graphettion> I suck so bad at basic javascript algorithms :/
  605. Sep 17 14:23:06 <ThePendulum> Rabbles: http://jsfiddle.net/ThePendulum/y1vdLjp6/
  606. Sep 17 14:23:07 <ThePendulum> shallow compare
  607. Sep 17 14:23:20 <ThePendulum> might be a better way really
  608. Sep 17 14:25:19 <ThePendulum> Rabbles: http://jsfiddle.net/ThePendulum/y1vdLjp6/
  609. Sep 17 14:25:22 <ThePendulum> that one finds the 'odd one out'
  610. Sep 17 14:25:33 <ThePendulum> which I think might be more accurate
  611. Sep 17 14:25:36 <ThePendulum> eh, accurate
  612. Sep 17 14:25:41 <ThePendulum> closer to what you'd expect it to do
  613. Sep 17 14:25:51 <ThePendulum> anyway, I can't think of a use for them, and they'd need improvement
  614. Sep 17 14:26:05 <Rabbles> ThePendulum, http://jsfiddle.net/ThePendulum/y1vdLjp6/
  615. Sep 17 14:26:31 <Rabbles> I mean http://jsfiddle.net/y1vdLjp6/2/
  616. Sep 17 14:26:59 <Rabbles> Sure I can do that. I though modifying DOM objects like that is bad idea
  617. Sep 17 14:27:09 <falafel> what DOM objects?
  618. Sep 17 14:27:17 <hackal> Hello, I am appending my own '<style>...</style>' to head with jQuery. However the CSS is being applied with delay. I understand this is due to CSS being added by JavaScript but I would like to ask if there is any way to eliminate or reduce the delay as much as I can. Any advice appreciated
  619. Sep 17 14:27:23 <ThePendulum> Rabbles: yes, that'll also work
  620. Sep 17 14:27:26 <falafel> Extending native prototypes is not a good idea if that's what you meant
  621. Sep 17 14:28:04 <Rabbles> That is what I meant thanks
  622. Sep 17 14:28:11 <django_> hey
  623. Sep 17 14:28:16 <django_> whats the syntax error here: http://pastebin.com/rCMK4CxV
  624. Sep 17 14:28:18 <django_> (small piece of code)
  625. Sep 17 14:28:33 <django_> error: SyntaxError: missing ) after argument list
  626. Sep 17 14:28:41 <falafel> django_, missing ) in line 5
  627. Sep 17 14:28:45 <falafel> follow open closing parens
  628. Sep 17 14:28:46 <django_> why
  629. Sep 17 14:28:54 <falafel> (function(data){}
  630. Sep 17 14:28:56 <falafel> missing )
  631. Sep 17 14:29:05 <django_> since when
  632. Sep 17 14:29:27 <falafel> since forever, pernes must match on both sides
  633. Sep 17 14:29:29 <falafel> *parens
  634. Sep 17 14:29:36 <larrydavid> Hi. Not a webdev so bear with me. I'd like to make a webapp which fetches status data from a server, and displays it on the screen. Data is associated with an entity shown as an icon on a map, user clicks on an icon to view the full status data for that. There's authentication of multiple users, permission to view certain types of data, etc. Now it's clear I'll need Javascript to show this
  635. Sep 17 14:29:36 <larrydavid> in the browser, but any suggestions on what to use in the back-end to make my life easy?
  636. Sep 17 14:29:38 <Rabbles> DOM Objects are the javascript objects created from parsing the HTML document?
  637. Sep 17 14:30:03 <larrydavid> Wikipedia is not giving enough information to answer that question
  638. Sep 17 14:30:05 <falafel> django_, your editor must have a way to go to the next open/closing match, in Vim for example you do %
  639. Sep 17 14:30:21 <falafel> if it is not there when you do that, or jumps to a location you didn't expect, then it is missing
  640. Sep 17 14:30:45 <deltab> Rabbles: yes (though they're not specifically *javascript* objects)
  641. Sep 17 14:31:01 <django_> falafel: ok..now i get an error for return data; SyntaxError: expected expression, got keyword 'return'
  642. Sep 17 14:31:27 <falafel> django_, what your code look like now?
  643. Sep 17 14:31:39 <graphettion> I don't even know how to attempt this, lol - https://jsfiddle.net/L20rthze/
  644. Sep 17 14:31:50 <larrydavid> did my question go through? I'm not sure if I logged in in time
  645. Sep 17 14:31:59 <django_> falafel: http://pastebin.com/W39qqgZj
  646. Sep 17 14:32:25 <Hannibal_Smith> Rabbles, https://developer.mozilla.org/en-US/docs/Web/JavaScript/JavaScript_technologies_overview contains a good definition
  647. Sep 17 14:32:26 <django_> larrydavid: use nodejs
  648. Sep 17 14:32:30 <falafel> django_, now it is just invalid syntax
  649. Sep 17 14:32:36 <falafel> django_, what happened to the braces?
  650. Sep 17 14:32:41 <deltab> "function(data) (" is wrong
  651. Sep 17 14:32:49 <django_> ...
  652. Sep 17 14:32:54 <django_> i thought it was {} --> ()
  653. Sep 17 14:32:59 <django_> missing "(
  654. Sep 17 14:33:00 <falafel> django_, best practice to never forget punctuation, write it all first
  655. Sep 17 14:33:13 <falafel> django_, .success(function(){})
  656. Sep 17 14:33:21 <django_> http://pastebin.com/rCMK4CxV
  657. Sep 17 14:33:23 <django_> where is the mstake here
  658. Sep 17 14:33:31 <django_> ahh
  659. Sep 17 14:33:34 <django_> lets see
  660. Sep 17 14:34:07 <larrydavid> django_: my worry with Node.js is that all the ecosystem consists of a few github projects mentioned in random stackoverflow posts and blog posts. There's no real documentation tying everything together.
  661. Sep 17 14:34:27 <deltab> django_: match each ( and { with its pair
  662. Sep 17 14:34:28 <larrydavid> I'm a bit scared to jump in because of that.
  663. Sep 17 14:34:39 <falafel> larrydavid, what do you mean?
  664. Sep 17 14:34:51 <falafel> larrydavid, there is plenty of documentation here https://nodejs.org/api/
  665. Sep 17 14:35:11 <larrydavid> not for Node itself, but for all the stuff on top of Node that one would use to save time
  666. Sep 17 14:35:13 <django_> larrydavid: nodejs is documented and works great
  667. Sep 17 14:35:16 <django_> wal mart funded it i htikn lol
  668. Sep 17 14:35:17 <larrydavid> like Express.js's wikipedia page has 2 sentences.
  669. Sep 17 14:35:25 <django_> yeah i feel you
  670. Sep 17 14:35:26 <larrydavid> so when I was researching earlier, I discarded it
  671. Sep 17 14:35:27 <django_> i also had doubts
  672. Sep 17 14:35:33 <falafel> larrydavid, mmm, Express... plenty of docs as well http://expressjs.com/4x/api.html
  673. Sep 17 14:35:35 <django_> so i asked and ppl say its good
  674. Sep 17 14:35:52 <django_> falafel and deltab ty!
  675. Sep 17 14:35:55 * hugdru
  676. Sep 17 14:36:13 <larrydavid> falafel: yeah I know I was just worried. So you're seconding django's recommandation of Node.js?
  677. Sep 17 14:36:27 <falafel> larrydavid, recommendation for what? I missed that part...
  678. Sep 17 14:36:45 <larrydavid> <larrydavid> Hi. Not a webdev so bear with me. I'd like to make a webapp which fetches status data from a server, and displays it on the screen. Data is associated with an entity shown as an icon on a map, user clicks on an icon to view the full status data for that. There's authentication of multiple users, permission to view certain types of data, etc. Now it's clear I'll need Javascript
  679. Sep 17 14:36:45 <larrydavid> to show this in the browser, but any suggestions on what to use in the back-end to make my life easy?
  680. Sep 17 14:37:11 <django_> larrydavid: if you have doubts on extra stuff ask around if its good or build it yourself
  681. Sep 17 14:37:17 <larrydavid> "fetches status data" can be replaced by "server pushes data when it changes" if you want
  682. Sep 17 14:38:03 <falafel> larrydavid, yeah, Node is fine for that, I think all you need is Express and some middleware for authentication in the backend
  683. Sep 17 14:38:23 <larrydavid> django_: I'm really new to web tech, there's so much choice, and it's hard to tell what's unsuitable at first glance. Would take a long time to test everything here: https://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#Comparison_of_features
  684. Sep 17 14:38:39 <django_> larrydavid: stackoverflow
  685. Sep 17 14:38:40 <django_> googe..
  686. Sep 17 14:38:42 <django_> irc
  687. Sep 17 14:38:49 <django_> #node.js
  688. Sep 17 14:39:12 <larrydavid> well #node.js wouldn't give me a neutral answer. I mean what they gonna do, say "go use Django"? :)
  689. Sep 17 14:39:25 <larrydavid> so I tried #webdev, then here
  690. Sep 17 14:40:48 <larrydavid> is there a name for a back-end feature that help save you time creating GUIs? Or is that generally done entirely on the front-end using raw data obtained via API requests?
  691. Sep 17 14:43:32 <NoiseEee> yeah, the latter
  692. Sep 17 14:44:19 <larrydavid> thanks
  693. Sep 17 14:45:16 <deltab> larrydavid: you can also generate DOM objects on the server, serialize them to HTML, and send them to the browser
  694. Sep 17 14:47:19 <larrydavid> deltab: thanks. I knew that actually, but I don't think HTML applies to a webapp with a fancy GUI like I have in mind.
  695. Sep 17 14:47:57 <sillyslux> graphettion, https://jsfiddle.net/L20rthze/1/
  696. Sep 17 14:47:58 <larrydavid> it's more like a simple game GUI than anything
  697. Sep 17 14:50:21 <tcsc> if you're updating every frame you might not want to use html for your gui
  698. Sep 17 14:50:36 <tcsc> not all web-based games do that though
  699. Sep 17 15:00:51 <sillyslux> graphettion, https://jsfiddle.net/L20rthze/3/
  700. Sep 17 15:01:26 <graphettion> sweet, ty sillyslux
  701. Sep 17 15:02:46 <graphettion> sillyslux: I was having trouble with returning arrays and figured out map does that so I came up with this - https://jsfiddle.net/L20rthze/2/
  702. Sep 17 15:02:51 <graphettion> I appreciate the help man.
  703. Sep 17 15:07:37 <sillyslux> yw
  704. Sep 17 15:08:44 <ThePendulum> >> 21.582 + 0.6
  705. Sep 17 15:08:44 <ecmabot> ThePendulum: (number) 22.182000000000002
  706. Sep 17 15:08:49 <ThePendulum> why does it do this
  707. Sep 17 15:09:00 <ThePendulum> >> 21.582 + 0.600
  708. Sep 17 15:09:01 <ecmabot> ThePendulum: (number) 22.182000000000002
  709. Sep 17 15:09:07 <ThePendulum> :/
  710. Sep 17 15:09:14 <falafel> ThePendulum, floating point math
  711. Sep 17 15:09:18 <L8D> ThePendulum: IEEE 755
  712. Sep 17 15:09:37 <ThePendulum> how do I prevent that
  713. Sep 17 15:09:41 <Impaloo> IEEE 754 actually
  714. Sep 17 15:09:46 <L8D> ^
  715. Sep 17 15:10:15 <Impaloo> does anyone know what IEEE stands for, without Googling?
  716. Sep 17 15:10:22 <Impaloo> i always forget it
  717. Sep 17 15:10:30 <ThePendulum> institute of electrical and....
  718. Sep 17 15:10:30 <Impaloo> IETF though
  719. Sep 17 15:10:33 <ThePendulum> engineers something
  720. Sep 17 15:10:42 <ThePendulum> institute of electrical and electronics engineers?
  721. Sep 17 15:11:02 <Impaloo> ThePendulum: googler!
  722. Sep 17 15:11:03 <ThePendulum> so this is predictable behavior then
  723. Sep 17 15:11:17 <ThePendulum> Impaloo: I was already on the IEEE 754 page :P
  724. Sep 17 15:11:29 <falafel> it is normal behavior
  725. Sep 17 15:11:40 <Impaloo> not very predictable though
  726. Sep 17 15:11:44 <ThePendulum> how do I account for it?
  727. Sep 17 15:11:46 <Impaloo> except 0.1 + 0.2
  728. Sep 17 15:11:53 <falafel> ThePendulum, what exactly are you trying to do?
  729. Sep 17 15:11:58 <falafel> like, what are you calculating?
  730. Sep 17 15:12:03 <falafel> floating points are ok for most things
  731. Sep 17 15:12:24 <ThePendulum> I have the y-coordinate of the first of 2 lines, and I know the difference between the two lines
  732. Sep 17 15:12:31 <ThePendulum> so I add the difference and then try to find the 2nd line in a lookup table
  733. Sep 17 15:12:43 <ThePendulum> which obviously isn't going to work if there's a .00000000000002 difference
  734. Sep 17 15:12:57 <ThePendulum> I guess I need to put back the fuzzy searcher
  735. Sep 17 15:14:31 <falafel> ThePendulum, if anything you could look for a bigint library
  736. Sep 17 15:14:45 <falafel> or rather bigdecimal
  737. Sep 17 15:14:53 <falafel> this one https://github.com/dtrebbien/BigDecimal.js
  738. Sep 17 15:15:19 <ThePendulum> I was looking at big.js
  739. Sep 17 15:15:42 <ThePendulum> could someone summarize why this is happening at all?
  740. Sep 17 15:15:57 <tcsc> ThePendulum: floats are in base 2, and not base 10
  741. Sep 17 15:16:07 <ThePendulum> right
  742. Sep 17 15:16:13 <tcsc> it's like how 1/3 can't be represented well in base ten (0.333333333)
  743. Sep 17 15:16:51 <falafel> ThePendulum, http://floating-point-gui.de/
  744. Sep 17 15:16:54 <tcsc> ThePendulum: if you can, avoid big decimals.
  745. Sep 17 15:17:01 <tcsc> they probably won't do what you want.
  746. Sep 17 15:17:08 <tcsc> even if they do they're very very slow.
  747. Sep 17 15:17:11 <ThePendulum> right
  748. Sep 17 15:17:25 <tcsc> are you summing a lot of things, or just a few things
  749. Sep 17 15:17:35 <falafel> ThePendulum, how were the other numbers calculated? The ones in the table
  750. Sep 17 15:17:52 <baxx> I'm trying to create some html from within the JS, I'm a bit confused as to what's up here https://jsfiddle.net/3oqg6jgd/2/ . It seems to be messing up around the ('head')[0] part, but I'm not sure why as the html (in the local version at least) has a 'head'. Any pointers would be cool, cheers
  751. Sep 17 15:17:55 <ThePendulum> they are coordinates, they're given
  752. Sep 17 15:18:26 <falafel> ThePendulum, but you say you are trying to match th results, right?
  753. Sep 17 15:18:30 <falafel> how were the results calculated
  754. Sep 17 15:18:57 <ThePendulum> the coordinate I need is already somewhere in the lookup, the right numbe
  755. Sep 17 15:19:10 <ThePendulum> I know another coordinate and I know the difference between that one and the one I need
  756. Sep 17 15:19:21 <ThePendulum> so I add the difference to the known coordinate and try to find it in the lookup table
  757. Sep 17 15:19:55 <tcsc> ThePendulum: you probably want to bucket them so that close together floats are identical
  758. Sep 17 15:19:59 <ThePendulum> but it'll be looking for 4.839 exactly, for example, not 4.839000000000000000000002
  759. Sep 17 15:20:02 <tcsc> are considered identical*
  760. Sep 17 15:20:04 <ThePendulum> yeah
  761. Sep 17 15:20:07 <jak2000> deltab: http://postimg.org/image/49u7a0iif/d0d55d58/ strange strange
  762. Sep 17 15:20:16 <ThePendulum> I need to figure out how to do that efficiently for multiple reasons
  763. Sep 17 15:20:31 <tcsc> ThePendulum: that's known as quantization
  764. Sep 17 15:20:40 <tcsc> well, that will at least point you in the right direction
  765. Sep 17 15:20:42 <ThePendulum> because there might be tolerable variations in the given coordinates as well
  766. Sep 17 15:21:06 <jak2000> L8D are you there?
  767. Sep 17 15:21:27 <L8D> jak2000: yeah
  768. Sep 17 15:21:38 <jak2000> see: http://postimg.org/image/49u7a0iif/d0d55d58/ please
  769. Sep 17 15:22:43 <L8D> jak2000: ok
  770. Sep 17 15:23:05 <L8D> the first has one space between [AGROFRUTAS] and AGROFRUTAS, the second has two spaces
  771. Sep 17 15:23:36 <tcsc> ThePendulum: actually, since your numbers aren't going to be in the 0,1 range quantization isn't what you want
  772. Sep 17 15:24:06 <tcsc> you could just do Math.floor(num * precision)/precision
  773. Sep 17 15:24:11 <tcsc> before putting it in a table
  774. Sep 17 15:24:27 <tcsc> where precision is something like 1 / minimum allowed difference
  775. Sep 17 15:24:37 <tcsc> so like 1000 or something
  776. Sep 17 15:24:41 <tcsc> or even less
  777. Sep 17 15:26:06 <ThePendulum> tcsc: so I'd have to multiply the coordinates by 10 a few times to allow for that?
  778. Sep 17 15:26:26 <ThePendulum> otherwise I'll just end up with 0 everywhere
  779. Sep 17 15:26:53 <ThePendulum> in fact
  780. Sep 17 15:27:50 <ThePendulum> Math.floor(coordinate * (1 / precision)) I guess
  781. Sep 17 15:27:51 <tcsc> >> var precision = 1000;[30.001, 30.0006, 30.0014].map(function(n) { return Math.round(n*precision)/precision; })
  782. Sep 17 15:27:51 <ecmabot> tcsc: (object) [30.001, 30.001, 30.001]
  783. Sep 17 15:28:56 <ThePendulum> hmm
  784. Sep 17 15:29:00 <tcsc> precision should be a fairly large number.
  785. Sep 17 15:29:18 <Zak> Can somebody possible check if https://equinox.io/ is up for them? It's hosting some ngrok binaries and I can't seem to get to them :9
  786. Sep 17 15:29:18 <tcsc> it should be the inverse of whatever your maximum tolerance is
  787. Sep 17 15:29:30 <tcsc> and round is probably more correct here than floor
  788. Sep 17 15:29:55 <ThePendulum> tcsc: hence Math.round(coordinate * (1 / precision)) ? that allows me to determine the precision based on the coordinates without having to inverse it manually
  789. Sep 17 15:29:59 <duckgoose> downforeveryoneorjustme.com/equinox.io
  790. Sep 17 15:30:32 <Zak> never sure about the accuracy of those sites :(
  791. Sep 17 15:30:32 <ThePendulum> hold on
  792. Sep 17 15:30:33 <Zak> but thanks
  793. Sep 17 15:31:16 <tcsc> hm. determine it based on coordinates how?
  794. Sep 17 15:32:32 <ThePendulum> so I guess Math.round(coordinate * (1 / precision)) * precision
  795. Sep 17 15:33:05 <tcsc> sure. but how would you determine it based on coordinates. it needs to be fixed for a given lookup table.
  796. Sep 17 15:33:05 <ThePendulum> or coordinate / precision
  797. Sep 17 15:33:11 <ThePendulum> probably more direct
  798. Sep 17 15:33:19 <ThePendulum> tcsc: yes, it's determined manually
  799. Sep 17 15:33:26 <tcsc> okay.
  800. Sep 17 15:33:38 <ThePendulum> but it seems inconvenient having to invert it manually as well, and set it in the profile like that
  801. Sep 17 15:33:52 <tcsc> well, it doesn't make a big difference.
  802. Sep 17 15:34:01 <tcsc> it depends what you think of the input as.
  803. Sep 17 15:34:25 <ThePendulum> it does, it requires you to know the code when profiling and determining the precision
  804. Sep 17 15:34:57 <ThePendulum> it requires more insight about how that number is established
  805. Sep 17 15:36:29 <tcsc> eh. it's somewhat subjective. i think both require knowledge into how you're going to use them.
  806. Sep 17 15:36:33 <tcsc> but w/e
  807. Sep 17 15:37:00 <timetocode> When I switch browser tabs (in chrome, so far), my javascript in the background tab gets paused. When I switch back to it, it appears to attempt to catch up... but it only certain logic seems to be able to catch up. For example, anything sent via a websocket while it was in the background gets received after it gains focus again. Meanwhile, I have some time-based math which it seems to just skip. What is the nature of this pause/resume? What k
  808. Sep 17 15:37:00 <timetocode> ind of things can it really resume
  809. Sep 17 15:38:03 <ThePendulum> tcsc: you'd otherwise only have to look at the set of coordinates and just literally observe the leeway and note it down
  810. Sep 17 15:38:15 <ThePendulum> without having to worry about converting it in any way
  811. Sep 17 15:38:20 <netameta> how can i create a page where "/" has some content and its the home state, however when someone at the top menu is selected that content is changed
  812. Sep 17 15:39:14 <tcsc> i guess i was assuming it was more of a tweakable parameter that you adjust based on the output, as opposed to something where you look at the values and come up with something
  813. Sep 17 15:39:16 <netameta> like say you have the home state that the url is /, and the about page, when about is clicked the content of the view (where home content was) get replaced with the about
  814. Sep 17 15:39:16 <ThePendulum> you make the menu item a hyperlink to a new page with new content
  815. Sep 17 15:39:43 <netameta> ThePendulum, the above meant to me ?
  816. Sep 17 15:39:53 <ThePendulum> tcsc: it's part of a profile that gives instructions on what a to-be parsed PDF looks like, it's more of a config file than direct input
  817. Sep 17 15:40:06 <ThePendulum> netameta: yes, why get fancy? :P
  818. Sep 17 15:40:12 <persina> is there an equivalent of .serialize() for POST?
  819. Sep 17 15:40:15 <ThePendulum> good ole' HTML anchors
  820. Sep 17 15:40:37 <netameta> persina, there are some jquery plugins that does it
  821. Sep 17 15:41:06 <persina> netameta: what do you mean plugins?
  822. Sep 17 15:41:12 <ThePendulum> tcsc: I'm not sure why I didn't think of just rounding the values everywhere before
  823. Sep 17 15:41:18 <ThePendulum> d'oh
  824. Sep 17 15:41:24 <netameta> ThePendulum, yea yea hyperlinks to new states but how where will i put the content of the first page
  825. Sep 17 15:41:36 <netameta> ThePendulum, or you mean not to use states at all
  826. Sep 17 15:41:41 <netameta> persina, jquery plugins
  827. Sep 17 15:41:44 <ThePendulum> if you want to load it dynamically pe se you'll want to use AJAX
  828. Sep 17 15:42:20 <persina> netameta: what does that mean? explain...
  829. Sep 17 15:42:24 <netameta> persina, I assume you want to grap the values of a form into an object ? or something like that ?
  830. Sep 17 15:42:40 <persina> netameta: yes
  831. Sep 17 15:42:44 <ThePendulum> netameta: but you have to ask yourself if it's worth the hassle
  832. Sep 17 15:43:09 <netameta> persina, Jquery dont have a native way to do that, you'll need to search for a jqeuery plugin
  833. Sep 17 15:43:09 <ThePendulum> especially when the user is already navigating a menu, I'm not sure why you'd load the content dynamically
  834. Sep 17 15:43:28 <persina> netameta: what about serializeArray()?
  835. Sep 17 15:43:28 <ThePendulum> it's usually something you'd do to update the content in front of the user
  836. Sep 17 15:43:29 <netameta> ThePendulum, what are you talking about ?
  837. Sep 17 15:43:39 <netameta> persina, Yea that might work,
  838. Sep 17 15:43:50 <ThePendulum> netameta: If you don't know than I have no idea what you're asking
  839. Sep 17 15:44:06 <ThePendulum> you want to change the content on a page whenever someone navigates a menu?
  840. Sep 17 15:44:28 <netameta> ThePendulum, Are we talking about not using angular at all and simply making a html page with menu that points to other pages ?
  841. Sep 17 15:44:46 <ThePendulum> I didn't know you're using angular
  842. Sep 17 15:44:58 <netameta> ThePendulum, Ahhh crap wrong channel...
  843. Sep 17 15:45:00 <netameta> shiet
  844. Sep 17 15:45:02 <ThePendulum> LOL
  845. Sep 17 15:45:03 <tcsc> ThePendulum: worth noting that if you're going to go with a value close to 1, you will want to consider using floor and ceil instead of round, since round will bring stuff from 0.5 above and below, whereas floor will actually be in that range.
  846. Sep 17 15:45:05 <netameta> sorry for the confusion
  847. Sep 17 15:45:36 <ThePendulum> yeah, disregard that for angular
  848. Sep 17 15:45:39 <ThePendulum> I'm not sure how that all works
  849. Sep 17 15:46:11 <ThePendulum> tcsc: the tolerance / precision value is usually around 0.01
  850. Sep 17 15:46:27 <tcsc> it probably doesnt matter then.
  851. Sep 17 15:46:34 <ThePendulum> yeah, probably not too much of a problem
  852. Sep 17 15:46:55 <ThePendulum> although I am considering to use floor still
  853. Sep 17 15:47:06 <netameta> Well floor or ceil will have a more "predictable" results
  854. Sep 17 15:47:08 <ThePendulum> because honestly I'm not sure why the precision matters
  855. Sep 17 15:47:33 <netameta> because you know you'll always either get +1 or -1 and you can build on that.
  856. Sep 17 15:47:43 <ThePendulum> if I have 4.346 and another 4.344, with a precision of 0.01, they should really both end up being 4.34
  857. Sep 17 15:48:09 <ThePendulum> while I'd be getting 4.35 and 4.34 here
  858. Sep 17 15:49:19 <tcsc> then you probably want floor
  859. Sep 17 15:49:21 <RonRichie> hey whats up y'll!
  860. Sep 17 15:49:23 <ThePendulum> I just realized I'l still get that float problem now
  861. Sep 17 15:49:34 <ThePendulum> oh hmm
  862. Sep 17 15:49:53 <ThePendulum> I get it with round but not with floor
  863. Sep 17 15:50:19 <ThePendulum> I'm not sure if that's fundamental or a coincidence
  864. Sep 17 15:50:25 <tcsc> no that's fundamental
  865. Sep 17 15:50:51 <RonRichie> tcsc dude lol your diagram helped me a lot, I started making better sense of other recursions as well, I was working on this for an hour and I draw this beautiful masterpiece, it looks correct right? https://repl.it/BIxE/1
  866. Sep 17 15:51:41 <tcsc> it looks correct at rough glance. does it work?
  867. Sep 17 15:52:35 <tcsc> gotta run, bbl
  868. Sep 17 16:01:39 <ThePendulum> I assume I shouldn't be requiring a JSON file in a function?
  869. Sep 17 16:02:53 <ThePendulum> or can I just do that
  870. Sep 17 16:03:34 <ThePendulum> like, anywhere
  871. Sep 17 16:06:08 <Sal> hi, is there a way to check touchstart coords to see if the user tap a specific element?
  872. Sep 17 16:06:31 <jak2000> L8D yes i see
  873. Sep 17 16:06:36 <Sal> i need to let the user move a line (div with bottom-border 1px)
  874. Sep 17 16:06:46 <jak2000> but the value of this.text and $myPRod have exact value or not?
  875. Sep 17 16:06:54 <Sal> inside a full screen container
  876. Sep 17 16:15:57 <ThePendulum> interesting
  877. Sep 17 16:16:47 <ThePendulum> why is require() not asynchronous despite needing to load a file?
  878. Sep 17 16:17:22 <ThePendulum> discard that
  879. Sep 17 16:17:44 <deltab> convenience?
  880. Sep 17 16:19:32 <L8D> ThePendulum: because it would make everything pointless
  881. Sep 17 16:19:57 <jak2000> L8D ?
  882. Sep 17 16:20:26 <L8D> jak2000: what I said earlier, they are not the same value
  883. Sep 17 16:20:33 <L8D> jak2000: one has two spaces, the other has one
  884. Sep 17 16:20:56 <L8D> jak2000: I'm guessing this is because the DOM added artificial spacing when generating the text content
  885. Sep 17 16:21:24 <L8D> ThePendulum: if require() was asynchronous, then node.js would be a futile platform for developing applications
  886. Sep 17 16:21:56 <robertmaxrees> jak2000 those two strings are not the same.
  887. Sep 17 16:22:12 <robertmaxrees> one has two spaces.
  888. Sep 17 16:22:15 <robertmaxrees> the other does not.
  889. Sep 17 16:24:27 <ThePendulum> L8D: yeah, I realized a split second after sending that that that would make things a lot more complicated
  890. Sep 17 16:25:09 <ThePendulum> is it in any way wrong to require() a JSON file deeper down in an application?
  891. Sep 17 16:25:09 <hapyt0wn> has anyone messed with cubism
  892. Sep 17 16:25:12 <hapyt0wn> ?
  893. Sep 17 16:26:01 <L8D> hapyt0wn: I'm an avid cubist
  894. Sep 17 16:26:01 <ThePendulum> it's not my style
  895. Sep 17 16:26:21 <hapyt0wn> L8D can you change the width of the graph
  896. Sep 17 16:26:24 <L8D> My 3x3 average is 40 seconds
  897. Sep 17 16:26:40 <jak2000> L8D and robertmaxrees i understand, but why not see the second space in the value of $myprod variable
  898. Sep 17 16:26:45 <jak2000> making a Fiddle
  899. Sep 17 16:26:58 <L8D> jak2000: because Chrome hides it for some reason
  900. Sep 17 16:27:35 <L8D> hapyt0wn: the width is dependent on the width of the parent element
  901. Sep 17 16:28:01 <L8D> hapyt0wn: well, the width you set for the canvas
  902. Sep 17 16:28:04 <hapyt0wn> L8D: I scaled the parent element....
  903. Sep 17 16:28:19 <hapyt0wn> it seemed it was dependent of the amount of data points...
  904. Sep 17 16:28:40 <hapyt0wn> Can you send pictures through IRC?
  905. Sep 17 16:29:08 <L8D> hapyt0wn: you can upload to an image hoster
  906. Sep 17 16:29:10 <L8D> like imgur
  907. Sep 17 16:29:11 <sillyslux> hapyt0wn, make asciiart pics of it
  908. Sep 17 16:29:31 <hapyt0wn> L8D: I'm behind a firewall...
  909. Sep 17 16:29:34 <hapyt0wn> I'm on a work PC
  910. Sep 17 16:29:36 <hapyt0wn> ....
  911. Sep 17 16:29:50 <hapyt0wn> I could ssh tunnel but I might get in trouble...
  912. Sep 17 16:39:32 <Kayra> How do I pass a this.variable into an anyonymous function and still be able to use it outside of the function?
  913. Sep 17 16:41:03 <robertmaxrees> pass it, or access it?
  914. Sep 17 16:41:20 <robertmaxrees> like, you want to access the parent function's scope?
  915. Sep 17 16:43:02 <laphlaw> I'm seeing strange behavior with ajax.. when calling an ajax request, about 10% of the time it fails to even make the ajax request
  916. Sep 17 16:43:06 <laphlaw> http://pastebin.com/AYrw1Y8X#
  917. Sep 17 16:44:30 <laphlaw> i'm somewhat suspicious if window.location.replace is interfering somehow, but that isn't called until after the ajax request. I'm honestly baffled
  918. Sep 17 16:44:42 <larrydavid> Any advice on what to use to create a UI like this? https://i.imgur.com/BsqzzK0.png The data would come from a server via AJAX or websocket. Also, despite the flavor text it's not a game, so I'd like to avoid game engines unless they're the best tool for the job.
  919. Sep 17 16:45:54 <laphlaw> when it *does* fail, it doesn't execute the error callback function either :(
  920. Sep 17 16:58:20 <zumba_ad_> so classA has a property say profile. The profile property value is inherited from another class. so var classA = { property = '', showProfile = function() { render property } }; Now classB is a child of classA that also wants to render the property in parent classA. According to my officemate, it's not seeing the inherited value when method is called in classB
  921. Sep 17 17:06:28 <zumba_ad_> should be call, super, etc?
  922. Sep 17 17:07:07 <zumba_ad_> I hope someone can make a sample fiddle. it's advance for my level
  923. Sep 17 17:13:38 <chars6> hi
  924. Sep 17 17:13:48 <chars6> i'm not sure what i'm doing wrong here
  925. Sep 17 17:13:56 <chars6> but i want to use a regex inside a switch statement
  926. Sep 17 17:14:19 <chars6> so, where window.location ends with 'page=account', i want to alert('asdf')
  927. Sep 17 17:14:29 <chars6> code: http://pastebin.com/ZYyss7CN
  928. Sep 17 17:14:56 <chars6> it always runs default tho
  929. Sep 17 17:18:44 <sillyslux> you can't do "case (page.test('page=account$'))"
  930. Sep 17 17:20:12 <chars6> sillyslux: what is the correct syntax? i chose test because my understanding is it returns a bool
  931. Sep 17 17:20:50 <sillyslux> test returns bool yes, i'm trying that myself
  932. Sep 17 17:20:54 <chars6> ultimately, i want 3 of these, for account, shipping, and cart
  933. Sep 17 17:24:48 <chars6> i might have the regex wrong....
  934. Sep 17 17:25:03 <chars6> if i run alert(page.test('page=account$')); i still get false when i'm expecting true
  935. Sep 17 17:32:11 <sillyslux> chars6, try this http://jsfiddle.net/983mchkd/
  936. Sep 17 17:34:24 <sillyslux> http://jsfiddle.net/983mchkd/1/
  937. Sep 17 17:35:39 <baxx> under what condition would this be true if(style.styleSheet) ?
  938. Sep 17 17:36:02 <sillyslux> the latter will work with /?page=shipping&something=else too
  939. Sep 17 17:39:20 <chars6> sillyslux: i don't understand. is that first line var site = ... supposed to be a string?
  940. Sep 17 17:39:53 <sillyslux> regex.exec returns an array
  941. Sep 17 17:40:16 <chars6> no, i mean the /page-(.+)/ part
  942. Sep 17 17:40:26 <sillyslux> ist value is the full string, 2nd the match, therefore site[1]
  943. Sep 17 17:40:42 <sillyslux> *1st
  944. Sep 17 17:40:54 <sillyslux> /page-(.+)/ is the regex
  945. Sep 17 17:41:16 <chars6> no, line 1. should /page=(.+) be wrapped in apostrophes?
  946. Sep 17 17:41:26 <sillyslux> no
  947. Sep 17 17:42:09 <sillyslux> it can be in apo, but doesn't have to
  948. Sep 17 17:44:38 <timetocode> do browsers fire anything when they put javascript into some sort of throttle/pause such as when a tab is not active?
  949. Sep 17 17:45:33 <timetocode> i have an app which is only partly recovering when it regains focus
  950. Sep 17 17:45:59 <undrinkablesoup> So I have <td id="anid"></td>, and then var a = document.getElementById("anid"); How can I figure out the x and y positions of the top-left corner of that element now?
  951. Sep 17 17:46:13 <undrinkablesoup> Is it as simple as a.style.x and a.style.y?
  952. Sep 17 17:46:38 <undrinkablesoup> I'm trying to use this to position an element next to it.
  953. Sep 17 17:47:26 <chars6> sillyslux: cool. now i'm not getting the default to fire when the url doens't have extra paramaters, but i can get around that by wrapping the whole thing in an if statement
  954. Sep 17 17:47:34 <undrinkablesoup> I can't set position: relative; on the table or the td because it causes various CSS glitches/bugs.
  955. Sep 17 17:48:10 <chars6> sillyslux: so this is what i'm looking at right now http://pastebin.com/sT4n51XA
  956. Sep 17 17:48:58 <timetocode> undrinkablesoup, unfotunately that is not a standard thing. You might be able to get something like that with getBoundingClientRect(), and depending exactly how the apge goes you might need to mess with offsets
  957. Sep 17 17:49:18 <sillyslux> http://jsfiddle.net/983mchkd/2/
  958. Sep 17 17:52:44 <annoymouse> What's the purpose of the tilde operator?
  959. Sep 17 17:53:32 <chars6> sillyslux: yeah, whenever the contents of switch() is null i get an error
  960. Sep 17 17:53:36 <Havvy> Bitwise invert or something? It's not really that useful.
  961. Sep 17 17:53:53 <Havvy> Mainly because we don't have integral types.
  962. Sep 17 17:53:58 <chars6> sillyslux: i think screening for null ahead of time is what i'm going to need to do
  963. Sep 17 17:54:25 <sillyslux> i've seen that error too now
  964. Sep 17 17:55:04 <sillyslux> well i'd do if() too
  965. Sep 17 17:55:34 <chars6> sillyslux: thanks for your help!
  966. Sep 17 17:55:56 <chars6> sillyslux: i can figure out the rest from here
  967. Sep 17 17:57:01 <annoymouse> Havvy: But when would one use it?
  968. Sep 17 17:57:41 <Havvy> annoymouse: When programming in C on integral types.
  969. Sep 17 17:57:44 <sillyslux> i think i've used it once. i really can't remember when and why :(
  970. Sep 17 17:57:54 <Havvy> Possibly it's used in asm.js.
  971. Sep 17 17:58:01 <timetocode> annoymouse, the simple answer would be never ;). The complicated answer is that you use it for logical operations involving binary... sometimes in javascript that'll manifest as some cryptic performance hack
  972. Sep 17 17:58:24 <sillyslux> i do remember it was fun
  973. Sep 17 17:58:47 <Havvy> >> ~1
  974. Sep 17 17:58:47 <ecmabot> Havvy: (number) -2
  975. Sep 17 17:58:51 <Havvy> >> ~~1
  976. Sep 17 17:58:51 <ecmabot> Havvy: (number) 1
  977. Sep 17 17:58:56 <Havvy> >> ~-1
  978. Sep 17 17:58:57 <ecmabot> Havvy: (number) 0
  979. Sep 17 17:59:00 <annoymouse> I read a blog post about it and the guy said it's useful for str.indexOf()
  980. Sep 17 17:59:20 <timetocode> I had to use bit logic to make a buffer that could use bits instead of bytes
  981. Sep 17 17:59:27 <Havvy> >> if (~"abc".indexOf("d")) { true } else { false}
  982. Sep 17 17:59:27 <ecmabot> Havvy: (boolean) false
  983. Sep 17 17:59:28 <annoymouse> That way if it finds nothing and returns -1, the ~ will make it into 0, which evaluates as false
  984. Sep 17 17:59:31 <Havvy> >> if (~"abc".indexOf("b")) { true } else { false}
  985. Sep 17 17:59:31 <ecmabot> Havvy: (boolean) true
  986. Sep 17 17:59:51 <Havvy> But that's *really* *really* unreadable. ;)
  987. Sep 17 17:59:55 <timetocode> I would file that away under "cryptic performance hack"
  988. Sep 17 17:59:58 <timetocode> minus performance ;)
  989. Sep 17 18:00:14 <Havvy> if ("abc".indexOf("d") !== -1) { true } else { false} is much more readable.
  990. Sep 17 18:00:31 <annoymouse> Havvy: Exactly
  991. Sep 17 18:00:38 <Havvy> And when you can use ES6's library support... "abc".includes("d") would work better.
  992. Sep 17 18:01:26 <annoymouse> Havvy: Or even > -1
  993. Sep 17 18:01:52 <annoymouse> So in short, don't use it
  994. Sep 17 18:05:59 <ljharb> !es6-shim
  995. Sep 17 18:05:59 <ecmabot> ljharb: To get every backwards-compatible feature of ES6 in every browser and node, use https://www.npmjs.com/package/es6-shim ! It's heavily tested, comes with Promises, and using the !es5-shim as well is strongly encouraged.
  996. Sep 17 18:06:08 <ljharb> you can use String#includes now :-)
  997. Sep 17 18:06:21 <Havvy> annoymouse: Why use `>` when you can `!==`?
  998. Sep 17 18:06:35 <Havvy> ljharb: Bah, I refuse to use es6-shim.
  999. Sep 17 18:06:42 <ljharb> wat, why
  1000. Sep 17 18:07:03 <annoymouse> Havvy: Less chars. that was the bloggers justification for using tilde in the first place
  1001. Sep 17 18:07:07 <Havvy> It's not worth it in download size.
  1002. Sep 17 18:07:13 <Havvy> At least for what it gives.
  1003. Sep 17 18:09:53 <ljharb> Havvy: i'm not really sure what you mean - it's relatively small, and it gives you a ton of new API
  1004. Sep 17 18:10:11 <ljharb> Map, Set, Promise, new Array methods, including Array.from…
  1005. Sep 17 18:10:29 <ljharb> and more importantly, it fixes bugs in browsers' current implementations of them
  1006. Sep 17 18:11:46 <Havvy> I can use `Object.create(null)` as a Map for when I need maps most of the type. I haven't really needed sets that often in JS. The new array methods are nice, but not entirely necessary.
  1007. Sep 17 18:12:12 <Havvy> If I'm going to have a non-environmental promise, it's going to be bluebird.
  1008. Sep 17 18:12:37 <ljharb> you can't use Object.create(null) for object keys
  1009. Sep 17 18:12:54 <ljharb> ¯\_(ツ)_/¯ at any rate if you don't want to use it, don't, but "download size" is a silly reason
  1010. Sep 17 18:13:04 <timetocode> es6 has object keys? so sexy
  1011. Sep 17 18:13:14 <ljharb> timetocode: ES6 Map does.
  1012. Sep 17 18:13:42 <timetocode> that's exciting
  1013. Sep 17 18:13:42 <ljharb> Array.from, Array#find, Array#findIndex, and Array#fill are the most useful array methods in ES6 imo
  1014. Sep 17 18:16:45 <timetocode> I want to add an api to one of my libs such that people can write myLib.on('update', someUserCode). I haven't made something like that before.. what woudl it be basically... an event emitter and adding a listener that use someUserCode as the callback...?
  1015. Sep 17 18:17:43 <timetocode> also is there a particular merit to blah.onError(cb) vs blah.on('error', cb) ?
  1016. Sep 17 18:18:01 <timetocode> it seems like jquery had the former, and now has the latter
  1017. Sep 17 18:18:06 <ljharb> the latter is consistent with the node EventEmitter API
  1018. Sep 17 18:18:22 <ljharb> and with DOM's addEventListener
  1019. Sep 17 18:19:42 <timetocode> oh the .on function is straight up part of the event emitter.. i seeeeeeeee
  1020. Sep 17 18:32:40 <baxx> what does "if (style.styleSheet)" mean, I can't seem to get to evaluate to true. I'm presuming that it's something to do with style having the property styleSheet
  1021. Sep 17 18:32:40 <baxx>
  1022. Sep 17 18:33:06 <baxx> I'm not sure if that's something that kinda needs the context or not either tbh
  1023. Sep 17 18:33:57 <sillyslux> baxx make a fiddle
  1024. Sep 17 18:34:16 <baxx> sillyslux: cool cool
  1025. Sep 17 18:35:25 <baxx> sillyslux: contrived and colvoluted thing that I was just doing for learning https://jsfiddle.net/v8p0xdLu/
  1026. Sep 17 18:35:50 <baxx> you can see the ifs at the end where I was trying to see whether they would evaluate, but they didn't
  1027. Sep 17 18:39:12 <sillyslux> there is style.sheet
  1028. Sep 17 18:39:38 <sillyslux> fwiw
  1029. Sep 17 18:40:43 <baxx> sillyslux: how come the flag var doesn't get incremented then?
  1030. Sep 17 18:42:01 <baxx> i was following along with it in the firefox debugger and it never went in those if conditions or incremented the flag var
  1031. Sep 17 18:43:43 <sillyslux> there is style.sheet.cssRules[0].cssText
  1032. Sep 17 18:43:46 <sillyslux> in chrome
  1033. Sep 17 18:44:28 <baxx> sillyslux: Ok - so that's something thats 'given' with the browser? And thats just a chrome thing
  1034. Sep 17 18:44:44 <sillyslux> i don't think so
  1035. Sep 17 18:45:07 <baxx> I'm confused :/
  1036. Sep 17 18:46:33 <sillyslux> or yes, i don't see it in ff
  1037. Sep 17 18:47:35 <sillyslux> arrg sorry, yes it's available in ff too
  1038. Sep 17 18:48:09 <baxx> so this 'if' isn't an obvious 'thing'? I'm trying to work out what the point in it is, as I can never get it to actually enter the if statement ... like the append section puts the CSS var into the DOM / HTML / whatever bit, but that other bit's confusing me
  1039. Sep 17 18:48:13 <baxx> ha no worries ;)
  1040. Sep 17 18:48:14 <sillyslux> style.sheet.cssRules[0].cssText has the css definition
  1041. Sep 17 18:48:32 <baxx> sillyslux: ah fuck - is this the no-css / reset css thing that some people use?
  1042. Sep 17 18:48:41 <sillyslux> it's style.sheet not style.styleSheet
  1043. Sep 17 18:49:10 <baxx> sillyslux: ooo I'll test that
  1044. Sep 17 18:50:26 <baxx> sillyslux: ha ok, now it goes into the if ;)
  1045. Sep 17 18:50:54 <sillyslux> :) yes, but there is no style.sheet.cssText
  1046. Sep 17 18:51:19 <baxx> so this if condition is basically asking whether there already exists some kind of style sheet - and if there is to append whatever is in the if onto it?
  1047. Sep 17 18:51:49 <baxx> (just thinking about what the intention was for now rather than how it's not working, if that's doable)
  1048. Sep 17 18:52:20 <sillyslux> you mean the 1st if/else?
  1049. Sep 17 18:52:33 <sillyslux> with cssText=css
  1050. Sep 17 18:52:35 <sillyslux> ?
  1051. Sep 17 18:52:44 <sillyslux> style.sheet.cssRules[0].cssText
  1052. Sep 17 18:53:17 <baxx> yeah the if(style.styleSheet){
  1053. Sep 17 18:53:17 <baxx> style.styleSheet.cssText = css;
  1054. Sep 17 18:53:17 <baxx>
  1055. Sep 17 18:53:31 <sillyslux> that will never match
  1056. Sep 17 18:53:47 <sillyslux> ah maybe in ie?!
  1057. Sep 17 18:53:50 <sillyslux> :D
  1058. Sep 17 18:53:53 <baxx> yeah but am I understanding the intention of it? (Or is trying to do that a pointless exercise)
  1059. Sep 17 18:53:59 <baxx> oh yeah ha, forgot about ie
  1060. Sep 17 18:54:10 <annoymouse> I have two promises that I want to run simultaneously, and when they are both fulfilled, I want to continue
  1061. Sep 17 18:54:10 <baxx> or 'edge' as it like to be known now
  1062. Sep 17 18:54:23 <annoymouse> But I don't want to wait for the first one to complete to start the second one
  1063. Sep 17 18:54:31 <sillyslux> you mean what it's good for?
  1064. Sep 17 18:54:39 <annoymouse> I feel like this should be really simple with Promises. Perhaps I'm missing the point
  1065. Sep 17 18:55:24 <sillyslux> style.appendChild(document.createTextNode(css)) could also have been style.innerHTML=css
  1066. Sep 17 18:55:28 <baxx> sillyslux: i was just trying to understand what that code was doing / trying to do i guess
  1067. Sep 17 18:55:34 <tcsc> oh, is that my code?
  1068. Sep 17 18:55:41 <baxx> tcsc: ;)
  1069. Sep 17 18:55:50 <tcsc> i think i just copied it from other code i had written. it's supposed to add some css to the document.
  1070. Sep 17 18:55:52 <Drewery> hello everybody
  1071. Sep 17 18:55:57 <tcsc> in the head.
  1072. Sep 17 18:56:11 <sillyslux> tcsc you wrote that?
  1073. Sep 17 18:56:19 <tcsc> yeah, it was part of a oneoff
  1074. Sep 17 18:56:28 <sillyslux> where do you get style.styleSheet from?
  1075. Sep 17 18:56:43 <baxx> yeah part of the "stupid, oversimplified, and not terribly accurate, physics engine"
  1076. Sep 17 18:56:54 <tcsc> older code i had written, i think i had heard it was required for certain IE
  1077. Sep 17 18:57:14 <sillyslux> see, ie, told y0ou ;)
  1078. Sep 17 18:57:18 <tcsc> not sure how far back that goes, so I keep using it, even though its probably no longer necessary
  1079. Sep 17 18:57:47 <baxx> sillyslux: yep :)
  1080. Sep 17 18:58:12 <baxx> tcsc: fair, yeah I was trying to get the if to execute and failed a bit
  1081. Sep 17 18:58:17 <tcsc> ah
  1082. Sep 17 18:58:24 <tcsc> yeah, that's a compatibility thing
  1083. Sep 17 18:58:45 <tcsc> i think it might execute if you run it in IE9 but i'm not 100% certain
  1084. Sep 17 18:59:00 <baxx> I thought that it was testing to see whether there was a prexisting style sheet, or if that 'reset css' or something had been run, idk lol
  1085. Sep 17 18:59:14 <baxx> not sure if IE9 is in the debian repos
  1086. Sep 17 18:59:29 <tcsc> lol
  1087. Sep 17 19:00:04 <baxx> oh that's cool then, I can just ignore that as I'm not bothered about compatability at the mo :)
  1088. Sep 17 19:00:55 <sillyslux> haha debian-ie that would be nice
  1089. Sep 17 19:01:43 <baxx> I'd love to be on ##linux when it got announced
  1090. Sep 17 19:01:54 <baxx> I got told off for using pastebin there ha ha
  1091. Sep 17 19:03:00 <sillyslux> which browser are you using baxx?
  1092. Sep 17 19:03:14 <sillyslux> firefox developer edition?
  1093. Sep 17 19:03:14 <baxx> firefox and chrome
  1094. Sep 17 19:03:15 <tcsc> i use pastie usually. but it's not the best, it doesn't support a lot of languages so i have to fudge it sometimes.
  1095. Sep 17 19:03:32 <baxx> No never used dev edition - not sure what the difference is
  1096. Sep 17 19:03:56 <tcsc> i think it has more developer tools but i've never really noticed.
  1097. Sep 17 19:04:19 <tcsc> well, i don't use the non-developer edition much so, i guess i wouldnt notice.
  1098. Sep 17 19:04:28 <baxx> tcsc: you got a little bash function for that or something? I keep meaning to set something up, pasteit isn't so great
  1099. Sep 17 19:04:46 <tcsc> no, i just go to pastie and paste it in
  1100. Sep 17 19:05:05 <sillyslux> when you go to the html panel and right click on that style element and choose the last option "inspect in dom panel" you can browser through all it's properties and find style.sheet
  1101. Sep 17 19:05:24 <baxx> tcsc: manual labor
  1102. Sep 17 19:05:36 <tcsc> sure, but i don't paste a lot
  1103. Sep 17 19:05:50 <tcsc> also, amdahl's law def. applies
  1104. Sep 17 19:05:57 <tcsc> it takes longer to write the thing being pasted
  1105. Sep 17 19:06:00 <tcsc> than it does to paste it
  1106. Sep 17 19:06:02 <baxx> sillyslux: I've been looking in the debug section thing
  1107. Sep 17 19:06:58 <sillyslux> oh i see, that firefox builtin thing
  1108. Sep 17 19:07:03 <sillyslux> i meant firebug..
  1109. Sep 17 19:07:37 <baxx> firebug, everyone told me no one uses that ha
  1110. Sep 17 19:07:51 <tcsc> nobody should use it
  1111. Sep 17 19:07:53 <tcsc> people still due
  1112. Sep 17 19:07:55 <tcsc> err, do*
  1113. Sep 17 19:10:05 <baxx> i can see a fair bit of stuff in variables on the right
  1114. Sep 17 19:10:44 <sillyslux> ff won't show the dom properties on that style element in the jsfiddle frame
  1115. Sep 17 19:11:04 <sillyslux> maybe mine is a bit old
  1116. Sep 17 19:11:36 <baxx> sillyslux: oh sos I'm actually looking at mine from the local file >.<
  1117. Sep 17 19:11:37 <sillyslux> and.. why not firebug? deprecated?
  1118. Sep 17 19:11:57 <tcsc> the builtin tools are waaaay better
  1119. Sep 17 19:11:59 <sillyslux> firebug and chrome work well here
  1120. Sep 17 19:12:04 <tcsc> firebug is its own project
  1121. Sep 17 19:12:09 <tcsc> so it's not deprecated
  1122. Sep 17 19:12:13 <tcsc> it's just, not as good.
  1123. Sep 17 19:12:17 <tcsc> by a wide margin
  1124. Sep 17 19:12:31 <sillyslux> think i read somewhere that they'll merge
  1125. Sep 17 19:12:37 <sillyslux> or did merge
  1126. Sep 17 19:13:10 <sillyslux> didn't use ff in the last 15 months or so
  1127. Sep 17 19:13:13 <ycon_> Hi all, not sure why but my JS won't let me set the amount of results I want form an random number query. Line 17. Any tips? http://jsfiddle.net/jjz977um/13/
  1128. Sep 17 19:13:51 <tcsc> tbh 15 months is longer than i've been writing javascript.
  1129. Sep 17 19:13:53 <undrinkablesoup> timetocode: Dammit. :/
  1130. Sep 17 19:14:38 <baxx> tcsc: what were you doing before, c++ ?
  1131. Sep 17 19:14:41 <tcsc> yes
  1132. Sep 17 19:14:44 <tcsc> and actionscript
  1133. Sep 17 19:15:06 <tcsc> sort of c# too but i started that around the same time as js.
  1134. Sep 17 19:15:13 <baxx> oh right, got better or worse for JS?
  1135. Sep 17 19:15:25 <tcsc> what do you mean?
  1136. Sep 17 19:15:38 <ycon_> Ah I figured it out! js aint so bad after day 2
  1137. Sep 17 19:16:48 <baxx> tcsc: just whether js had been as much / more fun or whatnot
  1138. Sep 17 19:17:06 <tcsc> i like being able to write code and easily distribute it
  1139. Sep 17 19:17:22 <tcsc> but i think it's not a good language for game development since its very hard to guarantee performance.
  1140. Sep 17 19:17:32 <baxx> tcsc: that's a big appeal to me - the react native stuff is interesting as well.
  1141. Sep 17 19:18:02 <sillyslux> ycon_, http://jsfiddle.net/jjz977um/15/
  1142. Sep 17 19:18:11 <baxx> sillyslux: 20 seconds in on this : http://sendvid.com/1ccxrxoz
  1143. Sep 17 19:18:12 <tcsc> we use react for our game editors and it's okay. its fairly tedious tbh.
  1144. Sep 17 19:18:29 <tcsc> it works well in the context of an editor though.
  1145. Sep 17 19:18:29 <baxx> sillyslux: is that the info you were getting in the firebug?
  1146. Sep 17 19:18:45 <baxx> tcsc: what do you mean editors?
  1147. Sep 17 19:18:51 <tcsc> like, content editors
  1148. Sep 17 19:18:59 <ycon_> sillyslux: Thanks. I just needed to change my *10 to *30 (to get 30 results instead of just 10). Thanks
  1149. Sep 17 19:19:05 <tcsc> so that game designers dont have to edit json files and crap
  1150. Sep 17 19:19:30 <baxx> oh right fair, to automate stuff
  1151. Sep 17 19:19:45 <tcsc> basically.
  1152. Sep 17 19:20:07 <ycon_> json files are a headache. Is there any good js library around to conver JS to csv? I've got tonnes to data to sort
  1153. Sep 17 19:20:18 <baxx> I'd love to do visuals or something one day, computer visuals are mathy at hell though so it'll be a while
  1154. Sep 17 19:20:29 <tcsc> yeah, there's a lot of math to it
  1155. Sep 17 19:20:51 <tcsc> although game engines can take care of a decent amount of that for you.
  1156. Sep 17 19:20:58 <baxx> tcsc: which I don't mind, it's just one has to actually have the time to learn it ;)
  1157. Sep 17 19:20:59 <tcsc> depending on what you want to do.
  1158. Sep 17 19:21:10 <tcsc> yeah. i think the math is worth knowing.
  1159. Sep 17 19:21:16 <baxx> yeah its great!
  1160. Sep 17 19:21:29 <baxx> not sure if that sounded sarcastic, it wasn't
  1161. Sep 17 19:21:52 <baxx> I mainly mean like geometric kind of stuff tbh
  1162. Sep 17 19:22:40 <baxx> https://i.imgur.com/StIh4V5.jpg that would be more in line with my meaning than a computer game for example
  1163. Sep 17 19:23:01 <sillyslux> long ago i learned lot's of geometry, that was when i went to school
  1164. Sep 17 19:23:14 <baxx> oh damn erc is loading that gif and it doesn't like it at all
  1165. Sep 17 19:23:17 <tcsc> i imagine that was made in something like blender or after effects or something
  1166. Sep 17 19:23:31 <tcsc> not that you couldn't do it in code
  1167. Sep 17 19:23:36 <sillyslux> 23yrs later i don't remember that much
  1168. Sep 17 19:24:01 <tavl> how can I do something like a fork/join using Q (promise)? I mean: A -> B|C -> D, where B and C need the result from A as input. I tried using Q.All, but I think I'm doing something wrong here. ps: All functions return promises
  1169. Sep 17 19:24:30 <tcsc> i remember when i was in college, i took a computer graphics course and the professor asked me what the equation for a circle is in front of the class
  1170. Sep 17 19:24:32 <tcsc> and i had no idea
  1171. Sep 17 19:24:42 <sillyslux> baxx that one is for ana tudor :p
  1172. Sep 17 19:25:45 <baxx> test
  1173. Sep 17 19:25:47 <tcsc> and that was after i had taken nearly enough math to have a math minor. i think i was just one course short.
  1174. Sep 17 19:25:58 <tcsc> math is one of those things you forget if you dont use it
  1175. Sep 17 19:26:48 <fprophet> so true
  1176. Sep 17 19:27:03 <fprophet> I still use a calculator for simple addition, like 10+5
  1177. Sep 17 19:27:07 <sillyslux> https://twitter.com/anatudor/status/644621903626391553
  1178. Sep 17 19:30:47 <tcsc> i feel like doing those things in pure html/svg and css is practically masochism
  1179. Sep 17 19:31:12 <baxx> tcsc: emacs just shat itself over that gif - not sure if you posted before this message - what do you mean?
  1180. Sep 17 19:31:18 <fprophet> all of my projects are usually done without any addons or libraries
  1181. Sep 17 19:31:30 <baxx> ah shit, you're not talking about that gif ha ha, nw
  1182. Sep 17 19:31:32 <fprophet> except for stuff I cant do myself, like sha encryption in c
  1183. Sep 17 19:31:44 <tcsc> i don't use many libraries when i can avoid it.
  1184. Sep 17 19:31:52 <fprophet> I've never used jquery
  1185. Sep 17 19:32:08 <fprophet> so whenever I have javascript questions I have to spend extra time finding a solution that doesnt use jquery
  1186. Sep 17 19:32:27 <tcsc> i use much more for work, but our deadlines are such that its very hard to avoid.
  1187. Sep 17 19:33:33 <tcsc> but quality suffers, both because i'll use a library even if it only does sort of what i need, and because we have like 2 week deadlines.
  1188. Sep 17 20:03:30 <Kamuela> Nothing wrong with jQuery that anyone has validly argued
  1189. Sep 17 20:03:55 <Kamuela> ^I know that's a pretty bold statement m
  1190. Sep 17 20:04:07 <zomg> Kamuela: it's a valid argument :P
  1191. Sep 17 20:06:41 <Kamuela> Why won't ghost just finish its damned external API
  1192. Sep 17 20:07:06 <Kamuela> It's making me login to view posts. Humbug
  1193. Sep 17 20:24:22 <tcsc> jquery's performance is probably the biggest thing wrong with it
  1194. Sep 17 20:24:36 <tcsc> it's also kind of bloated imo
  1195. Sep 17 20:25:09 <tcsc> but the performance isn't debatable. on mobile it's really bad.
  1196. Sep 17 20:25:24 <tcsc> or at least was like 8 months ago.
  1197. Sep 17 20:54:40 <Kamuela> 2.x or 1.x?
  1198. Sep 17 21:06:36 <Boar> Afternoon everyone, is there anything Special I have to do to get npm modules working with Requirejs?
  1199. Sep 17 21:57:34 <NitroLiq> Anyone awake?
  1200. Sep 17 21:59:57 <Boar> no
  1201. Sep 17 22:03:22 <NitroLiq> That stinks. I could use an extra pair of eyes to help me sort out a wee bit of jquery.
  1202. Sep 17 22:36:44 <vmonteco> Hello!
  1203. Sep 17 22:39:12 <vmonteco> I have a little question about mutations : If <div id="no1"><div id="no2"></div></div> is added to my page : will my MutationObserver get a mutation for each div (one for #no1, one for #no2), or only a mutation for #no1?
  1204. Sep 17 23:02:59 <Robarelli> how do I reference this element inside its options? http://kopy.io/I93nX
  1205. Sep 17 23:03:48 <Robarelli> i want the source to be dynamic, which is taken from an array, keyed by the element's name
  1206. Sep 18 00:28:58 <javascript278> hey guys
  1207. Sep 18 00:29:09 <javascript278> can anyone assist me in my javascript project?
  1208. Sep 18 00:29:16 <nodist> sure
  1209. Sep 18 00:29:32 <javascript278> nodist: great! one sec!
  1210. Sep 18 00:31:03 <javascript278> nodist: I'm trying to build this http://callmenick.com/_development/memory/
  1211. Sep 18 00:31:30 <javascript278> nodist: Basically I have one last feature I want to implement which is to show a preview of the tiles for 10 seconds before the game starts.
  1212. Sep 18 00:31:44 <nodist> ok
  1213. Sep 18 00:31:48 <javascript278> https://github.com/callmenick/Memory
  1214. Sep 18 00:32:09 <javascript278> the codes are in there, to be more specific https://github.com/callmenick/Memory/blob/master/js/memory.js
  1215. Sep 18 00:32:54 <javascript278> I'm not very good at prototype, how do I use the javascript file to create a button, and to show the preview for 10 second and then lead to the game?
  1216. Sep 18 00:33:32 <javascript278> I've toyed around for quite abit, and realise once I add the class "flipped" the tiles will be turned over. So how can I mass "flipped" the tiles for 10 second before removing the class
  1217. Sep 18 00:33:45 <javascript278> And also to not shuffle the preview tiles until the game is over.
  1218. Sep 18 00:33:53 <supay> would it make more sense to use something like semantic-ui for the frontend ui, or reactjs? if you can also explain the advantages of whichever, that would be amazing.
  1219. Sep 18 00:34:01 <nodist> you want to use document.createElement add an on click and append to the html
  1220. Sep 18 00:34:20 <javascript278> okay.
  1221. Sep 18 00:34:32 <javascript278> the problem is the "preview" of the tiles.
  1222. Sep 18 00:38:15 <javascript278> nodist: are you there?
  1223. Sep 18 00:38:33 <nodist> yeah its a lot, im looking
  1224. Sep 18 00:38:40 <javascript278> nodist: yeah thanks!
  1225. Sep 18 00:39:07 <supay> hm? is this the wrong channel to discuss frontend dev? :/
  1226. Sep 18 00:39:42 <javascript278> :/ but isn't javascript also for front end .
  1227. Sep 18 00:40:14 <supay> i guess its possible.. isnt that what react.js is?
  1228. Sep 18 00:41:01 <javascript278> supay: o.o I haven't heard of it :/ taking a look at it right now.
  1229. Sep 18 00:41:22 <GreenJello> supay, semantic ui is for quickly building web sties, react is for building complex web applications that are maintainable long term
  1230. Sep 18 00:41:44 <GreenJello> you could use them together, but you have to wrap the semantic ui stuff in react components
  1231. Sep 18 00:41:54 <javascript278> GreenJello: What about for web applications, I'm currently building web-based games like jigsaw puzzles.
  1232. Sep 18 00:41:59 <supay> GreenJello: ah, i see. and i can use react as the 'View' part in an MVC framework?
  1233. Sep 18 00:42:11 <supay> such as in conjugation with angular?
  1234. Sep 18 00:42:33 <GreenJello> you can, but react and angular don't get along
  1235. Sep 18 00:42:42 <supay> oh
  1236. Sep 18 00:42:44 <GreenJello> a lot of people just use react and other libraries to build applications
  1237. Sep 18 00:42:49 <supay> can react do the MV parts as well?
  1238. Sep 18 00:42:50 <supay> i see
  1239. Sep 18 00:43:03 <supay> it would be helpful if there was a list with such information :(
  1240. Sep 18 00:43:29 <GreenJello> no frameworks; the best use of react is when you need full control; it takes longer to get started with but pays off in the medium to long term
  1241. Sep 18 00:43:32 <supay> so difficult for newbies to get the right technologies installed and begin the learning process (i prefer to learn actively, as in, as i code)
  1242. Sep 18 00:44:01 <supay> interesting. very interesting. i guess ill just have to get react and try it out to see what is possible with it.
  1243. Sep 18 00:44:05 <GreenJello> supay, a good setup is react, webpack, reflux, superagent
  1244. Sep 18 00:45:17 <supay> awesome, googling! ^.^
  1245. Sep 18 00:45:56 <supay> btw, i might be comparing apples with oranges here. but if i want to make a decent sized, scalable web-application would you suggest i go with angular or react and the set you just mentioned?
  1246. Sep 18 00:47:47 <GreenJello> supay, do you want control and maintainability or a faster MVP that you might have to rewrite later on?
  1247. Sep 18 00:48:05 <nodist> <javascript278> you there I added a timeout at the begining but Im not going to take the time to add a button
  1248. Sep 18 00:49:00 <nodist> javascript278 here is the updated function http://jsfiddle.net/nodist/0qdd4xyg/
  1249. Sep 18 00:49:17 <javascript278> nodist: i'm taking a look
  1250. Sep 18 00:51:54 <javascript278> nodist: you select all the inner, and gave them flipped class
  1251. Sep 18 00:52:05 <nodist> yeah
  1252. Sep 18 00:52:22 <javascript278> interesting, i was trying this earlier and i just couldn't get it.
  1253. Sep 18 00:52:28 <nodist> but I only did it for 5s though
  1254. Sep 18 00:52:36 <javascript278> yup i know
  1255. Sep 18 00:52:47 <javascript278> nodist: i tried to createlement
  1256. Sep 18 00:53:01 <javascript278> this.gameButton = document.createElement("button");
  1257. Sep 18 00:53:37 <javascript278> how do I get the button
  1258. Sep 18 00:53:38 <javascript278> to show?? o.o
  1259. Sep 18 00:53:47 <nodist> append to it element
  1260. Sep 18 00:54:33 <javascript278> i did this
  1261. Sep 18 00:54:36 <nodist> eg document.getElementById(id).appnedChild(this.gameButton)
  1262. Sep 18 00:54:45 <nodist> append*
  1263. Sep 18 00:54:51 <javascript278> var x = document.createElement("BUTTON"); var t = document.createTextNode("Click me"); x.appendChild(t); document.body.appendChild(x);
  1264. Sep 18 00:54:54 <javascript278> something like that
  1265. Sep 18 00:54:58 <javascript278> but nothing show
  1266. Sep 18 00:55:30 <nodist> you don't need the document part
  1267. Sep 18 00:55:38 <nodist> lol wait I read it wrong
  1268. Sep 18 00:55:48 <nodist> you don't need the text node
  1269. Sep 18 00:56:57 <javascript278> so i just remove tht and it will work?
  1270. Sep 18 00:57:05 <javascript278> btw the code you sent me, why did you need the var self = this;
  1271. Sep 18 00:57:18 <javascript278> why even initialise self when you didnt use it?
  1272. Sep 18 00:57:19 <javascript278> o.o
  1273. Sep 18 00:57:31 <nodist> var but = document.createElement('button');
  1274. Sep 18 00:57:31 <nodist> but.textContent = 'Hello';
  1275. Sep 18 00:57:31 <nodist> document.body.appendChild(but);
  1276. Sep 18 00:58:00 <nodist> I did use the self
  1277. Sep 18 00:58:04 <nodist> look near the bottom
  1278. Sep 18 01:04:55 <nodist> !mdn promise
  1279. Sep 18 01:04:55 <ecmabot> nodist: Promise - JavaScript | MDN <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise>
  1280. Sep 18 01:08:06 <javascript278> nodist: thanks i got it to work!
  1281. Sep 18 01:08:12 <nodist> np
  1282. Sep 18 01:08:48 <javascript278> nodist: i feel that I will be using this prototype things again. Do you know where I could learn in detail about this?
  1283. Sep 18 01:09:10 <nodist> I guess mdn
  1284. Sep 18 01:09:11 <asd_> Hi. I want to make a bigger image side-by-side with a smaller image on a webpage. https://stackoverflow.com/questions/32645867/how-to-make-this-big-image-side-by-side-with-smaller-image Can someone help?
  1285. Sep 18 01:09:23 <javascript278> mdn?
  1286. Sep 18 01:09:28 <nodist> !mdn mdn
  1287. Sep 18 01:09:28 <ecmabot> nodist: Mozilla Developer Network <https://developer.mozilla.org/>
  1288. Sep 18 01:09:35 <javascript278> !mdn mdn
  1289. Sep 18 01:09:35 <ecmabot> javascript278: Mozilla Developer Network <https://developer.mozilla.org/>
  1290. Sep 18 01:09:42 <javascript278> oH
  1291. Sep 18 01:09:45 <javascript278> wow thanks!
  1292. Sep 18 01:09:48 <javascript278> I'm gonna read up on it
  1293. Sep 18 01:09:52 <nodist> !mdn prototype
  1294. Sep 18 01:09:52 <ecmabot> nodist: Object.prototype - JavaScript | MDN <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype>
  1295. Sep 18 01:09:59 <javascript278> !mdn prototype
  1296. Sep 18 01:09:59 <ecmabot> javascript278: Object.prototype - JavaScript | MDN <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype>
  1297. Sep 18 01:38:57 <Mackan90096> Hi! Does anyone know if and where I can accuire free Javascript stickers?
  1298. Sep 18 01:40:44 <vmonteco> Does anyone know for my MutationObserver question?
  1299. Sep 18 01:45:05 <ankr> Mackan90096 not free.. but http://devswag.com/
  1300. Sep 18 01:45:11 <ankr> otherwise go to conferences
  1301. Sep 18 02:02:40 <zomg> You can just try emailing or tweeting at companies too
  1302. Sep 18 02:02:44 <zomg> I've heard that sometimes works :P
  1303. Sep 18 02:03:43 <Mackan90096> Okay, I want a javascript sticker for my laptop, from where should I get it?
  1304. Sep 18 02:05:04 <ankr> Mackan90096 You could try find a meetup for your favorite technology and go there. Many times they bring stickers etc.
  1305. Sep 18 02:05:29 <Mackan90096> ankr: Hm, I'll google around a bit, thanks
  1306. Sep 18 02:07:05 <ankr> Mackan90096 You sit in sweden?
  1307. Sep 18 02:07:15 <Mackan90096> I do.
  1308. Sep 18 02:07:31 <Mackan90096> Not even close to stockholm or gothenburg though.
  1309. Sep 18 02:07:43 <ankr> Mackan90096 what about malmø?
  1310. Sep 18 02:08:27 <Gilgameshkun> "Gothenburg" has always sounded strange to me. Growing up speaking English in an opposite corner of the world, I'd always heard that city called "Goteborg". :P
  1311. Sep 18 02:08:38 <Mackan90096> That's about an hour from where I live.
  1312. Sep 18 02:08:58 <Mackan90096> Anyways, I'll be right back.
  1313. Sep 18 02:10:51 <ankr> Mackan90096 Maybe you can find something here http://javascript.meetup.com/cities/se/malm%C3%B8/ --- I would check for Copenhagen as well, there's usually a lot going on.
  1314. Sep 18 02:13:20 <moep> hi
  1315. Sep 18 02:13:21 <Mackan90096> Alright
  1316. Sep 18 02:13:24 <Mackan90096> I'm back.
  1317. Sep 18 02:14:26 <Mackan90096> Right. From where should I get stickers?
  1318. Sep 18 02:24:49 <teomar> !help
  1319. Sep 18 02:24:49 <ecmabot> teomar: For help, ask your question. Be patient. Code samples should be pasted in a paste service (see !paste). Tell us 1) what you want to happen, 2) what is actually happening, and 3) any error messages you find (see !describe and !debug).
  1320. Sep 18 02:26:27 <zomg> Yeah I'd imagine might be difficult to get stickers if you don't live in the US :P or have a major city near you
  1321. Sep 18 02:26:38 <zomg> here in Finland pretty much the only place with conferences or anything even resembling that is Helsinki
  1322. Sep 18 02:27:18 <acetoxy> zomg: unixstickers.com :)
  1323. Sep 18 02:27:21 <zomg> I think the commonly used JS logo (yellow box with letters JS) is open source though so if you like it you can grab the SVG and get it printed
  1324. Sep 18 02:27:30 <acetoxy> I just put a vim sticker on my laptop
  1325. Sep 18 02:27:32 <teomar> Here in Sardinia Italy we have plenty of conferences... of shepherds.
  1326. Sep 18 02:27:47 <zomg> I have a Daily WTF sticker on my macbook
  1327. Sep 18 02:27:55 <zomg> got it with the purchase of one of their mugs many years ago :D
  1328. Sep 18 02:28:28 <zomg> and one of these on my car :p http://store.dieselsweeties.com/products/warning-vehicle-transforms-into-robot-stickers
  1329. Sep 18 02:30:48 <teomar> I got a huge GitHub sticker on my macbook, but my fav is my old IBM Thinkpad X31, I have all kinds of stickers on it
  1330. Sep 18 02:31:08 <teomar> most irrelevant to tech though
  1331. Sep 18 02:31:19 <teomar> that robot sticker is awesome
  1332. Sep 18 02:32:10 <teomar> Hey, can someone help me with some JS issues?
  1333. Sep 18 02:33:12 <zomg> Sure, just ask
  1334. Sep 18 02:33:26 <teomar> I'll msg you
  1335. Sep 18 02:35:25 <teomar> so, if you go here http://f6f.e05.myftpupload.com/client (to unlock the coming soon screen) and then here http://f6f.e05.myftpupload.com/prodotto/peperoni/ take a look at the contents of child.js
  1336. Sep 18 02:36:07 <teomar> my problem is that window.* events do not load
  1337. Sep 18 02:36:29 <teomar> I've tried the resize and the onload events, nothing
  1338. Sep 18 02:37:09 <teomar> on the other hand, documen.ready works fine
  1339. Sep 18 02:45:10 <zomg> heh I tried to look at it but just get a fatal error :P
  1340. Sep 18 02:47:49 <teomar> huh?
  1341. Sep 18 02:47:52 <teomar> got a screensht?
  1342. Sep 18 02:48:22 <zomg> Warning: require_once(core/metaboxes.php): failed to open stream: No such file or directory in /home/content/p3pnexwpnas02_data03/79/2736279/html/wp-content/themes/shoelace/functions.php on line 212
  1343. Sep 18 02:48:34 <zomg> Fatal error: require_once(): Failed opening required 'core/metaboxes.php' (include_path='.:/usr/local/php5_4/lib/php') in /home/content/p3pnexwpnas02_data03/79/2736279/html/wp-content/themes/shoelace/functions.php on line 212
  1344. Sep 18 02:48:34 <teomar> ah
  1345. Sep 18 02:48:38 <teomar> I just added some stuff
  1346. Sep 18 02:48:51 <teomar> thanks, nevermind it for now
  1347. Sep 18 02:48:56 <zomg> ok :)
  1348. Sep 18 03:14:15 <teomar> zomg, still around?
  1349. Sep 18 03:14:28 <zomg> yeah
  1350. Sep 18 03:14:35 <teomar> could you please take another look?
  1351. Sep 18 03:14:39 <teomar> fixed the errors
  1352. Sep 18 03:15:29 <zomg> sure
  1353. Sep 18 03:16:23 <teomar> I changed a couple of things
  1354. Sep 18 03:16:26 <zomg> well looks like there's an error because jQuery(..).onload is not a function
  1355. Sep 18 03:16:44 <teomar> jQuery is in compatibility mode for WP
  1356. Sep 18 03:19:38 <teomar> okay, I'm an idiot
  1357. Sep 18 03:28:22 <teomar> fixed, apparently it was a compatibility issue
  1358. Sep 18 03:28:31 <teomar> I replaced $ with jQuery and everything worked.
  1359. Sep 18 03:28:53 <teomar> It's weird though, I've used this method in the past and everything worked fine, don't know what the deal was now.
  1360. Sep 18 03:43:23 <ahoo> do integers have to be quoted in json?
  1361. Sep 18 03:43:49 <Hannibal_Smith> ahoo, no
  1362. Sep 18 03:43:53 <ahoo> thx
  1363. Sep 18 03:45:07 <Gilgameshkun> Non-finite numbers do, or they'll serialize as null.
  1364. Sep 18 03:48:24 <zomg> teomar: iirc wordpress uses jQuery's noConflict mode so that would stop $ from working
  1365. Sep 18 03:49:34 <teomar> I know, but that's why you're supposed to do the whole jQuery.blabla(function($){ thing
  1366. Sep 18 03:49:49 <teomar> I've used it before w/ WP and it worked fine
  1367. Sep 18 03:49:57 <zomg> Ah
  1368. Sep 18 03:50:13 <teomar> now I'm creating my own bootstrap theme and I must have messed up something
  1369. Sep 18 03:50:19 <zomg> I think that works with jQuery(whatever).ready(function($) { }) (or with jQuery(function($) { }) )
  1370. Sep 18 03:51:00 <teomar> yeah, that's what I did
  1371. Sep 18 03:51:14 <teomar> in any case, screw it for now, it was for a very particular project :)
  1372. Sep 18 03:55:50 <Mackan90096> Okay, I have a contenteditable div. How do I insert a tab character at the caret position?
  1373. Sep 18 03:56:10 <Mackan90096> I already have a function to get the caret position and a hook on the tab key.
  1374. Sep 18 03:56:26 <Mackan90096> I'd like to not use jQuery for this.
  1375. Sep 18 03:58:38 <Mackan90096> Nevermind my question, I found a function for it.
  1376. Sep 18 04:12:55 <Mackan90096> Okay, in a contenteditable div, how do I set the caret position?
  1377. Sep 18 04:15:42 <deltab> set a zero-length selection, I think
  1378. Sep 18 04:16:02 <Mackan90096> deltab: How do I do that?
  1379. Sep 18 04:16:30 <deltab> by calling a method, probably
  1380. Sep 18 04:16:47 <Mackan90096> Obviously.
  1381. Sep 18 04:16:54 <Mackan90096> I meant in terms of what method(s)
  1382. Sep 18 04:17:01 <deltab> possibly by getting an object and setting its properties
  1383. Sep 18 04:17:20 <Mackan90096> !mdn contenteditable
  1384. Sep 18 04:17:21 <ecmabot> Mackan90096: Content Editable - Web developer guide | MDN <https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable>
  1385. Sep 18 04:27:17 <dbrock> is it impossible with the es6 module syntax to just import everything from a module?
  1386. Sep 18 04:27:24 <dbrock> import * from "foo" gives a syntax error
  1387. Sep 18 04:28:06 <ankr> try import * as foo from 'foo'
  1388. Sep 18 04:29:57 <dbrock> ah, yeah, that's what I opted for
  1389. Sep 18 04:31:35 <dbrock> I can do export * from "foo" though...?
  1390. Sep 18 04:33:12 <ankr> dbrock all syntaxes are explained here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
  1391. Sep 18 04:34:23 <deltab> dbrock: you always have to specify some name or names to assign to
  1392. Sep 18 05:08:22 <hellyeah> hey
  1393. Sep 18 05:08:36 <hellyeah> can i check button click or not like that? What am i missing here?
  1394. Sep 18 05:12:18 <supay> hellyeah: of course you can. thats what onClick() is for :)
  1395. Sep 18 05:15:36 <hellyeah> supay: when i click button i want to get alert what am i missing here? https://jsfiddle.net/3ssa5stm/17/
  1396. Sep 18 05:17:33 <Jordy> Is there a way to add a "<br/>" between 2 items everytime in a array? ['a', 'b', 'c', 'd'] -> ['a', 'b', '<br/>', 'c', 'd']?
  1397. Sep 18 05:19:31 --- ChanServ gives channel operator status to buu
  1398. Sep 18 05:20:38 <CamC> Hi, hope someone can help. I have a click event (returns position) on a parent div, and a child div inside, when I click it triggers the child, shouldnt it trigger the parent?
  1399. Sep 18 05:22:51 * buu removes quiet on $~a
  1400. Sep 18 05:23:46 <buu> CamC: It depends on how the event is captured and bubbled
  1401. Sep 18 05:24:46 <buu> hellyeah: what on earth is that code
  1402. Sep 18 05:27:04 <Guest33> guys, i need some help with Math. I have a calculation (37554 * 256) + 33 which outputs 9613857 - However with the # 9613857, how do i get back the number 37554?
  1403. Sep 18 05:28:28 <guessx> -33 / 256?
  1404. Sep 18 05:28:33 <buu> Guest33: reverse the operations?
  1405. Sep 18 05:29:48 <Guest33> yeah right ( 9613857 - 33) / 256
  1406. Sep 18 05:29:49 <Guest33> thanks!
  1407. Sep 18 05:32:51 <buu> welp
  1408. Sep 18 05:48:11 <Jordy> Is there a way to add a "<br/>" in between 2 items everytime in a array? ['a', 'b', 'c', 'd'] -> ['a', 'b', '<br/>', 'c', 'd']?
  1409. Sep 18 05:52:33 <ankr> >> ['a', 'b', 'c', 'd'].reduce(function (r, e, i) { if (i && !(i % 2)) { r.push('<br>'); } r.push(e); return r; }, []);
  1410. Sep 18 05:52:33 <ecmabot> ankr: (object) ['a', 'b', '<br>', 'c', 'd']
  1411. Sep 18 05:52:41 <ankr> Jordy try something like that
  1412. Sep 18 05:55:02 <nirakara> hi. I have this JS (https://dpaste.de/QsZs). When i click the allowPost button, i get "clicked" in console and nothing else. when I try clicking the button again i get Uncaught TypeError: Cannot read property 'send' of null (https://github.com/jonashagstedt/swampdragon/blob/master/swampdragon/static/swampdragon/js/dist/swampdragon.js#L330) why would this be?
  1413. Sep 18 05:55:15 <nirakara> it seems that the sockjs connection suddenly refers to nothing after the second click
  1414. Sep 18 06:01:35 <Jax2> Morning all... can someone help a total JS noob for a moment? I have a working script on my site on one page (http://riddlesforall.com/sudoku.php) and I am trying to move it to the new layout at (http://riddlesforall.com/new/sudoku.php) ... I have included links to the same css styles and the .js script yet on the first page, it works, on the 2nd, it doesn't, and I have no clue why
  1415. Sep 18 06:04:15 <buu> Jax2: Have you tried opening up the javascript console
  1416. Sep 18 06:04:54 <Jax2> in chrome?
  1417. Sep 18 06:06:38 <Jax2> It shows me an error - Uncaught TypeError: Cannot set property 'innerHTML' of null
  1418. Sep 18 06:07:22 <Jax2> the error points to this line in the JS code: document.getElementById("display_area").innerHTML = data + "<br />\n";
  1419. Sep 18 06:10:15 <Jax2> ha... figured it out, I missed a tiny little <div id="display_area"></div> at the bottom - thanks for the very brrief, but very helpful suggestion :)
  1420. Sep 18 06:12:26 <Jordy> ty ankr <3
  1421. Sep 18 06:14:24 <nirakara> hi. I have this JS (https://dpaste.de/QsZs). When i click the allowPost button, i get "clicked" in console and nothing else. when I try clicking the button again i get Uncaught TypeError: Cannot read property 'send' of null (https://github.com/jonashagstedt/swampdragon/blob/master/swampdragon/static/swampdragon/js/dist/swampdragon.js#L330) why is the sockjs object getting redefined to null?
  1422. Sep 18 06:21:41 <nirakara> does anyone know anything about data code 3001 when using sockjs
  1423. Sep 18 06:21:53 <nirakara> the connection is just closing
  1424. Sep 18 06:24:24 <bberry> So, we want to have a sort of "new features" page where users can go to and see new changes.... and we're thinking about having it in a blogish style format. Any library recommendations on blog formatting?
  1425. Sep 18 06:24:47 <buu> library.. blog.. formatting?
  1426. Sep 18 06:24:57 <buu> Need more context
  1427. Sep 18 06:30:37 <Sharaal1> bberry: perhaps you want to google "markdown parser javascript"
  1428. Sep 18 06:31:37 <bberry> Sharaal1, probably a good idea. i think the idea is for us to be able to add "posts" through the website interface instead of writing html/css or markdown.
  1429. Sep 18 06:31:53 <bberry> basically my coworker wants a wordpress
  1430. Sep 18 06:32:38 <Sharaal1> wordpress has a WYSIWYG editor, no need of markdown or writing html/css
  1431. Sep 18 06:34:29 <bberry> yeah, i know, i'm guessing that is what he wants. so i think WYSIWYG is probably the best google search term :D
  1432. Sep 18 06:34:31 <bberry> ty!
  1433. Sep 18 06:37:07 <Kamuela> bberry: are you trying to stick to a JavaScript stack or something?
  1434. Sep 18 06:38:08 <Kamuela> a lot of Wordpress comes down to its plugin ecosystem. But if the client wants primarily content management functionality there are admin pages for lots of JS stacks
  1435. Sep 18 06:38:35 <bberry> Kamuela, mostly we want to have full control of the content of our pages (look/feel) instead of having a link to a wordpress.
  1436. Sep 18 06:38:41 <aleray> Hi, I've written a scrip that allows one to select a document in a dropdown and load the selected document in an iframe on the page. This part seems to work, but I don't manage to restore the iframe src value on reload
  1437. Sep 18 06:38:50 <aleray> here is my code: http://dpaste.com/3F77XE7
  1438. Sep 18 06:39:19 <aleray> lines 15 and 16 are meant to restore the state but don't work
  1439. Sep 18 06:40:17 <aleray> actually it works on chromium, but not on epiphany
  1440. Sep 18 06:47:54 <GreenJello> aleray, parse location.hash
  1441. Sep 18 06:48:09 <GreenJello> get the value from there instead of the history object
  1442. Sep 18 06:51:45 <aleray> GreenJello, indeed I can do that. Still curious why the other solution don't work
  1443. Sep 18 06:51:57 <GreenJello> maybe a browser bug
  1444. Sep 18 06:52:18 <aleray> GreenJello, thanks
  1445. Sep 18 06:52:26 <GreenJello> history state is for session stuff, I've only seen it used to track things like scroll position
  1446. Sep 18 06:52:58 <GreenJello> if you want people to be able to link to the state, you put the data in the url and read from the url
  1447. Sep 18 06:57:24 <baxx> requestAnimationFrame can be a bit intense - what's an easy way to limit how many calls this makes? Make a counter variable with if(counter % val) or something or is there a different approach?
  1448. Sep 18 06:58:10 <GreenJello> baxx, what's up?
  1449. Sep 18 06:58:38 <undrinkablesoup> getBoundingClientRect() returns an object with left/top values that appear to work as long as the page has not scrolled. As soon as the page has been scrolled down, the values start to not match up, increasingly more and more the more you scroll. How can I account for that?
  1450. Sep 18 06:59:12 <aleray> GreenJello, thanks it works perfectly
  1451. Sep 18 07:00:45 <baxx> GreenJello: just that sometimes I don't think I need request to be requesting quite so much for what i'm doing, so it'd be cool to limit that a bit
  1452. Sep 18 07:02:50 <GreenJello> undrinkablesoup, maybe you want el.offsetTop/offsetLeft ?
  1453. Sep 18 07:03:25 <GreenJello> baxx, so you want to throttle http requests?
  1454. Sep 18 07:03:31 <undrinkablesoup> Sounds about right.
  1455. Sep 18 07:04:47 <smgs> http://jsfiddle.net/jyoticharan/r4AGd/6/ could someone guide. thanks
  1456. Sep 18 07:04:58 <smgs> i want it in pure javascript only. thanks.
  1457. Sep 18 07:06:11 <GreenJello> smgs, start by looking up the syntax for a "for loop"
  1458. Sep 18 07:06:23 <baxx> GreenJello: I dunno I guess so, just so that if it's currently refreshing 40 times a second I could change that to 10 or whatever just to make it a bit easier on the processer or whatnot
  1459. Sep 18 07:06:50 <smgs> GreenJello: https://jsfiddle.net/d03px1ut/ could you help with this.
  1460. Sep 18 07:07:00 <GreenJello> baxx, underscore/lodash has a function called throttle that lets you say "don't run this more than every 100ms"
  1461. Sep 18 07:07:00 <smgs> i just want to test if it can be done in pure javascript or not. thanks
  1462. Sep 18 07:07:18 <hellyeah> buu: what?
  1463. Sep 18 07:07:36 <baxx> GreenJello: I'm not using and libraries at the mo - I'm only doing something really basic for learning so it's nothing that has to be releasable or whatever
  1464. Sep 18 07:08:40 <GreenJello> throttle is the simplest way to solve that
  1465. Sep 18 07:08:53 <baxx> GreenJello: oh ok cool, didn't mean to be obtuse :)
  1466. Sep 18 07:08:53 <GreenJello> you could write it yourself if you like
  1467. Sep 18 07:09:12 <GreenJello> :-)
  1468. Sep 18 07:09:30 <baxx> GreenJello: if it's simple then yeah, but this was just something that I thought might make sense and maybe commonly done, I guess you've answer 'yes, with throttle though' ha
  1469. Sep 18 07:10:13 <smgs> brb. gtg.
  1470. Sep 18 07:10:26 <baxx> I'm a bit confused about why I'm getting only a small box on this that refreshes : https://jsfiddle.net/9scf62kh/
  1471. Sep 18 07:11:11 <baxx> You can move the ball with the arrow keys - but it can only move a bit
  1472. Sep 18 07:12:00 <zumba_addict> good morning folks. I posted a question on so about inheritance issue. This is the code that was given to. It works. However, I don't know if it's a good solution or if there is a nicer way - http://jsfiddle.net/dqggvjrj/
  1473. Sep 18 07:13:27 <_mouse_> zumba_addict what was the question this is solving?
  1474. Sep 18 07:13:40 <zumba_addict> inheritance issue
  1475. Sep 18 07:13:49 <zumba_addict> let me grab my post
  1476. Sep 18 07:14:08 <zumba_addict> this is what I posted last night - http://stackoverflow.com/questions/32643167/advanced-javascript-inheritance-is-failing-parent-parent-child
  1477. Sep 18 07:15:12 <GreenJello> yeah, that's pretty much how you do it
  1478. Sep 18 07:15:20 <GreenJello> or use es6 classes if you can
  1479. Sep 18 07:15:24 <yansanmo> my question would be, when do you need inheriting in javascript?
  1480. Sep 18 07:15:32 <zumba_addict> got it
  1481. Sep 18 07:15:50 <GreenJello> yansanmo, clearly for implementing people
  1482. Sep 18 07:16:08 <acmello> can you use composition instead?
  1483. Sep 18 07:16:11 <yansanmo> I would like to see a website with that modal
  1484. Sep 18 07:16:19 <yansanmo> *with that model
  1485. Sep 18 07:16:41 <zumba_addict> i was wondering why he had to prototype the method. Why did he not add the method at first?
  1486. Sep 18 07:16:46 <GreenJello> acmello, there's no real code there, so you can't really say if it's good or bad or how you'd do "it" in other ways
  1487. Sep 18 07:17:03 <GreenJello> because there's no "it"
  1488. Sep 18 07:17:58 <zumba_addict> btw, what does this do? ClassA.call(this);
  1489. Sep 18 07:17:58 <undrinkablesoup> GreenJello: offsetTop seems to increase even if the page has not been scrolled.
  1490. Sep 18 07:18:13 <GreenJello> seems to increase?
  1491. Sep 18 07:18:29 <acmello> GreenJello, I'm saying it's a better solution, just saying there're other different ways to deal situations where inheritance my be suitable :)
  1492. Sep 18 07:18:48 <undrinkablesoup> I use the following formula to calculate the Y position of the object: rectObject.top + theElement.offsetTop
  1493. Sep 18 07:18:49 <acmello> I'm not*
  1494. Sep 18 07:19:06 <undrinkablesoup> offsetTop seems to increase for each object (trs).
  1495. Sep 18 07:19:23 <GreenJello> oh right
  1496. Sep 18 07:19:24 <undrinkablesoup> I also tried - instead of +.
  1497. Sep 18 07:19:33 <GreenJello> you want relative to the top of the page?
  1498. Sep 18 07:19:37 <undrinkablesoup> Yeah.
  1499. Sep 18 07:19:43 <undrinkablesoup> (Of course?)
  1500. Sep 18 07:19:47 <ljharb> zumba_addict: that's just calling a function with its receiver set to the current "this"
  1501. Sep 18 07:20:10 <GreenJello> undrinkablesoup, do the clientRect and use document.body.scrollTop
  1502. Sep 18 07:20:18 * undrinkablesoup tries that
  1503. Sep 18 07:20:21 <zumba_addict> thanks ljharb. I put a debugger and ran over the code, the this grew
  1504. Sep 18 07:20:36 <GreenJello> add them together and that should give you the absolute position of the element
  1505. Sep 18 07:20:59 <zumba_addict> looks like that code is what implements the inheritance
  1506. Sep 18 07:21:20 <undrinkablesoup> GreenJello: Same thing seems to happen with that. Sigh.
  1507. Sep 18 07:21:26 <undrinkablesoup> As soon as I scroll, it becomes offset.
  1508. Sep 18 07:21:36 <undrinkablesoup> Only works when it has not scrolled.
  1509. Sep 18 07:22:14 <undrinkablesoup> This is really making my skin crawl...
  1510. Sep 18 07:22:54 <undrinkablesoup> I tried with - as well. Wrong.
  1511. Sep 18 07:23:11 <undrinkablesoup> rectObject.top + document.body.scrollTop
  1512. Sep 18 07:23:14 <undrinkablesoup> rectObject.top - document.body.scrollTop
  1513. Sep 18 07:23:20 <undrinkablesoup> Both work when it has not scrolled.
  1514. Sep 18 07:23:29 <undrinkablesoup> But as soon as it scrolls, the wrong values start being calculated.
  1515. Sep 18 07:24:45 <undrinkablesoup> GreenJello: Turns out that document.body.scrollTop never changes when I scroll.
  1516. Sep 18 07:24:50 <undrinkablesoup> That's why it calculates wrongly...
  1517. Sep 18 07:25:05 <undrinkablesoup> But why doesn't it? Isn't it scrollTop?
  1518. Sep 18 07:25:08 <zumba_addict> so "this" inside a function will have the scope of that function unless we substitute this to another variable like self and use self instead
  1519. Sep 18 07:25:19 <cjohnson> this and scope are totally separate concepts
  1520. Sep 18 07:25:27 <cjohnson> usually we call "this" the context, just to avoid confusion
  1521. Sep 18 07:25:43 <cjohnson> zumba_addict: read this article: http://perfectionkills.com/know-thy-reference/
  1522. Sep 18 07:25:52 <cjohnson> explains exactly how "this" works
  1523. Sep 18 07:25:58 <zumba_addict> k
  1524. Sep 18 07:26:06 <zumba_addict> thanks
  1525. Sep 18 07:26:25 <zumba_addict> i thought scope and context were the same
  1526. Sep 18 07:26:51 <cjohnson> scope = the variables that you have access to
  1527. Sep 18 07:26:56 <ljharb> actually usually we call "this" the "receiver" to avoid confusion
  1528. Sep 18 07:27:02 <ljharb> the word "context" is what causes confusion.
  1529. Sep 18 07:27:06 <cjohnson> aka the current function and all parent wrapping functions
  1530. Sep 18 07:27:34 <cjohnson> I am only going based on what I actually see in the real world, and I've never once seen the word receiver used. many docs use context and scope
  1531. Sep 18 07:27:44 <MinusFour> maybe lexical context but not execution context
  1532. Sep 18 07:29:20 <zumba_addict> i updated the code and the value got overwritten. This is now a real world scenario. What is the ideal way to address this? http://jsfiddle.net/dqggvjrj/1/
  1533. Sep 18 07:29:46 <zumba_addict> i'm referring to the age property I added in ClassC
  1534. Sep 18 07:30:53 <zumba_addict> so am I right that ClassC shouldn't have the same property name? or should I put another property that doesn't exist from the parent?
  1535. Sep 18 07:31:18 <cjohnson> code runs top to bottom zumba_addict
  1536. Sep 18 07:31:30 <cjohnson> setting this.age =10; and then setting this.age = 12; means this.age will be 12
  1537. Sep 18 07:31:38 <zumba_addict> no, it's 10
  1538. Sep 18 07:31:38 <cjohnson> which is what you're doing in ClassC
  1539. Sep 18 07:31:42 <undrinkablesoup> GreenJello: Isn't it window.scrollY?
  1540. Sep 18 07:31:43 <cjohnson> well, no
  1541. Sep 18 07:31:52 <undrinkablesoup> The question goes for everyone else too.
  1542. Sep 18 07:31:56 <cjohnson> you are setting this.age = 10; and then you are immediately after that setting this.age = 12;
  1543. Sep 18 07:31:59 <zumba_addict> that's what I am seeing on the output. It gets overwritten by classB
  1544. Sep 18 07:32:04 <undrinkablesoup> Maybe document.body.scrollTop is legacy and discontinued or something?
  1545. Sep 18 07:32:11 <GreenJello> undrinkablesoup, is the window scrolling or is it the table?
  1546. Sep 18 07:32:21 <undrinkablesoup> GreenJello: The browser window is scrolling, obviously...
  1547. Sep 18 07:32:25 <zumba_addict> i am instantiating classC first which calls classB
  1548. Sep 18 07:32:31 <GreenJello> tables can scroll, it's not uncommon :-)
  1549. Sep 18 07:32:32 <zumba_addict> classC is a child of classB
  1550. Sep 18 07:32:36 <undrinkablesoup> They can?
  1551. Sep 18 07:32:47 <GreenJello> height: 100px; overflow-y: scroll;
  1552. Sep 18 07:32:51 <undrinkablesoup> Well, either way, you said document.body...
  1553. Sep 18 07:32:55 <undrinkablesoup> Not theTableElement.
  1554. Sep 18 07:33:09 <GreenJello> I assumed the viewport was scrolling, yeah
  1555. Sep 18 07:33:14 <GreenJello> try it on another site
  1556. Sep 18 07:33:21 <GreenJello> put document.body.scrollTop in the console
  1557. Sep 18 07:34:16 <undrinkablesoup> Finally it works!
  1558. Sep 18 07:34:28 <undrinkablesoup> "I assumed the viewport was scrolling"
  1559. Sep 18 07:34:30 <voiter> is there a best practice for responsive tooltips? or would you suggest to use a plugin?
  1560. Sep 18 07:34:35 <undrinkablesoup> The viewport = browser/page window?
  1561. Sep 18 07:34:44 <undrinkablesoup> voiter: ?
  1562. Sep 18 07:34:58 <GreenJello> yeah
  1563. Sep 18 07:35:14 <GreenJello> scrollY is also fine, there's a lot of things you can do in many ways in dom
  1564. Sep 18 07:35:40 <shoky> zumba_addict: inheriting by prototype doesn't automatically call the "parent" constructor function for you. that part you do yourself, manually, as you're doing in your fiddle. so line 20 runs before line 11
  1565. Sep 18 07:38:20 <shoky> zumba_addict: er disregard, i'm too tired, wrong, should not have attempted now ;)
  1566. Sep 18 07:38:31 <zumba_addict> :D
  1567. Sep 18 07:38:40 <zumba_addict> let me remove the debugger and see if it changes
  1568. Sep 18 07:38:59 <ELCALOR> does anyone have an answer to this question? http://stackoverflow.com/questions/27712505/get-dom-of-adsense-ad-with-phantomjs
  1569. Sep 18 07:38:59 <MinusFour> you should move the parent constructor call to the top of the constructor of the child
  1570. Sep 18 07:39:17 <shoky> but yea ^ that'd fix your problem
  1571. Sep 18 07:39:45 <zumba_addict> nope, it's still 10. Yup, so this.age on line 20 should be swapped with ClassB.call(this); Right?
  1572. Sep 18 07:40:00 <MinusFour> yes
  1573. Sep 18 07:40:16 <baxx> I'm not sure why the movement is being odd on this https://jsfiddle.net/9scf62kh/11/
  1574. Sep 18 07:40:25 <zumba_addict> that means, I really have to be careful what I'm inheriting and what property names I use
  1575. Sep 18 07:41:00 <zumba_addict> so am I right that when calling the constructor when creating a child, it should always be the first call?
  1576. Sep 18 07:41:05 <GreenJello> which is part of why inheritance can be dangerous and confusing
  1577. Sep 18 07:41:15 <zumba_addict> i'm not sure if my terminologies are right :D
  1578. Sep 18 07:41:31 <GreenJello> yeah
  1579. Sep 18 07:41:44 <zumba_addict> k
  1580. Sep 18 07:41:45 <zumba_addict> :D
  1581. Sep 18 07:41:53 <zumba_addict> here is what I've noticed
  1582. Sep 18 07:43:03 <zumba_addict> here is what I've noticed after I've been running it manually. It constructor is similar to what I was doing in Pascal days where the params sent are updated by the function and are also seen by the caller that sent it. However, I remember add a special symbol before the parameter name
  1583. Sep 18 07:43:30 <zumba_addict> It constructor/The constructor^
  1584. Sep 18 07:43:47 <ljharb> i don't think Pascal is going to be too relevant
  1585. Sep 18 07:44:11 <zumba_addict> i'm referring to the inheritance like of ClassC.call(this)
  1586. Sep 18 07:44:31 <zumba_addict> the this parameter is similar to the pascal parameter when &somevar is used
  1587. Sep 18 07:45:28 <MinusFour> it really is just a function appending values to an object
  1588. Sep 18 07:45:37 <zumba_addict> in passcal function sum(somevar) - the somevar will be the old value even if it gets updated on the function. However, if declared as &somevar, it will be sent back to the caller
  1589. Sep 18 07:45:53 <zumba_addict> yeah MinusFour, that's what I meant. it's like extend?
  1590. Sep 18 07:46:12 <zumba_addict> i think extend does similar thing too. Right?
  1591. Sep 18 07:46:27 <zumba_addict> i don't know if extend is a javascript thing or an underscore thing
  1592. Sep 18 07:46:29 <MinusFour> i don't think so
  1593. Sep 18 07:47:01 <MinusFour> for example A extends B... B shouldn't override properties of A
  1594. Sep 18 07:47:12 <zumba_addict> they will be combined
  1595. Sep 18 07:47:19 <MinusFour> no, A will override B
  1596. Sep 18 07:47:19 <zumba_addict> right?
  1597. Sep 18 07:47:35 <zumba_addict> really?
  1598. Sep 18 07:48:06 <zumba_addict> maybe i'm getting confused with BackboneJS's extend with underscore's extend
  1599. Sep 18 07:48:54 <MinusFour> well, i would think it's a matter of when you are extending A over B
  1600. Sep 18 07:49:21 <MinusFour> although, i can't remember if underscore extends or jquery extends do those checks
  1601. Sep 18 07:50:06 <ljharb> !classes @ zumba_addict
  1602. Sep 18 07:50:07 <ecmabot> zumba_addict: Class hierarchies? Don't do that! http://raganwald.com/2014/03/31/class-hierarchies-dont-do-that.html (See also, !inheritance)
  1603. Sep 18 07:50:10 <ljharb> !inheritance @ zumba_addict
  1604. Sep 18 07:50:11 <ecmabot> zumba_addict: JavaScript does not really have “inheritance” like classical languages. What it has is more properly called “property delegation” or “behavior delegation” http://davidwalsh.name/javascript-objects - ie `foo.bar(baz)` when `!foo.hasOwnProperty('bar')` is essentially doing `Object.getPrototypeOf(foo).bar.call(foo, baz)`
  1605. Sep 18 07:50:12 <ljharb> read those.
  1606. Sep 18 07:50:34 <zumba_addict> thanks for the links, I'll read them once i get to my desk. I'm entering the tunnel soon
  1607. Sep 18 07:57:28 <baxx> still a bit comfused about what's going on with the movement on this https://jsfiddle.net/z09anyn2/1/ . I had the moveX moveY set to just +20 or -20, and then I've tried adding an if to make sure that they're at 0 when a different direction is pressed, but Its not really working and I'm sure it's something pretty basic.
  1608. Sep 18 07:57:29 <baxx>
  1609. Sep 18 08:00:00 <Sal> is there a way to check what element has been clicked?
  1610. Sep 18 08:00:19 <Sal> or do i have to compare pageX with every element on page?
  1611. Sep 18 08:02:11 <ljharb> Sal: it's the "target" property of the event object.
  1612. Sep 18 08:02:21 <ljharb> !mdn event object @ Sal
  1613. Sep 18 08:02:22 <ecmabot> Sal: Event - Web API Interfaces | MDN <https://developer.mozilla.org/en-US/docs/Web/API/Event>
  1614. Sep 18 08:02:50 <Sal> yes, but i can't use target, bevause the element i'm trying to click is a 1px line
  1615. Sep 18 08:03:28 <Sal> and to make it simple to catch, i added a 5px per side clickable area
  1616. Sep 18 08:03:51 <Sal> so, if i use target, it will only work if i click on the line
  1617. Sep 18 08:04:07 <Sal> don't know if i was clear
  1618. Sep 18 08:04:48 <Sal> its a 1px line, but i want to add a 5px tollerance on both sides
  1619. Sep 18 08:04:59 * zumba_addict is back :) I'll check out those links now ljharb
  1620. Sep 18 08:05:45 <ljharb> Sal: if you give the line 5px of margin on both sides, then clicking on the margin will be a click on the line.
  1621. Sep 18 08:05:57 <baxx> i have created a video of the behaviour http://sendvid.com/9iivpzny as demoed in this fiddle https://jsfiddle.net/z09anyn2/2/
  1622. Sep 18 08:08:01 <django_> someone help me with this: http://pastebin.com/Me11fFBr
  1623. Sep 18 08:09:02 <django_> that is the output when the page is loaded
  1624. Sep 18 08:09:32 <fschuindt> Folks, I am trying to get all strings between two brackets in a text using regex. https://jsfiddle.net/11ueputd/ But I am geting no success. Anybody can help me?
  1625. Sep 18 08:10:39 <CamC> Im trying to show a problem but my code doesnt seem to behave on jsfiddle https://jsfiddle.net/xn8w6nxk/1/ its a simple point click
  1626. Sep 18 08:10:59 <MinusFour> django_, so the problem is that $scope.testme is undefined right?
  1627. Sep 18 08:11:09 <smgs> GreenJello: thanks anwyas got it.
  1628. Sep 18 08:11:17 <django_> MinusFour: yes
  1629. Sep 18 08:11:28 <MinusFour> well, that's because $http.jsonp is most likely async
  1630. Sep 18 08:12:00 <shoky> baxx: the jsfiddle behaviour is because scrollbars appear, cause your body is larger than the window, cause your css injection isn't working properly
  1631. Sep 18 08:12:21 <MinusFour> in other words, by the time console.log prints $scope.testme, the $http.jsonp call hasn't call your function that populates that property
  1632. Sep 18 08:12:30 <shoky> baxx: or rather the css you're injecting is not proper css
  1633. Sep 18 08:12:53 <undrinkablesoup> Bleh. It seems as if I forget everything unless I constantly use it.
  1634. Sep 18 08:13:09 <baxx> shoky: ha shit, yeah I just zoomed out on the (local) page and it works as expected >.< I was really confused there. I'm not following about the CSS ?
  1635. Sep 18 08:13:13 <baxx> thanks though
  1636. Sep 18 08:13:19 <undrinkablesoup> Right now, I'm trying to remember the syntax to check if a given integer value is inside an array that looks like var someArray = [ 1, 2, 3, 4, 5 ];
  1637. Sep 18 08:13:28 <shoky> baxx: you have commas , instead of semicolons ;
  1638. Sep 18 08:13:46 <undrinkablesoup> And also, I'm trying to add to that array. I guess for the second problem, I do someArray.push(123);?
  1639. Sep 18 08:13:48 <shoky> baxx: width: 100%,
  1640. Sep 18 08:14:00 <shoky> baxx: height: 100%, padding: 0,
  1641. Sep 18 08:14:00 <MinusFour> undrinkablesoup, so basically indexOf?
  1642. Sep 18 08:14:00 <ljharb> undrinkablesoup: yes, but it's best not to mutate things.
  1643. Sep 18 08:14:06 <ankr> CamC try something like https://jsfiddle.net/11ueputd/1/
  1644. Sep 18 08:14:07 <undrinkablesoup> Mutate them?
  1645. Sep 18 08:14:11 <baxx> shoky: ah of course, school boy all round then, thanks :)
  1646. Sep 18 08:14:17 <undrinkablesoup> MinusFour: Not sure.
  1647. Sep 18 08:14:18 <ljharb> undrinkablesoup: change
  1648. Sep 18 08:14:28 <undrinkablesoup> ljharb: I don't understand what you mean.
  1649. Sep 18 08:14:31 <ljharb> undrinkablesoup: ie, don't add something to someArray. make a brand new array using concat.
  1650. Sep 18 08:14:39 <ljharb> undrinkablesoup: `var newArray = someArray.concat(123)`
  1651. Sep 18 08:14:52 <undrinkablesoup> I fail to see the difference...?
  1652. Sep 18 08:14:53 <baxx> shoky: yeh it works now, thought it would be something trivial, cheers
  1653. Sep 18 08:15:00 <undrinkablesoup> Or rather...
  1654. Sep 18 08:15:01 <shoky> np
  1655. Sep 18 08:15:08 <django_> MinusFour: that means one is running in thebackground right?
  1656. Sep 18 08:15:09 <undrinkablesoup> Why make a new array?
  1657. Sep 18 08:15:20 <ljharb> undrinkablesoup: the difference is that then "someArray" never changes, so it's easier to reason about what it contains, and it's easier for the engine to optimize it.
  1658. Sep 18 08:15:32 <ljharb> undrinkablesoup: mutation in general makes code harder to reason about.
  1659. Sep 18 08:15:44 <CamC> ankr:how does that help?
  1660. Sep 18 08:16:11 <MinusFour> var someArray = [1, 2, 3, 4, 5]; someArray.indexOf(1) > -1; /* true */ someArray.indexOf(0) > - 1; /* false */
  1661. Sep 18 08:16:44 <ljharb> oh right, i skipped the first question
  1662. Sep 18 08:16:50 <ljharb> indexOf, yes
  1663. Sep 18 08:16:58 <MinusFour> or use maps
  1664. Sep 18 08:17:16 <MinusFour> rather, i think maps would be faster for this
  1665. Sep 18 08:17:22 <MinusFour> instead of array
  1666. Sep 18 08:18:28 <MinusFour> django_, yes, the $http.jsonp "runs in the background", so it hasn't finished just yet by the time you call console.log($scope.testme)
  1667. Sep 18 08:18:56 <django_> MinusFour: how do i fix this?
  1668. Sep 18 08:19:08 <django_> my whole program is based off the http call
  1669. Sep 18 08:19:20 <MinusFour> you either continue down the callback path
  1670. Sep 18 08:19:24 <MinusFour> or you start using promises
  1671. Sep 18 08:20:13 <MinusFour> what framework are you using?
  1672. Sep 18 08:21:20 <undrinkablesoup> ljharb: But the whole point is that I'm adding elements to that array.
  1673. Sep 18 08:21:27 <ljharb> undrinkablesoup: right, why?
  1674. Sep 18 08:21:40 <ljharb> undrinkablesoup: i'm suggesting that your program would be designed better, and would work better, if you didn't do that :-)
  1675. Sep 18 08:21:40 <undrinkablesoup> ljharb: Because it's the data structure that contains the items...
  1676. Sep 18 08:21:57 <django_> MinusFour: angular
  1677. Sep 18 08:22:06 <undrinkablesoup> If I make a local copy and add to that, it... won't change the real data structure.
  1678. Sep 18 08:22:19 <ljharb> undrinkablesoup: so instead of having something point to the same array, and keep making changes to it - like it's a big global variable - use functions, that accept an array, and return a new array
  1679. Sep 18 08:22:24 <RangerMauve> Anyone have ideas about looking up variable lookups in snippits of javascript? For example. Given something like "foo.bar = baz(fizz)", how should I go about detecting that `foo`, `baz`, and `fizz` were referenced? The goal is to make my expressions in a templating language fancier.
  1680. Sep 18 08:22:31 <ljharb> undrinkablesoup: i'm saying you shouldn't have one "real data structure"
  1681. Sep 18 08:22:40 <undrinkablesoup> Well, it *is* a global variable.
  1682. Sep 18 08:22:54 <undrinkablesoup> I know a lot of programmers hate global variables, but they are beautiful IMO.
  1683. Sep 18 08:22:55 <RangerMauve> Currently I'm just adding special syntax to have users add a `@` before variable lookups in the scope, but I've been advised to make it fancier
  1684. Sep 18 08:23:22 <ljharb> undrinkablesoup: lol if you have a global variable you've already thrown readability, maintainability, and the last 10 years of best practices out the window, so ¯\_(ツ)_/¯
  1685. Sep 18 08:23:43 <smgs> are there any pure javascript codes ? i want to learn so that i could code for my android device. thanks. i am using DroidScript ( google play Store ) thanks
  1686. Sep 18 08:24:02 <MinusFour> django_, $http.jsonp returns a promise which you could use
  1687. Sep 18 08:24:05 <undrinkablesoup> ljharb: What can I say? I don't get why you hate global variables.
  1688. Sep 18 08:24:15 <undrinkablesoup> I hate shuffling data around and making everything so damn abstract.
  1689. Sep 18 08:24:18 <ljharb> undrinkablesoup: because i'm a programmer with more than zero experience?
  1690. Sep 18 08:24:18 <GreenJello> !eloquent @ smgs
  1691. Sep 18 08:24:19 <ecmabot> smgs: Eloquent JavaScript is a comprehensive introductory Web-based book with examples and a built-in interpreter. http://eloquentjavascript.net/
  1692. Sep 18 08:24:21 <GreenJello> read that
  1693. Sep 18 08:24:26 <django_> MinusFour: where can i read about promises
  1694. Sep 18 08:24:35 <smgs> GreenJello: yup i did read that :).
  1695. Sep 18 08:24:38 <ljharb> !globals @ undrinkablesoup
  1696. Sep 18 08:24:39 <ecmabot> undrinkablesoup: Globals: not even once! It's best to avoid global variables. As variables lose scope, they will be eligible for garbage collection. If they are scoped globally, then they will not be eligible for collection until the global namespace loses scope (e.g. when the page unloads). See also !IIFE
  1697. Sep 18 08:24:50 <GreenJello> smgs, and you understand it?
  1698. Sep 18 08:24:51 <ljharb> that's just a performance reason they're awful. but there's many more.
  1699. Sep 18 08:24:53 <smgs> GreenJello: thanks. testing the first sample code there. thanks
  1700. Sep 18 08:24:55 <MinusFour> django_, to use them?
  1701. Sep 18 08:25:05 <undrinkablesoup> Also, it's annoying that I can do "php.net/whatever" to get to official documentation on PHP stuff, but I have to open my "MozDev" link and manually input a search term to get to not-really-official-at-all documentation on JS.
  1702. Sep 18 08:25:20 <django_> MinusFour: idk what a promose is
  1703. Sep 18 08:25:21 <django_> promise*
  1704. Sep 18 08:25:27 <MinusFour> here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
  1705. Sep 18 08:25:45 <undrinkablesoup> Well, of course I'm not making random variables global for no reason. I only use them for variables that... are... global.
  1706. Sep 18 08:25:50 <RangerMauve> undrinkablesoup: You could read the Ecmasrcript standards. But they're kinda shit for beginners
  1707. Sep 18 08:26:03 <ljharb> undrinkablesoup: http://mdn.io/whatever
  1708. Sep 18 08:26:05 <undrinkablesoup> Like, "var masterContainerOfItems = [];" in the beginning of the script, and then all functions can refer to that one and add items or remove them.
  1709. Sep 18 08:26:17 <ljharb> undrinkablesoup: and no variables should be global. that's a horrible horrible design and you should feel bad for doing it.
  1710. Sep 18 08:26:31 <undrinkablesoup> Global variable shaming?
  1711. Sep 18 08:26:35 <ljharb> absolutely
  1712. Sep 18 08:26:44 <GreenJello> undrinkablesoup, I do l{tab}mdn promise where `l` is the custom search trigger for feeling lucky search
  1713. Sep 18 08:26:51 <ljharb> there should be a tumblr with programmers holding signs like "i made a global variable"
  1714. Sep 18 08:27:13 <ljharb> "i used the with statement"
  1715. Sep 18 08:27:14 <smgs> GreenJello: awesome! the first code ran. Epic!! so very thankful to you. :)
  1716. Sep 18 08:27:23 <ljharb> "i didn't write tests"
  1717. Sep 18 08:27:35 <MinusFour> undrinkablesoup, does your variable literally needs to be reached from everywhere?
  1718. Sep 18 08:27:44 <cjohnson> the answer is no :P
  1719. Sep 18 08:28:13 <RangerMauve> "I modified a built in prototype"
  1720. Sep 18 08:28:19 <ljharb> ^
  1721. Sep 18 08:29:57 <RangerMauve> Anyone know of an uber simple module for parsing JS expressions into something that can be toyed with?
  1722. Sep 18 08:31:10 <cjohnson> RangerMauve: meaning what
  1723. Sep 18 08:31:50 <RangerMauve> cjohnson: Basically, I want something that'd parse a JS expression and tell me what different parts it contains. Like variable lookups and function calls
  1724. Sep 18 08:33:27 <RangerMauve> My specific use case is for parsing expressions in a template library I'm working on
  1725. Sep 18 08:33:39 <RangerMauve> I really just care about variable lookups in the template scope
  1726. Sep 18 08:33:40 <MinusFour> so a JS parser?
  1727. Sep 18 08:34:01 <RangerMauve> A basic one. Like, the fewer features it has the better
  1728. Sep 18 08:34:17 <MinusFour> maybe uglifyjs
  1729. Sep 18 08:34:20 <zetlen> i made a request test library!
  1730. Sep 18 08:34:20 <MinusFour> or esprima
  1731. Sep 18 08:34:24 <zetlen> https://github.com/zetlen/jort
  1732. Sep 18 08:34:29 <zetlen> feedback welcome
  1733. Sep 18 08:34:37 <zetlen> it's just a little tool for single-use mocks of http servers
  1734. Sep 18 08:34:39 <zomg> Esprima's good but it's pretty complex
  1735. Sep 18 08:35:36 <RangerMauve> Yeah, that's the thing. It's like 5.5k SLOC or something crazy like that
  1736. Sep 18 08:36:26 <RangerMauve> I was thinking of maybe not dealing with actual parsing and figuring out a clever regex or something like that
  1737. Sep 18 08:36:44 <ljharb> RangerMauve: JS is a big language. you can't get a correct and small JS parser.
  1738. Sep 18 08:36:48 <ljharb> RangerMauve: and do NOT use regex.
  1739. Sep 18 08:36:50 <ljharb> !regex html @ RangerMauve
  1740. Sep 18 08:36:50 <zomg> JS is pretty flexible so you can structure things in a ton of different ways
  1741. Sep 18 08:36:50 <ecmabot> RangerMauve: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
  1742. Sep 18 08:36:55 <Lethalman> NO regex
  1743. Sep 18 08:36:57 <ljharb> regular expressions are for regular languages. JS isn't one.
  1744. Sep 18 08:37:04 <zomg> so yeah like ljharb says it's not gonna be parseable like that
  1745. Sep 18 08:37:08 <ljharb> RangerMauve: just use a correct parser, no matter how big it is.
  1746. Sep 18 08:37:18 <zomg> RangerMauve: why are you so concerned about the size anyway?
  1747. Sep 18 08:37:26 <RangerMauve> Because I want this to be used client-side
  1748. Sep 18 08:37:56 <zomg> You should probably just define your own DSL
  1749. Sep 18 08:38:05 <zomg> Something that's simpler to parse
  1750. Sep 18 08:38:07 <ljharb> i really don't think you do want that.
  1751. Sep 18 08:38:15 <ljharb> but if you do, then ship an entire JS parser to the client.
  1752. Sep 18 08:38:59 <RangerMauve> The current DLS I have is a layer over top of JS where using `@` in front of an identifier constitutes a lookup of a variable in the template scope
  1753. Sep 18 08:39:07 <RangerMauve> *DSL
  1754. Sep 18 08:40:10 <RangerMauve> And that works fine since I let the browser deal with syntax errors after I process the expressions to use my `@` thing. But a person I had reviewing my project suggested I try to detect variable lookups automagically
  1755. Sep 18 08:41:14 <RangerMauve> I know for sure that other projects have done that without having to resort to esprima or other full featured parsers,
  1756. Sep 18 08:42:04 <zomg> I don't think any project is attempting to shove JS into a template language
  1757. Sep 18 08:42:12 <zomg> I mean I suppose they could just run it through eval if they do
  1758. Sep 18 08:42:20 <RangerMauve> VueJS and Ractive for one
  1759. Sep 18 08:42:59 <zomg> if they allow full js syntax then they probably eval it
  1760. Sep 18 08:43:07 <ljharb> RangerMauve: "automagically" is another word for "implicit", which is strictly worse imo
  1761. Sep 18 08:43:17 <ljharb> things should be explicit.
  1762. Sep 18 08:43:27 <RangerMauve> Currently I'm using the Function constructor which is essentially eval without the fancy scope features
  1763. Sep 18 08:43:49 <RangerMauve> ljharb: Yeah, that's why I started with my syntax.
  1764. Sep 18 08:44:07 <ljharb> eesh, Function is basically the same as eval
  1765. Sep 18 08:44:33 <zomg> Where does vue.js allow full JS syntax btw?
  1766. Sep 18 08:47:43 <zomg> Ractive uses Function as well it seems
  1767. Sep 18 08:48:03 <zomg> Angular has some sort of expressions which are similar to JS expressions, not sure what they use, but they definitely don't allow full syntax either
  1768. Sep 18 08:50:45 <RangerMauve> zomg: You can use JS expressions in directives in Vue
  1769. Sep 18 08:52:07 <zomg> ok, seems that's also a simplified syntax
  1770. Sep 18 08:55:15 <zap0> if i have var a; in global scope what is it assigned ?
  1771. Sep 18 08:55:29 <MinusFour> undefined
  1772. Sep 18 08:57:30 <zap0> ok. thank you.
  1773. Sep 18 08:59:55 <ljharb> zap0: same thing as in any scope.
  1774. Sep 18 09:01:09 <zap0> ok. i'm a C programmers, trying to comprehend the differences between undefined and null. and also trying to find out if var a; gets assigned a null by default.
  1775. Sep 18 09:01:12 <zap0> clearly not.
  1776. Sep 18 09:01:25 <MinusFour> they are just different
  1777. Sep 18 09:01:30 <zap0> programmer/
  1778. Sep 18 09:01:33 <ljharb> "undefined" is the default value of a variable, and the value returned from a nonexistent object property as well.
  1779. Sep 18 09:01:45 <ljharb> "null" means "no object" and is usually only there if a programmer explicitly put it there.
  1780. Sep 18 09:01:54 <AciD`> exactly
  1781. Sep 18 09:02:00 <persina> Can someone help me here? I'm trying to make serializeArray() return an array with the boxes that are checked. https://bpaste.net/show/7b565173bd21
  1782. Sep 18 09:02:05 <zap0> ok.
  1783. Sep 18 09:02:29 <AciD`> var a; 'gets assigned' to undefined
  1784. Sep 18 09:02:58 <AciD`> then you as a dev must do something like a = null; for it to be null
  1785. Sep 18 09:03:14 <zap0> ok, i got it now! thanks
  1786. Sep 18 09:03:27 <ljharb> persina: what's "generate_map"
  1787. Sep 18 09:03:32 <AciD`> it's pretty handy!
  1788. Sep 18 09:03:40 <ljharb> persina: if it's the <form> tag containing the checkboxes, that should just work.
  1789. Sep 18 09:03:41 <persina> ljharb: the var containing the form
  1790. Sep 18 09:03:50 <ljharb> (assuming it's a jquery object)
  1791. Sep 18 09:04:13 <zap0> DOMContentLoaded event can have multiple listeners.. but how do you determine which order they get run in ?
  1792. Sep 18 09:04:30 <persina> ljharb: It is a jquery object. I'm getting three seperate objects back from serializeArray()
  1793. Sep 18 09:04:55 <persina> ljharb: I want one object containing all three values
  1794. Sep 18 09:05:09 <bluezone> Are you allowed to have one array that contains multiple types in javascript? i.e. [2,3,'foo','lol']
  1795. Sep 18 09:05:21 <ljharb> persina: that makes no sense
  1796. Sep 18 09:05:37 <ljharb> persina: you get an array of objects, each one has a "value" and "name" (or label, i forget) attribute
  1797. Sep 18 09:05:38 <zap0> bluezone, sounds like you want an object.
  1798. Sep 18 09:05:49 <ljharb> persina: you could map that array to an array of values, but an object doesn't make sense.
  1799. Sep 18 09:05:58 <ljharb> since there can be multiple checkboxes with the same name
  1800. Sep 18 09:06:10 <ljharb> bluezone: yes, of course. JS is untyped in that way.
  1801. Sep 18 09:06:10 <bluezone> zap0: just want to know if it's possible so I can avoid iterating over the entire array in my test
  1802. Sep 18 09:06:24 <bluezone> ok
  1803. Sep 18 09:06:26 <zap0> bluezone tias!
  1804. Sep 18 09:06:28 <ljharb> bluezone: that doesn't mean it's a good thing to have tho, you should try to keep arrays unityped
  1805. Sep 18 09:06:42 <MinusFour> persina, jquery documentation says it's for forms and form controls
  1806. Sep 18 09:06:47 <Impaloo> there are typed arrays in ES6
  1807. Sep 18 09:06:58 <persina> MinusFour: this is inside a form
  1808. Sep 18 09:07:01 <MinusFour> ah
  1809. Sep 18 09:07:07 <ljharb> Impaloo: true
  1810. Sep 18 09:07:25 <MinusFour> is generate_map a jquery with a form collection?
  1811. Sep 18 09:07:27 <ljharb> persina: an object (a key-value map) would be incorrect for checkboxes.
  1812. Sep 18 09:08:01 <persina> MinusFour: generate_map is the form variable
  1813. Sep 18 09:08:31 <persina> ljharb: What do you mean? that is how it is being interpreted by serializeArray()
  1814. Sep 18 09:08:40 <ljharb> persina: serializeArray returns an array.
  1815. Sep 18 09:08:48 <ljharb> persina: that array contains N objects, one per checkbox.
  1816. Sep 18 09:08:59 <ljharb> persina: each of those objects has the name of the checkbox, and its value, as properties.
  1817. Sep 18 09:09:21 <ljharb> that's the only sensible data structure to use to represent HTML checkboxes that's not a query string.
  1818. Sep 18 09:09:41 <persina> ljharb: yes, I understand. But if there is a group of checkboxes all with the same name I only want one variable to send with the post.
  1819. Sep 18 09:09:55 <ljharb> persina: then you don't want checkboxes, you want radio buttons.
  1820. Sep 18 09:10:09 <ljharb> checkboxes are for sending multiple values with the same name. radio buttons are for selecting only one out of a group of values with the same name.
  1821. Sep 18 09:10:20 <persina> ljharb: radio buttons only allow one option to be checked, I want to allow any number.
  1822. Sep 18 09:10:33 <ljharb> um, then why would you only send one option with the post?
  1823. Sep 18 09:10:40 <ljharb> if i check 10 options you should send 10 things
  1824. Sep 18 09:10:50 <ljharb> (which is what the browser will do by default)
  1825. Sep 18 09:11:28 <persina> ljharb: I want to send one object containing all the values that are checked. An array of checked values.
  1826. Sep 18 09:11:47 <ljharb> persina: that's how the browser sends it by default.
  1827. Sep 18 09:12:02 <ljharb> persina: whatever you're using on the serverside, if it's not totally broken, will automatically interpret it as an array of the values.
  1828. Sep 18 09:12:16 <ljharb> so you literally don't have to do a thing to make this work. zero JS.
  1829. Sep 18 09:12:46 <ljharb> (also, even though arrays are objects in JS, it's super confusing to call arrays objects, because they're not objects, conceptually)
  1830. Sep 18 09:13:17 <zap0> if there a string.indexOf that is case insensitive?
  1831. Sep 18 09:13:27 <persina> ljharb: For some reason it's veiwing them as separate values and overwritting, and i'm only recieving the last checked checkbox.
  1832. Sep 18 09:13:34 <Impaloo> >> Object.create(Array.prototype)
  1833. Sep 18 09:13:34 <ecmabot> Impaloo: (object) {}
  1834. Sep 18 09:13:37 <ljharb> zap0: no, use regex for that.
  1835. Sep 18 09:13:43 <ljharb> persina: ah! add "[]" on the end of the name.
  1836. Sep 18 09:13:45 <tcsc> or lowercase the string first.
  1837. Sep 18 09:13:53 <ljharb> persina: ie, instead of `name="foo"`, do `name="foo[]"`
  1838. Sep 18 09:14:04 <persina> ljharb: I have that already
  1839. Sep 18 09:14:04 <ljharb> persina: and it will Just Work. (i assume you're using php, or ruby on rails)
  1840. Sep 18 09:14:11 <ljharb> ah. what server tech are you using?
  1841. Sep 18 09:14:17 <persina> ljharb: I'm using django
  1842. Sep 18 09:14:30 <ljharb> ok then you should figure out how to fix django, because doing that is utterly broken.
  1843. Sep 18 09:14:37 <MinusFour> lool
  1844. Sep 18 09:14:46 <ljharb> with multiple values that end in "[]", everything should make an array
  1845. Sep 18 09:14:54 <leptone> how do i round to the nearest tenth?
  1846. Sep 18 09:14:57 <persina> ljharb: that's what I thought too...
  1847. Sep 18 09:15:13 <ljharb> with multiple values that don't end in "[]", php and rails will keep the last thing, and everything else usually makes an array.
  1848. Sep 18 09:15:24 <ljharb> persina: so in all honesty i'd ask the django people how to fix it
  1849. Sep 18 09:15:36 <MinusFour> i didn't know django do that
  1850. Sep 18 09:15:37 <persina> ljharb: k, off to #django
  1851. Sep 18 09:15:39 <ljharb> *especially* if you already have "[]" on the end of your name
  1852. Sep 18 09:15:42 <ljharb> good luck
  1853. Sep 18 09:15:42 <ljharb> !
  1854. Sep 18 09:15:57 <ljharb> persina: you can work around it in JS but you definitely shouldn't have to :-)
  1855. Sep 18 09:16:18 <persina> ljharb: Yea, i know I can but thats messy.
  1856. Sep 18 09:16:23 <ljharb> very
  1857. Sep 18 09:17:31 <zap0> if i have var a = "a string"; and i'm finished with a.. so it can get garbage collected/recycled.. what do i do with a ?
  1858. Sep 18 09:17:54 <MinusFour> delete window.a;
  1859. Sep 18 09:17:56 <cjohnson> leptone: multiply by 10, round, divide by 10
  1860. Sep 18 09:18:36 <leptone> so cjohnson this: Math.round((10.111*10)/10) should output 10.1?
  1861. Sep 18 09:18:42 <ljharb> zap0: nothing
  1862. Sep 18 09:18:42 <leptone> cuz I'm getting 10
  1863. Sep 18 09:18:51 <ljharb> zap0: never use any globals tho, because globals never get garbage collected
  1864. Sep 18 09:18:55 <_mouse_> MinusFour zap0 delete is an expensive function. just let the js internal garbage cpollection handle it
  1865. Sep 18 09:19:06 <ljharb> zap0: but JS is a memory-managed language. do not ever ever ever worry about memory.
  1866. Sep 18 09:19:45 <ljharb> zap0: just make variables when you need to and stop using them when you're done.
  1867. Sep 18 09:20:36 <guessx> leptone:((10.111*10)/10).toFixed(1)
  1868. Sep 18 09:20:57 <zap0> MinusFour, thanks.
  1869. Sep 18 09:21:41 <cjohnson> leptone: nope you have your operations mixed up
  1870. Sep 18 09:21:55 <cjohnson> you're rounding at the end, but I said to round second, THEN divide by 10
  1871. Sep 18 09:22:08 <leptone> got it thx
  1872. Sep 18 09:22:19 <cjohnson> >> Math.round(10.111*10)/10
  1873. Sep 18 09:22:20 <ecmabot> cjohnson: (number) 10.1
  1874. Sep 18 09:22:27 <cjohnson> toFixed won't round anything
  1875. Sep 18 09:23:41 <cjohnson> Oh, I'm wrong
  1876. Sep 18 09:24:09 <cjohnson> guess it does round
  1877. Sep 18 09:30:49 <tcsc> ugh. my work is 3 weeks late on payroll. i feel like i should just go home at this point.
  1878. Sep 18 09:34:20 <Torkable> yea
  1879. Sep 18 09:34:22 <Torkable> you should
  1880. Sep 18 09:34:42 <Torkable> and fix resume lol
  1881. Sep 18 09:36:11 <cjohnson> uh yes
  1882. Sep 18 09:36:26 <cjohnson> late with a paycheck definitely points to solvency issues
  1883. Sep 18 09:36:40 <cjohnson> or insane management
  1884. Sep 18 09:36:43 <cjohnson> either way be afraid
  1885. Sep 18 09:36:44 <cjohnson> lol
  1886. Sep 18 09:37:01 <graphettion> I'm struggling with this. Note: I don't want an answer. I just want to understand what to do - https://jsfiddle.net/fpmcs60x/
  1887. Sep 18 09:39:47 <tcsc> yeah. resume is already fixed and i've already been applying for jobs, since I'm not really happy with the direction we've been taking... but i should probably get more serious about it.
  1888. Sep 18 09:40:50 <guessx> graphettion that shouldnt work
  1889. Sep 18 09:42:18 <graphettion> guessx: Right, my code doesn't work. I'm not sure what to do to achieve the repeated string.
  1890. Sep 18 09:44:35 <MinusFour> well, you'll need to do your function recursive
  1891. Sep 18 09:45:20 <Torkable> hmm?
  1892. Sep 18 09:45:21 <Torkable> try fill
  1893. Sep 18 09:45:23 <Torkable> lets see
  1894. Sep 18 09:45:37 <Torkable> >> Array(5).fill('n')
  1895. Sep 18 09:45:37 <ecmabot> Torkable: TypeError: Array(5).fill is not a function
  1896. Sep 18 09:45:49 <Torkable> b> Array(5).fill('n')
  1897. Sep 18 09:45:51 <babelbot> Torkable: (okay) [ 'n', 'n', 'n', 'n', 'n' ]
  1898. Sep 18 09:45:54 <Torkable> ok
  1899. Sep 18 09:46:17 <Torkable> so just put the number you want in the array
  1900. Sep 18 09:46:21 <Torkable> and fill with the string
  1901. Sep 18 09:46:28 <Torkable> and join('')
  1902. Sep 18 09:46:35 <Torkable> b> Array(5).fill('n').join('')
  1903. Sep 18 09:46:38 <babelbot> Torkable: (okay) nnnnn
  1904. Sep 18 09:46:42 <Torkable> wewt
  1905. Sep 18 09:46:43 <Torkable> done
  1906. Sep 18 09:48:04 <graphettion> lol
  1907. Sep 18 09:48:12 <Torkable> ?
  1908. Sep 18 09:48:15 <graphettion> I never even heard of the fill function.
  1909. Sep 18 09:48:20 <Torkable> now you have lol
  1910. Sep 18 09:48:20 <graphettion> Sweet.
  1911. Sep 18 09:48:23 <graphettion> ty
  1912. Sep 18 09:49:00 <cjohnson> !mdn Array#fill
  1913. Sep 18 09:49:01 <ecmabot> cjohnson: Array.prototype.fill() - JavaScript | MDN <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill>
  1914. Sep 18 09:49:06 <cjohnson> !mdn String#repeat
  1915. Sep 18 09:49:07 <ecmabot> cjohnson: String.prototype.repeat() - JavaScript | MDN <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat>
  1916. Sep 18 09:49:09 <Torkable> its es6
  1917. Sep 18 09:49:15 <Torkable> but I think its in the shim
  1918. Sep 18 09:49:17 <Torkable> which makes it easy to use
  1919. Sep 18 09:49:36 <Torkable> yea it is
  1920. Sep 18 09:49:38 <ljharb> both are.
  1921. Sep 18 09:49:42 <cjohnson> String#repeat too
  1922. Sep 18 09:49:47 <ljharb> !es6 shim @ graphettion
  1923. Sep 18 09:49:47 <ecmabot> graphettion: To get every backwards-compatible feature of ES6 in every browser and node, use https://www.npmjs.com/package/es6-shim ! It's heavily tested, comes with Promises, and using the !es5-shim as well is strongly encouraged.
  1924. Sep 18 09:49:52 <Torkable> oh damn didin't know about repeat lol
  1925. Sep 18 09:49:57 <Torkable> even better lol
  1926. Sep 18 09:50:17 <graphettion> How do you do repeat?
  1927. Sep 18 09:50:32 <Torkable> b> "foobar".repeat(3)
  1928. Sep 18 09:50:35 <babelbot> Torkable: (okay) foobarfoobarfoobar
  1929. Sep 18 09:50:38 <Torkable> lol
  1930. Sep 18 09:50:44 <Torkable> there ya go
  1931. Sep 18 09:50:45 <graphettion> lol
  1932. Sep 18 09:51:33 <graphettion> Thanks. I know these are n00b questions. I just need more practice with strings. Returning arrays like .map() .filter()
  1933. Sep 18 09:51:38 <graphettion> I'm weak at these.
  1934. Sep 18 09:51:42 <graphettion> Thanks all!
  1935. Sep 18 09:51:47 <Torkable> np
  1936. Sep 18 09:53:53 * zumba_addict is still reading all the links about inheritance :p it's confusing
  1937. Sep 18 09:55:28 <zumba_addict> anyways, let's say classA is parent of classB and classB is parent of classC. Does it mean that when a property changes in classA, classC will automatically have the new value? or do we have to execute a code to grab it?
  1938. Sep 18 09:55:50 <cjohnson> JS doesn't have classes, so without having specific code it's hard to know what you mean by that
  1939. Sep 18 09:56:00 <skullcrasher> is it somehow possible to "echo" a file from an ajax request?
  1940. Sep 18 09:56:07 <zumba_addict> repasting the fiddle, one sec
  1941. Sep 18 09:56:15 <zumba_addict> http://jsfiddle.net/dqggvjrj/2/
  1942. Sep 18 09:56:33 <cjohnson> zumba_addict: if foo.prototype = bar, then whenever we look up a property on foo, if it doesn't exist, it will search bar
  1943. Sep 18 09:57:01 <cjohnson> so foo = {a: 'a'}; bar = {b: 'b'}; when we look at foo.a, it searches foo for a first, and finds it, so it stops there
  1944. Sep 18 09:57:03 <zumba_addict> it will search bar?
  1945. Sep 18 09:57:07 <cjohnson> but foo.b, it wouldn't find it, and search bar
  1946. Sep 18 09:57:09 <cjohnson> bar.b
  1947. Sep 18 09:57:21 <DeltaHeavy> I have a data attribute I want to store the name of a function reference. It looks something like data-callback="namespace.modules.test.newCallback" What's the cleanest way to go about this?
  1948. Sep 18 09:57:38 <DeltaHeavy> Was thinking of using split(.) and doing window[split[0]][split[1]][split[2]][split[3]] in conjunction with a loop maybe to support any number of children.
  1949. Sep 18 09:58:04 <zumba_addict> is bar a child of foo?
  1950. Sep 18 09:58:19 <cjohnson> zumba_addict: in my example, foo.prototype = bar
  1951. Sep 18 09:58:35 <zumba_addict> cjohnson: would love to see a short fiddle on that. That would help me a lot
  1952. Sep 18 09:59:17 <zumba_addict> ljharb: I got confused on this article - http://raganwald.com/2014/03/31/class-hierarchies-dont-do-that.html
  1953. Sep 18 10:00:02 <MinusFour> zumba_addict, watch this video:
  1954. Sep 18 10:00:04 <zumba_addict> today was my first time hearing class heirarchies. Is the fiddle i posted a class heirarch?
  1955. Sep 18 10:00:05 <MinusFour> https://www.youtube.com/watch?v=PMfcsYzj-9M
  1956. Sep 18 10:00:10 <zumba_addict> thanks MinusFour
  1957. Sep 18 10:00:30 <zumba_addict> MinusFour: is the fiddle I posted a class heirarchy? http://jsfiddle.net/dqggvjrj/2/
  1958. Sep 18 10:00:37 <zumba_addict> someone just gave that to me last night
  1959. Sep 18 10:00:53 <cjohnson> zumba_addict: http://jsfiddle.net/152tt9ne/1/
  1960. Sep 18 10:01:00 <zumba_addict> thanks so much cjohnson
  1961. Sep 18 10:01:22 <zumba_addict> wow, so glad when I see new function names :D
  1962. Sep 18 10:01:28 <zumba_addict> it makes me feel I'm advance
  1963. Sep 18 10:01:29 <cjohnson> I used Object.setPrototypeOf here which is es6 but you can think of that as instance1.prototype = foo; in es5
  1964. Sep 18 10:01:56 <zumba_addict> k
  1965. Sep 18 10:02:12 <zumba_addict> is it also similar to this? var instance1 = new foo();
  1966. Sep 18 10:03:04 <cjohnson> new foo is different, that calls the function foo (in my case, foo isn't a function, just an object) and it returns a new object from the function foo
  1967. Sep 18 10:04:37 <cjohnson> zumba_addict: http://jsfiddle.net/xbLf3y8s/
  1968. Sep 18 10:04:44 <cjohnson> this over-simplifies all the magic that "new" does
  1969. Sep 18 10:04:50 <zumba_addict> k
  1970. Sep 18 10:04:54 <cjohnson> but that's the gist of it
  1971. Sep 18 10:05:13 <cjohnson> er, http://jsfiddle.net/xbLf3y8s/1/
  1972. Sep 18 10:05:16 <cjohnson> missed 'a' and 'b'
  1973. Sep 18 10:05:58 <EdwardIII> hrm am i going nuts? document.querySelector('input[type="submit"]').className = 'biscuits' // doesn't show up in inspect element? the classnames don't actually change
  1974. Sep 18 10:06:27 <zumba_addict> oh, just saw you posted another one
  1975. Sep 18 10:06:36 <EdwardIII> unnig it in the console
  1976. Sep 18 10:06:43 <zumba_addict> i was about to say the params :D
  1977. Sep 18 10:06:44 <EdwardIII> unning=running
  1978. Sep 18 10:06:45 <zumba_addict> there you go
  1979. Sep 18 10:07:06 <cjohnson> zumba_addict: one more piece I forgot, it also sets the prototype: http://jsfiddle.net/xbLf3y8s/2/
  1980. Sep 18 10:07:33 <zumba_addict> :D
  1981. Sep 18 10:08:11 <zumba_addict> I remember reading that using `new` is discouraged. Is it true?
  1982. Sep 18 10:08:50 <zumba_addict> really appreciate your time helping me. I wish I was near your place and I can treat you for a lunch
  1983. Sep 18 10:09:00 <cjohnson> no worries :) glad to help
  1984. Sep 18 10:09:07 <zumba_addict> :)
  1985. Sep 18 10:09:14 <cjohnson> new is... a little bit magic. it isn't exactly obvious what it does, so in that sense it's not perfect
  1986. Sep 18 10:09:19 <zumba_addict> thanks too MinusFour, I'll download the video
  1987. Sep 18 10:09:25 <zumba_addict> k
  1988. Sep 18 10:09:56 <cjohnson> ljharb: I can never remember, is Object.create the better new? or do you do something else
  1989. Sep 18 10:10:12 <Torkable> object.create is the weird one
  1990. Sep 18 10:10:13 <Torkable> imo
  1991. Sep 18 10:10:28 <Torkable> everything on the prototype!
  1992. Sep 18 10:10:41 <cjohnson> well before setPrototypeOf, isn't Object.create how you set the prototype?
  1993. Sep 18 10:10:54 <Torkable> if you want everything on the prototype, then yea I'd use create
  1994. Sep 18 10:10:56 <cjohnson> ignoring [[Prototype]] hacks and such
  1995. Sep 18 10:11:05 <zumba_addict> so the article tells me I should run away from class heirarchies. Is this fiddle a class heirarchy? http://jsfiddle.net/dqggvjrj/2/
  1996. Sep 18 10:11:25 <zumba_addict> i asked it earlier to ljharb but looks like he's not available
  1997. Sep 18 10:11:26 <Torkable> I use assign far more often
  1998. Sep 18 10:11:29 <Torkable> Object.assign
  1999. Sep 18 10:11:30 <MinusFour> more like a constructor hierarchy
  2000. Sep 18 10:11:53 <zumba_addict> ok. So that code pattern is ok to use?
  2001. Sep 18 10:12:03 <zumba_addict> or is there a better/nicer way?
  2002. Sep 18 10:12:06 <EGreg> hey all
  2003. Sep 18 10:12:08 <EGreg> I would like to do the following:
  2004. Sep 18 10:12:19 <EGreg> 1) save the value of the width style in an element
  2005. Sep 18 10:12:20 <MinusFour> I prefer Object.create but constructors do have their advantages
  2006. Sep 18 10:12:22 <EGreg> computed width
  2007. Sep 18 10:12:31 <cjohnson> zumba_addict: generally, trying to force classes into JS is going to lead to pain
  2008. Sep 18 10:12:35 <EGreg> 2) set the width to what I want (essentially freeze the width, actually, in px)
  2009. Sep 18 10:12:39 <EGreg> 3) then restore the previous width
  2010. Sep 18 10:12:45 <Torkable> well I avoid any sort of oo in js as much as possible
  2011. Sep 18 10:12:48 <EGreg> the problem is that I want to restore "100%" width
  2012. Sep 18 10:12:51 <cjohnson> zumba_addict: if you *really* do want something like classes, then get yourself babel, and look at ES6 class keyword
  2013. Sep 18 10:12:52 <EGreg> and I don't know how to get that value!
  2014. Sep 18 10:12:59 <cjohnson> it's not really a class but it will take away a lot of this confusion for you
  2015. Sep 18 10:13:00 <EGreg> Only by analyzing all the stylesheets and rules :(
  2016. Sep 18 10:13:06 <EGreg> which seems like overkill
  2017. Sep 18 10:13:11 <EGreg> any way to find out whether a width was "100%" ?
  2018. Sep 18 10:13:13 <cjohnson> zumba_addict: http://www.2ality.com/2015/02/es6-classes-final.html
  2019. Sep 18 10:14:06 <zumba_addict> cjohnson: wasn't really sure i was looking into class heirarchy. I just asked in so how instance C will be able to inherit properties of instance A - http://stackoverflow.com/questions/32643167/advanced-javascript-inheritance-is-failing-parent-parent-child
  2020. Sep 18 10:14:19 <EGreg> http://stackoverflow.com/questions/324486/how-do-you-read-css-rule-values-with-javascript
  2021. Sep 18 10:14:36 <cjohnson> zumba_addict: If you want c to inherit properties from a, then Object.setPrototypeOf(c, a)
  2022. Sep 18 10:14:50 <cjohnson> and now c.foo will search c for foo, and if it doesn't find it, will search a for foo
  2023. Sep 18 10:14:54 <zumba_addict> similar from your example right?
  2024. Sep 18 10:14:57 <cjohnson> yep
  2025. Sep 18 10:14:59 <zumba_addict> cool
  2026. Sep 18 10:15:15 <EGreg> oh boy, that sucks :(
  2027. Sep 18 10:15:18 <zumba_addict> i'll try to rewrite it using setProtoTypeOf and if I fail, I'll ask help here :)
  2028. Sep 18 10:15:25 <EdwardIII> zumba_addict: well also i'd suggest reading object thinking
  2029. Sep 18 10:15:38 <zumba_addict> thanks EdwardIII, I'll google it
  2030. Sep 18 10:16:04 <zap0> how do i add a listener for a html <SELECT> ? i've tried 3 things and failed :(
  2031. Sep 18 10:16:10 <zumba_addict> i hope it's geared towards JS because we know about JS's weirdness :D
  2032. Sep 18 10:16:20 <EdwardIII> ok, it isn't, not at all
  2033. Sep 18 10:16:30 <zumba_addict> k
  2034. Sep 18 10:16:39 <EdwardIII> but it's about the principles by OO in an effort to create a language-agnostic way of really understanding what it's good for
  2035. Sep 18 10:16:48 <zumba_addict> i think it will give me a good foundation on objects which is nice
  2036. Sep 18 10:16:52 <zumba_addict> yup
  2037. Sep 18 10:16:57 <cjohnson> zumba_addict: make sure to add https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.js
  2038. Sep 18 10:17:00 <cjohnson> to your fiddle
  2039. Sep 18 10:17:07 <zumba_addict> cool, thanks
  2040. Sep 18 10:17:12 <EGreg> anyone even reading?
  2041. Sep 18 10:17:13 <EGreg> hehe
  2042. Sep 18 10:17:29 <cjohnson> EGreg: you have to analyze all of the stylesheets and rules yes
  2043. Sep 18 10:17:33 <cjohnson> it's a nightmare
  2044. Sep 18 10:17:36 <EGreg> that's what I thought :(
  2045. Sep 18 10:17:54 <EGreg> So, what is a better technique to 'freeze the dimensions of a container while I edit its contents'
  2046. Sep 18 10:18:55 <cjohnson> give it a fixed width and height?
  2047. Sep 18 10:19:08 <cjohnson> you could calculate its offset width and height to see what they currently are
  2048. Sep 18 10:19:53 <cjohnson> EGreg: https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model/Determining_the_dimensions_of_elements
  2049. Sep 18 10:20:14 <zumba_addict> forgot to ask, why do I need es6-shim.js, is setPrototypeOf a polyfill?
  2050. Sep 18 10:20:17 <EGreg> yes but then I want to restore it back
  2051. Sep 18 10:20:19 <EGreg> after the editing is done
  2052. Sep 18 10:20:28 <EGreg> that's the problem! the original could have been specified in units other than px
  2053. Sep 18 10:20:41 <EGreg> My solution right now is to make an element that's 100% width inside the other element (which is not to be permanently altered)
  2054. Sep 18 10:20:44 <EGreg> and then freeze the width of that
  2055. Sep 18 10:20:47 <EGreg> and then bring it back to 100%
  2056. Sep 18 10:21:00 <EGreg> or rather, I am setting its max-width and then later removing it
  2057. Sep 18 10:22:44 <cjohnson> setPrototypeOf is an es6 method zumba_addict yes
  2058. Sep 18 10:22:52 <cjohnson> es6-shim polyfills that method into browsers which don't support it
  2059. Sep 18 10:23:13 <EGreg> It works now! here is the result: https://www.dropbox.com/s/79ea4ealgkx8ezk/Screenshot%202015-09-18%2012.23.12.png?dl=0
  2060. Sep 18 10:23:18 <EGreg> in case you were wondering cjohnson
  2061. Sep 18 10:24:26 <cjohnson> EGreg: I would do: if (node.style.width) { node.dataset.oldWidth = node.style.width; } var calculatedWidth = node.offsetWidth; node.style.width = calculatedWidth;
  2062. Sep 18 10:24:53 <cjohnson> and when you're done, if (node.dataset.oldWidth) { node.style.width = node.dataset.oldWidth; } else { node.style.width = ''; }
  2063. Sep 18 10:24:56 <cjohnson> something like that
  2064. Sep 18 10:25:06 <EGreg> (I wouldn't use dataset because IE<11 doesn't support it)
  2065. Sep 18 10:25:18 <EGreg> but the problem is, like I said, the offsetWidth would be in px!
  2066. Sep 18 10:25:26 <EGreg> and if the original width was in %, say
  2067. Sep 18 10:25:32 <EGreg> then it should resize with its container
  2068. Sep 18 10:25:38 <EGreg> and after I "restore" the width, it wouldn't do that anymore
  2069. Sep 18 10:25:42 <aib> is this a good place to ask about the DOM? I want to get the contents of a file as a string, preferably specified as a <script src="myfile.txt"></script>. Is that possible?
  2070. Sep 18 10:25:46 <EGreg> so I would have broken the width of the element to which I applied tha tbehavior :P
  2071. Sep 18 10:25:55 <zumba_addict> thanks cjohnson
  2072. Sep 18 10:25:55 <EGreg> that's what I was trying to avoid.
  2073. Sep 18 10:26:03 <cjohnson> EGreg: exactly, you *fix* the width using the calculated offsetWidth, while you're editing
  2074. Sep 18 10:26:17 <cjohnson> and once you're done editing, restore it to whatever it was before, including its unit (% or px)
  2075. Sep 18 10:26:23 <EGreg> cjohnson: say the original container had width: 100%
  2076. Sep 18 10:26:30 <EGreg> "restore it to whatever it was before, including its unit (% or px)" -- there is no way to get this information in JS
  2077. Sep 18 10:26:40 <cjohnson> .style.width
  2078. Sep 18 10:26:41 <EGreg> unless I manually reproduce what the browser does, walking all the CSS rules
  2079. Sep 18 10:26:42 <cjohnson> will return 100%
  2080. Sep 18 10:26:46 <EGreg> .style.width returns in px always :(
  2081. Sep 18 10:26:50 <cjohnson> wut
  2082. Sep 18 10:26:52 <EGreg> try it
  2083. Sep 18 10:27:12 <EGreg> you can write % but not read %
  2084. Sep 18 10:27:18 <EGreg> That was the rub :(
  2085. Sep 18 10:27:38 <EGreg> http://stackoverflow.com/questions/10624368/getting-the-width-of-an-html-element-in-percent-with-jquery
  2086. Sep 18 10:28:05 <cjohnson> EGreg: http://jsfiddle.net/850wzznt/
  2087. Sep 18 10:28:07 <cjohnson> returns 100%
  2088. Sep 18 10:28:16 <EGreg> which browser?
  2089. Sep 18 10:28:28 <cjohnson> chrome
  2090. Sep 18 10:29:37 <EGreg> hmm, you are right in crome.
  2091. Sep 18 10:29:38 <EGreg> sec
  2092. Sep 18 10:30:07 <cjohnson> if the width comes form a class, that property will be empty, but that's fine too because once you restore node.style.width = ''; it will re-inherit widht: 100% form the class
  2093. Sep 18 10:30:08 <zumba_addict> btw folks, I have a question about lines 1 thru 7 of my fiddle - http://jsfiddle.net/dqggvjrj/2/ What was the reason for writing ClassA.prototype.showFullname outside of function ClassA() { .... }
  2094. Sep 18 10:30:22 <EGreg> cjohnson: I guess I stand corrected
  2095. Sep 18 10:30:28 <EGreg> I was pretty sure it was coming back as a calculated Width
  2096. Sep 18 10:30:30 <cjohnson> zumba_addict: the code inside the function is "instance-specific" code
  2097. Sep 18 10:30:44 <cjohnson> zumba_addict: by writing on the prototype, you are creating a property which is shared across all the instances
  2098. Sep 18 10:30:45 <zumba_addict> gotch
  2099. Sep 18 10:30:49 <EGreg> so I can really save the old value of style.width ?!
  2100. Sep 18 10:30:57 <cjohnson> EGreg: seems like it
  2101. Sep 18 10:31:01 <zumba_addict> got it, very interesting
  2102. Sep 18 10:31:02 <EGreg> nice.
  2103. Sep 18 10:31:13 <EGreg> I already did it with the div right inside it, which I am able to mangle the width of,
  2104. Sep 18 10:31:18 <EGreg> but for the future I will keep this in mind! Thank you!
  2105. Sep 18 10:31:22 <cjohnson> no prob
  2106. Sep 18 10:31:25 <EGreg> sometimes jsfiddle is great ;-)
  2107. Sep 18 10:31:51 <EGreg> one more question then
  2108. Sep 18 10:31:55 <EGreg> I can ask this in #css also
  2109. Sep 18 10:32:01 <EGreg> how do I negate a border around an <input>
  2110. Sep 18 10:32:03 <EGreg> say it has a 1x border
  2111. Sep 18 10:32:15 <EGreg> do I make margin: -1px ?
  2112. Sep 18 10:32:33 <EGreg> or change box-model?
  2113. Sep 18 10:32:44 <EGreg> box-sizing
  2114. Sep 18 10:33:08 <cjohnson> border: 0
  2115. Sep 18 10:33:14 <cjohnson> presumably
  2116. Sep 18 10:33:31 <EGreg> I want the border to appear though
  2117. Sep 18 10:33:34 <EGreg> maybe I need css outline?
  2118. Sep 18 10:33:51 <MinusFour> if you want the border to be part of the width then box-sizing
  2119. Sep 18 10:33:52 <cjohnson> I'm not sure what you mean by negate then
  2120. Sep 18 10:34:10 <cjohnson> EGreg: did you read that article I linked? you might not want to use offsetWidth
  2121. Sep 18 10:34:19 <cjohnson> there are different props depending which parts of the box model you want to include
  2122. Sep 18 10:34:20 <EGreg> I don't use offsetWidth
  2123. Sep 18 10:34:32 <cjohnson> well...then you might want to use offsetWidth
  2124. Sep 18 10:34:35 <EGreg> I use boundingrect usually
  2125. Sep 18 10:34:38 <smgs> is there anyway to get GPS location of the device? thanks
  2126. Sep 18 10:34:39 <cjohnson> I don't recall which is which by the article explains it
  2127. Sep 18 10:34:47 <EGreg> I missed your link to the article btw
  2128. Sep 18 10:34:53 <cjohnson> smgs: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation
  2129. Sep 18 10:35:00 <smgs> thanks
  2130. Sep 18 10:35:02 <EGreg> I read John Resig years writing years ago about getBoundingClientRect
  2131. Sep 18 10:35:02 <cjohnson> 12:19 < cjohnson> EGreg: https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model/Determining_the_dimensions_of_elements
  2132. Sep 18 10:35:16 <EGreg> which does everything the most correctly for you (it's what jQuery uses for is(":visible") and width() stuff)
  2133. Sep 18 10:35:54 <EGreg> aha, transforms apparently make a difference, that's what the article mentions, ok.
  2134. Sep 18 10:36:07 <EGreg> I usually would need boundingrect.
  2135. Sep 18 10:38:33 <EGreg> aha I guess the answer is to have a border the whole time
  2136. Sep 18 10:38:41 <EGreg> since I am not able to compensate for it later
  2137. Sep 18 10:54:15 <smgs> cjohnson: thanks. it works only on that page. i tried to run it on JSfiddle, but on clicking the "Show my Location" button nothing happens
  2138. Sep 18 11:09:32 <zumba_addict> has anyone of you ever thought about this? I just posted it. I hope you guys have encountered it before and was hoping if you can share your ideas - http://stackoverflow.com/questions/32657386/remove-dev-sit-code-when-grunt-build-is-for-prod
  2139. Sep 18 11:10:14 <renlo> there are browserify global vars if i recall correctly
  2140. Sep 18 11:10:38 <renlo> depends on how you are bundling your code
  2141. Sep 18 11:12:12 <zumba_addict> k
  2142. Sep 18 11:12:26 <zumba_addict> i don't think we are using browserify
  2143. Sep 18 11:12:48 <hover> What would be the best way to sort by distance in this object:
  2144. Sep 18 11:12:57 <hover> https://www.irccloud.com/pastebin/Z61CkfNw/
  2145. Sep 18 11:14:19 <zumba_addict> hover, maybe use of underscore or lodash?
  2146. Sep 18 11:14:35 <yansanmo> hover, first you need an array, if you want order
  2147. Sep 18 11:15:35 <hover> Running on Node.js, so maybe something a little lighter than those libs?
  2148. Sep 18 11:16:07 <yansanmo> Object.keys(o.couriers).map(function(a) { return o.couriers[a]; }).sort(function(a,b) {return a.distance-b.distance;})
  2149. Sep 18 11:17:37 <yansanmo> you could put the key inside the object, if you don't want to lose it
  2150. Sep 18 11:21:00 <Torkable> yea you guna need to change how that data is formatted
  2151. Sep 18 11:21:45 <hover> yansanmo: very silly question, but how would I log that to console?
  2152. Sep 18 11:21:55 <Torkable> console.log
  2153. Sep 18 11:22:14 <palid> zumba_addict: requirejs + r.js pragmas/has
  2154. Sep 18 11:22:26 <hover> Torkable: yes, I know. But never really used a return statement before.
  2155. Sep 18 11:22:27 <palid> I'm using this kind of method.
  2156. Sep 18 11:22:40 <Torkable> hover: hmm?
  2157. Sep 18 11:23:03 <zumba_addict> palid, we use require.js but what is r.js?
  2158. Sep 18 11:23:14 <palid> for dev server we're getting whole backbone=faux-server and mockjax + routes and stuff, which is not attached in the final build
  2159. Sep 18 11:23:35 <palid> zumba_addict: it's a tool made by jburke to optimize requirejs modules.
  2160. Sep 18 11:23:47 <palid> it does all the compiling magic
  2161. Sep 18 11:24:00 <zumba_addict> so what I asked in so will be able to handle that?
  2162. Sep 18 11:24:24 <palid> if you're not using require.js's dynamic loading in your code in production
  2163. Sep 18 11:24:30 <zumba_addict> we are using it
  2164. Sep 18 11:24:36 <yahkob> What is zumbaing
  2165. Sep 18 11:24:45 <yahkob> is there a IRC #zumba?
  2166. Sep 18 11:24:52 <palid> zumba_addict: how big is the app?
  2167. Sep 18 11:24:59 <zumba_addict> big
  2168. Sep 18 11:25:02 <yahkob> Zumba MVC?
  2169. Sep 18 11:25:11 <zumba_addict> i'm building it yahkob :)
  2170. Sep 18 11:25:17 <palid> zumba_addict: links?
  2171. Sep 18 11:25:24 <yahkob> Zumba.Zumba.Zumba()
  2172. Sep 18 11:25:26 <yahkob> :O
  2173. Sep 18 11:25:43 <zumba_addict> :)
  2174. Sep 18 11:25:48 <palid> because it cant be big if you're not using r.js with require.js :>
  2175. Sep 18 11:25:59 <palid> it's THE default tooling
  2176. Sep 18 11:26:02 <zumba_addict> k
  2177. Sep 18 11:26:04 <palid> it's in docs.
  2178. Sep 18 11:26:12 <zumba_addict> let me check if r.js is being used
  2179. Sep 18 11:26:22 <palid> it may be for compilation.
  2180. Sep 18 11:26:51 <zumba_addict> i don't see it in package.json nor in bower.json
  2181. Sep 18 11:27:27 <zumba_addict> is this the one you are referring to? https://github.com/jrburke/r.js/
  2182. Sep 18 11:27:57 <palid> yes
  2183. Sep 18 11:28:28 <palid> you may be using webpack for building, but I advice using r.js
  2184. Sep 18 11:29:04 <sillyslux> what a sad and insightful story https://remysharp.com/2015/09/14/jsbin-toxic-part-1
  2185. Sep 18 11:29:08 <zumba_addict> i think i saw webpack somewhere, checking
  2186. Sep 18 11:30:43 <palid> zumba_addict: webpack also have this kind of magic - it removes dead code on compilation automatically.
  2187. Sep 18 11:30:51 <palid> but you have to read the docs.
  2188. Sep 18 11:30:51 <zumba_addict> I was wrong, i dont wee webpack in package and bower
  2189. Sep 18 11:31:01 <zumba_addict> wee/see
  2190. Sep 18 11:31:03 <palid> ao, use r.js
  2191. Sep 18 11:31:14 <palid> ther'es an awesome example in rjs repo
  2192. Sep 18 11:31:16 <zumba_addict> looks like plain grunt is our build
  2193. Sep 18 11:32:17 <zumba_addict> i heard from our last week's meeting that in the new app we are building, we are going to use webpack
  2194. Sep 18 11:32:24 <zumba_addict> is that a nice move?
  2195. Sep 18 11:32:38 <zumba_addict> we are also going to use reactjs and ampersand
  2196. Sep 18 11:33:39 <Jayflux> How would you check an object is an ancestor of another? isPrototypeOf only checks 1 up I think?
  2197. Sep 18 11:34:49 <tcsc> i think you'd just use instanceof
  2198. Sep 18 11:36:08 <tcsc> oh, no, that only works on functions. nevermind.
  2199. Sep 18 11:36:18 <Jayflux> tcsc, thats worked, thanks
  2200. Sep 18 11:36:20 <tcsc> oh
  2201. Sep 18 11:36:21 <Torkable> lol
  2202. Sep 18 11:36:50 <tcsc> i thought you wanted to know like, x = {}, y = Object.create(x), z = Object.create(y), x instanceof z
  2203. Sep 18 11:37:07 <tcsc> err, vice versa, z instanceof x
  2204. Sep 18 11:37:17 <tcsc> which would be pretty weird tbh.
  2205. Sep 18 11:41:01 <sillyslux> >> var x = {}, y = Object.create(x), z = Object.create(y); z instanceof x
  2206. Sep 18 11:41:02 <ecmabot> sillyslux: TypeError: invalid 'instanceof' operand x
  2207. Sep 18 11:41:35 <sillyslux> chrome says Expecting a function in instanceof check, but got #<Object>
  2208. Sep 18 11:43:22 <zap0> how do you indicate arguments to a function are optional ?
  2209. Sep 18 11:48:23 <yahkob> I make a options hash
  2210. Sep 18 11:48:36 <yahkob> (arg1, options) then document it =D
  2211. Sep 18 11:48:39 <yahkob> maybe not the best way
  2212. Sep 18 11:50:26 <step1step2> Look at this formatting by Visual Studio/ReSharper: https://gist.github.com/step1step2/7d8d34232ae3e02940ee It looks like a rocket :-§
  2213. Sep 18 11:51:13 <yahkob> translation rocket
  2214. Sep 18 11:51:21 <yahkob> that would be a terrible rocket
  2215. Sep 18 11:51:21 <ggggthomas> hey
  2216. Sep 18 11:51:33 <yahkob> I wouldnt leave the planet on that
  2217. Sep 18 11:52:05 <jacob___> will javascript ever implement operator overloading
  2218. Sep 18 11:52:25 <ggggthomas> no
  2219. Sep 18 11:52:28 <step1step2> I'm no Astronaut :c
  2220. Sep 18 11:53:46 <yahkob> someone asked me how to implement logic for a javascript powered motor cycle with tessel.io
  2221. Sep 18 11:54:00 <yahkob> It made me very scared for the pilot of the motorcycle
  2222. Sep 18 11:54:00 <yahkob> lol
  2223. Sep 18 11:54:11 <yahkob> while( notBrake ) { ... }
  2224. Sep 18 11:55:21 <hashtag___> hi
  2225. Sep 18 11:55:43 <hashtag___> Could one tell me what the "window variable" of this script would be?: https://github.com/diazemiliano/googlemaps-scrollprevent/blob/master/dist/googlemaps-scrollprevent.js
  2226. Sep 18 11:56:33 <yahkob> type in window to your console :)
  2227. Sep 18 11:56:46 <yahkob> window is the top level object in Javascript
  2228. Sep 18 11:59:48 <hashtag___> yes
  2229. Sep 18 11:59:56 <hashtag___> but what does that given script add to window (itself - variable?)
  2230. Sep 18 12:03:26 <fooey> good old JetBrains, they realize they screwed up and pissed off all their customers, so they work hard to come up with a way to piss them off even more
  2231. Sep 18 12:04:55 <MachinShin> fooey? what'd they do now?
  2232. Sep 18 12:05:09 <fooey> http://blog.jetbrains.com/blog/2015/09/18/final-update-on-the-jetbrains-toolbox-announcement/
  2233. Sep 18 12:06:05 <hashtag___> nyone? :/
  2234. Sep 18 12:06:16 <fooey> they admit their screwed up and no one likes their new model, but if you don't like it you can have your software rolled back to a 1 year old version
  2235. Sep 18 12:06:29 <yahkob> do you know how bind works?
  2236. Sep 18 12:09:25 <hashtag___> yes
  2237. Sep 18 12:09:33 <hashtag___> https://github.com/dolox/fallback
  2238. Sep 18 12:09:51 <hashtag___> the fallback js seems to download one by one - I guess the reason is that the code failed to load in eyes of fallback
  2239. Sep 18 12:11:27 <dude_> what does that mean by int [a] = {2, 3}
  2240. Sep 18 12:12:16 <tcsc> that doesn't look like js
  2241. Sep 18 12:14:44 <dude_> is there anything like "int" in javascript?
  2242. Sep 18 12:16:40 <dude_> or something like "int [] a"
  2243. Sep 18 12:17:41 <hover> Anyone know how I can sortByAll with lodash and still preserve the parent keys?
  2244. Sep 18 12:17:43 <RLa> dude_, there are no integers in js
  2245. Sep 18 12:18:04 <bosnian> looking for a job in Germany... anyone here with such opportunities? thanks!
  2246. Sep 18 12:18:43 <fooey> someone has to give me a job in Denver first ;p
  2247. Sep 18 12:19:28 <bosnian> denver is good
  2248. Sep 18 12:19:30 <bosnian> denver is reliable
  2249. Sep 18 12:19:32 <bosnian> if it doesn't work
  2250. Sep 18 12:19:33 <nettoweb> folks, yesterday I received many replies about my question but my pc turn off nd I couldnt see... is there way to see a log of that conversation?
  2251. Sep 18 12:19:38 <bosnian> you can always hit him with it
RAW Paste Data