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
// replace dumb quotes like "these" with “these” | |
function smartQuotes(str) { | |
return str | |
.replace(/'''/g, '\u2034') // triple prime | |
.replace(/(\W|^)"(\S)/g, '$1\u201c$2') // beginning " | |
.replace(/(\u201c[^"]*)"([^"]*$|[^\u201c"]*\u201c)/g, '$1\u201d$2') // ending " | |
.replace(/([^0-9])"/g,'$1\u201d') // remaining " at end of word | |
.replace(/''/g, '\u2033') // double prime | |
.replace(/(\W|^)'(\S)/g, '$1\u2018$2') // beginning ' | |
.replace(/([a-z])'([a-z])/ig, '$1\u2019$2') // conjunction's possession |
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 copyToClipboard( text ){ | |
var copyDiv = document.createElement('div'); | |
copyDiv.contentEditable = true; | |
document.body.appendChild(copyDiv); | |
copyDiv.innerHTML = text; | |
copyDiv.unselectable = "off"; | |
copyDiv.focus(); | |
document.execCommand('SelectAll'); | |
document.execCommand("Copy", false, null); | |
document.body.removeChild(copyDiv); |
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
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; | |
$(document).keydown(function(e) { | |
kkeys.push( e.keyCode ); | |
if ( kkeys.toString().indexOf( konami ) >= 0 ) { | |
$(document).unbind('keydown',arguments.callee); |
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(r,e,a,d,y){function $(f){d?f():r.push(f)}e.ready=$;e.addEventListener(a,y=function(){d=!e.removeEventListener(a,y,d);while(y=r.shift())y()},d)}([],document,'DOMContentLoaded',!1); |
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
Here is a list of scopes to use in Sublime Text snippets - | |
ActionScript: source.actionscript.2 | |
AppleScript: source.applescript | |
ASP: source.asp | |
Batch FIle: source.dosbatch | |
C#: source.cs | |
C++: source.c++ | |
Clojure: source.clojure | |
CoffeeScript: source.coffee |
NewerOlder