Page 10 of 11

Git branch cleanup after pull request Feb 24 2018

After merging a pull request Github shows the option to remove the branch that was merged, but that only removes the branch from the remote Github repo.

If you display all your branches in local( git branch -a ) you’ll still see that the removed branch still appear.

To verify which branches are ok to remove you use the command:

1
git pull --prune --dry-run

This will show you which branches on remote can be removed, we will use this list to clean our local repo. The –dry-run flag makes the command just display what will happen if we prune the remote repo.

Read More...

tmux basic usage Feb 19 2018

After editing your config file (probably ~/.tmux.conf) you don’t need to kill your tmux server and reload it, you can just go to tmux command mode and source your configfile:

1
<C-b>:source-file ~/.tmux

When you open use vim on tmux you might lose your colours that is because the term that tmux uses is screen and you might be using xterm, you can fix that by:

Adding to your alias(on your .bashrc .bash_profile or where every your alias are located):

Read More...

Using rbenv for multiple projects Feb 15 2018

I prefer to keep all my gems separated by project so I use rbenv-gemset you might want to do that too.

If you want to use a specific ruby version on a project do the following:

1
2
cd project
rbenv install 2.4.1 # you can pick any version `rbenv install -l`

then use that specif ruby-version on the project

1
rbenv local 2.4.1

This will create a .ruby-version file that contains the version you are using, to verify that you can check the version running:

Read More...

CTags vim multiple projects Feb 14 2018

If you have to reference multiple directories on your ctags do the following.

Install ctags

Generate CTags for all of your projects, from your project’s root

1
ctags -R .

this will generate a file tags, add it to the git ignore

1
echo "tags" >> ~/.gitignore_global

Now configure your vimrc to search current dir, then add other the tag files from your other projects

set tags=./tags,$HOME/project1/tags,$DEVPATH/project2/tags

Now you can go to the root of all of your projects open vim and Ctrl-] Ctrl-t all you like

Read More...

Installing docker-toolbox on mac OSX Jan 11 2018

If you use iTerm you’ll probably need to change the file:

/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/iterm.scpt

Following the code in this gist

Install bash_completion from mac ports or using homebrew Here I’ll show the autocomplete files you need to add to your autocomplete.d directory (check where ports or brew installed your autocomplete.d)

Problem installing docker in VM: https://github.com/moby/moby/issues/15990 Read More...

On being pragmatic Jul 19 2017

Sometimes rules or styles become hindrances instead of being helpful, we have to keep track of so many things that we forget what was the purpose of what we started with.

Interesting reads: Just use double-quoted strings

https://en.wikipedia.org/wiki/The_Pragmatic_Programmer

Read More...

Vim use ESLint via ALE Jul 17 2017

Why ALE and not Syntastic ? just personal preference, ALE seems to take advantage of the async in Vim 8, just that.

What would we need:

Step 1.

Installing ESLint is very straightforward using NPM  in general just(this will install it in your current directory if you want it global use the -g flag, you should have initialized your npm in the current project npm init prior to run this command):

Read More...

On Security Jul 15 2017

Two-factor authentication is important but sometimes is hard if you are travelling around and don’t have a fixed phone number in every country. Here are some security features that you might find helpful:

Read More...

Vim colour schema Jul 15 2017

When you see colours displayed on vim, they are defined by highlight rules, and they are applied to groups (in the example below the group is Normal, you can view all of them running: :so $VIMRUNTIME/syntax/hitest.vim) for example:

" Set the background colour to white 
:highlight Normal ctermbg=White
" Set the background colour to yellow
:highlight Normal ctermbg=Yellow
" Set the background colour to none(back to normal)
:highlight Normal ctermbg=0

Where are colours defined? you can check the value of each colour for x-term256 here

Read More...

The little schemer Jul 10 2017

  1. Get the book
  2. Get a working copy of Scheme (The one I used is Racket Download & Install )
  3. If you use VIM you could use the setup shown in this post to complete the exercises.
  4.  Maybe you’ll struggle with the first exercises on what are you required to do. So just remember to initialise the function:
1
2
3
4
; atom? as defined in the Guidelines for the reader
(define atom?
(lambda (x)
(and (not (pair? x)) (not (null? x)))))
  1. Start with the first exercise:
1
(atom? (quote atom))

When the instructions ask if it’s a list you can use the function list? (see the pattern?)

Read More...

$