Skip to content

Instantly share code, notes, and snippets.

View imlucas's full-sized avatar
⚒️

Lucas Hrabovsky imlucas

⚒️
View GitHub Profile
/**
* Get a XSPF playlist as a JSON object
*/
var getUrl = 'http://hideout.com.br/shows/hideout-41.xspf';
$.getJSON('http://pipes.yahoo.com/pipes/pipe.run?_callback=?&_render=json&_id=095dfddb83b72f96b9271cbabf2808e0&playlist_url='+encodeURIComponent(getUrl), function(d){
var items = d.value.items;
var playlist = [];
$.each(items, function(){
var item = this;
item.id = this.location;
if($('link[href=http://gist.github.com/stylesheets/gist/embed.css]').length==0){
$('head').append('<link rel="stylesheet" type="text/css" media="screen" href="http://gist.github.com/stylesheets/gist/embed.css" />');
}
var g = 'http://gist.github.com/';
$('.content a[href^='+g+']').each(function(){
var el = $(this);
var gist_json_url = el.attr('href')+'.json';
$.getJSON('http://pipes.yahoo.com/pipes/pipe.run?_callback=?&_render=json&_id=f6840497e732806602852e40bc38cacc&gist_url='+encodeURIComponent(gist_json_url), function(d){
var gist = d.value.items[0].gist;
$(gist).insertAfter(el);
// SAT, DAY MONTH YEAR TIME OFF
// (\w{3}+)(\,+) (\d{2}+) (\w{3}+) (\d{2}+) (\d{2}:\d{2}:\d{2}+) (\+|\-+)(\d{4}+)
// Comes in like this
// Sat, 10 Oct 09 00:43:06 +0000
// Needs to be
// Sat Oct 10 00:43:06 GMT+0000 2009
var cleaned:String = String(created).replace(/(\w{3}+)(.{1}+) (\d{2}+) (\w{3}+) (\d{2}+) (\d{2}:\d{2}:\d{2}+) (\+|\-+)(\d{4}+)/g, "$1 $4 $3 $6 GMT$7$8 20$5");
var then:Date = new Date();
$.getScript('http://amiestreet.com/static/js/amie-api-client.js', function(){
amiestreet.__gateway = 'http://beta.amiestreet.com/api/v0.1/';
amiestreet.UserApi_playHistory = function(user, limit, offset, callback){this.__call('UserApi', 'playHistory', arguments);},
amiestreet.UserApi_playHistory('lucas', 25, 0, function(history){
var lastAlbumId= '';
var list = {};
// group by albums
$.each(history, function(){
if(this.song.album.id != lastAlbumId){
$.player.playSong = function(song){
$('#playerbox').addClass('loading');
try{
clearInterval($.player.__progressInterval);
if($.player.getElement()){
$.player.getElement().pause();
}
}catch(e){}
if(!$.player.isVisible()){
$.player.open();
/**
* Queries the FanFeedr Docs DOM at http://developer.fanfeedr.com/docs and builds a json hash
* that can be used for easily generating API clients in any language.
*/
jQuery.getScript('http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js', function(){
var response = {};
var out = [];
var $j = jQuery;
var methods = $j('div.method');
/**
*
* FANFEEDR THEME
*
* Check out http://solutions.mashery.com/public/Mashery/styles/masherycssfw.src.css to see the base structural defaults.
* You can find documentation on customizing your portal at http://solutions.mashery.com/docs/Customizing_Your_Portal
* We discourage making major changes to the layout since it has a standard structure to it which is easy for users
* to use.
*
*/
/**
* lucas' micro lazy loader.
*
* Super tiny lazy loader for external dependencies. Features callbacks when
* individual scripts are loaded and when all scripts have finished loading.
*
* @todo (lucas) Use interval to check for load errors
*
* $l(
* [
<script type="text/javascript">
/**
* This should be outside of the loop. Live will watch for new elements added to the dom.
* So you dont have to register new .click handlers every time a backtrack row is added.
*/
#('a.backtrack-more-info-show').live('click', function(){
$(this).parents('td.backtrack').find('song-more-info').show();
});
#('a.backtrack-more-info-close').live('click', function(){
$(this).parents('td.backtrack').find('song-more-info').hide();
/**
* You talk to sounds. sounds talk to sound players.
*/
var Sound = function(options){
this.id = options.id;
this.url = options.url;
this.__ready = options.on_ready || jQuery.noop();
this.__loading_progress = options.on_loading_progress || jQuery.noop();
this.__play_progress = options.on_play_progress || jQuery.noop();