Pragmatism in the real world

Hide the ST3 sidebar automatically

As a mostly keyboard user, I take advantage of the keyboard shortcuts in Sublime Text. However, the sidebar is quite a lot of effort to manage, especially as I mostly leave it closed. Firstly, you need cmd+k,cmd+b to open it. Then you type ctrl+k,ctrl+0 to focus it as opening it doesn't automatically set focus. Then you can navigate to the file you want and open it via pressing return. Finally, you type cmd+k,cmd+b to close… continue reading.

Screenshot of the active window on Mac

I find myself needing to take screen captures of the currently active window in OS X reasonably frequently. The built-in way to do this on a Mac is to use shift+cmd+4, then press space and then use your mouse to highlight the window and click. For a good proportion of the time, I'm not using a mouse, so this doesn't work great. There's a built-in command line utility called screencapture which requires you to know… continue reading.

Auto reloading a PDF on OS X

Currently, I create presentations using rst2pdf and so I regularly have vim open side by side with the Preview app showing the rendered PDF. I use a Makefile to create the PDF from the rst sources, so I just use :make in vim to rebuild the PDF file and then had to switch to Preview in order for it to reload the updated PDF file. Recently a friend wondered why the PDF viewer couldn't reload… continue reading.

Free the Geek appearance

I was delighted to spend an hour chatting with Matt Setter on episode 14 of Free the Geek. In this podcast, we talked about Slim 3 and development in general. Matthew gives me a great introduction (thanks!) and then we delve into the chat. We talk about the importance of semantic versioning as I think this is key to stability in a project. It's not very glamorous to work on code where you have to… continue reading.

Use vim's :make to preview Markdown

As it becomes more painful to use a pointing device for long periods of time, I find myself using vim more and so I'm paying more attention to customisation so that the things I'm used to from Sublime Text are available to me. One thing I'm used to is that when I run the build command on a Markdown file, I expect Marked for Mac to open and render the file that I'm writing. Vim… continue reading.

Styling rst2pdf tables

I currently use rst2pdf to create presentations slide decks from reStructured Text files. I like rST a lot as it's more expressive than Markdown and allows for extension. Tables in rST are marked up like this: +———–+———–+———–+ | Heading 1 | Heading 2 | Heading 3 | +===========+===========+===========+ | a | b | c | | | | | | aa | | | +———–+———–+———–+ | d | e | f | +———–+———–+———–+ | g… continue reading.

installing XHGui via Ansible

I'm still using Ansible to provision Vagrant VMs. This is how I added the XHGui profiler to my standard setup. Theres a number steps we need to do: Install Composer Install the uprofiler PHP extension Install XHGui Set up for profiling Set up host for XHGui website Install Composer Installing Composer requires these tasks: – name: Install Composer shell: curl -sS https://getcomposer.org/installer | php — –install-dir=/usr/local/bin creates=/usr/local/bin/composer – name: Rename composer.phar to composer shell: mv… continue reading.

Shorter directory text in Bash prompt

Rather helpfully, David Goodwin left a comment about how he shortens the space taken up by the directory section of his terminal's PS1 prompt by using a Bash script to remove the middle portion. This is a really good idea, so I ported it into my PS1 set up which resulted in some rearranging and thought I'd share here as I modified for OS X and I don't want to lose it! The relevant portion… continue reading.

Setting OS X's Terminal Tab to the current directory

I use many tabs in a Terminal window quite frequently, and while the window title will show the current directory name, the tab title doesn't. You can manually change it using shift+cmd+i, but who can be bothered? Automating it so that the tab title always matches the current directory turns out to be really easy and just requires a few lines in ~/.profile. Firstly, we need a function that sets the tab's title to the… continue reading.

Converting databases between MySQL and SQL Server

I regularly deal projects that target SQL Server, but mostly develop against MySQL to avoid having to run a full Windows stack locally all the time. One of the nice things about PHP with DBAL and Migrations is that the database is pretty well abstracted from my code. Of course, this means that I don't target any of the specialist features, but for these projects, this hasn't been an issue. To convert data from SQL… continue reading.