Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
var foo = function () { | |
console.log(this); | |
console.log(arguments); | |
} | |
var context = {}; | |
// shortcut with predefined context and arguments | |
var bar = Function.prototype.call.bind(foo, context, 'arg1', 'arg2'); | |
bar('arg3'); // context, ["arg1", "arg2", "arg3"] |
function intervalMixin() { | |
var intervals = []; | |
return { | |
addInterval: function (func, delay) { | |
intervals.push({ func: func.bind(this), delay: delay }); | |
}, | |
startIntervals: function () { | |
intervals.forEach(function (interval) { |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
$.fn.queueAnim = function (steps, callback) { | |
var $selector = this; | |
function iterator(step) { | |
step.push(iterate); | |
$selector.animate.apply($selector, step); | |
} | |
function iterate() { | |
if (!steps.length) return callback && callback(); |
function elo(oldRating, opponentRating, result) { | |
var kFactor; | |
var expected = 1.0 / (1.0 + Math.pow(10.0, ((opponentRating - oldRating) / 400))); | |
if (oldRating < 2100) { | |
kFactor = 32; | |
} else if (oldRating >= 2100 && oldRating <= 2400) { | |
kFactor = 24; | |
} | |
else if (oldRating > 2400) { |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
# dump heroku db | |
heroku pgbackups:capture | |
# restore | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d database_name DUMP_PATH |
function hasWebSocket() { | |
var m = navigator.userAgent.match(/Android ([0-9]+)\.([0-9]+)/i); | |
if (m) { | |
var x = parseInt(m[1], 10); | |
var y = parseInt(m[2], 10); | |
return window.WebSocket && (x > 4 || (x == 4 && y >= 4)); | |
} |
function run(genfun) { | |
var gen = genfun(); | |
function next(err, answer) { | |
if (err) { | |
return gen.throw(err); | |
} | |
var res = gen.next(answer); | |