Sunday, October 24, 2010

Rails routes, respond_to and more

As pulled from:

I've used respond_to previously...but it slipped my i figured I'd repost it here.

Here is the snippit that replaced a separate (and now useless method) for each major entry view page.

respond_to do |format|
format.js { render :partial => 'list.html.erb' }

Tuesday, February 23, 2010

Flot - jQuery Graphing

Here is one use of Flot in an app I'm working on:


Some ruby to fill in the data/ticks variables:

and that's about it. Some tweaking to clean things up, but I now have a nice weight over time graph with appropriate BMI ranges coloring the background.

Friday, February 19, 2010

Remove .svn folders from a project (bash)

Many thanks to for this one:

If you want remove all your .svn directories from a project run this:

find . -name ".svn" -exec rm -rf {} \; 

Thursday, February 18, 2010

jQueryUI - datepicker on multiple elements by class

I was having some difficulties in placing numerous datepickers on the same form as I'd have to assign ids in my code...I didn't want to do that.
So i made jQuery assign the ID's for me. Loop through each..assign an ID...voila I now have fully functional datepickers on each element as designated by the 'datefield' class.

some jQuery for which I should be ashamed..

This beauty is for a wellness app that I'm working on (in Rails). What makes me proud (ashamed) is my use of 'var that = this'. I saw this somewhere..and couldn't help but laugh..and keep up the fun.

/* Click Event for Goal Completion */ $(".goal_link a").click(function(){ var that = this; $.ajax({ type: "PUT", url: $(this).attr("href"), data: "authenticity_token=#{form_authenticity_token}", success: function(msg){ $(that).parent().parent().parent().parent().parent().hide("slow"); }, error: function(req, status, error){ $("#user_goals_messages").html("We're sorry, but there was a problem updating this goal"); } }); return false; });

This bind event simply performs an ajax call (which would otherwise be sent normally) to mark a "Goal" complete. Upon success it is hidden.

The Start of it all

Throughout the years, I've found myself working to solve random issues for various work projects. I plan to post many of these issues/fixes here (mostly for my own review later on).
Most of these solutions have come from other blogs...forums..screencasts, it seems appropriate to try and give back.

Quick bit about me...
I'm a person who..

  • is a terrible optimist. 
  • firmly believes in the idea of putting everything in life within moderation..especially moderation. 
  • has a Wife and kids that make life grande. 

I'm a programmer who ..

  • enjoys .NET based client app programming
  •  still curses my friend Tim for getting me hooked on Ruby on Rails for web programming. (displacing PHP)
  • has replaced all scripting needs with Ruby based scripts (previously perl and PHP). (irb FTW). 
  • enjoys SQL Server and can keep your Oracle..bleh. (Once again, many will argue against this stance...and good for you). 
  • will curse your existence if you use the phrase "I have this App..." if the words "VB" or "Access" show up anywhere in the following sentences. These have all become the bane of my work existence over the years. 
  • believes in the concept..of try and fail, try again... and fail less..== progress. 
  • Finds himself cleaning up other's messes and making the best of it. 

I'm sure I have much more I could put here..and if I stick with this..I'm sure I will in the future.
I plan to post my accomplishments..failures..and other hilarities I encounter along the way.