development full of
merriment and sense

Rails respond_to Made It Too Easy

Geoffrey on July 13, 2009 at 10:49 am

I recently had a spike in traffic (1-2 visits/day to 30-40 visits/day) over at CatechizeMe.com. Someone out on the internet came across it, found it useful, and linked to it. Yay!

With this new traffic, came some new requests for features. The first was a request for a Google Gadget. I didn’t know much about what I needed to create a Gadget, but after looking it up I realized I could use the CatechizeMe API that came automatically when I built the app. With just a few lines of code, the Daily Question service was created and returning JSON data. You gotta love it when things are this easy.

BEFORE:

  def daily_question
    @question = @catechism.daily_question
    render :template => '/questions/show'
  end

AFTER:

  def daily_question
    @question = @catechism.daily_question
    respond_to do |wants|
      wants.html { render :template => '/questions/show' }
      wants.js { render_json @question.to_json }
    end
  end

So now I get a daily catechism question from the CatechizeMe website or via the Google Gadget using JSON:

Filed under: Entrepreneurial, JavaScript, Projects, Rails, Web Applications

Microapps Encourage Hacking

Geoffrey on June 3, 2008 at 8:54 am

Small Train
photo by Jeff Belmonte

I am back from RailsConf 2008 and two of my favorite talks were “Microapps for Fun and Profit” by Erik Kastner and “23 Hacks” by Nathaniel Talbott. I have recently been toying around with creating small little apps where I can try out new ideas and sharpen my skills.

One of those apps is the Template Generator Pro. It was a really simple little app the generates funny cover letters, two week notices, job postings, and more. Not a lot to it. What did I learn? I deployed it to SliceHost (my previous apps have been deployed to DreamHost) and starting learning more about hosting and system administration. I also had a chance to port the Nonsense Perl script to a Ruby version. That was fun!

Tools of the Trade

What am I using for my microapps? The first ones (CathechizeMe and TemplateGeneratorPro) were small Rails applications. But that is alot of overhead and not a lot of “micro” in that. So for new things I am looking at Sinatra for a framework and Stone or ActiveRecord with SQLite for persistance. I like JQuery for the Javascript and BluePrint CSS helps me make it look pretty fairly easily. Open Source Web Design and Open Web Design help to stimulate the creative aspects of the designs.

Check it Out

You can see some my little hacks being stored on my GitHub account: http://www.github.com/gdagley. I also have some projects from work at http://www.github.com/relevance.

Filed under: CSS, GitHub, JQuery, JavaScript, RailsConf, SQLite, Sinatra, SliceHost, Web Applications, microapps, mongrel, nginx

One Way I Got JQuery To Play Nicely With Rails

Geoffrey on September 13, 2007 at 10:51 am

Bridge
photo by dave_mcmt

I love JQuery! I did a short 10-15 minute presentation at the last Dallas.rb to let others in on the joys of using JQuery.

But one thing that doesn’t work right when using JQuery with Rails applications is the JQuery AJAX features and Rails respond_to. It turns out the Rails it looking for a specific request header, but JQuery sends something different one.

It is easily solved with this at the top of your application.js file:

$.ajaxSetup({
  beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");}
});

Filed under: AJAX, JQuery, JavaScript, Rails

Lightning Talks at Dallas.rb

Geoffrey on August 31, 2007 at 10:56 pm

Lightning
photo by anyoungkevin

We are doing lightning talks at this month’s dallas.rb meeting. I decided to give the group some choice of what I would present.

I will do a short one on “Why Firefox Makes Me Look Good” or “Better Web App Development using Firefox and a Buttload of Extensions”

I can also do one “JQuery: I Don’t Know Much, But I Know I Love You

And since neither of those are Ruby related, I will throw another one out there: “Tighter Abs: XML Situps Made Easy With Ruby”

I’ll let everyone decide which ones you want to hear more about.

Update

I only did the JQuery presentation and here are the slides (although they were much more interesting in person).

Filed under: Dallas, Development Environment, Firebug, Firefox, JQuery, JavaScript, Rails, Ruby, Web Applications, Web Developer Toolbar, Web Development, hpricot, xHTML

Why Firefox Rocks For Web Development

Geoffrey on May 8, 2007 at 9:47 pm

Because my friend Matt was so impressed with a Firefox extension I showed him, I thought I would share some of my other favorites.

Wild West Railroad
photo by longhorndave

What Extensions I Am Using Right Now

  • Web Developer Toolbar – Just about everything you could want to do HTML and CSS, plus I can edit AND save the CSS changes I was playing around with.
  • Firebug – So much goodness. Especially debugging JavaScript and looking over AJAX requests and responses.
  • View Source Chart – Makes looking at HTML source bearable.
  • ColorZilla – a color picker for pulling colors off of web pages.
  • HTMLValidator – because it is too easy to miss a closing tag somewhere that messes everything up.
  • DummyLipsum – when you need some filler content.
  • SeleniumIDE – great little utility for helping to write Selenium tests for functional testing.
Big Thunder Mountain
photo by meshmar2

Not to mention

Got a favorite? I’d like to hear about it.

Filed under: CSS, Development Environment, Firebug, Firefox, JavaScript, Selenium, Testing, Web Applications, Web Developer Toolbar, Web Development, xHTML

Is Your JavaScript Getting In The Way?

Geoffrey on May 1, 2007 at 9:21 am

Tram Sign on Floor
photo by monique72

With all of the talk these days of Web 2.0 and the fancy, shiny, draggable, refreshable, blinking, glowing components in web applications, I wonder how many of the will still work when JavaScript is turn off or not even present (yes, it still happens). And how is the usability and accessibility of the application affected when so much of the interaction happens through JavaScript that doesn’t degrade?

I have been taking a look at creating a fully functional application, without any fancy Javascipt or AJAX, and then adding the extra functionality unobtrusively. To force myself to learn how to do this, I stopped using Prototype, script.aculo.us, and the Ruby on Rails helpers with RJS, and I started using JQuery. Two things happened: 1. I started to better understand how AJAX works and can enhance my application. 2. I found out I really like JQuery.

More on my JQuery experiences later. Now back to adding cool features, unobtrusively.

Filed under: Accessibility, CSS, JQuery, JavaScript, Prototype, RJS, Rails, Usability, Web Applications, script.aculo.us

Interesting Content Coming Soon!

Geoffrey on April 24, 2007 at 4:50 pm

It finally happened. McKinney Station got a blog! Right now there is not much here, but should be changing very soon. I have all sorts of articles in my head wanting, no, demanding to get out. Thoughts on web applications, Ruby, Rails, Java, xHTML, CSS, JavaScript and more.

Check back soon for my latest thoughts and ideas. Welcome to the Station, this train is about the leave.

Filed under: CSS, Dallas, Entrepreneurial, Fort Worth, Java, JavaScript, North Texas, Rails, Ruby, Web Applications, xHTML

  • gdagley on Twitter

  • gdagley on del.icio.us

Powered by WordPress