Insights on Ruby, Git, jQuery, Cappuccino, WordPress, Debian and OS X. Please subscribe if you find something useful!

Learning Cappuccino: A Linked List

Posted: November 1st, 2009 | Author: Jerod | Filed under: Cappuccino | View Comments

Picking up a new framework can be a daunting task, especially if you’re simultaneously learning a new language. I’ve done this before when I learned Ruby & Rails all in one fell swoop. It was not easy. I’m doing it again with Objective-J and Cappuccino.

Along the way I’ve compiled a list of valuable resources. I believe many others will be taking this same journey in the coming days (especially once Atlas drops), so I’m sharing my findings for the benefit of all.

Read the rest of this entry »


A WordPress Skeleton Key

Posted: October 29th, 2009 | Author: Jerod | Filed under: Projects, WordPress | View Comments

File this one under “scratching my own itch”

A Problem

I often use WordPress as a CMS and have a couple of sites with many users contributing. I rarely go a week without an email or phone call from a user who needs help posting. When it comes to remote support there is no substitute for seeing what they’re seeing.

However, if you want to login to the site with their user account you have to either ask for their password (tacky & insecure) or reset their password temporarily (amateurish & annoying).

A Solution

Read the rest of this entry »


Cheating on Rails

Posted: October 20th, 2009 | Author: Jerod | Filed under: Tools | View Comments

Fellow command-line junkies either love the cheat gem by Chris Wanstrath or they’ve never heard of it.

What “cheat” offers is a plethora (currently 601) of text-based cheat sheets at the tip of your fingers. Go ahead, give it a try:
Read the rest of this entry »


CappuccinoFlow

Posted: October 14th, 2009 | Author: Jerod | Filed under: Cappuccino, Projects | View Comments

In Brief:

CappuccinoFlow
I just launched CappuccinoFlow: a community driven link blog for the Cappuccino framework. If you’re at all interested in this amazing new technology out of 280north, make sure to subscribe to the RSS feed, follow along on Twitter, and post cool Cappuccino-related links to the flow!

In Detail:

It has been a little quiet around these parts lately. I blame Cappuccino.

For the uninitiated, Cappuccino is a framework for writing web applications (for example). It is built on Objective-J, which is an Objective-C-esque superset of JavaScript. It is completely rad. Also, it’s all client-side so I still get to use Rails on the back-end. I believe the apt word is: woot.

I wanted a link blog to support the small, but growing, Cappuccino community. I’m a big fan of RubyFlow so I contacted its creator, Peter Cooper, and asked him if I could set one up for Cappuccino. He was gracious enough to say yes, and he had conveniently open-sourced an old version of his site awhile back. I forked it on GitHub and the result is CappuccinoFlow.

I’ll probably have to modify my blog’s headline soon, because once I become proficient in Objective-J & Cappuccino you’ll probably see some posts about it.


Run OS X System Profiler From Terminal

Posted: September 9th, 2009 | Author: Jerod | Filed under: OS X | View Comments

OS X’s built-in System Profiler provides a great graphical display of pretty much anything you’ll want to know about your Mac.

profiler

That’s cool and all, but what if you want to access that information programmatically? Turns out you can also run the System Profiler from the terminal by executing this command:

jerod@mbp:~$ /usr/sbin/system_profiler

What’s great about this access method is that it allows you to slurp that data into any other program and have your way with it! For instance, I wanted to track my new battery’s cycle count and charge capacity over time. Why? I dunno, because I’m a geek, okay, get off my back!… Anyways, with the system_profiler command I simply run this little Ruby script every day:

1
2
3
4
5
6
7
8
9
10
require 'date'
 
data      = `/usr/sbin/system_profiler SPPowerDataType`
cycles    = data[/Cycle count: (\d+)/, 1]
condition = data[/Condition: (\w+)/, 1]
capacity  = data[/Full charge capacity \(mAh\): (\d+)/, 1]
 
File.open('/Users/jerod/Documents/battery_history.csv', "a") do |file|
  file.puts "#{Date.today},#{cycles},#{capacity},#{condition}"
end

Ruby uses the (possibly familiar) backticks (line 3) to capture output from a shell command. All that was left for me to do was to parse the raw data and save it to a CSV file.

Finally, note that the my script is passing SPPowerDataType as an argument which narrows down the returned results. You can learn more about how to use the system_profiler command by readings its manual. Just:

jerod@mbp:~$ man system_profiler