« first day (2380 days earlier)      last day (2571 days later) » 
00:00 - 20:0020:00 - 00:00

12:02 AM
my vscode crashes when I paste 100kb of html
sigh
 
@DovydasNavickas yes
the issue is resolved now, I wasnt setting the defaultProps correctly
 
Yeah, I wanted to suggest double-checking the types of defautProps and propTypes :)
Glad to hear you've resolved it already.
 
 
1 hour later…
1:23 AM
If I have around 6000 titles of movies and I want to find the most used word out of all of the titles what is the best approach to take to find the top 10 most used?
 
each new word add a record, and increment when you find a dupe
then sort by number
 
1:52 AM
How do you diff @Loktar (JSON tehe) efficiently?
 
thanks for the reply @Loktar any idea how I might get the top 10 based on what I currently have?
var Words = function () {

    var v = require('voca');

    this.wordMap = new Map();
    this.bannedWords = ["a", "i", "the", "than", "but", "and", "of", "when", "he", "her"];

    this.checkString = (str) => {
        for (let x of v.words(str)) {
            this.addWord(x);
        }
    };

    this.addWord = (word) => {
        if (!this.bannedWords.includes(word)) {
            if (this.wordMap.has(word)) {
                this.increaseWordCount(word);
            } else {
                this.wordMap.set(word, {count: 1});
Been sat here trying to figure an efficient way of getting the top 10 entries in the map based on the count property
 
hmmm
 
probably convert to array
sort array via property
then grab the top 10
though the sorting could have pretty big overheads as there's almost 7k entries
so that's a lot of words to process
~98000 words to be precise
 
what is voca?
 
It's just a string lib so I didn't have to write 8 more lines of code
I'm thinking I'll calculate these stats on a node scheduler
and just keep stats for the top 10 everyday
 
2:02 AM
What about using something like Array.reduce()?
(I actually had to do something like this recently)
 
Never used that before
though from reading wouldn't this reduce stuff to one value?
 
Oh, do I have a treat for you, let me whip up a demo in jsbin
 
:o yes jake I like where this is heading
I'm really surprised there isn't a small library on npm for doing this kind of stuff
I'm tempted to throw my module up if it works well
 
@lix Can you give me a sample dataset?
 
How do you want it?
 
2:08 AM
pastebin.com? just an array string I can assign to a var
I assume its a string array of words?
 
Does anyone know of a way to mass edit JSON? Like for instance if I have a database with businesses and they have a lot of the same properties like city and state which will all be the same.
 
@lix a sort?
 
well I've got 7k in a db
 
what about something like that?
 
but I can give you like 20?
 
2:11 AM
throw them in an object
and then sort the values
9k words would take a bit though probably idk, when I had to do this I used a database
but I was going over thousands of documents too
would crawl them, update the db, then just do sql queries to get what I needed
 
that's a brief sample
 
user6820627
@Loktar I have processed 300 000 English words in JS (1 second!)
 
@Loktar cool example
It's around 5-6k articles per week all with varying title lengths
 
Still working on mine.
 
bored so:
const testWords = ['hello', 'test', 'hello', 'wow', 'rekt', 'hello', 'wow'];

const counts = testWords.reduce((acc, cur) => {
    acc[cur] = acc[cur] || 0;
    acc[cur]++;
    return acc;
}, {});

const top = Object.keys(counts).sort((a, b) => counts[b] - counts[a]);

console.log(top);
 
2:15 AM
@Mosho that returns only the top word correct?
 
array of words descending by count
in this case [ 'hello', 'wow', 'test', 'rekt' ]
 
Note the test data:
 
banned words isn't working there.
in mine
yeah I figured once I posted something getting actual code running others would make solutions :p
 
I just took your words
rekt
 
2:18 AM
and object.keys solution
rekt
 
@Mosho in your example can you get the amount of times each word occurred?
 
sec
 
:o
 
user6820627
Solution with banned words:
 
user6820627
var bannedWords = new Set(["a", "i", "the", "than", "but", "and", "of", "when", "he", "her"]);
var testWords = ['hello', 'test', 'hello', 'wow', 'rekt', 'hello', 'wow','when'].filter(_=>!bannedWords.has(_));

var counts = testWords.reduce((acc, cur) => {
    acc[cur] = acc[cur] || 0;
    acc[cur]++;
    return acc;
}, {});

var result = Object.keys(counts).sort((a, b) => counts[b] - counts[a]);

console.log(result);
 
2:19 AM
your is the top word
 
@LearnHowToBeTransparent wtf is has
oh it's a set
 
set method
 
whatevs
 
It's cool these work, the only thing I'm concerned about now is getting the count alongside the word
 
.filter(=>!bannedWords.has()); What is that??
Also none of these would work with the test data you sent me. You have to split the strings
 
2:23 AM
@jake the code I have at moment does that already :-)
 
const testWords = ['hello', 'test', 'hello', 'wow', 'rekt', 'hello', 'wow'];

const counts = testWords.reduce((acc, cur) => {
    let x = acc.get(cur) || 0;
    acc.set(cur, ++x);
    return acc;
}, new Map());

const top = [...counts].sort(([x, a], [y, b]) => b - a);

console.log(top);
I can be fancy and use Map too
 
user6820627
var result = Object.keys(counts).sort((a, b) => counts[b] - counts[a]).map(_=>{return {count: counts[_], word: _}});
 
that's actually lit.
 
user6820627
@lix what do you mean
 
very good, top notch
man you guys have made these so complex I can't really understand what there doing now
xD
 
user6820627
2:26 AM
@Mosho It took me 2 minutes to realize that you are destructuring
 
sucks to be you
 
It's alright I'll figure it out ^_^
 
yeah the vars are shit
that's part of it
but people have a tendency in chat to use single letter vars
@jake yeah that was like a 2 second thing to do :p
 
well I'll be dammed @LearnHowToBeTransparent not only does it look pretty but it's pretty fast :o
Time to throw 50k words at it and see what happens
 
@lix you should participate more in the room instead of just getting answers to questions
randomly looked at your recent history, it's close to vampy
 
2:40 AM
@Loktar my recent history?
 
chat history
 
Yeah, I have some really big deadlines coming up, back 1-2 months I was here talking about stuff
 
maybe that's why I remembered you
I was confused only seeing a few posts from you so spaced out
 
Yeah I used to talk all the time :-)
 
carry on :p
sexy af
 
2:42 AM
though your right, it does feel bad not participating in helping others when I come here to ask my own questions :/
 
been looking at these nixie clocks so hard
@lix meh yeah I only looked because I thought your avatar looked familair
but I saw like today, April 11th, April 4th, March 31st
 
user6820627
@Loktar how to see a person's chat history?
 
you can only see like the last x messages
under profile and recent
bah so bored, need to find something to do
@Mosho you find anything to spend money on ever?
 
@Loktar Buy some awesome mugs :-)
 
oh me man, I want a nixie tube clock
or a sweet oscilloscope clock
 
user6820627
2:48 AM
@lix I am not surprised when you say that.
 
user6820627
You're so easily predictable.
 
oh? how so?
Whats wrong with liking nice mugs?
 
lol wth
mugs seemed super random to me idk
not predictable
 
well no idea where that came from
 
user6820627
 
user6820627
2:55 AM
@Loktar buy that ^
 
you can make those too @LearnHowToBeTransparent
there are kits for cell phones
never seen one in person but apparently they look badass yet are simple
 
That picture is from a video where they make it for a cellphone I think
pretty sure I saw it on facebook sometime
 
user6820627
I made it 2 years ago
 
sweet, was it from a cell phone also?
 
user6820627
yeah
 
3:01 AM
@LearnHowToBeTransparent is it pretty badass looking in person?
 
user6820627
@Loktar correct. it's not so cool
 
oh I meant is it awesome looking in person
badass === awesome
 
user6820627
i read it as bad.*
 
user6820627
You really need a high quality glass to make it, i used this so the image quality is low @Loktar
 
const bannedWords = ["a", "i", "the", "than", "but", "and", "of", "when", "he", "her"];

const testWords2 = ['Lady Gaga And Stevie Wonder Serenaded Elton John For His 70th Birthday','Make A Sundae And We\'ll Reveal What Year You\'ll Be Your Hottest','A Thing Called Hand Salad Is Making People So Mad','Is This A Real Place In Newfoundland Or Just A Cute Name We Made Up?','Manhattan Landlords Are Offering Massive Giveaways to Their Retail Clients','Mnuchin Asked to Review Process for Too Big to Fail Designation','Only People With Perfect Color Perception Can Pass This Test','How Bougie Is You
Heres my meh attempt
 
3:07 AM
@jake Looks good, though transparent beat you to the punch
 
I know 😉 but I hope its the most readable.
 
@jake it is a lot easier to read for sure :D
 
Reduce is my favorite thing about js
 
unsurprisingly trump is top of this list
 
Trump trumps all
 
3:10 AM
brexit isn't too far down the list xD
 
this from news sites I take it?
 
@Mosho [...counts].sort(([x, a], [y, b]) => b - a); blew my mind, didn't know you could do that with Maps. I have some code to go update 👍
 
@Loktar "fake news"
 
@KendallFrey some of that could have came from Infowars though
 
@Loktar I've created a website that links to lots of articles from around 20 or so sources at the moment
 
3:12 AM
tbh i have no idea what we're talking about
 
user6820627
45 mins ago, by Mosho
sucks to be you
 
 
user6820627
@lix what's that site?
 
3:13 AM
@loktar have you played nier
 
I made it @LearnHowToBeTransparent
 
@Loktar ...
 
@Mosho no few of my friends have it I ALMOST grabbed it
 
Not currently live anywhere but yeah it's something I've been working on
 
@jake i never knew a mouth could be so recognizable
 
3:14 AM
 
@KendallFrey lol ikr
I don't think many on the right take him too seriously
but I do enjoy a few of the others who work at the organization.
the fish people and transdimensional pedophile shit just cracks me up
 
like I'm watching the syfy channel
 
transdimensional pedophiles? do tell
 
user6820627
@lix my mother once asked me to make that
 
user6820627
3:15 AM
but i didnt
 
@KendallFrey lol it was a podcast with him and Joe Rogan
let me see if I can find it
 
@LearnHowToBeTransparent cool story
tbh it's probably been a massive waste of time, but I've learnt a lot about node from making it
 
though your array reduce algorithm works really well transparent, thanks for helping out :-)
 
> interdimensional vampire pedophiles
 
3:18 AM
@Loktar dw, Alex Jones is clearly the end of a game of telephone anyway, one more link won't hurt
OMG LOL
 
lol
 
@Loktar Can't mention the tinfoil man without linking this clip:
 
I've never heard so many buzzwords used wrong in 5 seconds
 
yeah I figured you'd enjoy it
he says the craziest shit man
 
!!afk (goblins)
 
3:21 AM
Just flat out wrong in at least ten different ways, one after the other
learn u sum fizzix alex
 
3:50 AM
@jake @LearnHowToBeTransparent @Loktar puu.sh/vsbnZ/238cbec447.png Here's the little graph I produced with the code you helped me with
 
@lix jake is afk: (goblins)
 
4:08 AM
Why isn't there a good js lib for data structures?
 
5:04 AM
postgres question: how do you usually handle index of deleted rows?
does it really matter or not?
 
Is it normal that if I don't type anything in a form input that the placeholder will be submitted?
 
alesana nope in my experience
placeholder is not value
also, form looks for name
 
Form looks for name?
 
attribute
 
Right
 
5:15 AM
then gets the value
 
For some reason the placeholder is being submitted
I even put value=""
 
you should have something changing the value
or submitting the value or something like that
 
Should as in it is probably what is happening or it is something I should implement?
 
are you using a <form>?
 
Yup
 
5:17 AM
with some plugin?
because probably is that plugin that is doing that stuff....
 
Yeah a couple
Hmm I will isolate it
 
gl
 
Thanks ^^
That seems like really counter-productive method for a plugin lol
So I have another question, I have my JS load after my DOM is loaded and in my JS I prevent form submissions to submit them through jQuery, the problem is that if someone submits a form before the JS is done loading it tries to submit it
Should I just put something at the top that prevents form submits on the body?
I guess my previous problem was jQuery doing that so I just clear placeholders on submit
 
 
4 hours later…
9:33 AM
@MadaraUchiha what part?
 
9:43 AM
@BenjaminGruenbaum Hiring a remote FE in india
 
@MadaraUchiha oh, it's not "happening", it's something we're trying out.
 
Yeah, no, I mean, when was the decision made
 
As an alternative to the outsource - since you Nitzan and Danny seem to think they're not doing a good job and I tend to trust you.
 
No one mentioned it on thursday when I was in office
 
Ah, the decision hasn't been "made", me and Gilad talked about the possibility late on Thursday.
(Late being ~9, not ~1)
 
9:50 AM
Fair enough
@BenjaminGruenbaum About the post-mortem thing on GitHub
Wouldn't it be possible to do something like
process.onUnhandledRejection(e => { throw e; });
And have it crash that way?
 
madara and benji work toghether?
 
@MadaraUchiha the thing is - you can't handle promise rejections synchronously
 
@towc Yup
@BenjaminGruenbaum Right, but you do have async stack traces
 
@MadaraUchiha but not core dumps - someone might have changed something in the heap in that microtick.
 
@BenjaminGruenbaum That seems like a massive edge case.
 
9:58 AM
var appState = {foo: 'x'};
Promise.resolve().then(() => {
  process.nextTick(() => appState.foo = 'y');
  if(appState.foo === 'x') throw new Error();
});
In this case, you'd get the wrong appState value when the handler runs.
 
@BenjaminGruenbaum Yeah, but no one in their right minds would actually do that
There are very few (if any) legitimate use cases...
 
@MadaraUchiha I agree, especially since it doesn't matter that much anyway - see github.com/nodejs/CTC/issues/12#issuecomment-296359004
 
@BenjaminGruenbaum Not to mention the feature is still opt-in... so companies that don't want it can just not use it...
Such bikeshedding around an already solved problem -_-
 
@MadaraUchiha yes, but it makes it harder for them to prevent people from using it
Although in all honesty the fix is to delete global.Promise if they don't want promises.
 
@BenjaminGruenbaum Why would they want to prevent people from using it?
Are they in an anti-Promise religion of something?
Cleanse the world of the heretics and so forth?
 
10:01 AM
@MadaraUchiha because then they can get core dumps
 
@BenjaminGruenbaum From whom?
If you need core dumps in your own company, enact a policy forbidding Promises in your own company
Why do you care if it's in core? Especially since it's in high demand?
 
@MadaraUchiha that's what they're doing - but they're claiming this PR makes it harder to do.
 
guys, will a user always disconnect from a node js server when he leaves the page?
 
I call BS
@RachelDockter Unless you're using web sockets, there's no persistent connection between the client and the server to begin with.
 
im using socket io
 
10:03 AM
Then yes, but not immediately.
 
@BenjaminGruenbaum You can write a 5 line ESLint rule that forbids the Promise constructor and util.promisify()
 
the problem is that it can also be in any package you're using
 
i need to make a website where users can come and host games on the homepage and then when someone joins it will put them on a page with the game. will they disconnect from the node js server when going to another page?
 
and added in any semver minor of that package since it's not really a breaking change for most people.
 
im not sure how i would work this
 
10:04 AM
And with util.promisify you can avoid the promise constructor or the word Promise altogether
 
@BenjaminGruenbaum How would that be different from libraries today using Bluebird to achieve the same effect?
I don't think there's a real risk here that wasn't there before.
 
@MadaraUchiha you can blacklist libraries that reference bluebird
I don't disagree, but I understand the backlash
 
@BenjaminGruenbaum You can also blacklist libraries that use util.promisify()
 
Of course you can
 
10:18 AM
@MadaraUchiha did uprising legend?
 
10:47 AM
@Neoares Not yet
 
11:15 AM
Hello, I am having some trouble with a module. I wish to define a function such that it cannot be invoked except for within the module. I am currently performing the following to add functions: var x = {}; x.foo = function (){};. I suppose there functions are somehow attributed to this variable. But I do not know how to make it such that I can define a private one.
Oh, I forgot one thing. At the end I return x;
The full format is: module.exports = function () { var x; x.foo = function(){}; return x; }
 
user6820627
11:50 AM
@lix There is a 80/20 rule inside.
 
Is anyone familiar with embedded javascript?
I've got an ejs file with a button. I'd like to ensure that if pressed, an event listener can respond and update some content on the webpage. However, I have no idea where I should do that. Am I supposed to encode in the embedded js file, or have it stored externally and a call made to it?
 
12:45 PM
fuuuuuuck es2015 was two years ago
WHAT HAPPENED
where have I been?
 
your mom's basement
 
how many things did sterling spill since then?
 
1:23 PM
Came across a good article: Creative usernames and Spotify account hijacking, or more tales in how Unicode is confusing and will fuck you over
 
@Zirak nice
 
user6820627
1:39 PM
@Zirak I thought Unicode is just an international encoding standard but now I know there is more.
 
hey guys, have any one worked on Chrome Extension Theme? I need a help. I have created a simple Exercise theme that has wallpaper and a setting page that allows user to customize settings like background opacity, and changing wallpaper. My question is suppose i want to change the appearance of setting page how can i make the new changes available to all users that are using my Theme in there browser??
 
2:00 PM
@WaseemAkram You update your theme
At the same place where you publish the theme to the web store you can update it
 
@Zirak Are you sure? if i make any new changes in the web store, those changes will be affected to all users browser that are using my theme??
 
@WaseemAkram When's the last time you updated a chrome extension?
 
I have not added my theme in web store, i want to know the theory if i want redesign the options/settings.html page then what should i do to make those new design affect to users who are using my theme.
 
You update your theme
 
if you have a function which contains: this.function1(){} and this.function2(){} how can this.function1 call this.function2, from within the class
the only way I can do it is by making one of the functions private, so the: this.function1, calls a privateFunction2
 
2:16 PM
It's very straightforward. What have you tried?
 
so in this.function1(){ i tried: this.function2(), also tried, function2() }
i can only make it work by removing the public, or (this dot) of the second function
Ok i made a paste, pastebin.com/nf7EvcgB
 
user6820627
@snowy500 So you need to define this.thing1 in a different way
 
user6820627
    this.thing1 = ()=>{
        // I want to call thing2 from here, but I cant
        // I can only call it if thing2 is private

        this.thing2(); // doesnt work
        thing2(); // only works if thing2 is private
    }
 
is there a name or something for doing that?
 
user6820627
Arrow function
 
2:24 PM
thanks
 
@snowy500 That code works fine
this.thing2() calls thing2
 
user6820627
@snowy500 Yeah, your code works fine. ^^ Maybe because your this.thing2 is empty?
 
3:05 PM
@LearnHowToBeTransparent Very true, it got even worse once I removed the adjectives lmao
 
3:35 PM
@lix nice man
 
3:50 PM
is there a good tool to visualize the connections between all functions, objects and classes in javascript? i need to get some overview :)
 
