House of Rails

Andrew House

Searching With Angular

AngularJS is so badass.
This past week, I’ve been working non-stop on the Homework App James(my teacher at The Iron Yard) and I have been building. As an admin, James can post assignments and students can post the link to their homework and let us know if they are finished or not. We were trying to figure out a way to be able to easily search through all of the assignments and be able to display specific dates, titles, or even the description of the assignment. This is where AngularJS came in.

My knowledge of AngularJS coming into this was pretty minimal. I knew the basics of how it was supposed to work and some of the power behind it. I didn’t know how to hook Rails data into Angular. The only hint James gave me was that I would need to use ngResource. After reading several articles, I found a nice little snippet of code that appeared to use Rails rendered data in Json format.
Perfect!
From there I was able to grab the data and implement a new table using only Angular.
Once the table was complete, I started on the journey of implementing the search function. After playing around for a few minutes and figuring out where I needed to put in the filters, I was having a problem saying exactly what I wanted to search for. I talked to James and he showed me how to create my own filter in Angular. From there I built the search filter…and holy shit it worked.
I was amazed.
I had integrated a working AngularJS search function into my app and it worked wonderfully. Mixing in languages was difficult, but a ton of fun. I feel like I learned some valuable skills while implementing this. Coding is so much fun.

Breaking the Norm

I have been living in a state of being uncomfortable.
It’s a weird feeling. Always having to look up resources, reading articles, and watching videos.
It is constant learning.
At first, this style was incredibly uneasy. I would feel constantly anxious and stressed. Why didn’t I have the answers? Why was I having such a hard time finding answers? There is a great skill in asking the right questions, and a very valuable lesson I learned. I think my next blog post will be how to google 101, or googling for rails dummies. The evolution of my ability to see through what problem I am facing and being able to search for that specific problem has been astonishing. I’m starting to transition from being uneasy all the time to enjoying the hunt.

Where are the answers?
Which answer is the best for my needs?
Can I tweak the answer to get better results?

I feel like this is a great mentality to have. To be always improving is what it takes to be a developer. Breaking my old ways of doing what it is easy, digging into the trenches, and putting some sweat equity into me. It’s a pretty rewarding feeling. Looking at myself from the outside in and noticing a change. I am so glad that I am coding. It truly was a life altering choice to come to The Iron Yard. Not only will I become a badass Rails Dev, but I will also be closer to my true self.

Redesigning an App

I’m learning things way too fast.
Currently I am in the process of building a web app for my class at The Iron Yard. The app is a centralized place where the teacher can post assignments and we can post a link to our assignment and check to see if it is finished or not. It’s going great and it is working. However, I want it to do so much more.

This weekend I found myself making profile pages for each user. I’m not any good at design so it was challenging for me to try to tap into what little artistic vision I have. Partway through implementing the design, I kept wanting to work on other features and develop it so much further. I want to add a better search feature using Angular (still working on figuring it out), add a sort function for the assignments, add comments on each individual assignment a student posts, and so much more!

I have ideas galore on how to expand this to fit the needs for our class, but I don’t have enough time to implement them all. While studying and learning new skills every day, and researching what I need to do for the app. I find myself trying to prioritize what features I want to do. Do I take the least path of resistance and implement what would be easiest? Or do I study a language I haven’t used and try to work in this cool feature?

The good news is that I am having fun and want to do them all. Each feature is in its own a great challenge, and without challenges life is boring.

Crazy Easy Gravatars

Gravtastic saves a ton of headaches when wanting a gravatar.
In 4 lines of code (seriously 4) I had a gravatar up and running on my app. Here’s how.

Getting Started

Keep in mind, gravtastic relies on Devise to work. So all of the instructions are to be used after Devise is setup.
Go ahead and add the gem gravtastic to your Gemfile.

Gemfilelink
1
gem 'gravtastic'


As always, make sure to bundle after installing a gem.

Terminallink
1
bundle


Implementation

Now we need to make sure our model uses gravtastic. Your file may be different depending on what you named your devise model. I’m going to name mine User and generate the code on that premise.

app/models/user.rblink
1
2
3
4
5
class User < ActiveRecord::Base
  include Gravtastic
  gravtastic
  ...
end


With that gravtastic has been able to hook into your devise model. Hooray! The last job is rendering the gravatar to the view.
I’m using Haml, so the html syntax may be weird. If you’re using Erb, just replace the = with <%= and end the line with %>

app/views/whicheverview.html.hamllink
1
=image_tag current_user.gravatar_url


That’s it!
Now a gravatar should be rendering on your page. If you want to adjust the size you can pass a size option on gravtastic in the model. The specifics of different options to use can be found on the Gravtastic Github Page

Building an API With Rails

I think API’s are amazing.
It’s kind of weird how much I’m into API’s lately. Yet, I’ve only technically made one (and oh my goodness was it a small one). I hold much value in the flexibility that an API provides. To be able to talk to multiple devises in different languages by only providing the necessary data.

Data is my thing.

It’s nice not having to worry about making anything pretty. If I want to see if my data is working the way I want I can just do a quick curl. I’m currently having a problem figuring out authenticity tokens. But that is okay, it’s just another hurdle to overcome.

