« first day (1789 days earlier)      last day (3381 days later) » 

16:00
@Lalaland But false is 0, so that breaks right away.
user406009
? False isn't 0.
it is
user406009
(At least, not in any sane language)
it is in c.
16:01
in every language, false is represented by and typically == (or ===) to 0
user406009
C is not a sane language.
in JS, false is 0
user406009
@ssube I would argue that is bad.
you're not a sane language
@Lalaland congratulations, but that's how reality is
user406009
16:01
false !== 0 (pretend I used the bot here, I always forget the syntax)
what else could you even use?
having a separate boolean type seems more recent.
we're in a binary system, so false and true have to be 0 and 1
user406009
@Luggage C is the only commonly used language I know without a separate boolean type.
@Lalaland most languages only pretend to have a boolean type, but actually use a number
user406009
16:03
That's an implementation detail.
user406009
I don't really care about implementation details.
but false not being 0 is an implementation detail
user406009
? No that's semantics.
user406009
In the semantics of JS, 0 !== false.
user406009
I don't care if the bits for 0 are equal to the bits for false. false could be 0xDEADBEEF, and no one would no the difference.
16:04
I would.
@Lalaland that's not possible, processors require false be 0
user406009
@ssube Interpreted language or imagine I have a special processor.
well, you'd have the instructions that are output compare to DEADBEEF instead of just a "not zero" or whatever
but 0 is the most natural
user406009
In JS, you wouldn't be able to tell the difference.
they don't use a full register for the jump flags, so you can't have DEADBEEF, specifically
16:06
@BenFortune Terminal works here at home with the latest EAP
user406009
So it's not important in the context of JS programming.
it's kinda too bad. JS is the way JS is..
user1596138
@Lalaland be glad everything in JS is abstracted for you but don't pretend it doesn't matter.
the only tricky part is whether {} or dict() should be truthy or falsy
unless you are creating a new language (because we always need more) there isn't a point in arguing about how it should be
16:07
very few people are going to argue that 0 should be truthy, because that's rather absurd
but empty objects/dicts are always a fun case
JS treats them as truthy, Python as falsy, not sure about other langs
user406009
I would argue that only true and false should be truthy or falsy in a statically typed language.
In a dynamically typed language, only false and null should be falsy. Everything else truthy.
@Lalaland what if you provide a boolean conversion operator?
user1596138
!!> 'Ø' == true
@Jhoopins false
in C++, only true and false are truthy/falsy, but plenty of types can be cast to boolean
user1596138
16:08
Err...
user406009
!!> 'Ø' !== true
@Lalaland true
!!> [0, [], {}, '', null, undefined].map(function(x) { return x == false; });
@Luggage [true,true,false,true,false,false]
user1596138
!!> !!'Ø'
16:08
@Jhoopins true
user1596138
Slashed 0 lol
user406009
@ssube I don't like implicit conversions either.
user406009
It's a misfeature.
JS and Python both have bad truthy/falsy systems
user1596138
Doesn't do anything different..
16:09
but js has === to skip that..
!!> !!'Ø'
@Luggage map(Boolean)
@ssube true
@Jhoopins 'Ø' != true but !!'Ø' == true is not good
user1596138
Yeah that's something I think is bad..
16:10
that's a bad string
user1596138
What do you mean bad string?
does eslint have a warning for using == instead of ===?
user406009
@Luggage Yes.
@Luggage everything does, yeah
user406009
It also has an exception for == null, which is good.
user406009
16:11
Never do === null.
user1596138
!!> console.log( (!!"0"), ("0" == true))
@Lalaland why?
@Jhoopins "undefined" Logged: true,false
you should absolutely use === null
16:11
there's no reason whatsoever to use == null in any case
Know what it's called?
user406009
@ssube Do you have a valid case where you want to distinguish between null and undefined?
@Luggage eqeqeq
user1596138
@Lalaland yes, because undefined type coerces from many things.
user406009
@Luggage Wrong page: eslint.org/docs/rules
16:12
ahh, ty both
user1596138
Well... not many things. But it isn't literal
@Lalaland plenty of things, like 0 or false, == null but not === null
user406009
@Jhoopins Like what?
undefined is unset, null is explicitly set to null
user406009
@ssube Incorrect.
user1596138
16:13
!!> var obj = {thing: undefined}; JSON.stringify(obj);
@Jhoopins "{}"
user406009
Only null == undefined.
user406009
Check the truth table.
user1596138
!!> var obj = {thing: null}; JSON.stringify(obj);
@Jhoopins "{\"thing\":null}"
user406009
16:13
@ssube As far as I am concerned, those are equivalent.
i use == null in exactly 5 places in my codebase when i know i am checking for undefined OR null
user1596138
They aren't interchangeable.
@Lalaland they are very much not
that's why most tools (and compiled languages) have a warning for uninitialized variables
user1596138
Think about the backend
they also do entirely different things
plus, null should never really show up in an ideal codebase, since it's always avoidable
user406009
16:14
@Jhoopins ?
user1596138
What if you sent an object like that where the backend expects the key/value pair regardless of whether the value is undefined/null
what? null has meaning
drafts.csswg.org/css-grid-1/#grid-layering CSS might now become 0.00001% sane.
@Luggage it does, but it can usually be avoided with something more idiomatic or safer. Empty list instead of null, for example.
well, i have data that can be nullable..
16:15
null pointers were a huge mistake
user406009
@Jhoopins When I read JSON with an optional property, I provide a default of null.
@Luggage is it nullable or optional?
user1596138
You are fine with undefined, because you checked that the value == null, so you send an object that is missing that key.
optional, i guess.
@Lalaland most importantly, null is a real value where undefined is not
user1596138
16:16
^
user406009
@ssube So you are advocating Optional<T> (Maybe, etc) for JavaScript.
it maps well to null in my databae and is easy to reason about
user1596138
@ssube nice words
user406009
@ssube Undefined is also a real value. It means the same thing as null.
@Lalaland absolutely. I use that in a bunch of places.
@Lalaland No, it doesn't.
user1596138
16:16
@Lalaland Did you totally miss the JSON.stringify?
undefined is not the same as null
and has real differences in the way some built-in JS functions use that (like JSON.stringify)
user406009
@ssube Same. I find optional helpful in statically typed languages. I don't find it as useful in dynamic languages.
user1596138
!!> JSON.stringify({undefined: undefined, null: null})
@Jhoopins "{\"null\":null}"
exactly.
16:17
Optional gives you inline documentation, explicitly calling it out as potentially not there. Even that can usually be avoided with an empty list instead of returning null.
user406009
@Jhoopins Like I said. I consider {"foo": null} equivalent to {}.
@Luggage But JSON is not specced in ECMA262. It is part of ECMA404.
@Lalaland and how many 19-level deep if (typeof foo !== 'undefined' && typeof foo.bar !== 'undefined') checks do you suffer through?
user1596138
@Lalaland you can't. You don't get to make that decision, you are not the backend dev receiving the data. You are expecting the backend to be written according to an assumption you made
user406009
I prefer keeping things simpler. Less cases to worry about when you consider null and undefined equivalent.
16:18
never having null in a codebase is a beautiful thing, you can just assume things are always valid
you can just for (let foo of bar.getFoos()) and not check if there are any, because it will correctly iterate an empty list
user406009
@ssube None? I just do if (foo != null && foo.bar != null)
@Lalaland and if it's undefined?
user406009
I usually don't care.
user406009
Undefined and null are the same as far as I care.
user1596138
@Lalaland That works fine and dandy for hobbyists or full stack devs who know exactly what every part of the code expects.
16:19
hoo buddy, if that's how you write your null checks, you're gonna run into some serious problems
user1596138
I give up, I think he's trolling lol
user1596138
!!afk back to work
p.sure he is
damn, Object.assign copied undefined values, i assumed it would skip them
user406009
I am not trolling. I sincerely believe that undefined is completely useless.
16:20
well, properties with a value of undefined
@Lalaland what should the value of foo be after let foo; then?
@Lalaland there are good argumenst that JS doesn't need it, but in the real world it is a different value
user406009
@ssube Null.
lol
it's redundant, but distinct
16:21
!!> let c; console.log(c === d);
@Callum "SyntaxError: let is a reserved identifier"
Get tae fuck.
@Lalaland but null specifically indicates an empty object reference/pointer. What if foo was supposed to be a number?
user406009
Null indicates empty anything. In JS numbers and objects can all be null.
Other languages, such as Java require a bit more care.
In languages like Java, a number can't be null.
It's a primitive, not a reference type.
user1596138
16:22
Starring because funny not because I agree lol
in c# it looks like they can be null if you use Nullable<>, but it's just syntactic sugar for another special value
user406009
@ssube Yes, but we are talking about JavaScript, not Java.
Also, in C, null happens to be 0, so a "null" number is actually just set to the entirely valid value 0.
user406009
That's bad. C is not a paradigm of language design.
@Lalaland We're talking about how undefined and null are utterly different things, undefined is important but null can be eliminated from a carefully-designed codebase, and your theory makes no sense.
user406009
16:24
@ssube Fine. Remove null. Rename undefined to null. Now we are both in agreement.
user406009
Problem solved.
window.undefined = null; //you could do this in the past
@Lalaland lol, that defeats the point
undefined is not null, null is an actual value (just a bad one)
undefined is no value
user1596138
@Lalaland what do you think about it in reverse?
null explicitly says "I could point at something, but I'm not." undefined is "this isn't anything, keep moving."
16:25
I use null to mean a value that is optional and not supplied: { hoursWorked: 1, comments: null }
user1596138
!!> var g; g == null;
@Jhoopins true
user406009
@Luggage Why isn't {hoursWorked:1} equivalent to that?
user1596138
Do you want to allow undefined instead of null?
as much as I hate Ruby, Nil kind of makes more sense than null for naming
user406009
16:26
They both mean the same thing.
it calls out that it's set to something and that something is nothing
user1596138
Oh really?
if i pass {hoursWorked:1} to the server to patch my object, it won't clear the comments field
Scala solves that with None instead of null
C++11 has nullptr instead of a dumb #define NULL 0
sometimes you want to SET somethign to null, not just fail to change it's value
16:27
@Lalaland No. In @Luggage 's example, comments is explicitly unset.
also, i can data-bind to a null value, I can't data-bind to a missing property
It exists, it has a value, and that value is nothing.
Now, I would use comments: [] to keep things type-safe and idiomatic.
(depends on your databinding framework, naturally)
user1596138
@Luggage That's what I was typing out an example for
an empty array? maybe an empty string
16:27
because then you can dumbly loop over it and it will always succeed
@Luggage it's a plural, so I assume it's an array
it's a string. i think the real field might be called "comment".
if someone left a comment and it became a string, then the empty version would be an empty string. If people left comments and it became a list of strings, then the empty version would be an empty list. Those are sensible, same-type defaults that let you simplify your code.
user1596138
!!> var obj = {something: null}; /* some time later... */ console.log(obj.something == null); // has something been set? Does the property even exist? We have absolutely no idea
@Jhoopins "undefined" Logged: true
null is enough to use, because it calls out that it's set but empty.
16:29
yea, i can see empty string being ok, but meh.
Just omitting it because it's empty is a terrible, utterly broken idea.
null is pretty damn clear, and i think i accept both '' and null and store null in the DB field if it's empty string
You have to have sensible defaults somewhere, and after spending time in Java, I've come to appreciate the empty version of the same type.
user1596138
lol @Lalaland can we see some of your code where you use this hack
user406009
What hack?
16:30
@Luggage it's clear, it's just easy to accidentally propagate null too far and have something throw.
That's why I avoid it.
[] still has all the Array.prototype methods, they just become no-ops.
user1596138
Pretending null is equivalent to undefined. I just wonder in what context you are even using it
ok, but I think making up other values to represent a missing value for promitive types is awkard
Using null is enough to correctly handle empty values, but using the same-type-empty means you don't have to handle them.
I also allow null (in some cases) for integers {hoursWorked: null} is valid in some cases and not others (validation will yell at you)
user406009
I use it in all my code. Most of my JS my interesting JS code was written for work, so I don't have a public copy.
16:32
i think, in this case 0 might be ok.
@Lalaland You should probably warn your work that you've been using foo != null all over and their site will break at some point.
but I can imagine times when 0 has a different meaning than empty
@Luggage If you really need to call it out, why not a boolean flag next to it?
Or a enum status field?
Absolute zero is 0K
user1596138
You can't copy/paste a piece of code? I didn't mean the entire site
16:33
for every integer? no thanks. I'll just store null in the DB
user406009
@ssube We were using Flow Types, so we knew where all the nulls are.
user1596138
^ programming based on assumptions. I mean it works, for awhile.
user406009
@Jhoopins It's not really the exciting. Just use == null everywhere instead of === null or === undefined.
document.getElementById('text').appendChild(document.createTextNode("Two"));

