Posted 10.30.2012

I Decided to Look at Ruby on Rails

I’m a PHP girl. I’ve been writing PHP for the past 7 years. I’ve heard so much about Ruby lately that it’s hard not to wonder, “Is it really all it’s hyped up to be?” I’ve been reading plenty of blog posts (here and here) trying to decide if it’s worth investing the time to learn (yet) another programming language. Part of me is eager is to learn something new and is up for a new challenge. I like to think, the more tools I have in my toolbox, the better suited I’ll be for various projects. … So, this is my journey to learning to looking at Ruby and Ruby on Rails. Join me, if you want, we can struggle together.

…yes, the two (Ruby and Ruby on Rails) are different. Ruby is the programming language. Ruby on Rails is the framework that sits on top of Ruby. If I can put it in PHP terms, PHP is the language, CodeIgniter is the framework. Great, so, what’s a framework?

Well, for almost every project, there certain things you always have to do. Websites, for example, I (almost) always have to connect to the database. I could write that code every time, or I could use a framework that has built in functions that do the work for me. A framework gives me structure and a starting place.

While I’m eager to get my hands dirty and jump in with Ruby on Rails, I know I first need to learn Ruby before jumping in the deep end. Rails will make a whole lot more sense and I’ll be able to go a whole lot further in the long run, if I have a foundation first.

I’ve seen The Well Grounded Rubyist mentioned several times on various sites, so I decided to buy the book and start reading. Call me old school, but I prefer books over videos. I like being able to set my own pace, actually see the words, highlight and take notes. I’ve also looked at Code School, but for where I’m at right now, I feel like it moves a little fast and I’m having trouble connecting all the pieces together. I might find it more helpful, though, after I have a few chapters with this book under my belt.


Installing Ruby

I work off a MacBook Pro, running Snow Leopard (I know). It came with Ruby already installed, but it wasn’t the latest version.

I found an excellent blog post by David Benjamin explaining how to get everything up to speed.

I don’t want to be redundant, so I’ll let you click over (just this once) and read his post. –However, I will share a few of my hold ups:

I don’t have a lot of experience with the terminal.

I took a C++ class in college where we had to use the Terminal, so I at least have a basic understanding, but it’s been a while and really, the only commands I still remember are:

cd change directory
pwd display the current path
ln display the contents of the current directory

NetTuts has several posts that will help you get comfortable with the Terminal:

I use Sublime instead of TextMate.

So, instead of using the mate command (as listed in the instructions) to create a new file, I figured out how to call Sublime from the command line:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

So instead of saying mate ~/.profile, I used subl ~/.profile

I had trouble finding the bin folder.

I finally found it. If you go to the root directory > usr directory, it’s there.

Terminal - Finding the bin Folder

With those things out of the way, I was able to easily follow Dan’s instructions.


Understanding the difference between Ruby and ruby

(Apparently) the difference between Ruby and ruby is more than just an upper and lowercase letter. Ruby is the actual language, while ruby is the interpreter.

So, you’ll write Ruby files (with the extension .rb). Then, when you get ready to run the file, you’ll use ruby in the command line to interpret the file for you.


Your first Ruby Program

Create a folder called Ruby for all our code. Mine’s sitting in my Documents folder. Don’t worry, I didn’t do anything fancy like use the Terminal. I simply created it in finder. I’ll keep all my Ruby code there (crazy, I know).

In Sublime, I’ll create a new file and save it to that folder. I’ll call it “first_program.rb”

…BUT… if you did want to be fancy and feel really smart, you could do all this from the Terminal:

Terminal - mkdir for first Ruby program

Inside the file, I’ll type:

puts "I'm writing Ruby"

Save!

Now, in the Terminal, I’ll navigate to that folder. I’ll run the interpreter:

Terminal - ruby first_program.rb

Magic!

…If you don’t see this and got something like this, go back to your file in Sublime and make sure that you have code quotes " " and ' and not fancy ones.
Terminal - error when running ruby first_program.rb

