« first day (1940 days earlier)      last day (3001 days later) » 
01:00 - 23:0023:00 - 00:00

1:04 AM
Thanks, @BadgerCat! ^_^
Now back to the party :D
 
1:26 AM
:D
 
1:41 AM
@phenomnomnominal we're listening to your music
 
ew creep
 
I'm still waiting for a cover of The Middle
 
haha oh yeah that's right
keep reminding me and I will eventually
 
2:22 AM
@phenomnomnominal you sing ? play ?
 
2:40 AM
@phenomnomnominal link !?
 
 
1 hour later…
3:48 AM
Just did my taxes, getting the biggest return I've ever gotten even with the health insurance penalty <333
 
4:11 AM
@SterlingArcher hah grats man
 
4:53 AM
This has to be the worst answer I've ever seen on an SE site...
 
5:13 AM
Hi
 
6:08 AM
Hi guys!
 
 
3 hours later…
8:56 AM
hi
 
@AbrarJahin Welcome to the JavaScript chat! Please review the room rules. Please don'task if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Sure, thanks
 
9:47 AM
hi
anyone here?
i just see 3 hours later
 
 
1 hour later…
10:57 AM
@Japa hi
 
11:50 AM
yes i am here
 
@MerijnvanWouden Welcome to the JavaScript chat! Please review the room rules. Please don'task if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
thx
at what times GMT is this room active
 
Anyone here with experience with phantomjs-webdriver?
 
Is there any way to find out if the client is behind an https breaking proxy server ?
^ they claim but I wonder
 
crl
1:40 PM
if (i===1)
  return doThis()
else if (i===2) // else is useless but is it ok to keep it or it's not clear?
  return doThat()
//...
 
[doThis, doThat][i - 1]();
just cuz
 
crl
hehe
the pureRenderMixin is kinda cool
 
