When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for Ryan Sobol of Ritirisi.. In 30 minutes or less, it’s difficult to get a solid read on a candidate’s skill set without looking at code they’ve previously written.
Archive for the 'programming' Category
Here’s some SEO resources Ryan and I found today:
Keyword Suggestions:
http://www.webconfs.com/website-keyword-suggestions.php
Keyword Density Checker:
http://www.webconfs.com/keyword-density-checker.php
13 Fantastic tools for analyzing the competition:
http://www.noupe.com/tools/13-fantastic-tools-for-knowing-how-they-are-doing-it.html
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.
Here’s what I’m reading and bookmarking this week on the web.
Digital Web Magazine - How to Build a Green Business
OpenID-2.0.2 with Rails-2.0.2
Null is Love » Ruby on Rails
Beautiful Wordpress Designs
Buy the Full Ownership Rights to Articles, Tutorials, and Website Content | Daily Article
Testing your Rails views with Hpricot — Luke Redpath
DoubleTake - Stitch Images to Panoramas on Mac OS X
Flash Panorama Software / Photo Stitching Software - Panoweaver 5.00
Kekus photo stitching and correction software. Panoramas made easy.
The Picoshot service allows you to embed a thumbnail image of another website in your page with a simple <img> tag. And, I was also able to use curl on the command line to create a file.
A little HTML is all you need to know. There are currently 2 ways to retrieve a thumbnail:
<img src="http://image.picoshot.com/thumbnail.php?url=http://www.example.com"><img src="http://image.picoshot.com/thumbnail.php?domain=example.com">
Just replace example.com with the domain you wish to get the thumbshot for. It’s that simple to get a thumbnail for free. Currently only domain and sub domain front pages are available, with internal pages a coming feature.
For the command line, you must have curl installed, and then use something like this:
curl -o sw-thumb.jpg http://image.picoshot.com/thumbnail.php?domain=sustainablewebsites.com
Notice the -o switch is lowercase, you might be used to using the -O uppercase version to automatically name the file. Sometimes it takes a couple of tries with curl if the thumbnail has not been generated already for the site. If you figure out how to do this in JavaScript, Ruby, or PHP please let us know in the comments!
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.
Sometimes when I’m coding I need to remove all the subversion (SVN - a source code version control program, which if you’re a non-programmer, you could also use for any documents you want to version control) information from the project. Perhaps you’ve copied the code to another directory and want to start a new source repository, or have some other reason. I wrote a short ruby script to help called ’stripsvn’ Here it is:
#!/usr/bin/env ruby
# note above line may need to be changed on linux - use 'which ruby' to find path to ruby
# by Ivan Storck 13 February 2008
puts "The current directory is #{ENV["PWD"]}"
puts "About to delete ALL subversion info from this directory and all directories below"
print "WARNING - this is permanent! Type YES to continue:"
confirm = gets
if confirm == "YES\n" or confirm == nil
puts `find . -name .svn -type d -print0 | xargs -0 rm -rf`
puts "Deleted all subversion info"
else
puts "Command aborted"
end
I put this in a file called stripsvn in a folder called bash_scripts (I know, it’s not written in bash, it’s in ruby) - that was in my path from the command line so I could just type stripsvn at the terminal and run the command. You could put it anywhere, but it’s useful to have a folder that you put scripts you’ve wrote in, and have it included in your path. You might also have to chmod 755 stripsvn to make it executable. This short script is a good example of using mostly ruby to write a useful shell script and only use bash or what I’d call “unix” commands when you have to. It’s all ruby except for the line with the find that actually does the deleting.





Recent Comments