Quantcast
Channel: Adam Cameron's Dev Blog
Browsing all 1337 articles
Browse latest View live

JavaScript: getting my brain further around bind()

G'day:I was refactoring some JS code today, and one of the refactorings was extracting an inline callback into its own separate function. This was the "success" callback for a jQuery AJAX request. The...

View Article


Maintaining untested code, and mocking too much when backfilling test (with...

G'day:Here's another example of me doing something wrong. Well: there's a litany of wrongness in this exercise, and I'll show the whole thing from start to finish. But this all stems from me ballsing...

View Article


Image may be NSFW.
Clik here to view.

PHP: Getting PHPCS and PHPMD working within PHPStorm

G'day:These are just some quick notes on installing PHP Code Sniffer and PHP Mess Detector to work within PHPStorm. There's nothing particularly elucidating in here, it's simply what I did to get it...

View Article

PHP: Strategy pattern to defer implementation details

G'day:Once again my Saturday evening is set in the local pub (well: the one in Galway I go to when I'm here anyhow. I go to this place more than I do my "local" at home), with a Guinness and the laptop...

View Article

PHP: Scaling the decorator pattern

G'day:I while back I had a look at using the Decorator Pattern to simplify some code:Using a decorator pattern to reduce inappropriate code complexityDecorator Pattern vs simple inheritanceOne again me...

View Article


PHP: constants vs private static variables and understanding the intent of code

G'day:I was looking at some code the other day, and got into a conversation with the author about it. I can't show you the actual code (and, indeed, I'll be fictionalising the content of the...

View Article

CFML (yes, shut-up): sorted struct literal syntax

G'day:Yeah, all right. I'm gonna be admonished by at least one of my mates (that's you, Brian) for writing another article about CFML, but... oh well. This is not gonna become a habit as I feel bad...

View Article

Image may be NSFW.
Clik here to view.

JavaScript TDD: getting Mocha tests running on Bamboo

G'day:We've finally having a chance to move forward with our JavaScript TDD / testing. You might have recalled that I'd lamented in the past we'd wanted to take this sort of thing more seriously with...

View Article


"There, and back again" (or: I suck at JavaScript sometimes)

G'day:Sometimes I think I'm OK at JavaScript (well: I guess I'm OK at it [he says, whilst seesawing his hand]), and then sometimes I put this to the test and conclude I'm actually a bit shit. In this...

View Article


REST & nouns & verbs: analysing the right problem

G'day:I've recently changed teams at work, and have shifted from "safe" code bases that I've either been working on daily for over a year, or new applications that I've had a hand in from the ground...

View Article

PHP: re-call the same method for the same result, or use an intermediary...

G'day:I could not fit this in a Twitter message, so I'll clutter up this joint instead. And, hey, it could use some content, I know.I recently came across some PHP code (this happens to me a lot these...

View Article

PHP / Silex / Dependency injection: should I use a reference to a method?

G'day:This is another example of where I want to put a question out there, but it needs more space that Twitter will allow. I guess I'll put it on Stack Overflow too.We use Silex and Pimple's DI...

View Article

PHP: I finally get around to seeing how PHP interacts with a DB

G'day:This is "interesting" in that I've been a PHP dev for closing in on two years now, but as yet I've not had a requirement to connect to a DB and... like... query stuff. Crazy! This is all down to...

View Article


Code quiz

G'day:Apropos of nothing, here's a code quiz.Rules:You have an array of strings, eg: ['a', 'at', 'cat', 'scat', 'catch']. Return the first value that matches a regex pattern, eg: '.+at' would match...

View Article

Looking at the code from that quiz last week

G'day:So last Fri I asked this:[...] here's a code quiz.Rules:You have an array of strings, eg: ['a', 'at', 'cat', 'scat', 'catch']. Return the first value that matches a regex pattern, eg: '.+at'...

View Article


Breaking: Groovy and Clojure answers for that array-look-up code quiz

G'day:Well it's not really that breaking really... what I mean is a coupla other people posted some answers to last week's quiz after I wrote up the results ("Looking at the code from that quiz last...

View Article

Friday code puzzle

G'day:I'm waiting for a blood test and I'm "customer number 649", and they are currently processing "customer number 541". I have dubbed this place Franz Kafka Memorial Hospital.Anyway, I have an hour...

View Article


Image may be NSFW.
Clik here to view.

Friday puzzle: my PHP answer

G'day:So as per my previous article - "Friday code puzzle" - here's my answer to the current puzzle.I knocked the first version of this out over a beer whilst waiting for my flight to Galway, last...

View Article

Image may be NSFW.
Clik here to view.

Blimey, a CFML-centric article

G'day:But it's nothing that interesting. I submitted my answer ("Friday puzzle: my PHP answer") for the Friday Code Puzzle yesterday, deciding to use PHP, given it's what I do for a crust these days,...

View Article

JS: next Friday puzzle: displaying bytes in "nearest unit"

G'day:Here's my answer for the next Friday puzzle that was posted on the CFML Slack channel. I skipped last week's one as... well... I couldn't be arsed, but this was an easy one and I could sort it...

View Article
Browsing all 1337 articles
Browse latest View live