« first day (2759 days earlier)      last day (2413 days later) » 
02:00 - 17:0017:00 - 00:00

02:08
I’m killin me lol
 
1 hour later…
03:46
Parkway Drive is INSANE live. Best show I’ve ever been to!
user2620028
04:08
04:35
Can somebody let me understand difference between asynchronous loading of JS modules using AMD spec vs synchronous loading of modules using CommonJS spec?
How modules following AMD spec are loaded asynchronously?
04:49
so it's like saturday
did anybody go out and party?
05:26
Hi, I wish to parse an SVG file in JS (obviously), but I don't know how to load the file and get it's paths without displaying the file in the document itself
@DavidKamer I know that, NodeJS implements CommonJS specification(of module format). Does NodeJS also implement AMD specification(of module format)?
Raj
Raj
good morning everyone
can anyone suggest how to clear required validator in angular5 ractive forms
*reactive
@JacobSchneider To work with SVG, go thru some presentations from Curran
one and two
@overexchange uh, right
will get some structural idea on using SVG
05:32
@overexchange thanks for your time, but it seems relatively unrelated. and I do understand how SVG works and what it is.
0
Q: Modules - CommonJS Vs AMD

overexchangeCase 1: Following CommonJS specification, below are the modules(sum.js) var reduce = require("./reduce"); var add = require("./add"); function sum(list){ return reduce(list, add, 0); }; module.exports = sum; and main.js, var sum = require("./sum"); var numbers = [1, 2, 3]; var result =...

I want to get numbers from string id
var test = 'test-0-0-oitem_id';
test.replace(/[^0-9.]/g, "");
result : 00
i want : 0-0
05:56
try this
var test = 'test-0-0-oitem_id';
var matches = test.match(/([0-9]+)-([0-9]+)/g);
@debao84 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.
 
2 hours later…
08:06
0
Q: Is define() an asynchronous call?

