Skip to content

Instantly share code, notes, and snippets.

@vova
vova / zsh-keyboard-shortucts.md
Created May 12, 2022 22:34 — forked from mkfares/zsh-keyboard-shortucts.md
Common zsh Keyboard Shortcuts on macOS Catalina

Common zsh Keyboard Shortcuts on macOS

Navigation

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

@vova
vova / CHRUBY_add_ruby_version.md
Created July 19, 2018 21:34 — forked from yannvery/CHRUBY_add_ruby_version.md
CHRUBY - How to install a new ruby version

Install a new ruby version with chruby

OSX

First of all you must update ruby-build to update definitions list.

brew update

And update ruby-build

@vova
vova / README.md
Created May 21, 2017 22:25 — forked from csswizardry/README.md
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

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.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vsp **/*<partial file name><Tab>
@vova
vova / gist:4650631759877e36091a
Created June 9, 2015 15:19 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
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

Use the debugger gem with unsupported Ruby versions

  • 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 -
$('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) {
# 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
#!/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")
@vova
vova / Ruby Notepad Bookmarklet
Created February 14, 2013 15:30 — forked from jakeonrails/Ruby Notepad Bookmarklet
AnyBrowser: Ruby Notepad Bookmarklet
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>