How can I mix these?
$(document).on('click', '.textarea_tools > i', function(e) {
$("#qandatextarea").on('focus', function(e){
 
1:59 PM
you already did
 
@crl return i === 1 ? doThis() : doThat() makes semantic sense here too
 
@FlorianMargaine Mozilla refers to map/reduce/filter/etc as "pythonic sequence methods", interestingly enough
Going back to when we were talking about where js inherited those methods from
 
crl
ok towc, right
 
2:15 PM
Neat
 
@Hacktisch I hardly think so ..
 
It looks like Chakra implements the javascript "standard library" with c++
V8 and spider monkey just use javascript for that
 
maths/geometry thing: (not homework, dw)
There are 2 circles, whose centers are position vectors x1 and x2, their radii are r1 and r2, and the 2 tangents that they have in common and don't intersect between the centers, intersect at a point P. It's asking me to prove that the vector position for P is (r1*x2 - r2*x1)/(r1 - r2)
so, I started writing down how to find the equations for those tangents to intersect them, and it was getting more complicated than it should be. Looking at the hints it said that the proof follows from observing similar triangles
well, if you go from the center of the first circle, to P and to the intersection of L with the first circle you get a right triangle, same for the other one... but I'm not sure how that helps, although I assume that's what they wanted me to notice
wait, that means that I just need to find the intersection between L and the line that passes through the centers...
so that maybe helps a bit, but still not enough
 
2:34 PM
What's "dw"?
 
don't worry
 
Oh, I thought you were saying where it was from. Why would you possibly end up doing that not as homework? haha
 
training for the STEP exam to do computer science in cambridge (uk)
 
Ah, Homothetic centre
 
Anyone know of a good way to intercept SMTP emails with node? I don't want to be sending out actual emails during development.
 
2:48 PM
Its not perfect but saves almost all headache.
 
Is this article worth it or is he saying rubbish?
I just dont see what the advantages are of:
function generateGetMethod(attr) {
	return function() {
		return typeof this.getAttribute(attr) != 'undefined';
	};
}

var accessors = {
	sortable: {
		get: generateGetMethod('sortable')
	},
	droppable: {
		get: generateGetMethod('droppable')
	}
};
instead of simply doing 2 seperate function calls with different parameters
 
@Asperger That dude works on MDN
 
if I wanted to return a function within a functon I could just return the function as an object
return {fn: the function here}
 
I suppose his method ensures that all the functions are the same, aside from the attr.
 
@twiz ya but the only thing that changes here is the parameter passed
 
3:00 PM
Exactly. It ensures that nothing else can change.
 
function fn(attr) {
		return typeof this.getAttribute(attr) != 'undefined';
	};
fn('sortable') and fn('droppable')
its a working equivalent or not? I mean nothing changes in this function and far less code
 
get: function() {
	fuckUpEverything();
	return typeof this.getAttribute('sortable') != 'undefined';
}
You don't have the option of adding anything else into one of the gets if you use his method. Not saying its of particularly great benefit.
 
Writing an AimBot in javascript is trivial :-/
yikes!
 
@towc The thing is that the point P divides C1 and C2 in the ratio r1:r2 externally
 
As in... AIM... Is that still a thing?
 
3:05 PM
@twiz yes.
 
 
I just realized my game is like super easy to cheat in
 
@Abhishrek Is anyone not a bot?
 
all you have to do is somehow get access to the array of client positions (which in JS should be super easy)
 
ohhhh an AimBot hahaha
 
3:06 PM
and then override document.addEventListener('');
injecting the nearest enemy position gah
Any idea how to prevent this server side ?
 
@Abhishrek give them an array of pre-drawn pixels :P
which will be slow af
 
@towc streaming a video will not be a good option at all
 
send them some false client positions with an empty sprite
 
I thought of using a Mouse Lock
and then having them aim the hard as fuck way :D
 
@Abhishrek it's the browser, can be overwritten
 
3:12 PM
@towc the client sends MOUSE_UP/DOWN/LEFT/RIGHT
 
you can still easily cheat ;)
just not as easily as before
 
@towc ofcourse you can cheat x)
making a completely cheat free client is practically impossible
especially in a browser
 
use projectiles
 
@littlepootis projectiles ?
Oh you mean allow enemies to dodge ?
 
3:21 PM
@littlepootis its hard to aim anyways, thanks!
(You collaborate with a pilot.)
 
hi guys
anyone here with experience with firebase
and github login
I have that auth.uid seems to be the same as auth.github.id
which seemed strange to me
 
3:57 PM
any more elegant way to write this?
function construct() {
    this.hello = 'cool';
}
construct.prototype.name = function() {
    console.log(this.hello)
};

var x = new construct();

x.name();
Im trying to avoid having to create a new object since I only need this once
 
new construct().name()
 
This is a jquery code, what is its equivalent in pure-JS ?
post($(this));
 
post(this)
 
Actually this ^ doesn't work, Maybe the problem is another thing .. anyway ok tnx
 
@YamiMedina Welcome to the JavaScript chat! Please review the room rules. Please don'task if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
1 message moved to Trash can
@YamiMedina Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
4:10 PM
Sorry, I didn't know the code formatting worked in chat
 
1 message moved to Trash can
@YamiMedina Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
if I want to hide a particular button with the id "hideshow" on mobile and tablets, what should I do? Another SO post suggested this but it isn't working for some reason (I have jQuery loaded):
jQuery(document).ready(function(){
        var isMobile = window.matchMedia("only screen and (max-width: 760px)");
        if (isMobile.matches) {
          // hide webcam button
        //   $("hideshow").hide();
            document.getElementById("hideshow").style.visibility = "none";
        }
    });
 
@Cerbrus happy birthday
2
 
Neither of those methods seemed to work for me...I also have another document.ready(function) in the same script file, would that make a difference?
222
A: What is the best way to detect a mobile device in jQuery?

Gonçalo PeresFor me small is beautiful so i'm using this technique: In CSS file: /* Smartphones ----------- */ @media only screen and (max-width: 760px) { #some-element { display: none; } } In jQuery/Javascript file: $( document ).ready(function() { var is_mobile = false; if( $('#some-...

 
5:02 PM
Guys, I need some help
Is there a sane way of taking input like:
foo = a
foo.bar = b
foo.baz = c
foo.bar.baz = d
And transform it into
`{foo: p("a", {bar: p("b", {baz: p("d")}), baz: p("c")})}`
(both input and output are strings)
Other than having a recursion nested inside a loop or two
 
var ar = Object.keys(foo);, u take all keys and use recursively function inside function
 
(Or even better yet, an implementation of something similar to that, it looks suspiciously close like a virtual DOM tree)
@machei Hmm?
 
Is everything fine if I have an identical classname and idname in the same html ?
 
@Shafizadeh Yes
 
tnx
 
5:10 PM
1 message moved to Trash can
@machei 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 gist.github.com, hastebin.com or pastie.org
 
@MadaraUchiha pastebin.com/UkpqijK0
 
perhaps take a look at JSON.stringify(obj)
 
@Hacktisch JSON doesn't have functions.
@machei I think you're making an assumption about how my input looks.
My input looks like this, in string form:
9 mins ago, by Madara Uchiha
foo = a
foo.bar = b
foo.baz = c
foo.bar.baz = d
I don't have an object, or anything close to that.
 
U can define property for these?
 
ah right, i see
thought that was you js obj
 
5:12 PM
Also, see that foo has both an object and subkeys
So it's not either a value or a subkey.
@Hacktisch I wish, that would have been too easy though :P
 
you should split lines, then for each line split between name and value, then build an object that way
in the end transform the object into the string you have
 
@Hacktisch How do you deal with the fact that an object can have both a value and sub keys?
{foo: "a" ...... ?} what happened to subkeys of foo like foo.bar?
It's actually the point of the p() function in the resulting output to resolve this. The end consumer will see an object like this:
foo() ==> "a"
foo.bar() ==> "b"
// etc
Functions can have properties, strings cannot.
 
1 message moved to Trash can
@Hacktisch 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 gist.github.com, hastebin.com or pastie.org
 
fixed font failed sorry
 
5:21 PM
@Hacktisch paste, CTRL+K, enter
 
message lost
this sucks
anyway what i said was: the object's 'own' value van be built as a subkey
 
{
  foo: {
    ownValue: 'a',
    bar: 'b',
    baz: {
      ownValue: 'c',
      smth: 'd'
    }
  }
}
 
which is always the same, for instance 'ownValue':'value'
wow thx
 
@Hacktisch And if I have
 
im new here
 
5:23 PM
foo = a
foo.ownValue = b
?
 
right so you gotta be sure this key will never be used
if that is possible
choose something unique
 
It's not. I have absolutely no promises about what inputs I get.
And starting to generate random values is just an ugly hack.
 
other option: create a new class with two variables:
1 ownValue
2 list of subNodes (consisting of the same object)
then you dont need an ugly hack
 
@Hacktisch That's probably a better solution
But then, how do you find the subkeys and insert them into the right places
 
Someone suggest me a good Sci Fi series ?
 
5:30 PM
0
Q: requestAnimationFrame not working with decimal numbers below 1

AspergerrequestAnimationFrame doesnt work with decimals for some reason. Usually when animating in canvas I can work with decimals but in the case of dom elements I fail. As you can see below, I am animating the left position of a single div which works for n > 1 but not n < 1 (0.1, 0.2 etc). Why is thi...

 
so on each line that you process you traverse down the root of your object structure and every time check if the node has subNode with key 'key', if not, create it and append it to the subNodes list. Continue doing this until you traverse down as far as you deep to go (so with foo.bar.baz) you need to traverse down three times
 
anyone noticed this?
 
@Asperger answered
 
@Mosho wow thanks, will check : )
 
Asperger: the problem is you are using parseInt, you need to use parseFloat
 
5:35 PM
I can only accept in 8 minutes : (
You are right because it rounds the numbers
By the way, is there a better way to animate some css px value than im doing now?
 
yes
 
Are you sure? You are not talking about the css transition method right?
 
one performance flaw with your code is that on every frame you parse the css 'left' string as a float, which is not a big operation but it is cleaner to have an intermediate variable X and then set that value as the object left
well css animation would be cleanest but i assume you can't use it
 
not so flexible
I like to create custom easings and stuff, thats why
 
what i was saying is to keep another variable separate and add and substract that variable, not every time get the position from the object
 
5:40 PM
I see
So you mean something like this jsfiddle.net/m1qzqvu8/2
 
btw with css you can do a lot with easings
yes better
 
But I cant do complex stuff without so many lines of css
like reverse animations, crazy easings etc.
state machines. There is the Animations Api but support is really bad.
 
right so what i usually do is i create the animations/transitions in javascript but then let it be run in css because css animations are much smoother because they are executed directly on the graphical card of the computer or smth
i hope i explained myself well enough
animating dom elements with javascript on every frame can result in jumpy animations
 
Yes except the part with creating the animations/transitions in javascript and letting it run in css. Sounds like a contradiction, but just because I dont know what you mean by that.
 
i will write it better;
 
5:45 PM
Thanks ; )
 
so for instance say an object needs to move to point 100,200 in a smooth way, in 2 seconds

i would first set css on the object using javascript: transition: transform 2000ms 'easing function here'

then wait (timeout) 5 milliseconds,

then add the next css: transform: translate3D(100px,200px,0)

if there needs to be another animation after it, then javascript waits 2 seconds and then do the other animation


if i have to do something like this i write a small library that handles this in a nice way
 
Thanks for the B-day wishes, guys :D
 
The only thing I cant do is create dynamic values for the css animations /transitions
 
why not
 
I would have to parse the css file somehow
 
5:50 PM
no man you can just change an object's css in javascript!
 
oh ya you are right
you mean with the object.style.x method?
 
yes
ps i just googled and found this might be handy for you visionmedia.github.io/move.js
 
and remember that animation a position goes smoothest by using css transform: translate instead of css position left and css top
 
thats true!
how big is the difference though?
 
5:55 PM
thanks for article, at first glance it contradicts my experience but i will check it
the differencecan be huge depending on browser
some browsers dont render subpixel left and top
so you object will be snapped to the pixel grid
 
Man thanks for reminding me of this benefit
I always used left and top...was a huge mistake
 
regardless of the conclusions from david walsh' article i realize something else, you cannot depend on the frame length in requestAnimationTimeframe (for instance in IE you get less frames per second) so it will be hard to animation from A to B in X seconds, that will be easier with the css method
 
@Hacktisch I thought so too
check this out
He is using the time object to get the results.
 
i did see smth like that before, it can be useful if you want a low framerate like 30 fps

however you will then have to lower your framerate to the maximum of the slowest browser that you are targeting
but it's possible you don't need much frames
 
I see globally installed module have this set up as the command:
@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\node_modules\webpack\bin\webpack.js" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  "%~dp0\node_modules\webpack\bin\webpack.js" %*
)
but mine only has:
"%~dp0\node_modules\refactor-module\build\program.js"   %*
what am I missing
 
