These are chat archives for FreeCodeCamp/Help

26th
Feb 2015
Matthew Harames
@Harames
Feb 26 2015 02:18
function truncate(str, num) {
  var edit = "";
  var addin = "...";
  // Clear out that junk in your trunk
  if(str.length > num) {
    edit = str.slice(num-3);
    edit = edit.concat(addin);
  } else {
    edit = str.concat(addin);
  }
  return edit;
}

truncate('A-tisket a-tasket A green and yellow basket', 11);
Why does this cut off the beginning of the sentence and not the end
Cristián Berríos
@crisberrios
Feb 26 2015 02:21
hmm
Matthew Harames
@Harames
Feb 26 2015 02:22
I just realized my else statement was wrong, but it is still cutting off the beginning of the sentence
Cristián Berríos
@crisberrios
Feb 26 2015 02:23
check the slice method
you are slicing from the beginning
Matthew Harames
@Harames
Feb 26 2015 02:23
@crisberrios How would I slice from the end?
Cristián Berríos
@crisberrios
Feb 26 2015 02:24
check the parameters, which one is the starting index and the ending index
I think your logic is ok
but what slice returns are the extracted items
not the remaining items
Matthew Harames
@Harames
Feb 26 2015 02:26
@crisberrios OK
Matthew Harames
@Harames
Feb 26 2015 02:45
After eating dinner I figured it out
Cristián Berríos
@crisberrios
Feb 26 2015 03:00
your brain needed some fuel :D
Matthew Harames
@Harames
Feb 26 2015 03:57
I honestly have no idea how the logic in Chunky Monkey is supposed to work
Cristián Berríos
@crisberrios
Feb 26 2015 04:00
scroll back this channel, we did a lot of versions for this problem
and with we I mean @dannyfritz :P
Matthew Harames
@Harames
Feb 26 2015 04:00
ok
Can you tell me what this code does
function chunk(arr, size) {
  var slices = Math.ceil(arr.length/size);
  var answer = [];
  R.times(function (i) {
    answer.push(R.take(size, R.drop(i*size, arr)));
  }, slices);
  return answer;
}
I would like to now what that R.times, R.take, and R.drop is about
Cristián Berríos
@crisberrios
Feb 26 2015 04:05
check ramdajs documentation
but you shouldn't use those in the challenges
(though the library is accesible)
Lazarus G.
@PseudoSsiah
Feb 26 2015 04:17
I feel like some of these Code School videos do not really prepare you for all of the challenges properly. Is that just me?
Darryl Dixon - Piece Digital
@piecedigital
Feb 26 2015 04:28
@PseudoSsiah Sometimes they don't but I think that's because they want you to think a little. I think they do it in the wrong places sometimes.
Lazarus G.
@PseudoSsiah
Feb 26 2015 04:30
@piecedigital Okay, 'cause some of these lessons I fly through and then some of them I'm sitting there re-watching the video and re-reading the objective and totally just scratching my head as to what they're trying to have me do.
Also, is there an easy way to test any of this code? The console seems to get flooded with a bunch of stuff, so there's not much I feel that I can troubleshoot on them either.
Darryl Dixon - Piece Digital
@piecedigital
Feb 26 2015 04:42
@PseudoSsiah You could but you'd need to setup of a lot of things first before it can work. Some require more setup than others, it just depends on what you want to test.
Lazarus G.
@PseudoSsiah
Feb 26 2015 04:44
@piecedigital I don't know. Anything really. I'm used to having the console available to see my output so I at least understand what it's throwing.
Bill Maca
@bmaca
Feb 26 2015 05:28
guys guys, just use python ;)
;p
hehe jk, js rocks!
Lazarus G.
@PseudoSsiah
Feb 26 2015 05:33
Well, it's not so much the JS, just Code School. I would prefer actual errors to a description of something they think I may find useful, or in some cases, absolutely nothing.
Cristián Berríos
@crisberrios
Feb 26 2015 05:36
well, when you're convinced that the code is right
and you verify it using the buy answer button
and still it doesn't go well
just go forward
codeacademy is just a primer
and codeschool just a 1st layer
Darryl Dixon - Piece Digital
@piecedigital
Feb 26 2015 05:37
I had to buy an answer once. I was upset with what I got LOL.
Cristián Berríos
@crisberrios
Feb 26 2015 05:37
real js learning starts at bonfires
and real real learning starts at doing projects / real stuff
Lazarus G.
@PseudoSsiah
Feb 26 2015 05:38
lol, I can't do that. I get anxious when my mouse even gets near the button. I keep thinking "Come on. Just review it 1 more time."
Cristián Berríos
@crisberrios
Feb 26 2015 05:39
it's not wrong to review it, but sometimes you can even see the code working
and it won't pass the challenge
Lazarus G.
@PseudoSsiah
Feb 26 2015 05:41
Yeah, I swear on one of the challenges I changed single quotes to double quotes and it worked. I had to retype part of it though, so it could also have been a misspelling.
Darryl Dixon - Piece Digital
@piecedigital
Feb 26 2015 05:51
@PseudoSsiah Yeah, there's an issue with how they check code. It's not thorough.
yqyeoh
@yqyeoh
Feb 26 2015 06:08
function titleCase(str) {
  var array = str.split(" ");
  array.forEach(function(element){
    element = element[0].toUpperCase() + element.slice(1);
  });
  return array.join(" ");
}
can anyone tell me why this does not work?
ok nvm i got it, javascript pass by value
Ganesh Kumar Subramanian
@gans220
Feb 26 2015 06:14
Hi guys
I just have a quick question
Ganesh Kumar Subramanian
@gans220
Feb 26 2015 06:25
I was going through the regex challenge, and I am unable to understand the use of paranthesis in regex
Cristián Berríos
@crisberrios
Feb 26 2015 06:26
round one? (...)
Ganesh Kumar Subramanian
@gans220
Feb 26 2015 06:27
yup the ()
Cristián Berríos
@crisberrios
Feb 26 2015 06:27
it's for capturing groups
then you can use them depending on the function
str.replace(/([\d])/,("before digit $1 after digit");
Ganesh Kumar Subramanian
@gans220
Feb 26 2015 06:28
how is this ^(IMG(\d+)).png$ different from ^IMG\d+.png$
Cristián Berríos
@crisberrios
Feb 26 2015 06:28
because the number gets stored
and the whole name gets also stored
so 1st group capture is the whole name
and 2nd group is just the number
and you can pass those values to another function or store them
@yqyeoh you answered yourself :P
well, I'm going to sleep, see you tomorrow!
Ganesh Kumar Subramanian
@gans220
Feb 26 2015 06:32
Thanks @crisberrios
I am still trying to figure it out though! :P
Vince
@Vince33
Feb 26 2015 15:55
Hey guys, Has anyone tried using pluncker ?
I was wonder how you guys felt about using plunker to practice angular
Oliver
@Dadsaster
Feb 26 2015 16:21
Noob question - as a mac user - what do you guys recommend for writing and testing js? Sublime2 seems like it doesn't help at all with debugging.
Hannan Ali
@abdulhannanali
Feb 26 2015 16:22
@Dadsaster
The FCC founder @QuincyLarson uses WebStorm as well as many others here use it too.
@Dadsaster It's the recommended tool for JS development by many software experts.
@Dadsaster if you are a student you may get it for free too.
Oliver
@Dadsaster
Feb 26 2015 16:25
@abdulhannanali - thanks - I'll look into it
Cristián Berríos
@crisberrios
Feb 26 2015 16:25
Atom, Brackets, ST2, ST3, WebStorm seem to be the default options
BUT don't discard any editor if you are comfortable with it
Hannan Ali
@abdulhannanali
Feb 26 2015 16:26
^^^^
Cristián Berríos
@crisberrios
Feb 26 2015 16:26
like Visual Studio (in this case, not for mac), or Netbeans
Hannan Ali
@abdulhannanali
Feb 26 2015 16:26
I used Visual Studio it's computer resource eater.
Oliver
@Dadsaster
Feb 26 2015 16:26
I haven't spent any time in an editor - heard good things about sublime but I can't figure out how to debug in it.
Cristián Berríos
@crisberrios
Feb 26 2015 16:27
ST2 and ST3 can be extended by plug-ins and they have many, so if you're just missing the debug part, try to find how other users go about that
you really don't need much for debugging
devtools or node and you're good to go
Hannan Ali
@abdulhannanali
Feb 26 2015 16:27
devtools integration with brackets is brackets best part.
Oliver
@Dadsaster
Feb 26 2015 16:30
@crisberrios - thanks for pointing me in the right direction - seems like the WebInspector plugin for ST2 is the winner
Ammar Ali Shah
@AmmarAliShah
Feb 26 2015 16:57
@PKMNinja Yes I did :smile:
Chris Dziewa
@chrisdziewa
Feb 26 2015 20:30
@terakilobyte Took you up on your challenge and finished with Map the Debris using map.
Nathan
@terakilobyte
Feb 26 2015 20:41
a bit easier and cleaner?
Chris Dziewa
@chrisdziewa
Feb 26 2015 20:46
Ha yeah a bit simpler.
Ashley Drake
@aldraco
Feb 26 2015 21:35
i'm struggling with express routing if anyone can/wants to help.
i have two route files/modules? which are mounted on separate paths. I need to redirect "out of" one path to another.
it's not working ...
the docs say it's possible, so clearly I'm missing something.
Cristián Berríos
@crisberrios
Feb 26 2015 21:41
it should
since the redirect call is browser based
unless I'm missing something
Ashley Drake
@aldraco
Feb 26 2015 21:42
that's what hte docs said.
i'm also trying to authenticate, which might be throwing things off.
so i'm using isLoggedIn as middleware, and trying to get the failure case (not logged in) to redirect to /login
Cristián Berríos
@crisberrios
Feb 26 2015 21:43
did you start from scratch?
Ashley Drake
@aldraco
Feb 26 2015 21:44
i did.
Cristián Berríos
@crisberrios
Feb 26 2015 21:44
there's a generator with passport included so you can see the code and check how they do it
(yeoman)
I started a project with that and implemented exactly what you describe
just don't have the repo installed to tell you how exactly I did it
Ashley Drake
@aldraco
Feb 26 2015 21:46
well, i am using a tutorial that provides all of the passport.js code. and i can get things to work in one routes file, just not in the other. haha
but i will check that out and see if i'm missing a piece somewhere
it's probably a comma or something silly :P
Ashley Drake
@aldraco
Feb 26 2015 21:52
thanks
JesseJHernandez
@JesseJHernandez
Feb 26 2015 21:59
Hey guys Im currently learning Ruby on Rails, at work I want to create an inventory system where I can store computer/printers serial number etc. Where do I begin?
Nathan
@terakilobyte
Feb 26 2015 22:05
@JesseJHernandez head on over to the odin project
we focus on fullstack javascript here
JesseJHernandez
@JesseJHernandez
Feb 26 2015 22:14
Ok cool Ill check it out, I have a javascript project I need some help with. I need help using JSON and connecting to an API, Im still relatively new.
connecting to www.moj.io api
Nathan
@terakilobyte
Feb 26 2015 22:15
good luck
Quincy Larson
@QuincyLarson
Feb 26 2015 23:23
@JesseJHernandez Yes, that’s a cool API. I think Odin Project covers JSON, and there’s also a gem that should turn the JavaScript API into a ruby-accessible one here: https://rubygems.org/gems/moj_template
@JesseJHernandez When you’re ready to start working directly with JavaScript, come back and we’d love to help!
Hannan Ali
@abdulhannanali
Feb 26 2015 23:25
This message was deleted
This message was deleted
Germaine Pannell
@germainep
Feb 26 2015 23:50
hey guys wondering if I could get some help with Symmetric Difference bonfire
what I have so far:
```
what I have so far:
function sym(arr) {

  var z = [-1,2];
  var list;
  var newArr= [];

  function diff(a,b){
    for(var i=0; i<a.length; i++){
      if(b.indexOf(a[i]) === -1){
         newArr.push(a[i]);
      }
    }

    for(var j=0; j<b.length; j++){
      if(a.indexOf(b[j]) === -1){
        newArr.push(b[j]);
      }
    }
    return newArr;
  }
  var args = [];
  for(var j=0; j<arguments.length; j++){
      args.push(arguments[j]);
  }



  return args.reduce(diff);
}

sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]);
it works for two arguments but crashes the browser with three
Cristián Berríos
@crisberrios
Feb 26 2015 23:57
could you link the bonfire?