These are chat archives for FreeCodeCamp/HelpFrontEnd

13th
Mar 2018
Asher
@AJB14
Mar 13 2018 00:04
Hey I'm try to learn visual basic and in my textbook there is a project where I need to make a program the when you enter your name as lastname,first name it will switch the names places and remove the comma I cant seem to find out how to do this any help would be appreciated.
Ken Haduch
@khaduch
Mar 13 2018 00:55
@AJB14 - I don't know visual basic, at least haven't looked at it in years - look at string manipulation functions (I might try to google and see what hints I could give) but something like a "split" method or function, that's where I would start.
Ken Haduch
@khaduch
Mar 13 2018 01:00
@AJB14 - this page looks like it would be what you want to use - "Split" and you specify a delimiter, it returns an array of the strings that are found. There is "RTrim" and "LTrim" to remove leading and trailing spaces. Then a "Join" to form them back to a string, or maybe just concatenate them using a space in between the two words.
Nick
@rhozeta
Mar 13 2018 01:08
Hey, can anyone help me out! I am trying to do authentication with JsonWebToken and Passport, but I keep getting this error after applying passport.authenticate to my route:
(node:2624) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): CastError: Cast to ObjectId failed for value "undefined" at path "_id" for model "Post"
(node:2624) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Here is the strategy:
var opts = {}
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken()
opts.secretOrKey = 'theysaidnmlmlm'
opts.issuer = 'accounts.theysaid.co'
opts.audience = 'theysaid.co'
passport.use(new JwtStrategy(opts, function(jwt_payload, done) {
  User.findOne({id: jwt_payload.sub}, function(err, user) {
    if (err) {
      return done(err, false)
    }
    if (user) {
      return done(null, user)
    } else {
      return done(null, false)
    }
  })
}))
Abraham Andres Luna
@geniusFunk
Mar 13 2018 01:47
You could always browse the internet for more resources and tutorials about what you need to build. i like codeproject
@jvondarke try codeproject
@rhozeta I don't see the where you define the 'done' variable
Ryan Williams
@Ryanwfile
Mar 13 2018 01:54
Can someone please help me with this div background image moving, the image moves as text appears and I just want the image to stay still, any help is greatly appreciated https://codereese.com/
Abraham Andres Luna
@geniusFunk
Mar 13 2018 03:02
@Ryanwfile body {
background-image: url("img_tree.png");
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
The fixed position will stop it from scrolling
Ryan Williams
@Ryanwfile
Mar 13 2018 03:02
@geniusFunk Thank you so much, tried editing so much CSS in the inspector and couldn't pinpoint it
CamperBot
@camperbot
Mar 13 2018 03:02
ryanwfile sends brownie points to @geniusfunk :sparkles: :thumbsup: :sparkles:
:cookie: 13 | @geniusfunk |http://www.freecodecamp.org/geniusfunk
Abraham Andres Luna
@geniusFunk
Mar 13 2018 03:03
Thx for da brownies @Ryanwfile
What IDE are you using?
Ryan Williams
@Ryanwfile
Mar 13 2018 03:11
@geniusFunk The site is on wordpress
Ryan Williams
@Ryanwfile
Mar 13 2018 03:21
@geniusFunk I have tried that css in a few locations in the chrome inspector and can't seem to fix the image moving issue, where specifically should I use this css?
Abraham Andres Luna
@geniusFunk
Mar 13 2018 04:29
@Ryanwfile use that css on the div class definition
Let me fire up the laptop and review your code
Ghost
@ghost~5928d90bd73408ce4f629b9e
Mar 13 2018 04:59
does anyone know useful links for understanding authentication in express just the basic without using mongoose for modelling.. every tutorial i find uses this piece of #### like the writers just copy paste each other
Ali Bulut
@ali27001
Mar 13 2018 07:03
image.png
image.png
how can I do that
circle image hover bla bla
do not care about the picture behind
i want to give hover into circle and add icon into
Fabien SHAN
@X140hu4
Mar 13 2018 07:11
@ali27001 You could have a div for the background image, a nested div that shows on :hover.
Ali Bulut
@ali27001
Mar 13 2018 07:26
Is there any example I can look at
Fabien SHAN
@X140hu4
Mar 13 2018 07:26
The image you posted?
Marianissimus
@Marianissimus
Mar 13 2018 07:29
@ali27001 A div over a div over a div / OR pseudo-classes - before & after
Frosty427
@Frosty427
Mar 13 2018 07:31
@Frosty427
image.png
why does my hamburger button get pushed to the side on mobile?
is it the padding of the colorful flaT?
https://codepen.io/Frosty27/pen/rdVqJb
nvm
founf it
Edy1988
@Edy1988
Mar 13 2018 07:32
hi guys check out my portfolio page! https://codepen.io/EdyB/full/eMNPqO/ . Its not pretty... design is not my strong point yet. x
Marianissimus
@Marianissimus
Mar 13 2018 07:33
@Edy1988 Hi, I like the colors - the pink and the light blue:)
Fabien SHAN
@X140hu4
Mar 13 2018 07:33
@ali27001 quick and dirty example: https://jsfiddle.net/36e6tcwm/3/
Edy1988
@Edy1988
Mar 13 2018 07:34
@Marianissimus hi thanks! I really struggle to choose fonts and colours
CamperBot
@camperbot
Mar 13 2018 07:34
edy1988 sends brownie points to @marianissimus :sparkles: :thumbsup: :sparkles:
:cookie: 481 | @marianissimus |http://www.freecodecamp.org/marianissimus
Marianissimus
@Marianissimus
Mar 13 2018 07:36
You're welcome. Next time, maybe try to take care of the layout more - margins, centering, etc. Find a site that inspires you and try to copy it.
Edy1988
@Edy1988
Mar 13 2018 07:36
@X140hu4 this is cool!
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 07:36
@Edy1988 Do you want a colours guide?
Someone sent one to me yesterday... its a palette maker kinda thing
Edy1988
@Edy1988
Mar 13 2018 07:37
@Marianissimus yes! good point, otherwise it takes too much time to try and come up with a lay out. Thanks!
CamperBot
@camperbot
Mar 13 2018 07:37
edy1988 sends brownie points to @marianissimus :sparkles: :thumbsup: :sparkles:
api offline
Fabien SHAN
@X140hu4
Mar 13 2018 07:37
@Edy1988 CSS is pretty powerful haha. If you browse around codepen you can find some amazing stuff
Edy1988
@Edy1988
Mar 13 2018 07:39
@MuhammedKarim sure, although choosing the right ones is the problem for me... ha
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 07:42
Fabien SHAN
@X140hu4
Mar 13 2018 07:43
@MuhammedKarim Pretty cool
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 07:44
@X140hu4 Obviously it is coz @mstellaluna sent it to me!
Frosty427
@Frosty427
Mar 13 2018 07:44
image.png
how do i get that text centered?
(text-center didnt do it)
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 07:44
text-align:center @Frosty427
Marianissimus
@Marianissimus
Mar 13 2018 07:44
Or this - with palletes votes: http://colorhunt.co/
Frosty427
@Frosty427
Mar 13 2018 07:44
image.png
trying to make it look like this
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 07:46
@Frosty427 Have you put each one in a separate container?
Frosty427
@Frosty427
Mar 13 2018 07:46
@MuhammedKarim why would i do that?
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 07:47
@Frosty427 Wouldn't that be the best way to design them as above?
Zara Otamias
@zotamias
Mar 13 2018 08:04
Hi! I would love to have some feedback on my weather app project. I'm still working on it & making some changes, so feel free to add suggestions/opinions. https://codepen.io/zotamias/full/jzEZye/
Keone Martin
@Athaman
Mar 13 2018 08:09
@zotamias looks good to me.
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 08:11
@zotamias :+1:
Zara Otamias
@zotamias
Mar 13 2018 08:30
thanks @Athaman
CamperBot
@camperbot
Mar 13 2018 08:30
zotamias sends brownie points to @athaman :sparkles: :thumbsup: :sparkles:
:cookie: 625 | @athaman |http://www.freecodecamp.org/athaman
Zara Otamias
@zotamias
Mar 13 2018 08:31
thanks @MuhammedKarim
CamperBot
@camperbot
Mar 13 2018 08:31
zotamias sends brownie points to @muhammedkarim :sparkles: :thumbsup: :sparkles:
:cookie: 144 | @muhammedkarim |http://www.freecodecamp.org/muhammedkarim
Aleksandar Zdravkovski
@azdravkovski
Mar 13 2018 08:57
Hi guys. I'm trying to work out a RegEx that would match the following pattern: &A or &E or &EF or &EL. I'm stuck on getting it to match the L or F after the &E. Thanks for your help.
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 09:05
@zotamias :+1:
Claudio Restifo
@Marmiz
Mar 13 2018 09:20
@azdravkovski it may be a bit biased so need further testing but you can test for &EF or &E
&EF|&EL|&E
Donnie
@Donnie-D
Mar 13 2018 09:29
Guys! why is my bootstrap not aligning my text in the middle? lol
https://codepen.io/Donnie-D/pen/YaydRM
anyone?
Aditya
@ezioda004
Mar 13 2018 09:36
@Donnie-D Looks like its because the .row has display: flex property
Frosty427
@Frosty427
Mar 13 2018 09:37
@Donnie-D remove row
Donnie
@Donnie-D
Mar 13 2018 09:38
yes removing row works :+1: but why and whats going on in there? I have done this before with row class lol
Aditya
@ezioda004
Mar 13 2018 09:38
@Donnie-D You can add class = justify-content-center in the .row
But anything else you put that in that row will also align it to center.
BS4 uses flexbox for rows so thats why
h1tag
@h1tag
Mar 13 2018 09:41
@Donnie-D or you can add bootstrap 3 instead of 4
Donnie
@Donnie-D
Mar 13 2018 09:41
how can i add bootstrap3 using codepen search?
h1tag
@h1tag
Mar 13 2018 09:42
@Donnie-D google bootstrap cdn
Aditya
@ezioda004
Mar 13 2018 09:43
In the CSS menu of codepen you have an option to use BS3 instead of BS4
Donnie
@Donnie-D
Mar 13 2018 09:45
@ezioda004 you little legend lol giving me just what i wanna know :+1:
thanks all of you fellas
by the way so if somebody learnt a bit of bootstrap 3 from tutorials, they need to forget about it and learn BS4 now? as BS3 practices dont seem secure. I dont even know what else has changed
Clark Weckmann
@clarkhacks
Mar 13 2018 09:48
@Donnie-D You can read about breaking changes and what not here https://github.com/twbs/bootstrap/releases on the release page. Bootstrap 3-4 is very similar in grammar.
Donnie
@Donnie-D
Mar 13 2018 09:59
@clarkhacks @h1tag I am trying to read from those links you shared but it seems hard taking them in like this.
I was wondering if a lot more than just a 'text-center' has been updated (I mean is there a glossary of some sort to see changes so one could refer to that if things dont seem to be working?) Or need I take it all in the way its given?
or i dont suppose sticking to BS3 would be recommended since now we have this BS......4 ?
Aditya
@ezioda004
Mar 13 2018 10:06
@Donnie-D If something doesnt work when you use BS4, search for it in the official docs, thats how I learned the changes (assuming you know somewhat BS3), also .text-center hasnt been updated, its the other properties that take precedence was causing problem.
Johnny
@JohnnyBizzel
Mar 13 2018 10:06
@Donnie-D Learn CSS3 grid. It has almost 100% browser support now.
Aditya
@ezioda004
Mar 13 2018 10:07
If you really want some brief glossary then check this out, might help you.
Sorin Ruse
@sorinr
Mar 13 2018 10:08
@Donnie-D here a bs4 cheat sheet link
Donnie
@Donnie-D
Mar 13 2018 10:09
@JohnnyBizzel I have learnt CSS3 grid :smile: I was wondering refreshing it back now that everyone keeps mentioning of grids and flexeboxes. Yes, that seems like one way to invest some time in :+1:
h1tag
@h1tag
Mar 13 2018 10:09

