extensions

Using bit.ly and Quicksilver to Shorten URLs

November 20, 2009 · Leave a Comment

If you have a mac, and don’t use Quicksilver, well, you should!

Here’s how to use Quicksilver to shorten URLs using bit.ly. This is useful for many things, but especially for posting links to twitter.

Obviously you need Quicksilver installed, and you also need to create an account with bit.ly, and get an API key. (API stands for application programming interface, which is basically a set of standard ways to interact with bit.ly using computer code.) You find the key listed under your account once you register. You’ll also need Growl, which is a program that delivers alerts from different apps to your mac.

So, to start, you open Applescript, and paste the following into a new script:

using terms from application "Quicksilver"
	on process text longURL
		-- Init
		my growlRegister()

		-- If we didn't get a text string then grab the URL from Safari
		if longURL is "" then
			tell application "Safari"
				if document 1 exists then
					copy the URL of the front document to longURL
				end if
			end tell
		end if

		-- Format the URL accordingly in case it was types sans http://
		if (longURL does not start with "http://") then
			set longURL to "http://" & longURL
		end if

		-- Convert the longURL
		set shellScript to ("curl --url \"http://api.bit.ly/shorten?version=2.0.1&longUrl=" & longURL & "&login=YOUR_BITLY_ID" & "&apiKey=YOUR_BITLY_API_KEY " & "\" | grep shortUrl | grep -o http.*[/a-zA-Z0-9] ")

		set shortURL to (do shell script shellScript)

		-- Display success message
		growlNotify("Short URL now in clipboard:", shortURL)

		-- Open the shortURL in Safari to test it
		--tell application "Safari"
		--set URL of front document to shortURL
		--end tell

		set the clipboard to shortURL

	end process text
end using terms from

using terms from application "GrowlHelperApp"
	-- Register Growl
	on growlRegister()
		tell application "GrowlHelperApp"
			register as application "Shorten URL" all notifications {"Alert"} default notifications {"Alert"} icon of application "Script Editor.app"
		end tell
	end growlRegister

	-- Notify using Growl
	on growlNotify(grrTitle, grrDescription)
		tell application "GrowlHelperApp"
			notify with name "Alert" title grrTitle description grrDescription application name "Shorten URL"
		end tell
	end growlNotify
end using terms from

Now, find in the script where I wrote in all caps YOUR_BITLY_ID and YOUR_BITLY_API_KEY — that’s where you plug in your info from bit.ly.

Next, save this file (I use the file name “Shorten URL”) in your Actions folder, which is located on your mac in:

Home -> Library -> Application Support -> Quicksilver -> Actions

One note — make sure your Actions folder appears in the Catalog in quicksilver. If it does not, open the catalog (apple-comma), go to Custom, and use the + sign on the bottom to find your Actions folder and add it in.

Rescan the catalog, and you’re done.

To use it, first copy a long URL to the clipboard. Then, invoke Quicksilver, paste the URL in, and tab to the second box. Type “Shorten URL” (or whatever you named the script), and hit enter.

You should see a growl alert with the new URL, and it will be in your clipboard. Paste away!

Credit where credit is due:

I didn’t write this script on my own, but found these two posts, which I used to create the script:

http://tanniespace.com/bitly-textexpander-applescript-win/

http://trumcgowan.tumblr.com/post/84901795/shorten-urls-using-quicksilver

Programming is all about remix, really… :-)

→ Leave a CommentCategories: technology
Tagged: , ,

The Inevitable I Need To Start Blogging Again Post

November 16, 2009 · Leave a Comment

Really, I do.

→ Leave a CommentCategories: 1

How To (Mostly) Block Ads in Fluid Apps

October 23, 2009 · 5 Comments

Fluid for the mac is a terrific piece of software. It allows you to create a separate “app” for specific web sites, and works especially well for websites that you frequently visit. For me, my RSS reader (which is google) is a constant go-to; it’s how I keep up with tons of blogs, etc. Other fluid apps I have setup are Brizzly, The New York Times web site, and Pandora. All good stuff.

One of my big frustrations, though, is that there is no ad blocking capability built-in to Fluid. (And there never will be.) Even if you add in an adblocker for Safari (Fluid basically runs a Safari browser), it will not carry through on Fluid apps.

I’ve searched several times for a solution, but have not found anything…until today. It’s not perfect, but works well enough.

Here’s how to do it.

I’m assuming here you have some experience with setting up Fluid, setting the allowed URLs, and all that. If not, please leave a comment, and I’m happy to provide more of a step-by-step.

First, download the CSS file found here at this site (the file is called userContent.css). This is built specifically built to block the images from well-known ad services.

