→ How are rubies cut?

Thursday, May 08, 2008

Master Rubyist Charles Nutter recently posted an entry titled The Rubyists are wrong. Wrong about the way rubies featured in our Ruby logos are cut.

My father has worked in the jewelry business for over 30 years. As soon as I read Charles’ article, I wondered what Pop would think. So, I emailed him.

Here is his response:

[Charles] is close, but he missed it. The diamond part is correct. But in my experience and having worked with diamonds and color all over the world there is one common thread in the cutting of any color stone. Diamonds are cut for brilliance and yield. Any color stone is cut into a shape which will bring out the color to its upmost beauty and at the same time maximize the yield of the rough. That is why you see more cushion shapes and ovals in rubies. But you usually only see those in larger stones. The majority of the small stones are round. So, I would have to say the round cut is cut the most. Also, the round cut is different from the diamond brilliant cut. Faceting is done to bring out the color in the color stones. So, there really isn’t a facet count on round color like a diamond would have. Also, all of the Ruby logos are correct. If that was the best way to cut the rough to maximize the color than it’s possible a cutter would use any of the shapes, including the JRuby logo. Yes, a lot of color stones are cut off center or in a nonsymmetrical shape.

Thanks Dad.

→ My Goruco Talk

Friday, May 02, 2008

It’s up at the Confreaks site. Besides the few remaining World Tour stops, I’ll also be keynoting the Ruby Hoedown. You won’t want to miss it.

→ Learning Cocoa

Thursday, May 01, 2008

Nathan Florea responded to my last post to correct my Objective-C.

Instead of this:

NSString* amount = [[NSString alloc] initWithFormat:@"%.02f", 
  [converter convertCurrency]];

He recommended I write this:

NSString* amount = [NSString stringWithFormat:@"%.02f", 
  [converter convertCurrency]];

Much nicer. While he was foolishly giving away valuable advice for free, I asked him to recommend some resources for a budding Cocoa developer. His response was pretty awesome, and he’s given me permission to share it with you:

The obvious place to start is the mailing lists. Apple’s are pretty good, but Apple’s interface sucks. Try Cocoabuilder, which actually makes the archive usuable. The Omni Group’s MacOSX-dev still gets some traffic, but I haven’t followed it in a little while. Might be worth checking out and they have some good (but advanced) code online.

A great resource is the CocoaDev wiki. A really great resource for learning is Cocoa Dev Central. They’ve got some great tutorials for learning obj-c that I still use occasionally when I need a quick refresher.

For code snippets, you can try Code Beach and Cocoa Traces. They haven’t really taken off, though, so there isn’t a lot there (I think the CocoaDev wiki is better for that). But I still hope.

You should also check out F-Script. It lets you explore and play with Cocoa apps using an obj-c-ish scripting language. It makes learning fun! Or it’s just fun. But you’ll learn something.

I’d also ask this question at the Ars Technica Mac Forum, Macintoshian Achaia). There aren’t really any development discussions, but there are a lot of devs in the group and they could point you to other resources.

And there are some good IRL resources. If you are near a CocoaHeads group, I would definitely take advantage of that. And if you can get someone to pay for it, the WWDC conference is unbeatable. Part of the ticket price gives you access to all of the sessions, from the current and past WWDCs, through iTunes. It doesn’t replace the experience of getting to talk to other developers and Apple engineers, but it does give you some lasting value that perhaps makes the price easier to swallow.

And last, but not least, there are the blogs. There are some really good Mac dev blogs. I’ve exported my list into OPML for you, so take a look at those and find the ones you like.

Here’s the OPML in question: CocoaDevs.opml

Thanks Nathan!

→ Obj-C vs Ruby

Thursday, April 24, 2008

In Objective-C:

NSString* amount = [[NSString alloc] initWithFormat:@"%.02f", 
  [converter convertCurrency]];

In Ruby:


amount = "%.02f" % converter.convert_currency

That’s all.

→ best of: bash history

Thursday, April 17, 2008

I’ve been tagged.

$ history 1000 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' \
| sort -rn | head
113 fg
90 rg
85 gs
84 git
29 vi
23 rake
15 gb
8 github7
7 sc
6 ls

I use Vim and constantly ^Z / fg Unix jobs.

rg is the redgreen test runner.

gs and gb are git bash aliases.

github7 is the slice I always SSH into.

sc is alias sc='./script/console'

→ bounce

Sunday, April 06, 2008

You want to redirect your old url (/repositories/search) to your new one (/search).

At the top of your routes file:


map.with_options :controller => 'site', :action => 'bounce' do |bounce|
  bounce.connect '/repositories/search', :to => '/search'
end

Your controller:


class SiteController < ApplicationController
  def bounce
    redirect_to params[:to], :status => 301
  end
end

Simple. Add as many more bounces as you need.

→ git bash aliases

Sunday, April 06, 2008

My buddy Rob Sanheim recently post a fresh way to get a new Rails app up and running, git-style.

He shares some of his bash aliases at the bottom, so I thought I would do the same:

alias gb='git branch -a -v'
alias gs='git status'
alias gd='git diff'

# gc      => git checkout master
# gc bugs => git checkout bugs
function gc {
  if [ -z "$1" ]; then
    git checkout master
  else
    git checkout $1
  fi
}

Or grab the pastie.

Oh, bonus:

alias bashrc='vi ~/.bashrc && source ~/.bashrc'

Now you can type bashrc to edit the file and, when you’re done, it’ll automatically be loaded into your current shell. Essential.

→ GitHub is Git's Killer App

Thursday, April 03, 2008

It’s true. DHH said so. In honor, I thought I would take this opportunity to share a few stats.

  • Rails plugins: 28
  • Rails LOC: 3800
  • jQuery plugins: 11
  • Javascript LOC: 910

We recently posted about all the projects making the switch. The list just keeps growing. Hot damn.

→ Tom Morris on GitHub

Tuesday, March 11, 2008

People have said some awesome things about GitHub, but I especially love this quote from Tom Morris on the nodalities podcast:

Git and GitHub together, it’s just bliss… It actually changes how you develop.

→ .railsrc

Monday, March 10, 2008

I like to keep a .railsrc file in my ~ for Rails-specific IRB goodies.

In your ~/.irbrc:


load File.dirname(__FILE__) + '/.railsrc' if $0 == 'irb' && ENV['RAILS_ENV'] 

All set. Here’s an evily awesome snippet to get you in the mood:


def method_missing(method, *args, &block)
  User.find_by_login(method.to_s) || super
end

Now:

>> defunkt
=> #<User id: 44, login: "defunkt", ...>

Lovely. I also like this one:


def sql(query)
  ActiveRecord::Base.connection.select_all(query)
end