# Photoshop Patterns, Homestead Provisioning, Composer Basics

- Link: https://cagrimmett.com/2016/02/13/patterns-homestead-composer/
- Published: 2016-02-13T05:00:00-05:00
- Author: Chuck Grimmett

### Today I learned:

#### Tiling Photoshop Patterns

I’ve been [making some patterns](http://bgpatterns.com) for the header images on
these TIL posts in my down time the past few days. There are two ways to tile patterns
in Photoshop. One is manual and time consuming, the other is fast, easy, and less
prone to error.

 * The manual, time consuming way is to open a pattern in one layer, duplicate the
   layer multiple times, and move the layers so that they line up in a tiling pattern.
   While PS is pretty great at snapping items to a grid, sometimes they don’t always
   line up and you only find out after you export the image.
 * The fast and easy way is to open the pattern in PS, go to _Edit > Define Pattern…_,
   then use the _Pattern Stamp Tool_ to paint the pattern you just created across
   a large canvas.

This would have saved me a lot of time on the first nine headers, but c’est la vie.
This will definitely save me time going forward.

---

#### Homestead Provisioning

I use [Laravel Homestead](https://laravel.com/docs/master/homestead) for my local
PHP environment. Provisioning a new site is something I’ve done multiple times, 
but I do it so infrequently that I have to look it up each time. So here are my 
quick notes:

 * Create the site folder in `~/Projects/`
 * Map the folder and domain in `~/.homestead/Homestead.yaml`
 * Map the domain to `192.168.10.10` in `/etc/hosts/` (reminder: `$ sudo nano /etc/
   hosts/`)
 * Run `$ cd ~/Homestead`
 * Run `$ vagrant up --provision` or `$ vagrant reload --provision` if vagrant is
   already running.
 * Site should now be accessible locally.

If you need a new database for this site and load it from a SQL dump:

    ```bash
    $ vagrant ssh $ mysql -u homestead -p -e 'create database DBNAME;' $ mysql -u homestead -p  DBNAME < path/to/file.sql
    ```

---

#### Composer Basics

[Composer](http://getcomposer.org) is a dependency manager for PHP. I’ve used Composer,
but like Homestead provisioning above, I’m a little rusty. Writing it down helps
me remember.

After you’ve installed it (I have it installed [globally](https://getcomposer.org/doc/00-intro.md#globally)),
the basic usage is:

 * Set up `composer.json` in the directory you are working on. A basic structure
   looks something like this:

    ```language-json
    {     "require": {         "ajt/guzzle-toggl": "^0.10.0",         "corneltek/getoptionkit": "~2"     } }
    ```

 * In that directory, run `$ composer install` to install the dependencies listed
   in `composer.json`. They will be in a file called `vendor`.
