« first day (2107 days earlier)      last day (3066 days later) » 

00:27
Hey, on a scale of 1 to PHP, how horrible would you say it would be to use CSS comments and JS to emulate CSS variables?
I've made a tiny script which allows you to define variables like this:
/* CSS code */
.button-primary {
  background-color: /*accentColor*/ blue;
}

/* JS library call */
cssSet('accentColor', 'red');
So far I'm using it to make a blog have random accent colors on each page - and because using compiled CSS with a tumblr theme isn't very practical.
m59
m59
1 to PHP. hahaha
I don't get what you're trying to do, though.
00:46
Perhaps an example will help: jsfiddle.net/mh7j6cqe
I'm using comments in the CSS to make some values easy to replace via JavaScript. In a way, this can replace compile-time variables offered by SASS or Less and various other CSS preprocessors.
hey guys I need some help with some javascript
@gx2g Welcome to the JavaScript chat! Please review the room 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.
m59
m59
I think once you start thinking about JS and CSS, just go all the way and do it all with JS and no CSS.
var cDate = new Date("01/01/2014");
var eBday = employees[0].birthdate;
var total_days = (eBday - cDate) / (1000 * 60 * 60 * 24);

document.getElementById("birthDays").innerHTML = total_days;
I get NaN and I can't figure out why this isn't working
Yeah, I guess...
Perhaps my code really has little use outside of tumblr and other hosts/frameworks which limit your freedom.
my object array is var employees = [
{"internalid":"1", "name":"Abe Anderson", "email":"[email protected]", "birthdate":"9/25/1974", "supervisor":"3", "2012 Revenue":"100000.00", "2013 Revenue":"0.00"},
{"internalid":"2", "name":"Bob Benson", "email":"[email protected]", "birthdate":"7/13/1972", "supervisor":"3", "2012 Revenue":"150000.00", "2013 Revenue":"0.00"},
{"internalid":"3", "name":"Chelsea Chastain", "email":"[email protected]", "birthdate":"5/7/1968", "supervisor":"", "2012 Revenue":"375000.00", "2013 Revenue":"0.00"},
I'm trying to calulate how many days left till birthday from a date I choose.
in this case var cDate = new Date("01/01/2014")
@m59 Interesting. I'd have to look into it some more.
i have it in a for loop like this
for (var i = 0; i < employees.length; i++){

var cDate = new Date("01/01/2014");
var eBday = employees[0].birthdate;
var total_days = (eBday - cDate) / (1000 * 60 * 60 * 24);

document.getElementById("birthDays").innerHTML = total_days;
Well, for starters you should write the dates in a proper format.
you mean 1968/7/5
Chrome seems to recognize your syntax correctly, but no. I mean using the iso date format, which is YYYY-MM-DD.
will be treated as a local date of 25 November, 2015 in Firefox 30 and an invalid date in Safari 7. However, if the string is recognized as an ISO format string and it contains invalid values, it will return NaN in all browsers compliant with ES5 and later:
@JABFreeware Yeah, I'm in Québec, Canada and here the popular format is DD/MM/AAAA. At least, that's what my teachers taught me in primary school. When I learned that in the US they swapped day and month I switched to always using the iso format.
I'm still getting NaN though
var employees = [
{"internalid":"1", "name":"Abe Anderson", "email":"[email protected]", "birthdate":"1974/9/25/", "supervisor":"3", "2012 Revenue":"100000.00", "2013 Revenue":"0.00"},
{"internalid":"2", "name":"Bob Benson", "email":"[email protected]", "birthdate":"1972/7/13", "supervisor":"3", "2012 Revenue":"150000.00", "2013 Revenue":"0.00"},
{"internalid":"3", "name":"Chelsea Chastain", "email":"[email protected]", "birthdate":"1968/5/7", "supervisor":"", "2012 Revenue":"375000.00", "2013 Revenue":"0.00"},
Your employees birthdates are strings, not numbers. You need to convert them to dates (in the right format) before you can compute the difference.
01:04
awww I was missing a step ok let me do that then.
You might want to use a regex for that. If you've never done that... you better look for tutorials. It's tedious to explain, but super useful.

Or you can just split your strings using "/" as a separator.
(unless your data is fictional and you can actually store it in the iso format, in which case your problem is solved)
I want to convert to string split I think and then store the value back to the object array
then display that updated value from the updated array back into the html page
lots of fun :)
01:20
Are there any native English speakers? Is it natural to say "This group is primarily for JavaScript"?
@ZhengquanBai Yes
@KendallFrey Thank you!
what r u shocked for
epic reddit comments
02:23
@KendallFrey didn't know you came here
 
1 hour later…
m59
m59
03:29
@deltab I used this as my entrypoint and it solved the issue github.com/Yelp/dumb-init
 
3 hours later…
06:27
FB released react-create-app woop woop
Okay by now, I'm sure we're writing a book.
 
1 hour later…
07:46
is there an alternative for using Object.assign() if I need to merge two value objects?
What is the data type of what’s got from requiring a JSON file?
@tereško I think jQuery.extend might be a choice
or you can implement that merging yourself
I think you didnt understand the question
what I'm looking for is a different way of doing foo(Object.assign(global_config, local.config));, because it is not immediately obvious what Object.assign() does
I think it's pretty obvious to anyone familiar with ES6 what Object.assign() does
there is a huge skill disparity in the dev team I work with
there are alternatives, like using Reflect in preference to Object, but in your case Object.assign() would be the idiomatic approach
07:53
some of those people havent learned anything new in close to 10 years
Time for them to learn then
$.extend
I can always learn new English words from talking to you guys.
so it would look something like defaults(global_config, local.config)
07:56
that doesn't really help much
I was hoping there was something like foo + bar as an option :D
that's how I do it in PHP with arrays
defaults(options, overrides) is best I can think of
Implement a function that does what Object.assign does using ES5 or older JavaScript.
^ yeah, but that would be a bit fugly, which is the exact reason we got the Object and Reflect helpers
@ZhengquanBai you seem to be confused. I am using ES2015
@tereško so what?
07:58
for instance, it's super fugly to iterate the object's own properties to get their values, which is why we will get Object.values(obj) in the future
You don't have to use every new feature the latest version of a language brings.
@FilipDupanović for..of
@tereško ES6 proposal was released as ES2015, ES7 is ES2016 and ES.Next will be ES2017
I know that. Your team members haven't learnt new technologies for a long time. It would be better to implement new functionality using old technologies so that they can understand what's going on.
I am leaning towards the "fuck 'em" option instead
Object.assign() then :P
08:00
yes
Or just explain to them what Object.assign does, it shouldn't be a difficult api to reason about.
@JanDvorak whoops, sorry, brainfart, didn't mean to get an iterator of the values, but to get an array of
Then yeah. But you still have Object.keys(o).map(k=>o[k])
agreed, but an internal helper Object.values(obj) will be more concise and should be preferred from then on
function mergeTwoObjects(a, b) { return Object.assign(a,b) } "problem" solved, now it's obvious to people who don't know Object.assign what's going on.
08:15
What is a "CREATIVE WAY TO CLONE JSON"
@cswl probably this
Object.assign({}, source) for a shallow copy
lol........
08:18
stringify then parse xD
The whole SO Docs thing is a result of StackOverflow devs being way too impressed with "Twitch plays Pokemon"
10 ways to say hello in javascript... really?
@littlepootis why'd you approve :(
I rejected that
DID I APPROVE IT?
IM ON MEDS.
oh I didn't
brb, adding one with new SpeechSynthesisUtterance()
(no, not really)
The doc is turning into JavaScript The Definitive Guide..
08:24
You misspelled W3Schools
Hey guys, is anyone good with Vue.js? I have a lot of weird this going on with my app.... >.>
I meant a big book of everything about JavaScript from basics to apis... no offense to the book..
@tereško SO citizens write documentation
Why would I care about what the alert function returns when I just want to output hello world..
Golfing :-D
08:31
@cswl oh lol
"Currently it just looks like a bunch of random topics:" That's how it's supposed to look. That's how Docs.SO works; it's an unorganized grab-bag of random factoids. That is by design. The makers of this project are under the impression that what the Internet is really lacking is peer-reviewed documentation that has absolutely no structural organization. So that's what we've got. — Nicol Bolas 17 hours ago
that
@ivarni it does have structural organisation. It is categorised by language.
s/absolutely no/minimal/ then
@ivarni yes, I already commented on that :P
It's still a mess right now and it's not terribly useful or easily navigated
And as a result there's duplication everywhere
08:41
duplication is not an issue
Can I hire someone (skype) for some VUE questions?
I have so many weird things going on with my app. I'd like to skype with someone, have a look at my code, and explain to me what's wrong. I could pay some money through PayPal!
... unlike people suffering from dunning-kruger
Well, right now.. it's a guide and an api reference.. at least for JavaScript..
language reference..*
I feel like "a heap of question/answers pairs" a keystone of SO, isn't it?
08:57
And hence SO docs are exactly that, just renamed and slightly restyled
var h=$(".left").height();
$(".right").css({height: h});
@PrabuLakshmanan Welcome to the JavaScript chat! Please review the room 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.
questions are "topics", answers are "examples" .. That makes sense...
is it correct?
depends on the meaning of "correct"
this won't throw a syntax error, and it will even attempt to set the height of every .right to the current height of the first .right
09:00
It's not supposed to be... "Array" topic and then 34 examples of "everything you can do with arrays" ...
but sometimes it throws error like "TypeError: $(...) is null"
jQuery() should never return null. Fiddle?
let me try again
how to create slider with use of pure javascript?
such as the one that appears automatically when you use overflow:scroll?
09:17
> So many speling mistakes n logical erors
Ironical.
@littlepootis Are you reviewing?
so documentation is all about examples and rep.. mostly rep.
They should just remove the "gaining rep" thing.
Hi, any node experts here?
09:25
@littlepootis I feel like I've seen that somewhere already
"rep is a motivating factor", not for those who just want to help
My problem is this: I'm trying to run node for the first time. So i chose this example https://scotch.io/tutorials/building-a-slack-bot-with-node-js-and-chuck-norris-super-powers . I've created the files and understood the code. Now I want to run the script so this would be a nice try :D The error is:
.run();
^
TypeError: undefined is not a function
morning guys
got a problem need some help from some js pro's
// A Arrays
const arrayA1 = [{name: "James"}, {name: "John"}, {name: "Jack"}]
const arrayA2 = [{age: 10}, {age: 20}, {age: 12}]

// B Arrays
const arrayB1 = [{name: "James"}, {name: "John"}, {name: "Jack"}]
const arrayB2 = [{age: 10}, {age: 20}, {age: 12}]
const arrayB3 = [{height: 150}, {height: 200}, {height: 180}]

const result = {}
const result1 = {}

// Mapping Function A      --------- How can i make the  SAME function work for both A and B arrays
arrayA1.map((x, y) => {
  let abc = [x, arrayA2[y]];
appreciate any help. thanks :)
@David that should give a line where the error occurs.. check some stuffs about debugging in node.js
@cswl Its line 25 => norrisbot.run(); I will try to debug why the method is undefined.
10:13
Great.. someone put up a lure at the pokestop outside my window, how am I supposed to work under these conditions?
home office if actual office and vice versa
I suppose I could just close the app as well
I ... guess so. I thought you were annoyed by the noise?
Well I want pokemons but I also want to work. Phone vibrates when one shows up and they show up a lot when there is a lure
Normally there's one every hour or so and that's not too distracting
They should ban pokego and promote geocaching
10:32
!!>Math.sqrt(43.88/0.78)
@JanDvorak That didn't make much sense. Use the !!/help command to learn more.
@JanDvorak 7.500427338252818
11:34
@rlemon i'm using your color scheme - looks so cool
@rlemon (your Chromium plugin)
 
3 hours later…
14:56
Anyone has any experience with inflatable Jacuzzis? I want a Jacuzzi for my roof and the "real" ones start at ~$4000 and the inflatable one is for $1000
Who am I talking to, everyone is out playing Go
@BenjaminGruenbaum Remember when "playing Go" meant a complex board game?
Oh, you mean the new Go?
I think this is an XY problem. What are you trying to accomplish with this jacuzzi?
4
Yeah, maybe you don't need a Jacuzzi at all
Try to really understand what your problem is first
15:07
does anyone have a good link with all the implementations before CSS made it into the standard?
Cascading Style Sheets, level 1
W3C Recommendation 17 Dec 1996, revised 11 Jan 1999
Do not try to inflate the Jacuzzi. That's impossible. Instead, only try to realize the truth.... @BenjaminGruenbaum ... There is no "real" Jacuzzi.
there was an article outlining like 10 non-standard implementations, but I can't find it
15:38
0.o I'm going to have to write some proper code documentation
I'm screwed
I have no idea why most of my code is there
lol, why don't you know?
it's a joke, but still
I don't think I can explain really well why my code is there
without pointing to articles or similar
Try :p
it's just crunched maths
and the doc is mostly to be read by people who don't maths
15:58
@towc it's not about the code, it about what it does, and what can it be used for.
i'm nearly free of jquery. I just have a few controls (date picker, etc) that use it left..
I look forward to the day I can: npm uninstall jquery --save --forever
unknown flag "--forever". Did you mean "--forget"?
16:16
maybe the jQuery docs can shine some light onto the issue
@Luggage good luck!
i'm also trying to move off jquery.. a coworker yesterday told me "i'm going to rewrite this form validator in jquery.. it's easier"
):
I'm pro-jQuery
@JanDvorak it's okay
I'm not apologising
lol
a big problem i find is old projects say using 1.8, and then switching to a newer project that is using 1.12 and the code you're taking across doesn't -quite- work
or visa versa
i know that's with every framework, but people seem to forget this, and i've been cleaning up / fixing 'broken' scripts etc.
so my critique atm isn't a critique on jquery, i guess
so yeah, carry on
16:33
Our upgrading strategy is "sure go ahead, as long as you don't commit something that doesn't work."
2
haha nice
it's like "i have this jquery plugin and i've stuck it in here and it looked great and it's live but now we found that the click events are firing twice on mobile in it"
@JanDvorak i want to write this into a post commit git hook
go ahead
16:53
God, this pokemon Go is a disease.
17:12
I was just playing it :d
 
2 hours later…
19:16
Is it possible to get custom variable's from a connection in an array? e.g: Will clients[0].score work and if not, How can I get it working
@RowanHarley When you ask a question, you have to explain what you're talking about. We're not mind readers here.
@KendallFrey Sorry, I'm working on a Node.JS Matchmaker. I want to check the other player's scores then match them accordingly
@copy I'm slightly disappointed in season 2 of Dr. Robot so far, but the church group speech was pretty good
 
1 hour later…
20:46
@SomeGuy Did you listen to the 2nd season of Serial?
Just started the 4th episode, it's really good. Different than the 1st season.
21:34
do you know those websites where you land on a thing that takes up the whole window screen exactly, but then as you scroll down there's more content?
can't remember any, but I'd like to see a few to understand the design choices affiliated...
21:58
@towc Like oculus.com?
it don't fit the screen, but the design is about the same, yeah
and found them, thanks anyway
It fits my screen vOv
lucky fella :P
more like this: ninjahost.no
funnily enough I didn't make that site
22:37
I'm leaning towards something like Express for lightweight team messaging to integrate into my team portal, e.g. For things like "Hey grab this ticket" or "Team meeting" ... any other suggestions besides Express?
22:56
Any way I can pass state props from another component to another?
I've got a prop from, say, a component called Test, this.state.url. How can I pass that in a function to, say a component called Test1?
what is their relationship?
Let's see..
Same directory, siblings?
directory doesn't matter, how are they related in your "dom".
What do you mean exactly?
<Test />
<Test2 />
//or
<Test>
    <Test2 />
</Test>
etc
23:01
Ahh
Parent child
a child passed in like above, or in Test's render() method?
I've got react router setup like this:

Parent route, one with component with url prop
Child route with component I want to pass url prop to
ohh, react-router.
Yeah, sorry forgot to mention
can you just give me a couple lines of code? i'm getting bored of guessing what you have
23:04
Sure, wait a sec
@Luggage Not sure if it's enough, but: hastebin.com/ezadamules.js
can you add the render() of TopbarContainer ?
so.. that is how you can apppend props to children that were passed in from the outside.
I am not so sure it's the best solution for a url, though. wouldn't that come from react-router?
The thing is I wan't some static component on every page, but have the other components direct to external pages
oops, that's supposed to be {newChildren} not {this.props.children} still
23:17
Yeah, caught that :)
then can't you put the static component outside react-router?
How so?
<div>
    <StaticComponent />
    <Router> ...
not sure if it works that way..
I've only seen it done with react-router, so I'm not sure how you'd do it otherwise.
I don't use react-router, so that might be wrong
23:19
Hmm, that may work
Is it possible to change the address of the page of a specific component?
i don't follow
Not sure how to describe it, is it possible to have a static component wherever you go, but have a component that is dynamic redirect to a different page?
to answer that, first you must know whether has anyone really been far even as decided to use even go want to do look more like?
Couldn't understand clearly, could you explain?
exactly
23:25
:)
23:38
critics? A logo for a friend's company: codepen.io/towc/pen/kXJLZE
(not the one at celestialsecurity.com, they still suck)
C a bit too big?
hate the padding on the right, but can't just shift it by decentering the text
@towc A tad. I'd line it up with the top of "Cyber Security"
@KendallFrey would then possibly look too blocky? Maybe below the top of cs?
You can make it the same size as the rest if you want
the position of "cyber security" is weird too
I like the larger C though
23:49
@phenomnomnominal aligning it to the right really won't help anything
Overall it's a nice design
centering will make it so much worse
thankss
still seems awfully off
I don't really know why it's above tbh
@towc What about putting it below the text, inside the loop of bits
it's not cyber security celestial
and then move the loop to the left a bit
23:50
so this doesn't work either?
I don't think it works as well as it could
so, have it below and centered?
(talking about celestial)
also, maybe I should use another font?
that's verdana
ubuntu monospace for bits
papyrus
below and left aligned
@Luggage good idea
23:52
@towc I think it works, it's just a little unintuitive to read as a whole phrase
inb4 comic sans
then have the C sit between the start and end of the loop
comic papyrus*
@towc Yeah I was gonna suggest a font without the slash through the 0
They're obviously zeros so the slash isn't important in that sense
true
@phenomnomnominal as if the loop started from the C?
@KendallFrey any particular one?
imply it, but don't make it look like that
23:54
@towc None in mind
"it's not what it looks like" screamed the C as the user looked at the logo
the idea was to make the loop seem galaxy-like (celestial → space), but that's clearly not getting through, right?
making it originate from the C would completely kill that idea
but yeah, could make it look better
@towc Yeah that wasn't obvious
it has no centre
Obvious logos are kinda cheesy though
well, I may have to change the whole logo to have something celestial-like then :/
Throwing that away would be kind of a shame...

« first day (2107 days earlier)      last day (3066 days later) »