« first day (3323 days earlier)      last day (1608 days later) » 
00:00 - 19:0019:00 - 00:00

12:08 AM
@forresthopkinsa do you know c++?
 
practically, no
 
I need to access a native api in node. But the native api's are only offered in swift and objective - c. But node only accepts modules in C++. So i have to make a Objective - C C++ bridge and then make a module. Best part is I don't know the API, Objective - C, or C++.
 
I'd consider myself proficient in js, ts, c#, java, and kotlin; and I'd consider myself good-enough in python, dart, and PHP. But I wouldn't say I know any programming langs outside of those
hmmm that sounds like a nightmare
do the native APIs have a cli
 
Normally I'd be like "ah fuck it". But i want to sell my app so it needs to be good.
 
just spawn_process it if you can
 
12:12 AM
Unfortunately, not that i know of. There is a ObjC JS bridge but it isn't compiled and I don't think it would be great performance wise.
 
I've corresponded with that project author before
neat
yeah I don't think I'm any help to you here
 
Its a bit confusing because of how low level C++. Probably would be easier learning C++ first and then JS later.
Np. May take me a while but hopefully i'll get it.
 
12:16 AM
thanks :)
 
12:34 AM
hi
 
o/
 
I have this angular app that hosts child web-components
one of these child components is modifying the parent Angular app's location.href
screwing up the routing in the app
Is there any way I could add a guard in Angular Routes config to prevent unwanted location.href changes?
using @angular/router
 
 
2 hours later…
2:14 AM
we've been over this
 
2:26 AM
Would javascript still be usable if the only 2 selection methods were querySelector and querySelectorAll
 
You can select just about anything with those two methods. I only use them ever since rlemon yelled at me.
 
Its for a... "side project"
 
Whats the project?
 
Im pretty sure getElementById is pretty much required though right? because of cross-browser compat?
 
No. querySelector("#id")
 
2:30 AM
or are all browsers supporting Query and Queryall
Guess that article i read was outdated
well i know that
Its the same thing as Jquery's $() method
 
Fully support for past 10 years. I think you'll have bigger issues if you are trying to support that old of a browser. caniuse.com/#search=querySelector
 
oh, yeah forgot, the project is basically about trying to rewrite and shorten javascript using javascript
basically... Simplify it as much as flipping possible :P
 
...so the project is to write good code?
 
to see what people can know about Javascript, and notice problems, or useless/useful features
I guess?
 
everyone generally agrees that JS is way too bloated but there isn't anything to be done for it
 
2:32 AM
like, personally, I would shorten document.getElementById(): to getId();
 
if you remove deprecated functionality then half the internet breaks
 
and document.querySelector(); to query();
well, yes
 
sounds like you're remaking jquery
 
its a hypothetical project idea
but yeah its for beginners
to see if they can simplify it in their own way
 
heres poor mans jquery:
const $ = document.querySelector.bind(document);
const $$ = document.querySleectorAll.bind(document);
boom two lines
 
2:34 AM
Pretty much I guess
Also, Im created a side project off this project for personal use.
Ill start including it in my projects, to shorten and simplify my code as much as possible
sick of ugly large packs of document.getElementById
I know some people hate short code, but I have the urge to make everything... tiny... simple... and minimal at all costs
 
