→ TextMate Minor Mode

Tuesday, December 02, 2008

TextMate Minor Mode is an Emacs minor mode that emulates some awesome TextMate features.

Like ⌘T (find file in project).

And ⇧⌘T (go to symbol in file).

And more! Really, the README says it all.

Installation:

$ cd ~/.emacs.d/vendor
$ git clone git://github.com/defunkt/textmate.el.git

In your emacs config:

(add-to-list 'load-path "~/.emacs.d/vendor/textmate.el")
(require 'textmate)
(textmate-mode)

Or just grab the elisp: textmate.el

TextMate Minor Mode was written for Aquamacs but works great on console Emacs, CVS Emacs.app and Carbon Emacs. Try it today!

→ Why Lisp Failed

Monday, December 01, 2008

Emacs.

Writing Lisp without Emacs is just too painful. If your language depends on specific features of a specific editor, you better be a big company like Sun or Microsoft with the mad moneys. Otherwise forget it.

→ Learning Your Editor

Wednesday, November 19, 2008

Text editors should take a lesson from video games. In many games, you have access to subset of total weapons, powers, whatever. As you advance and master the basic weapons, more weapons become available to you. By the end of the game you have direct experience with all or most of the weapons – from basic to advanced.

How many times have you done something cool or strange in Vim only to think, “How did I do that?” video-game-mode would be a fun way to learn an editor: start with the basic commands and unlock more as you progress.

→ Singin' Singletons

Tuesday, November 18, 2008

There’s stuff I just don’t understand. David Bowie, for instance. Or the Southern Hemisphere. But nothing quite boggles my mind like Ruby’s Singleton. Because really, it’s totally unnecessary.

Here’s what they want you to do with your code:


require 'net/http'

# first you setup your singleton
class Cheat
  include Singleton

  def initialize
    @host = 'http://cheat.errtheblog.com/'
    @http = Net::HTTP.start(URI.parse(@host).host)
  end

  def sheet(name)
    @http.get("/s/#{name}").body
  end
end

# then you use it
Cheat.instance.sheet 'migrations'
Cheat.instance.sheet 'yahoo_ceo'

But that’s crazy. Fight the power.


require 'net/http'

# here's how we roll
module Cheat
  extend self

  def host
    @host ||= 'http://cheat.errtheblog.com/'
  end

  def http
    @http ||= Net::HTTP.start(URI.parse(host).host)
  end

  def sheet(name)
    http.get("/s/#{name}").body
  end
end

# then you use it
Cheat.sheet 'migrations'
Cheat.sheet 'singletons'

Any why not? The API is more concise, the code is easier to test, mock, and stub, and it’s still dead simple to convert into a proper class should the need arise.

→ Pretty Fixtures

Tuesday, November 18, 2008

# in whatever test helper you use
class Test::Unit::TestCase
  def defunkt
    users(:defunkt)
  end

  def github
    repositories(:github)
  end
end

# in your tests
context "A user" do
  test "belongs to a repository" do
    assert_equal defunkt, github.user
  end
end

Somethin’ like that.

→ Sugar

Thursday, October 30, 2008

The console is part of your app. Treat yourself right.

→ Good Homes Found

Wednesday, October 29, 2008

After putting out the call, a few developers interested in taking up sad, abandoned projects of mine stepped forward.

Thanks to the following for giving these projects good homes:

→ Good Homes Wanted

Wednesday, October 22, 2008

The following projects need a good home. Interested in taking over? Let me know.

→ When GitHub goes down...

Wednesday, October 08, 2008

What if my GitHub repository is corrupted or deleted?

Don’t Panic! Because of the distributed nature of git, everyone always has a local full copy of the repository, complete with history. Any of your repositories, assuming they have been kept up to date, can be uploaded to the GitHub repository with no loss of data.

If the universe is conspiring against you and all copies of your repository are unaccessible, just email support@github.com – we keep offsite, encrypted backups of all repositories.

How can I share my repository if GitHub goes down?

Luckily, git has a built in server for sharing git repositories. If you have several repositories in your Code directory:

/Users/Matt/Documents/Code/
  rbvimeo/
  rubyzilla/

You can serve all of these with the following command:

git daemon --base-path=/Users/Matt/Documents/Code/ --export-all

The repositories can then be cloned using the address of your computer

git clone git://127.0.0.1/rbvimeo
git clone git://127.0.0.1/rubyzilla

Note: The default port git uses is 9418. Make sure that your firewall is set up to handle this.

How can I get a quick web interface?

You can run git instaweb to quickly start a network-accessible gitweb interface, for example:

git instaweb --httpd=webrick

How do I deploy my application with Capistrano when GitHub is down?

There are quite a few ways to deploy without github… ah the wonders of git!

Deploy from a local git server

Set up your repositories to be shared using git-daemon as detailed above. Set your capistrano config files to point the repository to your local repository:

set :repository, "git://YOUR_IP/rails-app" 

You can now deploy your repository as normal.

Push over ssh

Another handy trick is to push the repo to your deploy server over ssh, then deploy using the local path. For this to work, you need ssh access to your deploy server, of course.

git remote add deployserver ssh://myuser@myserver.com/~/myrepo
git push deployserver master

Assuming your users are stored in /home...

set :repository, "/home/myuser/myrepo"

→ Java in Ruby

Wednesday, July 23, 2008

Witness as Ruby dons the fake mustache and bifocals of burly Java: