Categories
Workflow

Mac – Random Loss of Apache

Mac hung this morning. After rebooting (twice) and restarting Apache still had no httpd service.

Needed to separately run:

sudo apachectl stop
sudo apachectl start

Categories
Workflow

Squashing Git Commits

Assuming none pushed to origin.

git rebase -i HEAD~n where n is number of recent commits to squash.

Vim will show commits from oldest to newest.

  • i to enter interactive mode.
  • make changes. Esc to leave interactive mode
  • :w to write
  • : x to execute (remove space between : x. Preventing emoji render)

PICK the oldest (first line).  SQUASH the subsequent commits.

Do a similar thing with Vim to edit the new commit message (interact, save, execute)

Categories
PHP Workflow

Local Mac PHP issues

Update March 2019

brew services restart php@7.2

I was trying to change PHP settings, to be able to experiment with Xdebug profiling.

phpinfo() shows that it loads /usr/local/etc/php/7.1/php.ini , which is true, but didn’t seem the case because changes were not taking affect after restarting PHP and Apache.

I was restarting the wrong PHP with brew services restart php71. Even stopping it has no effect.
So that’s not the version that Apache is pointing to. It uses some other instance of the service that I don’t know how to restart without doing the whole computer!

Do this

sudo brew services restart php@7.1
brew services list can also be useful, or even brew services list | grep php

Categories
Workflow

Mac Homebrew Dev Environment Stuff

Restart Apache
sudo apachectl restart

Apache Config
/usr/local/etc/apache2/2.4

Categories
Workflow

KEYBOARD LAYOUT

Left Alt + Shift to revert to correct keyboard layout.

I never remember this.

Categories
Servers Workflow

Manually Backup Site & MySQL from Command Line

(e.g. WordPress site)

Tar Gz Directory

  • Go to /var/www
  • tar -zcf ../mysite_today.tar.gz public_html
    • (-z compress; c create file; f archive file name)
    • contains public_html in archive.
  • Download with WinSCP

MySQL

mysqldump -u username -p dbname | gzip > myexport.sql.gz

Type your password. Done.

Categories
Workflow

Windows Keyboard Layout Shortcut

I accidentally swap to a European keyboard layout. A lot.

[code]Left Alt + Shift[/code]

Categories
Workflow

MD5/Sha1 File Checksums on Windows

  1. Get this tool from Microsoft
  2. cmd: fciv.exe –add my_file.txt -sha1 (omit -sha1 for md5 default)
Categories
Workflow

Exit Gulp Command

If your gulp.js has a “watch” it’ll continue running to monitor changed files.

To exit back to the command prompt press Ctrl+C

Categories
Responsive Workflow

Responsive Design – Test a Batch of Media Queries

The handy window.matchMedia JavaScript method lets you test a media query against the current viewport.

I made a little tool to test a batch of media queries at once. It simply iterates an array and reports success/failure.

Note that results won’t be accurate when a vendor prefixed media query is unsupported.

Responding

Run the test page here & now

Have your way with this tool on Github.