Just find and replace <document.getElementById("> with <document.querySelector("#>
 
I already have started doing that.
Basically, once Im finished with this project (Ive also written extra system methods thats ive always wanted in the code, but were never added... like .ran() for arrays)
 
@TaylorS People are fine with short code as long as its readable. People will usually take readability over anything even performance. If you are going for shortness, just use a minifierer.
 
Im going to host it on my webserver, and serve it to all my projects
Like, I know this sort of thing is so illegal, but when they dont add system methods that you want, it can be anoyying
Array.prototype.ran = function() {
 this[Math.floor(Math.random() * this.length)];
}
illegal in javascript standards :3
 
3:08 AM
@TaylorS Not sure what others think but I would suggest extending the Array class and then adding your own methods. That way you can create a new TaylorArray() and do what ever you want without overwriting prototypes.
 
As long as Im selecting an appropriate prototype that isnt overwriting a current one, no problemo
plus this is more for personal use/developement
codepen.io/SkylerSpark/pen/zYYbEyb - I created a few ones so far, its just stupid shit that I use a lot and need more easy access to.
 
what do you use bytes for?
 
Mostly for checking system performance with calculations
sometimes for working with File Streams
wanting to visualize my data sometimes in bytes :3
or bits
Trying to think of more javascript features that are repetitive and I hate them alot...
 
4:12 AM
If I make an api call which does not support pagination and this api returns a large number of user data which takes a quite little more time but in client side how to display a few data at least ?
 
 
2 hours later…
6:38 AM
guys anyone who can help me how to solve this issue of association in node.js
0
A: How to I insert an id of associated table into a database

Rohit DalalTry Bellow Code - Post will have many comments. Post Needs to be created first, in its association u need to send comments. models.Post.create( { ...postData, comments: { title: req.body.title, description: req.body.description...

 
7:03 AM
Hello. I am trying to split a string based on mathematical operators: repl.it/repls/RoundOrneryBlog
However, I don't get why I get undefined in the resulting array
Okay never mind I got it...
 
7:56 AM
welp, my job is done here
 
8:53 AM
Hello guys, how do i get a list of gas_stations in a certain country using google maps?
 
@codepreneur 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.
 
@towc Will you come and participate to the TWC6 ? It's started
 
@DenysSéguret I get non-programming related results when googling "TWC6".
 
Results like the ones you get when googling TS playground? (don't google that; NSFW)
 
@KarelG it's the Tribo World Cup, sixth edition, to which @towc registered (but I understood he might have connection issues)
 
9:02 AM
either some wooden crafting tools or hats
 
It's organized on Miaou
 
oh.
 
There's no hat involved, but there are badges
 
Badges? We don't need no stinking badges!
 
Dafak, Neil, I have more badges than you?
 
9:10 AM
@geisterfurz007 you seriously care about badges?
 
No but I still got more :D
The only thing I somewhat actively tried to get was the Fanatic one (100 days in a row).
 
after a while, they tend to be meaningless
just like reputation
 
After a while... Doesn't everything tend to be meaningless?
 
now you're talkin' my language
 
9:37 AM
whats up guys
 
@DeepankarSingh 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.
 
hi guys
is anyone der?
 
I know of no one by that name
 
@Neil R u alright ? Take a nap baby
 
Just answering your question
 
9:52 AM
Can anyone help me with async settimout functions?
 
@Thibaut 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.
 
@Thibaut sure, just ask your question
 
If you use async settimeout function with just sync code, the settimeout will run after the sync code. but if you have multiple settimeout function running some console.log, they will run synchronously, but shouldn't they wait for the first settimeout to be done?
I can show a picture if you need visuals
 
@Thibaut When the timeout happens, it gets queued with every other event
so the timeout happens asynchronously, and then the event callback gets called in order according to the event queue
it's the reason why if you do setTimeout(func, 0), it won't ever run it immediately but rather wait for execution of the current code to finish
 
but when u do setTimeout(func, 0) setTimeout(func, 0) setTimeout(func, 0), they will run sync?
 
10:04 AM
@Thibaut they all get queued up at the same time, and executed in the order in which they were queued up
it's not synchronous
but it can seem that way if the events coincide
 
so this shouldn't be happening?
 
It can happen.
 
oh wait i think i'm mistaken because i had a delay
 
I can't see that image
 
The event queue is not ordered. You both add callback1() and callback2() to the queue after each other. That does not mean they must be run in that exact order, I think.
 
10:07 AM
@DenysSéguret miaou is still not working in firefox :/
 
And callback 1 is called supposedly a second after callback 2 @Thibaut
 
@towc I have many users using Firefox
 
you'll have to count me out. It also turns out I'll be very busy for the next 2 weeks :/
 
@DenysSéguret uhm, that's curious
 
10:08 AM
hmm yea i think i'm getting it
 
@geisterfurz007 the trigger which adds them to the event queue is not in any particular order
but the event queue executes in order
 
I've shown you what I get when using firefox (even without extensions), right?
 
 function job(callback1, callback2) {
  setTimeout(() => { callback1(); }, 2000);
  setTimeout(() => {
    callback2();
    setTimeout(() => {
      callback2();
      setTimeout(() => {
        callback2();
      }, 1000);
    }, 1000);
  }, 1000);
}
 
@geisterfurz007 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 like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
if you simulate 10 clicks and then a page scroll event, it will execute any listeners in that order
 
10:09 AM
@JamesBot It's not my fault, mkay?
 
@geisterfurz007 mother of god
 
That's the code in the image.
@Neil Ah, dang it. I was spreading fake news again, sorry :/
 
Hi guys I have a problem with Imacro JS script. I need to remove comma , from mine extracted words pastebin.com/Fky7DsGj I get word1, word2, word3 and I need to get word1 word2 word3... Can someone help me with this?
 
@towc I think so... but I don't remember... I've been very very busy with FOSS projects and inteviewing those recent days
 
no worries, remind me to help you fix it after these 2 weeks (project ends wednesday, dec 4)
 
10:20 AM
 
10:31 AM
I need to add .remove(,) but I don't know where
Can someone help me with this?
 
probably somewhere in your code. Without that it's going to be hard to tell.
 
@geisterfurz007 You can see my code here pastebin.com/Fky7DsGj
 
Ok, now what do you want to remove where
 
I want to remove , from extracted text
I get word6, word7, word8 and want to be word6 word7 word8
 
'{{!EXTRACT}}'.replace(/,/g, '').split and so on
 
10:35 AM
Thank you. I will try
 
Hello
 
I tried your code but not work for me. My original text don't have comma, but with slice(6,30) I get what I want but with comma. Can I do that slice from 6 to 30 without coma?
@geisterfurz007 Sorry I didn't mention you
 
I guess after the slice(6, 30) you could add .map(word => word.replace(/,/g, '')) (and remove the previous replace one)
Just to make sure: The "," should not be used to split?
 
Yes I don't need "," comma
But for split I need to have one
 
ah ok
 
10:47 AM
@geisterfurz007 I get error SET !VAR1 EVAL("'{{!EXTRACT}}'.split(' ').slice(6,30).map(word => word.replace(/,/g, ' '))")
 
map(function(word) { return word.replace(/,/g, ''); }) maybe?
 
Is there an option to remove the highlight when you double click on an icon / text for specific div?
 
@geisterfurz007 I get error
 
nvm got it
 
I don't know what exactly you are running there (inside the eval). Best advice I can give you is to see how to replace characters in that and replace , with an empty string.
 
10:53 AM
@geisterfurz007 Thank you man for your help. I found .join(' ') and get what I want
SET !VAR1 EVAL("'{{!EXTRACT}}'.split(' ').slice(6,30).join(' ')")
 
Oh! Oh yeah, well we talked absolutely two different things then but that's ok :D
 
11:30 AM
._.
 
 
1 hour later…
12:49 PM
Is it generally ok to define methods within methods, so the inner methods can directly access the parameters from the outer method, without having to relay the parameters? Or is this really bad practise? Something like this:
function outer(c) { function inner() { c.log('blub');} inner(); } outer(console);
 
@Christian 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.
 
@Christian no, so long as you're doing it with some scope in mind
if you're doing it without a good reason, it just hurts readability
but other than that, nothing wrong with it
if this weren't possible, you wouldn't have classes in javascript
that's all classes are essentially
 
@Neil ok, thank you
 
1:43 PM
Hey anyone here know if your able to "take" the Javascript of a website, like All of its Javascript, compile it into a string, and return it?
Like... copy the Javascript of a site using Javascript
I already managed to extract all the Stylesheets of a page using JS, and same with HTML (harder then it seems, had to figure out how to get the doctype and shet)
 
I guess you can load a website into an iframe (or some other thingy where you can do dom lookups in). Get all script tags. If they contain a src attribute, request that script and keep it. If they don't and contain some content instead, take that.
You probably also want to go through all the events there are and do a querySelectorAll("[onevent]") for example to get all those as well (if you need them).
No clue how much you could miss with that approach but that would be my first attempt.
 
you could create a web crawler which loads a web page and then, in order, takes each javascript included in the page and each section, and combines it into a single file
though it would perhaps contain a lot of extra crap that you don't need like google analytics
 
Web Crawler? I think thatd be a bit too big for this
Well, Neil, this system variable thingy I was making yesterday, it now includes a pageData System Variable that can be used to save your page data
so far Ive wrote a CSS Compiler, HTML Compiler, and Im working on an Offline/versus Online Whole Website Saver
 
I mean you could just that manually
 
1:50 PM
if you had a single page, it wouldn't be that hard to do
but I would make a web crawler if I had to deal with more than 2 pages
 
Saving HTMl is easier then it seems, but was harder to find the answer to
  var a1 = document.documentElement.innerHTML;
  var b1 = new XMLSerializer().serializeToString(document.doctype);
  var c1 = b1+"\n<html>"+a1+"</html>";
  return c1;
Well, Neil, For my Online Saver, Im going to run the saveHTML Function, and then Im going to use the document location system variable to find the current HREF, and append it to a <base> tag
and place the base in the head dynamically
For the Offline Saver, im going to have to delete all occurances of stylesheets and scripts by default and compile them all together into an inline-style
Basically, im trying to make a small and dynamic PageData Exporter that fits well with Javascript's Default Style
Once Im finished with this "extra system variables and methods" api, Ill probably compile it and host it on CDN or something
 
Already parsed HTMl, that was the easiest of the Three
I got CSS working, now I just need to figure out how to grab all the Javascript Code and Files in the site
 
I am sticking to my script tag idea :D
 
Oh thats clever
I missed it
Well, I wont need the events in Tags
Only the Scripts in Script tags and <script src=""> tags
as for Images? Well, Getting CSS Compiled to a string for offline use was good enough work for me today, As for Images, Ill just append a "base" tag to the Offline Saver too, and place the base URL, so if you DO have wifi, it will retrieve the images
Oh... I just figured out I can extend base functions in JS
.... like extending the Math function to have even more Options...
Bruh
 
2:02 PM
You do the most bizarre things with html and javascript
 
This prototyping business seems so bad practice, but I want to keep using it, so much more fun options and abilities
Yes... yes I do
 
I mean not entirely a bad thing
it certainly teaches you things that's for sure
 
For the longest time, I used <center> tags instead of text-align:center; display: inline-block;
And Marquees XD'
I think i once made a Racing Game out of Marquees using a random function generator with arrays
 
I repeat, you would have loved 90's web development :)
 
Holy... Hell... I still have it: codepen.io/SkylerSpark/pen/EBVyBr
Lol
 
2:04 PM
There is a thing that your tool is going to fail on though (and I have no clue how that would be solved properly). If a website is going to request external resources through XHR or Ajax, you won't be able to provide that.
 
lmao
I clicked the button a few times too many and now the timer randomly jumps around :D
 
Oh God...
70s internet
Yeah
my old way of making timers XD
I never updated it :P dont want to
It looks good as is
 
well 90s internet but yeah :P
 
90s yes... I dont understand Pre late 2000s
 
2:07 PM
The original Space Jam website is still up spacejam.com/archive/spacejam/movie/jam.htm
 
Lol... I just realised, my marquee racetrack actually has a HTML4.01 loose tag on it
in the doctype
I actually used to write doctypes manually :3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
Are you a masochist?
 
No, That project was just made like years ago
 
@Hypersapien that was considered good page design back then :D
 
Well, Nowadays, you just write <button> and chrome automatically generates a doctype, default inline styles, and a whole Doc template in the devtools
 
2:09 PM
Within the past 10 years I had to talk a client out of having us put a hit counter on their page.
 
Lol
 
@Hypersapien "but come on! It'll be sooo coooooooooooool!"
Did he ask for a guest signbook as well?
 
lol
 
Hello, does the $() of jQuery does the same thing as document.querySelector() ?
 
Yes
pretty much
 
2:10 PM
@Begueradj That's what $() calls assuming there exists a document.querySelector function
 
@Begueradj no
 
Jquery's $() is pretty much:

const $ = document.querySelector();
 
I was working for a company that did conferences and tech shows for government and military contractors. It was our web site but their event page on our site.
 
actually document.querySelectorAll if we want to be specific
 
soemeone mentioned it yesterday
 
2:11 PM
@TaylorS he's wrong
 
Please do not say no, @KarelG :)
 
It isnt then?
wierd
Well, personally... my idea of a JQuery function would be more like:
 
@Hypersapien perfect example of a client which should best leave that sort of thing to the professionals
 
Please explain or give us reference @KarelG
 
var $ = function(m) {
 return document.querySelector(m);
}
 
2:12 PM
Yeah. Tell me about it.
 
@Begueradj just look into the source code. It does many things
(look for jQuery.fn.init)
 
@TaylorS it does a bit more than this
 
I know
it has "special" features
but thats the basis of it
 
but yeah, essentially the same
 
the selection portion
 
2:13 PM
if it doesn't exist, it provides a polyfill
 
https://www.theworldsworstwebsiteever.com/ I see "TWWWE v2.0 Coming Soon"...

BRUH WHAT
 
Neil and TylorS are trying to save me :) But I like your notes, @Neil, actually I am searching for that
 
@KarelG tf.. where's the call to querySelectorAll?
 
it does not only accept css selectors, but also html strings, objects ect ...
 
2:15 PM
@TaylorS Go to the mistakes :D
 
Didnt someone say Jquery had a "querySelectorAll" called $$
 
jQuery itself is querySelectorAll, no?
 
I've been trying to avoid using jQuery lately
 
Firefox does provide $$ as shortcut though if it is not otherwise defined
 
jQuery was around before querySelectorAll existed, so maybe that's an older version of jQuery
 
2:16 PM
@TaylorS That was planned for long time already but there wasn't a new one until 2018 at least.
 
@Neil look for .find
they use that to find elements in the tree
in this situation, it is just root.find(selector)
 
@KarelG ah, and that's where it gets called I suppose
still, it's hot garbage. If all you're looking to do is to search the DOM, use document.querySelectorAll
 
ah, it tried to serve many things with one function
and cross-browser-y
 
It does a lot of checks that you don't need to be doing
It's clever, but it's also slower
 
like $('<span>hey</span>') gives you a jquery object with element
 
2:18 PM
It has to check that you're including a tag in the passed string for instance
so a regex check
 
@Neil AFAIK there are some short circuits around and some regex magic
but not a good example no. It worked for all browsers, of which is important
 
hot info :) thank you all, but I keep reading your notes :)
 
that's the one thing it did well
 
@geisterfurz007 it is a standard that you can use the id of an element as variable name
 
@Begueradj if you're just starting off with javascript, I would encourage you to stay away from jQuery until you've gotten a good handle of native javascript
 
2:20 PM
@KarelG ok yes, but what does that have to do with $$ and firefox? :D
 
that you don't need $$
 
you can do almost everything through jQuery, and therefore it means when you remove jQuery from the equation, you don't know how to do anything without it :P
 
If you don't want to type document.querySelectorAll you can very well use $$ because it is a lot shorter to type.
 
best to ensure that it does not get overriden
some client side libraries have $$ in it, but due of use var and not scoping their "library", it gets leaked to the global scope
 
If I want to look only for a specific DOM node, let's say <p>, is it fair to say $() is the same as document.querySelector() ?
 
2:23 PM
no
 
$() always returns a jQuery object
 
if it is document.querySelectorAll() then partially
 
what would be the fair equivalent to $() then ?
 
$(p) gives a collection of jQuery objects of all <p> in your document whereas document.querySelectorAll(p) gives you a nodelist of all <p> elements
 
That's fault of the library and not of firefox. It's clearly stated in the documentation of those shortcuts that they can be overriden by anything but if nothing else defines them, $ can be used as shortcut for document.querySelector, $$ can be used as document.querySelectorAll and others are there too but I keep forgetting them.
 
2:25 PM
you can replace $() with document.querySelectorAll() but the code that follows has to be modified anyways
 
@KarelG $('p') :)
 
