Skip to content

Instantly share code, notes, and snippets.

View noma4i's full-sized avatar
💭
🦑 Daily Kraken

Alexander Tsirel noma4i

💭
🦑 Daily Kraken
View GitHub Profile
@noma4i
noma4i / gist:4069509
Created November 14, 2012 00:59 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
# Scenario 1: remote resource returns a binary file;
# the last part of the uri represents the file name
# e.g. http://someurl.com/artists/jeanlucponty/tracks/elephants-in-love.mp3
class Audio < ActiveRecord::Base
has_attached_file :file
def file_from_url(url)
self.file = download_remote_file(url)
end
@noma4i
noma4i / deploy.rb
Created January 28, 2013 04:01 — forked from andruby/deploy.rb
after "deploy:symlink", "deploy:restart_workers"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
/*
* Starts jetty for scalatra programatically
*
* Replace YourApplicationEndpointFilter with the filter in your application
*/
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.{DefaultServlet, ServletContextHandler}
object JettyLauncher {
def main(args: Array[String]) {
[
{ "keys": ["command+alt+k"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
]

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
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@noma4i
noma4i / rvm2rbenv.txt
Last active December 19, 2015 10:09 — forked from brentertz/rvm2rbenv.txt
RVM to RBENV migration guide
## Prepare ###################################################################
# Remove RVM
rvm implode
# Remove the RVM stuff from your .profile - It probably looks like...
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# Ensure your homebrew is working properly and up to date
brew doctor
(function(d){
var scrs=d.getElementsByTagName("script");
var scr=scrs[scrs.length-1];
var w=window;
function n(){
var e=d.createElement("script");
e.async=true;
e.src=("https:"==d.location.protocol?"https://":"http://")+"example.org/path/to/javascript.js";
scr.parentNode.insertBefore(e,scr);
}