These are chat archives for FreeCodeCamp/Help

23rd
Aug 2017
Albert Cardona II
@daddycardona
Aug 23 2017 00:00
nevermind I did not see what you was doing there my mistake
Gersho
@Gersho
Aug 23 2017 00:01
you also need to return something after the loop i guess ? (depends on what the function is supposed to return when you can't find Dave)
wnghero
@wnghero
Aug 23 2017 00:01

@Gersho "Create a new function called lookingForDave that will iterate through an array of names, and evaluate whether or not one of them is "Dave". Use a for loop to iterate through the array, and an if/then statement to check to see if the current item in the array is "Dave".

If the loop finds Dave, return the string "I found him.""

i fixed the indexOf()
still not working
and i put the array in the function
Margaret
@Margaret2
Aug 23 2017 00:02
@wnghero do you need the . at the end of the string?
Gersho
@Gersho
Aug 23 2017 00:03
wow those instructions are awfully specific
wnghero
@wnghero
Aug 23 2017 00:03
right
and @Margaret2 i dont think so ill try though haha
Margaret
@Margaret2
Aug 23 2017 00:03
yeah, lookingForDave is pretty funny :laughing:
wnghero
@wnghero
Aug 23 2017 00:04
it wasn't the period :/
Margaret
@Margaret2
Aug 23 2017 00:04
show what your code looks like now
wnghero
@wnghero
Aug 23 2017 00:05
function lookingForDave(arr){
var testArr=["mike","Dave","Jake...","from Statefarm"];
for(i=0;i<arr.length;i++){
if(indexOf.arr(i)==="Dave"){
return "I found him.";
}
}
}
lookingForDave(testArr);
Albert Cardona II
@daddycardona
Aug 23 2017 00:05
I was wrong about that @wnghero I said my mistake
Margaret
@Margaret2
Aug 23 2017 00:05
@wnghero dude, the index will never be "Dave"
wnghero
@wnghero
Aug 23 2017 00:05
how do i use markup i feel liek a pleb
Margaret
@Margaret2
Aug 23 2017 00:06
arr[i] will be "Dave"
Razvan
@razvanlikespizza
Aug 23 2017 00:06
Daddy Cardona aw man... xD <3
Gersho
@Gersho
Aug 23 2017 00:06
i pointed the indexof earlier
Razvan
@razvanlikespizza
Aug 23 2017 00:06
@daddycardona I am getting in love with u xD
wnghero
@wnghero
Aug 23 2017 00:07
@Margaret2 truuuu
Margaret
@Margaret2
Aug 23 2017 00:07
#bromance :stuck_out_tongue_winking_eye:
Corentin Whyte
@CorySW
Aug 23 2017 00:07
https://codepen.io/CreativeCoding/full/gxwNvg/ what could I do to have a delay between the buttons pls
Albert Cardona II
@daddycardona
Aug 23 2017 00:07
No thanks I am taken
wnghero
@wnghero
Aug 23 2017 00:07
@Margaret2 thank you thats was it
CamperBot
@camperbot
Aug 23 2017 00:07
wnghero sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:star2: 2895 | @margaret2 |http://www.freecodecamp.com/margaret2
Margaret
@Margaret2
Aug 23 2017 00:07
thx also @Gersho
Razvan
@razvanlikespizza
Aug 23 2017 00:08
@daddycardona We can keep that our little secret. If I continue, I am getting banned for harassing people. I hope you know thats a joke.
wnghero
@wnghero
Aug 23 2017 00:08
banned
Albert Cardona II
@daddycardona
Aug 23 2017 00:09
I am straight sorry no secrets here but don't tell my bf about my gf lmao
Gersho
@Gersho
Aug 23 2017 00:09
@CorySW try setTrigger for you delay related troubles
Corentin Whyte
@CorySW
Aug 23 2017 00:10
@Gersho thanksss
Gersho
@Gersho
Aug 23 2017 00:16
@CorySW apologies, the function name is actually setTimeout
Gersho
@Gersho
Aug 23 2017 00:21
https://codepen.io/Gersho/full/weVQjr
can i make it smaller without having to rewrite everything ? (it's all in fixed positions :| )
Margaret
@Margaret2
Aug 23 2017 00:25
if you set the absolute width/height of everything in pixels, you pretty much have to go back and change that
Gersho
@Gersho
Aug 23 2017 00:26
:( couldn't manage to make the centerpiece properly w/o fixed, well i guess i'll have to edit all the number *0.7 or smth like that should do the trick
Razvan
@razvanlikespizza
Aug 23 2017 00:27
Good night people!
Gersho
@Gersho
Aug 23 2017 00:27
by the way how small should i make it ? it's about 700 px wide at the moment
gn8
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 00:46

Hello bebol

Ross Scarborough
@SourceHorse
Aug 23 2017 01:21
Can some people try this and tell me if the layout works?
Gersho
@Gersho
Aug 23 2017 01:22
works and looks finr
fine
Albert Cardona II
@daddycardona
Aug 23 2017 01:49
works and looks awesome bro also @SourceHorse send them to a blank target so they wont have to backspace it other than that very nice layout
Albert Cardona II
@daddycardona
Aug 23 2017 02:30
I need some help with my site I am trying to make it so that when I scroll up it looks smooth and when I scroll down it goes to the top of a div - 60px. I have the code however I can't get to the top of the page when I click a href but it works with all other links
$(document).on("click", "a", function() {
        console.log($(this).attr('href'));
        if ($(this).attr('href') == $('#top')) {
            $("html, body").animate({
                    scrollTop: $($.attr(this, "href")).offset().top
                },
                1250
            );
        } else {
            $("html, body").animate({
                    scrollTop: $($.attr(this, "href")).offset().top - 60
                },
                1250
            );
        }
    });
I know I must be doing something wrong here

$(function() {
    // Activate Carousel
    $("#myCarousel").carousel();

    // Enable Carousel Indicators
    $(".item1").click(function() {
        $("#myCarousel").carousel(0);
    });
    $(".item2").click(function() {
        $("#myCarousel").carousel(1);
    });
    $(".item3").click(function() {
        $("#myCarousel").carousel(2);
    });
    $(".item4").click(function() {
        $("#myCarousel").carousel(3);
    });

    // Enable Carousel Controls
    $(".left").click(function() {
        $("#myCarousel").carousel("prev");
    });
    $(".right").click(function() {
        $("#myCarousel").carousel("next");
    });

    //clicking on links with fixed navbar
    $(document).on("click", "a", function() {
        console.log($(this).attr('href'));
        if ($(this).attr('href') == $('#top')) {
            $("html, body").animate({
                    scrollTop: $($.attr(this, "href")).offset().top
                },
                1250
            );
        } else {
            $("html, body").animate({
                    scrollTop: $($.attr(this, "href")).offset().top - 60
                },
                1250
            );
        }
    });
    $('[data-toggle=tab]').click(function() {
        if ($(this).parent().hasClass('active')) {
            var url = $(this).attr('href');
            var tid = url.split('#')[1];
            console.log(tid);
            $('#' + tid).toggleClass('active');
            document.location.hash = '';
        }
    });
});
this the whole code just in case it make a difference
this is the link it wont go to the top
http://rodaslandscaping.cardonafam.com/
Tricia
@patricia07
Aug 23 2017 02:44
hey
is something wrong with my code?

// Only change code below this line

var processed = 2;

function processArg(num) {
return (num + 2) / 5;

processed = process (7);

}

Manish Giri
@Manish-Giri
Aug 23 2017 04:01
@patricia07 process (7);
what does this do?
Kyle Holm
@thekholm80
Aug 23 2017 04:02
:sparkles: magic :sparkles:
Gersho
@Gersho
Aug 23 2017 04:02
nothing it's after a return
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:10
@thekholm80 hello
@thekholm80 a little quick question about something
Kyle Holm
@thekholm80
Aug 23 2017 04:11
sure, what's up @ahmedtarek2134
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:12
so I have started testing my code and I stumbled upon a code that I just can't quite test
I am developing a command line tool so I ask users for inputs
how can I test these inputs ?
wnghero
@wnghero
Aug 23 2017 04:12
var arr1 = [15,17,22,4,3,35,11,12,38,8];
// Create a function that will average all the even or odd numbers in an array.
function averageArray(arr,evenOrOdd){
var evenNums = 0;
var oddNums = 0;
var evenArr = [];
var oddArr = [];
if (evenOrOdd === "evens"){
  for(i=0;i<arr.length;i++){
    if(arr[i] % 2 === 0){
      evenArr.push[i];
       for(i=0;i<evenArr.length;i++){
         evenNums += i;
         evenNums / evenArr.length;
         return evenNums;
       }
    }else if(evenOrOdd === "odds"){
      oddArr.push[i];
       for(i=0;i<oddArr.length;i++){
         oddNums += i;
         oddNums / oddArr.length;
         return oddNums;
       }

    }
  }
}else{

}
}
console.log(averageArray(arr1,"evens"));
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:12
I am using mocha and chai
inquirer.js
wnghero
@wnghero
Aug 23 2017 04:12
why am i getting an infinite loop?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:13
my goal from the file is to output a valid package.json data which it does, after the user inputs the answers
if I create like a fake object data, the function basically will return that object untouched
so it's like a waste or not proper testing
Kyle Holm
@thekholm80
Aug 23 2017 04:15
@ahmedtarek2134 i think there are libraries to spoof user interaction, one sec i'll look
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:16
@thekholm80 that would be awesome!
@thekholm80 also how can you test nodejs fs functions, you can only test the path and data to be written I guess, at least that's what I am doing
Kyle Holm
@thekholm80
Aug 23 2017 04:18
@ahmedtarek2134 looks like https://www.npmjs.com/package/mock-stdin might do what you need
you did say it's a CLI not a web app, right?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:19
yeah it is
@thekholm80 I can't quite understand what this library does hmmmm
stdin.send([
  "Array of lines",
  "  which are joined with a linefeed."
]);
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:24
where does it send this array?
Kyle Holm
@thekholm80
Aug 23 2017 04:24
that gets processed as though the user typed it into the command line
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:26
but inquirer takes an array of questions, if it did take a question one by one then yes we could use this
idkkkk what to doo hahah
Darren
@DarrenfJ
Aug 23 2017 04:26
evening fCC
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:26
oke wait let me write an example of an inquirer question
Kyle Holm
@thekholm80
Aug 23 2017 04:27
@DarrenfJ hiya
Darren
@DarrenfJ
Aug 23 2017 04:27
@thekholm80 hey buddy!
Manish Giri
@Manish-Giri
Aug 23 2017 04:27

@wnghero try this

var arr1 = [15,17,22,4,3,35,11,12,38,8];
// Create a function that will average all the even or odd numbers in an array.

function foo(arr) {
  return arr.reduce((a,b) => a + b, 0)/arr.length;
}

function averageArray(arr,evenOrOdd){
  return evenOrOdd === "evens" ? foo(arr.filter(a => a % 2 === 0)): foo(arr.filter(a => a % 2 !== 0));
}

console.log(averageArray(arr1,"evens")); // 16.8

short and sweet

Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:27
@thekholm80 ```js
inquirer.prompt([{
  type: 'input',
  name: 'test',
  message: 'Helellooooo'
}, {
  type: 'confirm',
  name: 'start',
  message: 'yayayaayayay'
}]).then(results => {
  console.log(results)
})
so this will return a promise with the user's answers
by the name given
Darren
@DarrenfJ
Aug 23 2017 04:28
@Manish-Giri manish!
the gangs all here ;)
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:28
results.test will equal the result to that question
Manish Giri
@Manish-Giri
Aug 23 2017 04:28
@DarrenfJ :wave:
:watermelon:
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:28
I can't spoof the user interaction to test this aaaaahhhhhhhhhh
@Manish-Giri @DarrenfJ hey guys!
Kyle Holm
@thekholm80
Aug 23 2017 04:29
@ahmedtarek2134 yeah, i don't know what to tell you. I've never used mocha or chai, only jest and that just a little
Manish Giri
@Manish-Giri
Aug 23 2017 04:29
:wave:
wnghero
@wnghero
Aug 23 2017 04:29
@Manish-Giri SyntaxError: Unexpected token (13:4)
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:29
@thekholm80 can you test such a function with jest, willing to switch if it will tbh
Kyle Holm
@thekholm80
Aug 23 2017 04:30
maybe? @ahmedtarek2134 i've only used it to test react components
i'm a testing noob
wnghero
@wnghero
Aug 23 2017 04:30
@Manish-Giri also "Create a function called averageArray that takes in an array of numbers and a value of either 'evens' or 'odds' and, depending on which the function is asked to evaluate, returns either the average of all the even numbers in the array, or all of the odd numbers in the array."
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:30
I started testing but I do believe not everything can be tested
you can't have 100% coverage with such things in a CLI app
should I just skip testing this file or what?
Darren
@DarrenfJ
Aug 23 2017 04:31
@ahmedtarek2134 hey buddy :D
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:31
@DarrenfJ hey man! how are you doing?
Kyle Holm
@thekholm80
Aug 23 2017 04:31
set it all on fire and play video games instead
Darren
@DarrenfJ
Aug 23 2017 04:31
ah you know.. too busy with work
Manish Giri
@Manish-Giri
Aug 23 2017 04:31
@wnghero well the function exists, doesn't it?
function averageArray(arr,evenOrOdd){
  return evenOrOdd === "evens" ? foo(arr.filter(a => a % 2 === 0)): foo(arr.filter(a => a % 2 !== 0));
}
Darren
@DarrenfJ
Aug 23 2017 04:31
but i've been trying to focus on finishing the projects this summer
fCC projects
wnghero
@wnghero
Aug 23 2017 04:31
@Manish-Giri ahh true
not sure why its not working
Manish Giri
@Manish-Giri
Aug 23 2017 04:32
you have a URL to the challenge?
@wnghero
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:32
@DarrenfJ I am trying to finish a project before this friday cause I'll be traveling to Turkey but oh well I'm banging my head against my code :(
Gersho
@Gersho
Aug 23 2017 04:32
@DarrenfJ :wave: hi! i've finished my pomodoro since then !
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:32
@thekholm80 Already finished sniping people in Battlefield 1
Code is sniping me this time
wnghero
@wnghero
Aug 23 2017 04:33
i keep getting SyntaxError: Unexpected token (13:4) on the console on the website
Kyle Holm
@thekholm80
Aug 23 2017 04:33
@ahmedtarek2134 lol
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:33
:shipit:
Darren
@DarrenfJ
Aug 23 2017 04:33
@Gersho yah still gotta do that one too :/
@ahmedtarek2134 what's up in turkey for yah?
Manish Giri
@Manish-Giri
Aug 23 2017 04:33
@wnghero URL?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:34
@DarrenfJ Just going to have a little bit of fun until school starts :smile:
Darren
@DarrenfJ
Aug 23 2017 04:34
ah cool
whenever i think of turkey i think of, of all things, the singer of bauhaus
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:34
I think of shawarma
Gersho
@Gersho
Aug 23 2017 04:35
when i think turkey i remember my aunt that always had something to say about them (she's algerian)
Darren
@DarrenfJ
Aug 23 2017 04:35
oh man don't get me started on my greek barber..
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:36
I am half Turkish and half Syrian, born in Egypt though haha
Gersho
@Gersho
Aug 23 2017 04:36
half algerian, half french, born in france
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:36
my mother's side are turkish and my dad's are syrians
@Gersho Multi Nationals :joy:
Gersho
@Gersho
Aug 23 2017 04:37
and my mom isn't even really french since she's halt italian half espa~nol
hmm i don't remember how to do the spanish n lol
Darren
@DarrenfJ
Aug 23 2017 04:39
sadly i am canadian.. that means an endless mix of scottish french irish german and other boring cultures over years.. pretty much just a mutt
Gersho
@Gersho
Aug 23 2017 04:39
@ahmedtarek2134 fun thing is, i currently live in guadeloupe (caribean island) so here i'm considered "white"
@DarrenfJ canada is one of the destination i've considered to look for work once i'm more proficient in code
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:40
Canada is one of my top places to go to for university actually
reeealllyyyy thinking about it
Darren
@DarrenfJ
Aug 23 2017 04:41
which one you have your eye on?
Gersho
@Gersho
Aug 23 2017 04:41
if you can, you should, the world may say stuff about equality, but a diploma from canada will help you way more than one from turkey (even in turkey)
me i'm 32, so it's more like "trying to catch the last train at starting over"
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:42
@Gersho i'm going to turkey for vacation not eduction
Darren
@DarrenfJ
Aug 23 2017 04:42
Montreal's Mcgill comes with the added bonus of being in Montreal, a city that is actually still cheap to live in, has an amazing music scene, and a good mix of English of French.. feels more European...
TO is very much trying to be NYC
Gersho
@Gersho
Aug 23 2017 04:42
@ahmedtarek2134 oh i assumed you were currently living there
Darren
@DarrenfJ
Aug 23 2017 04:42
so not as chill
and if you really like chill, Vancouver is pretty much extreme sports ;)
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:42
@DarrenfJ I still haven't seen any universities actually
I still have two years to apply
Darren
@DarrenfJ
Aug 23 2017 04:43
lotsa time
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:43
exactly
but they say its nice for computer science
Darren
@DarrenfJ
Aug 23 2017 04:43
UofT?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:43
something that is very poor here in the middle east
no one cares about computer science here
Darren
@DarrenfJ
Aug 23 2017 04:44
ah.. too bad.. it's kinda the future... i mean someone's gotta be butlers for our robot overlords
maintenance and reprogramming them
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:44
or maybe trying to destroy them hehe
Darren
@DarrenfJ
Aug 23 2017 04:44
while serving at their dinner parties
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:45
when they badly malfunction
Gersho
@Gersho
Aug 23 2017 04:45
or simply fixing your everyday stuff, since soon fixing your front door will involve a termina
Darren
@DarrenfJ
Aug 23 2017 04:45
true dat
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:46
tbh I am waiting for a day where we fully rely on technology
you can actually control your door with a terminal
put an arduino or a raspberry
:smile:
Darren
@DarrenfJ
Aug 23 2017 04:46
i'm waiting for when we can control it with our minds
Gersho
@Gersho
Aug 23 2017 04:46
well you can already today, problem is it's proprietary stuff linked to an external server (instead of a server in your house) so if there's no internet you're locked ouy
out
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:47
no the arduino doesn't require any of that
its just a chip that you code whatever you want it to do in python
Gersho
@Gersho
Aug 23 2017 04:47
i'm for a smart one, but one that --> I <-- control, not google or whatever
oh yeah if you do your own
but i have 2 left hands, coding is a thing, making complex tools (door mecanim, etc) is not for me
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:48
I actually love playing with hardware
I am totally a computing guy hehe
Gersho
@Gersho
Aug 23 2017 04:49
i love it too, i'm just really bad at it
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:50
never tried making something work in hardware lmao
Gersho
@Gersho
Aug 23 2017 04:50
"Farpotshket" (Yiddish)What It Means:Something that was a little bit broken ... until you tried to fix it. Now it's totally screwed.
that's me
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:50
just playing around
hmm saaammmeee
I destroyed both of my ps3 controllers "trying to fix them"
Gersho
@Gersho
Aug 23 2017 04:51
back then i actually repaired a few ps1-2 ones, but that was back when they had a hard board
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:51
uggghh PS1 memories
Pepsi Man :joy:
Amit Patel
@AmitP88
Aug 23 2017 04:53
hey guys, I'm working on building a game using react canvas and I've run into a few errors when I installed it to my project via npm. Judging from the errors, is this a cause for concern when building my app? In other words, will I run into problems using react-canvas when working on my project?
Darren
@DarrenfJ
Aug 23 2017 04:53
"Farpotshket" :D
Amit Patel
@AmitP88
Aug 23 2017 04:53
react-canvas installed.png
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:54
it says that it need react installed and it wasn't found
try installing react and react-dom
@AmitP88 npm install --save react react-dom
Gersho
@Gersho
Aug 23 2017 04:54
@DarrenfJ google site:cracked.com foreign words // they have plenty of other exemple ^^
Amit Patel
@AmitP88
Aug 23 2017 04:55
@ahmedtarek2134 hmmm, I installed react before installing react-canvas. but I'll try your suggestion
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:55
@AmitP88 hmm ok can you take a screenshot of your package.json file
Amit Patel
@AmitP88
Aug 23 2017 04:57
package.png
@ahmedtarek2134 when I started this project, I followed the installation instructions under Create a New App: https://facebook.github.io/react/docs/installation.html
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 04:58
@AmitP88 use create-react-app better
firstly run this command
npm install -g create-react-app
then after it finishes installing
go to the directory where you want your project to be and run this command
create-react-app <project-name> replace <project-name> with whatever you want the project to be called
Amit Patel
@AmitP88
Aug 23 2017 05:00
@ahmedtarek2134 so the -g create-react-app command should be used on desktop?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:00
it can be used anywhere, the "-g" installs it globally on your machine
Amit Patel
@AmitP88
Aug 23 2017 05:01
ah ok. because when I started this project, I did that inside my project folder
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:01
with what exactly, react-canvas?
Amit Patel
@AmitP88
Aug 23 2017 05:01
no, with create-react-app, like the docs say
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:02
you can do it anywhere, it will be installed globally
Amit Patel
@AmitP88
Aug 23 2017 05:02
I was able to work on my project just fine, but then I wanted to use react-canvas and that's when I started running into warnings upon npm install
I even checked my node_modules folder inside my project folder and I had the react folders installed beforehand
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:03
maybe the version you installed isn't the latest, create-react-app will install the latest boilerplate template
Amit Patel
@AmitP88
Aug 23 2017 05:03
that's what I used though. I did exactly what the react docs said and they used npm install create-react-app
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:04
hmmm
ohhhh
did you do npm install react-canvas?
Amit Patel
@AmitP88
Aug 23 2017 05:04
yeah, I did it according to this: https://github.com/Flipboard/react-canvas
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:04
because create-react-app uses yarn and not npm
Amit Patel
@AmitP88
Aug 23 2017 05:05
ooooh I see
lol I have no idea what yarn is, but I've heard of it
I heard about it from react-konva
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:05
its like npm, no difference now with the new npm update
at first it was faster than npm
but now with npm v5 they are like the same
if you don't have it installed, do npm install -g yarn
Amit Patel
@AmitP88
Aug 23 2017 05:06
hmmm, does npm update automatically?
ah ok
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:06
no it doesn't but they should notify your when a new version is out
Amit Patel
@AmitP88
Aug 23 2017 05:06
ah ok
hmmm, I have npm version 3.10.10
how do I install the latest update?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:08
download the latest version of node
the v8.0.0
I just created a project to try if react-canvas installs and yep it does successfully
Amit Patel
@AmitP88
Aug 23 2017 05:09
ah ok
hmm, react-canvas folder is in my node_modules folder. should I uninstall react-canvas and reinstall after nodev8?
Darren
@DarrenfJ
Aug 23 2017 05:10
sorry, was off playing around with Spock quotes...
maybe I should have the random quote machine with a button that coverts it to yiddish :D
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:10
you should create a whole new project, just to make things clear
Amit Patel
@AmitP88
Aug 23 2017 05:11
ok, i'll do that
luckily I haven't written much in the project so far
Albert Cardona II
@daddycardona
Aug 23 2017 05:11
@DarrenfJ yes you should do that lol
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:11
@AmitP88 that's good
Jill Lee
@jill-lee
Aug 23 2017 05:12
Hi, how do you make the nav bar menu links work and open to a new page within codepen when you click on it? Is it possible?
Amit Patel
@AmitP88
Aug 23 2017 05:13
ok, v8 is installed. let me delete my project, install create-react-app -g and then try react-canvas install. hopefully it'll be clean this time
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:13
@AmitP88 did you install yarn?
Amit Patel
@AmitP88
Aug 23 2017 05:13
I believe so, let me double-check
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:14
@phoenix-burn make them anchor tags with the href to the page and the add target="_blank" as an attribute
Darren
@DarrenfJ
Aug 23 2017 05:14
@daddycardona :D
i just added a spock button that just adds spock quotes
Amit Patel
@AmitP88
Aug 23 2017 05:14
yarn.png
yeah, I have it installed
don't know if anything is missing though
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:15
Amit Patel
@AmitP88
Aug 23 2017 05:15
damn, looks like I have a few errors
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:16
can you re-write the command but --version instead of -v
because its usually -V so -v would result in an error
Amit Patel
@AmitP88
Aug 23 2017 05:17
ok, all it printed was 0.27.5
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:17
oke then you have it installed
Amit Patel
@AmitP88
Aug 23 2017 05:17
is that because -v is only used in npm?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:17
i don't know tbh
Amit Patel
@AmitP88
Aug 23 2017 05:17
nvm, I just read your comment lol
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:17
do you have create-react-app installed
?
create-react-app --version
Darren
@DarrenfJ
Aug 23 2017 05:18
@phoenix-burn yes...
Amit Patel
@AmitP88
Aug 23 2017 05:18
yeah, got version 1.4.0
Darren
@DarrenfJ
Aug 23 2017 05:18
@phoenix-burn gotta use target blank though
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:19
@AmitP88 now go to where you want your new project to be and run the create-react-app <project-name> command
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:19
and then cd into the project and run yarn add react-canvas
Amit Patel
@AmitP88
Aug 23 2017 05:20
should I make a new folder or use my existing project folder? (I already did create-react-app my-app inside my project folder
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:20
no use a new folder, its cleaner
Amit Patel
@AmitP88
Aug 23 2017 05:20
ok
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:20
forget about the existing project folder
Amit Patel
@AmitP88
Aug 23 2017 05:22
ok, I deleted the existing project folder. hang on a sec
when I type in create-react-app <project name> should I use the '<' '>' ?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:25
no
that's just a placeholder
Amit Patel
@AmitP88
Aug 23 2017 05:25
oh ok. it's installing atm
Jill Lee
@jill-lee
Aug 23 2017 05:26
@ahmedtarek2134 @ahmedtarek2134 @DarrenfJ I mean not an external link but links within codepen links that will open to a new page in codepen within the page. Target blank works but it open a new codepen in codepen. What i mean my navigation bar doubles
Amit Patel
@AmitP88
Aug 23 2017 05:27
canvas.png
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:28
annndd ittsss donnnee
react-canvas is installed
Amit Patel
@AmitP88
Aug 23 2017 05:28
I got two warnings though, is that ok?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:28
warnings do always happen, dw about them
Darren
@DarrenfJ
Aug 23 2017 05:28
@phoenix-burn a link in CodePen that opens something like a thumbnail on the same page in CodePen?
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:28
errors are the ones you should worry about
Amit Patel
@AmitP88
Aug 23 2017 05:28
ah I see
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:29
anyway ama need to go sleep now, goodnight everyone :sleeping:
Amit Patel
@AmitP88
Aug 23 2017 05:29
@ahmedtarek2134 thanks bro for your help, I really appreciate it :)
CamperBot
@camperbot
Aug 23 2017 05:29
amitp88 sends brownie points to @ahmedtarek2134 :sparkles: :thumbsup: :sparkles:
:cookie: 582 | @ahmedtarek2134 |http://www.freecodecamp.com/ahmedtarek2134
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:29
@AmitP88 np man :+1:
Amit Patel
@AmitP88
Aug 23 2017 05:29
have a good night dude
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:30
u too
Jill Lee
@jill-lee
Aug 23 2017 05:30
@DarrenfJ Target works but my navigation bar doubles so what its doing is it opens an entire codepen within codepen and what i only want to happen is open a new page within codepen
prakash chandra yadav
@prakashyadav008
Aug 23 2017 05:30
hey can anyone help me out
how do i remove the spacing between the search bar and the search button
.?
Jill Lee
@jill-lee
Aug 23 2017 05:31
brb
Darren
@DarrenfJ
Aug 23 2017 05:32
@ahmedtarek2134 night brutha
and thanks for helping out straigh through for the last hour :D
thanks @ahmedtarek2134
Gersho
@Gersho
Aug 23 2017 05:32
@prakashyadav008 i don't see the space you mention
CamperBot
@camperbot
Aug 23 2017 05:32
:cookie: 583 | @ahmedtarek2134 |http://www.freecodecamp.com/ahmedtarek2134
darrenfj sends brownie points to @ahmedtarek2134 :sparkles: :thumbsup: :sparkles:
Gersho
@Gersho
Aug 23 2017 05:32
just finished doing the html/css basic layout of my calculator so i can actually start coding
prakash chandra yadav
@prakashyadav008
Aug 23 2017 05:33
do u see it now
Gersho
@Gersho
Aug 23 2017 05:34
yeah, but it wasn't there
Darren
@DarrenfJ
Aug 23 2017 05:34
@phoenix-burn not sure if there's some super secret code for CodePen that only links the content.. maybe try using the fullpage view
prakash chandra yadav
@prakashyadav008
Aug 23 2017 05:34
ya i used inline-flex property but if i dont use it then the space comes back
@Gersho
Darren
@DarrenfJ
Aug 23 2017 05:35
@phoenix-burn although yer probably working on something that makes more sense to do via gitHub pages or something
Gersho
@Gersho
Aug 23 2017 05:35
@prakashyadav008 i see you have .search-button{ margin:0;}
did you try with a negative left margin ?
Tyler Furby
@tyler-furby
Aug 23 2017 05:35
@sjames1958gm Thank you so much! Fixed it!
CamperBot
@camperbot
Aug 23 2017 05:35
tyler-furby sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8367 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ahmed Tarek
@ahmedtarek2134
Aug 23 2017 05:36
@DarrenfJ hah thx bro, u have a nice day too !
prakash chandra yadav
@prakashyadav008
Aug 23 2017 05:39
@Gersho ya that works
thanks
but i can get the search bar and button to align in a row
Gersho
@Gersho
Aug 23 2017 05:40
by the way do you really need that search field to expand when selected ? this is for a wikipedia search so people won't type long text in there
prakash chandra yadav
@prakashyadav008
Aug 23 2017 05:41
thats not important actually first i need to get them in a straight line @Gersho ersho
Gersho
@Gersho
Aug 23 2017 05:44
but they were earlier ? what happened
prakash chandra yadav
@prakashyadav008
Aug 23 2017 05:45
ya i am trying to get the search button to be a bit bigger but when ichange the size it misaligns
Gersho
@Gersho
Aug 23 2017 05:47
well then do in 2 steps, first you get it the size you want, then you move it around with padding/margin
prakash chandra yadav
@prakashyadav008
Aug 23 2017 05:48
ya trying ..unsuccessful at the moment
change only one value at a time so you can see in what direction it goes
Gersho
@Gersho
Aug 23 2017 05:56
anyway good luck to you i'm off ! bye
Darren
@DarrenfJ
Aug 23 2017 06:00
@Gersho have a good one brutha.. and my usual thank you's for helping out
CamperBot
@camperbot
Aug 23 2017 06:00
darrenfj sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 346 | @gersho |http://www.freecodecamp.com/gersho
Darren
@DarrenfJ
Aug 23 2017 06:01
for all the brownies and goldstars you missed mining the helpMines
i'm off to walk dogs then likely to sleep too...
later roomies :D
julien Demarque
@JulienDemarque
Aug 23 2017 07:12
Hello, Anyone can help me with exporting code from Glitch to Github? I am not sure I understand the steps...
Suhail Bahawi
@IKing4ever1
Aug 23 2017 07:23
How can I make the page accessible only by another page
؟؟؟
bt php
by php *
i want to do control panel
for the website
koder3
@koder3
Aug 23 2017 07:45
<div class = "getTheNumber">
34.44
<button class = "btn"></button>
</div>
how do i access the number that is 34.44
using javascript
Jill Lee
@jill-lee
Aug 23 2017 07:53
@DarrenfJ I was thinking about that but was just wondering. Thanks
CamperBot
@camperbot
Aug 23 2017 07:53
phoenix-burn sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1984 | @darrenfj |http://www.freecodecamp.com/darrenfj
Sorin Ruse
@sorinr
Aug 23 2017 08:25
@koder3 something like $('div.getTheNumber').val() but you should move the button outside of that div. see here an example
George Fandridis
@fandridis
Aug 23 2017 08:35
@koder3 If you don't want to use jquery, I would give the div before the number an ID lets say id="theNumber" and then you could target it with var x document.getElementById("theNumber").innerHTML
Suhail Bahawi
@IKing4ever1
Aug 23 2017 08:36
@IKing4ever1
hello
when i insert arabic text from php to sqll
the text be like this سشيشسيشسÙ
wh ?
why ?
  • the table is utf-8
George Fandridis
@fandridis
Aug 23 2017 08:38
@koder3 But generally , you might think of doing something like this:
<div class = "getTheNumber"> <p id="theNumber> 34.44 </p> <button class = "btn">Click Me</button> </div>
pfff I expected "line break" to make this much more readable
Stephen James
@sjames1958gm
Aug 23 2017 09:12
@koder3
I would use
document.querySelector(".getTheNumber").textContent
Owais Ahmed
@owaisehmed
Aug 23 2017 09:59
https://codepen.io/OwaisEhmed/pen/zdRozE
how can i make the buttons hover with the blue background?
Victor Popescu
@VicPopescu
Aug 23 2017 10:33
@owaisehmed .navbar-nav li:hover{ background-color: 'potato'}
gishy1
@gishy1
Aug 23 2017 13:08
hello world
need help
Gulsvi
@gulsvi
Aug 23 2017 13:12

@owaisehmed Replace this:

a:hover {
  background-color: #2C3E50 !important;
  color: #18BC9C;
}

With:

.navbar-nav > li > a:hover {
  background-color: #2C3E50;
  color: #18BC9C;  
}

So it only applies to navbar links. That will override bootstrap's default styling.

@gishy1 what's up?
gishy1
@gishy1
Aug 23 2017 13:13
image.png
Gulsvi
@gulsvi
Aug 23 2017 13:14
@gishy1 that challenge uses what we learned earlier about .pop(), .shift(), .unshift(), and .push()
.push() will add an element to the end of an array: https://www.freecodecamp.org/challenges/manipulate-arrays-with-push
image.png
add an element to the end, remove an element from the beginning, return the element from the beginning that you removed
Gersho
@Gersho
Aug 23 2017 13:24
hello everyone !
https://codepen.io/Gersho/pen/RZJPrZ
looking for opinion / check if it's working, etc <3
Gulsvi
@gulsvi
Aug 23 2017 13:30
@Gersho Clear buttons don't seem to work
Ken Haduch
@khaduch
Aug 23 2017 13:30
@Gersho - good day... just taking a quick look at the calculator. Basic math operations seem to work. I can enter a sequence of keys that give a display of 0.3.6.2 - multiple decimal points. In fact, I can just enter ..... and have it display as 0...., and the "AC" key doesn't seem to clear it. At least not the display, I think that I can enter other input after the AC is clicked.
Gersho
@Gersho
Aug 23 2017 13:33
oh the points, forgot those D: thanks for input @SkyC0der @khaduch
CamperBot
@camperbot
Aug 23 2017 13:33
gersho sends brownie points to @skyc0der and @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2539 | @skyc0der |http://www.freecodecamp.com/skyc0der
:star2: 3232 | @khaduch |http://www.freecodecamp.com/khaduch
gishy1
@gishy1
Aug 23 2017 13:52
@SkyC0der bro very grateful that diagram has really helped me!!!
Gersho
@Gersho
Aug 23 2017 13:55
i think i fixed clear, dots and ac, should be working as intended now
Gulsvi
@gulsvi
Aug 23 2017 14:02
@Gersho Nice work! Just painful floating point issues now, but that isn't a user story technically.
0.05 - 0.04 = 0.010000000000000002
It doesn't do quadratic equations either :)
Gersho
@Gersho
Aug 23 2017 14:04
quadratic ?
also how am i supposed to fix it if the math itself is wrong ? (your 0.05 - 0.04 exemple)
Gulsvi
@gulsvi
Aug 23 2017 14:12
@Gersho That was a joke about quadratic equations. (bad joke, still waking up). The 0.05 - 0.04 example is common in most of our calculators. It's a floating point arithmetic issue. A good discussion on how to handle those values here: https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript
Gersho
@Gersho
Aug 23 2017 14:15
i've read a bit, there was maths, i closed the tab and decided i'll call it a feature
gishy1
@gishy1
Aug 23 2017 14:28
image.png
need help guys
Gersho
@Gersho
Aug 23 2017 14:31
you're mixing up stuff a bit here
Margaret
@Margaret2
Aug 23 2017 14:31
@gishy1 wasThatTrue is not the name of the function
so you can't call it like that
Gersho
@Gersho
Aug 23 2017 14:31
wasThatTrue() is called 2 times on the last 2 lines but there is no function with such name
Pethaf
@Pethaf
Aug 23 2017 14:36
@SkyC0der You could limit the size of the floating point numbers.
Gersho
@Gersho
Aug 23 2017 14:39
i could, but how would i know when it's one of those specific cases, and when those floaters are relevant ?
i ended up using scientific notation, it's not a real fix but it'll do
Pethaf
@Pethaf
Aug 23 2017 14:41
Could work.
I used a variable to track the number of floaters entered.
Gersho
@Gersho
Aug 23 2017 14:42
how do you do for division ?
Darren
@DarrenfJ
Aug 23 2017 14:43
morning fCC
@phoenix-burn hey didja ever get that CodePen page in a codepen figured out?
@Gersho hey man :D :wave:
Gersho
@Gersho
Aug 23 2017 14:44
hey Darren, slept only 2 hours but my calculator's code is mostly done :D @DarrenfJ
Darren
@DarrenfJ
Aug 23 2017 14:45
coolCool
we'll sleep when we're dead ;)
coders mantra :D
Gersho
@Gersho
Aug 23 2017 14:46
well that wasn't on purpose, but going to sleep at 3 and i couldn't sleep by 6 so might as well get up >.>
Darren
@DarrenfJ
Aug 23 2017 14:47
might as well
Gersho
@Gersho
Aug 23 2017 14:49
now i have to make it look cool, i hate css :(
Darren
@DarrenfJ
Aug 23 2017 14:50
agreed
took a design cert a few years back and much prefer actually designing a layout like with illustrator or something rather than CSS
css is thee worst :/
Gersho
@Gersho
Aug 23 2017 14:51
well for my simon, i did it on paper and mesured stuff then did all the css in fixed position
well since i did the JS already, guess i'll take a break and come back later ^^
Darren
@DarrenfJ
Aug 23 2017 14:57
:D
yah that's how we used to do it back in the day... even with illustrator.. lay it out in scratch notes...
but css can be so un-intuitive
but at least yer getting it done :D
Darren
@DarrenfJ
Aug 23 2017 15:11
thanks @Gersho for chatting off totest :D
CamperBot
@camperbot
Aug 23 2017 15:11
darrenfj sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @gersho |http://www.freecodecamp.com/gersho
Ravi Kishore Thella
@ravikishorethella
Aug 23 2017 15:29
@DarrenfJ :wave:
how are you?
Kotdrobinachaosu
@Kotdrobinachaosu
Aug 23 2017 17:18
hey team :)))
i got a simple one
so

include <iostream>

main ()
(

cout << "meow";

)

and this sends me [Error] expected unqualified-id before ')' token something like that
help plz :C i feel stupid
Ian Hicks
@ijhicks
Aug 23 2017 17:31
having some trouble w a codepen that doesnt seem to be passing global variables to functions lower in the code.. wondering if im doing something wrong.. if anyone could take a look
Nicol
@NicolNonga
Aug 23 2017 17:32
hello help me please
Ian Hicks
@ijhicks
Aug 23 2017 17:32
it seems that my input variable isnt defined.. but I thought i defined it at the top
Nicol
@NicolNonga
Aug 23 2017 17:32

function diffArray(arr1, arr2) {
var newArr = [];
// Same, same; but different.

for(var i=0; i<= arr1.length; i++){

  if(arr2.indexOf(arr1[i])===-1){

    newArr.push(arr1[i]);
  }
  }


return newArr;

}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);

Diff Two Arrays
Christopher McCormack
@cmccormack
Aug 23 2017 17:33
@NicolNonga when iterating over an array and starting your iterator (i) at 0, you usually want to use i < arr1.length not i<= arr1.length
Otherwise you'll go one too far which is out of bounds of the array
Kotdrobinachaosu
@Kotdrobinachaosu
Aug 23 2017 17:34
Can i haz help also ?
:)

include <iostream>

using namespace std;
main ()
(
cout << "meow";
)
this code gives me responce in the compiler
[Error] expected unqualified-id before ')' token
Nicol
@NicolNonga
Aug 23 2017 17:36
-+ @cmccormack that is right but it return an empty array any ideia
Christopher McCormack
@cmccormack
Aug 23 2017 17:37
@NicolNonga your example doesn't have a value in the first array that isn't in the second, so nothing gets pushed
Albert Cardona II
@daddycardona
Aug 23 2017 17:39

$(function() {
    // Activate Carousel
    $("#myCarousel").carousel();

    // Enable Carousel Indicators
    $(".item1").click(function() {
        $("#myCarousel").carousel(0);
    });
    $(".item2").click(function() {
        $("#myCarousel").carousel(1);
    });
    $(".item3").click(function() {
        $("#myCarousel").carousel(2);
    });
    $(".item4").click(function() {
        $("#myCarousel").carousel(3);
    });

    // Enable Carousel Controls
    $(".left").click(function() {
        $("#myCarousel").carousel("prev");
    });
    $(".right").click(function() {
        $("#myCarousel").carousel("next");
    });

    //clicking on links with fixed navbar
    $(document).on("click", "a", function() {
        console.log($(this).attr('href'));
        if ($(this).attr('href') !== $('#top')) {
            $("html, body").animate({
                    scrollTop: $($.attr(this, "href")).offset().top - 60
                },
                1250
            );
        } else {
            $("html, body").animate({
                    scrollTop: $($.attr(this, "href")).offset().top
                },
                1250
            );
        }
    });
    $('[data-toggle=tab]').click(function() {
        if ($(this).parent().hasClass('active')) {
            $($(this).attr("href")).toggleClass('active');
        }
    });
});
can anyone help me understand why the home button no longer brings the page to the top?
this is the link
Toshi Badwaik
@toshibadwaik
Aug 23 2017 17:41

https://codepen.io/toshibadwaik/pen/dzKRpK

can anyone help me out with this, I want to marquee all the images such that it will appear one after the other, but actually its appearing one below other… plz help me out

Nicol
@NicolNonga
Aug 23 2017 17:41
@cmccormack i update de code still the same

function diffArray(arr1, arr2) {
var newArr = [];
// Same, same; but different.

for(var i=0; i< arr1.length; i++){

for( var j=0; j<arr2.length; j++){

   if(arr1[i]!=arr2[j]){


     newArr.push(arr2[j]);
   }     


return newArr;

}
}
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);

Kotdrobinachaosu
@Kotdrobinachaosu
Aug 23 2017 17:43
ok thx :)
Christopher McCormack
@cmccormack
Aug 23 2017 17:43
@NicolNonga that's not going to work either - you were on the right track using indexOf, but you also have to make sure you're checking BOTH arrays.
oops I didn't read your latest code properly, let me review. it would help a lot of you formatted your code properly
```
code
```
Stephen James
@sjames1958gm
Aug 23 2017 17:44
@Kotdrobinachaosu you ned {} not () around the function body
using namespace std;
main ()
{
cout << "meow";
}
Christopher McCormack
@cmccormack
Aug 23 2017 17:45
@NicolNonga your latest code is going to push values to the array even if there is a match somewhere else, just not when they do match
@daddycardona this is kind of confusing - any reason you couldn't just add an id or class to the home button and target it that way?
Albert Cardona II
@daddycardona
Aug 23 2017 17:48
I did add an id id="top" and it don't work that way either
@cmccormack
Nicol
@NicolNonga
Aug 23 2017 17:50
@cmccormack thanks a lot it work
CamperBot
@camperbot
Aug 23 2017 17:50
nicolnonga sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1164 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Aug 23 2017 17:50
@NicolNonga np
@daddycardona did you try logging the value you get from $($.attr(this, "href")).offset().top to console to see the value?
Albert Cardona II
@daddycardona
Aug 23 2017 17:53
Yes
console.log($(this).attr('href')); like this
does it make a difference how I do it?
Christopher McCormack
@cmccormack
Aug 23 2017 17:55
did you get a number as in your console?
Albert Cardona II
@daddycardona
Aug 23 2017 17:55
No I got it to say #top
Christopher McCormack
@cmccormack
Aug 23 2017 17:56
Did you log the whole string I pasted above or just what you pasted above
Albert Cardona II
@daddycardona
Aug 23 2017 17:57
I am doing what you said right now
I just uploaded it let me check @cmccormack
Christopher McCormack
@cmccormack
Aug 23 2017 17:57
anyhow the idea is to log the number value so you can see where scrollTop will actually move the scrollbar
Albert Cardona II
@daddycardona
Aug 23 2017 17:58
I did I think it is moving it 60px at a time
up
when i wrote that if statement it should of not allowed that offset of 60 which is weird with out the if statement I get an error
@cmccormack
actually it did not move just 60 it moved almost 200px however it does not seem to be taking what I am saying correctly
Christopher McCormack
@cmccormack
Aug 23 2017 18:04
Keep logging and testing, I'm sure you will find the issue. Best way to troubleshoot is log your variables and see if they match what you would expect
Albert Cardona II
@daddycardona
Aug 23 2017 18:05
I think I did let me try
nope
Albert Cardona II
@daddycardona
Aug 23 2017 18:14
@cmccormack could it be that I have two click functions differently and might need to bind them together some how?
Christopher McCormack
@cmccormack
Aug 23 2017 18:23
@daddycardona not sure, it's hard to play with your code as you're hosting it
if you wanted to drop it into a codepen or something we could play with it and see
Albert Cardona II
@daddycardona
Aug 23 2017 18:23
does codepen allow php?
Stephen James
@sjames1958gm
Aug 23 2017 18:25
@daddycardona php is generally a server side language.
SO I did just that php was not really the issue I think
I think ever since i added the toggle =tab function it stopped working I am just moving stuff around now
Christopher McCormack
@cmccormack
Aug 23 2017 18:36
ah
here's your problem
#top moves with the page
so it's top value keeps changing
@daddycardona set scrollTop: 0 for your #top condition, and also make sure you adjust your first condition to match the string not the element - if ($(this).attr('href') !== '#top') {
Albert Cardona II
@daddycardona
Aug 23 2017 18:39
yes
I don't know what you mean set scrollTop:0 if I am trying to use the animated function
Christopher McCormack
@cmccormack
Aug 23 2017 18:40
you want it to scroll to the very top of the page if home is selected, correct?
Albert Cardona II
@daddycardona
Aug 23 2017 18:41
Yes I figured out what to do
Christopher McCormack
@cmccormack
Aug 23 2017 18:41
https://codepen.io/cmccormack/pen/mMKGry
Albert Cardona II
@daddycardona
Aug 23 2017 18:41
thanks @cmccormack you the best don't let anyone else know I told you that LOL
CamperBot
@camperbot
Aug 23 2017 18:41
daddycardona sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1165 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Aug 23 2017 18:41
haha glad to help
Albert Cardona II
@daddycardona
Aug 23 2017 18:42
it was the conditioning like you said :)
Albert Cardona II
@daddycardona
Aug 23 2017 18:47
@AlejandroHTadinoM I see what you did I made it harder for myself and did this scrollTop: $($.attr(this, "href")).offset().top = 0 and you simpley said scrollTop:0 I see now genius LOL
@cmccormack
I don't know how that happen the alejandro lol
Christopher McCormack
@cmccormack
Aug 23 2017 18:48
@daddycardona plus that wouldn't work as that element kept moving down the page, that's why you only saw the scroll move a little
but yeah, 0 is a lot easier :D
Albert Cardona II
@daddycardona
Aug 23 2017 18:49
LOL
I overcomplicate things why I am not done with certain challenges like the wherefor are though
Christopher McCormack
@cmccormack
Aug 23 2017 18:51
haha it IS a bit complicated but at least you're probably learning more this way
Albert Cardona II
@daddycardona
Aug 23 2017 18:54
yes I just forget as much as I learn because how much time it has been taking me to make this site. I think I am going to redo it tonight in wordpress because I might get paid for it and it is that much easier to use wordpress so that I don't have to worry about ~0
~moz ~webkit lol this is a template for this company I do like the logo I made for them though :)
Christopher McCormack
@cmccormack
Aug 23 2017 18:58
Sometimes it's good to take pieces of code you wrote and liked and put it in a gist a pen to show examples that you can refer to later
Albert Cardona II
@daddycardona
Aug 23 2017 19:07
I started to save all my challenges and code on my hard drive
Christopher McCormack
@cmccormack
Aug 23 2017 19:09
do one better and add them to an FCC git repo along with github or another SVN repo so it's also backed up!
Albert Cardona II
@daddycardona
Aug 23 2017 19:11
Yes I will be doing that tonight or tomorrow sounds like the smart thing to do I have to go once again thanks a lot for the help :)
Christopher McCormack
@cmccormack
Aug 23 2017 19:18
np
Razvan
@razvanlikespizza
Aug 23 2017 19:42
@daddycardona Hey daddy, how are you? ;)
John Gabriel Simmons
@sosmaniac-FCC
Aug 23 2017 20:57
All of my click events beyond the first button labeled 'Click' are not firing upon mouse click. I have been playing around with the syntax for awhile to no avail. May someone familiar with react.js help me out with this stubborn issue? https://codepen.io/sosmaniac/pen/oepOGw/?editors=0110
Kyle Holm
@thekholm80
Aug 23 2017 20:58

@sosmaniac-FCC you have an error:

addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

John Gabriel Simmons
@sosmaniac-FCC
Aug 23 2017 21:07
Hmm.. I will have to further investigate what a ref in react is. I did not think I was using any refs but perhaps I am mistaken here. Thanks @thekholm80
CamperBot
@camperbot
Aug 23 2017 21:07
sosmaniac-fcc sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1451 | @thekholm80 |http://www.freecodecamp.com/thekholm80
John Gabriel Simmons
@sosmaniac-FCC
Aug 23 2017 21:23
oh wait, I see now. Importing react-with-addons means I do not have to import plain old react with it. Derp.
Mike Batista
@mbmontana
Aug 23 2017 22:41
This is the Check for Palindromes challenge. The error message I got is "Cannot read property of 'replace' of undefined. Am I heading in the right direction or should I clear my code and start over?
function palindrome(str) {
 RegExp (str[/[^a-z0-9+]+/gi]);
 str = str.prototype.replace
(str, subString).split('').reverse().join('').toLowerCase();
 if (subString == str) {
  // Good luck!

  return true;}
  return false;
}



palindrome("eye");
Uriel Guzmán
@Burinson
Aug 23 2017 22:43
https://codepen.io/Burinson/pen/eEEdoK?editors=1100
How can I make the #searchIcon expand with input when the width expands?
just1witness
@just1witness
Aug 23 2017 23:27
K, so yeah, I know this code is really bad and probably doesn't make a lot of sense, but even so I am SOOOO close to passing the test! (after I pass... if I pass, I will then watch a bunch of tutorials on it and learn how to do it right) This is my solo run through with my limited knowledge. So, the question is, now that I got it returning the correct format and only money values under the change that's due, how do I get it to return as many of each value that is needed equal the changeDue amount? I am assuming I would use % somehow, but i'm having trouble wrapping my mind around it. (on the plus side I get for loops now! :grinning: ) For instance changeDue = .50 returns one of each value under .50 , one quarter, one dime, one nickel, and one penny. How would I get it to return TWO quarters?
 var monVal = [
    {value: 100.00},
    {value: 20.00},
    {value: 10.00},
    {value: 5.00},
    {value: 1.00},
    {value: 0.25},
    {value: 0.10},
    {value: 0.05},
    {value: 0.01},
  ];

  var monName = [
    {name: "ONE HUNDRED"},
    {name: "TWENTY"},
    {name: "TEN"},
    {name: "FIVE"},
    {name: "ONE"},
    {name: "QUARTER"},
    {name: "DIME"},
    {name: "NICKEL"},
    {name: "PENNY"},
  ];

function checkCashRegister(price, cash, cid) {
  var answer = [];
  var changeDue = (cash - price) * 100;
  var CID = (cid.reduce(function(acc,val){
    return acc+val[1]*100;
  },0));


  if (changeDue === CID) {
    return 'Closed';
  }
  if (changeDue > CID/100){
    return 'Insufficient Funds';
  }


  for (var i = 0; i < monVal.length; i++) {
    if(Object.values(monVal[i]) <= changeDue/100){
     answer.push(Object.values(monName[i]) + ", " + Object.values(monVal[i]));

    }
  }  
 return answer;  
}

checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
Margaret
@Margaret2
Aug 23 2017 23:39
@mbmontana i don't quite get what you're trying to do tbh
i don't see how any of the first three lines are supposed to work