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
#!/usr/bin/env ruby
require 'csv'
# This assumes:
# - Ruby 1.9's CSV library, if you are using 1.8, use FasterCSV.
#
# https://raw.github.com/hadley/data-baby-names/master/baby-names.csv
csv_fname = "baby-names.csv"
@noma4i
noma4i / gist:7512637
Created November 17, 2013 12:15
Show forms info in Chrome console
[].forEach.call(document.querySelectorAll('form'), function (input) {
var table = [];
console.group('HTMLForm "' + input.name + '": ' + input.action);
console.log('Element: ', input, '\nName: ' +
input.name + '\nMethod: ' + input.method.toUpperCase() +
'\nAction: ' + input.action || 'null');
['input', 'textarea', 'select'].forEach(function (control) {
[].forEach.call(input.querySelectorAll(control), function (node) {
@noma4i
noma4i / gist:7382967
Last active December 27, 2015 20:09
Install ruby 2.0 as system.
sudo add-apt-repository ppa:brightbox/ruby-ng-experimental
sudo apt-get update
sudo apt-get install -y ruby2.0 ruby2.0-dev ruby2.0-doc
@noma4i
noma4i / .git.alias
Last active December 23, 2015 21:28
Git alias
# Aliases
alias g='git'
compdef g=git
alias gst='git status'
compdef _git gst=git-status
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git pull --rebase'
compdef _git gup=git-fetch
alias gp='git push'
(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);
}
@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
----- 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

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": ["command+alt+k"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
]