Skip to content

Instantly share code, notes, and snippets.

View colinyoung's full-sized avatar
🚲

Colin Young colinyoung

🚲
View GitHub Profile
@colinyoung
colinyoung / PostalAddress.rb
Created June 22, 2011 06:29
Parses a postal address into its components. (limited) i18n support and other features. inspired by this forrst post: http://forr.st/~zDa
#
# Most of the regexes here are from http://twitter.com/schuyler.
# They were posted on Forrst (http://forr.st/~zDa) as a public post,
# so I reworked them into a full class.
#
# Added:
# => (limited) international support -- should handle US/Canada and most of western europe
# => added :receipient, :postcode, and :country fields
# => state/province detection built-in
@pheuter
pheuter / sc-dl.js
Created March 5, 2012 20:44
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);