MetaSkills.net
Coding things under other things!

Workflow

How To Clean A Campfire Room Of Uploads

For us at work, our uploads to campfire are really transitory. Most of the time they are simple screenshots around a current topic. Every now and then vacation photos or even movies, at the end of the day, none of it has value after a certain amount of time. To us as the real value of campfire is our textual transcripts. This morning after 4 years of campfire, we were real close to our 1GB limit of uploads. Time for...

The alias_method_chain of Rake - Override Rake Task

Rake is cool. It is built so that multiple tasks with the same name run in a reverse defined series. This is great, but sometimes you want to override a task with your own behavior and conditionally call the earlier task. Especially if that task is defined deep somewhere else, like in a rails gem. I have had to solve this problem before in Rake. Awhile back I hacked something up that would totally trump a predefined rake task and...

Git Init XCode Projects

Here is a little ZSH function I have been using for quickly setting up new XCode apps I call tire kickers, little play and learn apps. Being able to track your learning as you go with git. if [[ -x `which git` ]]; then function ginit_xcode () { git init echo "\n\n# XCode\nbuild\n*.mode1v3\n*.mode2v3\n*.nib\n*.swp\n\ *.pbxuser\n*.perspective\n*.perspectivev3\n\n# OSX\n.DS_Store\n\n\ # TextMate\n*.tm_build_errors\n\n\n" >> .gitignore git add .gitignore git commit -m "Ignore Xcode stuff." git add . git commit -m "Initial Xcode project." } fi The...

Git & Subversion User Commit Reports

Want a list of the users and the number of commits they made? Git makes it really really easy, while I could not find such an easy method on Subversion. Here they are. Git $ git log | git shortlog -n -s Subversion #!/usr/bin/env ruby require 'rubygems' require 'activesupport' log_xml = `svn log -q --xml` svn_logs = XmlSimple.xml_in(log_xml)['logentry'] report_hash = svn_logs.inject({}) do |report,log| author = log['author'][0] report[author] ||= {:commit_count => 0} report[author][:commit_count] += 1 report end commits_authors = report_hash.keys.map {...

MultiRuby The MacPorts Way. Testing Your Rails Apps With Ruby 1.9

UPDATE: In a recent article, I covered how to install REE and have hence NOOP'ed this function to ignore the symlinking when REE is installed. Ruby 1.9.1, the stable release, is just around the corner and if your like me, maybe you want to start playing around with it and perhaps test a few projects using 1.9 with edge rails 2.3. If so, and your on a Mac, then perhaps this installation method might appeal to you. I'll break this...

Autotestify Brothers and Sisters

Based on my previous article Using Autotest For Rails Plugin Development, Brennan Dunn wrote a ZSH function that helps him with his eager rails plugin work. Testing plugins is simply the most fun you will ever have. It's nice to test in isolation and easy to make a plugin test multiple rails versions, etc. Typically plugin testing is very fast to because you are not burdened with excessive tests in a big app that might use it. Just the ones...

Using Autotest For Rails Plugin Development

I love autotest. I have event posted before how to extend the idea of autotest sounds to a red/green playlist but now that I am taking more time to extract some of my work to plugins, I really wanted autotest to come with me. The problem is that the default autotest mappings do not play with rails conventions, the biggest being that test files for a lib match the name of the lib with _test.rb at the END of the...

Coulda Shoulda Woulda

It has been about 6 months now since I started using the Shoulda testing plugin as my BDD/TDD tool of choice. Unlike a lot of other people, I did not flock to the RSpec bandwaggon. Personally I think RSpec is horribly bloated a sledgehammer for a simple issue, the need to have test code organized with nested setups and context blocks. If you are new to Shoulda, I highly urge you to take a look at the Thoughbot project page...

Rake task to read and write the ActiveRecord schema version table.

After attending Rails Edge in Reston, Virginia I decided to move some common tasks from my ~/.irbrc file and put them into Rake. I thought I would share a task that reads and writes the ActiveRecord schema table. Sometimes in migrations this is either good to know or manually change. Simply copy this in a foo.task file in your project/lib/tasks directory and use rake -T to see the description and usage. I have placed these tasks in the db:version namespace....

Custom Rake Task To Unload Fixtures

I made a revised version of a rake task that I have used quite often, for unloading existing DB tables into fixture data and thought I would share. This rake task is the in correct name space and adds a "rake db:fixtures:unload" command to your rails project when you put this in "lib/tasks/foo.rake". It can take an optional TABLES variable or if none is present the whole array of DB tables are converted. I find this rake task helpful when...

Quake Style Terminal Window on OS X

Well this is far beyond cool but highly functional, a Quake like terminal implementation of Terminal.app that is a HotKey away from within any application. A friend turned me on to this after it showed up on the Monday morning Apple links post from arstechnica.com. Although I have never thought of this idea, it seems to have been a popular request for quite some time and after a public request, the author of QuickSilver stepped up to the challenge and...

Getting On Good Terms With The OS X Shell

I will be the first to admit that I am really just learning how to tap into the power of my shell environment and to be honest, I've spent way to many hours reading man pages and figuring out how to do some really neat things that help my automate my workflow and system administration. Mostly these are just basic tasks like my Simple MySQL Backup and Deleting Invisible Resource Files scripts. But in all seriousness, when you get right...

Shell Script To Delete All Invisible ._ Resource Files

If you have ever accessed your website using a network protocol such as the Apple Filing Protocol (AFP), Samba (SMB), Web-based Distributed Authoring and Versioning (WebDAV), or Network File System (NFS) using your Mac – I am sure you have run into this problem before – dreaded invisible resource fork files. These are the files that begin with a ._ and they are normally not seen from within the finder. My understanding is that these files are not even created...

The Best Font for Mac Programmers, ProFont

After being exposed to using TextMate for all my normal text editing needs, I soon began to do more things than just simple GREP-based search and replace functions. I actually started to look at code more often. Within a few short months, I had gone away from my established norm of the happenstantial viewing of simple CSS, HTML and PlainText files to a ful-time lookey lou of languages such as Ruby, XML, PHP, SQL or any number of configuration files...

How To Setup a Simple MySQL Backup Script

Lately, I've been loving all things that can be solved by using RsyncX. It's my de facto backup utility and I just keep finding more and more tasks for it as each day goes by. It has become the hammer for all my system's needs. So when it came time for me to implement a nice little backup routine for the MySQL databases hosted here at ActionMoniker.com, it was the first tool I considered. My requirements were simple, I needed...