4:26 PM
I need some new metal
 
4:47 PM
Can someone please help me out with an embedded javascript file?
 
@Loktar you working on anything cool atm? :D
 
@Owatch ejs?
 
Yeah. I'm suddenly getting an error where it seems none of my variables are defined anymore after trying to render the file.
 
What's the exact error? Is this on the server or client?
 
Server.
Also. simple things like charAt no longer work
Which is very odd
 
4:54 PM
What did you change to suddenly get the error?
 
Ah wait no I see, it's yet another undefined. What I changed was moving a partial from being rendered in a larger file using include, to a standalone route where upon receiving a request, the partial is rendered individually and returned
There is only one variable used in the ejs I provided, called schedule
However, despite providing it in the new location, it still doesn't seem to recognize it
Hold on, let me show
 
it's a rootkit
common issue nowadays
happens when you inline your css
 
Those are the functions I am changing. I tried to keep it short.
Summary: I am trying to render schedule.ejs individually using the same data when rendering it through loggedIn.ejs and it unfortunately doesn't seem to recognize the variable schedule in the new version.
 
5:11 PM
Angular 2 has got to be the most complicated piece of software I have ever, ever worked with
 
Guys is there a way to concatonate two 32 bit integers into one 64 bit integer?
ah nevermind.
 
