Skip to content

Instantly share code, notes, and snippets.

View rafaelmotta's full-sized avatar
🎯
Focusing

Rafael Michels Motta rafaelmotta

🎯
Focusing
View GitHub Profile
@rafaelmotta
rafaelmotta / gist:f51dd371d9221163fe4335c38e211c9c
Created February 21, 2017 19:50 — forked from marcosdemetrio/gist:f77bdf3794b5a5b76a72558feace49d2
Deploy ruby on rails application with Dokku on Digital Ocean
1) Create a droplet on Digital Ocean
1.1 cloud.digitalocean.com/droplets/new;
1.2 In choose an image click on "One-click apps" and choose Dokku Image;
1.3 After choose the size, datacenter region, add your SSH Keys¹ and choose a hostname;
1.4 Create.
¹ - Find your SSH Keys in ~/.ssh/id_rsa.pub
2) SSH connection
@rafaelmotta
rafaelmotta / gist:3cc4d1dc560c8f1708509d25b1dc5eef
Created June 30, 2016 17:17 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

Sublime Text 2 – Useful Shortcuts (Windows)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command prompt
Ctrl+` python console
Ctrl+N new file

Editing

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
[
{
"keys" : ["alt+shift+w"],
"command" : "insert_snippet",
"args": {
"contents": "<${1:p}>${0:$SELECTION}</${1}>"
}
},
{ "keys": ["j", "j"], "command": "exit_insert_mode",
"context":
@rafaelmotta
rafaelmotta / useragent.js
Created October 28, 2012 01:25 — forked from priithaamer/useragent.js
Node.js User-Agent parser
// Based on fantastic jQuery useragent parser plugin https://gist.github.com/373298
function parse(uaStr) {
var agent = {
platform: {},
browser: {},
engine: {}
};
var ua = uaStr,
p = agent.platform,
@rafaelmotta
rafaelmotta / backbone-validation-bootstrap.js.coffee
Created August 2, 2012 14:14 — forked from driehle/backbone-validation-bootstrap.js.coffee
Render error messages of Backbone.Validation for Twitter Bootstrap
_.extend Backbone.Validation.callbacks,
valid: (view, attr, selector) ->
control = view.$('[' + selector + '=' + attr + ']')
group = control.parents(".control-group")
group.removeClass("error")
if control.data("error-style") == "tooltip"
# CAUTION: calling tooltip("hide") on an uninitialized tooltip
# causes bootstraps tooltips to crash somehow...
control.tooltip "hide" if control.data("tooltip")