June 22nd, 2009
Wouldn’t it be nice to have a neat little an application on your desktop which allows you to search and view ruby docs.
Well it’s just 4 easy steps away.
Step 1: Install Fluid
Download and install Fluid a site specific browser for OS X, that enables you to turn a website into an application.
Step 2: Download the Rails Searchable API Doc
- Visit Rails Searchable API Doc
- Press ’select gems’ and decide which versions of Ruby, Rails and other common gems you want to include in your ruby docs application
- Click download
- Unpack the zip file you download and save it to ‘/Users/you/Library/Application Support/RubyDocs’ say.
I chose the ‘Rails Searchable API Doc’ because it includes a number of other ruby gems, has a good search function and supports keyboard shortcuts.
Of course if you prefer on of the other renderings of the docs, e.g. Noobkit and RailsBrain then you could download one of those instead.
Step 3: Download a nice icon
Download conekt’s excellent RubyDoc icon.
Step 4: Make your application
Open Fluid
- Put the local URL of your docs, ‘file:///Users/you/Library/Application%20Support/RubyDocs/index.html’, say, in the URL field
- Put ‘RubyDocs’ in the name field
- Select ‘Other’ in the icon field and find your spiffy icon (downloaded in step 3)
- Press the create button.
You’re done. Enjoy.
No Comments »
June 11th, 2009
The latest version of Screen (version 4.0.3 port revision 3) that comes with MacPorts has a number of issues.
Most annoying for me were that ‘mate’ and ‘gitx’ stopped working from the command line (with the errors ‘mate: failed to establish connection with TextMate’ and ‘gitx: failed to establish connection with GitX’ respectively).
The screen port @4.0.3_1 (version 4.0.3 revision 1) is free of these problems and, with a little bit of work, you can install this version via MacPorts. The instructions below are based on Joe Horns’ post, install old versions of ports using MacPorts.
Instructions
Set up a local port repository. In the file /opt/local/etc/macports/sources.conf, add this line before the rsync line:
file:///Users/Shared/dports
and create that directory.
Install the old revision of the port into your local repository, revision 45522 specifies screen port @4.0.3_1.
cd /Users/Shared/dports && svn co --revision 45522 \
http://svn.macports.org/repository/macports/trunk/dports/sysutils/screen/ \ sysutils/screen/
Run portindex so that ports now finds your new (old) version of Screen.
portindex /Users/Shared/dports
Now you should be able to see two versions of the screen port by running
port list screen
However, rather unhelpfully, they will both be listed as version @4.0.3.
Install Screen
sudo port install screen @4.0.3_1
and you should be up and running.
1 Comment »
November 30th, 2008
When working on web apps, it can really useful to be able to load production data into your development environment.
I am a sucker for anything that reduces typing so I put together a mysql_tasks rails plugin for my MySQL backed applications which makes it as easy as
rake mysql:refresh_from_production
Which makes a tar gzipped snapshot of the production database, downloads it into my development box and loads it into my development environment.
If you want to give it a go yourself then read these installation instructions for the mysql_tasks plugin.
This was inspired by the real Nate Clark.
1 Comment »
September 25th, 2008
Textmate’s indent functionality does a passable job of formatting your code BUT there is a great deal of room for improvement.
Inspired by the Paul Lutus’s ruby beautifier script and Tim Burks’s post on making it into a Textmate bundle I’ve put together a Code Beautifier Textmate bundle
It only supports Ruby at present but does improve upon Textmate’s indent functionality, in particular it is better at indenting multiline statements and cleans up white space.
It’s all hosted on Github so if you want to make improvements then please fork away.
Installation
Run this:
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/mocoso/code-beautifier.tmbundle.git Code\ Beautifier.tmbundle
Then select ‘Bundles > Bundle Editor > Reload Bundles’ from Textmate’s menus
Updated on 21 May 2009
Changed the URL of the repository on GitHub to http://github.com/mocoso/code-beautifier.tmbundle/tree/master to fix a typo in the name (oops).
2 Comments »
September 9th, 2008
When working on a rails project I usually have script/server, script/console and autotest all running in GNU Screen. Jamie Flournoy has already described why using GNU screen is better than plain old Terminal Tabs.
I’ve put together a Screen Textmate Bundle to make it easy to configure and open per project screen sessions.
Installation
Run this:
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/mocoso/screen.tmbundle.git Screen.tmbundle
Set up your screen configuration for a project
Create a .screenrc file in your project directory if you want to specify a particular configuration for your project.
For example for a Ruby on Rails project you might create a .screenrc file in your project directory like this
# Have the server running in screen 1
#
# Stuff is used so that when you exit the stuff-ed program, you drop back
# to the bash shell for that screen instead of immediately exiting that
# screen. This is useful for "^c, up-arrow, enter" restarting of programs.
screen -t server 1
stuff "script/server\012"
# Have autotest running in screen 2
screen -t autotest 2
stuff "autotest\012"
# Have the console running in screen 3
screen -t console 3
stuff "script/console\012"
# Finally have a command line prompt at the project root in screen 4
screen -t project_root 4
Usage
Use this bundle’s ‘Start Session’ command (ctrl-shift-s) to start (or reconnect to) your project’s screen session.
If you have created a .screenrc file in your project directory then this will be used to initialize the new session.
Update (14th Sep 2008)
On Jonathon Palardy’s suggestion I’ve added a ‘Send to Screen’ command (ctrl-alt-c) that copies selected text (or current line if no selection made) to your project’s screen session. If you have multiple windows open in the session then it will paste to the currently selected window.
Update (22nd Jan 2009)
If you want similar functionality without learning screen then check out Nick Rutherford’s Rails Workbench
4 Comments »