⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
// http://stackoverflow.com/a/2490876 | |
var event; | |
if (document.createEvent) { | |
event = document.createEvent("HTMLEvents"); | |
event.initEvent("dataavailable", true, true); | |
} else { | |
event = document.createEventObject(); | |
event.eventType = "dataavailable"; | |
} |
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 moveCursorToEnd(el) { | |
el.focus(); | |
if (el.setSelectionRange) { | |
var len = el.value.length * 2; | |
el.setSelectionRange(len, len); | |
} else el.value = el.value; | |
el.scrollTop = 999999; | |
} |
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
<snippet> | |
<content><![CDATA[console.log($1);$0]]></content> | |
<tabTrigger>cs</tabTrigger> | |
<scope>text.html,source.js</scope> | |
<description>console.log()</description> | |
</snippet> | |
<!-- Save file in /packages/User/console-log.sublime-snippet --> | |
<!-- Restart Sublime Text 2 --> | |
<!-- Type "cl" and hit tab --> |
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
// http://stackoverflow.com/questions/1248302/javascript-object-size | |
function roughSizeOfObject ( object ) { | |
var objectList = []; | |
var recurse = function ( value ) { | |
var bytes = 0; | |
if ( typeof value === 'boolean' ) bytes = 4; |
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
/* | |
* Usage: | |
* '#' is optional | |
* $.gradient( "#CCCCCC", -0.1 ); // returns a 10% darker hex color | |
* $.gradient( "#AAAAAA", 0.4 ); // returns a 40% lighter hex color | |
* $.gradient( "NTAF2S", 0.3 ); // returns false | |
*/ | |
$.gradient = function ( hex, opacity ) { | |
if ( !/^#?[0-9a-f]{3,6}$/i.test( hex ) ) return false; |
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
$.extend($.expr[':'], { | |
inview: function ( el ) { | |
var $e = $( el ), | |
$w = $( window ), | |
wt = $w.scrollTop(), | |
wb = wt + $w.height(), | |
et = $e.offset().top, | |
eb = et + $e.height(); | |
return eb >= wt && et <= wb; |