I'm a moron.
I was serializing the JSON before sending it back. Of course trying to render without parsing wouldn't work. FML
At least an hour on this
I deceived myself because the routing functions get their JSON already serialized to send back. I did not think it was serialized, and failed to notice that I was not serializing it there when sent (which would mean it was already done).
 
5:37 PM
Angular , reactjs, vue what should I pick >_<
 
5:51 PM
I've got a jQuery eventListener that overwrites a block of html containing the element it was listening to. Once I do this the buttons no longer works. I call the function to set the eventListeners again after the html is overwritten, but unfortunately the buttons still do not work. What do I do?
 
6:05 PM
I fixed it, stupid me used a wrong name, and jQuery seems to ignore errors or not log them visibly
Things do what I want - finally
 
6:16 PM
... or you could not actually use jquery at all, @Owatch, because it's not even useful these days
 
True. I dont use jQuery at all exept when a lib I use needs it
 
@WIPocket Welcome to the JavaScript chat! Please review the room rules. Pleasedon'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.
 
@lix nah
I've been a loser lately project wise
 
@tereško It's what I've got to work with since my classmates use it. What would you be using?
 
been in a project funk for like 2 years
I have one I need to finish but I put it off
 
6:23 PM
@Owatch native JS
 
 
1 hour later…
7:42 PM
A reactJS question. I have some component that is required to display some HTML that is returned by an API. Is using <span dangerouslySetInnerHTML={{__html: this.state.text}} /> the correct/best approach for doing that?
 
The best approach woould be to refactor your clearly terrible API to respond with data instead of markup, and then actually use React for what it's for, which is templating/markup.
But yes, if you can't do that because your requirements suck, then what you have is the only way
without going outside of React's workflow
 
7:57 PM
@GNi33 what wasn't cool?
 
00:00 - 20:0020:00 - 00:00

« first day (2380 days earlier)      last day (2571 days later) »