OS X Service for memorizing verbatim text

First_Letters.workflow.zip
Download this file

Lately I’ve been somewhat into memorizing some of my favorite quotations from books. The most effective method I’ve found for doing so has been converting each word of whatever text I’m trying to memorize to just the first letter, and trying to reconstruct the passage from that. Here’s the theory behind why this is helpful:

This is the crucial concept of any type of memorization. The act of reading something you want to memorize fires different connections than the act of recalling. This means that simply reading a particular piece of text over and over again is going to be the long road to memorization. You need to let your brain practice recalling the data so it can strengthen the same pathways that will fire when you need to remember the information later on. You can’t practice recalling until the information is at least partially contained in your short term memory.
How to Memorize Verbatim Text

So, say I want to memorize this passage from Pawn in Frankincense by Dorothy Dunnett:

The woman sitting there, straight and still on the bright velvet cushions, was not young; nor was she less than beautiful. The black hair, loose and shining, and deep, fell back over her shoulder and forward down to her waist; her chin was high above the pure line of her neck, which you could have held in one hand. Her eyebrows were black, and arched in pride, or surprise, or over some deep, long-held thought; and below the black, silky lashes, the wide eyes were packed full of straw.

Here’s what it gets converted to:

T w s t, s a s o t b v c, w n y; n w s l t b. T b h, l a s, a d, f b o h s a f d t h w; h c w h a t p l o h n, w y c h h i o h. H e w b, a a i p, o s, o o s d, l-h t; a b t b, s l, t w e w p f o s.

The website that describes this method provides a helpful JavaScript tool for performing this conversion, but before too long I was finding copying text into the box on the website a little unwieldy. So, I grabbed the relevant regular expression from the JavaScript code (str.replace(/(w)w*/g,”$1″)) and turned it into an OS X Service, a transformation that, luckily for me, Snow Leopard has made very easy. All the service does is grab some text, run a simple sed replace command (sed ‘s/([a-zA-Z0-9])[a-zA-Z0-9]*/1/g’), and output it.

In case this tool I’ve created could be at all useful to anyone else, I figured I might as well upload it.  To install it, just put it in either /Library/Services or ~/Library/Services.

Using Quicksilver and Applescript to Keep a Stack of Safari URLs

My friend posted this question on Hacker News. I answered:

If you’re on a Mac and you’re using Safari you might like Urly (http://www.zenonez.com/urly/news.html). It lets you make a pretty basic stack of browser links. If you don’t like that (and you’re a Quicksilver user), it might be worth writing some Quicksilver triggers to push and pop urls using a text file as a stack.

I decided I might as well code my solution. I’d never written any Applescript before, so what have is cobbled together from various examples I found online and very likely not the best way to do it.  I made two scripts.
 
bpush.scpt:
tell application "Safari"
 
set theurl to URL of front document
end tell
 
set clipFil to (path to documents folder as text) & "tobrowse.txt"
try
close access file clipFil
end try
set filRef to open for access file clipFil with write permission
write (return & (theurl)) to filRef starting at eof
close access filRef
tell application "Safari" to activate

bpop:scpt:
set clipFil to (path to documents folder as text) & "tobrowse.txt"
 
try
close access file clipFil
end try
 
set filRef to open for access file clipFil with write permission
set filetext to (read filRef)
set thelist to every paragraph of filetext
set theurl to item (length of thelist) of thelist
set item (length of thelist) of thelist to ""
set newtext to (thelist) as text
set eof of filRef to 0
write newtext to filRef
close access filRef
 
tell application "Safari"
activate
set URL of document 1 to theurl
end tell

I can activate these by just typing bpush and bpop into Quicksilver. I’ve tried using this while browsing for the past hour or so and it’s definitely too soon to say for sure, but I think I might actually use these.