These are chat archives for FreeCodeCamp/Help

22nd
Feb 2015
John Hampton
@jjhampton
Feb 22 2015 00:00
maybe i'm just not reading the DOM setup correctly. rereading
Angelica Ferdinand
@ESOComputing
Feb 22 2015 00:00
I think this section is what you should focus on first:
The .append() and .appendTo() methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With .append(), the selector expression preceding the method is the container into which the content is inserted. With .appendTo(), on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted into the target container.
Gregory Scheerlinck
@greg-js
Feb 22 2015 00:01
@jjhampton there's also prepend, before, after, html, insertAfter, insertBefore, and I'm sure I'm forgetting one or two, they're all subtly different, check the docs for more info
Angelica Ferdinand
@ESOComputing
Feb 22 2015 00:01
Right.
Depending on what you're using, it affects how the DOM manipulation occurs.
I'm looking at your code again...
One sec
John Hampton
@jjhampton
Feb 22 2015 00:03
@wdgreg will do that too. one thing i've noticed is that the jquery docs are a little harder to follow than the MDN JS docs, IMO
Gregory Scheerlinck
@greg-js
Feb 22 2015 00:03
Yep, but the overall idea is pretty much the same, it's not like you have to memorize the particulars of all of them, in practice you'll run into certain situations that require certain solutions and jquery has most of these different solutions wrapped up nicely for you in separate methods
Angelica Ferdinand
@ESOComputing
Feb 22 2015 00:04
@jjhampton They do tend to be a bit dry. I agree. Sometimes I have to read thru several times before I understand.
Gregory Scheerlinck
@greg-js
Feb 22 2015 00:05
the jquery doc pages are pretty good imo, but finding the right one can be tricky.. and also, all the docs on anything on the web are probably inferior to MDN :)
John Hampton
@jjhampton
Feb 22 2015 00:05
@wdgreg, yes, i've found it very convenient the various methods that jQuery provides. just started playing around with it last week. can't wait to use many of them more.
Angelica Ferdinand
@ESOComputing
Feb 22 2015 00:07
I loved JQuery when I discovered it last November.
<3
John Hampton
@jjhampton
Feb 22 2015 00:20
strange, i was able to get it to work with var target = $('.target'); $('#location2').append(target);
Angelica Ferdinand
@ESOComputing
Feb 22 2015 00:21
I think it has to do with the syntax differences they talk about in the jQuery doc.
John Hampton
@jjhampton
Feb 22 2015 00:59
figured it out, it was a syntax thing. to use .append() for that solution the parameter must be expressed as a jQuery object, not as a selector
John Hampton
@jjhampton
Feb 22 2015 01:04
thx for the help all
Shane Dutcher
@sdkask
Feb 22 2015 05:50
Needing help on dash project 4 section 4 slide 35 with: include an @webkit-keyframes animation with the same values. and you’ll need an @moz-keyframes version, too. I am unsure of what they want
Cristián Berríos
@crisberrios
Feb 22 2015 05:51
you need to add them
Jeroen
@teKoa
Feb 22 2015 05:52
They want you to add the prefixes for browsers that do not support it yet
Cristián Berríos
@crisberrios
Feb 22 2015 05:52
so you have @keyframes {...} @moz-keyframes {...} and @webkit-keyframes {...}
and if there are gradients
Jeroen
@teKoa
Feb 22 2015 05:52
  • in front though right?