Next, following the instructions here on a site for an unrelated application for Fluid, goto the Preferences inside your Fluid app, and select the “Userstyles” option. Once there, you’ll hit the plus sign, and check the box next to “URL Pattern.” in the right column box, type in an expression to allow the URL of your app. (This is the same thing you do under “Advanced,” where you allow the site’s URL.) For example, in my google reader fluid app, I simply put “*google.com*” (without the quotes…).

Below that, you’ll want to paste in the contents of the CSS file you downloaded in the first step. It’s easy to do — open the CSS file on your mac (using TextEdit, or, as on my mac, DashCode), select it all, and paste it into the field in the Fluid preferences.

Close the preferences window, reload your app, and the ads should (mostly) be gone. No more eye-burning ads on your screen!!!

Well, again, it’s mostly. It doesn’t work perfectly, as some get through. And I’ve only done limited testing, in just a couple apps.

But, so far, it’s the simplest way I’ve found to do this.

→ 5 CommentsCategories: technology
Tagged: , ,

Punked

October 16, 2009 · Leave a Comment

Balloon boy, all a big hoax, it seems

→ Leave a CommentCategories: Media Studies · journalism · media · television
Tagged: , , ,

Old Versus New Media: Food Writer Edition

October 15, 2009 · Leave a Comment

Cook’s Illustrated editor Chris Kimball has thrown down the gauntlet!

If you haven’t been following this food blogger versus professional writer battle that’s been simmering, it started when Kimball wrote a fairly silly op/ed in the Times, bashing both the so-called amateurish writing of bloggers, as well as the larger movement of participatory culture that is happening in all areas of media, where “regular people” have been given a voice through social media. When it comes to food writing, Kimball doesn’t seem too keen on this at all:

…in a click-or-die advertising marketplace, one ruled by a million instant pundits, where an anonymous Twitter comment might be seen to pack more resonance and useful content than an article that reflects a lifetime of experience, experts are not created from the top down but from the bottom up.They can no longer be coronated; their voices have to be deemed essential to the lives of their customers.

Bloggers have hit back; in particular, Adam Roberts, over at the Amateur Gourmet, has a great response:

The derision and condescension in this statement is baffling. Every food writer—from MFK Fisher to Ruth Reichl herself—started at the bottom and worked their way up. Kimball, at the end of his column, invokes Julia Child, a cook who didn’t start her food career until much later in life. If she’d had a blog documenting her time at Le Cordon Bleu (and maybe she would have, if she’d been born a few decades later), would Kimball complain that she hadn’t spilled enough blood in the kitchen yet? That “inexperience rarely leads to wisdom?”

It’s naïve to think that all food writing on the web is created equal, that the “million instant pundits” are all valued the same. The truth is that there are, indeed, an enormous number of food blogs out there, but it’s still a meritocracy: only the good ones gain traction. The most popular food blogs are popular because of their quality; in many ways, their content is better than much of what you’ll find in actual food magazines, including Kimball’s.

Kimball comes across here as elitist, an old guard fighting off the new. If he doesn’t read food blogs, he’s missing out on a diverse world of recipes and ideas and perspective on food. His notion of an “anonymous Twitter comment” is also strange — while we may not see each other on Twitter, the people I talk to there are hardly strangers. And yes, if someone I follow (and trust) on Twitter makes a recipe or restaurant recommendation, I’ll surely be paying attention.

In any case, perhaps looking to settle this (or cash in on the controversy, more likely!), Kimball has upped the ante, challenging any recipe found on a wiki to one of his from the Test Kitchen:

So, I am willing to put my money, and my reputation, where my big mouth is. I offer a challenge to any supporter of the WIKI or similar concept to jump in and go head to head with our test kitchen. We will jointly agree on a recipe, on the rules, on a time frame, etc. At the end, we will ask a panel of impartial judges to make and test the recipes and declare a winner.

It’s a fantastic idea, and should be lots of fun.

Let the games begin!!!

→ Leave a CommentCategories: Media Studies · food · journalism · media
Tagged: , , ,

A Keyboard for your iPhone?

September 18, 2009 · 2 Comments

→ 2 CommentsCategories: technology
Tagged:

If You Printed The Internet

September 14, 2009 · 3 Comments

More here.

→ 3 CommentsCategories: Media Studies · media · technology
Tagged: , ,

Remembrance

September 11, 2009 · Leave a Comment

Amazing photos.

→ Leave a CommentCategories: media · photography
Tagged: ,

Lindsay Graham’s Handrubsave

September 11, 2009 · Leave a Comment

Via TPM:

→ Leave a CommentCategories: Media Studies · media · politics
Tagged: , ,

I Love You Man

August 28, 2009 · Leave a Comment

Wow was that an awful movie.

→ Leave a CommentCategories: Media Studies · media
Tagged: ,