« first day (2882 days earlier)      last day (2083 days later) » 

12:09 AM
Hey yall, I am trying to run my test on my windows at home, rather than my mac at work
Yet it keeps failing
is there a terminal command that is the same as npm run e2e but for windows
"npm run e2e" is what I use at work
 
that's a custom npm run command
you might need to modify it in the package.json (or create a second one that's for windows)
 
"'.' is not recognized as an internal or external command,"
is the error I get
 
make sure you are in the correct folder before you run the command and that you have node installed
 
"scripts": {
    "e2e": "./node_modules/mocha/bin/mocha ./e2e --timeout 60000 --recursive",
    "test": "./node_modules/mocha/bin/mocha ./unit --timeout 60000 --recursive"
  },
Oh I believe windows uses different file path notation
That must be it
 
i would expect that to work
 
12:14 AM
Thanks both
Node version 9.4.0 is still most up todate?
 
10.9.0
 
@KevinB for sure a custom script, but I still cant seem to convert it to windows syntax
 
 
1 hour later…
1:46 AM
const TodoList = ({ todos, toggleTodo }) => (
  <ul>
    {todos.map(todo =>
      <Todo
        key={todo.id}
        {...todo}
        onClick={() => toggleTodo(todo.id)}
      />
    )}
  </ul>
)
Isnt that an error
or thats what react compiles
 
2:03 AM
wat
isn't what an error
looks fine to me
 
2:15 AM
@KevinB you know how to solve 3sum problem in linear time?
 
what's that
 
given an array of ints find all uniqe 3 numbers to add up to a target number
[1,0,1,3,5] target = 7 result [1,1,5]
 
jwt:

PROS/CONS on sending JWT in response body or in HTTP header? WWYD?
 
@rolu why would you do that?
 
@Rick why would I use JWT? For API authentication
 
2:26 AM
why would you put it in the header
 
jwts usually go in the Authorization header
 
@david =)
I guess either way works
 
You should really put it in the Authorization header
 
thanks
 
that's what libraries expect
 
2:31 AM
Yeah, Im going to switch it now. Thanks =p
 
Authorization: Bearer ${jwt}
 
yup
 
brain stopped working there for a sec, I meant to say body.
 
