« first day (1643 days earlier)      last day (3307 days later) » 

12:33 AM
I find myself doing, more and more, if ("property" in myObject) -- any downsides? Do you cringe when you see this?
 
JSLint cringes.
I think it's only valid if you really want to search the entire prototype chain for property existence, undefined or not. I doubt you need to do that a lot.
 
@NickDugger i prefer it
I too often see if( !foo.bar ) {
 
I do it a lot for feature detection, like if ('localStorage' in window)
 
if(window.localStorage)
 
I know I can do it, but I feel like the 'in' keyword makes my intentions clear
 
12:47 AM
I prefer in as well
not that performance here matters.. but depending on the size of the object, 'in' check can be faster
 
performance always matters
 
not when we are talking 10 million ops and 20 million ops and higher
 
1 millisec here, 1 there... eventually they do add up.
 
the client won't care
 
is x => JSON.stringify(x) valid? Do arrow functions automatically return whatever if there are no braces?
 
12:55 AM
var foo = {
  bar: Date
}
'bar' in foo; // slower that !!foo.bar
var foo = {
  bar: localStorage
};
'bar' in foo; // faster that !!foo.bar
but these number are all still over 10 million ops
it is not worth worrying about
be consistent
that is more important
 
yuss
used a kOS script successfully in a mission
 
For me, the issue with in is one of intent. I prefer hasOwnProperty for checking for property existence on an object specifically. Or just a truthy check if you need to see if anything is there. in scans the prototype chain and also returns true if a property exists but is undefined. That's more worry than your reader needs.
 
but I'm lazy. hasOwnProperty has way more characters than in
 
1:10 AM
var f = x => x*x; f(3); // 9
So yeah, if the RHS of => is a single expression then its value is returned.
 
That's pretty cool. I really like our new arrow functions lol
 
The "people reached" thing on the new profiles is kind of crazy... I never thought about how many people out there are reading my nonsense.
 
@NickDugger You should take up code golf then. :-)
 
Nah, too busy writing tutorials and working on personal projects
 
Yeah, code golf is addictive. It's probably best not to start!
 
1:14 AM
I think writing tutorials is addictive so far, lol
 
:-)
 
I always wanted to be a writer...
 
And now you are.
 
I ended up just writing a lot of code instead lol
 
Code golf does have an educational side to it though, in terms of language and algorithm understanding.
 
1:16 AM
Anyone have any good suggestions for a very minimal responsive grid framework? None of that bootstrap nonsense.
 
RYO
 
afk
 
@NickDugger ?
 
roll your own
 
oh. Yea, its not exactly complicated, but considering there are 1000s of responsive frameworks out there, someone has surely done the work for me.
 
1:20 AM
I tend to avoid them, because they usually ship with a lot of bloat
 
That's why I said minimal. :-)
 
