Skip to content

Instantly share code, notes, and snippets.

View rocktronica's full-sized avatar
😎
sup

Tommy rocktronica

😎
sup
View GitHub Profile
@lavelle
lavelle / convert-date-components.js
Last active February 15, 2018 22:13
Lodash Art Gallery
// Author: Giles
const datetimeComponents = _(matchResults).tail().map(_.toNumber).value();
// Better than
var datetimeComponents = _.map(
matchResults.slice(1, 6), // skip the matched result
function(component) {
return parseInt(component, 10);
}
);
@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);