Send Eco-elegant flowers

Tag Archive for 'ruby on rails'

Getting down to coding faster

When I reboot my mac, or need to switch projects, I had quite a few clicks and mouse movements to go through. I found it rather repetitive, so I set up a shell script (in ruby) to open Firefox, Textmate, and start the rails server.

Here’s the script. I called it open_dev_environement and used chmod 755 open_dev_environment to make it clickable and executable from the project directory.

# make sure your path to ruby is the same as above by typing 'which ruby' at the command line
app_directory_name = "persfin"

# start mongrel, using -c to change the directory
system 'mongrel_rails mongrel::start -c ~/Sites/' + app_directory_name + '&'

# change Minefield to Firefox if you're not using the latest Firefox Nightly Beta
`open -a /Applications/Minefield.app http://localhost:3000`

# make sure your textmate project file has the same name as the directory
system 'open -a TextMate ~/Sites/' + app_directory_name + "/" + app_directory_name + ".tmproj"

It would be interesting to know how to extend this to open up multiple tabs in Terminal (for example, ’script/console’) Or, if there is a better way to do these commands with osascript for applescript. If you know, let us all know in the comments.
see also Ruby may replace Applescript.

Bookmarks for Sunday, March 2nd, 2008

Here’s what I’m reading and bookmarking this week on the web.

Digital Web Magazine - How to Build a Green Business

Digital Web Magazine - How to Build a Green Business

In an age of inconvenient truths, global warming, and “green is good” messages in the mass media, Sustainability has become a popular catchphrase and the new marketing must-have for many companies. But what does it truly mean? And how can it apply to your business? Contributing to the community in which you work can have far-reaching business effects, from positive brand recognition, to free networking and marketing, to a broader, better talent pool. Plus, it just makes for a better place to work and live. In this article, I’ll discuss how our web design and development company incorporated sustainability into our business model, and how other development companies can do the same

Tags: ,

OpenID-2.0.2 with Rails-2.0.2

OpenID-2.0.2 with Rails-2.0.2

How to use OpenID with Rails 2.0.2

Tags: , , , ,

Null is Love » Ruby on Rails

Null is Love » Ruby on Rails

Great series on learning testing and TDD on ruby on rails

Tags: , , , ,

Beautiful Wordpress Designs

Beautiful Wordpress Designs

Wordpress designs utilizing the css-enabled Sandbox theme are easy ways to get going on your wordpress blog customization.

Tags: , ,

Buy the Full Ownership Rights to Articles, Tutorials, and Website Content | Daily Article

Buy the Full Ownership Rights to Articles, Tutorials, and Website Content | Daily Article

Pay for royalty-free rights to articles for your site. This seems like a bit of a short-cut, but if you find the right article it may be very cost and time effective. And if you’re a writer, you could get paid for your work. It’s kind of like iStockPhoto for articles.

Tags: ,

Testing your Rails views with Hpricot — Luke Redpath

Testing your Rails views with Hpricot — Luke Redpath

Rails comes with the built-in assert_tag method but I’ve always found it clunky and a pain in the arse to use. By combining the Hpricot library and a few useful helper functions, you can now test the output of your Rails views in Test::Unit::TestCase easily using Hpricot’s support for CSS selector searches.

Tags: , , , , ,

DoubleTake - Stitch Images to Panoramas on Mac OS X

DoubleTake - Stitch Images to Panoramas on Mac OS X

Virtual wide angle lens for panorama images. Drag images from iPhoto or Finder and stitch them together, with a minimum of effort. for €16.95

Tags: , , ,

Flash Panorama Software / Photo Stitching Software - Panoweaver 5.00

Flash Panorama Software / Photo Stitching Software - Panoweaver 5.00

Flash Panorama Software / Photo Stitching Software - Stitch photos into 360 degree spherical Flash panorama. Free trial. You may stitch both spherical and cubic Flash panoramas. Mac only version 4, $299

Tags: , , ,

Kekus photo stitching and correction software. Panoramas made easy.

Kekus photo stitching and correction software. Panoramas made easy.

Calico is an automatic multi-row stitcher for the casual photographer. Calico was developed with ease of use in mind. Unlike many other stitching programs, Calico does not limit you to a single row of images or a 3×3 mosaic. With Calico, you can shoot several rows of images or a single row. It’s your choice. Calico requires OS X.4 (Tiger). $39

Tags: , , ,

View all my bookmarks on Ma.gnolia

Rake Tasks for dumping mysql

I have definitely used sqlite database files but I also like sticking to mysql, because I know that’s what I’ll use on the the server. I’ve created some rake tasks to help me in this process. As usual, they go in lib/tasks.

here’s my db.rake file:


# with thanks to sake
# http://errtheblog.com/posts/60-sake-bomb
namespace :db do

  # command line usage: rake db:version
  desc "Returns the current schema version"
  task :version => :environment do
    puts "Current version: " +
      ActiveRecord::Migrator.current_version.to_s
  end

  #rake db:dump
  desc "dumps the devel database to a sql file"
  task :dump => :environment do
    puts "Creating .sql dump file. Enter mysql root password. Just press Enter for none"
    #run a shell command mysqldump -u user -p database name to file name
    `mysqldump -uroot -p app_development > app_development_dump.sql`
  end

  #command line usage: rake db:dumpimport
  desc "imports the devel databse dump file to www2_sw"
  task :dumpimport => :environment do
    puts "Loading www2_sw_development_dump.sql. Enter mysql root password. Just press Enter for none"
    `mysql -uroot -p app_development < app_development_dump.sql`
  end

end

Note you might want to use another mysql user to access your database. For example, -u yourusername. I like doing this so I can check in the dump file into subversion or whatever version control system you’re using. If you find this incredibly useful, you may want to sake bomb it, which would make it available to all your projects. Bonus points for commenting on how to do this below (please?) It would also be cool to automatically grab the production database name.