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
import sublime, sublime_plugin | |
class AutoBuild(sublime_plugin.EventListener): | |
def on_post_save(self, view): | |
view.window().run_command("build") |
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
$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) { | |
$cont.css('overflow','hidden'); | |
var w = $cont.width(); | |
opts.cssBefore.left = w; | |
opts.cssBefore.top = 0; | |
opts.animIn.left = 0; | |
opts.animOut.left = 0-w; | |
}; |
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
$('form').submit(e) { | |
e.preventDefault(); | |
$(this).ajaxSubmit({ | |
beforeSubmit: function() { | |
// code to show spinner | |
}, | |
complete: function() { | |
// code to hide spinner | |
} | |
}); |
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
import sublime, sublime_plugin | |
# additional functionality for SortTabs plugin | |
# https://github.com/bizoo/SortTabs | |
# trigger SortTabs when a file is activated | |
class SortTabsListener(sublime_plugin.EventListener): | |
def on_activated(self, view): | |
w = view.window() | |
if w != None: |
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
// might as well make it a plugin | |
$.fn.fixChromeBg = function() { | |
if (! /chrome/i.test(navigator.userAgent) ) | |
return this; | |
return this.each(function() { | |
var el = $(this), bi = el.css( 'background-image' ); | |
if (bi) { | |
setTimeout(function() { |
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($) { | |
$.fn.cycle.transitions.turnHorz = function($cont, $slides, opts) { | |
opts.before.push(function(curr, next, opts, fwd) { | |
$.fn.cycle.commonReset(curr,next,opts,false,true); | |
if (fwd) { | |
opts.cssBefore.left = next.cycleW; | |
opts.animIn.width = next.cycleW; | |
} | |
else { |
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
jQuery.post = function( url, data, callback, type, onError ) { | |
// shift arguments if data argument was omited | |
if ( jQuery.isFunction( data ) ) { | |
onError = type; | |
type = callback; | |
callback = data; | |
data = {}; | |
} | |
return jQuery.ajax({ |
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
// don't declare anything out here in the global namespace | |
(function($) { // create private scope (inside you can use $ instead of jQuery) | |
// functions and vars declared here are effectively 'singletons'. there will be only a single | |
// instance of them and they are not publicly accessible. so this is a good place to declare | |
// any immutable items or stateless functions. for example: | |
function myPrivateHelper() { | |
// some helper fn |
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
// fn to handle jsonp with timeouts and errors | |
// hat tip to Ricardo Tomasi for the timeout logic | |
$.getJSONP = function(s) { | |
s.dataType = 'jsonp'; | |
$.ajax(s); | |
// figure out what the callback fn is | |
var $script = $(document.getElementsByTagName('head')[0].firstChild); | |
var url = $script.attr('src') || ''; | |
var cb = (url.match(/callback=(\w+)/)||[])[1]; |