« first day (2029 days earlier)      last day (2926 days later) » 

user2620028
@shmiddty ban malz every game for the love of all that is holy
 
12:53 AM
hello :)
should I compare objects with "===" or "=="?
 
It depends on what you are trying to do.
 
@thepiercingarrow I have the same object instance stored in two arrays
 
Then you should use neither
 
and want to know if these are equal
 
you have to compare properties
 
12:57 AM
You have to compare each individual element
For example:
for var i in array1:
 
Object.keys(obj1)
please
 
if (array1[i] != array2[2]) return 0
 return 1
a few typos, but you get the idea
 
@thepiercingarrow I know I have to compare the objects individually. The question is, should I use "===" or "=="?
if (array1[i] != array2[2]) return 0
or
if (array1[i] !== array2[2]) return 0
 
function same(a,b) {
  return Object.keys(a).every(key => a[key] === b[key]);
}
 
Oops sorry didn't see your post
use ===
 
1:00 AM
ok, good
 
The difference is type
 
@rlemon I want to compare the pointers, not the keys
 
then they are arrays not objects
 
"5" == 5 is true
but "5" === 5 is false
@rlemon no, arrays are objects
 
for the purpose of this discussion they are not
 
1:02 AM
@rlemon they are just special objects
 
objects are not ordered keys, arrays in js are iterable
 
@rlemon everything in js is an object
 
yes, if you want to be pedantic. but that leads to a completely different solution (arrays vs objects)
so using the more proper term would have helped
all I'm saying
 
okay then. I know you're probably better than me at javascript o.O
Are you familiar with C/C++ ?
 
well it isn't about that.
 
1:03 AM
idk I just have that impression of you
 
I was just pointing out that my solution was specific for objects
 
@rlemon yeah, i agree.
 
Guys how can I possibly create a function that allows me to add new properties?
 
arrays are different
 
function getElement(name) {
obj.name = document.getElementsByTagName(name);
}
 
1:04 AM
@Asperger you mean like middleware?
 
middlware?
 
@Asperger properties of what?
 
lets say i have an object like: var obj = {};
 
Like if foo() is a function, then there is also foo.bar()
 
pass the object.
or bind it to the function
 
1:05 AM
and I want to add var obj = {x: hello}
 
function addProp(obj, name, val) { obj[name] = val }
 
ya I know how to pass it: obj.x = "hello"
 
pass the object pointer into the function, then the function can edit it directly
 
but what if I want to pass in a string to the function so that the x part can be anything i type in
 
function foo() {
	this.x = 123;
}
const obj = {};
foo = foo.bind(obj);
console.log(obj); // {}
foo();
console.log(obj); // {x:123}
 
1:06 AM
@thepiercingarrow im not sure how to do that.
 
or maybe simply
 
Oh i see
 
var foo = {};
function bar(foo) {
 
2 mins ago, by Christoph Bühler
function addProp(obj, name, val) { obj[name] = val }
is the other idea
 
foo.x = prompt("");
 
1:07 AM
function foo(obj, key, val) {
  obj[key] = val;
}
 
}
bar(foo);
 
this is what ive tried jsfiddle.net/xvw0od2t
 
Sorry I can't do new line because I am using ipad
 
oh crap
 
You can't have a var and function with same name
 
1:09 AM
so I can use square bracket notation too for adding new stuff?
 
because functions are basically variables
 
var foo = {};
foo.setName = function(name) {
	this.name = name;
}
foo.getName = function() {
  return this.name;
}
foo.setName('rlemon');
console.log(foo.getName()); // rlemon
there are really so many different ways to do this
 
im such a fool
I keep using the dot notation that I always forget that the square bracket notation is available
 
Look at that
I just made it
 
Ya, though the name is still name
if you console log it. But change it to foo[name]
it will work : )
 
1:12 AM
4 mins ago, by rlemon
2 mins ago, by Christoph Bühler
function addProp(obj, name, val) { obj[name] = val }
5 mins ago, by rlemon
is the other idea
4 mins ago, by rlemon
function foo(obj, key, val) {
  obj[key] = val;
}
 
