Redesigned site again

So I ran into some problem using a single-page oriented system with knockout.js for my site.

The problem is not the browsing, but the indexing. I want my page to be able to appear on search results from web search engines.

If you are using a single-page design, you will have some problems with this. Search engines can't crawl you page properly and keywords are hard to inject.

I tried using the escaped fragment approach but I figured this would only solve the problem for Google. Not any other search engine or crawler.

So I've migrated over to a classical server side rendering. The rendering is done with express and pages are written in Jade.

So far I really like Jade. It requires little html-coding, lets you focus more on the model behind the page and doesn't mix rendering and model like a classical PHP setup usually do.

Lazy git aliases

When you are working with version control system, you tend to do the same operations over and over all the time. Therefore you should take every shortcut you can find to make the process as smooth as possible, limiting the amount of text you type.

Before switching to Git, I used Svn a lot. In Svn they have added shortcuts for the most common commands:

  • svn update = svn up
  • svn commit = svn ci
  • svn status = svn st
  • svn checkout = svn co

Using the short versions instead of the longer ones will save you some time. When using svn st I mostly add the option -q to get a more limited output.

Most of the commands in Git are verbose and that's a hazzle. To my knowledge there are no standard aliases in Git like the ones in Svn so lets create some!

When you create aliases in Git you specify what command will be executed and you can also specify parameters. Basically you tell Git what to add after the git command.

git config --global "commit"
git config --global alias.fe "fetch -v --all"
git config --global alias.rb "rebase -v"
git config --global "merge"
git config --global alias.meff "merge --no-edit --ff"
git config --global alias.menff "merge --no-ff"
git config --global "checkout"
git config --global "status -uno -s -b"
git config --global alias.lo "log --decorate"
git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"

Copy these into your terminal to store them in your Git configuration file ~/.gitconfig. They all bring down the amount of key presses needed, and some of them have a bit added functionality

I use git fe all the time to make sure I'm working against the newest code. The added -v will give you a simple list instead of a verbose message, and --all will fetch data from all repositories. If any of the branches have been updated you will se it in the list.

The merge comes with an extra two variants. The meff will tell Git to explicitly make an fast-forward, and menff not to make a fast-forward.

The tree alias will print you a decent view of how the branches and commits are connected. I found this alias online by searching for git tree alias. There are a few variants of this command.

I have a github gist file with all the aliases that I use: Gist.

Tuesday, October 06, 2015   #tech #dev #git #lazy #alias #cli #config 

tmux - Multitasking in cli

I've recently stumbled upon a new cli program called tmux. This program is similar to the old program screen which can be found in many nix systems.

In short the program is a "windowmanager for the cli" allowing you to have multiple sessions spawed from one terminal.

tmux usage

When you start tmux it will open a new terminal session for you. You can send a list of commands in tmux by pressing CTRL-b. This will make the program enter command mode. To get a list of all commands press CTRL-b + ?.

The program differentiates between windows and panes. Windows are areas that cover the entire screen. Panes are split areas inside of a window.

As I mentioned before I just recently stumbled upon tmux, so I will have to experiment a bit more to see what it can be used for.

So far I've found these commands to be most vital:

  • CTRL-b + % Split the current pane vertically.
  • CTRL-b + " Split the current pane horizontally.
  • CTRL-b + o Select the next pane.
  • CTRL-b + CTRL-o Rotate around the panes.
  • CTRL-b + ? Show a help page of available commands.

The reason why I like this program is that often you enter a system through a single session and then you want to be able execute multiple jobs at the same time. For example if you log into a computer through ssh or get root acces. You don't whant to start another terminal and perform another login. This program makes that more convenient.

Tuesday, September 22, 2015   #tech #tmux #discovery #cli #ssh 


Redesigned site- Monday, September 21, 2015 #tech #dev #journal #nodejs #expressjs #bloggy #knockoutjs #pagerjs