RYO
(I'm not helpful)
 
Hah this almost looks like a joke: arnaudleray.github.io/pocketgrid/docs
I think a reset stylesheet would do pretty much the same thing.
 
Anyone around here interested in Artificial Intelligence? I've been working on an early stage draft model of a plan for a (possibly?) unique appraoch to AI development. Anyone care to take a look and offer some feedback?
 
@twiz That's really bad
 
1:33 AM
I suppose the docs are a decent tutorial of how to handle RWD though...
 
@monners Why are people over 31 bad for international relations?
 
@MediaWebDev Isn't this just a Genetic Algorithm?
 
1:50 AM
@Retsam looks like it ^_^
Hmm. Gotta love when you arrive at an idea as complex at this one which already has a Wikipedia page lol
 
Those times when you have a great idea and then realize that someone else already thought of it 65 years ago.
 
Yeah, well
They say most every idea has been thought up by now. From here on we just implement them in new ways
 
Anyone here use Microsoft Azure?
 
@SomeKittens Science?
 
eloquentjavascript.net/09_regexp.html#summary_regexp I cannot get the "Qoute style" exercise to work.
 
1:59 AM
@twiz Remind me to tell you about the time I invented straws
 
"aren't 'the dictator' ".replace(/(\W'|'\W)/, "\"")
 
@SomeKittens So you remember that time you told me to remind you about the time you invented straws?
 
@SomeKittens I invented the wheel and sliced bread on the same day. Man I felt like a turd the next day.
 
How do I put back the non-word character back in place with $1 $2?
 
/me is at meetup with issacs and substack, so responses will be slow
 
2:01 AM
@StevensHaen use \B instead of \W
 
@KendallFrey everything that's not a boundary wouldn't replace them at all
 
what do you mean?
!!> "aren't 'the dictator' ".replace(/(\B'|'\B)/, "\"")
 
@KendallFrey "aren't \"the dictator' "
 
@KendallFrey if \b is for boundary then \B is a non-boundary
 
like that, but with the g flag
is that not what you wanted?
 
2:05 AM
what about the slash?
 
I think that might be part of displaying the string
yeah
it's not actually in the string
 
I works, great.
 
plus you don't need that space at the end
 
!!>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod".replace(/\b{1,5}\b/g, "");
 
@rlemon " , consectetur adipisicing , eiusmod"
 
2:07 AM
@rlemon I thought \w matches single characters, not whole words
 
it does
 
b does that
 
oh eah
because of the boundary
 
@rlemon "SyntaxError: nothing to repeat"
 
why doesn't this match 5 chars inside a word?
 
2:08 AM
\b surrounds the word
 
I get that
 
@StevensHaen what are you expecting it to match that it doesn't?
 
So we're working inside the boundaries of the word. It would be logical to try match chars 1-5 inside the word
 
it does
 
and I still don't get how you made my first example work
 
2:09 AM
it matches up to 5 chars, followed by a boundary
 
All of my single quotes have a boundary around them
 
@StevensHaen the position between a ' and a space is a non-boundary
 
you wanted to filter, aka remove, all words under 6 chars. that matches all words 1-5 chars and removes them
 
@rlemon I see
This is a great solution, I have to admit
it's true regex golf
 
it's what I do
if you want a golfed regex, I can reduce it for you
 
2:13 AM
further?
 
the easy one is removing the ()
/\B'|'\B/g
/'?\B'?/g is even shorter, let me test it
nope :/
 
yea Kendall is WAY better at regex than me
I'd trust him
#nojokes
 
look at what I just did
guessed, and got it wrong
 
but in the end, you know more about regexp than me
 
like how to pronounce it ;)
I kid...
lmao
> Consider wearing many layers of clothing to bed, to make it difficult to access your genitals.
 
2:31 AM
> Masturbation is a sinful habit that robs one of the Spirit and creates guilt and emotional stress. . . It is a habit that is totally self-centered, and secretive, and in no way expresses the proper use of the procreative power given to man to fulfill eternal purposes. It therefore separates a person from God, and defeats the gospel plan.
 
ahahaha this gets weird
 
it does create guilt and emotional strain --- that has been scientifically proved.
 
the app makes you rub a virtual metal rod until it heats up and explodes
 
but being totally self centered, secretive are good qualities.
 
that sounds kinda familiar
 
2:32 AM
@KendallFrey mflao
 
> As the user slides the virtual hand back and forth across the virtual rod, virtual friction is created. Sliding faster creates more friction. With increased friction, the rod will eventually begin to heat up and glow. The end goal is to make the rod white-hot. The user should feel free to engage in this activity with righteous vigor.
> When the goal is finally achieved, the rod will melt away in an explosion of fireworks, and the app will play soothing gurgling/splashing sounds to help the user relax and bask in the glow of a job well-done.
> discharging a full can of pressurized whipped-cream onto a fully-consenting friend or hired helper can provide some relief.
lmfao this is just too crazy
 
I was just wondering, what if we are a part of "Klingon" Empire (or someone like them) and they don't consider us sentient enough ? But thats about to change :o ?
 
and then they say ""Stretch" goals being inappropriate for this subject matter"
> $1,000,000: we will look into the possibility of giving the app the functionality to sense the presence of lubricant on your hands. If lube is detected, but no activity is logged, the app will bide its time, and at some random interval of time later, it will announce loudly, "Masturbation alert!! Would you like to log your activity from earlier?"
i can't take it anymore
 
lol
 
I want to believe this is a joke, but it seems too serious
Pledge $1,000 or more

All lesser rewards, and your name inscribed on the graphic of the iron rod within the app. Potentially millions of users will virtually stroke you as they battle their urges!
 
2:37 AM
@darkyen00 We'd know we are not sentient enough when they demolish Solar System to make way for a galactic highway.
 
meh we won't
some specie like klingons won't even consider warning us.
lol
 
0
Q: Iphone viewport height too large in landscape mode