6:06 PM
What is the best solution to determine screen size so I can hide a button using jQuery?
 
ps: don't know about performance of the date method compared to css, i would be interested
 
object.offsetWidth
@YamiMedina use offsetWidth to determine the width of your screen
 
see the back of the screen for the product code and google it to find the specs
it will give you diameter in inch
 
okay. i got window.matchMediafrom an SO question/answer, but that didn't seem to work before so i'll go with that
 
@YamiMedina offsetWidth
it will give you the exact width of the object you are targeting (div, body, html)
then you simply make a check if (object.offsetWidth < 1920) {button.style.display = "none"}
no need for jquery
 
6:14 PM
thanks
 
crl
6:37 PM
css media queries are good for that too
 
6:59 PM
1 message moved to Trash can
@Shiuyin Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
user1648409
test
 
user1648409
ah, that's formatted code
 
user1648409
`<script>
lastSubmissionData[<?=$mask->getId()?>] = <?=json_encode($lastSubmissionData)?>;
</script>`
 
user1648409
Hm...
 
by the way, does this exist?
 
7:01 PM
@Shiuyin Go to the Sandbox room to test things out.
 
<!=
less or not equal to
 
user1648409
<script>lastSubmissionData[<?=$mask->getId()?>] = <?=json_encode($lastSubmissionData)?>;</script>
 
