Bonfire: Mutations

This challenge took me so ridiculously long!

The Challenge:

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

For example, ["hello", "Hello"], should return true because all of the letters in the second string are present in the first, ignoring case.

The arguments ["hello", "hey"] should return false because the string “hello” does not contain a “y”.

Use .indexOf()

The Solution:

function mutation(arr) {
  var firstArr = arr[0].toLowerCase().split('');
  var secondArr = arr[1].toLowerCase().split('');

  for (var i = 0; i < secondArr.length; i++) {
    var positive = firstArr.indexOf(secondArr[i]);
    if (positive === -1) {
      return false;
return true;

mutation(["hello", "hey"]);

To find the solution to this challenge, I first needed to compare all the letters of the two arguments with each other. To separate the letters of each word, I used .split(”) (see lines 2 and 3).

Since the second argument is shorter than the first, I only wanted to loop through the length of the second argument, in this case “hey”.

Using .indexOf(), I checked each letter of “hey” (secondArr) to see if the letters are in “hello” (firstArr). If the letter from secondArr is NOT in firstArr, the value of -1 will be saved to the variable positive.

Easy Counting Question | Hackerrank

Completing a sample easy challenge from Hackerrank


Write a function called countUp(start) that takes a number (start) and counts upwards 10 times with all the words separated by “then”.

For example:


>> 11 then 12 then 13 then 14 then 15 then 16 then 17 then 18 then 19 then 20

The Solution:

function countUp(start) {
    start = start + 1;
    var string = "";
     process.stdout.write((start) + string);
    for (var i = start+1; i < (start + 10); i++) {
        string = process.stdout.write(" then " + i);

process.stdout.write is equivalent to Ruby’s ‘print’ . It removes the line break.

This was a really hard coding challenge, even though it was labeled ‘Easy’.

I knew I had to print out numbers in sequence, incrementing by 1 so I decided to use a ‘for’ loop. Getting all the numbers to print out and then adding ” then ” to the end was easy. Removing the last ” then ” was hard.

I first was trying to loop adding ” then ” after the number like this:

4 then 5 then 6 then 7 then 8 then

But then my answer ends with the word ” then ” and that’s incorrect. So next I tried to just count up to 9 numbers and add the 10th number to the end of the string, but I kept getting an error. After much time had passed, I added ” then ” before the number so that my loop looked like this:

then 5 then 6 then 7 then 8

Finally, I added the ‘start’ value +1 to the beginning of the string to pass the tests.

4 then 5 then 6 then 7 then 8

FreeCodeCamp in Atlanta

I organized the Atlanta FreeCodeCamp meeting this past Saturday, gathering fellow FreeCodeCampers together to code and pair program. Just saw this post this morning where the Founder of FreeCodeCamp, Quincy Larson, used my picture in his LinkedIn post linking to an answer on Quora. I am ecstatic. I am SO impressed with how involved the founder is with the users of his program. Thanks for promoting the Atlanta group!

Screen Shot 2015-10-20 at 9.17.24 AM

See the Quora post here: “I suck at programming but I love it. What should I do?” Quincy Larson is very active on Quora and I highly recommend signing up and following him.

To attend one of our Atlanta FreeCodeCamp meetups, join the official Facebook Group here: We welcome all coders, whether you are going through the online boot camp or not, and are more beginner-focused.

Bonfire: Slasher Flick

Use either .splice() or .slice() to get the answer to this coding challenge from FreeCodeCamp.

The Challenge:

Return the remaining elements of an array after chopping off n elements from the head.

The head meaning the beginning of the array, or the zeroth index

My Solution:

function slasher(arr, howMany) {
  // it doesn't always pay to be first
  arr = arr.slice(howMany, arr.length);
  return arr;

slasher([1, 2, 3], 2);

I used the .slice() method and sliced starting at the howMany value, through the length of the array. This challenge took me about ten minutes! Are they getting easier or am I just getting better? I hope it’s the latter!

Bonfire: Factorialize a Number

Factorialize a Number – great JavaScript coding challenge from free online full-stack bootcamp FreeCodeCamp. This was a tough one that required a couple hours to figure out. Taking a break from these challenges really makes them harder when you start back up!


Return the factorial of the provided integer.

If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.

Factorials are often represented with the shorthand notation n!

For example: 5! = 1 * 2 * 3 * 4 * 5 = 120


function factorialize(num) {
  var total = 1;
  for (var i = 0; num > i; i++) {
    total = total * (i+1);
  return total;


Unblock JavaScript in Chrome

If you are on Windows using Google Chrome, you may sometimes keep trying to open your localhost URL only to have Chrome block your JavaScript from loading. To enable JavaScript, right click on your web page to Inspect Element.

  1. Click the console tab.
  2. Click the gear icon in the upper right and go to settings.
  3. Uncheck the “Disable JavaScript” checkbox.

Difference between ‘git add . ‘ and ‘git add * ‘

What is the difference between the git add . and git add *?

$git add .

This adds all new and modified files in the current directory, including hidden folders and files (ones that begin with a ‘ . ‘).

$git add -A

This adds all new, modified, and deleted files in the current directory.

$git add *

Adds all files and directories EXCEPT ones that are hidden (begin with a ‘ . ‘ (dot)). The asterisk is actually a shell command and not part of git.

Here is an image from StackOverflow that also addresses the question:

git add bash shell

Linking Snippets in Codeigniter – PHP

Since I have been attending LAMP Camp, I have been learning PHP and MySQL and using MVC frameworks to build web applications. I’m about to start my 6th week tomorrow, so I’m already halfway through! It’s a free 12-week immersive program in Atlanta, that you can read more about here.

To get your certificate of completion, you have to create a personal portfolio site using what you’ve learned. Since we have to use an MVC framework for our project, I’ve chosen Codeigniter since they have a tutorial that comes with the download. Their tutorial is very easy to follow and they teach you how to also connect to a database.

Today I spent my time on the views and getting the Bootstrap Carousel feature to work. I also learned how to link pages together. If you are using the MVC framework Codeigniter for your PHP web application, you can link page views without touching your controller file.

I saved my ‘snippet’ views in their own folder in ‘views/templates’ and just linked to them where I wanted them to appear. Since I worked on the carousel feature today, I put the carousel code in its own file called carousel.php. Then, I added the following code to my home.php view file where I wanted the carousel to appear:

 <?php $this->load->view("templates/snippets/carousel.php"); ?>

This is my controller file that loads the home.php view:

public function view($page = 'home')
  if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
  // Whoops, we don't have a page for that!

  $data['title'] = ucfirst($page); // Capitalize the first letter

  $this->load->view('templates/header', $data);
  $this->load->view('pages/'.$page, $data);
  $this->load->view('templates/footer', $data);

UNIX Commands in Windows Command Prompt

How to use UNIX commands in Windows 10:

  1. Download and install the latest version of Cygwin. (32-bit) or (64-bit)
  2. Follow the steps in this tutorial if you want detailed instructions about the installation. The installation takes a while, but it’s normal.
  3. After installation finishes, open your Advanced System Settings in the Control Panel.
  4. Click the Advanced tab.
  5. Go to Environment Variables.
  6. In the second table labeled System Variables, find Path and click Edit.

    cygwin UNIX

  7. Scroll to the end of the Variable Value list and enter the path of your \cygwin\bin\ folder. Remember to close the previous path with a semicolon, so your path should look something like this: ;C:\cygwin\bin\


  8. Click OK and close all the windows.
  9. Open your Windows command prompt and type ls -l to test your installation.
  10. Yay! Now you can use UNIX commands within your command prompt.

I installed this today on my Windows 10 OS and had no problems. Feel free to leave a comment if you are getting errors and I’ll try to help.