Most of my writing is now on labs.kortina.net

kortina's tumblog

Workout of the Day Fitness iPhone App

more: kortina.net

Playing with the bit.ly Plaintext API

The bit.ly plaintext API is just this url:

http://api.bit.ly/shorten?format=text&history=1&version=2.0.1&longUrl=http://cnn.com&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07

“format=text” will make the API return just a string instead of the full JSON response. The above call returns:

http://bit.ly/15DlK

JSON api is handier in most places, but I have a few quick hits where the plaintext version is gonna work just fine. Full docs are at http://bit.ly/apidocs and more tips on http://blog.bit.ly/

Add the Tumblr MP3 Player Asyncronously

dankantor:

Anyone that knows me knows that the first thing I do with new technology is figure out how to make it play music. So it makes sense that a week-or-so in to my Tumblr blog, I would create an mp3 player for it. So here is my first stab at it. You can see it in action at the bottom of this blog.

Love this mp3 player widget but I do not love javascripts that slow down page load. I hacked this script (by modifying the bookmarklet version that dankantor also posted) and inserting it with a body onload javascript event. The result, your tumblog loads fast and the streampad player loads afterwards. Here’s what you need in your template to make this work:

<script type="text/javascript" charset="utf-8">
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() { oldonload(); func(); }
}
}
addLoadEvent(function(){
/* streampad */
var s=document.createElement("script");
s.src="http://static.streampad.com/streampad-tumblr.js?ref=kortina";
s.onload=function(){ streampadPlayer.init() };
document.body.appendChild(s);
});
</script>

Enjoy!

How to Download Any Youtube Video for Free

I just read an email with the subject “oh shit this is awesome hack” and was not disappointed. You can download a copy of any YouTube video as flv or mp4 simply by prepending youtube.com with “pwn.”

For example, to download
http://www.youtube.com/watch?v=rek3g8znpOg&eurl=http://blog.kortina.net/&feature=player_embedded
go to
http://www.pwnyoutube.com/watch?v=rek3g8znpOg&eurl=http://blog.kortina.net/&feature=player_embedded

The mp4 version should work on your iPhone or iPod touch. Dope!

via hacker news http://bit.ly/I2tp

The Fastest Way to Compose Gmail Messages - gCompose Bookmarklet

I send lots of emails via Gmail, and I hate waiting for the full Gmail UI (chat list, inbox, etc) to load every time I want to send a quick note. Jenny and I riffed on this topic awhile back on Hackaddict, where we talked about a nice little bookmarklet for composing messages ( http://bit.ly/11Xgv ). This works pretty well, but still takes quite awhile to load.

This morning, I suddenly had the insight to hack around with any iGoogle Gadgets for composing Gmail gadgets to see if I could find anything faster. After a few minutes I struck gold and found this link loading in an iframe: http://bit.ly/gCompose

NOTE: if this link doesn’t work, see the UPDATE at the bottom of this post!

This loads in about 1s, doesn’t show chat or inbox, and still performs autocomplete on the recipient address fields. I am going to use this exclusively for authoring new emails now.

I’ve made the link available in a number of ways:

As a simple bookmark:
http://bit.ly/gCompose

As a bookmarklet that pops a nice little window:
gCompose

As a Mozilla Ubiquity Plugin:
http://labs.kortina.net/ubiquity-kortina.html

Here’s a quick screencasat demoing all 3 ways to use the gCompose Bookmarklet:
Watch the demo on YouTube: http://www.youtube.com/watch?v=1woYdrO-J5k

One of the the ways I know this is going to save tons of time is by not loading inbox or chat. When I just want to fire off a quick email, inbox and chat always end up diverting me into 5 minutes of distraction from whatever I was doing. GTD! This bookmarklet is the perfect workflow for getting things done and keeping focus.

*** UPDATE: *** if the above doesn’t work, you probably have a different link for your Google Account to this compose page that depends on a special “mid” flag in the URL.

To make this work, first install the Gmail gadget for iGoogle: http://bit.ly/qWO3

Open the Compose window from the gadget on iGoogle:


Right click on this window, and choose to open the frame in a new window so you can get the location:


The important part here is to get the correct “mid”:


Now, either bookmark this page, or, substitute your “mid” for “141” in this bookmarklet and add it to your bookmarks bar:

javascript:var%20w=window,u='http://www.google.com/ig/gmailmax?hl=en&mid=141&view=comp',l=document.location;try{%20throw(0);%20}%20catch(z)%20{a%20=function(){if(!w.open(u,'gmail.kortina.bookmarklet','toolbar=0,resizable=0,status=1,width=600,height=480'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();}void(0)

Or, you can do the same substitution in this ubiquity command:

CmdUtils.CreateCommand({

name: "gmail",

preview: "Opening gmail compose window window",

description: "opens a laser fast gmail compose window",

author: {name: "kortina"},

execute: function() {

var document = Application.activeWindow.activeTab.document;



var f='http://www.google.com/ig/gmailmax?hl=en&mid=141&view=comp';

a = function() {

if (!window.open(f, "gmail.bookmark.by.kortina", 'location=yes,links=no,scrollbars=no,toolbar=no,width=600,height=480'))

location.href=f;

};

a();

}

});

If anyone knows a way around this “mid” business, please post in the comments, but unfortunately this seems to be the only way to make the compose window load on different Gmail accounts. Sorry for the confustion, folks!