like -webkit- and -moz-
no idea why the - turned into a dot there
Cristián Berríos
@crisberrios
Feb 22 2015 05:53
yeah
it's -moz-keyframes
and -webkit-keyframes
Shane Dutcher
@sdkask
Feb 22 2015 05:53
Alright let me try
The part with the same values i am not getting
Cristián Berríos
@crisberrios
Feb 22 2015 05:59
can you paste your code?
don't forget to add lines with ` ` ` before and after code to format it
Shane Dutcher
@sdkask
Feb 22 2015 06:01
i only have the starting point i am not sure what i am adding in the \@moz-keyframes { } and @webkit-keyframes { } \
Cristián Berríos
@crisberrios
Feb 22 2015 06:02
the same content inside @keyframes
also, it's @-moz-keyframes and -webkit-keyframes
Jeroen
@teKoa
Feb 22 2015 06:03
@DevKask did you manage to get the blinking eyes?
Shane Dutcher
@sdkask
Feb 22 2015 06:04
yes
Jeroen
@teKoa
Feb 22 2015 06:04
because it is pretty much the same like that
3 times the same code, 2 which are prefixes (-moz- and -webkit-) to help certain browsers show it properly
Shane Dutcher
@sdkask
Feb 22 2015 06:08
I got it was missing dance
thanks for the help :)
Jeroen
@teKoa
Feb 22 2015 06:09
Awesome, glad you got it :)
Vince
@Vince33
Feb 22 2015 06:22
Hey I was wondering if anybody knew the best way to keep up with changes upstream on git hub just add original repo as remote and fetch ?
Justin Rogers
@yaskyj
Feb 22 2015 06:28
You mean on a forked repo?
Vince
@Vince33
Feb 22 2015 06:29
yeah so trying to keep my local repo uptodate with the orig upstream
so yes forked sorrry
Justin Rogers
@yaskyj
Feb 22 2015 06:31
So, say if I want to pull in the latest FreeCodeCamp, I go to Github and do a pull request, but with my local on the left and the original repo on the right. Then just merge the changes.
Vince
@Vince33
Feb 22 2015 06:32
I am not sure about that
the pull request is after you have changes you want to submit i thought
Justin Rogers
@yaskyj
Feb 22 2015 06:33
Did I misunderstand what you're trying to do?
Kathy O'Driscoll
@odrisck
Feb 22 2015 06:33
a pull request is for when you want to add your changes to the main repo
Vince
@Vince33
Feb 22 2015 06:33
maybe
Justin Rogers
@yaskyj
Feb 22 2015 06:33
Yes, it can be.
But you can use the pull request to merge changes from the original repo.
Kathy O'Driscoll
@odrisck
Feb 22 2015 06:34
if you have access, you wont always if you are forking others work
Vince
@Vince33
Feb 22 2015 06:34
I want my local repo to be up to date with the original I thought that adding it as a remote and fething would keep me up to date
but not sure if that is the work flow
I saw something about rebasing but not sure if I got that
oh remote access you
mean
Justin Rogers
@yaskyj
Feb 22 2015 06:37
I've only done rebasing when I I'm trying to keep my master and gh-pages in sync.
Vince
@Vince33
Feb 22 2015 06:37
@odrisck so is there a efficient way to keep up if the orig is being modified quickly
and you don't have remote access
Kathy O'Driscoll
@odrisck
Feb 22 2015 06:37
have you worked on your fork?
maybe that will help?
Vince
@Vince33
Feb 22 2015 06:39
not yet I am just trying to get a overview before I jump in never contr. before so like to be responsible
Kathy O'Driscoll
@odrisck
Feb 22 2015 06:39
ahh yes then perhaps you want that article I linked
have a look and see if its what you are looking to do
Shane Dutcher
@sdkask
Feb 22 2015 06:41
Is there a way to delete empty folders on mac launchpad?
Justin Rogers
@yaskyj
Feb 22 2015 06:41
@Vince33 Here's how to do it through a pull request in Github if you haven't made any changes: http://www.hpique.com/2013/09/updating-a-fork-directly-from-github/
Vince
@Vince33
Feb 22 2015 06:47
@odrisck @yaskyj cool thanks guys I am going to read through these a little more thoroughly !!!
Vince
@Vince33
Feb 22 2015 06:58
@DevKask I just saw something about a bug with that not sure didn't read through the article but it is from dec
Shane Dutcher
@sdkask
Feb 22 2015 07:00
Awesome thank you
Vince
@Vince33
Feb 22 2015 07:00
np
@DevKask are you watching the live stream?
Shane Dutcher
@sdkask
Feb 22 2015 07:01
Yes
Ryan Malm
@Rybar
Feb 22 2015 07:39
stream?
Vince
@Vince33
Feb 22 2015 07:41
twitch
@Rybar
Vince
@Vince33
Feb 22 2015 07:50
@Rybar Thanks!
Serhii Borovskyi
@serhiicss
Feb 22 2015 13:20
var rectangle = new Object();
rectangle.height = 3;
rectangle.setHeight = setHeight;

rectangle.setHeight = function (newHeight) {
  this.height = newHeight;
};

