"Boilerplate code is any seemingly repetitive code that shows up again and again in order to get some result that seems like it ought to be much simpler."
### $ in Terminal
$ is the default character you'll see, in the examples going forward you don't need to paste this in.
It's also possible to customise the $, for example.
.bash_prompt
```bash
PS1="\[\e]2;$PWD\[\a\]\[\e]1;\]
$(basename "$(dirname "$PWD")")/\W\[\a\]${BOLD}\
$(usernamehost)\[$GREEN\]\w\$(git_info)\[$WHITE\]
\n\n༼ つ ◕_◕ ༽つ⚡ \[$RESET\]"
```
![nodollar](http://173.254.28.140/~simonow1/speaking/wcmcr2014/nodollar.png)
https://github.com/s10wen/dotfiles/blob/master/.bash_prompt#L57
### Create a new site folder
```
$ mkd sitename.dev
```
Custom .functions code
```bash
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$@"
}
```
I just created a new directory
&&
I'm in it!
### Sublime Text - Config Project
```
httpd.conf, httpd-vhosts.conf, hosts
```
Project > Save Project As...
Quick Switch project = `Ctrl+Cmd+P`
http://sow.so/paths
### hosts
```
# S
127.0.0.1 sitename.dev
```
### httpd-vhosts.conf
```
# S
# sitename.com
<VirtualHost *:80>
ServerName sitename.dev
ServerAlias *.sitename.dev
DocumentRoot "/Users/simonowen/Sites/sitename.dev/"
<Directory "/Users/simonowen/Sites/sitename.dev/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
ErrorLog "/var/log/apache2/mysite.local-error_log"
</VirtualHost>
```
Copy and paste the into a new file, or from my GitHub gist.
$ bash wordpress-install.sh
Voilà! A clean WordPress install.
Install your boilerplate theme
.gitconfig
c = clone --recursive
.aliases
alias g="git"
Means:
$ g c git@bitbucket.org:yourname/yourtheme.git
More time savers
# List all files colorized in long format
alias l="ls -l ${colorflag}"
# Open current directory in Sublime Text
alias s="subl ."
Cmd+T > Start typing out a filename > Enter
### Update wp-config-sample.php
Open `wp-config-sample.php` add the database information and rename to `wp-config.php`.
```
define('DB_NAME', 'databasename');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
```
!!! Be sure to add a secure username and password when live !!!
README.md
In your boilerplate theme (and pretty much any repo) it's worth having a README.md
So next time when we do `$ bower install` it automatically installs.
Yayayaya
### 2 other important files
.editorconfig
Ensure consistency throughout your team.
```
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = LF
trim_trailing_whitespace = true
[{package.json,bower.json}]
indent_style = space
indent_size = 2
```
### 2 other important files
.gitignore
Don't add files to your theme repo you don't need to.
```
### Package Managed ###
/node_modules
/bower_components
### CSS ###
.sass-cache
/css/screen.css
/css/screen.css.map
```
Styling with Sass
With gulp watch, gulp will watch for changes in the /sass folder.
With Sass it's possible to split code up into separate files called partials.