Would this be a better idea than innerHTML
@JasonStackhouse why not textContent = "Two"?
user1596138
16:34
@JasonStackhouse Yes but you can use textContent
user1596138
!!mdn textcontent
Is that faster?
@Lalaland You can never know where all the nulls are.
@JasonStackhouse The element already has a content property, it's just (potentially) empty. Why create a new node?
user1596138
16:36
Umm.... There is probably not much of a performance difference. But it's secure while innerHTML is not
user1596138
Was I doing something? I got kicked haha
It is a lot faster, thank you so much guys :)
@Jhoopins I didn't kick you, but it's probably because you're a punk :D
@JasonStackhouse it's very rare that you want to use innerHTML.
16:40
@ssube It's just what I've been using for years, never really seen textContent used in tutorials
@JasonStackhouse It's a newer property, so you should double-check browser compatibility.
user1596138
@BenjaminGruenbaum Most likely. I was rambling a bit too haha maybe it was someone's "calm down bruh"
user1596138
Trying to get work done from home. Still don't have a vehicle. Wbu?
user1596138
Oh I turned 21, I can beer. Did we lose @SterlingArcher or has he been intermittent since his new job? <3ro
had to go AFK. Did we resolve this null argument?
16:47
@Jhoopins come at me
user406009
@Luggage No. I think we just have to agree to disagree.
user1596138
@Mosho I will come in your general direction
agreement == null
@Jhoopins I always ejaculate toward Mecca
user1596138
@Luggage basically he said they are programming on an assumption which is always correct for them. There weren't really any words about how it makes sense to do it that way in other scenarios
sicne you can get any type at any time in JS-land, you are always making SOME assumption
unless you have guard statements everywhere
user1596138
16:50
Very true
Where the balls does chrome canary install
I can't find it
@Cereal which OS?
Windows
gtfo :-D
=D make me
16:58
forEach should be synchronous even when using promises, right?
No. Promises are magical.
Promises can make fs.readFileSync async.
Promises are sooo promising I can't even...
myArrays.forEach((arr, index) => {
  Controller.send(`id=${index}`)
    .then(() => Controller.send('MG "ID: ",id'))
    .then(() => Controller.download(arr))
})
I'm like 99% sure the forEach would move on before that promise resolved
Since when does ESPrima have full ES6 support o.O
@AwalGarg I swear to the dark gods, if you say "I can't even" again, I'll douse you in pumpkin spice.
user1596138
17:05
Whoa
user1596138
Why can I see deleted messages
can't everybody see message history?
user1596138
@Lalaland your voodoo star extension does this too doesn't it
user1596138
@ssube no it is a page not found if you aren't a room owner.
@Jhoopins screenie of what you see?
user1596138
17:06
I'm seeing it inline in the chat as if it was never deleted. And It's because of that StarGazer extension
that sounds like a bug
since deleted messages can't be starred
what is the message content?
user1596138
user1596138
That message is deleted but I've reloaded etc. It flashed deleted for a half second then goes back to the actual message
Userscript?
user1596138
17:08
function removedMessageShower() {
    function getMessage(messageID, callback) {
        return $.ajax({
            type: "GET",
            url: host + "/message",
            data: {message_id: messageID},
            success: callback,
        });
    }

    function showDeletedMessage(message) {
        var myMessageID = parseID(message.parents('.message').attr('id'));
        getMessage(myMessageID, function(content){
            if (content != 'No message') {
                message.text(content);
hah thats awesome @Jhoopins
@ssube so, whats wrong with "I can't even..."? :-P
@AwalGarg It's just, well, odd....
@AwalGarg you wearing uggs and drinking a latte?
user1596138
@Lalaland very nice, I are proud of you
user1596138
17:09
Nobody needs to go tell Meta about this.. Just sayin..
meta can't do anything about this. can't undelete anything from the interwebz ever.
user1596138
They can go patch it..
user1596138
Balpha thinks they patched showing who starred what lol. They did not..
he has a server running, scraping all messages as they are posted. so he has a copy, which you can't delete.
user1596138
17:15
Ohhh. I didn't see what was going on
user1596138
Now I get it
You can tell who starred what?
Why is that info even sent?
user1596138
Cause, stars aren't necessarily a secret.
No, but the client doesn't need to know who starred it.
Like for the functionality
@Cereal chat code is a mess
17:17
it would make more sense to just update the message with the count, but that's not what they do
Is it not sent through the websocket?
@Cereal imho, convenience. You just send globally, and you put the star in yellow if you receive a star you did
user1596138
@ssube well it is now... They aren't sending the userid anymore on the websocket for stars
user1596138
@FlorianMargaine yeah I figure that was why too you just check to see if your ID is one of the ones that starred it
user3196599
Hello, does anyone have experience with react? I have a quick question regarding using existing jquery plugins with my react component, any help is much appreciated...stackoverflow.com/questions/32485395/…
17:22
@FlorianMargaine moot point because the starring a message sends an http request with a success/failure response, not a websocket message
@AwalGarg you missed the point, congratulations!
:( explain
oh you mean the incoming star events. well they can just use the boolean filter they use for inbox events
Click handler for starring -> send the http request and don't care. Meanwhile, you're listening to the main websocket, and a new message tells you there's a star! Check its id to know if you put it in yellow or not.
There are other ways, we're just saying that's probably why they did it this way.
@FlorianMargaine if your sent request resulted in a success, you ignore first incoming event (and first because order doesn't matter anyways, there isn't a signature with the event)
17:41
Hi all, would this work properly? I have no idea what previous dev was trying to replace with this.
s = s.replace(/,/g,'@#');
is '/,/g' supposed to be the pattern to replace there?
he's replacing all commas with @#
this /g is the global match like in regex, right?
Well it is regex, so yes
dah okay right right
thanks :)
jsfiddle.net/kerjbzry/show how annoyed would you be if a 404 page had audio?
17:52
Not black enough
user1596138
@rlemon I would laugh so hard if I hit that randomly
The question clearly states, and it is mentioned in comments in several places, that I needed a solution based on the standard promises, not one specific promise library. I cannot use Bluebird's settle or anything something like this. jfriend00's solution is the one that works for me. — vitaly-t 6 mins ago
That guy -_-
@BenjaminGruenbaum You mention bluebird in like the fourth line. He probably stopped reading there
@Jhoopins cool. I'll add a subtle 'mute' button I suppose and toss it up on all of my sites :D
should a createModal function add the modal to the dom, or should I just return the element
17:55
hahaha nice @rlemon
that fiddle is awesome
user1596138
I was thinking I should get JHOOPIN on my license plates lmao. Nobody knows what it means I just know @Nick kept calling me that
Jpoopin
@Loktar ty
old codepen, just added audio
lol
user1596138
Nvm
user1596138
Nobody has "SOUTH" so. It'll be mine
17:59
> autoplay="fuck yea!" loop="this bitch!"
I'm doing this for all of my audio tags from now on

« first day (1789 days earlier)      last day (3381 days later) »