Home Link

Hello, my name is Brett Terpstra, and it’s nice to meet you. Elegant solutions to complex problems. Curious?

Posts Tagged ‘ruby’

  • Jan
  • Feb
  • Mar
  • Apr
  • May
  • Jun
  • Jul
  • Aug
  • Sep
  • Oct
  • Nov
  • Dec

Mar 06
2010

Another post, quickly and with less explanation…

The fact that Ever­note processes HTML so much bet­ter than it does plain or rich text got me think­ing and tin­ker­ing. I use Mark­down (actu­ally, Mul­ti­Mark­down) con­stantly, and it does a great job of turn­ing plain text into valid markup. With (Multi)Markdown, even plain text becomes HTML that–when imported into Evernote–retains most of its for­mat­ting. To answer your ques­tion, no, I’m not obsessed with Ever­note, I’m obsessed with prob­lems I think I could solve. It’s unhealthy.

Please note, this requires that you have Fletcher Penney’s Mul­ti­Mark­down installed in ~/Library/Application Support/MultiMarkdown, and that the Perl files (MultiMarkdown.pl and SmartyPants.pl) are located in a ‘bin’ sub­di­rec­tory (which is the default install). If you don’t have Mul­ti­Mark­down, you should get it any­way (all the cool kids have it), so head over to the down­load page and grab a copy. Now, on with the show.

I set this up orig­i­nally as a Text­Mate com­mand, intend­ing just to be able to clip code snip­pets and free-form text to Ever­note with­out think­ing too much about it. That worked well, so I mod­i­fied it to work as a Sys­tem Ser­vice. Specif­i­cally, a Snow Leop­ard ser­vice, but I’m pro­vid­ing the Ruby script here and it can be mod­i­fied for any Mac setup you want.

While it will work just fine on plain text with no markup, it does have a cou­ple of “spe­cial” fea­tures. If you start a line with a # and a space (e.g.: # This is my header), which is a Mark­down con­ven­tion for a first-level head­ing, it will use that as the title for the note and strip it out of the text in pro­cess­ing. It only uses the first one it finds, but it will strip out any first-level head­ers in the selec­tion. I’ll prob­a­bly mod­ify that later, or just have it leave them in. Also, a line that begins with “tags:” fol­lowed by a space and a comma-separated list of words will be split up and used to tag the new note. This is also stripped before pro­cess­ing. It han­dles spaces in multi-word tags, and odd marks at the begin­ning or end of a tag, but only one punc­tu­a­tion char­ac­ter, and only at the begin­ning or end of a tag. The code follows…

Con­tinue read­ing “A bet­ter Sys­tem Ser­vice for Ever­note clip­ping — with MultiMarkdown…”

Dec 31
2009

Down­load the Eval­u­ate Expres­sion Snow Leop­ard ser­vice: EvaluateExpressionService.zip

This is a stripped down ver­sion of a com­mand I have in the Text­Mate bun­dle we use at TUAW. It allows you to select any basic numeric equa­tion and eval­u­ate it, replac­ing the selected text with the results. It will ignore your text if it con­tains any­thing but num­bers and basic math­e­mat­i­cal sym­bols. Sure, there are plenty of ways to do cal­cu­la­tions in OS X (Spot­light, Launch­bar, Quick­sil­ver), but I’ve had more and more inci­dents lately where I just wanted to do quick cal­cu­la­tions inline, so I whipped this up. A lit­tle explanation…

Con­tinue read­ing “A (fairly) sim­ple equa­tion eval­u­a­tion ser­vice for Snow Leopard…”

Entries (RSS) and Comments (RSS).

Switch to Mobile version