I wrote a little utility to turn something like this
this=that, something_else="something else entirely"
Into the much easier to read
this = that, something_else = "something else entirely"
I use it in conjunction with my clipboard utility so I can just copy, run, paste. I mostly use this when I'm working with ColdFusion, so it also works for those pesky cfsets.
Usage: (After copying your target text to your clipboard)
ruby clipboard_format_set.rb
PS: I'd love to set some of my scripts up as Eclipse shortcuts so I've been toying with the idea of writing an Eclipse plug-in to act as a proxy. I realize you can set up and run "External Tools", but I have yet to see a way to bind a key. I'd like the plug-in to take care of the "pasting" to save me that extra ctrl-v. Maybe this would make a good New Years Project?
Tags: clipboard utility, coldfusion, eclipse, ruby, tools
I wrote this little script to copy the filenames of a directory into the clipboard a while back and forgot to post about it. I've been particularly surprised about how often it's come in handy for this or that.
require 'clipboard' c = Clipboard.new list = '' if ARGV.size == 0 path = "." else path = ARGV[0] end Dir.foreach(path) { |file| if(file.length > 2) list << file << "\n" end } c.set_data list
To use it, simply call run the script with the directory you want copied to your clipboard as an argument!
Tags: clipboard utility, ruby, tools
I wanted to demo an ad rotator the other day at work and I wanted to load up a bunch of images of various sizes to make it look legit. It would have taken forever to do it ad by ad, so I wrote a little ruby script to automatically resize all the images in a directory. Then I used my directory listing utility to copy the files into my clipboard. Pasted into the database from there!
(Requires GD2)
Usage:
r = Resizer.new input_path, output_path, width, height r.crop_files
Tags: clipboard utility, gd2, ruby, tools
Here's another little utility I put together. It uses my clipboard utility to copy and format xml data stored in the clipboard. Just copy, run the script and paste!
It comes in handy.
I got (and ever so slightly modified) the xml formatting code from DZone.
Tags: clipboard utility, ruby, tools
I made a small update to my ruby clipboard utility. Now it works in both Windows and Gnome...*ahem* again.
In particular I renamed my Clipboard class to Clipboardr to avoid a naming conflict.
Tags: clipboard utility, ruby, tools