PHP7: Easiest Upgrade Yet

With PHP7 looking increasingly stable (relatively speaking, it’s still pre-alpha so it’s VERY early days and anything could happen!), and work going well on the GoPHP7-ext project to get extensions converted, I have been thinking about the migration guides we’ll need to help people upgrade their existing applications. To this end, I took the simplest project I currently have (http://api.joind.in) and gave it a whirl on PHP7, using Rasmus’ PHP7 dev box. The result:


Continue reading

Count Changed Lines in Git

I have a favourite set of switches to git log, but today I wanted to answer the question “You deleted how much code today?” so I thought I’d share how I did that

git log --numstat will show you how many lines were added (first column) and removed (next column) per file, kind of a more scientific version of the --stat switch. And if you’re thinking of scripting this to gather stats, try it with --oneline as well, it’s easier to parse.

Scaling and Sizing with PDFJam

I find myself needing to take a PDF, output it at a specific size, and have the result offset to the top right hand side of the screen. To achieve it, I needed a few new switches to my good friend PDFJam, so I thought I’d share my command!

pdfjam --suffix converted --papersize '{1920px,1080px}' --scale 0.4 --trim "-6cm -1cm 13cm 8cm" slides.pdf

The --suffix is instead of giving an output filename, whatever you feed in ends up with the suffix in its filename. This is very handy because I use this command in a script and only need to pass in one variable. The --papersize isn’t a switch I have used before either but you can set exact sizes for the final output which is nice. The --trim switch can also be used to set --clip=true to remove the trimmed space from the document if desired.

I find PDFJam a very handy tool but with not nearly enough blog posts and code snippets around, so I’m dropping my command for future reference (yours as well as mine!).

Vimdiff and Vim to Compare Files

At the moment I’m working on a tricky project where two similar projects diverged. Very similar things happened to them both, but not quite the same things – and now we’re merging the codebases to give us as much common code as possible. All this simply serves to set the scene of exactly what I was doing spending a whole day with large code diffs – I had to look up a few things so I thought I’d capture them while I can remember. Continue reading

PHP Quick Stack Trace in Exception Handler

PHP and frameworks built from it have many great tools to assist with debugging (I particularly like XDebug) but sometimes you can find yourself in a situation where the “helper” features aren’t all that much help … in my case this was a framework totally determined to output HTML from my commandline script and to only show me 5 lines of stack trace, which wasn’t enough for my complex application. I had to look up how to generate a nice stack trace inside an exception handler so here it is in case I want it again some time (future me, you’re welcome!) Continue reading

Test Incoming Webhooks Locally with Ngrok

I’m enjoying working with hubot; I have a few different instances running for different groups. One of the things that I use hubot for is to echo activities from the source control repo, the bug tracker, the CI system, the (you get the idea) into the channel for a project. This is achieved via webhooks; a feature offered by many providers to POST information about an event to your endpoint as soon as it happens. Continue reading

Organising Inclusive Events

I’ve been thinking a lot lately about what makes an inclusive event. Not gender-inclusive, necessarily (I commonly find myself as the only woman developer at both my local user groups), just approachable, maybe for newcomers but mostly for everyone. What happens at the event itself is really important, whether people greet you, whether the speakers introduce themselves, and so on. That’s only half the story though, because often we’ve excluded people from our events before the event begins. Every conversation I have about this topic comes back to information. Continue reading

Hubot with Git Submodules

I love hubot and use one in a few different places. One thing I do find though is that I often want to edit or evolve those plugins, and it seems somehow unethical to just hardcode my changes into my own repo. Once I figured out how to wire together a forked repo as a submodule, it became much easier to work with hubots with external plugins, so I thought I’d share my recipe for that. Continue reading