Archive

Archive for December, 2013

2013 in review

December 31, 2013 Leave a comment

The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 160,000 times in 2013. If it were an exhibit at the Louvre Museum, it would take about 7 days for that many people to see it.

Click here to see the complete report.

Categories: review Tags: ,

The quick brown fox jumps over the lazy dog

December 20, 2013 1 comment

I’m sure you have seen the sentence “The quick brown fox jumps over the lazy dog” lots of times. I always thought it was just a stupid test sentence, but no! It’s a special sentence, a so-called pangram. A pangram is a sentence that contains all the letters of the alphabet. Here is the proof:

>>> s='The quick brown fox jumps over the lazy dog'.lower()
>>> s
'the quick brown fox jumps over the lazy dog'
>>> sorted(set(s))
[' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
Categories: fun, python Tags:

sending vim to background then bringing it back

December 13, 2013 Leave a comment

Problem
You are working in vim and you want to switch quickly to the terminal to do something. Then you want to get back to vim and continue editing where you left off.

Solution
Simply do the same you do with other programs:

  • CTRL+Z: suspends vim and you find yourself in the terminal
  • do your terminal business
  • fg: brings you back to vim
Categories: Uncategorized Tags: ,

sachet: customize your vim through a web interface

December 13, 2013 Leave a comment

Vim is a very nice text editor but for its full potential, you need a good config. file :) If you are new to vim, you can start with sachet. Sachet is a web application where you select the features you want in your vim editor and it prepares the config. file for you that you can download and install. Simple!

sachet allows you to handcraft your VIM development environment. By allowing you to select features and functionality that you are comfortable with, sachet generates you a small package with the appropriate configuration files, plugins, and theme so you can leverage the potential of your VIM editor.” (source)

Later on you can customize your .vimrc file.

Categories: Uncategorized Tags: ,

Learn Vimscript

December 13, 2013 Leave a comment

I don’t want to encourage anyone, but if you are interested in customizing your vim editor, check out Learn Vimscript the Hard Way.

The book is divided roughly into three sections:

  • The first covers basic Vim commands that you can use in your ~/.vimrc file to customize Vim quickly and easily.
  • The second looks more deeply at Vimscript as a programming language, covering things like variables, comparisons, and functions.
  • The third walks through the creation of a sample plugin intended for distribution to other Vim users.
Categories: Uncategorized Tags: ,

Vim tricks by Damian Conway

December 13, 2013 Leave a comment

At reddit I found an interesting talk given by Damian Conway. In this talk he shares some cool vim tricks.

The assets to the presentation are available here: Instantly_Better_Vim_2013.tar.gz

I found the following tips particularly interesting.

"====[ Make the 81st column stand out ]====================

"    " EITHER the entire 81st column, full-screen...
"    highlight ColorColumn ctermbg=magenta
"    set colorcolumn=81

    " OR ELSE just the 81st column of wide lines...
    highlight ColorColumn ctermbg=magenta
    call matchadd('ColorColumn', '\%81v', 100)

"=====[ Highlight matches when jumping to next ]=============

    " This rewires n and N to do the highlighing...
    nnoremap <silent> n   n:call HLNext(0.4)<cr>
    nnoremap <silent> N   N:call HLNext(0.4)<cr>

    " OR ELSE ring the match in red...
    function! HLNext (blinktime)
        highlight RedOnRed ctermfg=red ctermbg=red
        let [bufnum, lnum, col, off] = getpos('.')
        let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/))
        echo matchlen
        let ring_pat = (lnum > 1 ? '\%'.(lnum-1).'l\%>'.max([col-4,1]) .'v\%<'.(col+matchlen+3).'v.\|' : '')
                \ . '\%'.lnum.'l\%>'.max([col-4,1]) .'v\%<'.col.'v.'
                \ . '\|'
                \ . '\%'.lnum.'l\%>'.max([col+matchlen-1,1]) .'v\%<'.(col+matchlen+3).'v.'
                \ . '\|'
                \ . '\%'.(lnum+1).'l\%>'.max([col-4,1]) .'v\%<'.(col+matchlen+3).'v.'
        let ring = matchadd('RedOnRed', ring_pat, 101)
        redraw
        exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
        call matchdelete(ring)
        redraw
    endfunction

"====[ Make tabs, trailing whitespace, and non-breaking spaces visible ]======

    exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~"
    set list

"====[ dragvisuals ]======

    runtime plugin/dragvisuals.vim
    vmap  <expr>  h        DVB_Drag('left')
    vmap  <expr>  l        DVB_Drag('right')
    vmap  <expr>  j        DVB_Drag('down')
    vmap  <expr>  k        DVB_Drag('up')
    "vmap  <expr>  D        DVB_Duplicate()

    " Remove any introduced trailing whitespace after moving...
    let g:DVB_TrimWS = 1

The file dragvisuals.vim is in the archive linked above.

Categories: vim Tags:

gg.gg can shorten any URL

December 13, 2013 Leave a comment

I found this treasure in this thread.

The short URL http://gg.gg/rrg9 points to a URL that is 11,554 characters long. Wow! (This long URL contains a regular expression that validates an email…)

Do you know any other URL shortener that can process such long URLs? If yes, then please leave a comment.