« first day (1894 days earlier)      last day (3278 days later) » 

16:00
@Rolf ES6 is properly supported.
true, myArray.stream().map( el -> doSumethingWith(el) )
Nearly all of the features are already supported by the latest version of browsers
@Rolf the hype is well justified, and it's decently supported, especially if you use something like Babel
natively?
16:00
@Rolf a lot of features, yes
And for those older browsers, you have excellent transpilers out there.
babel is not proper support. I've run through bugs with bable
@Rolf you may want to read this before going on about support ;)
if there is a thing I hate more than hype it's transpilers
@Rolf I've yet to encounter bugs with babel
16:01
@AwalGarg Haha, smartass.
But I warmly encourage you to report any bugs you find on the babel issue tracker.
People that come in here and go on about how ES6 is bad, or it's not well supported, or it's too easrly to use it, etc... they don't know what they're talking about.
why add a pile of generated code (to stay polite) on top of my code, for what
We've had this situation over and over again
The day babel goes into the deep roots of static analysis and code execution timeline prediction to support proxies is the day JS tooling will triumph.
16:02
i never said ES6 is bad i am just developing an allergy to hype, by having doing web dev for too long
nothing personal
I know that sebmck will be happy.
So you're a JS Hipster?
i'm a purist and minimalist and parmatist
What's wrong with "hype" aka being excited about new useful features
pragmaticalist
something
16:03
@Rolf The entire point of these tools is to save you development time (and other types of headaches in general)
@MadaraUchiha I was checking your code above. The official .map() returns a function with the "current" element being executed in a loop as the first argument. But in your code why are you always returning arr[0] ? Why it shouldn't be arr[i] instead ?
I feel like babel is a great means to that goal.
eh, ES6 provides useful functions. If you don't want to use it, then you can write your own function.
@ZahidSaeed Recursion.
he's a php_purest
16:03
not the hype in itself but seeing people getting all excited and piling up frameworks when you can do things the "regular" way by just writing a coupld of words more, without needing to re-learn everything and piling up a huge buggy stack on top
Each step is executed on a smaller and smaller array.
ES6 is not a framework
i know
ah... PHP ...
@KarelG It's not the functions that are most useful.
16:04
i was discussing my attitude towards "hype"
Not only, anyway.
garbage language
is that same
returns
ph is not a garbage language
I have some JS code for handling file attachments, however, it doesnt work right if the user clicks "cancel" at the fileDialog.
16:04
anyone uses TLP on Linux (any distro)
it works pretty well and is neat
1 message moved to Trash can
@DininduWanniarachchi Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@Rolf You know, hype doesn't happen for nothing.
not great fun maybe
hmm
something that's the impression i have
That's a hell lot of code to paste in chat
16:04
*sometimes
There's hype around ES6 because it actually solves many pains developers have had for years.
!!afk coffee run
like?
    //handles placing selected file filename into textbox
    $(document).on('change', '.btn-file :file', function () {
        var input = $(this),
            numFiles = input.get(0).files ? input.get(0).files.length : 1,
            label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
        input.trigger('fileselect', [numFiles, label]);
    });

    $(document).ready(function () {
        $('.btn-file :file').on('fileselect', function (event, numFiles, label) {

            var input = $(this).parents('.input-group').find(':text'),
16:05
i know it has some great features
I believe that is formatted
like arrow funcs
@Rolf Here's an example
@MadaraUchiha true. but i said that that standard provides useful functions
16:05
or assigning multiple variables
but i'm not getting all excited about it to the point of getting a transpiler so that I can use it
what about generators and symbols?
Above is my JS code for handling file attachments, however, it doesnt work right if the user clicks "cancel" at the fileDialog.
for (var i = 0; i < 10; i++) {
  setTimeout(function() { console.log(i); }, 1000);
}
@Michael Please create a fiddle on jsfiddle.net (or put the code on gist.github.com) showing the issue in as less code as possible. See our guide on creating an MCVE.
@Rolf what do you think the above does?
16:06
i don't know if i missed anything about ES6
sure, sorry
having my 1st encounter with peer deps
@MadaraUchiha seems straightforward but why don't you tell me. It does what it seems to be doing.
@Rolf Care to try and run it? :)
what for i know what it does
16:07
@Michael Please make a fiddle instead of writing code here
i don't see the point
counts to 10
@Rolf Wrong.
Nupe
Here is my code in a fiddle: jsfiddle.net/p333qb1d Its for handling file attachments, however, it doesnt work right if the user clicks "cancel" at the fileDialog.
it counts to 10 in the console
16:08
@MadaraUchiha just use a string in setTimeout :-P
@Rolf No, it does not.
@AwalGarg Ew.
it doesn't :p
You'd think that
@AwalGarg Compilation error.
But timeouts in loops... no thanks.
16:08
@Michael There's NO HTML
It makes sense that it doesn't when you look at it
@SterlingArcher s/timeout/ajax/
ah no
@ZahidSaeed whoops
16:08
it's setTimeout not setInterval
so it would print 10 after a second
@MadaraUchiha ?
@ZahidSaeed adding that now
@Rolf Also wrong.
Just run it :P
it prints 10 times "10"
@Rolf run the code, see what it does
16:09
magic :)
maybe it prints an error because i is out of scope by that time?
@AwalGarg I treat eval() and implicit eval as compilation errors.
@Rolf It will print the number 10, 10 times.
Do you know why that is?
ok i ran it and yeah that's what it does
@ZahidSaeed Updated it with html jsfiddle.net/p333qb1d
but what's your point?
16:10
@Rolf Here's another example, very similar to the first one\
example of what?
Why did I get a secret hat
yes i know why that is
for (let i = 0; i < 10; i++) {
  setTimeout(function() { console.log(i) }, 1000);
}
@Michael No you still didn't
16:11
@Cereal It's a secret
Now, what does this one do?
BUT WHY
why what?
Why did I get a secret hat
What's the question ?
16:11
@ZahidSaeed .. lol having a tough jsfiddle.net/p333qb1d/2
  function isEmpty(str) {
    return (!str || 0 === str.length);
  }
this is the Boolean global function, in effect
I think he's trying to teach rolf the difference of let and var scopes
@Michael So what you wanna do ?
no he's trying to tell me about non-blocking functions in Javascript
@Rolf No, that's exactly what I'm trying to teach you.
Because that's one major pain that ES6 solved for you.
16:13
i know the difference
true
@ZahidSaeed when the user clicks cancel at the file dialog, any previously selected input (selected file) is lost.
it's not a major pain though
(justlikeyouknewwhattheloopwouldprint)
@Rolf lol
cough
16:13
it's just a refinement
@Rolf Have you ever tried to track down a bug like that?
With asynchronous things in loops?
you know what would be a major pain? Using babel
do you really see that as a "refinement" ?
@ZahidSaeed Is there a way to keep any current input if the user clicks cancel
I was burned so badly and so many times, that I'm afraid to do anything asynchronous inside of a loop anymore.
16:14
When i look at let, i think it just fixed a problem that is only present in poorly written code. If all of those loops were instead written using forEach, map, reduce, etc, the problem wouldn't exist.
maybe i can use the same wording with PHP :|
from my perspecive anyway :) i don't expect everyone to agree, not anyway in fact
@Rolf How is that a major pain?
@Michael Let me check
@KevinB All of those are relatively new.
16:14
well i'd imagine it would be
@MadaraUchiha Why in the world would you do that?
@pootis Because sometimes, you can, and it's the most straightforward way.
i ran into some bugs on codwars, surely due to babel, and one was just a horrible bug that made no sense at all
something to do with recursion
debugging that was a major pain
@Rolf "surely" due to babel?
using var and adding an IFE if needed instead of let is not a major pain.
yes surely because it made no sense at all
16:15
@Rolf Wait what?
Do you know what that entails?
i've looked at it for a long time
Maybe not a pain, but it's ugly as hell.
that also
It entails creating a whole new function, with its own closure, for every iteration of the loop
@Michael Attach jQuery first
16:16
You're going to tell me that's worth the hassle?
well if you need block variables that badly then you can just do that
but i don't
you can solve the whole new function every iteration of the loop problem, but it's still a lot more code/work than simply using let
sure if you have ES6 then go for it but i'm not into transpilers i'm not that excited about it
@KevinB Yes, by removing the function out of the loop and making the loop look even more out of place.
@Rolf You won't "have" ES6 even in 10 years
Look at us, most of the people here are still supporting IE8\
And nevertheless ES6 is definitely the future.
And I'd much rather learn and be well versed in the future, than in the past.
"have native ES6 support"
16:18
@ZahidSaeed sorry, never used a fiddle before.. has the jquery now jsfiddle.net/p333qb1d/4
Transpilers aren't difficult to work with, just tie it into your existing build process (you have a build process right?)
@Rolf Again, that won't happen anytime soon.
@Rolf Let me ask you this
Do you run ESLint on your code?
my english is not well so try to understand
16:18
well if you don't know 'your past' you might be just reinventing it
why don't you go ahead and tell me whatever you want to
@Rolf Do you, or do you not?
Also, do you unit test your code?
it just sounds too much like a challenge with the aim of proving something along like you know better then me aobut something
and I'm not into that
Those aren't hypes, aren't they? They're sanity tools
Tools meant to keep you sane in the long run.
@copy for(;r=readline();print(i))for(f=i=0;~f;)r[i++]>"("?f--:f++ I think I can reduce this bit: r[i++]>"("?f--:f++
@Rolf It really isn't.
16:20
yeah i agree
i don't
@Rolf Why?
but I am not against it
@Michael What you want is when the user clicks the 'cancel' button in the dialog box then the value of input shouldn't be changed ?
See, the vast majority of web apps that use JS today have either
@Shmiddty I tried and I couldn't
16:21
That is it should be preserved
well that's a per-project decision
And when you have a linter or unit tests, than you have a build step.
so i'll have to go into details to explain it
@ZahidSaeed yes, currently I have it so that the "text" doesnt change, but I still lose the input value
And when you have a build step, using a transpiler is trivial.
16:21
@MadaraUchiha what?
39 mins ago, by Madara Uchiha
function map(arr, cb) {
  return (function mapper(arr, cb, i) {
    if (arr.length === 0) { return []; }
    return [cb(arr[0], i, arr)].concat(mapper(arr.slice(1), cb, i+1));
  })(arr, cb, 0);
}
How can improve?
@Shmiddty Well, I could shorten "(" though
@MadaraUchiha That's super slow in JS, since concat is eager and so is slice, you can't write code like this in JS.
@BenjaminGruenbaum Yes, I know.
Well, you can if you're using Seq in ImmutableJS, but you're not so there's that.
16:22
It's a proof of concept.
@MadaraUchiha true, might be. but the more code you add the more bugs you might have to deal with
For writing map() recursively.
so that's why i prefer adding these things only when needed
Can I use es2015 goodies @MadaraUchiha ?
16:23
@Rolf You... really can't.
@BenjaminGruenbaum Which?
can't what?
@Rolf You can't trivially add unit tests "only when you start to need them"
@MadaraUchiha I'd use generators, but you want recursion so there's that, maybe just arrows hmm.
By that time your code is almost certainly untestable.
i know
i know that it's best added first
16:23
@copy hmm
Same with ESLint, you'd have to fix hundreds of errors.
i'm just prototyping ATM
@DininduWanniarachchi I will kick you a second time.
but you have a point
@DininduWanniarachchi Because you're begging for help for quite a while now.
Please read the room's rules (At the top right)
If someone can and wants to help you, they will.
@Rolf The fact is, that most new projects today have a build step.
If I wanted ineffectively implement map I'd just do:
function map(arr, cb) {
    return arr.reduce((p, c) => p.concat(cb(c)), []);
}
@BenjaminGruenbaum That's cheating.
No array methods allowed.
I don't start a project without ESLint, anything that I plan to maintain also has unit tests.
16:25
Why isn't there any good es6 documentation generators yet?
@MadaraUchiha as a minimalist I try to avoid grunt except when the need and benefit is obvious
@Rolf Who said anything about grunt?
nobody
well me
Ask @BenjaminGruenbaum you can easily write your own build script in 10-20 LoC
that's what I assimilated to build step
16:26
Just use make
just use makefiles, they are awesome
:D
I beat you to it, @Awal
yay another thing to learn
learning is fun
16:26
@Rolf Just use a completely normal node.js script.
@MadaraUchiha You could also define reduce first
function map(arr, cb) {  // ew, also no index, but I'm fine with that.
    return arr.length === 0 ? [] : [cb(arr[0])].concat(map(arr.slice(1), cb));
}
@pootis I wrote like double of what you wrote, I win much more easily :P
crl
crl
very ew
@copy probably the better idea.
16:27
well i like to use a subset and optimize it
@BenjaminGruenbaum Fails most test cases that require the index and originalArray argument.
if i can do everything using that then i find it better
I'm not fine with that :P
@AwalGarg Still, mine was earlier.. wait, how the hell did you come up with the same thought at almost the same time?
@copy I don't see it
16:28
@Michael How about creating a variable outside the on("change") function and assigning its value to the file that was selected ?
@pootis Great minds think alike, and fools rarely differ.
@MadaraUchiha at least make it efficient.
What do you have in mind?
@ZahidSaeed, sure let me try
@Michael But remember you have to use if-else to check if the value is empty then simply return (that is don't change the value of that variable)
16:29
please someone why is this happening regex101.com/r/jS9xY1/1 I a binary number "1100101000000000" ... now I have to find the max number of cnsecutive 0's between two 1
@argentum47 Yeah, you can't really use regex for that
@MadaraUchiha you seem to underestimate the diversity of foolishness present in this little world
At least, not purely regex.
function map(arr, cb, i = 0, result = []) {
    if(i === arr.length) return result;
    result[i] = cb(arr[i], i, arr);
    return map(arr, cb, i + 1, result);
}
@MadaraUchiha this is much faster because it's a tail call.
@ZahidSaeed right.
16:30
If you run it in babel, it'll inline the recursion.
oh I see :P , then I have to do normal programming way
@BenjaminGruenbaum But can be fucked up with map([1,2,3], x => x*2, 42, ['fuck you'])
@MadaraUchiha so what?
@argentum47 Hi, where have you been?
I can wrap it in a "mapInner" or some stupid thing. @MadaraUchiha
16:31
@BenjaminGruenbaum Which is basically what I did
You just added the result[] array and got rid of .concat()
Only in O(n^2)
(Which is great)
@pootis I am goood .. but I am little burdened with office work ..
@MadaraUchiha why? Mine does it much faster and isn't harder to read...
@argentum47 oh, good. I'm useless chicken, btw.
16:32
I actually have my second round of toptal process .. I was going through some of those codility.com sample problems and I realise I am terrible at !web dev
@AwalGarg oink oink
@BenjaminGruenbaum Yours isn't a "drop in replacement" for [].map()
Which is what I'm aiming for since I'm teaching someone.
!!> "1100101000000000".match(/(.)\1*/g).reduce((a,b) => a = b.length > a.length ? b : a)
@pootis u smell good
16:33
(She did it with loops, now without)\
@Cereal "000000000"
\o/
answer is 2
16:33
const map = (arr, cb) => (function mapper(arr, cb, i, result) {
    if(i === arr.length) return result;
    result[i] = cb(arr[i], i, arr);
    return mapper(arr, cb, i + 1, result);
})(arr, cb, 0, []); // ugly, but not slow @MadaraUchiha
coz the last 9 zero's not between two 1
Also, neither mine nor yours are drop in replacements, I hope you realize that @MadaraUchiha
@argentum47 clever
16:34
In a few days benji will have 1M rep
@BenjaminGruenbaum Because TCO?
@MadaraUchiha [1,2,3,,,,,].map(x => 2 * x)
because holes.
It'd have to do an in check.
@BenjaminGruenbaum Right
Well, it's a PoC, so meh
const map = (arr, cb) => (function mapper(arr, cb, i, result) {
    if(i === arr.length) return result;
    if(i in arr) result[i] = cb(arr[i], i, arr);
    return mapper(arr, cb, i + 1, result);
})(arr, cb, 0, []); // ugly, but not slow @MadaraUchiha
All it takes to fix it...
Wait, still has to explicitly set the .length, lol JS.
@ZahidSaeed Do you know how I can capture the value of whatever is currently selected?
16:37
@BenjaminGruenbaum Heh
Yeah, I'd ignore the edge cases for this example.
@Michael .val() if you are using jQuery
I'll mention that the original functions do handle them though.
@MadaraUchiha Then why did you ask for the unimportant stuff like index and original array?
@Michael yes.. by using eithere :checked or .value .. don't know what the context is though
If you want to show recursion just show recursion...
crl
crl
16:38
!!> Array.from([1,2,3,,,,,]).map(x => 2 * x)
@crl "2,4,6,NaN,NaN,NaN,NaN"
const map = (arr, cb) => (!arr.length) ? [] : cb(arr[0]).concat(arr.slice(1))
@Michael But since you are using <input type='file'> therefore you have to use
var file = $("input")[0].files[0] // If user can select only 1 file at a time
@ZahidSaeed ahh okay, let me try that
Good morning all.
16:40
@Michael $("input") is not necessary, you can use whatever you want to refer to that <input> element
@argentum47 wuzzap
Morning
!!afk steam
@AwalGarg !LTS how izz rusty ?
!!tell Enijar Morning
16:41
@ZahidSaeed You iz in mindjail
lol :D
!!> "1100101000000000".match(/10+1/g).reduce((a,b) => a = b.length > a.length ? b : a).length - 2
\o/
@Cereal 2
I don't know how it works :P
@argentum47 It is pretty awesome, not sure I'd ever like to write C again
16:42
@Cereal codility.com/demo/results/trainingPYEXKN-E79 does it work for all of'em ?
@trilolil 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.
I m having a problem with JAVA swing
@AwalGarg I went to one of those deep web sites today .. using tor .. one chat room was there .. it had a socket.c and index.php and a .js file .. they have done those whole room and join room thingy in C ..
This is my current UI:
and I am trying to get it like this:
16:44
@argentum47 like.. IRC?
@trilolil : please note that this is Javascript room, not Java
yhea I know
but there s nobody in the java room
so I hoped there d be some people here with exeperience in JAVA
@argentum47 Now with bitwise operators
@AwalGarg not sure of that .. but I guess so .. but there are private rooms and no index page ..
16:45
@trilolil Please visit chat.stackoverflow.com/rooms/139/javachat-fish-and-chips for any question related to java
nobody there...
the last person who posted smt there is me
@trilolil : i suggest to put a Q, with both images and the code of which you're using to have that display.
Well then you have to wait for someone to get online there
@copy the decimal to binary function ? I googled that up .. shortcut to negative modulus ..
16:46
without code, it's like a stab in the dark.
@argentum47 I finally moved arch from a VM to my primary boot menu, btw :P
@copy there's also a solution using replace("()",""), but it's too long
@argentum47 nope
@AwalGarg holy shit .. (Y)
@argentum47 No, use << >> ^ & | instead of .match()
16:47
oh
@ZahidSaeed still having an issue. Cant set Stored Variables value back into input jsfiddle.net/p333qb1d/8 commented out the line where that happens because its broken
@argentum47 heh, I have to control audio and brightness level by echoing the level value to the correct file in /sys/class/<something> from the terminal :P
@Shmiddty In Python you can evaluate the input and return the location of the syntax error
@AwalGarg for audio no alsamixer ?
16:49
@copy hah
@argentum47 nah, I am just exploring the tools right now trying not to install anything as much as possible
@copy ok... so like take numbers = "binary number".split(); then take numbers[i] | numbers[i+1] == 0 then increment count.. and if 1 then store count in array and reset counter .. and then sort array and take last value ?
maybe silly question, how hard would it be to make a flag 'alias' for npm ??
npm list --depth 0 -> npm list --short
or not worth it? probably not.. but now I am curious.
i have problem with inline elseif
searchDocument === Arr._input ? searchDocument = 0 : searchDocument = Arr._area : searchDocument = 1;
@rlemon <3
16:55
@DininduWanniarachchi that is called a Ternary
is this wrong
!!mdn ternary
crl
crl
the ternary era
@DininduWanniarachchi Yes.
16:56
@SterlingArcher bro, did you get the taco video?
every : should have ?
I did, that was hilarious
so any solution for inline else if
Who DOESNT know that registers are empty after dark lol
conditionA ? foo : conditionB ? bar : hamburger; // but this is unreadable garbage
please NO for nested ternaries
that hurts my eyes
crl
crl
!!> if (1) ok; else ko;
@crl "SyntaxError: missing ; before statement"
@crl "ok"
for(;r=readline();)try{eval(r)}catch(e){print(e.columnNumber)} should work eventually
too long though
16:58
Anyone here familiar working with FileDialogs? I am having trouble retaining the file that user has selected if they reopen the fileDialog and click cancel: jsfiddle.net/p333qb1d/8
@SterlingArcher most places keep a float. usually $300-$500, still not worth it..
Apparently you cannot manually set the File Input to anythin
!! if (Math.random() > 0.5) "crl got KOed"; else "KarelG got KOed";
@KarelG That didn't make much sense. Maybe you meant: gif
Really? They gonna float that ass right to jail for going in no mask haha

« first day (1894 days earlier)      last day (3278 days later) »