« first day (2850 days earlier)      last day (2323 days later) » 

00:06
!!giphy hacking
hack faster, you're going too slow!
 
1 hour later…
01:10
@towc so apparently I wasn't calling 1 of the function in my original implementation
they are still ~30ms apart
but this is something I can live with
90 vs 60
Question:
Answer:
*bah dum tssh*
How can I make a youtube like video bar where, onhover a box with the frame at that time pops up?
so if I hover at 2:02 on the video bar the frame of the video at 2:02 will popup?
nvm
Oh, thumbnails?
@ShrekOverflow ?
wdym
@ShrekOverflow yes I guess
01:13
You'd need to generate lots of thumbnails
and load the images just in time (iirc YT does it that way)
alternatively, you could just make a tiny <video> element with the time
@ShrekOverflow that's what I was originally thinking but theres gotta be a better way
Send thumbnails at every 5 seconds
much lower quality
you can even send a YUUUUUUUUGE PNG / JPG with those elements as sprites
but sending thumbnails you can lazy load
thats annoying
that url used this
01:28
Wohoo faster recommendation problems quantamagazine.org/…
Now off to daily work
does anybody have a mock advertisement generator service ?
@ShrekOverflow what for?
Building a B2C demo
I don't want to write an ad framework
oh then no
 
1 hour later…
02:38
Does anybody have a nifty function for detecting a cookie change ?
I can't think of anything but storing the date I wrote the cookie in the cookie, which we all know is prone to issues.
02:51
@ShrekOverflow could you be more specific?
Doubtful, just want to see if document.cookie changed
I mean I can obviously poll and hash it -_-
03:22
I ended up with
const POLL_FREQUENCY = 2000;

function listenCookieChanges(callback) {
	// No point
	if (isServer()) {
		return;
	}

	let oldCookie = document.cookie;
	const timer = setInterval(() => {
		const newCookie = document.cookie;
		if (newCookie !== oldCookie) {
			oldCookie = newCookie;
			callback();
		}
	}, POLL_FREQUENCY);
	return () => clearTimeout(timer);
}
@KendallFrey Jeff Attwood's tweet?
Oh wow -- soo many good drafts patrickkettner.github.io/cookie-change-events
03:48
wat
04:07
@KevinB that is helpful if you are writing an app with an independent Identity Layer and can have multiple tabs;
short of the idP iframe using postMessage
also
!!> (function () { let x = Array(1e4).fill(0).map(() => Array(1e3).fill(3)); console.time('doublefor'); for(let i = 0; i < 1e4; i++) { for (let j = 0; j < 1e3; j++) { x[i][j]; } } console.timeEnd('doublefor'); })();
@ShrekOverflow "TypeError: console.time is not a function"
y u
!!> (function () { let x = Array(1e4).fill(0).map(() => Array(1e3).fill(3)); let start = Date.now(); for(let i = 0; i < 1e4; i++) { for (let j = 0; j < 1e3; j++) { x[i][j]; } } console.log(Date.now() - start) })();
@ShrekOverflow "undefined" Logged: 10
!!> (function () { let x = new Uint8Array(Array(1e4 * 1e3).fill(0).map(() => (3))); let start = Date.now(); for(let i = 0; i < 1e7; i++) { x[i]; } console.log(Date.now() - start); })();
@ShrekOverflow "undefined" Logged: 10
04:10
Such optimization!
@littlepootis ?
oh, i was just saying wat
!!wat3
 
2 hours later…
06:46
@eicksl Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
Is it a good idea to have sounds stored as base64 strings inside an object and load them into <source> and <audio> elements once the page loads? e.g., like this
I suppose if I'm questioning my own idea, it's probably bad.
 
