Dear Coding Diary,

Blah, blah, blah...

Development Stack

I imagine it’s only a matter of time till zsh comes bundled with Chrome.

Chrome Canary Dev Tools, coupled with my solarized color scheme, https://github.com/d-g-h/solarized-dark-skin-chrome-devtools, yes.

efficient.sh
1
2
3
4
5
6
brew install node
npm install -g grunt-cli
npm install grunt-contrib-watch --save-dev
npm install grunt-browser-sync --save-dev
echo 'I have vagrant running already, right?'
cap deploy

Node.js, installing this much easier, brew install node for those of you using homebrew. This will help run the utilities below.

npm install grunt, running this with right configuration will run the tasks below are more.

grunt-contrib-watch to compile preprocessor code, for me, stylus.

grunt-browser-sync for live reloading across all connected devices, connected as in, viewing the site on your network.

http://css-tricks.com/cross-browser-css-injection/

https://github.com/shakyShane/browser-sync

Vagrant for virtual servers in your neighborhood, or locally.

I finally got around to deploying with Capistrano (2.*), for a while I enjoyed SSHing into one of my servers, and pulling down from git. I’m over it.

It might take a day or so to get things running, but that’s only 1 day wasted instead of 20. Thanks to everyone who helped build these amazing tools.

VLEMP

Vagrant Linux NGINX MySQL PHP

Here’s a start for those interested in NGINX, PHP, MySQL, Chef and of course, Wordpress, The stack is based up another repo I found. If you any problems or feedback, please create an issue over on the repo page. I have been using this setup for a while without Chef. I rolled something a bit more complex for Graph Paper Press. Once I reroll up my EC2 server, I’m moving to Digital Ocean by ways of Packer. I’m moving on up.

Custom Excerpt Lengths All Around WordPress

First off, to get back here, I needed to use this cmd for .zsh

rake "new_post[Zombie Ninjas Attack: A Pastafarian's Retrospective]"

and not…

rake new_post["title"]

Moving on, I wanted to share this with rest of the world as I don’t understand why it isn’t default in WordPress.

I didn’t write this myself, but it’s clear as to what it does. I believe the original was found in codex.wordpress.org, but maybe not.

By default, the_excerpt function in WP is 55 words. You can customize this length via there API. That is weaksauce though. This plugin allows you to make different custom lengths where you need them to be custom. Here we go.

functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
  function my_excerpt($excerpt_length = 55, $id = false, $echo = true) {
      $text = '';

            if($id) {
                  $the_post = & get_post( $my_id = $id );
                  $text = ($the_post->post_excerpt) ? $the_post->post_excerpt : $the_post->post_content;
            } else {
                  global $post;
                  $text = ($post->post_excerpt) ? $post->post_excerpt : get_the_content('');
      }

                  $text = strip_shortcodes( $text );
                  $text = apply_filters('the_content', $text);
                  $text = str_replace(']]>', ']]&gt;', $text);
            $text = strip_tags($text);

                  $excerpt_more = ' ' . '[...]';
                  $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
                  if ( count($words) > $excerpt_length ) {
                          array_pop($words);
                          $text = implode(' ', $words);
                          $text = $text . $excerpt_more;
                  } else {
                          $text = implode(' ', $words);
                  }
          if($echo)
            echo apply_filters('the_content', $text);
          else
          return $text;
  }

  function get_my_excerpt($excerpt_length = 55, $id = false, $echo = false) {
   return my_excerpt($excerpt_length, $id, $echo);
  }
  add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
?>

Yay!

I can’t blog and never do so while I’m on a roll. I just wanted to completely think about all the new tools and I have used or I am currently using.

Off the Top of My Head Tool List
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
tmux
mvim
sshuttle
ssh -D
git
scp
brew
osx lion
chrome canary
vimium
iOS simulator 6.0 w/safari as the inspector
solarized
magic keyboard and trackpad
virtualbox with ie7-10
ec2
nginx
node
express
jade
stylus
supervisor
octopress
github pages
github
dig
ack
Vagrant
zsh
oh-my-zsh

That’s it I guess I can add to this list. I’m sure I’m missing a bunch of things. I didn’t mention any VIM plugins…

Here is it real quick though

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
My Bundles
Bundle 'gmarik/vundle'
Bundle 'MarcWeber/vim-addon-mw-utils'
Bundle 'tomtom/tlib_vim'
Bundle 'mileszs/ack.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'altercation/vim-colors-solarized'
Bundle 'spf13/vim-colors'
Bundle 'tpope/vim-surround'
Bundle 'AutoClose'
Bundle 'kien/ctrlp.vim'
Bundle 'vim-scripts/sessionman.vim'
Bundle 'matchit.zip'
Bundle 'Lokaltog/vim-powerline'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'godlygeek/csapprox'
Bundle 'flazz/vim-colorschemes'
Bundle 'corntrace/bufexplorer'
Bundle 'vim-stylus'
Bundle 'vim-jade'
Bundle 'rstacruz/sparkup'
Bundle 'scrooloose/syntastic'
Bundle 'garbas/vim-snipmate'
Bundle 'spf13/snipmate-snippets'
Bundle 'tpope/vim-fugitive'
Bundle 'scrooloose/nerdcommenter'
Bundle 'godlygeek/tabular'
Bundle 'majutsushi/tagbar'
Bundle 'Shougo/neocomplcache'
Bundle 'spf13/PIV'
Bundle 'klen/python-mode'
Bundle 'python.vim'
Bundle 'python_match.vim'
Bundle 'pythoncomplete'
Bundle 'leshill/vim-json'
Bundle 'groenewege/vim-less'
Bundle 'taxilian/vim-web-indent'
Bundle 'HTML-AutoCloseTag'
Bundle 'rails.vim'
Bundle 'spf13/vim-markdown'
Bundle 'spf13/vim-preview'
Bundle 'tpope/vim-cucumber'
Bundle 'Puppet-Syntax-Highlighting'