botbotbot 's blog

Jekyll with Continuous Integration

.travis.yml

Tips:

Travis support docker but not fully permission some dependencies that try to use OS command ex. kill can make your test error or failed.

  • htmlproofer external

link that not start with http will be claim as internal link

References:

  1. Jekyll with Continuous Integration
  2. Test your Jekyll blog with Travis CI
  3. Simple Docker Container for Jekyll Work
  4. Automatic merge branch into master on sucessful build in travis
  5. TravisCI Custom Deployment

Pomodoro Technique

Benefits

  • Focus on your work and make it Flow, eliminate your social that you can do in break.
  • Estimate your work with time, not your feeling that you know how long did you work and how long will be break.
  • Reduce multi-task that has high cost for switching.
  • Keep track of how long you’re spending at your task that make you easier to plan. Normally use pomodoro unit ex. two pomodoros for meeting, four for coding.

Guide

  1. Pomodoro Get Started
  2. Productivity 101: A Primer to The Pomodoro Technique
  3. เทคนิค Pomodoro: วิธีจัดเวลาเพื่อทำงานอย่างฉลาด เพื่อเปลี่ยนเรื่องยากให้เป็นเรื่องง่าย
  4. Pomodoro ไม่ใช่ทำงาน 25 นาที แล้วพัก 5 นาที

Apps

  1. Tomighty - Simpler - Source

    # osx
    $ brew cask install tomighty
       
    # if use dark theme need to build with youself
    # issuse - https://github.com/ccidral/tomighty-osx/pull/16
    # https://github.com/mrknmc/tomighty-osx
    # notification version
    # https://github.com/eduardonunesp/tomighty-osx
    
  2. TomatoTimer - WebApp

Vim Plugins

Plug-in - More:

  1. Vim Plug - A minimalist Vim plugin manager.
  2. surround
  3. Easymotion - EasyMotion Doc
  4. ctags
  5. GoldenView.Vim
  6. Ag.vim
  7. sneak.vim - Doc

Janus

# update vim version to support all plugin in janus
$ brew install vim
Keys Description
<leader>hs toggle highlight search
<leader>n toggle NERDTree
<leader>ci , <leader>/ toogle comment # NERDCommenter
<leader><leader>w easy motion w # EasyMotion
v{motion}S{tag} Visual Select then surround it with tag #surround
cs{old}{new} change old surround to new surround #surround
ds{tag} delete tag surround #surround

NERDTree - Ref

r in NERDTree - update tree m->a in NERDTree - create file/folder

Ctrlp

F5 in ctrlp - update ctrlp

Ctags

$ brew install ctags
$ ctags -R # generate tags
Keys Description
<C-]> jump to tag
<C-t> back to original

vim-trailing-whitespace

:FixWhitespace

VimDeck - Presentation in Vim

# osx not support ascii-art
$ brew install imagemagick
$ sudo gem install rmagick
# gem install vimdeck
$ sudo gem install vimdeck-without-ascii-art

Reference:

  1. Vim Essential Plugins
  2. vim.rc & vim plugin (video th)
  3. Vim and Ctags
  4. How can you automatically remove trailing whitespace in vim
  5. Why I switched from Vundle to Plug
  6. How to use Syntastic plugin for Vim

Vim Command

Range

[range] Description
0 above first line
1 first line
. mean to current line
% all lines
$ last line
{start},{end} from start to end line
<,> start selection to end selection

Insert

Command Description
:[range]print , :p print line
:[range]copy{target} , :t copy line & paste
:[range]normal {vimkey} action vim key via command
  ex. :%normal A; - put ‘;’ in end line for each line
:!<shell command> run shell command in vim % mean to current file
:r<file> ,:r !<shell cmd> retrieving file after current cursor

Editor

Command Description
:e<file> edit/new file
:new<file> new file
:vnew<file> new file in vertical
:w !sudo tee % write file with sudo premission

Number

Command Description
:set relativenumber enable relative number
:set norelativenumber disable relative number

Key Mapping

Command Description
:map, :map! show mapping key
:verbose map <key> show mapping key and where it mapping

ETC

Command Description
:[range]move{target} , :m move line
:nohlsearch , :nohls mute highlight search
:<stg>C-d<\tab> command line completion
:redraw redraw screen (Ctrl + L)
:messages show history of messages

References:

  1. How can I view old status messages in Vim?
  2. Make echo seen when it would otherwise disappear and go unseen

Robot Packtpub

Automate claim free ebook from packtpub to your packtpub account by robotframework script.

Robot Script

Package Requirements or Dockerfile on Robot-packtpub Repo

# ubuntu
$ apt-get -y update
$ apt-get -y install python-dev python-pip
$ apt-get install -y phantomjs libicu52 wget
$ wget https://raw.githubusercontent.com/Pyppe/phantomjs2.0-ubuntu14.04x64/master/bin/phantomjs -O /usr/bin/phantomjs && chmod +x /usr/bin/phantomjs

$ pip install robotframework
$ pip install robotframework-selenium2library

How to use

# Edit {USER} and {PASSWORD} first !!!
$ pybot robot-packtpub.txt

Note

  • We use XPath to locate where button and input form are that not flexible, It may change when Web UI changed (XPath is Best Solution that I found). You can find XPath by following this video - Quick Tip: Getting The XPath In Google Chrome.

  • PhantomJS2.0 fixed this issue We use Xvfb Firefox for headless browser instead of PhantomJS that have some problem on docker in this case.

  • You can use Travis-CI and Nightly Builds to run your script everyday - See demo here.