Ubuntu PHP FPM Update

The latest package update for php-fpm on Ubuntu is a bit messy to install if you’re listening on a unix socket. The service will restart and change the permissions on the socket to only be accessible to root, which means unless you’re running your webserver as root (please don’t), it won’t be able to run any PHP.

You can manually change ownership or permissions to give your web server user read/write access, but when the service restarts, it will fail again. The best way to fix the issue is to uncomment these lines in your pool.d file (changing owner, group, and permissions when necessary):

listen.owner = www-data
listen.group = www-data
listen.mode = 0666

Makin' Bacon Pancakes for 10 hours

I’ve successfully listened to the entire 10 hour version of the Ryden Ridge remix of Bacon Pancakes.

There’s nothing interesting, it’s literally just the same few lines over and over for 10 hours with some nice background music.

When Shane Makes Bread

:P

Regular Expression Lookarounds

Let’s keep this simple.

  • (?=pattern) positive lookahead
  • (?!pattern) negative lookahead
  • (?<=pattern) positive lookbehind
  • (?<!pattern) negative lookbehind

Lookarounds can be nested, and lookbehinds can generally only be of a fixed length.

Where available, you can use lookarounds with grep -P. The -o flag will only output the match, instead of the full matching line.

That’s all.

Sublime Text Plugins

I use several plugins every day in Sublime Text 3 that I’ve grown very used to having, and now find I couldn’t work without them. I last updated this post on April 21, 2016.

  • Package Control
    • This one is essential for any Sublime Text user, and makes installing other plugins very simple and fast.
  • Git, SidebarGit, or SublimeGit (commercial) from Package Control
    • All can be used together, or just pick the one you prefer
  • GitGutter
  • SublimeLinter - I use these sub-plugins:
    • SublimeLinter-php
    • SublimeLinter-jshint (Requires Node.js, npm install -g jshint)
  • DocBlockr
  • Markdown Preview
  • XDebug Client

Code formatting is also nice sometimes, these are great for that:

  • HTML-CSS-JS Prettify
  • Indent XML
  • JsFormat

And if you’re using languages not natively supported by Sublime, here are some great packages:

  • SCSS
  • LESS
  • INI
  • ApacheConf.tmLanguage

I use the Soda Dark theme, installable via Package Control, with a modified Monokai color scheme that increases the contrast.

Here’s my User Preferences file, with the parts requiring custom packages removed:

{
    "auto_complete_commit_on_tab": true,
    "auto_find_in_selection": true,
    "auto_match_enabled": true,
    "copy_with_empty_selection": true,
    "default_line_ending": "unix",
    "ensure_newline_at_eof_on_save": true,
    "font_face": "Menlo",
    "font_options": [
        "grey_antialias"
    ],
    "font_size": 9,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "ignored_packages": [
        "Vintage"
    ],
    "save_on_focus_lost": true,
    "shift_tab_unindent": true,
    "show_encoding": true,
    "show_full_path": true,
    "trim_trailing_white_space_on_save": true,
    "word_wrap": true
}

This used to, but no longer includes my absolute favorite code font, ProFont, designed to be incredibly readable at small sizes. Use ProFontIIx if you’re on Mac, it’s beautiful. I’ve since switched to Menlo, because I’m working longer days and can’t focus on tiny text that long anymore :(

Also note the save_on_focus_lost option, which does exactly what it says it will.

I also have custom hotkeys for SublimeGit commands, which I have bound to G-keys on my Logitech keyboards, as well as re-bindings of Ctrl+Tab and Ctrl+Shift+Tab that make more sense to me.

Windows keymap:

[
    { "keys": ["ctrl+,"], "command": "open_file", "args": {"file": "$packages/User/Preferences.sublime-settings"} },
    { "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" },
    { "keys": ["ctrl+k", "ctrl+m"], "command": "toggle_minimap" },
    { "keys": ["ctrl+tab"], "command": "next_view" },
    { "keys": ["ctrl+shift+tab"], "command": "prev_view" },

    { "keys": ["ctrl+shift+g", "l"], "command": "git_pull" },
    { "keys": ["ctrl+shift+g", "p"], "command": "git_push" },
    { "keys": ["ctrl+shift+g", "a"], "command": "git_add_current_file" },
    { "keys": ["ctrl+shift+g", "s"], "command": "git_status" }
]

OS X keymap, including adjustments to Home and End keys:

[
    { "keys": ["super+k", "super+m"], "command": "toggle_minimap" },
    { "keys": ["super+tab"], "command": "next_view" },
    { "keys": ["super+shift+tab"], "command": "prev_view" },

    { "keys": ["super+shift+g", "l"], "command": "git_pull" },
    { "keys": ["super+shift+g", "p"], "command": "git_push" },
    { "keys": ["super+shift+g", "a"], "command": "git_add_current_file" },
    { "keys": ["super+shift+g", "s"], "command": "git_status" },

    { "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
    { "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
    { "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
    { "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } },
    { "keys": ["super+home"], "command": "move_to", "args": {"to": "bof"} },
    { "keys": ["super+end"], "command": "move_to", "args": {"to": "eof"} },
    { "keys": ["super+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true} },
    { "keys": ["super+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} }
]