rectangle.setHeight(6);
Can someone tell me why it returns setHeight not defined?
Kapil Dutta
@duttakapil
Feb 22 2015 13:23
var rectangle.setHeight maybe?
Serhii Borovskyi
@serhiicss
Feb 22 2015 13:26
apparently no need for rectangle.setHeight = setHeight;
I am confused tho.
Kapil Dutta
@duttakapil
Feb 22 2015 13:27
From where is this?
But in the previous chapter I had to declare setSomethig
Kapil Dutta
@duttakapil
Feb 22 2015 13:29
This message was deleted
This message was deleted
Serhii Borovskyi
@serhiicss
Feb 22 2015 13:29
```
Kapil Dutta
@duttakapil
Feb 22 2015 13:29
This message was deleted
Serhii Borovskyi
@serhiicss
Feb 22 2015 13:30
the ``` on the LEFT side of keyboard
This message was deleted
This message was deleted
This message was deleted
above TAB
Kapil Dutta
@duttakapil
Feb 22 2015 13:30
var rectangle = new Object();
rectangle.height = 3;
rectangle.width = 4;
// here is our method to set the height
rectangle.setHeight = function (newHeight) {
  this.height = newHeight;
};
// help by finishing this method
rectangle.setWidth = function (newWidth) {
    this.width = newWidth;
};  

// here change the width to 8 and height to 6 using our new methods
rectangle.setHeight(6);
rectangle.setWidth(8);
Got it
Serhii Borovskyi
@serhiicss
Feb 22 2015 13:31
yes, that is how I did it. But look at the previus problme
// here we define our method using "this", before we even introduce bob
var setAge = function (newAge) {
  this.age = newAge;
};
// now we make bob
var bob = new Object();
bob.age = 30;
bob.setAge = setAge;

// make susan here, and first give her an age of 25
var susan = new Object();
susan.age = 25;
susan.setAge = setAge;


// here, update Susan's age to 35 using the method
susan.setAge(35);
Here we have to setAge for both bob.setAge = setAge;
susan.setAge = setAge;
Why?
But we don't have to declare trianble.setHeight and triangle.setWidth
Kapil Dutta
@duttakapil
Feb 22 2015 13:34
I haven't revised my OOP yet, so I won't be able to tell. But I sure remember asking the same question when I did the Js track last year, and I also remember figuring it out.
Serhii Borovskyi
@serhiicss
Feb 22 2015 13:34
Ok
Thank you tho :)
Kapil Dutta
@duttakapil
Feb 22 2015 13:39
I think it has to do something with the this.x
Serhii Borovskyi
@serhiicss
Feb 22 2015 15:20
This message was deleted
This message was deleted
Oliver
@Dadsaster
Feb 22 2015 18:31
I'm doing a Bonfire and can't figure out what is wrong with my code:
var chunker = [];
function chunk(arr, size) {
  // Break it up.

  for (i=0; i<=size; i++) {
    var tester = arr.slice(i*size,i*size+size);
    if (tester != '') {
        chunker[i] = tester;
        //console.log(chunker, i*size, i*size+size);
    }
  }
  return chunker;
}

chunk([0, 1, 2, 3, 4, 5], 4);
The challenge states: Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.
When I test my code this is just what it does so I'm not sure why I'm failing
Oliver
@Dadsaster
Feb 22 2015 18:36
Apologies - my code passed this time...
Danny Fritz
@dannyfritz
Feb 22 2015 18:38
@Dadsaster i like your answer quite a bit, only thing i'd change is the var chunker = [] outside the function scope
Oliver
@Dadsaster
Feb 22 2015 18:39
@dannyfritz - thanks for the feedback. These are the sort of things that would go unnoticed if I was left to my own devices.
Thiago Ferreira
@ThiagoFerreir4
Feb 22 2015 19:13
Hi all! I'm currently doing the palindrome bonfire challenge...I've been at it for awhile now and I don't know what I'm doing wrong.
Here's my code:
function palindrome(str) {
      var eye = str.length;
    for ( var i = 0; i < Math.floor(eye/2); i++ ) {
        if (str[i] !== str[eye - 1 - i]) {
            return true;
        }
      else{
        return false;
      }
    }

}
console.log(palindrome("eye"));
Maxim Orlov
@Maximization
Feb 22 2015 19:18
you want to return false in the first condition and return true if and only if you finish the loop
Thiago Ferreira
@ThiagoFerreir4
Feb 22 2015 19:20
Well I've tried that one initially and I get this error:
assert.deepEqual(palindrome("A man, a plan, a canal. Panama"), true);AssertionError:expected false to deeply equal true
function palindrome(str) {
      var eye = str.length;
    for ( var i = 0; i < Math.floor(eye/2); i++ ) {
        if (str[i] !== str[eye - 1 - i]) {
            return false;
        }
      else{
        return true;
      }
    }

}