2:47 AM
@KendallFrey can this time complexity be factored down any further? O(n^(3/2)√(log n)
 
@KevinB don't worry about it, it's an Omega(n^2). Don't kill yourself trying to solve it.
 
i don't solve fake problems
 
@KevinB how did you know it was fake?
 
it has a name
 
2:57 AM
you mean that the problem is well understood?
 
a problem that is theoretical
academic
simply not interesting to me
 
you not interested in teoretical stuff. That's probably why you are such a fan of the kerbal space program
 
i mean
i'm bored of that game now
haven't played it in quite a while, now that it's just exploration without real progression goals
 
omg!!! so what do you do for fun now?
 
path of exile, wow, tv, etc
 
3:00 AM
I write code for fun
 
i did for a little while
but it started to burn me out, working all day coding and then going home to code some more
 
these are role playing games. you must be on a spirtual journey for meaning.
 
nah, just burning time
 
@KevinB done the new raid that got released yesterday?
 
have thousands of hours in these two games
 
3:03 AM
i'm trying to get back into wow but it's hard going
 
we did half of heroic, and a little more than that on normal
we finish it thursday, 2 day a week guild
 
damn not bad
what do you play?
 
fak you got precious' ribbon
we killed that fucker so many times and he only dropped one
 
i got it after the fact, went back to get the legendary an xpac or two later
 
3:06 AM
ah okay
i got him to 120 then stopped playing :(
 
i took the whole launch week off and nolifed it
 
there's a guy i work with who took off 3 days
i last played in wrath though, so it's actually really hard to get stuff set up the way i want it
and the thought of spending hours messing around with button layouts and ui stuff isn't really appealing :(
i miss raiding though
 
I don't think I've ever played a Blizzard game
 
their rtses are pretty good
diablo2 is also amazing
 
@JennaSloan you should
 
3:13 AM
@Rick none of them look fun though
 
@JennaSloan don't tell me you do real life fun stuff like snowboarding
 
d3 is fun in short doses
 
@Rick I've never even seen a mountain with enough snow to snowboard on
 
@JennaSloan why you live on an island ?
 
@Rick No, I live in this giant flat area called the "Great Plains"
It's pretty plain
 
3:21 AM
@jenna Sloan i have so many question, are there still byson that roam the "Great Plains"?
 
sounds great
 
@JennaSloan Do Indian Cherokees sill raid your settlement for horses and supplies
 
@Rick I can't say I've seen either of those
 
@JennaSloan I am very disappointed, at least tell me your favorit movie is "Dances with Wolves"
 
@Rick never heard of it
 
3:30 AM
OMG what kind of "Great Plains" person are you?
@JennaSloan What do you do out there for fun?
 
@Rick You mean besides writing code?
 
there's nothing down here, but i'm 3 hours away from the beach, new orleans, birmingham, montgomery, and 4-5 from memphis/nashville
plenty of places to go for weekend trips etc
 
@JennaSloan your pass time is writing code?
 
last one was up to columbus ohio... that was one hell of a drive. spent 5 days, 1 day there, stayed 2 days, then spent 2 days driving back. Stopped in tennessee at the jack daniels brewery
 
@Rick I also play video games sometimes
 
3:43 AM
@JennaSloan do you write interesting code. do you specialize in algo or machine learning
@KevinB was this like a family outing? did you drink a lot of jack daniels?
 
family, but there was drinking
 
why don't you guys do something interesting like swim with sharks.
climb mountins, wrestle a bear, etc..
 
 
1 hour later…
5:08 AM
Any one could please help me out for this question ?
 
maybe
 
0
Q: Calling callback function in recursive function in javascript facebook sdk paging

Abhi BurkI am working a small script in which I am fetching photos using facebook pagination.I am able to fetch it using pagination and pushing the result in an array called quotations. Below is my code in which I am struggling to call one callback function when pushing of data is finished in quotations. ...

 
put callback(quotations, albumName); into an else after your check for next
 
my fb account has 117 photos so at a time I canget 100 and then I have use next() pagination over here so for first 100 I am pushing it in an array then again calling fb.api and then pushing it until their is no photos
whatever u said I did but it sends only first 100 not all the push elements
 
5:39 AM
i am having this issue where i have "react": "^16.4.2", in my package.json but i'm still getting a UNMET PEER DEPENDENCY react@16.4.2
trying to install react-summernote (npmjs.com/package/react-summernote)
i also get:

npm WARN react-summernote@2.0.0 requires a peer of bootstrap@^3.3.6 but none was installed.
npm WARN react-summernote@2.0.0 requires a peer of react@^15.0.0 but none was installed.
but i have 16.4.2
 
@BenjaminGruenbaum lol don't worry i know him pretty well, we've met irl
 
6:07 AM
@stonerock Well, then I have to give you a second piece of advice to add to the first: don't piss off the people trying to help you. Accusing me of banning you didn't help your cause. Good luck with your problems or whatever.
 
Can chrome debug my webapp with simulating high latency network
Ok, I found then, thank
 
6:31 AM
@KevinB I already pointed him to that. He has troubles to debug properly. I quit to help him because he does not want to do some effort and lacks even the basic aspects of javascript. He is transforming in a help vampire.
 
yup
pretty sure that threshold was passed months ago
 
he also pings everyone. My wallet to give him some credit is empty :P
 
I would have been a lot more patient with him, had he not just outright accused me of having banned him
and after having helped him once already, geez the nerve
 
Hi guys, i'm facing a issue with subscribe and for loop in angular 5 where while i subscribe and console the result it show me the correct data but while the same data is gone through a loop it shows previous data.
@KarelG @nyconing pls consider
 
@VishnuSBabu Don't ping people for help please. If they can give help they will when they can
 
6:45 AM
can you show the relevant code? I believe that you have trapped in the famous scoping pitfall
 
Yeah, I was going to say.. sounds like a scope problem
 
Btw, you are free to ask question here, yet try to avoid that random pinging the next time. It is frowned upon.
 
1 message moved to Trash can
@VishnuSBabu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
sure i will do
this.notifications.subscribe(data => {
  console.log(data); // shows me the correct result
  data.forEach(element => {
    console.log(element.count); // shows me incorrect data
    if (element.count > 0) {

    }
  });
});
 
data is an array of objects. correct?
(just c/p over the output of console.log(data)
 
6:52 AM
@VishnuSBabu Assuming that data is an array of objects with .count, what you're saying is impossible.
 
dahell:
In today's episode of Fun™ with JavaScript: Global regular expressions remember the index of last match, and use it (+1) as the startIndex for the next .test(string) call, even if you're testing a completely different string. Also, .test() _doesn't_ take a startIndex param. 😱
 
@towc Yeah? RegExp are stateful objects, what of it?
 
that's not a behaviour I was aware of
I'm surprised no bugs of mine came from it
why is this a thing that happens?
 
why would you call test multiple times for the same match?
it makes sense to move on to the next match
 
Because RegExps, even though they don't look like it, are stateful, mutable objects.
Unlike strings, which look very similar syntax-wise, which are immuitable and not stateful
But yes, it is surprising at first glance.
Then again, almost anything from that time is.
 
6:56 AM
First ladies rule the State, then state the rule: ladies first.
 
@KarelG yea array of objects
data o/p's me--->
(4) [{…}, {…}, {…}, {…}]
0
:
{id: 1, name: "Alarm", count: 4, css_class: "critical-alert"}
1
:
{id: 2, name: "Warning", count: 1, css_class: "high-alert"}
2
:
{id: 3, name: "Caution", count: 0, css_class: "medium-alert"}
3
:
{id: 4, name: "Info", count: 2, css_class: "low-alert"}
length
:
4
whereas inside foreach i get element as
{id: 1, name: "Alarm", count: 0, css_class: "critical-alert"}
{id: 2, name: "Warning", count: 0, css_class: "high-alert"}
 
can you format it? :P
 
@KarelG @MadaraUchiha
 
Please do not ping randomly/often ...
 
const containsA = /a/g;
const expected = [true, true, false];
const actual = ['bac', 'abc', 'bc'].map((s, i) => containsA.test(s));
actual.every((r, i) => expected[i] === r);
// I totally thought this would be true
I guess this is another point to not using regexes in backend validation
why is it even this way?
 
6:59 AM
@VishnuSBabu You've already been warned
 
2
Q: How can I write this function without a bunch of if else statements?

Ali GajaniI basically just can't figure this one out and don't want to hack it. It will look so messy if I do this for 52 weeks in a year. Any tips? calculateUsersCurrentWorkoutWeek: function(timestamp) { let daysSinceSignup = moment().diff(timestamp, "days"); if (daysSinceSi...

Why did this get 2 upvotes? :o
 
sup sup
 
@VishnuSBabu your code should behave correctly. element are those objects and using element.count should give you the value of 'count' in that object
 
1 message moved to Trash can
@RohitSharma Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
!!> [{count: 0}, {count: 1}, {count: 2}].count
 
7:02 AM
@Neil "undefined"
 
1 message moved to friendly bin
 
count is a property of each element, not of the whole array @VishnuSBabu
 
@VishnuSBabu That is not possible with normal objects.
 
in your case
maybe you were thinking of length?
!!> [{count: 0}, {count: 1}, {count: 2}].length
 
@Neil 3
 
7:04 AM
@Neil i need the count from element
 
Which one: {{$variable}} or {{$variable$}}?
I like the first one better, but I think the second one would (theoretically) have a slight performance advantage
 
but as u see data is giving me the correct count but when i pass to foreach and individually print the count as element.count . its showing m e 0
 
@VishnuSBabu run this in console: [{count: 0}, {count: 1}, {count: 2}].forEach(el => console.log(el.count));
you will see that it should work correctly
 
@Shea It wouldn't be less performant if you always surrounded with brackets
 
oh I see
 
7:06 AM
the trick is knowing where the variable name ends :)
 
your data array suddenly got changed
// before
{id: 1, name: "Alarm", count: 4, css_class: "critical-alert"}
// in foreach
{id: 1, name: "Alarm", count: 0, css_class: "critical-alert"}
the count is suddenly 0.
 
Well the thing is, it's in PHP, and there's also {{&file/path/name.htm}} and {{#loops ...{{$var}} }}
I'm thinking it's going to see the performance boost in the nested brackets
 
@KarelG the data which i copy and console will show me the correct result but suddenly it changes or something other
@KarelG can be it of subscription
 
Instead of looking for }} finding it, and determining it's the wrong one, it can just look for the closing loop #}}
 
you need to check the access to that data object. It gets modified elsewhere
 
7:08 AM
@Shea why would it be the wrong one? you expect something other than a variable name there?
 
Be the {{$single_indicators}} are so much more sexier
 
so how? @kare
 
oh nested brackets
 
It would be the wrong one, because there would be more than one }}
 
usually you don't do nested brackets like that
you'd use only $var for instance
 
7:09 AM
Yeah, it's just for a quick and dirty little template parser
Well that could work, since we already know we're in the loop
 
@Shea wait when someone does doThis({{$i}})
 
1 message moved to Trash can
@RohitSharma Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
Not sure I follow. I think that would just be invalid
It's just parsed, not actually executed
Or evaled or anything like that
Uuggghh it's been too long since I dealt with PHP templates
 
I used twig
 
var newPromise = $.Deferred();
$.when(newPromise).always(function() {
console.log("Something");
});
Can we use always() here
 
7:13 AM
!!afk tinkering a server
 
@RohitSharma Don't use $.Deferred
Use native Promises.
 
7:35 AM
I have a couple of JSON Models, I want to change the names of their keys.
The keys for the "Title field" have different names, I want to change them to "title"
is this at all something I should do? At runtime?
 
If you don't want to do it at run time, you can build a simple script to do it once, and just output the JSON.stringify. Then save that as your model.
Probably shouldn't do it at run time though, if there's no need to preserve the original Title field
 
@snek I met him IRL too, just be cautious - trust me on that
 
@Shea I get the json models via an odata request and want them in a table on the view
 
@MadaraUchiha Why I should not use $.deferred?
 
He’s great but you need to be very careful
 
@RohitSharma Because you have normal Promises in the language
 
@Shea the different json models have different keys for the values I wan't to place in a table column "Title".
 
So you're saying you want {a: 1, b: 2, c: 3} to all go in one column?
Not really sure what the issue is with that, seems pretty straightforward
 
No, json model1 gets loaded {titleXY: 1, num: 45} and displayed in the table,
user performs action, json model2 {titleX: 1, num: 23}
my table has a path to titleXY for example and will not display json model2
.. maybe my data structures are shit :(
 
Are you aware of the following syntax?
var foo = {a: 1, b: 2, c: 3};

for (var bar in foo) {
	console.log(bar);
}
 
7:50 AM
if you want to do it at runtime, then there's an underlying problem here
 
Excuse the foo bar I've been working in PHP
 
@Shea Yes, you should avoid for..in
 
What's the alternative? I forget, it's been a while...
 
@Shea (for cosnt [key, value] of Object.entries(foo)) {
If you want both key and values
 
That seems right
 
7:51 AM
@Shea don't use while either ;)
 
You can use Object.keys() or Object.values() for just the keys or values respectively.
 
Hello. When I type npm -v I get 3.5.2. Is this what we call npm version 5?
 
No, this is what we call npm version 3.5.2
 
Thanks, but when I install the latest version of npm on Ubuntu, that is what I am getting ...
 
ubuntu always has a horribly old version of node
 
7:53 AM
@BillalBEGUERADJ The version in apt is out of date
Horribly so
 
I wrote it down so I won't forget again =3
 
doesn't it put it under /usr/bin/nodejs as well or something?
 
@MadaraUchiha hmm, maybe object.values but my json model is bigger than just {a: 1, b: 2}, many of the values I don't care about
 
Has the added bonus of not requiring root
 
7:54 AM
drake_bad.jpg npm version 5, drake_good.jpg npm 0.10
 
Thank you very much for the info. So I need to install npm version 5 on ubuntu 18 in a different way, I will check how
 
@BillalBEGUERADJ There's already an npm 6.4.x
 
8:09 AM
I always start reading a question at the end. If it ends with "Thanks in advanced.", generally, it pays out to have the close-vote dialogue open already.
 
Is it me or are let and const painful to use in node REPL ?
 
8:31 AM
@DenysSéguret Very.
 
@Cerbrus From a long time I was using an extension of my own on SO which was simply hiding all questions following some patterns (like containing "beginner", "thanks", "sir", "urgent", "bear", etc.)
var badQuestionPatterns = [
	/document\.write/,
	/beginner/, /newbie/, /plz/i, /please/i, /\bsir\b/i, /urgent/i, /bear with me/i,  /quick question/i,
	/enter code here/i,
	/bootstrap/i, /carousel/i,
	/thanks/i
];
 
"Thanks! This is an urgent question, sir. I'm a beginner so bear with me..."
 
var probablyBadQuestionPatterns = [
	/not working/i,
	/help/i
];
 
@BenFortune you miss the point. In my example there's a referenceError in the assignement when declaring
 
8:39 AM
u didn't do what he did, he assinged a non-existing variable to let x
 
Oh I get you
Also You*
 
9:02 AM
let x = 'undefined'
 
@DenysSéguret bootstraps are automatically bad questions? Does that imply that bootstraps should not be used at all?
or that those question ends with code dumps?
@DenysSéguret happens in dev console as well fyi
sorry for double ping
 
@KarelG I was the sole user of that extension, so I might have been a little more opinionated there than if I had shared it with others. The point was probably that bootstrap questions mere more often asked by lazy noobs
@KarelG no worry (and sorry for double reply)
 
9:34 AM
EA was/is also having problems with it, with their famous loot boxes system 😀
 
and they're eliminating the loot box system, because loot boxes will now be called something else entirely
 
> Also laughing, but in maple syrup.
canadian detected
 
Maybe someone can help me here. I have a html grid, and inside that grid I have a button with a onclick to a JS function. Once the button pressed. I want to read the value of the first cell of the clicked row. sounds easy but for some reason it's not working.
var articleColumn = ".td-Article";
var article = $(cell).children(ArtikelColumn)[0].innerText;

alert(article);
 
if you click on the button, don't you loose the focus of the row you clicked before?
you have to cache it
 
<th class="td-del"><i class="glyphicon glyphicon-remove" onclick="RemoveRecord(this)"></i></th>

You give the cell as param this right?
 
9:50 AM
hey everyone. quick question. Is it possible to export another module from a module?
 
@falcon sanity check, is your var name correct in code or did you make a mistake here?
 
like in a file you could do
 
@Falcon Is it a cell with a button, and the value is in another cell on the same row?
or we talking about the first cell of a table which is sibling to the button in question?
 
`import X from "X";
import Y from "Y";

const bundle = { ... X, Y }

export default bundle;
 
@KamilSolecki Oh sorry. I translated the dutch var to english, but the var names are correct
 
9:52 AM
is this possible?
 
I'm guessing it's the former, in which case, you need to get the parent row, then grab the first child
 
@Neil It's a cell with a button/span and the value is in another cell in the same row indeed.
 
$(cell).closest('tr').children(ArtikelColumn)[0].innerText
 
Thanks a lot
works
 
@Thaenor Have you tried it?
 
9:54 AM
np :)
 
@BenFortune not yet... Maybe I should pose the question in a little different way
 
Maybe you should try it
 
let's say we have an app that's a dashboard.
The users choose which graphs they want to see
and each type of graph is a different module. For the sake of it let's they're in react
with CSS modules, all clean and separated.
You'd have your dashboard.js - your main file. How would you write the code so it knows which components to import?
let's assume we have tens of different components and graphs.
do you import everything at the beginning. Read the user settings and then only call the ones you should?
or you could have a JSON that stores the user preferences... and based off of it you'd import what you need.
but then how would you know how to do import X from "userSettings.choosenComponent[i]" within a for loop?
 
10:11 AM
You'd use require
 
@Thaenor The first one... you import everything into an object and then select the components you need based on whatever dynamic data you want
 
But yeah, do the former
 
10:43 AM
Hey @Ben Fortunate, you there?
 
nope
 
how unfortunate
!!afk lunch
 
Ben, do you have experience with debouncing and throttling?
 
I do
 
Would you be able to help me with something in my React redux application?
 
10:47 AM
@Thaenor There's no magic here. You need to implement the dispatch
Be it with switch/case or some routing library to do it for you
 
Probably not
 
If you want code splitting, webpack supports that with the use of async import expressions
Example from our routing configuration:
 
Are you not well versed in react/redux? Or is it a time thing? or do you just not feel like it?
 
{
    path: '/jobs',
    name: 'jobs',
    getComponent: async () => (await import(/* webpackChunkName: "jobs" */'../../pages/Jobs/Jobs')).JobsPage,
  }, {
    path: '/sign-up',
    name: 'sign-up',
    getComponent: async () => (await import(/* webpackChunkName: "signup" */'../../pages/Login/LoginRouter')).LoginRouter,
  }, {
    path: '/sign-in',
    name: 'sign-in',
    getComponent: async () => (await import(/* webpackChunkName: "signup" */'../../pages/Login/LoginRouter')).LoginRouter,
  }, {
 
I've created a sandbox to test this out.
 
10:49 AM
@55Cancri The redux part
 
Well, actually, that is a very minor aspect of this
 
@Thaenor You can't really test this in a codesandbox
Because it's a concern of your bundler (usually, webpack)
 
And actually is not relevant to my issue.
 
And codesandbox doesn't do bundling
 
Can I post my code anyway and see what you think?
 
10:50 AM
!!welcome 55Cancri
 
@55Cancri Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
Caprica Six, thats the rooms bot right?
Did anyone else see this message or just me?
 
!!tell 55Cancri bot
 
@55Cancri I'm actually a bot, so don't reply to me.
 
!!tell Madara bot
 
10:51 AM
@Madara I'm actually a bot, so don't reply to me.
 
Gotta
Madara, I seek assistance!
O famed cofounded of Kohana village
 
@MadaraUchiha you're right, but I think this sort of works around my problem. In my scenario we're loading a web app and we have an env variable setting which type of web app it's going to look like. sort of if env.type = "mode1" I want the background to be blue and have this set of react components. other I want "mode2" which has a different CSS and set of modules.
the first idea was to dynamically require all the components we needed based off of a settings object. But it could also work if instead we bundle each set of components and then just choose dynamically which to import.
 
holy crap, awaiting imports. I've never seen that before
I thought the import statement can only be top level
 
it already exists, but not in the way I want to implement
I wanted something like
 
@Thaenor You want to do that at the build level
I suggest you actually use a different entry point for each "type"
 
10:55 AM
```
const myComponentPath = //getTheComponentNameFromSomewhere
import Comp from "./" + myComponentPath
```
 
@Thaenor Dynamic imports is a bad idea.
Almost always.
 
in this case the only way is to use require instead of import
so
 
@Thaenor Not true, and still a bad idea.
 
`const myComponentPath = //getTheComponentNameFromSomewhere `
`const Comp = require("./" + myComponentPath);`
what other options do I have?
 
@Thaenor Use a different entry point, which imports different files.
 
10:57 AM
a different entry point? How so? sorry, I'm not following
 
@Thaenor In your webpack config, you specify an entry point
The file which starts the entire app
That file imports other files, which in turn import other files, and so on
Following so far?
(Usually some /src/index.js or something)
 
yes, we're using next.js but iirc it has weback behind, so we should have access to those settings.
 
@Thaenor So what I'm suggesting, is that you create another such entry point file
 

« first day (2882 days earlier)      last day (2083 days later) »