« first day (1679 days earlier)      last day (3254 days later) » 

12:04 AM
I think after generation if I go over it again and 'smooth' cells whose 8 neighbors are different to be the same it will be okay
 
Small question, is anyone here used to dealing with .p12/.pem files or would have an idea why a .pem file would work under windows to create a JWT and issue a request, but fails when executed on a centOS machine?
 
@Khaldor Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
12:51 AM
How can I return all the rows with .overtimeapproval:checked in a $('#mytable').dataTable().fnGetNodes() ?
 
@RogerOliveira Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
$('.overtimeapproval:checked').map(function() {
  return $(this).parents('tr');
});
maybe
 
great, what does .map function ?
 
!!jquery map
 
12:54 AM
Great! Hey I could make it work with this command: $($("#datatableList").dataTable().fnGetNodes()).has('.overtimeapproval:checked')
Thanks a lot! You are a legend!
 
@RogerOliveira no clue.
 
thanks see u
 
but good luck!
 
Hi, all. What is the difference between

$(function() {
})

and

(function($){
$(document).ready(function(){});
})(window.jQuery)

I dunno what to search for.
 
@Angularnoob Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
12:56 AM
$(function() {
})
is the same as document.ready
 
Mhm.
Does anyone know why people sometimes use the second form (e.g. github.com/murtaugh/HTML5-Reset/blob/master/assets/js/…)? Like I say, it is tricky to search for, as I do not know the right terminology.
 
the rest is a IIFE (you can google it) which you pass 'jQuery' and accept it as $
 
I though the first one was an IFFE also.
 
nope
$(fn)
you're passing a function to jQuery in the first
in the latter you are passing jQuery to a iife so you don't conflict with other libs that use $
(presumably)
 
ah. it is starting to make sense now. thank you, @rlemon
i think the bottom line is, if I do not understand the need for it, I do not need it. but I am curious anyhow.
 
1:00 AM
the iife is basically to encapsulate the $ variable name
the former is identical to calling $(document).ready
 
i.e. outside of the global namespace?
 
js is function scoped (forgetting es6 let)
so anything defined inside of the iife stays there
 
mhm.
 
passing jQuery into it and accepting it internally as $ allows other libs to consume $ without negative side effects in the iife
 
do you know of any libraries, aside from jQuery, that make use of the identifier $?
i am also curious why people sometimes do this: github.com/dope/word/blob/master/js/main.js#L1
 
1:04 AM
@Angularnoob lots do
@Angularnoob lookup speeds. and again to encase the variable names
 
i have never encountered one, personally, not yet anyway
that dude passes "undefined" and "document" but doesn't even use them o.o
 
that is probably due to a pre-determined snippet in his editor
 
probably.
or ignorance :p
am I correct in thinking that code does not run ondocumentready?
 
I would side on the snippet
$(fn) does
again it 1:1 to document.ready
 
does that still count as the short-hand then?
 
1:07 AM
iife's do not
 
i am confused why that code runs on documentready
 
because jQuery
 
the outer is to make sure there is no conflict with other libs, the inner is to make sure it is dom ready
All three of the following syntaxes are equivalent:

$(document).ready(handler)

$().ready(handler) (this is not recommended)

$(handler)
fyi
 
this code does not have a handler though?
 
1:10 AM
nope, it is a iife that passes jQuery as $ to avoid conflict. it doesn't require dom ready
so it doesn't wait for it
 