1 hour later…
08:22
@JennaSloan probably not
Due to parse time
08:49
@Shrek no, you were actually only calling the first .then function, and the last function declared, with the implementation you showed
oh no actually, just the last, I was right
const getFn = n => x => (console.log(n),x + 1);
Curry(getFn(1)).then(getFn(2)).then(getFn(3)).then(getFn(4)).then(getFn(5)).then(getFn(6))('hey');
// logged: 6, returned: 'hey1'
09:47
1 message moved to Trash can
@MoonEater916 Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
I'm not sure as to why line 5 doesn't work - it doesn't enter the if statement (gist.github.com/AritonV10/a7f3d40f544b3e7bd3a9f4a340a9c9e3)
hit enter by mistake
i was in the process of editing@CapricaSix sorry
10:00
@VioAriton try logging target.tagName, target.tagName === 'LI'
10:26
oh wow thanks
li never gets triggered
10:52
Well @phenomnomnominal just blew up my screen with that long name
yes, my name is very long
sorry
 
2 hours later…
12:55
@MoonEater916 that's his real first name too
Ced
Ced
13:21
?
13:52
@towc that is not the version I had on file
The file one only called the first two and ignored the 3rd
hi
$(".collapsed").click(function(){
		$(this).removeClass("collapsed").addClass("expand");
	});

	$(".expand").click(function(){
		$(this).removeClass("expand").addClass("collapsed");
	});
why second function doesn't work?
@Shad There are likely no elements with the classname .expand when that code runs.
Read the jQuery documentation on .on(), should help you :)
I clicked on the collapsed class it got changed to expand though
oh alright madara uchiha! :)
If I've a function func(f_param, s_param) then I've a local variable var local = f_param || s_param -- if I call the function with f_param as null, will it init it the local with the second parameter?
@VioAriton Yes, || returns the first truthy operand, and if all of them are falsey, it returns the last.
Be warned though, 0, '' and false are all also falsey
So if f_param is any of them, local would be set to s_param as well.
14:09
oh I see
There's a proposal for ?? which would be closer to what you want
But not yet, I'm afraid :(
@MadaraUchiha How can I become like you?
In java there are several types of method such as void, primitive etc. Is there possible to implement that kind of types of method in js?
@hfbachri_ No, JavaScript has no enforced type system
You may want to check TypeScript out, though.
Do you still watch anime?
14:23
@MadaraUchiha how if i want to model my class with class diagram, only write method and params names without method types?
@hfbachri_ You can write the method types just fine
But you need to be aware that there's no safety net that would enforce that in code
You have no compiler, no type-checker
You can write that a function returns a number, and trust that the people on your team wouldn't break that promise without consulting/changing the documentation
Again though, take a look at TypeScript, it sounds like what you want.
@Shad Yeah, although I have much less free time on my hands :(
you are a legend on SO
Am I? 😀
A good legend, I hope :D
2
yeah so many uber people...I get goosebumps
14:37
$(function()) gets executed once the document is ready?
O-o
Madara still exists? Haven't seen him for ages :D
@geisterfurz007 Just returned from a month-long vacation to the US :D
@VioAriton Yes, more specifically, when the DOM is ready.
14:56
@KendallFrey neat: polyhedra.tessera.li/#
@MadaraUchiha Nice! Welcome back :)
@MadaraUchiha yes, ofc. The stories we hear about you are endless. Between slide pooping, picking up little people, eating raw chicken, being a vegan bodybuilder (and losing the game a lot), doing a lot of OSS work on node, it seems you've done it all
15:25
one time you became a goat, too
 
1 hour later…
16:35
What the heck?!
 
