« first day (2073 days earlier)      last day (2874 days later) » 
00:00 - 11:0011:00 - 00:00

11:04 AM
Download time: 12h. Maybe they have been trying to get rid of their user base?
 
11:17 AM
hi
 
Morning
 
do you know bootstrap?
 
@JanDvorak Legit tools will not require you to post on facebook or "promise" to not spam your email.
 
It's not the tool's webpage. It's a service that convinces one tool per day to be free on that day
 
What kind of tool takes 12 hours to download?
 
11:20 AM
Any tool from a crappy fileserver
 
11:32 AM
Does anyone know why you aren't able to loop an HTML5 video element with a media fragment set on the source? My hunch is that setting the Media Fragment of the source doesn't allow you to loop because it is calling pause() on the video whenever video.currentTime = Arg2? Does anyone know for sure? I'm also well aware I can write my own looping function in JavaScript, I'm just wondering why it doesn't work with the built in attribute.
 
11:51 AM
What would be the best way to convert jsonp to promises?
 
@Abhishrek Probably one of the only use cases for deffereds.
 
12:06 PM
import md5 from 'md5';
const map = new Map();

window.handleProfile = function(response){
  if(!response.entry || !response.entry[0]){
    throw new Error('Unresolved Profile');
  }
  const profile = response.entry[0];
  const hash = profile.requestHash;
  const resolve = map.get(hash);
  resolve(profile);
  map.delete(hash);
}

