RSS Feed
May 17

class_navigation_for helper



# The css classes used are for use with the Blueprint css framework

def class_navigation_for(object = nil, options = {})
  unless object.nil?
    options = {
      :class => ’span-24 class-navigation’,
    }.merge!(options)
    content_tag(:div, options) do
      content_tag(:p) do
        link_to “New #{object.to_s.titleize}”, eval(”new_#{object.to_s.downcase}_url”)
      end
    end
  end
end
May 17

Rails flash messages dried up.

Posted on Sunday, May 17, 2009 in Do it yourself guides

Im working on this so I can have less of this <%= flash[:notice] %> in my html templates.

def render_flash(flash)
    [:notice, :warning].each do |key|
      if flash.is_a?(Hash) && flash.has_key?(key) && !flash[key].blank?
        content_tag(:span, :class => key.to_s.downcase) do
          flash[key]
        end
      end
    end
  end
Apr 4

How to set your iPhone wallpaper from Safari

Posted on Saturday, April 4, 2009 in Do it yourself guides

Open Safari and locate an image on the web.
Tap and hold your finger on the screen where the image
is being displayed. A menu will appear, tap save image. Press the home button on you iPhone to return to the home screen. Tap photos and select camera roll. Locate the new image(s) and select one, choose use as wallpaper. Another dialog will appear asking you to move and scale.
Once you have the correct position and size click done. You will now see your wallpaper when your lock screen appears.

Feb 6

Rails ActiveRecord::Base missing find_all_by_date_range

Posted on Friday, February 6, 2009 in Just for fun, Ruby on Rails, Software, Web Design Tools, Web Tools, Work

Hello everyone,
A current project I am working on required finding records within a certain date range. Many other projects I have worked on also required something similar. So, I decided to create a Rails gem to handle this. The gem is available on GitHub. http://github.com/timmatheson/find-all-by-date-range/tree/master

Install

Usage:

I hope this helps anyone else needing this feature of ActiveRecord::Base.

Best regards,

Tim Matheson

Nov 19

Rails JavaScript and CSS file AutoInclude Snippet

Posted on Wednesday, November 19, 2008 in Ruby on Rails

Ok so you have a Rails application and it’s growing fast. Your putting complex logic where it belongs, Your partials are DRY, and your using TDD and BDD concepts in your project. The world is yours, your code is bullet poof. Well what about those pesky JavaScript and CSS files? If you have a lot of them they can easily get out of hand and become redundant and duplication becomes a direct result. So how can you DRY it up a bit you ask? With an asset_autoinclude_tag helper. The concept is simple. For each controller/view in your app you design a javascript and or css file with code directly related to the pages rendered by them. In addition to this you name them using the same Rails naming convention as your other files. For instance you have a PublicController you would create a public.css and or public.js file for any css/js code related to that controller. Everything else can go into application.js and application.css.
Heres the code.

Update:
I have moved this into a gem if you would like to use it in your projects. It’s available in my GitHub repository.

git clone git://github.com/timmatheson/asset_autoinclude_helper.git

You can also install the gem by adding GitHub to your gem sources and installing it.

INSTALLATION
gem sources -a http://gems.github.com
sudo gem install timmatheson-asset_autoinclude_helper-0.1.0

Then to include it in your application just call it in your global layout like this.

<%= asset_autoinclude_tag %>

You can also pass in options for the javascript_include_tag like :cache => true

<%= asset_autoinclude_tag(:cache => true) %>

And thats it. I hope this helps you dry up your code a bit. I know I am probably not the first one to think of this. I plan to make it into a gem soon so check back.

Best regards,

Tim Matheson

Jul 11

Refactoring ruby code

Posted on Friday, July 11, 2008 in Refactored Code

I am currently working on a Rails project with a team of developers.
I did some refactoring of a helper method and thought I would share it with the world.
Maybe someone out there can benefit from this.

NOTICE: I changed the helper method name and the model[attribute] values to show a more generic method.

Before refactoring

def some_helper_method
select_tag 'model[attribute]‘,
options_for_select([[" Today ... ", Date.today], Date.today+1,
Date.today+2, Date.today+3, Date.today+4, Date.today+5,
Date.today+6, Date.today+7])
end

After refactoring

def ship_date_select(model,attribute)
todays_date = Date.today
options = [['Today ... ', todays_date]]
6.times do |x|
options << todays_date+x
end
select_tag "#{model}[#{attribute}]", options_for_select(options)
end

The problem with the first example is that it is not very DRY. It is asking Ruby the date 7 times.
It should only need to ask this once and store it in a variable called todays_date. If anyone out there knows a better way to do this please feel free to shoot me an email.

Best,

Tim M.

May 16

Meet the Aqua Bots

Posted on Friday, May 16, 2008 in Work

Meet the Aqua Bots

A pair of underwater robots I created.

May 15

Gaffney Plumbing - Marshfield Wisconsin Plumbing Company

