CTRL + A
: Move the cursor to the beginning of the line
CTRL + E
: Move the cursor to the end of the line
OPTION + Left Arrow
: Move the cursor one word backward
OPTION + Right arrow
: Move the cursor one word forward
Left Arrow
: Move the cursor one character backward
Right Arrow
: Move the cursor one character forward
I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.
There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*
, e.g.:
:vsp **/*<partial file name><Tab>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
- replace the version of
debugger-ruby_core_source
in the path below, with the one you're using
gem install minitar
gem install debugger-ruby_core_source // or install it with bundler
cd ~/.rbenv/versions/2.0.0-p598/lib/ruby/gems/2.0.0/gems/debugger-ruby_core_source-1.3.7 && rake add_source VERSION=2.0.0-p598 && cd -
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# wrap ruby with gc tuning parameters | |
export RUBY_HEAP_MIN_SLOTS=<%= @node[:ruby][:gc][:heap_min_slots] %> | |
export RUBY_HEAP_SLOTS_INCREMENT=<%= @node[:ruby][:gc][:heap_slots_increment] %> | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=<%= @node[:ruby][:gc][:heap_slots_growth_factor] %> | |
export RUBY_GC_MALLOC_LIMIT=<%= @node[:ruby][:gc][:malloc_limit] %> | |
export RUBY_HEAP_FREE_MIN=<%= @node[:ruby][:gc][:heap_free_min] %> | |
exec "<%= @node[:languages][:ruby][:ruby_bin] %>" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').html('<table id="words"><thead><tr><th>Language</th><th>Category</th><th>Word</th><th>Strength</th></thead><table>'); | |
var ld = duo.user.attributes.language_data; | |
for (l in ld) { | |
ld[l].skills.models.forEach(function(model) { | |
var a = model.attributes; | |
if (a.progress_percent > 0) { | |
$.get('/skills/' + a.language + '/' + a.url_title, function(skill) { | |
skill.path.forEach(function(path) { | |
if (path.words && path.strength > 0) { | |
path.words.forEach(function(word) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A few examples about how to use Ruby for parsing files as we could do | |
# with Awk or Grep. This is based on what I learn fro this post: | |
# http://code.joejag.com/2009/using-ruby-as-an-awk-replacement/ | |
# Split each line with ':' and print the first $F[0] field | |
awk -F: '{ print $1 }' /etc/passwd | |
ruby -F: -nae 'puts $F[0]' /etc/passwd | |
# Parse the 'ps aux' output | |
# It'll print the ID process for the 'jojeda' user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
spec_hits = [] | |
checks = { | |
'_spec\.rb$' => ['focus:[:space:]*true'], | |
'\.rb$' => ['binding\.pry', 'debugger'] | |
} | |
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified | |
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -e 'require "fileutils";Dir.glob("app/helpers/**/*.rb").each{|file| if (!File.read(file).index("def")); FileUtils.rm file; FileUtils.rm_f file.sub("app/", "spec/").sub(".rb", "_spec.rb") if File.exist?("spec"); end}' |
NewerOlder