@Donnie-D of course there's a lot more changed than text-center (from the link above). There are some explanations in that link on some under the scene stuff that have changed, and there's a mention of the class names that have been renamed (this, for example).

Now, I don't have much info about this, but you can search online for what has changed (bootstrap 4 vs 3, for example).

And it seems that resources/blogs online advise to use the newer version (4), but the class names in v4 may still change, cause it's still in beta.

Markus Kiili
@Masd925
Mar 13 2018 10:10
@JohnnyBizzel Maybe almost 100% on most recent browser versions, but many people don't update their browsers. Must remember that when making production code.
Johnny
@JohnnyBizzel
Mar 13 2018 10:13
@Masd925 Well if people don't update their browsers will bootstrap 4 work? Just sayin'
CSS grid is an underlying technology. Bootstrap is an add-on.
Markus Kiili
@Masd925
Mar 13 2018 10:16
@JohnnyBizzel If you are for example building a web page that sells something, it must work on grandma's old browser too. So no grid and no ES6.
That is why we have tools like Babel etc.
Donnie
@Donnie-D
Mar 13 2018 10:17
lmao grandma's old browser
Johnny
@JohnnyBizzel
Mar 13 2018 10:17
Anyway, Bootstrap is good for learning layout.
My grandma's aren't alive so I'm not bothered.
I'm here to learn the new stuff!
Edy1988
@Edy1988
Mar 13 2018 10:26
@MuhammedKarim thank you!
CamperBot
@camperbot
Mar 13 2018 10:26
edy1988 sends brownie points to @muhammedkarim :sparkles: :thumbsup: :sparkles:
:cookie: 145 | @muhammedkarim |http://www.freecodecamp.org/muhammedkarim
Inga Vaiciakauskaite
@ingava
Mar 13 2018 10:30
Can anyone help me with a regex? I've been working on it for two hours and still can't figure it out. So I need to validate a username and the rules for it are the following: it must have at least one letter and can be numbers but no symbols except “_”. So I've come up with a regex that looks like this: ^\w+[a-zA-Z+]$ but for some reason a username 9ddd_ would not pass. Anyone has more experience with regex?
Long Nguyen
@longnt80
Mar 13 2018 10:38
@ingava have you tried this:
/\w*[a-zA-Z]\w*/g
Stephen James
@sjames1958gm
Mar 13 2018 10:39
@ingava Your regex does not allow an underscore as the final character
Inga Vaiciakauskaite
@ingava
Mar 13 2018 10:40
@longnt80 but your regex allows username like this: s9_x_.
Stephen James
@sjames1958gm
Mar 13 2018 10:40
@ingava BTW, the + would need to be outside the [] to have its normal effect
Inga Vaiciakauskaite
@ingava
Mar 13 2018 10:41
@sjames1958gm oh really, what does it do now then?
Stephen James
@sjames1958gm
Mar 13 2018 10:41
@ingava Add in the ^ $ to his
@ingava It allows letters or +
@ingava I believe - beginning to doubt myself :)
Inga Vaiciakauskaite
@ingava
Mar 13 2018 10:43
hm, ok, @sjames1958gm and @longnt80 I've combined your suggestions and it looks like it works! This is the final result of the regex: ^\w*[a-zA-Z]\w*$ It looks like I don't need to have the + now
Stephen James
@sjames1958gm
Mar 13 2018 10:44
:+1:
Inga Vaiciakauskaite
@ingava
Mar 13 2018 10:45
@sjames1958gm @longnt80 thanks a lot!
CamperBot
@camperbot
Mar 13 2018 10:45
:cookie: 681 | @longnt80 |http://www.freecodecamp.org/longnt80
ingava sends brownie points to @sjames1958gm and @longnt80 :sparkles: :thumbsup: :sparkles:
:star2: 9092 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 13 2018 10:48
@Edy1988 :+1:
Nate Mallison
@NJM8
Mar 13 2018 13:31
hey can someone help me with my wikipedia viewer? If you click on the tabs I want to boxes to all be at the top. I'm sure I'm blanking on something simple to do that. https://www.natethedev.com/FreeCodeCampFrontEndProjects/wikipediaViewer/
I know this can be done with flex box to make a carousel, if I can't get this to work I'll do that but I don't want to rewrite it all
Marianissimus
@Marianissimus
Mar 13 2018 13:46
@NJM8 try to remove the height property from the divs (height: 200px). no, that's not it, keep looking
Frosty427
@Frosty427
Mar 13 2018 13:54
image.png
can someone help me?
im trying to get those links at the bottom to move to the center
Dardan Demiri
@dardandemiri
Mar 13 2018 14:00
@Frosty427
Frosty427
@Frosty427
Mar 13 2018 14:00
yes?
Dardan Demiri
@dardandemiri
Mar 13 2018 14:00
Try adding to the ul class :smile:
justify-content-center
Frosty427
@Frosty427
Mar 13 2018 14:00
ok thanks ill try @dardandemiri
CamperBot
@camperbot
Mar 13 2018 14:00
frosty427 sends brownie points to @dardandemiri :sparkles: :thumbsup: :sparkles:
:cookie: 429 | @dardandemiri |http://www.freecodecamp.org/dardandemiri
Dardan Demiri
@dardandemiri
Mar 13 2018 14:01
;)
Connor
@cresharper
Mar 13 2018 14:08
Anyone here good at regex?
Dardan Demiri
@dardandmr
Mar 13 2018 14:09
@cresharper We will try
;)
how can we help you ?
Connor
@cresharper
Mar 13 2018 14:24
Nevermind, I figured it out but thanks!
Calat
@latimercaleb
Mar 13 2018 14:30
Hello all, the prodigal son returns
Ken Haduch
@khaduch
Mar 13 2018 14:38
@latimercaleb welcome back!
Calat
@latimercaleb
Mar 13 2018 14:42
I left off with the random quote machine project. So I'll be building that out since I'm in between tickets at work. How is everyone else doing?
Daniel Watson
@itsdanwatson
Mar 13 2018 15:13
Going through my Blackjack Card Counting function. I've gone through a switch statement, and now need to create an if statement to decide what to do with the results of the switch
Darren
@DarrenfJ
Mar 13 2018 15:43
@coderNewby hey got your PM sorry.. was off sick the last day or so.. looks good though.. go check it out
coderNewby
@coderNewby
Mar 13 2018 15:46
@DarrenfJ thanks! no worries.. I'm busy in the middle of the bootstrap...thanks again for the help
CamperBot
@camperbot
Mar 13 2018 15:46
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2422 | @darrenfj |http://www.freecodecamp.org/darrenfj
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:04
Hi folks! I have a big API call on the bottom of the website, so I want to display data only when user scroll to that section. I made it, but my API is called each time around when user scroll in that area. I tried 'one' jquery function, that solution doesn't work for me. Any help? Advice? Many thanks!
Dardan Demiri
@dardandmr
Mar 13 2018 16:05
@NikolaNbgd you can try using a setTimeout()
when the user arrives in that area, it starts onece
never again
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:05
@dardandmr how that can help me?
Dardan Demiri
@dardandmr
Mar 13 2018 16:06
right now you have made the code run every time the user scrolls down right ?
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:06
yep, but only when user sroll to that section
I can send you that piece of code
Dardan Demiri
@dardandmr
Mar 13 2018 16:07
Great idea
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:08
$(document).ready(function () {
$(window).on('scroll', function () {
var hT = $('.forks_me').offset().top,
hH = $('.forks_me').outerHeight(),
wH = $(window).height(),
wS = $(this).scrollTop();
if (wS > (hT + hH - wH) && window.location.pathname == '/') {
getApi();
console.log('works')
}
})
});
Dardan Demiri
@dardandmr
Mar 13 2018 16:10
window.addEventListener('scroll', function(){
  var place = document.body.scrollTop;
  var alertOn = document.getElementById('anotherElement').offsetTop;
  if(place > alertOn){
    alert('Function execute here');
    this.removeEventListener('scroll', arguments.callee, false);
  }
});