Lynel Hudson I'm working on a responsive website for the first time and noticed a rather undesirable feature in Safari in IOS7( on Iphone 4s ). This problem may persist in later versions of the OS as well, I'm not sure. The problem: As you can see in my gif above, there is no scrolling in portrait mode wit...

Curious if anyone has run into this problem before.
 
Dang, there's just so much double entendre
> If layering does not suffice, consider more extreme measures like binding your hands to the bedposts.
ooh, handcuffs
 
Our company ran into lots of problem with Safari, especially with older versions. I think we ran into this before, but not sure how the frontend dev fixed it.
 
100vh
thats how.
but that will break on iPad iirc.
 
2:42 AM
@KendallFrey I'm calling Poe's Law on that one.
 
@Sheepy you've had this particular issue before?
 
@Retsam yeah, it just seems so over-the-top, idk
 
This seems to be exclusive to IOS Safari. My testing is fine on windows phone 8 and android.
 
@LynelHudson Yes I saw this issue before, but I wasn't the one who fixed it. Sorry.
 
Ha. Just glad I'm not the only one.
 
2:50 AM
@LynelHudson try height: 100vh;
instead of 100%
 
Didn't think of that. Thanks. I'll let you know what happens.
 
@darkyen00 Looks like a good idea.
 
I put all my heights in VH values. Doesn't seem to have fixed anything but I have alot going on. I'll try to strip down my code and re-implement and see if it works.
 
Hello menandwomen of the javascript channel
does anyone here have an informed opinion regarding the relative merits of flux vs reflux when developing an application with react?
 
user365265
i hate the new profile page
 
3:05 AM
Sigh. One guy left a comment saying he lost an indeterminate amount of sleep over this lol. I'm definitely putting a bounty on this if it doesn't get answered.
 
Hey
 
@Celestriel Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
cool
 
Do you guys think that I'm making a career mistake by using gitlab instead of github to host most of my projects?
 
Can anybody quickly look over this code and tell me what's wrong? I am very close, it shouldn't be too difficult. repl.it/iyB/1
 
3:10 AM
That is the furthest from a "career mistake" one could possibly get
 
I would hope a potential employer would look at the quality of the projects, not what service they're hosted on
 
basically it's just a program that takes a sentence and finds each word with a given letter in it and then adds that word to an array
 
but I wasn't sure if Github itself was that important
 
@Celestriel s/sentance/sentence/
@Celestriel newArray isn't very descriptive
@Celestriel Why do you use += 1 once, then ++ right after?
@Celestriel Perhaps you should reset j after each iteration?
That's why the first part of a for statement is there for, after all
 
I'm learning. it's just habbit. I'm used to using ++, but I am reading 'javascript the good parts' and he uses i += 1
 
3:13 AM
@NathanJones I really don't think this should be a concern
 
@Celestriel I'd drop that source
 
@copy okay, I'll stop worrying about it. Thanks for the input.
 
or rather, take it with reserves. Some of his ideas are pretty... disagreeable with
!!>"letter"[0]
Ah, great, Cap's dead again
Indexing strings produces one-character strings, not charcodes
 
Do you mind me asking which ideas of his you disagree with?
 
not using ++
 
3:18 AM
like I said I am fairly new to Javascript. There is so many different resources telling me different things. It get's hard to figure out what is good and what isn't
what about not using new
 
I disagree with that too
new is perfectly fine. Just don't think Javascript is Java
 
yeah I guess
 
myString.match(/\b.*?e.*?\b/g).length
 
I wouldn't obsess over that stuff. Personally, I'd say get something like JSHint and just avoid the things that it complains about.
 
maybe
 
3:20 AM
^^
 
how do you run javascript with that bot again?
!!> "Hello my name is joe and this is a sentence".match(/\b.*?e.*?\b/g).length
 
@david 4
 
That assumes that that bot is here...
 
IRC, the default settings of JSHint are pretty conservative: things that it complains about are pretty much the things that virtually everyone agrees you shouldn't do.
 
hello, name, joe and sentence
 
3:22 AM
@david You know you can just run JS in the browser console, right?
 
@Retsam I can't, I'm using chrome
with noscript enabled and ad blocks
 
Uhh... yes, you can?
 
i'm also on a mac
so stop assuming things
 
Okay, hold up.
 
those are all great excuses
 
3:23 AM
Does he advocate not using inline conditions? Because if(cond) doSth() is perfectly fine without a newline
 