user1648409
Better now?
 
crl
@Asperger this is some shitty php
inline php, in inline scripts (bad for caching)
 
user1648409
So: Whats the best practice for dealing with that inline js arrays while generating the site with php? How can i remove those <script> tags in my php generation but still end up with the fully filled data array in js?
 
user1648409
7:12 PM
I could move it to some ajax file, sure
 
user1648409
what about filling a lot of data-x attributes in DOM and then on document.ready() reading those attributes and writing them to the js array?
 
user1648409
whats the best way here?
 
crl
I don't know best pratices with php sorry
 
user1648409
PHP is just the language i am using to generate the html, that should be of no interest here. There should be a non-language-dependant best practice here?
 
crl
I'd avoid putting data in html personally
 
7:24 PM
indeed
it is very bad. Id avoid that as well
 
crl
not very bad, you can have a data-id, or some short things sometimes
 
user1648409
why is that bad?
 
user1648409
i went ahead and moved SOME inline js to data-X tags
 
user1648409
i just have stuff like data-fieldId="7" now
 
user1648409
data-maskId="9"
 
user1648409
7:27 PM
why should that be bad? my js will work with those and now my code is split up in logic, structure and layout etc.
 
user1648409
furthermore its official w3c standard
 
what's that chatting service you don't need a login for
 
crl
sure, but we do more js approaches here (with templating languages like react for example)
@CSᵠ life
 
nooo waaay
 
crl
unless you're mute
 
7:34 PM
@crl did you ever use penners easing formulas? jsfiddle.net/m1qzqvu8/4
Wonder if my implementation if correct
 
crl
no hehe, will check a bit later, I have some bugs
 
need any help?
 
crl
finishing the wysiwyg, in reactjs, will show you soon
 
nice, I gave up on my editor since it involves creating a compiler which is a bit too advanced for me
 
crl
7:48 PM
thats a shiton of modules
 
the package.json
only has like
32 or so
 
8:15 PM
can anyone spot the obvious mistake i'm doing here: jsfiddle.net/gdvyLykf
 
