Author Archive for Zach Inglis

Introducing Crummy

I have worked on many applications that require breadcrumbs. Every time, one of the developers has built a quick custom solution. Finally, I decided that we needed a complete solution that we could easily add to future projects, and thus Crummy was born.

Requirements

I set a few requirements that must be fulfilled in order for me to call the plugin a success. They were:

  • Ability to add breadcrumbs at Controller class level (like a before filter)
  • Ability to add breadcrumbs in the controller methods (such as actions)
  • Ability to add breadcrumbs from the views
  • Ability to add breadcrumbs with or without an url
  • No variable conflicts (such as instance variables)
  • Full and strong spec coverage
  • Good documentation

I managed to fulfill these requirements and add a few shiny methods to make life easy.

Examples of Usage

    class ApplicationController < ActionController::Baseee
      add_crumb 'Home', '/' # This will display on EVERY list of breadcrumbs
    end
  


    class BusinessController < ApplicationController
      # The load order DOES matter.
      add_crumb("Businesses") { |instance| instance.send :businesses_path } # Show on all actions
      add_crumb("Comments", :only => [:comments, :show]) { |instance| instance.send :business_comments_path } # Only add the comments link on the comments and show actions.
      before_filter :load_comment, :only => “show”

      def show
       add_crumb @business.display_name, @business
      end

      def load_comment
       @comment = Comment.find(params[:id])
      end
    end
  

Golden Feature

One of the most useful argument usage is add_crumb :comment. What this does is turns the symbol into an instance variable (@comment.) Then it roughly translates into:

  # add_crumb :comment
  before_filter :add_comment_breadcrumb
  def add_comment_breadcrumb
    add_crumb @comment.to_s, @comment
  end

Installation

script/plugin install git://github.com/zachinglis/crummy.git

2 Comments

Introducing Holler

One thing that separates us at Hashrocket is the fact that we have a great team of Ruby experts. This is great if you get stuck, there is always at least one person who can help you on something. We also follow the great agile principle of pairing, which means that if someone is doing something you are interested in, then you can watch and learn with them.

Everyone is hesitant to get into Backpack for the purposes of updating their status and it is too private to talk about on Twitter so I thought I would come up with my own solution. Originally the Backpack feature came from their In/Out application, my good friend David Smalley came up with his own Merb solution too, but I wanted something Rails and thus Holler was born.

Holler Almost v1

It has only taken me 4 hours so far but I would like to introduce Holler. There are a few big features that I am planning on: Fluid integration similar to Shout, Javascript where its needed, tags, twitter integration (direct messaging to the application), more ways to view statuses.

Please feel free to fork it and make your own changes! Get Holler.

8 Comments

GMail Tips

Usually I do not like to post a topic so short but I learnt a few tricks that a few of you may not know. I know most people I know use Google Mail so thought it’d be helpful.

Suggesting your email is foobar@gmail.com, you may put periods in there as you please. foo.bar@gmail.com and f.o.o.b.a.r@gmail.com both work (Please do not use the latter; i beg).

Secondly, plus signs can be added onto the end followed by anything you want. You could have foobar+work@gmail.com and such and that works as a catch-all.

Obviously it can be used in conjunction with each other.

0 Comments

GeekThreads: Introducing: Git Push tshirt

I have been planning doing tshirts for a while under the company ‘Geek Threads’. I finally took the plunge and have shirts to sell here at RailsConf.

They are black shirts, with white monospaced text on the front and back. The front reads ‘Git push: just the tip’ and the back reads ‘just a little bit. just to see how it feels’. It’s a case of first come, first serve (I will be carrying some with me at all times but may not have your size). You can also custom order if I have run out or such. They are selling at $20 each (sorry guys, have to make a profit.)

I’m accepting ideas for both text-based and graphic based tshirts. So if you have any ideas, message me. I pay 25% profit royalties.

To find me, either look for one of the Hashrocketeers, email me or @zachinglis on twitter.

Cheers.

0 Comments

RailsConf

As always I forget to say until the last minute.

I and the rest of the Hashrocket team will be going to RailsConf next week, so if you see me there, do stop me and say Hi. :)

0 Comments

GTA IV Completed!

As I am in between projects and I am sick (glandular fever), I have been playing Grand Theft Auto 4. I completed it an hour ago and have since run around shooting everything I can and mucking about a bit.

It is a great game, the graphics are awesome and the gameplay is great. I find it is not that innovative. Nearly everything has been done before, just not so well. The two things about it the most (apart from multiplayer) is the small details it puts in. Cars get scratched, your phone interferes with the radio and such. Secondly is the story-line. You get to make small changes and you watch Niko make some well informed decisions but always the wrong ones.

For instance, there is small choices you can make ( would prefer there were more) and as opposed to games like Fable and Star Wars, i feel connected to Niko so I want the best things to happen to him, so you generally choose the good path.

X-Play had suggested that it would take 100 hours to complete. I think this includes running around and doing the jumps, flying under the bridges and such small “hidden achievements”. I have completed the game 70% (the storyline is completed) and it has taken me 35 hours.

There are a few things I dislike.

  • If you muck up a mission, you start from the very beginning of that mission. You have to do the chase and such again, and there are some LONG missions.
  • Learning how to disarm someone at the beginning of the game is only useful for that perticular scene, onwards from that you never need to use it again.
  • Often you will cover behind an object in the wrong manner, exposing yourself.
