This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install request --save | |
var request = require('request'); | |
var fs = require('fs'); | |
// update these with your auth values | |
var username = 'xxx@abc.io'; | |
var userpassword = 'xxxx'; | |
var workspace = 'oursupport'; | |
var importtags = [ "importedticket", "inbox-info"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum BooType { | |
case play | |
} | |
protocol FooDelegate { | |
func onBoo(boo: BooType) | |
} | |
class Foo { | |
var delegate: FooDelegate? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[soundcloud url="http://api.soundcloud.com/tracks/1460857?sharing=false" iframe="true" /] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function elementInViewport(el) { | |
var rect = el.getBoundingClientRect() | |
return rect.top < (window.innerHeight || document.body.clientHeight) && rect.left < (window.innerWidth || document.body.clientWidth); | |
} | |
// and then you can use it: | |
alert(elementInViewport(document.getElementById('inner'))); | |
// or | |
alert(elementInViewport($('#inner')[0])); | |
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You will need jQuery to be available on your page | |
// the widget will be written into HTML element with id="player" or some other DOM element that $playerContainer will point to | |
// the url format should be http://example.com/mytracks?track_id=3223234 or http://example.com/mytracks?track_url=http://soundcloud.com/matas/hobnotropic | |
$(function(){ | |
var params = location.search, | |
trackId = (params.match(/track_id=(\d+)/)||[])[1], | |
trackUrl = (params.match(/track_url=(.+?)(&|$)/)||[])[1], | |
$playerContainer = $('#player'); | |
if (trackId) { | |
trackUrl = 'http://api.soundcloud.com/tracks/' + trackId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if you have a link in your HTML that points to a sound: <a href="http://soundcloud.com/matas/hobnotropic">My Track</a> | |
// it will convert them to our new HTML5 widgets | |
$('a[href*="soundcloud.com"]').each(function(){ | |
var $link = $(this); | |
$.getJSON('http://soundcloud.com/oembed?format=js&url=' + $link.attr('href') + '&iframe=true&callback=?', function(response){ | |
$link.replaceWith(response.html); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNextTrack(node) { | |
var $player = $(node).closest('.sc-player'), | |
$nextItem = $('.sc-trackslist li.active', $player).next('li'); | |
// try to find the next track in other player | |
if(!$nextItem.length){ | |
$nextItem = $player.nextAll('div.sc-player:first').find('.sc-trackslist li:first'); | |
} | |
return $nextItem; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('<a href="http://soundcloud.com/matas/favorites">My Favorites</a>').scPlayer({ | |
randomize: true, | |
autoPlay: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asyncTest('Response returns jsonp', function() { | |
$.mockjax({ | |
url: 'http://example.com/jsonp*', | |
contentType: 'text/json', | |
proxy: 'test_jsonp.js' | |
}); | |
window.abcdef123456 = function(json) { | |
ok( true, 'JSONP Callback executed'); | |
deepEqual(json, { "data" : "JSONP is cool" }); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
append this to your script: | |
// update additional title | |
$(document).bind('onPlayerTrackSwitch.scPlayer', function(event, track) { | |
var $player = $(event.target); | |
$('.sc-inline-title', $player).remove(); | |
$('<p class="sc-inline-title">' + track.title +'</p>').appendTo($('.sc-scrubber', $player)); | |
}); | |
or hack the sc-player directly (will be overwritten with the next update) |
NewerOlder