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
<!-- | |
Just simply type 'module', press Tab, then enter the name of the "module", | |
press Tab again and then either press Backspace to remove JQuery "support" | |
or press Tab once more to finish. | |
This creates an anonymous self-executing function which is a design pattern | |
that can be seen in e.g. jQuery's source code. | |
One of the major benefits of this pattern is that you can limit access to | |
variables and functions within your closure, essentially making them private |
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
/* | |
* Author: Maciej Baron | |
*/ | |
;(function (SimpleDebug, $, undefined) { | |
/* | |
* Simple debugging | |
*/ | |
var debugEnabled = 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
echo Enter username; read i; echo "curl https://api.github.com/users/$i/events -s" | sh | grep message | sed -e 's/ "message": //g' -e 's/",/"/g' |
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
echo "last | grep shutdown | grep -v $USER" | sh | awk '{print "On "$3", "$4" "$5" finished at "$6}' |
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
if (!("placeholder" in document.createElement("input"))) { | |
$("[placeholder]").each(function () { | |
var placeholder = $(this).attr("placeholder"); | |
$(this).val(placeholder).focus(function () { | |
if ($(this).val() === placeholder) { | |
$(this).val(""); | |
} | |
}).blur(function () { | |
if ($(this).val().length === 0) { | |
$(this).val(placeholder); |
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 getScrollTop() { | |
if (typeof window.pageYOffset !== 'undefined'){ | |
return window.pageYOffset; | |
} else { | |
var iequirks = document.body; | |
var iedoctype = document.documentElement; | |
var doc = (iedoctype.clientHeight) ? iedoctype : iequirks; | |
return doc.scrollTop; | |
} | |
} |
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 | |
combinations = (('todo', '(.*)TODO:(.*)', 'string'), ('fix','(.*)FIX:(.*)', 'invalid')) | |
class HighlightText(sublime_plugin.TextCommand): | |
def run(self, edit): | |
view = self.view | |
for combination in combinations: | |
regions = view.find_all(combination[1],0) | |
view.add_regions(combination[0], regions, combination[2] , '') |
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
find . -name '*.jpg' | awk 'BEGIN{ a=0 }{ printf "mv %s tile%02d.jpg\n", $0, a++ }' | bash |
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 | |
combinations = (('todo', '(.*)TODO:(.*)', 'variable.parameter'), ('fix','(.*)FIX:(.*)', 'invalid.depricated'), ('notabene', '(.*)NB:(.*)', 'string')) | |
class HighlightText(sublime_plugin.TextCommand): | |
def run(self, edit): | |
view = self.view | |
for combination in combinations: | |
view.add_regions(combination[0], view.find_all(combination[1],0), combination[2], '') |
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
for f in *; do git mv -f "$f" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done |
OlderNewer