ya thats the only way
 
function foo(obj, key, val) {
  obj[key] = val;
}

var something = {}
foo(something, 'poop', 'no thanks');
console.log(something);
 
lol poop?
 
1:15 AM
Mar 23 at 17:37, by rlemon
@SterlingArcher I've decided that Foo and Bar are getting old. Poop and notPoop are much better
 
lol I kind of agree. Creative!
Do you know Java rlemon?
 
limited
worked with it, more so just piggy backed off knowing c#
which I also haven't worked with for ages now
JS is life
 
Hm.. I'm trying to implement clones in my scratch parody
 
I kind of love Java with JavaFX. Man you can even design your java applications with CSS
Ive read the CSS4 spec by the way. Awesome stuff
 
node + electron or nwjs and I'm pretty much set
 
1:19 AM
Thats true. Javascript evolved from being a toy to serious competition
 
nightmare rox!!
 
Brainfuck rocks :D
Brainfuck is an esoteric programming language created in 1993 by Urban Müller, and notable for its extreme minimalism. The language consists of only eight simple commands and an instruction pointer. While it is fully Turing-complete, it is not intended for practical use, but to challenge and amuse programmers. The language's name is a reference to the slang term "brain fuck", which refers to things so complicated or unusual that they exceed the limits of one's understanding. == History == In 1992, Urban Müller, a Swiss physics student, took over a small online archive for Amiga software. ...
 
try
Malbolge is a public domain esoteric programming language invented by Ben Olmstead in 1998, named after the eighth circle of hell in Dante's Inferno, the Malebolge. Malbolge was specifically designed to be almost impossible to use, via a counter-intuitive 'crazy operation', base-three arithmetic and self-altering code. It builds on the difficulty of earlier, challenging esolangs (such as Brainfuck and Befunge), but takes this aspect to the extreme, playing on the entangled histories of computer science and encryption. Weaknesses in the design have been found that make it possible (though still...
 
I wonder if anyone would dare and try it
 
brainfuck is sane
I wouldn't enjoy it, but it is sane
 
1:22 AM
Holy carp
Malborge, never read or heard about it
 
I always thought this was amusing
> The first version of the quine (it is the first quine in Malbolge ever) has been released at December 3rd, 2012. This are about 14 years after the release of Malbolge.
it took 14 years to figure out how to do this
:P
 
this is crazy man
HeLL IDE lol
 
there really are a lot of fun eso langs
100
A: 99 Bottles Of Beer

TimwiFunciton I wrote this just the other day. :) (Screenshots: start and finish) Since this looks ugly in StackExchange due to the extra line spacing, consider running the following code in your browser’s JavaScript console to fix that: $('pre').css('line-height',1) ...

 
@rlemon have you ever thought about creating your own scripting language?
based on c
 
nope
 
1:26 AM
hasn't everyone?
 
lol
 
xD
ya ya. Its a useless question i know
 
honestly. I love programming, but there are some things I would rather spend my time on than creating languages
 
Anything you would improve in javascript though?
 
lots
 
1:27 AM
a decimal type.
 
I would love to see enums. Right now the best thing we have thats close to it are object literals
 
"don't break the web" wouldn't be something I would care about
so unfortunately I would do more harm than good.
(assuming I had the knowledge to make the changes, which I do not currently)
 
ES6's symbols can give you something like an enum, but sometimes it's nice to not be so strictly typed and just use objects/strings
and only for some uses of enums
 
the compile to js ecosystem makes these things possible
if not faked.
but possible
 
Thats true
 
1:29 AM
I don't use it (sans babel, which I suppose is different) but it is a great thing
 
though es6 support without a transpiler makes things much more convenient.
 
yes
 
i doubt people are transpiling their python
 
but I see the appeal of TS
 
By the way, ive noticed so many people append loads of divs directly to the dom instead to a document fragment first.
Just wondering why that is considering its bad practice
 