😕
lel those stars
 
and if I have only one <p> in my document, is fair to say $('p') is equivalent to ducument.querySelector('p')
 
Ooooooooooooh shit Karel made a mistake! OOOOOOOOOOOH SHIT!
@Begueradj Still no for the same reasons above.
If you have only one <p> in your document you can say that the outcome of $('p')[0] should be the same as document.querySelector('p') (I think).
 
does someone know how to use foreverwith cross-envunder linux? Without it is working scl enable rh-nodejs10 "forever -m5 -o /home/dsi/logs/out.log -e /home/dsi/logs/err.log ./bin/www" but i don´t get it working with the npm module cross-env scl enable rh-nodejs10 "cross-env NODE_ENV=production forever -m5 -o /home/dsi/logs/out.log -e /home/dsi/logs/err.log ./bin/www" Does anyone have an idea?
 
2:30 PM
@geisterfurz007 yep
 
@Begueradj I don't think stars should be used as upvotes in chat :)
Actually $('p')[0] and document.querySelector('p') should always be equivalent, not just if there is one element.
 
jQuery acts like a composite in that it represents 0 or more results
whereas document.querySelector returns a single item (the first found?) and document.querySelectorAll returns an array
generally speaking, use querySelector unless you think there may be more than one
 
@TaylorS jQuery implicitly selects all matches. It then decides to iterate or only use the first match depending on the method you call. My example from before was "cheap mans jquery" because js has evolved to do just about everything jQuery does well with the exception of short selector methods so I simply shortcutted querySelector and querSelectorAll with $ and $$, respectively.
@TaylorS just bind it. document.querySelector.bind(document)
 
