Git yo Stuff on Heroku

So I just deployed my first rails project Anime Chase on Heroku and I still am a surprised at how easy it was but I see many have yet to put their awesome projects on Heroku. I decided to write this post to understand the progress a little better of posting apps to heroku and to help my fellow, fellows in the journey of showing off what they worked so hard on last week.

So getting your stuff on Heroku is broken into about 6 steps and it feel very simliar to using git.

1. Sign up for a free Heroku account.

this step is very easy just go to https://www.heroku.com/ and follow the step in signing up for a free account.

Featured image

2. Create your Heroku app

to do this while in app simply enter on the terminal:

heroku create

Screen Shot 2015-04-15 at 8.07.21 PM

this creates your app as a heroku app putting the heroku.

mines looked like this:

heroku create animechase

This is also what your git config file should look like:

Screen Shot 2015-04-15 at 8.38.25 PM

3. Edit the gemfile if need be. This includes add your more lines if you are using the gem sqlite.

Screen Shot 2015-04-15 at 8.07.38 PM

4. Apply the changes if you edited your gem file in any way with typing this into your terminal:

bundle install --without production

Screen Shot 2015-04-15 at 8.08.05 PM

5. Do all of your migrations, rake tasks, git commit and push to heroku master

git push heroku master

♥ heroku run rake db:migrate

Screen Shot 2015-04-15 at 8.06.55 PM

figaro heroku:set -e production

6. Visit your sit by just typing this into the terminal:

heroku open

Things to note:

If you’d like to edit the app on heroku this is the process:

Screen Shot 2015-04-15 at 8.08.19 PM

If you have a free account be careful of going over the database limits at this moment you can only have 10K rows in your database. I personally had to scale down Anime Chase in order to keep it running on heroku.

understand and inform the api key providers, if need be, of where your app is hosted. I know things like facebook’s oauth would not work if you stated your app lived on localhost:3000 but you are making calls on the heroku domain name.

so if you would like more information on the subject matter read these lovely resources below

resources:

http://docs.railsbridge.org/intro-to-rails/deploying_to_heroku

https://github.com/laserlemon/figaro

https://devcenter.heroku.com/articles/getting-started-with-ruby#introduction

Advertisements

Rails Project Day 1: The Birth of Anime Hunt

Featured image

So at Flatiron today we started working on our first week long project in Rails. I was very nervous at the beginning about about the project because we learned rails for maybe two weeks then dove right into the projects. I understand programming and rails, but creating a idea from scratch from methods and arrays; thats still crazy to me!

However, doing my own idea for the project made me feel a lot better about the situation. We are doing a Anime Search program which will search for animes by titles and genres. I always felt as though I was missing out one cool animes that I have not heard of, so I wanted to create a project that would give me recommendations based on genres of anime I would like.

We first modeled the program on how things should flow and work. We learned that the model anime should hold the title description and should have many genres and the genre model should belong to a anime to search by in the future.

FullSizeRender (2)

The first problem we faced in the project was finding a way to gain all of the anime titles with such dated api’s on the inter-webs. Most anime app.s only render xml format to parse. However, after a long search we found a api that is relatively good and renders JSON. We found the Hummingbird api to search animes for our hunt app. Hummingbird takes all of the data from a searched anime on presents them in a readable json format.  This can then be keyed into to create the anime in the database.

# this is the method that all the magic happens

def create

# search_input is the input that the user enters into the search box. the info is than downcased to
@search_input = params[“anime”][“title”].gsub(” “, “-“).downcase

#responce calls on the Unirest which creates a get request to hummingbird version 1 api in which we put the user’s input at the end
@response = Unirest.get “https://hummingbirdv1.p.mashape.com/anime/#{@search_input}”,
headers:{

# this gives the ENV api keys that we needed to sign up for in order to use the hummingbird api
“X-Mashape-Key” => ENV[“HUMM_API_KEY”],

this creates the form as json
“Accept” => “application/json”
}

so then we created a conditional statement that stops if the search turned up a 404 page not found. If the info is found we create a anime in the database then render the show page which shows the page after.
unless @response.headers[:status] == “404 Not Found”
@anime = Anime.create(title: @response.body[“title”],
description: @response.body[“synopsis”],
score: @response.body[“community_rating”],
img_url: @response.body[“cover_image”])
#next i would like to build the genres through the anime here to give them that belongs to table relationship.
render “show”
end

that is it for now until next time the three people that read my blog.

Playing around with Unity 3D… No wait trying to fix Unity

So I started my coding career in the hopes of making a game one day. In my countless search of finding resources to help me in this journey I found  internships that had many elements of game development, workshops that were really expensive but informative, and online game design courses. I found all of these resources very informative, but one of the elements I found the most consecutive beneficial to me was the online resources this is were I learned most of my game development and programming skills before The Flation School. I don’t normally talk about this as much as I would like but I am really appreciative of The Flatiron School for giving me the opportunity learn code because I would either need to have a lot of money to go to bootcamps for coding or had to have been a woman to learn how to code without going into debt in college.  However, because I did a ton of videos without the foundation of programming I had no idea what I was doing so I went back to the code I wrote for some particular games to understand what is going on now that I have a better understanding of coding.

logo (1) n3-1Z5OV_400x400

So this was still relatively difficult because most of my coding with game was in programming languages like C# and GameSalad which uses a cover language to make objective C easier. one of the methods I would like to go over in this blog because there are a ton that I programmed, but I wanted to show one of the coolest I learned and that would be the explode method in C#. This method is a destructive method that can chain on other behaviors. in this game I chose to spawn piece of the player with the explosion. which creates an effect of the player being blown to pieces. So I would like show a demo of this and talk about it alone with it.

However, in the process of trying to get my demo working for class I realized that there was a major problem with unity’s new editor it could not handle translating old projects. I will finish this blog post when I figure out more on the subject

Screen Shot 2015-04-01 at 12.48.26 AM