i am confused as to why it does not require domready :(
but the other one (supposedly) does
 
I don't know without context. ask the author
 
no no
bottom line, github.com/dope/word/blob/master/js/main.js does not wait for documentready (presumably, because it doesn't need to)
 
why not? it is on github. you can just raise an issue to clerify the docs you are confused on
 
1:13 AM
yes
 
that is my fundamental question, no need to ask the author
 
@AwalGarg You were going to tell me how Firefox speeds up dev time?
 
thank you!
 
depending on where it is included*
well that is false
 
yeah
so if it at the bottom of the file
it will EFFECTIVELY
 
1:14 AM
it is moot depending on where it is included
 
i need to do some more research on that
i have always put my script files at the bottom just because I was told to
 
developer.yahoo.com/performance/rules.html it is actually a good read.
 
i am not confident that I do not need documentready so I include it anyway
there is also the async attribute which I have heard of, but know little about
exciting stuff
and thanks for that link, mate and thanks again for all your help
 
np
 
Would you say that, if you put <script> at the bottom of the document, there is no point using jQuery documentready ?
 
user1994804
1:20 AM
Hey @copy referencing this page classifieds.your-adrenaline-fix.com/… I included localStorage["SellerBuyerData"] = JSON.stringify(SellerBuyerLocation); with SellerBuyerLocation being the existing array Im trying to store in localstorage but when I console.log(SellerBuyerData) I get undefined.
 
user1994804
Any ideas?
 
@ElliotBonneville right. they are awesome. better (and more mature) es6 support than any other browser, direct event info in the inspector for dom events (including jquery event bindinds) etc. etc.
 
@Angularnoob yes
 
scratchpad goes with the FS directly, and not in a slow sandboxed localstorage like chrome snippets
 
it makes sense
 
user1596138
1:21 AM
@loktar I saw Dan had something oneboxed in #random lol. Stolen discovery
 
@AwalGarg Interesting. Chrome does have info on events, and Babel precludes native ES6 for a little while longer, I think?
 
@ElliotBonneville Chrome can do pretty much all the things that FF dev tools can do, but FF does some of them better.
 
I have to admit you've got me beat on the scratchpad, though.
Mmhmm.
 
@ElliotBonneville ok, this page uses jquery right? Find me the onkeydown ilk listeners on the #input element from chrome dev tools and post a screeny
 
1:25 AM
@ElliotBonneville what is that? It displays the bound jquery listener, and not the actual function passed as the listener
@ElliotBonneville are you finding it or should I show you how FF does it?
 
@AwalGarg we'll have to continue this discussion later actually :(
 
chrome will also win later :P
cya
 
Sarcasm? :p
cya man
 
chrome or go home
 
You are just jealous that I can do this:
 
1:31 AM
not really
 
they say hiding jealousy makes you write buggy code :P
 
i'm not a front end dev.
;)
 
!!s/f.+d //
 
@AwalGarg i'm not a dev. (source)
 
:P
maybe not, but I make the $$
 
1:34 AM
You are used to make lemonades.
 
;)
i'll crush you with my wallet
 
:D
@rlemon so... just backend?
 
no I write full stack. but I don't like front end
I also do embedded
 
nice
 
Frontend is the shit!
 
1:36 AM
@monners only if your backed is .net
 
@AwalGarg Truer words have never been spoken
 
I like individual aspects, not the entire things
tedious
ugh
 
individual aspect of backend: you have to deal with an individual backend
individual aspect of frontend: you have to... well, deal with 90k forks of 42 different rendering engines
 
front end is so messy
browsers suck
 
yeah, but when I have to write stuff like userscripts for personal use or internal/home use apps - frontend rocks.
 
1:41 AM
true
as you've seen I also enjoy that
 
haha yeah!
 
2:09 AM
@AwalGarg You're the one that told me I should use JSPM right?
I want to like it, but its docs suck.
 
 
2 hours later…
user2620028
4:00 AM
www.youtube.com/watch?v=kfVsfOSbJY0
 
4:21 AM
 
Black Friday!
Oh, the Friday song, Internet's classics.
 
4:39 AM
 
4:58 AM
jsfiddle.net/Luxelin/ttn5a4rv which of these code blocks is considered "best practice"?
 
@FlorianMargaine wonderful ! At least!
 
5:42 AM
Hmm
Any idea why stackoverflow.com/questions/28915677/… and stackoverflow.com/questions/28709666/… would get downvotes and both the question and the answer one after the other?
 
it's always someone who's angry at you
I've pretty much given up trying to understand it
but it always happens on my highest scoring posts, which leads me to believe that they're clicking my profile and randomly picking a Q+A to dv
 
6:06 AM
hello all, is it a good practice to make setter public inorder to unit test easier?
 
