« first day (2286 days earlier)      last day (2663 days later) » 

10:00 PM
@Luggage Did you fall asleep on your neck?
 
!!afk 🏢 ➡️ 🚗 ➡️ 🏠
 
No, but the current theory is neck related. Chiari Malformation. My brain pokes out of my skull a bit, crowding the opening and putting pressure on it.
 
user2620028
look at this guy, bragging about the size of his brain
 
:)
 
are games sfw?
 
10:02 PM
@towc not always
 
are you a game developer?
 
@Luggage Me, or @towc?
 
towc.
 
 
10:04 PM
oh, in that sense. I think thats SFW.
unless you zoom in on the text
 
@rlemon are u there?
 
@neoDev rlemon is afk: 🏢 ➡️ 🚗 ➡️ 🏠
 
!!slidepoop
 
can someone make an example of advantages of being able to require('modules') in the browser?
 
Does a bot post SO javascript questions here? I thought i remembered one doing that, but I'm not sure
 
10:16 PM
nope
 
@KevinB oh
 
Feeds can do that, but... it's not
 
Well in that case
0
Q: How can you call the variable name instead of its value?

TrojanByAccidentSo, say I have the code let foo1 = 1, foo2 = 2, foo3 = 3, foo4 = 4, bar = []; Is it possible to write a function that will take the name of a variable, and then allow me to push that to bar, or would the variable's value always get called instead of the name? If it is always the value getting...

 
@TrojanByAccident it is interesting to me
I'm sorry but atm I can't help you
I have no idea
 
that's alright
 
10:18 PM
the value is always what is passed. you can't get the variable name from the value.
 
e.e why did someone downvote though
 
if that's what you're asking
 
I hate when people downvote a question and don't even post a comment saying why
especially when it's a decent question
 
you... can't judge that as being the asker
not objectively at least
 
fair enough
but it's not subjective
doesn't appear to be a duplicate
 
10:19 PM
Anyone knows how to correct my plugins folder to normal in my repo https://github.com/FridaySuite/friday-suite

I think it has become submodule
 
and it's pretty clear, imo
 
it does look like you haven't done any searching at all though
 
to me it's somewhat unclear
do you want to know, how to get the variable name that some value that you have is stored in? or... what
and if that's what you want... that's obviously not possible if you think about it
said value could be in any variable
 
@david I did search, however everything I found was in other programming languages
which, while interesting, doesn't really help me
 
did you include 'javascript' in your search terms? :P
 
10:23 PM
@david shh, let me persuade myself that I'm smart
 
user6438653
How can this be simplified and sped up? jsbin.com/seviziwuju/edit?js
 
@WATERYMEL0N you might ask codereview :P
 
and depending on the type of value (simple vs object) the problem is simplified in that simple values are copied, not passed by reference. So your value of 5 or whatever in your bar array isn't the same value that is in the original variable
there's no link left to it to find
 
@TrojanByAccident why do you need that at the moment?
 
user6438653
@TrojanByAccident Okay :)
 
10:25 PM
@neoDev a project I'm working on
 
why exactly do you need it?
 
I'm not sure how to explain it
 
try :)
it may be useful for us
 
@WATERYMEL0N That's already a fast and simple algorithm for square roots. The things I think of are microoptimizations like * 0.5 instead of / 2
 
user2620028
Could anyone explain to me what i am doing wrong here? https://jsfiddle.net/hatterismad/a7mx0s9q/
The idea being to push the footer to the bottom of the page on the browser resize. I cut it down to the minimal code to reproduce.
 
10:28 PM
@neoDev well, I want to use it for an interpreter I'm writing
 
@rlemon Nah
 
@Abhishrek rlemon is afk: 🏢 ➡️ 🚗 ➡️ 🏠
 
@CapricaSix how did you do that?
 
@TrojanByAccident she's a bot
 
do what? 🚗 🏠 ?
 
10:29 PM
:pooooooop:
 
@KevinB yeah
 
i typed :car: and :home:
and pressed space after
 
💩
 
:car:
 
10:30 PM
:sun:
 
that doesn't work
 
Oh :P I'm on a mac
 
oh, it's not a mac problem
😋
 
🖖🏻
But mac has a better solution ;)
 
10:31 PM
i see boxes
 
😀
And that one?
 
another box
 
Perfect
 
🚽
 
10:32 PM
same
 
I see a shitter
 
@Luggage Did you get an MRI or EKG yet? This happened to me over the course of 2016. tl;dr bad news. Just wait until you get prescribed a drug that your insurance denies.
 
that one showed
 
I am pretty sure the Mac input will only work on a browser with real emoji support
so derp
 
it woudl probably work at home
this pc is win7, half the emoji's don't work here
 
10:34 PM
His first two don't show on Android
 
hi
 
hi
 
hi
 
🆙
why is there an up but not a down
 
10:36 PM
There is up_arrow and down
I think
 
:up_arrow:
 
🔽
 
If I created a method that calls an Ajax GET with setInterval from componentDidMount event. Is that a suitable approach to poll the backend? Or can you see any reason why that might not work?
 
Arrow_up maybe
I'm on mobile or I'd look
 
⬆️
 
10:37 PM
@BrianJ if your server is off
 
heh heh
 
Repoll on complete, instead of in an interval
Probably
 
well I don't want to poll after each sucessfull GET..more like every 10 minutes when data is refreshed server side
 
