These are chat archives for FreeCodeCamp/HelpFrontEnd

7th
Oct 2018
Fabien SHAN
@X140hu4
Oct 07 2018 03:45
@bradley1492 I don't get your question.
Raghav Mundra
@Raghav17
Oct 07 2018 05:03
Thanks @kamatheuska
Raghav Mundra
@Raghav17
Oct 07 2018 06:12
Hi Guys. I am making a landing page and trying to make it responsive. I have added a slider with a button in it and working great with the desktop version. But as soon as I try mobile version the button dissapears
What could be the possible issue?
Fabien SHAN
@X140hu4
Oct 07 2018 06:50
@Raghav17 Can't know for sure w/o the code.
gadzet
@gadzet
Oct 07 2018 11:47
anyone could help with promises and class inheritance
my base class is fetching data and sub class is using this data, do i have to resolve it two times ?
in the constructor of the base class and after the init ?
gadzet
@gadzet
Oct 07 2018 11:52
@ehutchllew u here ? I am trying to extend my class was wondering mabye you could give me a tip or two
Spyrantis Theodoros
@thodorisanta
Oct 07 2018 12:02

Can someone help me please?
I made a navbar-collapse with bootstrap for medium screens. Im pretty sure that my code is correct. But for some reason when i make the screen medium size. the toggler doent do anything. Can you tell me why?

https://codepen.io/oshikurou/pen/oazeEb

maybe i didnt plug in the right type of bootstrap in my codepen? idk
gadzet
@gadzet
Oct 07 2018 14:24
func1(param) {...}
func2(param1, param2) {...}

mapFunction(list, callback) {
 //....
 const something = 'blabla';
 // if callback has second param run callback(something, secondParam)
 return callback(something) 
}

mapFunction(list, func1);
mapFunction(list, func2); // send second param
is it possible to send a second callback param in the last line
Moisés Man
@moigithub
Oct 07 2018 14:25
.. u can put as many params as u like on ur function/call
gadzet
@gadzet
Oct 07 2018 14:25
how ?
Stephen James
@sjames1958gm
Oct 07 2018 14:26
If you passed another paramter into mapFunction, then pass it along to callback
Moisés Man
@moigithub
Oct 07 2018 14:26
function myfun(p1,p2,p3,p4,p5){
  // do stuff
}
myfun(1,2,3,4,5)
Stephen James
@sjames1958gm
Oct 07 2018 14:26
mapFunction(list, callback, param) {
 //....
 const something = 'blabla';
 // if callback has second param run callback(something, secondParam)
 return callback(something, param) 
}
gadzet
@gadzet
Oct 07 2018 14:27
is it the only way ?
Stephen James
@sjames1958gm
Oct 07 2018 14:27
Another option is to make the mapFunction parameter the second parameter and use bind
gadzet
@gadzet
Oct 07 2018 14:27
would be nice to send it with callback
could you please give me an example
Moisés Man
@moigithub
Oct 07 2018 14:28
arrow function n build ur "callback" function inline (work same way as bind)
Stephen James
@sjames1958gm
Oct 07 2018 14:29
mapFunction(list, func1.bind(null, param));
This passes it as the first parameter though
Moisés Man
@moigithub
Oct 07 2018 14:30
myfun(111, (param)=>{fun1(param)} )
gadzet
@gadzet
Oct 07 2018 14:31
ok thanks guys then check the func length to see if its one or two or is there a cleaner way
and inside the func1, how to i get this param ?
gadzet
@gadzet
Oct 07 2018 14:37
@sjames1958gm it gives me e.reduce is not a function
Stephen James
@sjames1958gm
Oct 07 2018 14:37
@gadzet Can you show the code - there was no reduce in the already posted code
gadzet
@gadzet
Oct 07 2018 14:38
return this._mapStocks(stocksData, this._calculateBollingerBand.bind(null, accumulator));

private _calculateBollingerBand(stockInterval, accumulator) {
    return accumulator(CMath.MeanFromArray(stockInterval), (CMath.StandardDeviationFromArray(stockInterval) * 2));
}