@Ant's isn't the whole point of a setter function to indirectly expose private properties
 
@royhowie yeah true, thats the reason, I'm asking if there is no setter, how will I test the functions? Any other elegant way?
 
you sort of answered your own question
(since you're trying to encapsulate data)
 
@royhowie True, I want the function to be encapsulated, but at the same time, test them with ease. If I'm concentrated on encapsulation, i'm losing in testing and vice versa. Given this situation, how will you test them? Or even how will you design your functions
 
make your setters public then
a private setter doesn't really make much sense anyway => you can just move it to the constructor, if you want to hide the ability to further change a property
(okay, I guess there are some uses for them, but in your case [it seems] you should just make them public)
 
6:17 AM
`
`var obj = (function(){
var stateObj = {key:"privateValue"};
return {
getState: function() {
return stateObj.key;
},
publicFn : function(){
//do some operation with stateObj
if(getState() == "test") {
//. . . .
}
}
}
}());`
what about exposing the getters and mocking them? Instead of giving setter public? Is that a good idea?
 
indent your code by clicking the fixed font button
 
oi, edit the existing code
or delete the previous one
 
var obj = (function(){
	var stateObj = {key:"privateValue"};
	return {
		getState: function() {
			return stateObj.key;
		},
		publicFn : function(){
			//do some operation with stateObj
			if(getState() == "test") {
			//. . . .
		}
	}
  }
}());`
 
The ultimate question of setters/getters is: why are you exposing the data anyway?
a lot of the time people overuse getters/setters -> (use "verbs," not "nouns")
 
@royhowie Because imagine obj is a module, and say another module obj2, which indeed dependent on obj fn publicFn. Thats the reason, I need getters mainly. However, setter is not required (from obj2) perspective, but in order to test obj fn publicFn, I need a setter. So thats where I'm scratching my head!!
 
6:23 AM
@Ant's then just make the setter for testing
 
SGG
Hi. It's a normal web question. I want to save an image from web page. I inspected that image elemnt. Here is code:

`<path class="control raise" d="M60,168 l228,0 A108,108 0 0,1 50,168 z" transform="rotate(180 169 168)"></path><image class="arrow lower" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/images/magma/thermozilla/icon/thermozilla_icon_temperature_down-d7338738.svg#svgView(viewBox(0,0,36,22))" x="150" y="248" height="22" width="36" preserveAspectRatio="none"></image>`

How can I save this image? When I right click on it, there is no "save image as" option.
 
@royhowie Yeah, what I'm thinking is to expose the setter method only in test environment, not in PROD
 
@SGG link to the page?
 
SGG
home.nest.com. You should login to that page and you have do some configuration. @royhowie
 
@SGG oh, then just open up the console and look at resources
should be under resources/images somewhere
 
6:34 AM
Hey, quick question for you guys.
Is there any way to combine elements of an array. So say I want to combine element 7 with every element to the very end of the array. Is there a simple way to do that?
 
@MatthewH Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@MatthewH Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@MatthewH you want to increase every element in the array by the 7th element? arr.map(function (d, i, arr) { return d + arr[6] });
 
@FlorianMargaine I'll be happy to remove my own horrible upsert function as soon as possible : github.com/Canop/miaou/blob/master/libs%2Fdb.js#L836
 
Let me visualize it...
['0', '1', '2',.... '7', ' elements', ' to', 'combine']
So I want to make it so it's like...
['0', '1', '2',.... '7 elements to combine']
 
pseudocode..? array.add(array.slice(7).join(" "));
just learning js, so cant say anything, but you get the idea
 
6:39 AM
Hmm.
 
!!> var arr = [1, 2, 3, 4, 5, 6, 7, "a", "b", "c"]; arr.splice(6, arr.length - 6, arr.slice(7).join(" ")); console.log(arr);
 
@royhowie "undefined" Logged: [1,2,3,4,5,6,"a b c"]
 
oops
!!> var arr = [1, 2, 3, 4, 5, 6, 7, "a", "b", "c"]; arr.splice(6, arr.length - 6, arr.slice(6).join(" ")); console.log(arr);
 
@royhowie "undefined" Logged: [1,2,3,4,5,6,"7 a b c"]
 
@MatthewH does that work?
 
6:42 AM
js arrays can have mixed types of elements? :D
 
if you want to do it dynamically, just use var index = arr.indexOf("whatever you're looking for") and substitute index for 6 in the above code
 
Let me try it out. Hold on
 
@Meraj99 yes, they can have anything, including objects
 
Hi there
Is anyone aware of a good line-by-line profiling tool for javascript client code ?
 
It actually didn't work O.o
 
6:49 AM
@Sisyphe chrome dev tools?
 
well sadly chrome dev tools only does function wide profiling
not line-by-line
 
line by line ?
 
well at least as far as I'm aware ^^
well monitornig each statement
 
http://i.gyazo.com/c03bc4f00048cdaeced43859971b2545.png
That's the array. I'm trying combine everything from `message` to `\n`
 
Morning guys
 
6:50 AM
not just the functions calls
 
Dang, I can never get that right
 
!!google console api
 
I have fairly compelx functions that have bad performances :( And I cannot see why, its not obvious which statements causes issues
 
even statements, I don't think that would be useful. The biggest perfs problems in JS (excluding design or algorithms) are deoptimization problems (the function not being managed by the optimizing compiler anymoire)
 
6:51 AM
But yes, read through how V8 works, then try to work with it
 
dystroy : I don't think thats my issue actually :/
I would need somthing like that (for .NET) blog.jetbrains.com/dotnet/2013/01/30/…
 
Hello everyone!
 
What I really find missing from the perf tools is an easy to read information on optimization states
 
@Sisyphe how can you be so sure?
 
@royhowie Sadly it just grabs the last element :/
 
6:53 AM
@dystroy FR?
 
Jan : you're right, I'm not sure, but I don't have warning on chrome dev toole regarding deoptimization, and I avoided using stuff that prevents optimization (like try catch statements etc...)
 
@Sisyphe The problem isn't really a statement. For example, suppose you call delete on a property. This won't be long. But all subsequent operations on the object will be much longer
@JanDvorak what ?
 
yeap, but I have no delete statement ^^
 
@dystroy feature request to Google?
 
@Sisyphe it's an example...
 
6:54 AM
I already did some optimization and get rid of all garbage collection issues
 
@JanDvorak oh, ok
 
I see waht you mean
 
can anyone help me with this?github.com/videojs/videojs-contrib-hls
 
@Sisyphe delete has no link to the GC (perf wise)
 
yes it does
doing a delete can trigger a garvbage collection pass
 
6:55 AM
@Sisyphe "all garbage collection issues" sounds scary
Worse, delete triggers deoptimisation for that object
 
when doing a lot of operation, performing a delete can cause really bad perfromance issues if you have multiple garbage pass
anyway
 
@JanDvorak I profiled. This is a HUGE optimization killer. I solved a real perf problem in miaou related to it (client side), because an object was used as a map instead of being used as a class
 
^^
 
@dystroy how many orders of magnitude?
 
I have some array operation like "slice" and I suspect it can have bad consequences
but it's hard to tell withotu the good metrics
there is a reason why all professional profiler (for java, .net, C++) provide line-by-line profiling
 
6:57 AM
@JanDvorak I don't have the numbers. But the scrolling in Miaou was jumpy and it was perfectly smooth after the removal of the delete
 
I could totally believe a thousandfold increase in speed
 
@Sisyphe performances in a managed language like JS aren't related to statements, really. What matters most, for example, is whether your functions is managed by the optimized compiler or not
 
Why does JavaScript turn the date I enter into another date when transformed into JSON? I have an example here: jsfiddle.net/zrcdzfzf/1 I'm sending a date object from google sheets into the function and I have the same issue as I do in my fiddle; there's a miss-match in the date when transformed to JSON string by one day...
 
dystroy : what do you mean ?
 
6:59 AM
well I agree, the optimized compiler stuff matters
 

« first day (1679 days earlier)      last day (3254 days later) »