1:30 AM
@Luggage they would if everyone in the world had a different interpreter
:/
browsers are a strange system to deal with
@Asperger every time you append to the DOM you cause the browser to do a bunch of things behind the scenes (repaint, reflow, etc)
a single append is usually better
 
cool new stuff I found in the mozilla site Document.registerElement()
 
custom elements don't feel right to me
 
@rlemon thats why I dont get why so many people do it. I prefer adding everything onto a document fragment then appending once.
custom elements are cool man, they give semantics
 
I agree and I can't explain why.
 
1:33 AM
how does the computer know of the semantics?
 
<div class="container">
 
you do.. but humans are not the only people reading the code
 
or <container>
 
robots will have to get a lot smarter to obtain semantics from custom elements
<nav> is semantic, and robots can expect it to be something
<my-new-nav> is not
 
But do they still scan those tags content though?
 
1:35 AM
the only thing that needs to understand my end markup is the browser. I can provide semantic meaning to components using react or knockout or some other tool on my end.
 
uh... paul irish is following me on twitter
 
therefor: <div class="container"> is just fine as my output
 
@Luggage there is still the (albeit almost moot) argument about SEO and robots
I know it is a weak argument... maybe it is my only one?
I just don't like custom elements :D
:shakes old man stick:
 
I'm on your side, pal.
 
Damn, traitor. Its me vs the web world lol
 
1:37 AM
fuck this world. I am the hero now.
 
Im really all for custom elements. I would never use them though xD. I know contradictory but still lol
 
where is this timing attack?
 
ohhh. neat.
 
@AwalGarg congrats and clean code by the way
 
1:39 AM
that's cute!
 
nary a var!
 
user5293625
Behind every great man is some celebrity on the internet...
 
please, 'fuck' is not in itself flag worthy
 
flagged. :)
 
user5293625
Is anything, then?
 
1:40 AM
!!s/hero/captain/
 
Yes.
 
@phenomnomnominal fuck this world. I am the captain now. (source)
 
insults, spam, shitposts, etc.
 
1:59 AM
Hi. Does anyone know why this.message in the function is undefined.
Appreciate the help
function Agent(name, message) {
	this.name = name
	this.message = message
	this.shout = (function() {return 'The nname is ' + this.message;})();
	this.ho = this.message
}

var john = new Agent('Johnny', "Hi this is a message")
console.log(john.shout)
console.log(john.ho)
results
The nname is undefined
Hi this is a message
I understand if I take out the IIFE, this.message works. But I don't get why.
 
@phenomnomnominal its not the IIFE. its due to this?
 
It's to do with the value of this inside the IIFE
 
@phenomnomnominal I see. Inside the IIFE this is reffering to IIFE itself, not the function Agent?
 
it'll be whatever the global is
rather than the instance
function Agent(name, message) {
    this.name = name
    this.message = message
    this.shout = this.createShout();
    this.ho = this.message
}

Agent.prototype.createShout = function () {
    return 'The name is ' + this.message;
};
perhaps
 
2:05 AM
Can I put this
this.message = 'killer bee'

function Agent(name, message) {
	var statement = 'hi world'
	this.name = name
	this.message = message
	this.shout = (function() {return 'The nname is ' + this.message + ' ' + statement;})();
	this.ho = this.message
}
but it does not work
oh. this works. my bad.
 
(function() {return 'The nname is ' + this.message + ' ' + statement;}.bind(this)());
 
new Agent('...', '...');
 
@rlemon nice. bind works. thanks
 
Can webworkers send the client functions that edit the DOM?
 
@phenomnomnominal thanks for help. prototype makes sense.
 
2:10 AM
Or do I need to send text and have the main js construct the function?
 
ayo gais
Anyone know of any software that can turn a query into an ERD?
 
