Skip to content

Instantly share code, notes, and snippets.

View mataspetrikas's full-sized avatar
🤔
busy busy

Matas Petrikas mataspetrikas

🤔
busy busy
View GitHub Profile
// adding a remote validation customization, that allows us to submit the form even if the backend validation failed
var remoteFailsafe = function(url) {
return function(input) {
return {
url: url,
timeout: 10000,
error: function(request, status) {
// get the validator object
var validator = $(input).parents('form').data('validator');
request.abort();
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
/**
Lazy-load Google gdata libraries and check for the user authorization
@gscope - the google service scope you want to be authorized to, e.g. "http://www.blogger.com/feeds"
@callback - a function to be called after succesfull authorization
*/
getGdataAndAuthorize = function(gscope, callback) {
var checkInterval,
time = 100,
var shortenUrl = function(longUrl) {
var apiLogin = 'yourapilogin',
apiKey = 'yourApiKey';
// call the bit.ly service
$.getJSON('http://api.bit.ly/shorten?callback=?', {
long_url: mediaUrl,
version: '2.0.1',
login: apiLogin,
api_key: apiKey,
format: 'json',
original code:
<object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fmatas%2Fargo-discophonia-a1-matas-edit&"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fmatas%2Fargo-discophonia-a1-matas-edit&" type="application/x-shockwave-flash" width="100%"></embed> </object> <span><a href="http://soundcloud.com/matas/argo-discophonia-a1-matas-edit">Argo - Discophonia A1 (Matas Edit)</a> by <a href="http://soundcloud.com/matas">matas</a></span>
custom font code:
<object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fmatas%2Fargo-discophonia-a1-matas-edit&font=Georgia"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/playe
<object height="345" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http://soundcloud.com/Fmatas/sets/remixes-128&start_track=2"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="345" src="http://player.soundcloud.com/player.swf?url=http://soundcloud.com/Fmatas/sets/remixes-128&start_track=2" type="application/x-shockwave-flash" width="100%"></embed> </object> <span><a href="http://soundcloud.com/matas/sets/remixes-128">Remixes</a> by <a href="http://soundcloud.com/matas">matas</a></span>
this would load the 3rd track (first is 0)
2. code:
[soundcloud]{url}[/soundcloud]
3.replacement:
<object height="81" width="100%"><param name="movie" value="http://player.soundcloud.com/player.swf?url={url}&amp;g=bb"></param><param name="allowscriptaccess" value="always"></param><embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url={url}&amp;g=bb" type="application/x-shockwave-flash" width="100%"></embed></object> <a href="{url}">{url}</a>
@mataspetrikas
mataspetrikas / GitUtils.as
Created March 10, 2010 18:21
Extracting git information in ActionScript
package com.soundcloud.utils {
import flash.utils.ByteArray;
/**
* @author Matas Petrikas (SoundCloud) matas@soundcloud.com
*
* extract latest Git revision number for later use in AS3
* based on SVNUtil class by Apt labs:
* http://labs.apt.no/2009/11/20/automatically-embedding-a-subversion-revision-number/
*
<meta content="Goal! England by We Are Scientists" name="title" />
<meta content="video" name="medium" />
<link href="http://player.soundcloud.com/player.swf?url=http://soundcloud.com/we-are-scientists/goal-england-1&player_type=artwork" rel="video_src" />
<meta content="300" name="video_height" />
<meta content="300" name="video_width" />
<meta content="application/x-shockwave-flash" name="video_type" />
@mataspetrikas
mataspetrikas / SoundCloud custom player remote control
Created June 7, 2010 16:21
Control SoundCloud custom player remotely in the DOM
<a href="#" class="sc-remote-link">Toggle player</a>
<!-- add a customizable remote control button -->
<script type="text/javascript">
$(function() {
// sc-player remote control simulates the click on the play/pause button
$('a.sc-remote-link').live('click', function(event) {
@mataspetrikas
mataspetrikas / jump to a certain track in the custom player
Created June 8, 2010 09:17
jump to a certain track in the SoundCloud custom player
<script type="text/javascript">
$('a.sc-external-link').live('click', function(event) {
// simulate the click on the tracklist item
$('ol.sc-trackslist a[href=' + this.href +']').click();
});
</script>
<!-- HTML -->
<div class="sc-player">