Posted on Thursday, May 15, 2008 in Work

gaffney-post.jpg
Marshfield Wisconsin Plumbing Company

Apr 21

HowTo: Shutdown your Mac with a text message

Posted on Monday, April 21, 2008 in Automation, Command Line Tips, How To's, Mac Stuff, MacGyver, Macros, Productivity

Ever went on a trip and thought oh shit I forgot to turn of my Mac? Well you could turn around and go back, you could call a friend or you could just send a text message to your email address that Mail downloads and shut it down yourself. I’ve already showed you how to shutdown windows with a text message and a batch script. Now it’s time to do it Mac style. To complete this tutorial you will need the following.

1. A Mac (duh) Ive only tried this on Leopard, if you get it running on Tiger please let me know.
2. Mail which if you have a Mac you should have installed.
3. ScriptEditor also included with Mac
4. A cellular phone with sms text messaging capabilities and sms service.
(more…)

Apr 5

Holistic Dog Food - Better for your dog

Posted on Saturday, April 5, 2008 in About Tim Matheson

Domino My Puppy
Hello everyone,

I have recently switched my dog over to holistic dog food products to see if it makes any difference at all and it does. Domino has been on holistic dog foods for about 2 months now and his coat is nice and soft and very shiny, his teeth seem to be whiter and he has not been chewing up my things as much lately. I get my holistic dog food from work as I work for a pet store in Kenosha WI. The reason I wanted to let everyone know this is I didn’t think it would make that big of a difference. Yet it did after only a few weeks. If you wanna see the difference you can buy holistic pet food for both dogs and cats by clicking the link below.

www.barksnbubbles.com

Jan 26

HowTo Juice a lemon (Juicy Post)

Posted on Saturday, January 26, 2008 in Grocery Hacks, Household, Quick Tips

If your anything like me your not so handy around the kitchen. No worries, you can obtain master cooking skills from various sites around the internet and with a little practice, you can improve your cooking skills. To get you started heres a great video on how to squeeze a lemon to optimize juice production when juicing.

www.startcooking.com

Jan 26

DIY Desktop Virtual Reality Display on the cheap (Nintendo WII Only)


Johnny Lee, and his WIImote hacking tips has created a way to make 3D games (for the WII) a reality using DIY IR glasses. This is a really cool concept, the software tracks the movement of your head and adjusts the current display accordingly. I am definitely going to experiment with this technology.

You can also check out Johnny Lee’s website here.

Dec 21

1 Year of Ruby on Rails Programming

Posted on Friday, December 21, 2007 in Ruby on Rails

Over the past year I have made the change to Ruby on Rails as my programming language and framework of choice. The reason is simple, Ruby on Rails manages enough of the tedious tasks faced by most developers fairly easy. With that said it is also safe to say it makes me more productive, and increases the quality of my work. The pros outweigh the cons by far. I would encourage anyone programming in PHP, ASP/ASP .NET, C+, C++, JAVA, or even Cold Fusion to give Ruby on Rails a shot. Most likely you will hit the Rails and never look back, yeah it’s that great. It has now been one year since I originally Installed Ruby, Installed Rails and dug deep into the code. While I am still learning a great deal about some of Ruby’s more advanced functionality I have mastered for the most part the entire framework from unit testing to model associations. If you are just getting started in Ruby I would be glad to answer some of your questions, simply send me an email or comment on this post below.

Best regards,

Tim Matheson

Dec 12

SSH Copy files from one server to another using rsync clie tool

Posted on Wednesday, December 12, 2007 in BlueHost.com, CentOs, Linux, Media Temple, SSH

Ok so you have a file and want to move it to another server on another network. What to do what to do. Well you could just FTP it to your local machine then FTP it up to the new server, but this file is 300mb and that would take a long time. Being the lazy programmer you are you may seek another more ‘geek friendly’ way of doing this. There is a tool called rsync that does just that. It will login to one server, shake hands and then begin transferring your data to the specified new directory. I tested this on BlueHost and no dice. Authentication failed however I am sure if you have time to try and configure the two machines to talk you could do it. This would be great if you had root access to both machines. In my case I only have root to the destination server and not the source server. BlueHost technical support said that the port rsync uses is blocked. Im not sure what that port is but if you found out you could configure rsync as a daemon service and bind it to that port. I will be looking into this in the future and posting more about it in a follow up post.

Happy tunneling.

rsync -av -e ssh username@oldserverhost:/home/old_home/ /home/new_home/