export function getProfile(email){
  return new Promise((resolve, reject) => {
    const hash = md5(email);
    const script = document.createElement('script');
    script.crossOrigin = true;
@MadaraUchiha I am currently doing it like so
but i guess deffered makes a lot more sense here
 
12:53 PM
@Abhishrek That's essentially deferred
With a bit of an overhead, but still
 
vOv
using deffered now
 
1:24 PM
@Abhishrek are you seriously hashing with md5?
Why are you storing resolve/reject?
4and are never resolving or adding an onload
 
@BenjaminGruenbaum Gravatar only supports jsonp
 
oh, you're doing map.get, that doesn't make sense the script might not be loaded.
So abstract it at that point with jsonp.
 
Do you guys use maps or weakmaps in production?
 
I now just use deffered
 
@Asperger I do.
 
1:26 PM
@BenjaminGruenbaum you do use a polyfill or a switch fallback right?
 
also if you are asking the md5 lib, meh just an npm installed didn't search and read the source. If you are asking the algorithm that's a gravatar limitation
 
@Asperger right.
@Abhishrek just use successive integers?
 
Its kind of like in Java, C# or Haskell where ive use maps regularily.
I just like the fact that we dont need to specify the data type :D
By the way, it would be awesome if we had access to pointers in Javascript. Like really low level stuff.
 
NO, it wouldn't
 
Security?
 
1:31 PM
For one, you can't have pointers and GC
 
whats GC?
 
One of those things you rely upon until you don't have it.
 
function jsonp(url) {
  return new Promise((resolve, reject) {
    var scr = document.createElement("script");
    scr.defer = true; // meaningless, because it's async anyway
    const id = jsonp.counter++;
    const cleanUp = () => { delete window.["jsonp_" + id]; }
    scr.onload = () => cleanup();
    scr.onerror = (e) => cleanup() || reject(new Error(e));
    window.["jsonp_" +id] = resolve;
    scr.src = url + (url.includes("?") ? "&" : "?") "callback=jsonp_" + id;
    document.body.appendChild(scr);
@Abhishrek something like that?
 
oh for that
 
Needs some refinement
 
1:33 PM
`gravatar.com${hash}.json?callback=handleProfile`;
 
Oh, you hash for gravatar?
I thought you hashed for jsonp
 
yeah
I was hashing for gravatar so just reused the hash
 
oh, your promise use is still quirky
 
gravatar will return it to me nicely aswell
true that
 
missing a =>
 
1:35 PM
Where?
 
In my code, new Promise(... =>
function jsonp(url) {
  return new Promise((resolve, reject, id = jsonp.counter++) => {
    const scr = document.createElement("script");
    const cleanUp = () => { delete window[`jsonp_${id}`]; }
    scr.onload = () => setTimeout(cleanup);
    scr.onerror = (e) => cleanup() || reject(new Error(e));
    window[`jsonp_${id}`] = resolve;
    scr.src = `${url}${url.includes("?") ? "&" : "?"}callback=jsonp_${id}`;
    document.body.appendChild(scr);
  });
}
jsonp.counter = 0;
 
Oh, right
Would it be nice/useful/possible to have a foo(){code} alias for foo(function(){code}) ?
 
Swift has that, called "autoclosure"
Oh wait, autoclosure means you can omit the {}s too
foo(code) doesn't always run the code, this lets you do things like if in userland
Arrows make things pretty simple
 
Ruby has that, each method has a slot for one implicit proc passed using that syntax.
ary.each_cons(2){|e1, e2|...}
but would it cause ambiguities if added to Javascript?
I assume it would translate directly to a function argument.
Autoclosure looks nice and wouldn't be at all surprising in Lisp
In Haskell delayed execution is normal but it doesn't affect semantics
 
1:52 PM
It affects semantics in Haskell, it's just expected, there are lots of places where you write code and it evaluates the line but not it, most commonly with things like &&
 
But the order of evaluation isn't visible there, except to avoid infinite loops
In Swift delayed execution means you see different values
 
Well, in practice you rely on it in Haskell.
 
Absolutely
fix f = y where y = f y
Too bad you can't use fix with Double -> Double
 
I dont really like haskell. I got to admit, creating a loop in form of a minimal recursion is cool though. Many features such as lamdas, hashmaps, lets etc derived from functional programming languages
 
Ah, c'mon, repeat x = fix (x:) is just awesome
 
Haskells repeat is cool too
but for instance for calling an index from an array we do x !!! 1
it kind of sucks in terms of syntax
 
@Asperger you realize, you can write a for loop in Haskell if you really want to, but you really don't need to.
 
Other than fast mathematical operations im not sure what haskell is good for. Still trying to find some real benefit other than fast prototyping of programs
 
@Asperger no lol, you destructure.
If you have a function that takes a list, you destructure its arguments, you rarely use !! for that
 
@BenjaminGruenbaum a loop in haskell?
 
2:04 PM
@Asperger yes, but you typically don't need that.
 
I thought you just use recusions. The result is the same in most cases
 
head x = y where (y:_) = x
 
You'd use do notation with whileM, you typically don't write a lot of recursion of loops - you combine combinators
 
@Asperger most often you use a fold
 
Ok thats new to me
 
2:05 PM
You shouldn't use Haskell for a variety of other reasons
 
:-(
 
@BenjaminGruenbaum name a few because I have been looking at the official documentation every now and then
Im trying to find a reason to love it
 
@Asperger oh, learn Haskell first by all means
read LYAH
 
Learn Haskell, just don't use it :D
 
Well if I were to learn a functional PL then definately haskell but just to understand a new paradigm
 
2:07 PM
forkMapM -- Like mapM, but run all the actions in parallel threads, collecting up the results and returning them all. Does not return until all actions finish.
forkMapM_ -- like forkMapM but without bothering to keep the return values
forkMapM__ -- like forkMapM_ but not even bothering to track success or failure of the child threads. Still waits for them all though.
 
Haskell is so automatic and high level that performance worries me xD
 
@Asperger Most of the magic is done in compile time
So runtime is pretty good.
 
Ok, good to know : )
I wonder if it has something effective like in C for interacting with the heap.
 
wrong language
 
Haskell is well in the ballpark of C performance
sometimes surpassing it even.
 
2:13 PM
I meant it is the wrong language for playing with memory directly.
 
You do have FFI
Don't touch it though
 
Exactly.
 
So whats haskell for then? I did my research but most articles were useless opinions
I assume it could be used for extensive mathematical operations
 
Anything where correctness is of utmost importance
 
Correctness in terms of numbers precision?
Cant we achieve that in C with double precision floating points already
 
2:18 PM
correctness in terms of not radiation poisoning someone to death accidentally while xraying them.
 
/me is modding civ 5 to add Donald Trump
 
@JanDvorak brutal example :D
 
although models & animations :-(
 
if only you could find pictures of trump online..
 
@Luggage 3d models :-/
 
Paternal Legacy You start with 1000 gold upfront, no unhappiness population from population but -50% science, other civs / city states are hard to stay friends with. Increases in faith but lower great person generation.
 
I know this is a javascript room but guys this picture is awesome:
Look at this trump picture, its really funny
 
@Luggage I'll still have to animate him thats pretty painful
 
and risk of spontaneous nuclear war.
 
so far its just washington with trump.ogg sounds (thats pretty amusing TBH)
@Luggage I have set his nuclear thingy to > 24
 
2:24 PM
n1 ** n2
guess what this does ; )
 
depends which version of javascript your runtime supports
 
It wont work in any of the current ES standards
it will be an alternative to Math.pow() though in the upcoming update
 
Use haskell. It has both ** and ^. ^^ even.
 
@JanDvorak you love haskell dont you? : )
 
BBL, recharging my apostrophes.
 
2:30 PM
Damn that sucks, I just cant figure our how to remove that crappy blur effect when animating via transforms (rotations etc) on text
it seems the browser does some rasterization
crap
and putting the font on some mega size and using scale to put it back to normal is an evil hack
 
@Asperger the current update, not upcoming. read the channel title.
 
@Luggage oh wait, its been released? What about babel?
 
What about babel?
 
Does it support ES2016 already?
 
I don't see any preset for es7, but you can add the exponentiation plugin knowing that it's part of the spec
 
3:10 PM
@Luggage future features are in the stage-3 to stage-0 presets
 
those are all new features, even those not in es7.
 
then you want just stage-3
 
you want a preset.
stage-3 should start representing es2017
 
@Asperger you want to have a look here kangax.github.io/compat-table/esnext
 
linux issue
cant detect wifi
 
3:16 PM
buy a mac
 
ArchWiki to the rescue!
 
Win10
 
@FilipDupanović link
 
jiggle the handle
 
3:18 PM
@JanDvorak speak of the devil zenparsing.github.io/es-observable
 
@FilipDupanović well I dont see a network controller in lspci
and for some reason lshw is not installed
 
where is @littlepootis when you need him?
@Abhishrek silly question: do you have the wl module in your dependencies? modprobe wl
 
nope
 
you need to add that module to get the wireless drivers loaded
 
3:39 PM
dafuk
why don't I suddenly have it.
 
@FilipDupanović um
@Abhishrek you probably do.
 
module gnomes
 
@FilipDupanović meh
 
4:18 PM
@MadaraUchiha any chance you could clean up comments in stackoverflow.com/questions/37907983 I got into a silly argument kthx
 
4:36 PM
@BenjaminGruenbaum should we initialize a variable with null in javascript?
Im used to do just var x;
Occasionally I also do var x = null; to make it clear that it will be initialized properly later
 
probably. It shows intent, depends on what intent you want to show.
null is explicit nothing.
 
What do you prefer?
 
depends on the use case.
 
!!vote no-null
 
@JanDvorak vote registered
 
4:43 PM
That ... took a while
 
Squint is pretty cool, so you got in a little argument with him
I still didnt get where he was rude
 
@JanDvorak Benjamin got into some sort of argument but It seems the rude comment from squint has been deleted
@BenjaminGruenbaum what did he write`?
 
4:56 PM
Just started with JS so bear with me. What is this, and how can I automatically populate this from an array? data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
 
This looks like an array to me
inside an object literal, probably
 
essentially I want to populate that with the contents of an Ajax response:
 
1 message moved to Trash can
@cybermonkey Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
ah, sod the code markup
 
5:00 PM
@CapricaSix better, cheers :)
 
One does not simply return a value from an AJAX call
 
why was it deleted?
 
Error 404 occured, I will call the maid (@Zirak)
 
I edited it to format properly and it wasn't a big block
 
She's not particularly fast
 
5:01 PM
@JanDvorak the same code is used multiple times, which is why I'm using it in a function.
function CSVToArray($apiEndpoint) {
	$.ajax({
		url : $apiEndpoint,
		success : function(result){
			alert(result);
			var array = result.split(',');
			return array;
		}
	});
}
better?
 
You can return a promise from the function
Better yet, grab a client-side library so that you don't have to phone home
 
@cybermonkey this is slightly confusing, as even though you are returning array from an async function, which doesn't make sense, you are also not returning the value to any variable
 
Also, why is it named with a dollar?
 
@JanDvorak new to JS, and especially Ajax. I'm finding the JS naming conventions confusing atm.
 
OK, why is there a function named CSVToArray that doesn't take CSV, but rather the URL of a web service?
 
5:06 PM
@cybermonkey in javascript you can use all kinds of characters in your variable names, jQuery just uses the dollar sign to save you from typing 'jQuery' all over
 
@bitten makes sense
 
@JanDvorak doesn't the result.split(',') turn a csv into an array?
@cybermonkey yeah, you can even use emoticons. you do not have to follow this pattern and can omit the dollar sign from your own variables
 
$something usually refers to a jQuery collection
 
@bitten still not the best name IMO
 
5:08 PM
@cybermonkey so the problem here is that you're using an async (asynchronous) function to call your api. by their nature, javascript will execute async functions and continue on the script without waiting for a reply
the majority of functions you see are synchronous, although there are a few special ones like your $.ajax function
@JanDvorak true. perhaps getCSVAndReturnArray?
 
so, yes. return $.ajax(url) in the function, then getAry.then(function(){...})
 
@cybermonkey you may have a problem if your csv is multilined though, so watch out for that
 
Better use a parser. Any chance you can change the server, @cybermonkey?
If so, send a JSON
 
@JanDvorak I can, but have zero experience with JSON.
 
Then return JSON
jQuery will parse it for you, don't worry.
 
5:13 PM
@cybermonkey how much time are you willing to spend on this problem? as it's worthwhile to understand ajax and async, and also to get familiar with json
as in, are you interested in programming and want to continue learning? or is this just a problem in a website and after this you'll never see javascript again? heh
 
@bitten my task is to create a dynamic set of graphs from db output
just modified my PHP to output JSON
 
@BenjaminGruenbaum I'm assuming you don't mean the question?
Are you talking about your answer to the question?
 
5:33 PM
oi
 
6:00 PM
o7
 
6:12 PM
io
 
if you guys had to choose between the two variable names in a for in loop, which would you choose?
(let prop in obj) or (let property in obj)
 
Neither
 
while the latter makes things more readable im concerned that it might cause some conflict
 
key
 
let key in obj
 
6:22 PM
ya right.
they are essencially key value pairs. True
 
let obj in prop - where $obj is the property ( ͡° ͜ʖ ͡°)
 
lol
How did you create that face? It looks funny
 
( ͡° ͜ʖ ͡°)
 
( ͡0 ͜> ͡0)
Here an anime version
 
༼ つ ◕_◕ ༽つ ︵ standards
 
6:26 PM
( ͡O ͜ʖ ͡O)
 
Holy crap. Tacos looks amazing :D
 
thanks, I work out
 
7:01 PM
oh goody, unicode
I can't figure out why my auto-scrolling only works once.
I have two divs: both have auto-scrolling toggles. When the switch is on, JS is supposed to keep the div scrolled to the bottom. For the first div, it works fine and keeps the div scrolled when new text is shown, but the second one only scrolls to the bottom when I toggle the scroll. If new text comes in, it doesn't scroll
I have this running every time the text updates:
$('input[type="checkbox"][name="autoscrollma"]').change(function() {
                                                    if(this.checked) {
                                                        var objDiv = document.getElementById("logm");
                                                        objDiv.scrollTop = objDiv.scrollHeight;
                                                    }
                                                });
The site this is on is at x-p-w.tk/control.php, login is temp temp
 
7:27 PM
 
needs to be smaller
 
Nice @MadaraUchiha :)
 
Heh, another Israeli in the room, apparently.
Unless I'm totally reading your name wrong.
 
user1106925
@Asperger: No comments were deleted. He thought this one was "rude", though I admit it was slightly exaggerated. For some people (maybe Benjamin, maybe not), programming practices seem to be a matter of religion. I'm open to alternate, creative solutions that don't abide an artificially narrow set of rules.
 
7:35 PM
Asperger?
 
hi guys
 
7:55 PM
Apparently MS is doing a nice move by acquiring LinkedIn. Gotcha see the next news about that matter
 
8:32 PM
anyone on?
 
@driftking9987 Welcome to the JavaScript chat! Please review the room 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.
 
Sure. Will read the rules.
 
@Zacharee1 that Javascript needs to be rethought. It's rewriting the element everytime.
so, if you attach an event listener, then remove the element and add it back, the event listener is gone as well.
Not to mention this thing is causing a SERIOUSLY high memory leakage issue
 
Am using w2ui-1.4.2.min.js for multi select in a drop down box.
Am working on some charts(d3js). My main problem was that, when I included the w2ui drop down, I am getting "N" numbers of items as "undefined" in the box.
http://w2ui.com/web/docs/form/fields-enum
Above is the link for that script.

Now I debugged a lot and I pinpointed that I have some function which are causing that "undefined" to be there. In chrome's console, am not getting any error as such.
Array.prototype.getColumn = function(name) {
return this.map(function(el) {
// gets corresponding 'column'
if (el.hasOwnProperty(name)) return el[name];
// removes undefined values
}).filter(function(el) { return typeof el != 'undefined'; });
};
//dataArray = [10000000,12000000,12000000,13000000];
//remove duplicates in an array
Array.prototype.contains = function(v) {
for(var i = 0; i < this.length; i++) {
if(this[i] === v) return true;
}
return false;
};
Array.prototype.unique = function() {
var arr = [];
How do I get rid of those "undefined" items?
 
@driftking9987: that is horribly formatted code. Please Tidy it up before posting.
 
ok, that's better. Can you also link to a jsFiddle with some example usages where you're getting the error?
 
ok sure. I'll do that
 
Just, nothing immediately jumped out at me, so seeing it in action will provide a bit of context that'll allow me to debug it
 
does anybode here have much experience with js frameworks (specifically backbone.js)?
im trying to figure out if I need one for my current project
 
9:00 PM
In that, I added 3 functions at the bottom and it showed me 3 "undefined" in the list. If I remove that, it works fine. And the problem is that, I need these three function in my chart
 
9:51 PM
Error 404 occured, I will call the maid (@Zirak)
Error 404 occured, I will call the maid (@Zirak)
Error 404 occured, I will call the maid (@Zirak)
Error 404 occured, I will call the maid (@Zirak)
 
11:18 PM
@VeronicaDeane you are strange
 
@VeronicaDeane oo nice
> maybe time's just a construct of human perception, an illusion created b-WEH WEH WEHW EH WEH
 
lol
 
00:00 - 11:0011:00 - 00:00

« first day (2073 days earlier)      last day (2874 days later) »