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
// 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
// as of 1.4.2 the mobile safari reports wrong values on offset() | |
// http://dev.jquery.com/ticket/6446 | |
// remove once it's fixed | |
if ( /webkit.*mobile/i.test(navigator.userAgent)) { | |
(function($) { | |
$.fn.offsetOld = $.fn.offset; | |
$.fn.offset = function() { | |
var result = this.offsetOld(); | |
result.top -= window.scrollY; | |
result.left -= window.scrollX; |
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
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
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
[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
// 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
$('<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" }); | |
}; |
NewerOlder