SproutCore

SproutCore is an open-source framework for building blazingly fast, innovative user experiences on the web. SproutCore.

Advertisements

Alfred App Extension for shortening links with Google analytics campaign tracking and bit.ly pro

This is a simple script I use to consistently embed Google Analytics campaign tracking code within bit.ly short urls. The approach is similar to my Klout user score look-up: it uses Alfred App Powerpack extensions (and Growl)

The GA tracking code lets us know how our overall “direct social” efforts are performing and shows with sources (Twitter, Facebook, LinkedIn) are performing best.

(I’ve stored my bitly.API_KEY and bitty.API_LOGIN in the bitly library in my python path. Get a copy of the library here.)

#!/usr/bin/python

import sys
import bitly

if len(sys.argv) < 2:
	sys.exit(2)
if len(sys.argv) == 3:
	if sys.argv[2] == 'facebook':
		short_url = bitly.shorten(sys.argv[1]+"?utm_source=facebook&utm_medium=social&utm_campaign=sm-direct")
	elif sys.argv[2] == 'linkedin':
		short_url = bitly.shorten(sys.argv[1]+"?utm_source=linkedin&utm_medium=social&utm_campaign=sm-direct")
	elif sys.argv[2] == 'twitter':
		short_url = bitly.shorten(sys.argv[1]+"?utm_source=twitter&utm_medium=social&utm_campaign=sm-direct")
else:
	short_url = bitly.shorten(sys.argv[1]+"?utm_source=twitter&utm_medium=social&utm_campaign=sm-direct")

sys.stdout.write(short_url)

Display Klout score using Klout API, python, simplejson and Alfred.app

Here’s a little python script that displays a user’s Klout score. It can be run from the command line like this:

[smbrown@smbrown ~]$ klout-score.py smbrown

Or you can add it as an extension to Alfred App if you have the Powerpack.

Invoke Alfred App, type the extension shortcut, twitter username and see the user’s Klout score in less time then it takes to open and load http://klout.com/username.

Marcel Pinheiro Caraciolo has built a nice Python interface to the Klout API, definitely look into using that for anything more complicated then this simple use case.

If the script below is on your path and you can run it from the command like above, then this Alfred App Powerpack extension should do the trick

-- Alfred App Extension:
#Desc: 	Retrieve user's Klout score
#Use:	ks <query>
#Ex:	ks smbrown

URL=$(klout-score.py "{query}")
echo -n $URL

-- Python script follows:
#! /usr/bin/python

import httplib
import simplejson as json
import sys

if len(sys.argv) < 2:
	sys.exit(2)

user = sys.argv[1]

klout_key = "I-am-an-idiot-for-posting-the-version-of-this-snippet-with-my-real-key"
api_url = "/1/klout.json?users=%s&key=%s" % (user, klout_key)
api_domain = "api.klout.com"

conn = httplib.HTTPConnection(api_domain)
conn.request('GET', api_url)
resp = conn.getresponse()
data = resp.read()
data = json.loads(data)

print data['users'][0]['score']

Jawbone Up detailed: tracks activity, food intake and sleep cycles, available November 6 for $100 (video) — Engadget

Jawbone Up detailed: tracks activity, food intake and sleep cycles, available November 6 for $100 (video) — Engadget.

At last, the company’s ready to talk specifics. We just got word the Up will be available in the US November 6th for $100, and will continue its world tour on the 17th. With that price, it’s well-matched against the clip-on Fitbit Ultra tracker, and indeed, they have some key features in common — namely, a step counter and a few requisite social networking features. But with a sensor that knows when you’re in deep sleep and a mobile app that can identify photos of food, it has a few unexpected tricks that could give devices like Fitbit a run for their money. We’ll be getting one to test very soon, but in the meantime, join us past the break to learn more.”