I mentioned that a small group of us had been working on a project in week one.

The project is a startup idea generator with an 8-bit theme. You can actually see the design for it on my computer in that post.  In the tech world startups often pitch themselves using the This for That formula. Cake Health is the Mint.com for Health insurance, and Turning Art is Netflix for Artwork. Take look at the startups section on Angel List, and youll see the pattern.

We thought by creating a generator  a few good concepts would surface. My favorite is GitHub for gif posters. We could call it GifHub.

Here is the live application. You can also find the project files on GitHub. Who knows, maybe the startup idea youve been looking for is in there somewhere.

http://ideabit.herokuapp.com/

The Technical Bits

var names = function 
 var array1 = "Groupon", "Facebook", "Twitter";
 var array2 = "Starter League", "Doctors", "Teachers";
 var die1 = Math.floorMath.random*array1.length;
 var die2 = Math.floorMath.random*array2.length;
 var startup1 = array1die1;
 var startup2 = array2die2;
 return startup1 + " for " + startup2;
 ;
names;

However, The Starter League is about learning Ruby, I thought it would be a good exercise to try and convert what we had in Javascript to Ruby.

def home
 startup_array = IO.readlines"app/assets/startuplist.txt"
 dice = randstartup_array.length
 @startup = startup_arraydice
 
 occupation_array = IO.readlines"app/assets/occupationlist.txt"
 dice = randoccupation_array.length
 @occupation = occupation_arraydice
end

However, The Starter League is about learning Ruby, I thought it would be a good exercise to try and convert what we had in Javascript to Ruby.

Line 2 and 6 point to text files within the application. It reads the text file one line at a time, and adds the line to an array. Then a random number between 0 and the length of the array is generated, which allows more items to be added to the lists without having to edit code. The random number is correlated to a position in that array, which determines what will be shown in the generator.

Lessons Learned

Be careful where you copy files. I accidentally copied one of the files into the wrong folder. This caused about a hundred errors in the Heroku server log. I spent about two hours trying to decipher them with little luck. Fellow Starter Leaguer Benard Chan spent time trying to help me debug, and discovered that duplicate files were the issue.

$ git commit -a -m commit message

I will never forget that line. After correcting the duplicate file issue I could not push my updated code to GitHub. I spent an hour with my mentor, Don Bora, trying to figure out what was going wrong. Apparently the -a makes a difference when updating code. That is a mistake I’ll never make again.