1 hour later…
18:04
hi everyone
18:20
I'm reading about pushState - say I have a list of 5 objects and I add the list element to pushState and 5 more items gets added dynamically after that. If they trigger the popstate event (going back), will it display only those 5 items again?
have any of you work with twilio
18:37
what do you want to know
Jabbascript is sloooooooe
but I wonder if V8 is just using ndarrays internally
@ShrekOverflow use the tensorflow API you will get access to the GPU for ndarrays browser side.
@Rick no no I am not going to GPU
I am just very impressed by how well v8 optimizes certain patterns like Array of Arrays
18:53
hello
i am noyon
i am new here
so how are you
anyone here
!!welcome noyon07
@noyon07 Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
@ShrekOverflow ya many of the imporovments come from the new codestubassembler the V8 team is now using
yeah
i am very happy to join with you
@Rick I am trying to compare it with Jabba and C++ now
18:59
where are you from?
Well a Swamp far far away.
Hi! I'm really new to nodejs, and I'm having a problem using JSON / NodeJS / JavaScript. Basically, I'm using Twitter's node library to upload a image, then tweet it. After it tweets the image, I'm trying to retrieve the URL of the uploaded image but for some reason I'm getting an undefined error, I'm not really sure why
@ShrekOverflow
@DestinyFaith Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
@ShrekOverflow what have you found so far?
19:00
Thank you @CapricaSix
@Rick That I Suck at C++
I've printed the JSON out to the console and I know the values are there, so I'm just really confused why they're showing as undefined
don't you have interested in javascript @ShrekOverflow
@noyon07 I am
now you beginning c++
how many days are you spend on javascript?
About 10 years at this point.
wow
ok..where are you from?
A Swamp far far away.
swamp?
i want to learn new thing with you
so please help me
19:05
@ShrekOverflow from my undersanding the V8 turbofan updates are more about leveling out performance for built in functions. I recently found that foreach was faster than "for", even when I cashed the length of the array for(let i=0,n=arr.length;i<n;i++
yes forEach() traverse the whole arr and return result by condition
I think the stub assebler optimizes in this case when the arrays are small
almost the same thing happened together
ok good bye..see you soon
@ShrekOverflow my last boss joked that I should learn assembly. I am now starting to think that might be a good idea.
@Rick a few run ins with lower level languages are always nice
19:30
@BenjaminGruenbaum what's the process for getting involved in writing code for node?
@Rick you build node first github.com/nodejs/node, it runs, make -j4 and make test pass and you ping me
Then we'll find you something to work on together - you'll make a PR, we'll review it and land it, repeat a few times until you find something you like working on and we'll take it from there.
Usually people find one or two things they focus on - few generalize. thefourtheye is doing a lot of things all around for example and is in the leadership now :D
So proud of how that dude pushed himself in the project, I had nothing to do with it but it was inspiring to see :)
@Rick so java beats javascript hands-down (in that specific benchmark)
@BenjaminGruenbaum cool. Hopefully I can add something :)
@ShrekOverflow what benchmark was that?
just accessing 1e4 array of arrays of 1e3 objects randomly
@ShrekOverflow what did your js look like for that?
19:38
    x[fixedRand(WIDTH)][fixedRand(HEIGHT)].y = total += x[fixedRand(WIDTH)][fixedRand(HEIGHT)].x;
almost the same for Java :P
It has not practical use just trying to see how this code is optimized in each
I wonder if Math.random() is holding it back
@Rick awesome, it's really not that hard you just have to follow through - all it takes is 6-7 commits :)
nope js random is faster vOv
@ShrekOverflow Why don't you compare the built in methods like forEach and for-each
I am trying to see random order
how will i use forEach in a random order ?
going it in single direction they'll both take about 2ms :P
19:56
generate random arrays of equivalent length
well lets compare
just the single direction traversal in a single array
for (let out = 0; out < 4; out++) {
  console.time('non-random');
  let x = Array(MUL).fill(3).map(() => new Delta(3));
  let total = 0;
  for (let i = 0; i < MUL; i++) {
      x[i].y = x[i].x;
  }
  console.timeEnd('non-random');
}