anotherElement is the ID of the section you want to execute
window.addEventListener('scroll', function(){
  var place = document.body.scrollTop;
  var alertOn = document.getElementById('anotherElement').offsetTop;
  if(place > alertOn){
    getApi();
    console.log('works')
    this.removeEventListener('scroll', arguments.callee, false);
  }
});
This should work as you asked for
Calat
@latimercaleb
Mar 13 2018 16:13
Crap, how do you format code in here again ? It's been so long.
Dardan Demiri
@dardandmr
Mar 13 2018 16:13
with three ```
Dardan Demiri
@dardandmr
Mar 13 2018 16:13
then the code under
Calat
@latimercaleb
Mar 13 2018 16:13
Ahhh thanks guys
Dardan Demiri
@dardandmr
Mar 13 2018 16:14
;)

@latimercaleb Whenever you want to see this image sent by @gulsvi

Just pres Ctrl+Shift+M

Gulsvi
@gulsvi
Mar 13 2018 16:16
@NikolaNbgd can you check if an element has been populated with API data and conditionally call getApi() based on that?
if(!$("#myElement").text().trim().length) getApi();
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:16
@dardandmr well, nothing happens, my data even aren't loaded
Dardan Demiri
@dardandmr
Mar 13 2018 16:17
Can you put the whole code in Codepen
@NikolaNbgd here see an example
with jQueyr
jQuery
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:20
@gulsvi yeah, but my div is empty until user scroll to desired section
Gulsvi
@gulsvi
Mar 13 2018 16:25
@NikolaNbgd Right, so when it is no longer empty, no need to call the api. Or, set a flag to determine if the API has been called:
var api = false;

$(document).ready(function() {
  $(window).on("scroll", function() {
    var hT = $(".forks_me").offset().top,
      hH = $(".forks_me").outerHeight(),
      wH = $(window).height(),
      wS = $(this).scrollTop();
    if (wS > hT + hH - wH) getApi();
  });
});

function getApi() {
  if (!api) console.log("works");
  api = true;  
}
Run that code and you'll see "works" once in the console, instead of it appearing multiple times every time the user scrolls
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:26
@dardandmr oh, need a week to put all my code in codepen, its a really big project, can we find some other solution? :/
Dardan Demiri
@dardandmr
Mar 13 2018 16:28

Can you please explain this in more details:

I made it, but my API is called each time around when user scroll in that area.

NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:28
@gulsvi that make sense, but getApi is already function which displayed me data to the page, can't use function getApi() { if (!api) console.log("works"); api = true; }
Gulsvi
@gulsvi
Mar 13 2018 16:29
@NikolaNbgd Without the code, we're playing pin the tail on the donkey. You'll need to figure out how to determine if your API has been called yet or not.
Or... share the code :)
@dardandmr I get an alert "Bottom" every time I scroll to that section - I think the goal is to only fire the alert (aka, call the api) once
Maybe I'm misunderstanding the goal though, tbh
Dardan Demiri
@dardandmr
Mar 13 2018 16:32
$(document).ready(function () {
 var apiCall = true;
    $(window).on('scroll', function () {
        var hT = $('.forks_me').offset().top,
            hH = $('.forks_me').outerHeight(),
            wH = $(window).height(),
            wS = $(this).scrollTop();
        if (wS > (hT + hH - wH) && window.location.pathname == '/') {
            if(apiCall){
               getApi();
            }
            apiCall = false;
            console.log('works')
        }  
    })
});
This fires once in a lifetime
:P
@NikolaNbgd
Try this
it's your code just with the One Time call
Matthew
@RoutinePoutine
Mar 13 2018 16:35
Why does myArray.slice(0, 4); result in the first four entries rather than the first five?
Dardan Demiri
@dardandmr
Mar 13 2018 16:36
var a = ['zero', 'one', 'two', 'three'];
var sliced = a.slice(1, 3);

console.log(a);      // ['zero', 'one', 'two', 'three']
console.log(sliced); // ['one', 'two']
NikolaNbgd
@NikolaNbgd
Mar 13 2018 16:36
@dardandmr yeeeep, that is my solutuon! :) thank you man!
CamperBot
@camperbot
Mar 13 2018 16:36
nikolanbgd sends brownie points to @dardandmr :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @dardandmr |http://www.freecodecamp.org/dardandmr
Dardan Demiri
@dardandmr
Mar 13 2018 16:36
;)
@RoutinePoutine
var a = ['zero', 'one', 'two', 'three'];
var sliced = a.slice(1, 3);

console.log(a);      // ['zero', 'one', 'two', 'three']
console.log(sliced); // ['one', 'two']
This is how slice works
Matthew
@RoutinePoutine
Mar 13 2018 16:38
If 0 is 1, why isn’t 3 ...4?
Thanks for the response
Dardan Demiri
@dardandmr
Mar 13 2018 16:39

because the slice() function

takes 2 arguments

First one is where to start,

The second one is where to stop

Matthew
@RoutinePoutine
Mar 13 2018 16:39
It only cuts first and last ?
Why not stop at 3? If 3 is 4?
Does the second argument happen after 0 is no longer 1?
Dardan Demiri
@dardandmr
Mar 13 2018 16:41
can you make an example

like this

[1,2,3,4,5,6].slice(1,2)

Matthew
@RoutinePoutine
Mar 13 2018 16:41
function findLength(array)
Dardan Demiri
@dardandmr
Mar 13 2018 16:42
yes ?
Matthew
@RoutinePoutine
Mar 13 2018 16:42
return array.length;
Sorry
I mean functionFourItems(array)
Dardan Demiri
@dardandmr
Mar 13 2018 16:43
yes
Matthew
@RoutinePoutine
Mar 13 2018 16:43
return array.slice(0, 4);
Dardan Demiri
@dardandmr
Mar 13 2018 16:43
it should return just 4 items right ?
Matthew
@RoutinePoutine
Mar 13 2018 16:43
I thought it would be 0, 3
Yes
Does 4 imply 0 is no longer 1, but 2..so 4 is new 3?
Dardan Demiri
@dardandmr
Mar 13 2018 16:45
[1,2,3,4,5,6].slice(0,4);
 0 1 2 3 ( 4 not included)
Dardan Demiri
@dardandmr
Mar 13 2018 16:46
The second argument is never included
Matthew
@RoutinePoutine
Mar 13 2018 16:46
Thanks
4 is protected?
Dardan Demiri
@dardandmr
Mar 13 2018 16:47
Yes
always
Matthew
@RoutinePoutine
Mar 13 2018 16:50
Thanks
Dardan Demiri
@dardandmr
Mar 13 2018 16:51

and, for future thanks...

It's a better idea to mention the name by clicking on the name of the person who helped you, just to reward the helper...

Like this:

Thank you @RoutinePoutine

CamperBot
@camperbot
Mar 13 2018 16:51
dardandmr sends brownie points to @routinepoutine :sparkles: :thumbsup: :sparkles:
:cookie: 109 | @routinepoutine |http://www.freecodecamp.org/routinepoutine
Clark Weckmann
@clarkhacks
Mar 13 2018 16:58
I'm looking for a lightweight ios-esque css framework for a quick prototype, any recommendations? framework7 is what I'm using right now
Calat
@latimercaleb
Mar 13 2018 17:02
Ios-esque? Now you've got me interested. What do you mean by that @clarkhacks
Calat
@latimercaleb
Mar 13 2018 17:08
What do you guys think of this random quote generator? I think it meets all the requirements, i even got the query string with the twitter button to work https://codepen.io/latimeks/pen/VzdEoy
Dardan Demiri
@dardandmr
Mar 13 2018 17:09
@latimercaleb Great
I like the functionality, perhaps the style can be better
Works perfect
Calat
@latimercaleb
Mar 13 2018 17:11
Yeah, I think so too. I've never been much of a designer, I think I'm going to rework sass into the css and maybe user materialize on it to get some more fancy UI. Then I'll submit and start the next one
Dardan Demiri
@dardandmr
Mar 13 2018 17:11
Good idea ;)
Calat
@latimercaleb
Mar 13 2018 17:13
Thanks @dardandmr
CamperBot
@camperbot
Mar 13 2018 17:13
latimercaleb sends brownie points to @dardandmr :sparkles: :thumbsup: :sparkles:
:cookie: 285 | @dardandmr |http://www.freecodecamp.org/dardandmr
Clark Weckmann
@clarkhacks
Mar 13 2018 17:15
@latimercaleb ios-esque, just something rounded, lots of gradients, not a lot of shadows. Something light for some quick prototypes. F7 works well but it's a bit heavy for my use.
Calat
@latimercaleb
Mar 13 2018 17:53
Hmm I see, yeah I have no idea. But I wish you the best of luck. My knowledge of mobile is pretty darn small.
Nicolas Ramirez
@kamatheuska
Mar 13 2018 18:00

Hey everyone, I am trying to access a property in a prototype and it isn't working:

const SomeConstructor = function (value) {
  this.value = value
}

Now, in the prototype, if I do:

SomeConstructor.prototype = {
  foo: this.value,
  zaz: 1,
  bar () {
    return this.zaz + this.value
  },
}

let obj =  new SomeConstructor(2);

console.log(obj.bar()); // logs 3
console.log(obj.foo);   // logs undefined

Why is that?

Stephen James
@sjames1958gm
Mar 13 2018 18:02
@kamatheuska When you set foo for the prototype - this is a different value than when you run the function bar()
Calat
@latimercaleb
Mar 13 2018 18:03
this.value doesn't have a value at the constructor level. It works for bar because it's a function
Nicolas Ramirez
@kamatheuska
Mar 13 2018 18:06
@sjames1958gm @latimercaleb I see....how can I access this.value in a property in the prototype? I want to do something line SomeConstructor.prototype.foo = 'someString'.repeat(this.value);
I need something like a setter...just guessing
alpox
@alpox
Mar 13 2018 18:08
@kamatheuska yes you can use a property setter for this
Nicolas Ramirez
@kamatheuska
Mar 13 2018 18:09
mmm not sure how, is there a set() method?
gonna check on MDN
thanks for the help! @alpox @sjames1958gm @latimercaleb
Abdullah
@AbdullahChaudhry
Mar 13 2018 18:22
@kamatheuska
const SomeConstructor = function (value) {
  this.value = value
}

SomeConstructor.prototype = {
  foo () {
    return this.value
  },
  zaz: 1,
  bar() {
    return this.zaz + this.value
  },
}

let obj =  new SomeConstructor(2);

console.log(obj.bar()); // logs 3
console.log(obj.foo());   // logs 2
@kamatheuska Because your foo was not a function
Calat
@latimercaleb
Mar 13 2018 18:55
Does anyone else here struggle a bit with the algorithm questions? I usually find my own way of doing them without using the hinted functions, but trying to implement the hinted functions I never can find it out.
Dardan Demiri
@dardandmr
Mar 13 2018 18:59
Usually the hints are a better way of solving algorithms, you can always do it on your way and you should but always check how you can do it better
Ken Haduch
@khaduch
Mar 13 2018 18:59
@latimercaleb - I think that some of them are rather difficult. It's good to find a way to make it work on your own, but some of the hints and more advanced solutions are really amazing! I usually come up with something then find a better answer afterward. Rarely do I look at the provided solutions, though.
Jacob Pieczynski
@JacobPie
Mar 13 2018 19:13
@latimercaleb I honestly look at the provided solutions probably way too much. I really struggle them as well.
Matthew
@RoutinePoutine
Mar 13 2018 19:29
Thank you@Dardan Demiri
Thanks @dardandemiri
CamperBot
@camperbot
Mar 13 2018 19:30
routinepoutine sends brownie points to @dardandemiri :sparkles: :thumbsup: :sparkles:
:cookie: 430 | @dardandemiri |http://www.freecodecamp.org/dardandemiri
Matthew
@RoutinePoutine
Mar 13 2018 19:30
Finally haha
Jacob Pieczynski
@JacobPie
Mar 13 2018 19:35
Lol
Dardan Demiri
@dardandmr
Mar 13 2018 19:37
hahaha just the wrong user :P
hahhaha
@RoutinePoutine
Eric Weiss
@eweiss17
Mar 13 2018 19:38
if you click on their @ it will do it for you
Dardan Demiri
@dardandmr
Mar 13 2018 19:38
that's right
Matthew
@RoutinePoutine
Mar 13 2018 19:41
Is Dardan a common name? Looks like two
Dardan Demiri
@dardandmr
Mar 13 2018 19:42

Yes that was my old account...

After two years of staying Offline I have restarted FCC from the beginning

Matthew
@RoutinePoutine
Mar 13 2018 19:43
Ah. How is it the second time through?
Eric Weiss
@eweiss17
Mar 13 2018 19:43
You feel pretty smart when all the beginner stuff is real easy
Dardan Demiri
@dardandmr
Mar 13 2018 19:44
I have a degree in Computer Science
and every thing was fading away from my memory in this two years
now I have started like a beginner but the easy things are always fast steps
image.png
You can see, the fast steps
@eweiss17
Eric Weiss
@eweiss17
Mar 13 2018 19:47
wow think my streak is 6 days nice
Dardan Demiri
@dardandmr
Mar 13 2018 19:48
I was really angry at my self, that's why I made a Commitment to do every day progress
to relearn what I have forgotten

2 Years without a day in codding is like putting a tape in your mouth for two years...

After two years you won't be able to speak normally 100%.

Eric Weiss
@eweiss17
Mar 13 2018 19:50
I'm trying to get a job right now. harder than i thought
Dardan Demiri
@dardandmr
Mar 13 2018 19:51
What's your progress till now?
Eric Weiss
@eweiss17
Mar 13 2018 19:51
I graduated in december
was picky probably the first month
trying to be a juior web dev
i go on indeed every few days and apply to jobs in my area
lots of dev jobs are Senior or 3+ years exp in something i'v never done
Dardan Demiri
@dardandmr
Mar 13 2018 19:53
Great
but I would suggest to use git more
github
Lisa Copeland
@lisacopeland
Mar 13 2018 19:53
@eweiss17 whats in your portfolio?
Matthew
@RoutinePoutine
Mar 13 2018 19:54
I joined a boot camp because I lacked the personal discipline needed for FreeCodeCamp. I plan to do it afterwards to reinforce learning.
Lisa Copeland
@lisacopeland
Mar 13 2018 19:54
@eweiss17 Do you have some sample projects on your github account?
Eric Weiss
@eweiss17
Mar 13 2018 19:54
Matthew
@RoutinePoutine
Mar 13 2018 19:55
What role does a CS degree play in development?
Lisa Copeland
@lisacopeland
Mar 13 2018 19:55
@eweiss17 Nice
Dardan Demiri
@dardandmr
Mar 13 2018 19:55
More in Problem Solving
and of course
Eric Weiss
@eweiss17
Mar 13 2018 19:56
the projects on there are really just ported from codepen
Dardan Demiri
@dardandmr
Mar 13 2018 19:56
You learn a lot
but most are not needed when your focus is in one particular area

like:

If you want to be a Web Developer

in CS
you learn a lot of useless things that you will never use
Here is a list
Ah, it's on my Language
never mind
Mark Kubik
@KUBIX90
Mar 13 2018 20:00

Hi Guy's

How do I get the scope heading to appear below the horizontal skills without making to hacky or using <br>, thanks.

Dardan Demiri
@dardandmr
Mar 13 2018 20:00

It's good to have a CS, but not necessary...

You can be a great developer without a CS degree...

Like so many Google engineers

Eric Weiss
@eweiss17
Mar 13 2018 20:01
some people are just naturally really good
Dardan Demiri
@dardandmr
Mar 13 2018 20:04

That's not always true

Naturally really good, means he can learn something for a shorter amount of time but you can learn the same with a little more time...
And if you never stop, you will be better one day...
Because the winner is always he who never stops...

Ian Lee
@asparism
Mar 13 2018 20:32
@KUBIX90 are you trying to use flexbox?
Ken Haduch
@khaduch
Mar 13 2018 20:37
@KUBIX90 - I think that using position: fixed; makes things behave rather strangely. Why are you doing that - it seems that you have to go through a lot of contortions to make the block display where you want it to? Maybe you have a reason, but it disrupts the normal flow of elements on the page.
Ken Haduch
@khaduch
Mar 13 2018 20:50
@KUBIX90 - i found that if you add a margin-top of about 60px, that it will drop down to the next line. Maybe a "clear" would get it to move out of the line of floated elements? Yes, if you add a clear: both; to a class that is applied to your "Scope" heading, then it will drop to the next line. You might want to add some margin-top to that element, then, to space it away from the line of skills.
Ken Haduch
@khaduch
Mar 13 2018 20:56
@KUBIX90 - I rarely use floats, so it didn't pop to mind right away. You could read more about the CSS "clear" property here and at css-tricks
Riadh
@KWFE
Mar 13 2018 21:05
@khaduch are you full stuck developer !
Ken Haduch
@khaduch
Mar 13 2018 21:09
stuck, for sure... :)
Riadh
@KWFE
Mar 13 2018 21:09
stack sorry hhh
Ken Haduch
@khaduch
Mar 13 2018 21:10
I've done some backend development with PHP and started learning Node.js a while ago. But I don't have extensive experience as a full-stack developer.
Gulsvi
@gulsvi
Mar 13 2018 21:10
@KUBIX90 One quick fix is to replace float: left with display: inline-block for your h4 elements with the skills listed in them.
Ken Haduch
@khaduch
Mar 13 2018 21:11
@gulsvi - yeah, probably a better solution than using floats...
Riadh
@KWFE
Mar 13 2018 21:16
@khaduch i think u are good in JS
Hammad
@newnewb
Mar 13 2018 21:32
so close to the Front End Development Certificate
just need the 2 hardest challenges
Build a Tribute Page Incomplete   *

Build a Personal Portfolio Webpage Incomplete   *
Ian Lee
@asparism
Mar 13 2018 21:34
@newnewb i feel u
Exaland Concept
@exaland
Mar 13 2018 21:37
@sjames1958gm :+1: Thanks for your advice
CamperBot
@camperbot
Mar 13 2018 21:37
exaland sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9094 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Mar 13 2018 21:41
@exaland np
Exaland Concept
@exaland
Mar 13 2018 21:42
@sjames1958gm I have an question have you some knowing about laravel
Stephen James
@sjames1958gm
Mar 13 2018 21:42
Sorry I have not used that.
Exaland Concept
@exaland
Mar 13 2018 21:43
@sjames1958gm OK Thanks
CamperBot
@camperbot
Mar 13 2018 21:43
exaland sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
api offline
Hammad
@newnewb
Mar 13 2018 21:43
@exaland you killed @camperbot !