Stats
  • Playing time 35 hours
  • Longest game: 7hrs 30mins
  • Cash: $580,756
  • Missions attempted: 150 (all tries on all missions)
  • Missions passed: 94
1 Comment

Rails Tip: to_s

I haven’t posted much recently as I’ve been very busy at work (more on that later) so I thought I would post another Rails tip.


## Model
class Person < ActiveRecord::Base
def to_s
self.title
end
end

# View
link_to person

# Output
<a href=\"http://foo.bar/person/1\">Zach Inglis</a>

View Pastie

Furthermore you could extend it like this:

## Model
class Person < ActiveRecord::Base
def to_s
self.title
end

def to_param
self.slug
end
end

# View
link_to person

# Output
<a href=\"http://foo.bar/person/zach-inglis\">Zach Inglis</a>

View pastie

1 Comment

Ruby +1 for Google Apps == Ungrateful?

This post popped up on my feeds and after clicking it I thought I would share my opinion here. What I have to say is more an extension of myself than a comment could do for me.

The authors main argument is that people who want to program in Ruby over Python with the Google Apps Engine are ungrateful.

First things first, +1 is fricking annoying, agreed. The people should press the star button and not comment unless they have anything decent to say

But as for the matter of wanting Ruby in Google Apps is not unfair. I have coded Python but my Ruby-fu is far far stronger. I could create wonderful things with the tools I have.

Learning another language to use a tool is a crippled philosophy. If you downloaded software to write plugins and it was a vastly different language, it could be a deal breaker for you, right? Why should it be any less? Google are getting traffic and a bunch of other goodies out of locking you into their domain.

3 Comments

State of the View

After a brief discussion with Obie regarding Rails views, he suggested that I have a look at HAML. I did, and it is now my primary source for using as a templating system in Rails.

YAML and HTML but oddly enough, it really works. I was adamant to not use it, no matter how many people told me to take a look at it. Rightly so, it is a travesty to HTML views, but its a helpful, time-saving travesty.

My dream is to create a Flex-view-like language that uses XML like so:

<mx:DataGrid id="entries" width="{reader.width-15}" dataProvider="{httpRSS.result.rss.channel.item}" cellPress="{body.htmlText=httpRSS.result.rss.channel.item[entries.selectedIndex].description}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="title" headerText="Title" />
<mx:DataGridColumn columnName="pubDate" headerText="Date" />
</mx:Array>
</mx:columns>
</mx:DataGrid>

It is hard for a lot of people on the web to agree with, as they’ve spent the last 4 years being shoved that “views and content are seperate”, but there is a lot of logic in the above code which I enjoy.

I am curious to know what other people think of the state of HTML, HAML, and other view systems, and what they’d like to see.

1 Comment

SXSW 2008 Wrapup

SXSW has ended and my mind and body have not come back on the same flight.

It is always an awesome event but always tiring too. I usually try to write expansive reviews of the event but this year I am adopting a more bulleted system.

Mark Zuckerberg & Sarah Lacy Interview

Hot on everyone’s lips is the interview being dubbed as the worst interview of all time and such. When watching it, I thought the crowd was being over zealous. They had very high standards and did not feel that Ms Lacy met them. She felt that the interview was “An Interview with Mark Zuckerberg and Sarah Lacy” as opposed to being a tool to elicit questions. She was flirtatious beyond the point of good fun. Notably, many times Mark Zuckerberg hinted that she wasn’t interviewing him in a well manner but it didn’t quite decode in her mind. She failed the interview yet if you watch the after-video she seems to blame everyone else but herself. She started with a bigger introduction for herself than him (granted we know who he is, but she had already thrust herself in the lime-light) and then starts with telling the audience how she feels.

I was in the overflow-room and for it to happen in parallel suggests that it is more than just the crowd.

Also, Its funny she’s never heard of Will Wright, after she said “no one has ever had anyone as big as Mark before”

Egos

The one thing that I dread about SXSW is the egos. There are so many people in the web field with a huge ego. A lot of people got the panels they wanted to because they are known around the web and thought as of reputable sources (whether or not they are is different). Some chose to talk about things they knew about, others did not. It infuriates me no end.

Designers should talk about design, coders should talk about code, freelancers should talk about freelancers as should people who make web apps talk about web apps. And you watch as people with no clue about a subject branch over into another and then watch as people watch them for it.

Another example of egos is at the SXNW party (which ALWAYS rules, good work Blue Flavor) where a friend and I were waiting in a queue for 30 minutes (a mini queue upstairs) when a group of people, who I found out was the Flock crew barged past us and got priority service. This was a common theme so I understood, but the fact there was only 6 people in the line and when we mentioned we’d been waiting, they responded with “It’s fine, we work at Flock!”. Two members of the team got held as there was too many of them. And thus the wait carried on for another 30-60 minutes. I had left about 10 minutes after, angry and unamused.

Gaming

Gaming was a more prominent theme this year and I thought it overcrowded an already overcrowded conference. Game Developers Conference (GDC) was less than a month ago so I saw no reason that this conference should have been diluted even more. You can’t cater for everyone, instead do the best at a few things.

Wrapup

It was great to be there. I met some awesome new people and some good old friends too.

The fact that my hotel room flooded on the last day and got all my stuff wet, didn’t even put a dent in the trip.

The after-conference meetup (also known as the Airport) was awesome fun too.

Check out the photos for yourself!

0 Comments