@DirtyPenguin Welcome to the JavaScript chat! Please review the room rules. Please don'task if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@DirtyPenguin Open the console! :-)
 
i created a basic button. Clicking the button should trigger some JS that displays an alert. But for somereason, I can't figure out what I'm doing wrong
@king
@KingMob I tried including jQuery in my local tests, but that seemed to result in the same issue... i'll try adding jQuery as a resource in the fiddle.
 
Aye.
 
dang, adding jQuery worked for the fiddle, now to go back and add the layers of complexity back on :)
thanks @kingmob
 
8:19 PM
dont use jquery
especially not for just simple events
 
@asperger the problem came from a much bigger example where jquery is used a lot. The fiddle is just me reducing it down to something simple for reproducing the problem
 
Oh I see
 
hmm, i tried again with a basic html file, but I can't get the alert to pop up
do you see anything obviously wrong here: pastebin.com/Fbruv7Dm
 
damn I give up jsfiddle.net/m1qzqvu8/5
I dont get why penners formula doesnt work. I have no idea what im doing wrong
 
user3119231
joo
 
8:41 PM
Should this question be deleted: stackoverflow.com/questions/35258798/…
or should I answer it myself?
 
user3119231
Just write a comment please answer this question
 
crl
@Asperger it's nice to do that, and improve yourself but be aware css transitions can do many things
!!define widget
 
8:56 PM
@crl [widget](http://en.wiktionary.org/wiki?curid=61103) A placeholder name for an unnamed, unspecified, or hypothetical manufactured good or product.
Suppose we have a widget factory that produces 100 units per year...
 
@DirtyPenguin yes
<script type="text/javscript">
 
user3119231
So if I set width of a div to 0 the text in it seems like to wrap at a point. Is it just overflow: hidden which I need to add?
 
user3119231
nope, this does not solve the problem.
 
user1596138
@KendallFrey Yeah, sort of a "do it or don't" philosophy when it comes to making stricter policies ;P
 
So, I'm trying to design a "lobby" right now, where you can select from a list of games waiting to start, and join the queue, or create a game and wait for players
 
9:04 PM
Guys any idea why this doesnt work?
 
Should I split "create" and "join" into 2 different pages?
 
0
Q: Using robert penners easing to animate dom elements

AspergerIm having some trouble understanding how this works. I have read the tutorial on robert penners website where the different parameters are explained: t: time b: start value c: change d: duration I have specified the values but it doesnt seem to work, why is that? I dont seem to get the elastic ...

Trying to learn how this works. Unfortunately it seems im doing something wrong. Someone commented that the values are static, thats why. I tried incrementing the "t parameter though" which didnt have any effect either
 
9:18 PM
@ssube are you here?
 
user4883426
Hi guys :) anyone know how i can do this: stackoverflow.com/questions/35214817/…
 
user4883426
my onerror() is not working for some reason
 
but when the file doesn't exist i get:

in which case i want to call an onerror() callback which i have created.
you're missing a line there
 
user4883426
thanks for letting me know @FlorianMargaine i fixed it
 
This elastic easing fails as well jsfiddle.net/m1qzqvu8/5
 
user3119231
9:25 PM
@Asperger just use css left attribute with transition: 1s left
 
user3119231
this do the job, aswell
 
@Maurice ya but im trying to understand how easings work. I know how to animate things
 
user4883426
can someone please help me with this question: stackoverflow.com/questions/35214817/…
 
I can even create my own simple easings but using penners easings is kind of new to me
 
user3119231
@Asperger just saying. there is ease transition aswell
 
9:26 PM
incrementing the "T" parameter doesnt do the job
@Maurice ya, It is a nice feature, I know. I appreciate your input : )
 
iterating game keys [ 'game-1', 'game-3', 'game-4', 'game-2', 'game-5' ]
yassss
 
From within a setTimeout callback function, can I somehow view the bindings of the outer scope that the callback captured via closure (using DevTools or something)?
 
10:22 PM
@ŠimeVidas In the debuger (Sources panel) you have a Scope section to the right
 
@Zirak Does that work even if your callback has no free variables?
 
It shows all of the function's scopes
 
Oh, interesting.
 
10:49 PM
@SterlingArcher why are they named that way?
 
@Zirak Hmm, just tested it. I can only see captured free variables in the closure, not the bindings of the entire enclosing lexical environment, which is what I expected tbh. I thought that's what @ŠimeVidas was asking for anyway.
 
@KingMob Could you elaborate? What did you expect to see and was disappointed?
Some things get optimised away, which is a common gotcha
 
01:00 - 23:0023:00 - 00:00

« first day (1940 days earlier)      last day (3001 days later) »