Recover Bitly Bundle Data

For some years I've been creating a bundle of links covering articles I recommend for various topics in the Zend Certified Engineer Exam (if you can here looking for the bundle itself, it's at http://www.lornajane.net/zce-links-collection). This was done using bitly's bundles feature, which I thought was a great way to share links. In fact I had 10-15 bundles that I had created from collating all the links in a particular training course or talk, so that people didn't have to try to write down URLs as I went along. Unfortunately they sunset their bundles and then removed them completely, and I missed the announcement (it all happened quite quickly, they'd seen some abuse of the feature, it's free, all totally reasonable) BUT they also didn't respond to my support questions about how to recover the data.

It turns out, it's an undocumented feature on their API, so here is everything I know about recovering your bundle data, including the script I used to rescue my own data. Continue reading

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