2:48 PM
67
A: How can you weaponize a thermos

WillkFill it with ice cream. That will make it heavier. Also when you are done fighting you can eat the ice cream, and you will probably feel like ice cream about then.

That is not how any of this works :D
 
@geisterfurz007 got an upvote from me
I mean really.. when are you not going to want ice cream?
 
I love the idea of someone reading the question and their only thought is "Ice cream!"
 
you know was on their brain
 
Never used .bind()
doesnt it... like... attach the said function to a variable
No idea :P
 
Pretty much yes. With bind you can set this in a function (if I understood that stuff correctly).
omg I have to dig up that this talk with Madara in java!
 
2:56 PM
this is supposed to be a confusing operator
Javascript documentation on one site called it... "Unusual"
It really isnt though
it represents a future variable that doesnt exist yet
 
No variable exists at the time you write the code, really.
 
Pretty much
I like the this operator becuase of that feature
you can make dynamic Methods... rather than Functions with arguments
 
Checks out.
 
Well, Cya guys, going to go take a certification test in IT class
its gunna add a sweet IT Certified report to my record/resume
 
Good luck!
 
3:08 PM
Hopefully lol
 
3:57 PM
i had one of those once
 
4:52 PM
Im back, I actually barely got started with the test
it was like 75 questions
Ill continue it tomorrow hopefully after I present my lego robot to school IT staff
I made a claw arm that picks up blocks, places them, and also organizes, stacks, pushes them too
just a fun little project
 
 
1 hour later…
6:02 PM
whats the best way to get a gravatar link from an email?
import some md5 lib?
 
use jquery
 
lol
is there smth better than gravatar
resolution is so bad
ah ill make do
 
6:48 PM
any advantage to using object-fit: fill when I am stretching an image to fill a container? (width / height 100%)
 
6:58 PM
if you attach event handlers to a jsx element why is the resultant html a button with no onclick attribute?
 
@Spencer 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.
 
00:00 - 19:0019:00 - 00:00

« first day (3323 days earlier)      last day (1608 days later) »