Skip to content

Instantly share code, notes, and snippets.

@rumf
rumf / jquery.outerhtml.js
Last active October 12, 2015 10:17
jQuery get outerhtml
if (typeof $this.outerHTML !== 'undefined') {
outerhtml = $this.outerHTML;
} else {
outerhtml = $this.wrap('<div>').parent().html();
$this.unwrap();
}
@rumf
rumf / sortObject.js
Last active December 12, 2015 00:28
sortObject = function(o) {
var sorted = {},
key, a = [];
for (key in o) {
if (o.hasOwnProperty(key)) {
a.push(key);
}
}
function renderTemplate($template, $param = false) {
ob_start();
if ($param) {
extract($param);
}
include($template);
}

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
function getRandomInt(min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
}