for (let out = 0; out < 4; out++) {
  console.time('forEach');
  let x = Array(MUL).fill(3).map(() => new Delta(3));
  let total = 0;
  x.forEach((el) => el.y = el.x);
  console.timeEnd('forEach');
}
non-random: 3259.329ms
non-random: 3126.846ms
non-random: 2186.414ms
non-random: 2258.982ms
forEach: 3125.283ms
forEach: 3740.398ms
forEach: 3554.537ms
forEach: 3613.014ms
MUL here is 1e3 * 1e4
compared to random they take 1/2 the time.
but the same code in Java is an order of magnitude faster
@ShrekOverflow what is Delta doing
its just a class
class Delta {
  constructor(x) {
    this.x = x;
    this.y = 0;
  }
}
Using ^ is faster than just {x: 3, y: 0}
you can move the time to after the array allocation
@ShrekOverflow I am not getting the same times as you
After moving the allocation (which was most time)
non-random: 40.612ms
non-random: 42.819ms
non-random: 38.349ms
non-random: 38.447ms
forEach: 108.670ms
forEach: 126.617ms
forEach: 114.283ms
forEach: 109.608ms
I wonder why my forEach is so much slower
20:10
@ShrekOverflow are you testing in browser or node, and if node what version of node?
❯ node --version
v10.3.0
so after some tweaks the non-random access are at the same rate
still don't get why random access is getting hurt so much in JS but not in Java
This is the gist
This is the output difference
~380.0ms in Java vs ~3631.302ms in JavaScript
Ok I figured it out
was it type convertion
@ShrekOverflow you're not measuring what you think you're measuring
For example if Java does lazy allocation
20:26
nope nvm
@BenjaminGruenbaum as in ?
It's a very artificial benchmarks
True
I am just trying to break optimization and measure how much it can optimize
@Rick it was the other way around I floored Javas random
after I fixed that Java Started taking 7175.0ms
Measure allocating one large array
Ok
I think List / ArrayList is closer to JS Arrays in Java.
I should learn how to benchmark better 😛
But in the end, I am quite impressed by how much v8 can optimize code
The tests don't seem comperable for the reasons you mentioned. Why don't you use a new Map.
that seems like that would be more comperable to your java
@ShrekOverflow generating an array in those dimentions seems like you are using O(n^3) new Array and fill will loop twice along side the scopeing loop. where your java simply adds items to an object object
20:42
Also the behavior of arrays in js changes when you have more than 1024 elements
@Rick I am not measuring the time spent allocating and javascript is faster after I fixed my broken Java randomizer.
@Meredith That is very interesting
because 1e4 vs 1e4 will take forever to test
I don't remember exactly what changes though
I think everything below 1024 is just a bare hash map maybe
@ShrekOverflow but your console.time encompasses Array(MUL).fill(3).map(
I changed it out
for (let out = 0; out < 4; out++) {
   let x = Array(MUL).fill(3).map(() => new Delta(3));
   console.time('singlelist');
   let total = 0;
   for (let i = 0; i < MUL; i++) {
       x[fixedRand(MUL)].y = x[fixedRand(MUL)].x;
   }
   console.timeEnd('singlelist');
}
This takes ~3267.744ms
THe java code after fixing the random index
Single List took 4505.0ms (in appropriately named this is a java basic array now) I tried that too.
In array of arrays though something very interesting happens
for (let out = 0; out < 4; out++) {
    let x = Array(WIDTH).fill(0).map(
      () => Array(HEIGHT).fill(3).map(
        () => new Delta(3)
      )
    );

    console.time('doublelist');
    let total = 0;
    for(let i = 0; i < MUL; i++) {
        x[fixedRand(WIDTH)][fixedRand(HEIGHT)].y = x[fixedRand(WIDTH)][fixedRand(HEIGHT)].x;
    }
    console.timeEnd('doublelist');
}
Took ~3260.699ms
Turbo fan optimzations are really cool. It will cash your hashes and optimzie your function calls
@ShrekOverflow you have confirmed my suspicions that Java sucks and will continue to suck well into the future. :)
20:56
@Rick that is very impressive
I am sorry for not testing my code in the java side first x)
even with changing it to base java arrays as opposed to array lists its still slower 😃
 
3 hours later…
23:45
@ShrekOverflow Seems like it's time for more auth at work... The rest of the company is adopting salesforce and they want it to automatically create users on our SPA...
We're spinning up a machine that will act as a go-between linking salesforce and our app... it will need to call endpoints with an access token
from reading it looks like I want to use the client credentials grant flow to get a token, but because our application is set to "Single Page Application" I can't change the token endpoint authentication method away from 'none'
so I can either make an 'integration user' and give it the permissions I want, or I can change the application away from SPA... any suggestions?
actually... how does the client credentials grant thing work with the authorization extension... can i tell it which permissions i want? we're still using namespaced fields on the token rather than scopes

« first day (2850 days earlier)      last day (2323 days later) »