When I can easily implement an API I feel as though my self worth will go up drastically. Reason being, at The Iron Yard in Atlanta there are 3 cohorts (currently 2 since the front end class just graduated) and a well developed API could easily tie together all 3 classes. How cool is that? To be able to work with multiple people on a singular project.
All because data is badass.

I look forward to creating amazing API’s in the future and look forward to understanding enough Angular JS to be able to call on my API’s information. Doing Full Stack work sounds like a lot of work and would be a ton of fun.
I’m excited about the future.

Testing for Dummies

I suck at testing.
There are some things that click, and some that don’t. For me, testing doesn’t click. I understand the benefit of it, helping getting my thoughts in order and drive code in a structured way. I don’t know if its the specific DSL of using rspec, or what. But I am not good at it (yet).

Since testing is my achilles heel, I’ve decided to make it my prerogative to get it down. I don’t want to back away from a challenge just because I don’t get it at first. It’s completely okay that I’m not good at testing right now. The reason I’m at The Iron Yard is because I don’t have all the skills required to be a proficient Junior Rails Developer at my current level. That’s why I’m going to use the time that I have here to master any skills that I’m not good at. Testing is currently at the top of my list. Once I get it down (and I will get it down) I’ll move on to the next beast. Keep knocking them down one after another until I feel confident doing what I’m doing. Then when I’m confident, look at some amazing code that I don’t understand and begin the journey again. Learning is an ongoing process and it’s something that is needed by a web engineer. To be able to continuously challenge myself and push into the next technology. Adapting, evolving, and challenging. Three things that I love to do and will continue to do for as long as I can.
Coding is fun. Always changing and never perfect.

Forge Hackathon

I was a mentor at my first hackathon.
Weird right? The Iron Yard was a sponsor at the Forge Hackathon in Atlanta, and they asked their students if some of them would like to be mentors. I thought it would be a great experience to see what a hackathon’s atmosphere is like, and talk to people and see what they’re thinking. So I roll in Saturday morning and sit in a room just for software development. My role as a mentor was to sit and wait for people to ask for help. After about 5 minutes of sitting, I was approached by a team looking for help.

Their idea was that they were developing a wearable band that doctors were able to update their personal data. Such as basic information (name, birthday, etc) and more elaborate data such as diseases, medication, etc. The problem they had was that their target locations only had internet once every few months and didn’t know how to store their data locally. I recommended storing basic data on the wristband (before they were only trying to store the data on a server with a wristband having only an id). This way, when the doctor has internet they can push their data up to the server, allowing the internet copy to be up to date. The copy on the wristband would be as current as the doctor’s version is. So if they were to move and go to a different doctor, that doctor would have the most up to date version that their previous doctor had.
Then afterwards I explained strategies to span out their data model into separate categories to help future expansion and allow for easier transitions of adding data. For example,
instead of having a single User table, break medication, doctors, & diseases into a separate table so that adding and removing data would be much more efficient.

All in all, they seemed to really enjoy my feedback (actually, I asked if I was helpful and they said I was a huge help). My first hackathon experience was pretty awesome, it helped my resolve in believing in myself and trusting the knowledge I have to help others. It’s a spectacular feeling.

Front End Demo Day

Today the Front End course for The Iron Yard students in Atlanta showed their final projects.
I thought it was a very interesting experience. There were probably around 50-60 people attending, some Iron Yard affiliated, and some potential employers. And everyone was there to see the final projects for a few individuals. It kind of got my blood pumping. In just two short months I will be up on the stage showing off whatever project it is that I do. Our class (Ruby on Rails) will be giving their presentations at the same time as the IOS class. Which means my project needs to be twice as amazing as everyone elses. The pressure is on, the timer has started. There will be a ton of code cranked out in a few months. Now I just have to figure out what in the hell I’m going to do.

Learning by Doing

I have a problem when it comes to learning new skills/languages.
I am very theoretical minded person in a sense that I could read and watch videos about anything and be content. However, I have found that knowledge doesn’t stick as well with me if I don’t implement what I have learned.

Example:
I’m in the process of learning Angular Js and a few months ago I did the Code School course. When going over the course again, I noticed that I remembered a lot of theory. Things like, I’m able to make controllers in a separate JS file and integrate them into the HTML directly. Little detailed parts of a whole I remembered, but when it came to actual implementation I had forgotten the majority of it. That allowed me to catch up fairly quickly on what I was doing, I felt when I was learning it again a kind of snowball effect. Where everything felt strange at first, but the more I did the quicker it came back to me. However, I don’t want to fall that far back again. So this time I’m going to try a much different strategy.

Starting Angular JS

I’ve decided to be full stack would be fun.
I’m starting to progress nicely in implementing rails features, and my instructor James suggested that I take an interest in learning and implementing a front end client. I had taken the Code School Course on starting Angular JS and I liked it’s flow. The framework seemed less verbose than Backbone JS, although it’s entire syntax structure is odd at first. I like the way it read on an html page. I know that sounds weird with all of the controller’s and directives, but I dig it.

Since I took this course a few months ago, I’m going to go through it again to freshen up on the basics. After that I’m going to go through the Tutorial on the Angular JS Documentation. Once I get a good feeling of the flow of Angular, I’m probably going to try and implement it into my The Iron Yard Homework App. I know it will be a long road to get a feeling of the flow of Angular JS, but I feel like in the end, it will be a valuable skill to have.