OK, so what just happened in our code?! (It drives me crazy when authors say “Write this.” I write it and they say “Good job!” and I don’t even know what I wrote or what I did! For me, it’s just as much (if not more) about understanding the code, so I can use it in various circumstances in the future, as it is about completing the exercises.

In Ruby puts just means print. Send it to the screen. If you’re a PHP person (like I am), it’s just like echo. The only difference, is that puts adds a line break automatically to the end. So, none of this “\n” junk.

NOTE: Where did they get puts anyway? That doesn’t even sound like good English! Well, it’s an abbreviation for put string.

What if you want some of that “\n” that junk? Well, Ruby has another method you can use called print that doesn’t add “\n” to the end. I’ll show you what I mean. Open your first_program.rb back up. Update it to look like this:

puts "I’m writing Ruby"
print "This is my first program and "
print "it runs like a champ."

Save. Now, back in the Terminal, run your ruby first_program.rb command again.

NOTE: In the Terminal, you can hit the up arrow on your keyboard and it will automatically pull up the last command you entered. Keep hitting the up arrow and it will keep cycling back, showing the command before that. This makes it helpful, especially if you keep running the same commands over and over again.

See what I mean with the difference between puts and print?

Terminal - puts and print


OK, so, this might seem super simplistic, but the important part is we’ve started(!) and that’s something worth celebrating!

Below, I’ve listed a few tutorials that I’ve dabbled in, if you want to jump in a little deeper or move a little faster!

Tutorials



Posted 10.18.2012

Mobile Site Development: Debugging sites on my iPhone and iPad

As I’ve been gathering links for my 5 at 5 roundups, Adobe Edge Inspect kept resurfacing. I finally installed the app across all my devices Mac, (iPad, iPhone, and the extension for Chrome). Good gravy, this program is awesome!


What it does

  1. It will automatically send any page you load in Chrome to your iPhone or iPad
  2. It allows you to use your Chrome Web Developer tools with your iPhone or iPad

Getting it set up

  • Install the app on all your devices
  • Sync your devices. If you’re not paying for Creative Cloud, you can only have it running on one device at a time.
  • Click on the browser extension. Then, launch the app on your iPhone / iPad (your devices must be on the same wireless network). It will give you a passcode to enter.

 

  • Now, any page active in Chrome will automatically load on your device.

iPhone Adobe Edge loaded

  • If you click the < > it will pull of Chrome’s developer window.

  • Click on the device you’re using in the Web Developer panel

Chrome - Edge Inspector Web Developer Tools

  • It will load the Inspector panel. Any code you highlight will then be highlghted on your device. = SUPER COOL!
Edge Inspector in Chrome, Web Developer Tools
Using Adobe Edge Inspector on my iPhone

 


Couple this with LiveReload (Bonus)

I also found a program called LiveReload. In web development, there’s a lot of change the code, save, reload the browser. Make another adjustment, save, reload. Rinse and repeat. This program simplifies that process, so that when you save your file, the browser will automatically be refreshed.
LiveReload

A blog post on Adobe’s site had instructions for integrating this new workflow with LiveReload with Edge Inspect. (Before you get confused, Edge Inspect used to be called Shadow)


As I do more and more mobile web development, I know that these tools will prove invaluable. What are other tools you use when developing for your mobile devices?



Posted 03.10.2012

Typography Wall Art: An Interior Design Piece

Update May 27, 2016

I’ve revised this piece into something that I can sell! If you’re interested in purchasing, there’s a white version and a black version available.

Typography Wall Art on Gumroad

Recently, Lydia and I had the opportunity to do some interior design work for our new Vice President at LifeWay.

This office, not part of the executive suite, is meant to make him more accessible, providing a comfortable atmosphere for all day meetings. (I know, I just put “comfortable” and “all day meetings” in the same sentence.)

When Lydia and I were doing visual research, I stumbled upon this image.

I knew I wanted to do something similar in this space. I started trying to come up with phrases, I wanted to use biblical phrases (this is after all a Christian company), but not cliche. I also knew that some of our compapny’s most important decisions would (potentially) be made in this room. Therefore, I wanted “Be Strong and Courageous” to be the most prominent element.

Wall Art

Originally, I took the art to Kinkos to be printed on their 3′ wide draft paper. However, my piece had too much black and the printer started streaking. Unacceptable. I tried inverting the artwork, which definitely had an Esquire feel.

It works but, it wasn’t best.

In the end, we printed the banners in house on a thicker paper. The end result was much more along the lines of what we were looking for.

The total piece is 20′ x 7.5′

Wall Art

Wall Art

Wall Art