Skip to content

Instantly share code, notes, and snippets.

busy busy

Matas Petrikas mataspetrikas

busy busy
View GitHub Profile
mataspetrikas / importzendesk.js
Created Aug 28, 2018
A Node.js script for importing existing email tickets to Zendesk
View importzendesk.js
// npm install request --save
var request = require('request');
var fs = require('fs');
// update these with your auth values
var username = '';
var userpassword = 'xxxx';
var workspace = 'oursupport';
var importtags = [ "importedticket", "inbox-info"];
View .swift
enum BooType {
case play
protocol FooDelegate {
func onBoo(boo: BooType)
class Foo {
var delegate: FooDelegate?
mataspetrikas / gist:2301090
Created Apr 4, 2012
WordPress code: HTML5 widget with sharing disabled
View gist:2301090
[soundcloud url="" iframe="true" /]
mataspetrikas / gist:2300296
Created Apr 4, 2012
Check if the DOM node is visible in the viewport
View gist:2300296
function elementInViewport(el) {
var rect = el.getBoundingClientRect()
return < (window.innerHeight || document.body.clientHeight) && rect.left < (window.innerWidth || document.body.clientWidth);
// and then you can use it:
// or
mataspetrikas / gist:1779157
Created Feb 9, 2012
Create a SoundCloud widget from the id passed in the url
View gist:1779157
// 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 or
var params =,
trackId = (params.match(/track_id=(\d+)/)||[])[1],
trackUrl = (params.match(/track_url=(.+?)(&|$)/)||[])[1],
$playerContainer = $('#player');
if (trackId) {
trackUrl = '' + trackId;
mataspetrikas / gist:1723694
Created Feb 2, 2012
Converting HTML links to SoundCloud widgets using JQuery
View gist:1723694
// if you have a link in your HTML that points to a sound: <a href="">My Track</a>
// it will convert them to our new HTML5 widgets
var $link = $(this);
$.getJSON('' + $link.attr('href') + '&iframe=true&callback=?', function(response){
mataspetrikas / gist:1509934
Created Dec 22, 2011
control next and previous tracks in the soundcloud custom player
View gist:1509934
function getNextTrack(node) {
var $player = $(node).closest('.sc-player'),
$nextItem = $('.sc-trackslist', $player).next('li');
// try to find the next track in other player
$nextItem = $player.nextAll('').find('.sc-trackslist li:first');
return $nextItem;
View gist:1027211
$('<a href="">My Favorites</a>').scPlayer({
randomize: true,
autoPlay: true
mataspetrikas / gist:1024911
Created Jun 14, 2011
Mockjax remote jsonp failure
View gist:1024911
asyncTest('Response returns jsonp', function() {
url: '*',
contentType: 'text/json',
proxy: 'test_jsonp.js'
window.abcdef123456 = function(json) {
ok( true, 'JSONP Callback executed');
deepEqual(json, { "data" : "JSONP is cool" });
mataspetrikas / gist:986383
Created May 23, 2011
show additional titile in the custom player
View gist:986383
append this to your script:
// update additional title
$(document).bind('onPlayerTrackSwitch.scPlayer', function(event, track) {
var $player = $(;
$('.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)