Book review: CSS Secrets by Lea Verou

During holidays I finished book CSS Secrets by Lea Verou. I think its the best CSS book I have encountered. It presents 47 everyday design problems with well thought out alternative solutions using latest CSS features.

First chapter gives short introduction on how CSS standards are formed and presents some best practices for writing CSS. That introduction...

First impression is made once

A short story on my really swift and decisive comparison of transactional email as a service services.

After I noticed that Mandrill has dropped free tier from their pricing options I took of to find alternative to be used while prototyping and with a small scale hobby stuff.

I quickly browsed through Elastic Email, Mailgun, Postmark and Sendgrid. From them I chose Mailgun and Sendgrid to a closer inspection.

Both of them were quite even in feature-wise. Sendgrid offered 12k free monthly emails and Mailgun 10k. Both had HTTP api, SMTP, custom domains, TLS, DKIM, SPF and impressive lists of services using their product containing everybody’s favorite startups.

I continued by registering test accounts – starting with Sendgrid. After registration I had to wait for confirmation mail, opened verification link and got forwarded to a really terrifying marketing info questionnaire containing dozen required input fields.

I got scared and retreated…

Next up Mailgun. Filled in registration form and immediately got forwarded to a confirmation page containing Curl example on using the service sandbox and sample source code snippets for a number of alternate languages. Instant success!

Instant success with Mailgun

Getting react-native running on Fedora 22

I had a little bumps along the way following react-native’s OSX only instructions while setting up development environment on my Fedora 22 system, so here’s quick notes how I got it up and running.

  1. Installed Node v4.1.2 using NVM
  2. Installed OpenJDK from Fedora repos

    sudo dnf install java-1.8.0-openjdk java-1.8.0-openjdk-devel
    
  3. Installed tools only version of the Android SDK

After those steps I created test project and tried to run react-native and adb port forwarding

adb reverse tcp:8081 tcp:8081 && react-native run-android

… encountering following output:

… lots of log output snipped away …

java.io.IOException: Cannot run program “/opt/android-sdk/build-tools/23.0.1/aapt”: error=2, No such file or directory

… lots of log output snipped away …

Execution failed for task ‘:app:mergeDebugResources’.

> Crunching Cruncher abc_ic_ab_back_mtrl_am_alpha.png failed, see logs

Fierce googling provided me information that issue was caused by 32 bit aapt and it could be fixed by installing 32 bit versions of shared libs it required:

sudo dnf install zlib.i686 libstdc++.i686

Summary

  • Install node version 4.*.* with NVM
  • Install missing 32 bit libs
  • Reverse forward 8081 port for react-native to be able to fetch JS bundle

Secure storage for http basic auth credentials with Git

Lately I have been pushing to a couple git repository over https instead of usual git+ssh and the workflow felt a little bit tedious because by default git asks for http auth credentials before every action.

Fortunately I stumbled upon gitcredentials which allows git to use gnome-keyring among other possible storages.

Using gnome-keyring

In Fedora using git-credential helper for gnome-keyring is pretty straightforward, because the plugin comes prebuilt in Fedora RPM. All you need to do is:

git config --global credential.helper gnome-keyring

You can check what credential helpers your git version knows out-of-the-box with following shell command:

git help -a | grep credential-

OSX users may find helper for Keychain there and Windows users would probably be able to use wincred helper.

Ubuntu packages have gnome-keyring helper only as source in git documentation folder, so it has to be built first:

sudo apt-get install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring

After first successful login credentials are stored in gnome-keyring and retrieved from there in future.

Using gpg encrypted .netrc in non-Gnome system

If your are not using Gnome/Unity and don’t like to have gnome daemons running in the background, you could use encrypted .netrc file to achieve similar workflow.

  1. Place .netrc in your home directory where each line contain host, user and password definition in following format:

    machine {host name} login {user name} password {password}
    

    For example:

    machine github.com login johndoe password s3cret
    
  2. Generate gpg key if you don’t have one already:

    gpg --gen-key
    
  3. Encrypt ~/.netrc using gpg:

    gpg -e -r {YOUR EMAIL USED IN STEP 2} ~/.netrc
    
  4. Remove original unencrypted .netrc

    rm ~/.netrc
    
  5. Enable credential helper for netrc:

    sudo chmod +x /usr/share/doc/git/contrib/credential/netrc/git-credential-netrc
    git config credential.helper /usr/share/doc/git/contrib/credential/netrc/git-credential-netrc
    

    It will seek ~/.netrc.gpg by default and handle decrypting it.

Extra tip: Use gnupg.vim or epa if you prefer Emacs to ease editing .netrc.gpg.

Fish shell is my new favourite

I decided to take Fish shell to the test drive after running into mentions of it in The Setup blog and IRC lately. It was really positive experience and it’s my default login shell now.

Fish is acronym for friendly interactive shell and it really lives up to its name. It didn’t require any configuration to be able to suggest command completions using history, existing filenames or git branch names for example.

Suggestions will happen while you type similar to URL suggestions in web browsers and TAB completion works like you would expect if you are coming from Bash.

Screenshot

However to get rbenv working I had to include following to the Fish configuration at ~/.config/fish/config.fish:

set -x PATH $HOME/.rbenv/bin $PATH
status --is-interactive; and source (rbenv init -|psub)

And for git status / current branch display as right side prompt I added following:

function fish_right_prompt
  __terlar_git_prompt
end

Editing ~/.config/fish/config.fish is not the only way to customize your shell. Executing fish_config will start web server inside your terminal and open quite nice browser based configuration tool in your default browser.

Web config