Skip to content

Instantly share code, notes, and snippets.

@kswedberg
kswedberg / script.sublime-snippet
Created September 3, 2012 17:09
tab trigger for <script> without type="text/javascript"
<snippet>
<content><![CDATA[
<script>$0</script>
]]></content>
<tabTrigger>script</tabTrigger>
<scope>text.html</scope>
</snippet>
# modified from: https://gist.github.com/1443992
###### grb commands ######
# => create new branch `branch`
# $ grb new [branch] [--explain]
# => push branch `branch`, default current_branch
# $ grb push [branch] [--explain]
# => rename `branch1` to `branch2`
# $ grb mv [branch1] [branch2] [--explain]
# => rename current branch to `branch`
# General
output_style = :expanded
relative_assets = true
line_comments = false
project_path = File.dirname(__FILE__) + "/"
utils_dir = project_path + "utils/"
# Sass Paths
http_path = "/"
#!/bin/bash
echo
echo "## Files Modified in the last 24 hours. ###"
echo
find ./ -type f \! \( -path '*logs/*' -or -path '*Maildir/*' \) -mmin -1460 -exec ls -alht {} \;
echo
@kswedberg
kswedberg / jquery.loadasync.js
Created January 26, 2012 19:03 — forked from mathiasbynens/jquery.loadasync.js
Use jQuery to load scripts asynchronously
// Load scripts asynchronously
jQuery.loadScript = function(url, options) {
// Don't use $.getScript since it disables caching
options = $.extend(options || {}, {
dataType: 'script',
cache: true,
url: url
};
jQuery.ajax(options);
@kswedberg
kswedberg / dabblet.css
Created December 29, 2011 13:09
Untitled
a.title {
background: url(http://placehold.it/140x20) no-repeat 0 0;
display: inline-block;
min-height: 20px;
min-width: 140px;
}
(function( jQuery ) {
jQuery.ajaxPrefilter( "img", function( settings ) {
if ( settings.cache == null ) {
settings.cache = false;
}
settings.type = "GET";
settings.async = true;
});
@kswedberg
kswedberg / README.md
Created May 25, 2011 14:47 — forked from mathiasbynens/README.md
Improved swipe gestures plugin for jQuery

Improved swipe gestures plugin for jQuery

What Mathias changed (compared to the original v0.1.2):

  • Don’t modify the default settings internally.
  • Merge the options recursively (deep copy) so that the custom threshold values actually get used.
  • Allow overriding the options globally through $.fn.swipe.options.
  • Use namespaced jQuery events (using the swipe namespace) instead of DOM2 addEventListener to prevent errors in old IEs.
  • Simplified and optimized code.
<entry name="deferred.promise" type="method" return="Promise">
<signature>
<added>1.5</added>
</signature>
<desc> Return a Deferred's Promise object. </desc>
<longdesc> <p>The <code>deferred.promise()</code> method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request. The Promise exposes only the Deferred methods needed to attach additional handlers or determine the state (<code>then</code>, <code>done</code>, <code>fail</code>, <code>isResolved</code>, and <code>isRejected</code>), but not ones that change the state (<code>resolve</code>, <code>reject</code>, <code>resolveWith</code>, and <code>rejectWith</code>). </p>
<p>If you are creating a Deferred, keep a reference to the Deferred so that it can be resolved or rejected at some point. Return <em>only</em> the Promise object via <code>deferred.promise()</code> so other code can register callbacks or inspect the current state.</p>
<p>For more information, see the
<entry name="deferred.done" type="method" return="Deferred">
<signature>
<added>1.5</added>
<argument name="doneCallbacks" type="Function">
<desc>
A function, or array of functions, that are called when the Deferred is resolved.
</desc>
</argument>
</signature>
<desc> Add handlers to be called when the Deferred object is resolved. </desc>