private _mapStocks(stocksData: IStock[], callback: any) {
        return stocksData.map((stockData: IStock, index): IStock => {
            const stockInterval: number[] =  stocksData.slice(index, (this.getRange()+index))
                .map((stock: IStock) => (stock.last));
            return {...stockData, last: callback(stockInterval)}; // _calculateBollingBand(stockInterval, accumulator) 
        });    
    }
reduce is rank by these Cmath functions
so probably the first value is null
Stephen James
@sjames1958gm
Oct 07 2018 14:40
Because you are using bind the accumulator will be the first parameter not the second
gadzet
@gadzet
Oct 07 2018 14:41
shouldn't null pass trough the first ? :)
Stephen James
@sjames1958gm
Oct 07 2018 14:41
null is the 'this' value
Moisés Man
@moigithub
Oct 07 2018 14:42
reduce is an array function.. so u need to make sure e holds an array
Stephen James
@sjames1958gm
Oct 07 2018 14:42
maybe add a log to _calculateBollingerBand to see what each value is
gadzet
@gadzet
Oct 07 2018 14:42
i've switched params and it works like a charm
thanks alot
Stephen James
@sjames1958gm
Oct 07 2018 14:47
Cool :+1:
shivendrarox
@shivendrarox
Oct 07 2018 16:58
Hi, i am very much confused on p1xt guides,which one should i take?
Christopher
@bradley1492
Oct 07 2018 19:58

Hello, does anyone know, why my images seem to have padding to the left?
Like my two headings are more on the left while the images seem to be removed from center?

https://codepen.io/bradley1492/pen/GYNojZ?editors=1010

Nicolas Ramirez
@kamatheuska
Oct 07 2018 20:00
@bradley1492 bootstrap?
Christopher
@bradley1492
Oct 07 2018 20:01
@kamatheuska yes I am using bootstrap..
@kamatheuska is bootstrap moving my img items for some reason?
Nicolas Ramirez
@kamatheuska
Oct 07 2018 20:03
.col-4 has a padding-right: 15px; padding-left: 15px
the divs containing your images
there is your padding
.col-4{
    padding: 0
}
@bradley1492
Christopher
@bradley1492
Oct 07 2018 20:06
@kamatheuska oh thanks, is it common to reset these 15px of padding at the beginning of coding, as I understand all elements in bootstrap have padding of 15px?
Nicolas Ramirez
@kamatheuska
Oct 07 2018 20:06
mmm I wouldn't do that
global changes produce unexpected results...that is mainly why I don't use bootstrap, since I don't think it is worth it to learn all there specs
I would even target that padding specifically, like .container .col-4 or smh
Christopher
@bradley1492
Oct 07 2018 20:12

@kamatheuska okay so I just mess with the padding if I need it for an element?
Okay I will taget it like that.
So I should be cautious with global css changes..

I don't really know, I wanted to learn Bootstrap and so far it seems like an interesting experience. Before I always coded just with css. There's quite a bit of stuff that seems very usable if I ever need it.
I sort of thought I could finish this project with bootstrap and then for the next one decide for myself what I want to use, as I went through flexbox and css-grid a bit before..

@kamatheuska Are the 15px padding also the reason why my border on top of the lorem ipsum is not spanning across the whole container but being cut off each side for a tiny bit?

https://codepen.io/bradley1492/pen/GYNojZ?editors=1100

Christopher
@bradley1492
Oct 07 2018 20:24
@kamatheuska Sorry was the wrong link, here is what I meant https://codepen.io/bradley1492/pen/GYNojZ?editors=1100
Danny McVey
@dannymcvey
Oct 07 2018 20:45
Hi folks. I’ll be on fCC for a little bit and am willing to help with HTML or CSS questions.
Danny McVey
@dannymcvey
Oct 07 2018 21:26
Signing out...
DerMann97
@DerMann97
Oct 07 2018 22:45
Hey guys