console.log(palindrome("eye"));
Maxim Orlov
@Maximization
Feb 22 2015 19:21
input eye should work after you've done what I said
the challenge states you have to ignore punctuation and space so you'll have to do some pre-work on the string and have it removed from all punctuation and whitespace
Thiago Ferreira
@ThiagoFerreir4
Feb 22 2015 19:22
you mean get rid of the else{}
Danny Fritz
@dannyfritz
Feb 22 2015 19:22
your for statement can only go through 1 iteration currently
return exits the function
Thiago Ferreira
@ThiagoFerreir4
Feb 22 2015 19:23
alright what I don't get is how I can see what string is passed
and only have "eye" to work with
or should passe'm myself?
can't see*
you mean I should mess with the page itself on devtools? @Maximization
Maxim Orlov
@Maximization
Feb 22 2015 19:26
no not at all
first figure out how to solve what @dannyfritz and I told you
then you can think how to pre-work the string
Cristián Berríos
@crisberrios
Feb 22 2015 19:28
@ThiagoFerreir4 palindrome doesn't account for case or punctuation
or whitespace
so you should see a way for getting rid of those before doing the analysis itself
Thiago Ferreira
@ThiagoFerreir4
Feb 22 2015 19:30
@dannyfritz @Maximization @crisberrios Alright! Txs :)
Maxim Orlov
@Maximization
Feb 22 2015 19:31
just to save you a lot of trouble, look into the documentation for the replace() function
Thiago Ferreira
@ThiagoFerreir4
Feb 22 2015 19:32
Btw a quick question... you guys think I should pair up for those or should I just keep doing them on my own like I'm doing now?
Thiago Ferreira
@ThiagoFerreir4
Feb 22 2015 19:38
@Maximization I see what you mean with the replace() function
Cristián Berríos
@crisberrios
Feb 22 2015 19:49
@ThiagoFerreir4 pair as much as you can, both learning and teaching
@ThiagoFerreir4 you'll know you grasped the concepts when you can teach them and understand them while doing so.
Ryan Malm
@Rybar
Feb 22 2015 21:20
^^ The Feynman Technique. :) That's what makes participating in this community so great; by helping others you re-enforce your own understanding of coding concepts.
@terakilobyte I've successfully created a node/express/mongo app that reads and writes to the database, without assistance. :D
Nathan
@terakilobyte
Feb 22 2015 21:23
@Rybar hell yeah man, making me look bad!
lotbs
@LookOnTheBrightSide
Feb 22 2015 21:25
anyone care to explain what this code does?
TestMyCode.run("testing hello world function", function(assert){
    var result = helloWorld();
    // is the result as we expected?
    assert.equals("hello world!", result);
});
Or what I can look up to understand what the code does?
Nathan
@terakilobyte
Feb 22 2015 21:27
it’s running in some kind of test framework
it’s assigning the return from helloWorld() to a variable called result
then asserting that the string literal ”hello world!” is equal to result
lotbs
@LookOnTheBrightSide
Feb 22 2015 21:29
I honestly have no idea what I am supposed to do???
Ryan Malm
@Rybar
Feb 22 2015 21:31
You write a function called helloWorld that produces output equal to that assert() test.
lotbs
@LookOnTheBrightSide
Feb 22 2015 21:36
Is anyone free to walk me through the challenge or to perhaps point to what I can look up in order to understand what's required of me
Jon Lucas
@jonslucas
Feb 22 2015 21:50
Is there a list of all the bonfires? I'm curious to know how many I have left.
Nathan
@terakilobyte
Feb 22 2015 22:35
there isn’t one built in at the moment, however the list is there on a major feature branch