2:30 AM
I've made a vertical slider, I was wondering how I'd implement scrolling. I want to detect if they scroll a certain amount (so barely scrolling won't trigger anything), it will go to the next slide by a function
Anyone know a scroll function, not for a scrollbox but to detect the user's scrolling?
 
onmousedown(foo)
function foo() {
// scroll to mouse location
}
 
No, the actual user uses the mouse to scroll
onmousedown is when the mouse is clicked, not scrolled
 
onmousedown is when user clicks hus mouse down
 
I'm saying scrolling...
 
there is a scroll event
 
2:33 AM
Physical scrolling of the middle mouse button.
 
!!mdn onscroll
 
@rlemon Something went on fire; status 403
 
ugh
 
Hahaha
 
2:33 AM
var x; onmousedown(function(){x=setinterval(mousescroll)});
 
@thepiercingarrow You're not understanding what I'm asking
 
onmouseup(function(){clearinterval(x)});
 
Thanks again rlemon!
 
Sorry not very good with js and the DOM sry
 
Hi. Where does this bind to. returns me undefined and I placed console log statements everywhere already. Thanks for help.
function foo() {
	var a = 'foo function'
	console.log(this.a);
}

function doFoo(fn) {
	var a = 'hello doFoo function'
	fn()
}

var obj = {
	a: 2,
	foo:foo
}
var a = 'global';

doFoo(obj.foo);
 
2:43 AM
What is the real significance of the this context referencer?
 
@AndrewL its more of a tutorial.
 
What?
That made no sense...
What do you mean
 
Sry I didnt get your question
this is supposed to be looged at point of invocation
i thought it would be in doFoo(). get the 'hello doFoo function
 
on the third line, you do console.log(this.a). I'm just confused as why languages such as python need the self.<variable> when it is locally defined
 
1128
Q: What is the scope of variables in JavaScript?

lYriCAlsSHWhat is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally?

@Ming ^
 
2:46 AM
Oh yeah, why do you have a bunch of 'a's
 
@rlemon thanks will check it out.
@AndrewL to see which one gets invoked
but apparently all i get is undefined
 
because var makes a local variable
this refers to a local scope
 
Haha, you don't understand the question.
 
you're saying "make this new variable" then saying "log self.variableName" which isn't going to point to the same thing
 
so when doing function(a) { this.a = 1 }, I've heard the 'this' is all personal preference
 
2:47 AM
function mool() {
	console.log(this.a + '######');
}

var obj = {
	a: 2,
	mool: mool
}

obj.mool();
this one works. give me 2########
 
because you're calling mool with obj as the scope (maybe not the proper term, obj is the thisArg)
 
yes. so you're saying mool is being invoked within the obj scope.
 
you could achieve the same with .bind var obj = {a:2}; mool.bind(obj)()
.bind passing obj as the thisArg
so then you get a new fn ref with obj bound as the thisArg, () calls it
 
@rlemon but earlier code. for doFoo(obj.foo) what scope is it being invoked in
 
does this help?
 
2:53 AM
@rlemon whats GC'd
 
garbage collected
 
@rlemon do is the fn() in doFoo ever invoked?
 
yes
    var obj = {
    	a:1
    };
    bar(obj); // call bar and pass the object
    function bar(obj) {
    	var x = 'hello world'; // defines a local variable to the function scope
        foo.bind(obj)(x); // bounds obj as thisArg to foo and calls foo passing x
    }
    function foo(x) {
    	this.a = x; // sets the value of x to .a on the thisArg
    }
    console.log(obj.a); // hello world.
here is how you would make something like this work (one approach, there are others)
important to note. .bind returns a new function reference with the bound object
so you can call it later
var newFn = Fn.bind(obj);

newFn();
 
@rlemon thanks very much for help. Will run the code in visualizer to understand better.
 
@Ming also look at function.call and function.apply
they do similar things but do not return a function reference to call later
fn.call(thisArg, argumentA, argumentB, ...);
fn.apply(thisArg, [arrayOfArguments]);
basically.
 
3:04 AM
@rlemon thanks will check those out too. heard briefly about those.
 
3:30 AM
morning
 
morning
Can webworkers send the client functions that edit the DOM?
Or do I need to send text and have the main js construct the function?
 
where are you guys from.
im guessing somewhere in Asia? since you mentioned morning
 
Chats tend to follow Universal Greeting Time
 
Moooooring
 
3:44 AM
 _____
< ring >
 -----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
 
Universal Greeting Time?
 
3:59 AM
plz is anyone good with websorkers?
 
Hola
@rlemon How long have you been rockin' a beard? o.O
 
the beard is a lie
 
 
Wow lol
 
4:18 AM
!!/hangman
 
@monners That didn't make much sense. Use the !!/help command to learn more.
 
@Feeds lel
Not really misinformation, it's how they're called in 'murica
 
people and their conspiracy theories
 
4:44 AM
@SomeGuy I don't understand...
@SomeGuy Oh, I see. So I should use atomics?
 
Uh, how would I know? I was just sharing an article
 
5:01 AM
@thepiercingarrow Workers cannot modify DOM. Workers also cannot send functions. You can let GUI do the job on certain message, or you can send the function's body to GUI as text and let GUI create the same function on its side to run.
 
@Sheepy Awesomesauce.
JS on large loops crashes the browser. If its in an iframe will it still do that?
 
5:20 AM
@thepiercingarrow Very high chance. I won't bother to try.
 
SpaceX launch live right now youtube.com/watch?v=L0bMeDj76ig
 
arc
5:32 AM
+1
 
6:02 AM
has anyone here used NightmareJs before?
 
@Ming I am currently using it
@Ming Need help?
 
@thepiercingarrow great. I'm still quite new to it and JS. I was wondering are there many ways to code scripts or are the applications fairly straight forward.
@thepiercingarrow EG: grab links. just use this particular script
like a cookbook.
@thepiercingarrow becuase I find it difficult to create customised functions becuase there must I dont understand about the library. How best to learn it i guess is my question
@thepiercingarrow How do i create a recursive function in nightmarejs. eg: go to startingLink. get titles. Then move to next page. getTitles.
 
Just make your own functions
 
yes. but because nightmare is promise based, I'm not too sure how to chain the functions within the code.
 
@Ming There are many ways, but its also pretty straight forward
actions.js is the file that uses a nightmare chain
 
6:19 AM
@thepiercingarrow yes. but what if I have 100 pages. the chain will be too long
@thepiercingarrow any way to make it recursive?
should i wrap the whole code within another function. and make that function call itself?
 
Can you use a for loop?
You can make it recursive
Oops all caps sorry
 
yes. for loops are fine.
but how do i put it in the code. There are no examples on the github with loops like this.
 
Then just do something like:
var n = require('Nightmare');
var nm = new n();
for (var i = 0; i < 100; i++)
nm.click(link)
; yield title.then(function(title){console.log(title)});
doesn't actually work but you get the point
We had a long conversation about this.. just scroll up a few pages untill you see something about title()
 
@thepiercingarrow thanks very much. I'm trying it now actually. will take a look at that convo.
@thepiercingarrow whats botland about. I get a 404 when click on link "implementing botland"
seems interesting
 
arc
Hi guys this may be a little out of context, but can you guide me to any sites were developer chats takes place in a friendly manner like this one. The place were i can learn more about the latest development technologies?
 
6:33 AM
other rooms in stackoverflow?
gitter?
 
arc
thank you very much... I just wanted to learn more, but can't find anyone to guide me....
 
@arc just ask the forums. I'm sure people here will help you. I'm learning too.
chats
 
arc
Thank you ... All the best to you ...
 
6:50 AM
My wife bought a kilo of salmon to prepare last night
I was like, wtf.. a kilo? Really?
Turns out she brought a third of it with her to work today, but god, I've never eaten that much salmon in one sitting in my life
 
I'm really scared of getting salmonella, so I'll never eat salmon.
 
That's a joke ?
 
what? salmonella gives you diarrhea and makes you puke. why would I joke about not wanting that?
 
@Shea troll 6/10
 
I was hoping someone would post the bait image
 

« first day (2029 days earlier)      last day (2926 days later) »