Translating Bash to PHP is tedious
 
user6438653
@KendallFrey Okay, cool.
 
10:41 PM
eh I'll test it tomorrow
O/
 
user6438653
sorry bout that large message.
 
"That seems like an unrealistic goal." <-
What if t is negative ?
What if t is NaN
 
@BrianJ you could also look into long polling if you want to advance your skillset
and eventually move to websockets
 
what if t is infinity?
 
10:46 PM
by which point you'd actually have your renders triggered by real updates to your backend, rather than the component kinda controlling its own re-rendering
 
user6438653
@KarmaDoe I'll test that.
 
@WATERYMEL0N why are you trying to speed up sqrt?
 
user6438653
Hey @AndrewLi!
 
10:47 PM
that seems like the wrong thing to focus on if you're trying to optimise your code
 
user6438653
@david Because I will be running it lots.
 
11 hours ago, by Kendall Frey
Stop wasting your time trying to solve problems that you haven't verified to exist.
 
@WATERYMEL0N then a better optimisation would be to run it less
 
@WATERYMEL0N one thing you can do is codegolf it
function s(t){r=t*0.5;for(i=10;i>-1;i--)r=(r+t/r)*0.5;return r}
 
@WATERYMEL0N you could just cache the results depending on your expected needs
 
10:49 PM
@david ok cool
 
although that's not shortest codegolf, as it would be shorter to do t/2 (although t*0.5 is faster, I believe)
@rlemon yes.com
 
@rlemon Advice may be invalid due to caching
 
user6438653
I am making a multiplayer game, but i need to work out the distance between the player and other players/objects, it is quite taxing to work out the distance that much.
 
((t)=>{r=t*0.5;for(i=10;i>-1;i--)r=(r+t/r)*0.5;return r}())
 
10:51 PM
compare the squares, not the roots
 
linear distance ?
or proyected distance ?
 
@TrojanByAccident If you're golfing, you probably want an entirely different algorithm
 
@rlemon is right. more often than not you can simply keep everything squared and it still works out
 
Not to mention completely never use the word 'function' in a golf'd solution
 
1 message moved to Trash can
@WATERYMEL0N Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
10:52 PM
Ctrl+K Melon
 
Cap, that's a bug
we should fix that
 
@SterlingArcher Yet you still use parentheses around the lambda variable
 
float Q_rsqrt( float number )
{
	long i;
	float x2, y;
	const float threehalfs = 1.5F;

	x2 = number * 0.5F;
	y  = number;
	i  = * ( long * ) &y;                       // evil floating point bit level hacking
	i  = 0x5f3759df - ( i >> 1 );               // what the fuck?
	y  = * ( float * ) &i;
	y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
//	y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed

	return y;
}
// Thats the first time I have seen "fuck" on Wikipedia
 
user6438653
var math = {
  distance: function (a, b) {
    var c = a.x - b.x,
        d = a.y - b.y;

    return Math.sqrt(c*c + d*d);
  },
};
 
user6438653
10:52 PM
I'm on mobile.
 
@jake that's inverse square root isn't it?
 
why do you need distance?
 
@jake I laughed a lot when I got to that comment
 
hit detection?
 
22 hours ago, by Sterling Archer
they thought I was retarded for a couple months
That's what happens when you add extra parentheses in code golf
 
10:53 PM
@WATERYMEL0N have you tried googling about collisions?
 
yes
 
user6438653
collisions?
 
user6438653
It's not about collisions.
 
user6438653
It's about finding the nearest objects and sending them to the player.
 
if you're just comparing distances you can more than likely keep the values squared and just account for that.
@WATERYMEL0N then you for sure don't need the sqrt, just compare the squares
 
user6438653
10:55 PM
Okay. Cool, thanks.
 
@rlemon is it a valid solution for any kind of shapes: circles, squares, polygons etc?
 
....
not sure if...
 
we cannot be. waterymelon didn't specify that
 
I did something similar with my game where the user is pinged if another player enters their range of hearing, and given a direction
Would that help sort of, @WATERYMEL0N?
 
user6438653
Yes, a ton!
 
user6438653
10:56 PM
@neoDev It's hexagons.
 
it should just require you to return the unwrapped value
 
user6438653
The player is a hexagon.
 
we assume you're talking about 2d, right?
 
user6438653
Yes.
 
10:56 PM
instead of return Math.sqrt(c*c + d*d); just return c*c + d*d;
 
the last 3 functions might be of most for you, getting the distance of players from an x,y coord grid
function getDistance(playerA, playerB) {
	const x = playerA.x - playerB.x;
	const y = playerA.y - playerB.y;
	const l = Math.sqrt((x * x) + (y * y));
	return {x, y, l};
}
 
user6438653
@SterlingArcher Thank you so much! xD
 
@SterlingArcher you are still calling sqrt
 
aka what lemon just said lol
 
we're trying to avoid that
 
10:57 PM
Oh
 
he doesn't need distance, he need to compare objects to see which is closest
 
user6438653
^^ yip.
 
csc θ * BC.y = H
you have no sqrt there
 
7 mins ago, by rlemon
compare the squares, not the roots
!!afk factorio
 
Yeah, then what lemon said. cc + dd
 
10:59 PM
@rlemon don't do it
don't burn out on factorio when 0.15 is soooo close
 
1 message moved to Trash can
@WATERYMEL0N Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 

« first day (2286 days earlier)      last day (2663 days later) »