None of those things stop you from running JS in the console (except noscript, but I'm like 90% sure that won't stop you from running it in the console).
 
just drop noscript
 
macs don't even have a console
 
Uhh, I'm on a Mac, dude.
 
@david chrome does...
 
3:26 AM
don't call me dude, i was programming java since you were a babby in your mommys tummy
 
And I'm the one assuming things?
 
(i know you can run it in the console, that's where I was testing it. I wanted to run it here to show Celestriel that it solves his problem)
 
@david whom are we parodying now?
 
@david Chome, on Mac, does have debug console. That can run JS. And I was programming Delph last century, and Java since last decade.
 
the wwebsite on the internet guy
guys i was kidding, calm down
 
3:28 AM
!!urban Schrodinger's Douchebag
 
@Retsam Schrodinger's Douchebag One who makes douchebag statements, particularly sexist, racist or otherwise bigoted ones, then decides whether they were “just joking” or dead serious based on whether other people in the group approve or not.
 
I was hoping for that. Were you serious it would be a reason to walk the plank.
 
oh believe me I was very sure that the specific blend of noscript and java in a javascript channel would be disapproved of. It was meant to be fairly obvious but I guess not
It seems like celestriel has left anyway, so my regex one liner has fallen on deaf ears
 
Idk man just don't pretend to be a dick
Rubs people the wrong way even if they know you're joking
 
3:32 AM
Don't worry. What is the reqx question again?
 
>:-(
 
I think we have a mechanise for such minor disturbances. Yesterday an owner of this room asked what are girls. I promptly ignored him.
 
LInk?
 
what are girls though
 
omg @meredith /ignored
 
It is a distinct possibility
 
david you have a regx qustion?
 
@Sheepy I'm pretty sure Vimzy has a bigger sin than him here
 
No, someone else was trying to count the number of words in a string with the letter 'e' in them. They had a double loop thing going on and I pasted a regex solution
(I'm not 100% certain the regex solution is correct, but it seems to be)
 
@david Your regx Looks ok to me. :)
 
3:47 AM
Might deserve being accompanied with a comment, though
 
There is no way i'd use it in production I don't think
I'd probably go with a split -> filter -> count
even though it's slow
it's much more understandable
 
or maybe match -> filter -> count
 
I'm going to repost my original question because it didn't seem to get any answers:
Does anyone here have an informed opinion regarding the relative merits of flux vs reflux when developing an application with react?
 
Better yet: /\w*e\w*/
 
yeah that's better
 
3:50 AM
@david I've heard acid reflux can be bad
 
@Jan I find a teaspoon of bicarb disolved in half a cup of water works wonders
 
@david I'd rather use regx. With a comment. Like "Your regx Looks ok to me. :)".match( /(^|\s)(?=\S*e)/gi ).length /* Count space separated token containing 'e' */
 
or just put it in a descriptively named function
 
P.S. your regx is not case insensitive, not sure whether it was intentional
 
you mean not case insensitive
and yeah I didn't put a terribly huge amount of thought into it
i was trying to go for Jan's solution but it's been a long day
 
3:54 AM
Regx is tricky, for example if you don't want to count 're as a new word then don't use \b...
 
Yours is very password checky with the whole lookahead business
 
@david I still can't believe they didn't introduce lookbehind in ES6. Every other languages have it!
 
s.match(/\w*e\w*/gi).length
 
yeah, it's a pretty big omission
although i'd be content with comments
 
lol
 
3:56 AM
having comments INSIDE a regex can be so bloody helpful
 
Or some other appropriate character class.
 
@david You can comment regx. I do it two ways. One is for simple regx, I have a comment line below that matches the exact position of group brackets noting what they are.
The second way, for longer ones, I split the regx into multi lines and add comment for each part.
 
@Sheepy Building it from strings?
 
or use a regex library and the x flag
 
@mintsauce Yes. I have an habit of caching regx. Because I use them quite a lot, compared to the average programmer.
 
4:01 AM
@Sheepy I'm pretty sure V8 does that for you
 
Yeah i didn't think you could have multiline regex literals
 
@david Not in core JS.
Or, rather, even if you can, it is pointless because you cannot add comment like other languages.
 
exactly
 
Do you have a preferred regex library?
 
I don't use regx lib. I accept the limits I am given.
 
4:07 AM
I usually use a regex when I'm too lazy to think of a proper solution... So the last thing I'm going to do is go out and compare libraries :D
 
I don't really have a need for one, jsut curious. nice to know a good too for wheni need it
 
@Sheepy And give each part a meaningful variable name.
 
The most complex thing i want to validate is an email recipient list
 
@mintsauce Only if I'd reuse the parts or use them independently (it happens).
@Luggage Oh no, I did that once when I was young. The regx was like a few hundred characters long; I compose it by reading the email address spec.
 
I shouldn't ahve to write that regex. it should be available for me
 
4:12 AM
Eventually I simplified it to around 200 characters.
 
@Sheepy Fair enough; I find it helps anyway.
 
Most email regx reject too much vaild emails.
 
Right now I'm using a simple regex for an email address and just splitting the string by the delimiter first.
 
Just in last decade, most of them won't even accept a dot in local name. Which rejects my gmail.
 
i am not bothering validating TLDs or anything, just email-like
 
4:14 AM
@Luggage If the local part is quoted, splitting by @ may split at the wrong place.
 
I validate just enough to prevent non-sense data
no, splitting by ; in this case
the delimiter between emails
 
Well, whatever that works for you. I know the one google handed me couldn't do the job.
 
I see what you are trying to say. I'll err on the side of loose validation.
 
why do we validate email addresses?
 
because users are dumb
 
4:16 AM
what harm is there in sending to an invalid address?
 
Because people do input it wrong. Such as pasting password into email.
 
@david do you want me to make 1 million accounts and show you?
 
is it really just to inform the user that they may have made a mistake entering it?
 
yup.
 
i'm not sure i follow phenom
 
4:17 AM
You want a valid email address so you can send an email to them and validate that they exist.
 
@phenomnomnominal You could make a million invalid email address with a correct format too.
 
if it's just to inform them that they may have made a mistake, then when do we reject the input instead of just putting up a notification like 'your capslock is on'
@phenomnomnominal the important part of that flow isn't checking if the email address is valid
 
@mintsauce yep, but that's one step harder to do
 
in an app where I validate so many other inputs (icd9 code, drg, etc) it just felt natural to want to validate that one, too.
 
1@gmail.com;2@gmail.com;3@gmail.com
 
4:20 AM
1;2;3;4;5;6;7;8;9;10;
still harder
 
it's a validation step that gains you nothing, but can potentially cost you users if they have a funny email address
 
Not harder, just not golfed. :-)
 
We tend to just check for an '@'
 
point taken.
 
Yeah.
 
4:21 AM
though.. i could allow emails without the @ for local addresses..
 
@mintsauce someone could manually enter numbers pretty quickly. Someone probably isn't going to manually input email addresses.
Obviously you can script it, but that's already got rid of a big number of potential people who want to fuck with it
 
Many thing can goes wrong when sending email from user input. I validate just to make sure it looks like a email, to prevent dumb mistakes. I would gladly accept asdf@example.com at validation stage.
 
@phenomnomnominal If you wanted to cause havoc, I doubt that would be a problem. I'd guess that most invalid email addresses are simple typos anyway.
 
@mintsauce never doubt people's stupidity and their wont to break stuff.
 
s/doubt/underestimate/
 
4:23 AM
doubt was your word :P
 
and if you allow any: some name <someaddress@domain.com> deal..
but i'm not bothering with all that.
 
You could just not ask for email addresses, and ask for ICQ numbers instead
 
now you are talking nonsense.
:)
 
90% of the time you can be certain I'm talking nonsense
like just then, it's actually closer to 73%
 
@david We still have to validate the ICQ number is a number ;)
 
4:29 AM
ah, but that's easy to do! just turn it into a string, add ".00" on to the end, and try convert it back to a number! and then do +0 and 0| and you've covered all possible cases
holyshit i need to go home v.v
 
I think you just came up with a solution that's harder to read than regex.
 
or you could just wrap it in a Maybe monad and then you won't care!
 
Get out
 
okay
v.v
 
:)
 
4:32 AM
Don't forget to put it in a Promise. It can be time consuming :)
 
i think you might need to use Either instead of Maybe actually...
 
Actually(Maybe(Sorta(Promise())))
.Perhaps()
.Meh()
 
4:58 AM
@Sheepy, @darkyen00 Its working beatifully on my iphone now. All I needed was to add html{ position:fixed } to my CSS.
There are, however, a few problems when my buttons are active now. Sigh lol
 

« first day (1643 days earlier)      last day (3307 days later) »