overexchangeFollowing AMD specification, below are the client side modules sum.js, define(["./reduce", "./add"], function (reduce, add){ return function sum(list){ return reduce(list, add, 0); }; }); and main.js. define(["./sum"], function (sum) { var numbers = [1, 2, 3]; var resu...

09:01
I want to send  two params   with angularjs ajax to php page to insert later into mysql       db  Is this syntax correct
                $http.post('http://localhost/www/E/insertstore_api.php', {
                 Store_name: $scope.Store_name,
		    Store_image: $scope.Store_image,
                 })
09:32
Any idea how I'd get rid of the cast @MadaraUchiha ?
    if (this.lru.has(segmentNum)) {
      return this.lru.get(segmentNum) as Promise<Buffer>;
    }
Conditional type?
It needs to feed the type information that this.lru.has means that this.lru.get in the block will be of the correct Type, like TypeScript does for instanceof
09:48
I want to send angularjs parameters with ajax to php page to insert them in mysql should I use array or object to include params?
10:09
@BenjaminGruenbaum oh, like the foo is T syntax?
chat is sleeping
type Buffer = {};
const segmentNum: Promise<Buffer> = null;

function foo(): any {
    if (has(segmentNum)) {
        const buffer = get(segmentNum);
    }
}

function get <T> (x: T): T {
    return x;
}

function has <T> (x: T): x is T {
    return !!x;
}
buffer is inferred as Promise<Buffer>
or is that not what you mean?
What is the error with this syntax
var obj = { Store_name: $scope.Store_name, Store_image: $scope.Store_image}
10:28
Does anyone know a good tutorial / implementation for refreshing a JWT token in javascript?
@phenomnomnominal yeah
@phenomnomnominal I mean in foo, like:
one sec
const p = new Map<string, string>();

function foo() : string {
  if (p.has('kek')) {
    return p.get('k2k');
  }
  return 'hello'
}
This works because .get has a return type of string, though get can return undefined, if I set it to be strict then it won't infer
One sec I'll make a tsplayground
const p = new Map<string, string>();

let s: string = '';

if (p.has('foo')) {
  s = p.get('foo');
}
This is a compile errro
11:20
In related news, @Cereal is a robot
@Jhawins I remember you not liking the idea Peer5 utilizes users' upload without an explicit notification - do you think an opt-in popup would help?
twitch.tv/breakfasttv to see him lose his soul
that's not very welcoming
@Cereal why would a robot not be welcoming?
our bot welcomes every user
11:26
@BenjaminGruenbaum What is the type of this.lru?
Ah, the | undefined thing
Yeah, TypeScript can't infer that 'foo' definitely exists and forces you to acknowledge that, it can't do the check via .has() it's not that clever I'm afraid.
Your options are either to use the null assertion operator return this.lru.get(segmentNum)!;
Or to cache the value in advance, and do the existence check on that
const maybeValue = this.lru.get(segmentNum);
if (maybeValue) {
  // maybeValue can't be undefined here
}
11:47
@MadaraUchiha I wasn't asking for a solution, I was ranting about a feature I was missing.
It wasn't even a new problem, I ran into it before - I just meant it would be cool to solve it.
By the way, the way TS infers return types from option arguments in Node is also pretty nice.
(Though not surprising)
Good morning kids
Does someone knows if there's any js library out there that parses sass/scss to json and back from it, but all in the browser?
Is that even possible?
whadya mean scss to json? You mean to an AST?
Googling AST...
Abstract syntax tree?
@Frondor @Mosho would know for sure
But he's in Canada, so wait a few hours... or try to sneaky googling for it - nothing on the top of my head
That's a new term I can use for googlin... But yes, basically, all I want is to create an interface for working with variables and export either that JSON or AST back to SCSS
@BenjaminGruenbaum I'm on it, just got noticed by the "AST" term, maybe I can find something... All my google searches were constrained to JSON
11:56
The one person I know who finds that "cool" here is @Mosho and he also wrote libraries that do a lot of CSS parsing
Oh... Come on! It's cool indeed! :D
I'm still not sure what you mean by json. What's your end goal?
you get some scss/sass/whatever code, and then what?
Hey guys, I recently saw a login form template with a bear animation which closed its eyes when the user was entering password, has anyone seen it and have a link to it?
@Zirak then I conquer silicon valley
Get scss/sass input -> build interface with controls -> use the controls to modify the input -> build back to input format
@mega6382 I googled "login form bear" and found it
12:04
@Zirak really? Cause I've been googling that for an hour and couldn't found it.
that's creepy
@Frondor No, that is the one with the yeti. I am looking for a similar one but with a blue bear.
Still, that's creepy AF
oh
then I haven't seen that one
@Frondor Just looking around, there's an emscripten version of the SASS parser, so you can maybe be hardcore and use that
basically look around for "js sass parser"
12:08
Yeah, I found that one, that's the best one actually.. Most of the sass parsers I've found are outdated/unmaintained
github.com/gmac/sass-thematic looks pretty much like what I wanted, but I wouldn't rely on something with the last update happening in 2016
12:23
SASS is annoying AF to use 😒
Do you include scss in that?
Less?
The fact that you need to build a native module with node-gyp
And that if you upgrade your node too much it refuses to work
@Luggage Not as good a syntax imo
Ohh.. that. The build. Not scss itself.
12:26
Yeah
Node-sass hasn't been a problem for me mostly. I half remember there being an all-js alternative compiler.
I whish I could use node-sass in the browser. Why does it have to be a native module? Can it be written in pure js?
Not sure if that's up to date (what I was saying)
Im making a multiplayer game using node and socket.io. Should i put the heavy calulations of my game at a client making him a host of a game or should i put the heavy calculations at my server? what's the common way?
I don't care about cheating in it
Example of one "calculation"?
12:32
the game physics
checking colisions
The general approach is both, and be optimistic that the client isn't cheating.
both server and client
why both? isn't that unnessesary work?
links appriciated
I suggest you read more about it, there are specific guides and books about the very problem you're describing, there are many ways to solve it, and a lot of history behind it.
"multiplayer game" could be a first person shooter or poker, with very different needs.
12:35
If you want to make things right, you'll check the physics in the server, but don't wait for the client to know the results, so replicate them in the client as well. If the server finds something's wrong, then client must be noticed. But first you must solve something like "lag compensation" for that to work well.
Ohh you said physics.. so probably not poker :)
Unless...
Unless your UI looks like Hearthstone xD
12:47
that's a 10/10 UI
@Luggage Throwing the cards on the table in frustration involves physics
13:13
hello people
webpack looks weird to me
but i think i have an error that has to do with me touching a few things there
we're using Mithril js as frontend n Golang as backend
I'm writing a userscript for StackOverflow that has to detect when the user clicks "add a comment". I used a MutationObserver to do this, but since it's connected to document it triggers on every single mutation and actually freezes my browser when I open a question with many answers. Here's a minimal userscript that reproduces the problem.
As an attempt to work around this, I've postponed creating the MutationObserver until document.readyState changes to complete like so:
document.onreadystatechange = function(e){
    if (document.readyState === 'complete'){
        var observer_config = {childList: true, subtree: true};
        new MutationObserver(on_dom_mutation).observe(document, observer_config);
    }
};
But I'm wondering if
1) Can it happen that the user clicks "add a comment" *before* my MutationObserver is created?
2) Is there a better way to go about this?
@SomeGuy o_o
Apparently the original idea was to make a language where hello world took longer than compiling OpenOffice
13:31
nublets
@Aran-Fey document.addEventListener('click', ... ?
Also, there's an event for when the DOM is complete: DOMContentLoaded
i have a small question: like in <form> we have the action attribute that loads another page when the submit button is hit
can i use vanilla js(pure js) to check if the innerText of my inputs is the same with my declared var before allowing the page to load the next page?
you have two ways to go about that
you can use the form validation API, which if it fits, could be very good for you
Or you can do what it does manually: Bind a submit event handler to your form, do your checks, and if they don't match, preventDefault
13:45
no... no API's
It's part of the DOM
I'd never recommend external libraries :D
.innerText is part of an API. One provided by your browser.
13:46
did i check that? nah... thought it was just native
@Luggage I still shudder when I remember it's standard now
your 2nd choice @Zirak looks like a hack
ohh yea, you also don't want .innerText to check the value of Inputs. You want the value property.
wow...
why not innerText?
confuse here
@ConnelBLAZE in general whenever the question is "can you use vanilla JS?" for something the answer is "Yes". You should consider leveraging tools the browsers give you.
13:47
@ConnelBLAZE It's a bit weird, but that's how we did form validation before the API
@ConnelBLAZE innerText is a quirky textContent that looks at the text of an Element. That is - if you have a <span>Foo</span> the innerText of that <span> is Foo.
@ConnelBLAZE You get an input's value by doing inputElement.value
i'd look into the value property at MDN
@ConnelBLAZE .value is specifically for input elements and gets the value of them. The way to reason about it is the actual "tree" doesn't change. It's still the same DOM (unlike with textContent) but there is new data.
@ConnelBLAZE The good thing is - there are like... 6 things like this to remember and that's it.
@Zirak i don't quite get
13:50
neither do I
it's just me teaching myself js and don't want to learn frameworks yet
Good, nobody at any point in this conversation mentioned any framework
so i wanted to do like when using backend, lemme say to do login
yeah was just saying why i was asking
i just have 2 inputs, username n password. I have them declared in my script.js
@Zirak Neat idea, thanks. I'll play around with it. I'm actually trying to get my hands on the textarea that's created after the "add a comment" is clicked, and I'm not 100% sure how I can get there from a click event handler
i just want to do manual checking that's all
13:52
@ConnelBLAZE Attaching a submit handler and calling preventDefault is how you do manual checking, really
@Aran-Fey well, inside the event handler, you have evt.target which is what was actually clicked
You can check if that's the "add a comment" element
I'm guessing it'll have an indicative className or some other, similar attribute
hmmm... so if true i can load a page else reload the page
Yeah, but I need to access the textarea that's created by that click
@ConnelBLAZE nah, if it passes validation don't do anything; if it doesn't, preventDefault, that'll stop the form from submitting
@Aran-Fey hrm, that can be a bit more challenging
A cute solution could be to mix the two: When the button's clicked, add a mutation listener to some ancestor, and when you find your textarea remove it
okay let me do that now
I'll give it a whirl
14:03
@BenjaminGruenbaum Am not sure, how define() function is being resolved in that makefile build?
Because neither am using r.js or dojo implementation of AMD spec
Nor*
NH.
NH.
14:21
@FlorianMargaine keybase has its own problems such as uploading device-specific private keys. I'm not sure how carefully they audit any npm packages they use.
hrm I don't think this is going well
Everyone has 1 wish why?
14:37
7 mins ago, by Zirak
hrm I don't think this is going well
I wish I didn't have insomnia!
14:55
lol, I was curious about this user who has a gold badge in so I clicked through to his profile... turns out he is the creator. Makes sense now X-)
or at least his profile makes it sound that way, now it looks like he's not one of the founders though I'm sure he's contributed to it
15:26
@Zirak did you fix it?
@BenjaminGruenbaum yes, but sorting is too difficult
Once I have a few more (or just the one more) I'll throw it out here
15:39
@Zirak what are those wishes?
mentions of 'I wish.." in chat?
You'll see
okie :D
Be my santa please
only if you dress up like Ms Santa
@Frondor what do you mean by scss to json?
if you want an AST, postcss can probably do that
16:03
@Frondor told you ^
We released timeonsite-tracker recently to track time on site metrics for web analytics with some great features. What do you think we can improve in this web tracker saleemkce.github.io/timeonsite ?
@webblover 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.
@webblover First of all, cool
@webblover The font you use in the devtools
Second of all, make sure the license key in the picture is deactivated or otherwise invalid, or replace it with XXX-YYY-ZZZ...
16:10
@Zirak thanks.
Another suggestion is don't count time that the page isn't in the foreground
Your headers are a bit weird, like the blue text under the first one
What are you doing for users leaving the site without telling you? There are like 50 browser specific tricks.
And that chart...you transported me back to 2003
yes, the licence key is dummy.
16:12
The devtools text blew me away, gg
you mean, you like the devtools text??
yes
:)
"devtools text" is loaded with 6 different colors. Each time, it may show differently on page laod.
@webblover technically though it needs to record the time on the site better :D
Good luck with it :) (Assuming it's yours)
timeonsitetracker.js - its prime goal is to make accurate calculation of time on site/time on page and be greatly useful for web analytics.
16:19
It's actually a pretty complicated problem, you need to account for things like DST changes, inactive tabs, computers that were in "hibernate", pages that didn't actually load, users with extensions that mess up with time measurements etc.
Sounds interesting - what was the hardest so far?
@BenjaminGruenbaum I hope the current implementation is doing the job really great. Hope to optimize it and make it powerful. Yes, I agree with your list. I would say hibernate is highly complicated so far. Others addressed well.
"users with extensions that mess up with time measurements", I consider timeonsite tracker isolated. It doesn't mess with other extensions in browser.
Yes but other extensions can mess with it.
yea, I agree.
People will modify Date performance and everything else.
Also, when do you report a session has ended?
@webblover Comic Sans
16:24
Just open the browser and check in devtools: Tos.getTimeOnPage() you can see useful information.
When browser closes, we immediately track page close time.
@MadaraUchiha Do you suggest the font?
No, your logo is in Comic Sans
It's an atrocity.
yes, :)
@webblover yes but how? Detecting a page closed is done onloadend and at that point it's almost always too late.
@BenjaminGruenbaum yes, we can store the current time on page/site data in local storage/cookies. There is time only for this. You got it right!
I just realized it's open source - github.com/saleemkce/timeonsite
16:27
Further data manipulation at this point will block browser from closing or reload.
@webblover well, if you keep a websocket connection open it will report it on every browser close - you can report times incrementally (make requests) and there is a new kid on the block - lemme find it
you mean, we send periodic data to server by using socket?
That's one way, but a WebSocket always gets a disconnect event and you can always get the last message - that solves one problem (user navigating) but not another (the users' electrical power gets cut). In order to deal with the latter you'd need to periodically update the server and then you lose at most X data.
Instead of sending "how long the user was on the site" you'd send events. This is what our analytics platform at Peer5 does.
There's also a way to trick fetch to send the request even if the user has navigated away
You can send fetch with keepalive (this is what replaces the Beacon API you wanted btw @MadaraUchiha )
@BenjaminGruenbaum You mean <a ping=>?
Also, [citation needed]
@BenjaminGruenbaum that's really good suggestion.
16:33
@MadaraUchiha well, I just checked MDN and it literally says "Fetch with the keepalive flag is a replacement for the Navigator.sendBeacon() API." so there's that :D
Also, you can/should use Navigator.sendBeacon in older browsers by all means @webblover
@BenjaminGruenbaum Not IE though
We initially used Navigator.sendBeacon() for timeonsitetracker. But due to a bug in this API, posting JSON data is not possible or compatible in major browsers. Hope to use this API again soon.
Which means that it won't be quickly adopted by various ad companies and the such, which is where we really need it :(
It is really cool though, that's for sure.
@MadaraUchiha Yeah, fair point - though if we're being fair did I ever ping you with a new fetch feature and created the expectation it'd work everywhere out of the box?
16:36
The one I asked about years ago was ping= attribute for <a />
Which didn't manage to take off due to "It allows ad companies to spy on us!"
smh
@MadaraUchiha which does the same thing, mostly
@BenjaminGruenbaum Yeah, only declaratively and without a need for JS or logic of any kind
No code is best code.
@MadaraUchiha make it a web-component :D The DOM is a low level API
-_-
How are web-components these days?
Anything changed in the past 4 years or so?
It's stable and works mostly everywhere but no one cares afaik.
Everywhere - not on IE
16:38
Or is it the same half-baked spec with the same half-baked support?
@BenjaminGruenbaum Shadow DOM? Scoped CSS?
I love how Google for "are web components" completes to "are web components dead"
tl;dr web components are not really and do require polyfills (at least if you want real Firefox and Safari support)
@MadaraUchiha That's search history though :D
@BenjaminGruenbaum Only the first
Loving "is water wet" and "is this loss" XD
People wanna know if netflix is down more than they want to know if water is wet
16:41
Yeah
@Zirak no, they just search Google more often for it.
Maybe people who want to know if water is wet are just shy
Don't you ruin my narrative with logic
They almost fixed that one:
There's a lot of interesting work on how to unfuck machine learning algorithms due to real racism.
the pools with black?
@BenjaminGruenbaum :D
!!slidepoop
16:47
Mar 13 '13 at 1:40, by rlemon
(Random Fact, when rlemon was 13 he pooped on a slide. he isn't proud of it, but he felt it was time to confess. I'm sorry slide.)
@BenjaminGruenbaum I love that this is a thing. Much more than I should be :D
@MadaraUchiha I sort of hate that it's a thing - it means humans are shitty
It means that as a species - we suck
@BenjaminGruenbaum That's not really news though
@BenjaminGruenbaum In other shocking news, water is wet
16:48
@Zirak you just saved me a very embarrassing google search mister.
You're welcome
Humans aren't "garbage", we're shitty in a very special way.
@MadaraUchiha ahahahhahhaha
JS chatroom is the best
lol
maybe humans are savage
i should know, i used to creep in the c# room
16:50
@BenjaminGruenbaum Do you take things with that very special way and put them in trash bags and discard them in special trash cans?
and they are so uptight about posting non-c# related stuff
after all whe he first said the "earth is round" they burnt him
@Traitor so do what they ask and don't post non-C# related stuff :D It's entirely fine to have a room culture that stays on topic
@Zirak not really, no :D
yup, that's why i no longer creep there
why is it so hard to sort things in julia
16:51
Anyway, off to finally watch the new avengers
haha you still havent seen it
it's great!
meanwhile @Zirak i tried using the preventDefault() but...
@BenjaminGruenbaum Good luck!~
I already went twice :D
@BenjaminGruenbaum everybody died
i want to see the living tribunal on the next one
or atleast eternity
16:52
maybe when you're done we could talk about it tomorrow
we have 1 yr to wat
wait*
No spoilers fellas.
anyone not exited about the next star wars
like, im gona watch it but i feel shitty about it :/
haha...
im not even a star wars fan anymore with these movies just fucking it up so much
what's up with DC?
16:53
@ConnelBLAZE I said, no spoilers please.
Not even implicit ones.
they hire directors taht are good at making gritty movies
that wasn't a spoiler
thats why DC is struggling
that's actually what's going to happen
marvel, on the other hand, hires directors that want to give you a 'comic' book hero feel
and it works!
16:54
nope DC is better i don't just know what happened
Marvel graphics are Marvel-lous
we can disagree, just that DC's gritty take on comics isnt working yet
Marvel somehow manages to balance well the "I've read that comic!" audience as well as the casual and not-so casual audiences.
yeah they do
DC just tries to impose their own artistic decisions on the characters and story, but don't really cater well to any of the audiences of a comic-based superhero movie.
In 10 yrs Marvel cinematic universe has grown well
16:56
i liked the wonder woman movie
out of all the dc movies
it felt so genuine
<3 gal
that's the best DC or maybe one of the best
Batman has been on point
i think Batman movies has been the best in DC then wonder woman just came n baby sit all of em
christopher nolan batman movies + wonder woman
forgot about batman ><
how would you?
you need to pay a fine
16:57
yea..
"I AM BATMAN"
i want to see azrael vs bane
DC make it now!!!
haha... suicide squad vs Batman or maybe Dead shot
@Zirak are you still here to look through what i came up with?
02:00 - 17:0017:00 - 00:00

« first day (2759 days earlier)      last day (2413 days later) »