Since the iPhone lacks the possibility to export tasks from iCal I made hack/script to export all tasks from OmniFocus to a Safari bookmark and therefore be syncable with Safari.
I get a lot of questions on how to make the thumbails show up on theme behind this site. So I’ve updated the page with some instructions to help you all.
I’ve started on the 2.0 version on the theme that will (along other features) make thumbnails easier to manage.
I never really liked iTerm because of slow redrawing, ugly text anti aliasing and not reflowing text when resizing the window.
After reading some interviews on a Rails site today and saw that a lot of people are using iTerm i wanted to give one more try (because I’d really like a tabbed terminal).
It has improved a lot the latest months and seems really usable now. To make Rails development easier, I hacked together a small AppleScript what will ask you for the path to the Rails directory you want to use and then open four new tabs with Server/Mongrel, Console, Autotest and the directory itself. I thought it could be useful for others as well so here you go:
Save as an .app and run from Quicksilver:
global rails_dir
tell application "iTerm"
activate
set rails_dir to the text returned of (display dialog ¬
"Please Enter the Path to Your Rails Directory" default answer ¬
"~/Projects/" as text)
if (count of terminal) = 0 then make new terminal
my open_tab("Server", "&& ./script/server")
my open_tab("Console", "&& ./script/console")
my open_tab("Autotest", "&& autotest")
my open_tab("Rails Directory", "")
end tell
on open_tab(title, command)
tell application "iTerm" to tell first terminal
launch session "Default"
tell last session
write text "cd " & rails_dir & command
set name to title
end tell
end tell
end run_command
Just after posting this I saw that sam tagged the 1.5.1 release in svn so I guess this means that 1.5.1 is final. Great work!
There has been a lot of action the past days in the Prototype SVN; the release of 1.5.1 RC4, the new DOM and Position branches and a lot of other work. Since I watch most of the tickets and changesets I thought I write something about what’s (might be) in the future for Prototype.
DOM branch
I was happy to see a patch I’ve been working on (#7476) to get included some days ago.
It will define a new Element#writeAttribute method which will work together as the already existing #readAttribute to work around many issues browsers having with the native set/getAttribute methods (as always mostly in IE) but also to make chaining work:
The patch will also make the Element object into a constructor for very easy and fast element creation (i.e. document.createElement wrapper):
var header = new Element('h1');
The constructor will also accept an optional attributes hash for the attributes (as seen above in the #writeAttribute method):
var header = new Element('h1', {id: 'myHeader'});
Of course chaining will work so for a simple image switcher with preloading you could do this:
<!-- html -->
<img src="thumbnail.jpg" id="thumbnail" hires="big.jpg">
// javascript
$('thumbnail').observe('click', function(event) {
var thumb = Event.element(event),
preloader = new Element('img', {src: thumb.readAttribute('hires')});
preloader.observe('load', function(event) {
thumb.writeAttribute('src', preloader.readAttribute('src'));
});
});
Event Branch
I haven’t followed the event branch very closely but from the code and messages on the ML I’ve seen there should be new functionality for better garbage collection (to prevent memory leaks) and for e.g. easier removal of observers from elements.
Where you before had to manually collect all an element’s event listeners to be able to remove them later:
After five months we finally launched the new site for Konst & Teknik last night. It is my first Ruby on Rails-project and even though it might look pretty simple it has a lot of advanced things going on both server- and client wise. I plan to write more about the development of the site shortly.
I’ve found out that Safari can’t handle the same animated gif as background for multiple elements, it will just animate one of them at the same time. On a project I’m currently working on my I use the following trick to make all requests to the background image (in this case indicator_black.gif) unique.
[...]
var text = transport.responseText;
if (Browser.WebKit) {
text = text.gsub('indicator_black.gif', function(match) {
return match + '?' + new Date().valueOf() +
Math.round(Math.random() * 5000);
});
}
[...]
I’ve ported Rails’ Numeric Time extensions to JavaScript since I needed to do some date calculations for a project I’m working on. Now one should be able to calculate dates in JS like this:
This the first version of a TextMate bundle for Prototype and script.aculo.us JavaScript libraries. The language grammar is based on from Justin Palmers Prototype Bundle but the other commands/snippets are all new.
Please let me know if you have any comments and/or improvements.
This is a Prototypish rewrite of Paul SowdensStyle Sheet Switcher. The original version has a lot of global functions so I put everything into a class instead and made the code a bit more elegant. It should work as the normal one except for some methods have been renamed.
A cookie library is included as well since the switcher needs to read and create cookies to save the users preferred style sheet.
Update
I fixed a bug for pages without any alternate style sheets and updated the script to version 0.2.
Add these lines to your ~/Library/KeyBindings/DefaultKeyBinding.dict (create the file if it isn’t already there) and the commands will be available in every application started afterwords.
When you type e.g ⇧2 for a double quote (as in swedish keyboard layout), it’ll automatically insert the ending quote as well and place the cursor between them. This will also work for “([{<”. Remember the shortcuts are for a swedish keymap so you might want to change that.
A real time saver when writing outside an editor without this functionality built-in (like TextMate).
Update 2006-08-07
Simplfied the commands based on Jacob Rus’ comment.
To keep my desktop nice and clean I have a folder called “Dump” where I put temporary stuff like apps I want to try, PDF:s to read later that day or files I’m currently working with. But sometimes I forget to look inside that folder to find out what’s there so I wrote this Folder Action to let the folders name reflect the number of containing files/folders. (I know I could just enabled “Show item info” from Finders “View Options” but I don’t want to see all info for my hard drives and iPod)
Just create a folder on your desktop, name it something like “Dump (temp)” and attach this Folder Action to it (Folder Actions need to be located in ~/Library/Scripts/Folder Actions).
-- Set item count as folder name.scpt
on adding folder items to this_folder
my update_name(this_folder)
end adding folder items to
on removing folder items from this_folder
my update_name(this_folder)
end removing folder items from
on update_name(this_folder)
set this_name to POSIX path of this_folder
set sh_script to do shell script "P=\"" & (POSIX path of (path to me) as string) & "\";echo ${P/%.scpt/.sh}"
set new_name to do shell script "\"" & sh_script & "\" \"" & this_name & "\""
tell application "Finder" to set name of this_folder to new_name
end update_name
The script needs a shell script to work (since I don’t like working with AppleScript that much). It should be named exacly as the AppleScript but with an .sh extension instead of .scpt and put in the same directory. Remember to make it executable (chmod +x "Set item count as folder name.sh").
#!/usr/bin/env bash
# Set item count as folder name.sh
# Since the folder has a custom icon and therefore a `Icon?` file I
# decrease the item count by 1. Bad solution but works for now.
NUM_ITEMS=`bc <<< "$(ls "$1" | wc -l) - 1"`
if [[ $NUM_ITEMS == 0 ]]; then
ITEMS="empty"
elif [[ $NUM_ITEMS == 1 ]]; then
ITEMS="$NUM_ITEMS item"
else
ITEMS="$NUM_ITEMS items"
fi
BASE=`ruby -e "puts %x(basename \"$1\").match(/(.+) \(/)"[1]`
echo "$BASE ($ITEMS)"
I first renamed the folder from the shell script but then Finder would visually move the folder one step down or left on the desktop for every update. Instead I just let the shell script generatr the new name and pass it back to the AppleScript that will rename the file as I want.
This is a trick I’m using at this site that I picked up somewhere on the FeedBurner Forums. I wanted to have my RSS-feed from this site to go via FeedBurner to get stats etc, but I don’t want to communicate the http://feeds.feedburner.com/xxxx URL public since it might change in the future. So instead, in my .htaccess, I have these lines that will redirect all visitors except FeedBurner itself (otherwise it wouldn’t have any chance to read and parse my feed) to my FeedBurner URL.
The other day, Oskar Karlin asked me how and when I use the OS X Terminal app instead of e.g. the Finder. I’m not by any means a hard core command line guy but ther are often and often situations where the Terminal is faster or/and easier to use for the specific thing.
To resize all PNG-images in the current folder to 600px width
find . -name "*.png" -type f -exec sips --resampleWidth 600 {} \;
To put in a “.thumbnail” in the file name
for file in *.png; do mv $file ${file/.png/.thumbnail.png}; done
When I needed to know how many tracks we (Pluxemburg) sent to ITMSfind Music/iTunes\ Producer/Playlists -name metadata.xml -exec grep "<track>" {} \; | wc -l
Copy a file to our Burnfield server (instead of launching a FTP-client)
scp myfile burnfield@bidwell.textdrive.com:
Basic, but to view the apache error log
tail /var/log/httpd/error_log
To view the source of this site’s feed
curl "http://burnfield.com/martin/feed" | head
And how FeedBurner gets it
curl --user-agent FeedBurner "http://burnfield.com/martin/feed" | head
Today when working with the pluxemburg.com-site I got really tired of uploading everything with Transmit. Since our host doesn’t have support for rsync or something like that, I made this really easy bash-script that will upload everything that have been changed since last time the script was runned.
cd ~/Projects/Pluxemburg/pluxemburg.com #local path to site root
find . -newer ./lastupload -exec open -a Transmit "{}" \;
touch ./lastupload
In Transmit, remember that both local and remote paths have been set, and “Use DockSend” enabled. I saved the script as an application using Automator (Automator –> Run Shell Script), and made an icon in 20 seconds.
Now I just run the app from QuickSilver or Finder and it uploads everything really fast and easy.
Update: This is for OS X and only tested in 10.4 Tiger