This command was gracefully copied from [Tony Spencer's Website] it’s a great website I highly recomend it if you like my site (even has the same ndesign Word Press theme as my blog).

Dec 6

New Ruby on Rails site

Posted on Thursday, December 6, 2007 in Ruby on Rails, Web Design Portfolio

I recently deployed a few Ruby on Rails sites to a production server. If anyone wants to check one of them out they can visit Barksnbubbles.com Dog Food, Dog Toys, and Pet Supplies online retailer. If you have any suggestions for the site please let me know.

Best regards,

Tim Matheson

Nov 27

New Red Interactive Codes for Hidden Characters

Posted on Tuesday, November 27, 2007 in Keyboard Shortcuts, Off Topic, Personal Posts, Web 2.0

ff0000.png
I recently revisited Red Interactive and found some new characters in the sourcecode of the flash file. I thought I would share them with you here.

“nay nay give me some hay” = “ed”

“dead men tell no tales” = “nub”

“jiminy cricket!” = “hopper”

“the last straw” = “cameljoe”

“surley you jest” = “jester”

“rumpelstiltskin is my name” = “unclesam”

“may i please have some blueberry pie?” = “gordon”

“i shot a man in reno” = “jailbird”

“i dreamt i was a butterfly” = “sun”

NEW CODES!

“happy halloween” = “skely”

“the funk of forty thousand years” = “skeletor”

“trick or treat” = “shakspeare”

“smell my feet” = “minuteman”

“baby got back” = “fatback”

“nay nay i never got any hay” = “dropdeaded”

Nov 27

Surface computing brings multi touch sensors to your home


I have been following this multi-touch sensor based computer technology pretty closely. I am fascinated by the thought of these types of devices to replace our current constraint prone desktop and laptop computers. The file transfer feature has got to be one of the coolest features of the coffee table computer shown in the video. I dream of a day when wads of cables become non-existent.

Nov 25

Send emails with ease, Rails Mailers Demystified

Posted on Sunday, November 25, 2007 in Programming, Ruby on Rails

Ruby on Rails Mailers

Setting up a mailer in Rails can seem like a daunting task, especially to new comers. I found this video and several other resources online to be very helpful in explaining the ins and outs of setting one up. This is a very in depth video explaining how mailers can make life easier for the Ruby programmer. See the screencast!

[via : http://media.railscasts.com/]

Nov 24

Use Hibernate and Standby to Conserve Batteries

Posted on Saturday, November 24, 2007 in How To's, Productivity, Quick Tips, Travel Tips, Vacation Tips, Windows Hacks, laptops

Microsoft has a great article on how to conserve your laptops battery supply using hibernate features available in “most” windows installations. I really think this is an overlooked feature available to Microsoft customers. Read the full article

  1. Open Power Options in Control Panel. (Click Start, click Control Panel, and then double-click Power Options.)
  2. Click the Hibernate tab, select the Enable hibernate support check box, and then click Apply.
  3. If the Hibernate tab is unavailable, your computer does not support this feature.
Nov 23

Stream your files anywhere anytime for FREE


ORB Media Freedom
www.orb.com is a FREE piece of software that allows you to stream your desktop computers content to various web enabled devices such as cell phones, laptops, pdas and even other desktop computers remotely. I especially like the feature which allows you to stream video to your smartphone. While buffering can become excessive at times, the stream makes up for it in quality and the ability to encode virtually any media file you through at it avi, mpeg, mpeg4, mov, wmv etc. Orb is a must have for an on-the-go lifestyle. Get it FREE here

  • buy generic viagra
  • buy cialis from canada
  • price of acomplia
  • buy synthroid without prescription
  • synthroid online cheap
  • cialis from india
  • viagra order
  • accutane generic
  • cheapest levitra prices
  • buy clomid online
  • generic cialis cheap
  • buy cialis lowest price
  • buy acomplia
  • buy levitra online
  • cheap cialis pill
  • buy cheapest cialis online
  • discount cialis
  • where to order viagra
  • viagra no prescription
  • order cialis no prescription required
  • soma generic
  • cialis tablet
  • levitra
  • cialis for order
  • order acomplia online
  • cheap generic soma
  • order levitra
  • discount cialis no rx
  • find cialis no prescription required
  • viagra online
  • cialis malaysia
  • viagra uk
  • soma pharmacy
  • buy cheap cialis
  • levitra cheap
  • buy lasix without prescription
  • lasix without prescription
  • order propecia online
  • cheap cialis
  • viagra free delivery
  • viagra overnight
  • cheap clomid online
  • lasix without a prescription
  • viagra online review
  • find viagra online
  • cialis generic
  • purchase viagra
  • propecia pharmacy
  • find cheap cialis
  • cheapest cialis prices
  • buy soma cheap
  • buy lasix cheap
  • cialis overnight
  • sale cialis
  • clomid pills
  • order cialis on internet
  • soma sale
  • cheapest lasix prices
  • viagra no online prescription
  • buy viagra from us
  • buy generic cialis online
  • cheap viagra tablet
  • soma without prescription
  • buy zithromax cheap
  • order propecia
  • buy cheap synthroid
  • find cheap cialis online
  • buy cheap lasix
  • order soma
  • lowest price propecia
  • discount propecia
  • purchase viagra online
  • accutane for sale
  • soma pills