Viewing images right inside iTerm 2.9

Call me crazy, but viewing images from a CLI app can be pretty cool.
Yes, we have the ancient art of ASCII (and that will not go away)
but why not use a real image in some cases?

Now the nice folks behind iTerm 2 have made that possible in versions
of iTerm post-2.9. I do not claim this has not been done before, but
I am unaware of this capability in Terminal. Anyway, on to the goods:

Steps for ZSH Users

[ iTerm & ZSH, great together ]

  • mkdir ~/Projects/iterm/imgcat && cd !$
  • wget https://raw.githubusercontent.com/gnachman/iTerm2/master/tests/imgcat
  • wget http://p1cdn01.thewrap.com/images/2014/05/Halt-and-Catch-Fire-8.jpg -O hacf.jpg
  • Change $PATH to include ~/Projects/iterm/imgcat
  • Reload your shell
  • imgcat hacf.jpg

Halt and Catch Fire


set-upstream-to

Hello friends! Are you tired of this message:

There is no tracking information for the current branch.

I am too! So I searched the OhMyZSH repo for set-upstream-to and re-discovered this command: ggsup. Calling ggsup with the name of the branch you want to track will get you to the place you want to be. W00t!

To recap. Call

1
2
3
ggsup master
```
...to track `master`. Call

ggsup dev
```
…to track dev. Get trrrrrracking team!


Definition: The Zone (Programming)

(The) Zone

noun

The state in which all resistance to progress is non-present. Easy flow of information from subconscious to conscious mind, characterized by clarity of purpose, speed of achievement and the full architecture of your project being held intact at the front of your mind. “Peak zone” is typically sustainable for 2-4 hours but takes 15-30 minutes to “boot up” into and is easily knocked down like a deck of cards if the “zonee” is disturbed by someone outside the zone.


Dev Letters: TMZ for Developers

Some of the most useful and lasting content has come from letters between colleagues. In this tradition, I
will post some developer insight that’s shared between myself and other developers.

Tim

You’ve sent out some good stuff lately [on our JavaScript DL]. What’s your source? Is there a site I can check daily—a TMZ for developers?

James

  1. I’ve decided to share even when I’m really “in the zone”, whereas previously I shared when I was bored
  2. I make liberal use of IFTTT. I let the computers monitor the web and ping me when something “interesting” happens. E.g. I have Facebook’s Github profile monitored for new repos
  3. I listen to the “5 Minutes of JavaScript” podcast. 3/4 of their content is too junior, but the 1/4 that’s not is worth it

Capitalization of modules in Node.js

Tradition in Node.js dictates you import core modules using this style:

1
2
var fs = require('fs');
fs.readFile(packageJSONPath, readOperationDidFinish);

I’ve adhered to that style for the most part, but it’s always rubbed me the wrong way.
As a core modules that points to a collection of static methods, capitalization is more appropriate.

1
2
var FS = require('fs');
FS.readFile(packageJSONPath, readOperationDidFinish);

Where the correct decision becomes most apparent is when using the path module:

1
2
3
var Path = require('path');
var join = Path.join;
var path = join(process.cwd(), 'package.json');

We used lowercase for local values, and using lowercase for the path module easily results in naming conflicts.


git pug

I am an idiot who subconciously likes pugs, so I often type git pug instead of git push or git pull. Is this truly a problem?
Note if I execute the following:

1
npm install pugme -g

Then place this in my ZSH aliases file:

1
2
3
4
5
6
7
git() {
if [[ $@ == "pug" ]]; then
command pugme
else
command git "$@"
fi
}

Which results in


Harmonious Node.js

Setting up NVM w/ ZSH

Execute the following

1
2
3
4
5
mkdir -p ~ZSH_CUSTOM/plugins
cd ~ZSH_CUSTOM/plugins
git clone git://github.com/rummik/nvm-zsh.git
cd nvm-zsh
git submodule update --init

Then edit the plugins array in your ~/.zshrc to include nvm-zsh so that it
looks somewhat like this: plugins=(nvm-zsh history-substring-search git osx ruby)

Installing a newer version of node

  • Run nvm ls-remote to determine the latest version of Node
  • Install it: nvm install v0.11.15
  • Run node --v8-options | grep harmony to determine which harmony features are supported
  • Start using harmony features by running your code with node --harmony foo.js

Gotchas w/ Arrow Functions in ES6/Harmony

Note that the following does not work:

1
2
3
4
5
6
7
8
9
function ES6Example(){}
ES6Example.prototype.foo = function(bar){
return ((baz) => {
this.bar = baz
})(bar)
}
var es6Example = new ES6Example
es6Example.foo('qux')
console.info(es6Example.bar) //undefined

But this does:

1
2
3
4
5
6
7
8
function ES6Example(){
this.foo = baz => {
this.bar = baz
}
}
var es6Example = new ES6Example
es6Example.foo('qux')
console.info(es6Example.bar) // 'qux'


Installing mpstat

I’m testing out Scout App for server monitoring. It requires something called mpstat and it apparently isn’t installed.
To get it, run apt-get install sysstat.


IFTTT & the Augmented Human

I’ve been an IFTTT user for a while but only recently have I been trying to use it to its fullest extent. Apps like IFTTT & Zapier are an early version of augmenting ourselves.