Photoshop Patterns, Homestead Provisioning, Composer Basics

February 13, 2016
Category: TIL
Tags: Apps and PHP

Today I learned:

Tiling Photoshop Patterns

I’ve been making some patterns 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 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:

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

Composer Basics

Composer 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), the basic usage is:

  • Set up composer.json in the directory you are working on. A basic structure looks something like this:
{
    "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.

Find this post useful?

Buy me a coffeeBuy me a coffee