♫ I am a bard from a land far away, ♫ Where elePHPants frolick, code, and play. ♫ I muse and I croon about frivolous things, ♫ Like PSRs, RFCs, and PHP kings. (Follow @phpbard on Twitter)
Don't wanna be here? Send us removal request.
Text
Coding in the Night
To the tune of "The Music of the Night" from The Phantom of the Opera.
Workday’s over; full of much distraction. Deadline’s looming; Need a plan of action? Afraid of consequences, when known your small offense is...
Slowly, gently, night unfurls its splendor. Worry, hurry, they’ll know you’re a pretender. Wave family goodbye, there’s no time for lullabies. There is work to do and so much code to write. You’re going to go coding in the night.
Set your IDE to your favorite dark mode theme. Drink caffeine until you can blink no more. Crank up your music and close your office door! And you’ll code like you’ve never done before.
What have you done? It is really late now. Working late is normally not allowed. But things are going well; it’s like you are under a spell, In this darkness, you feel notably more bright. The enlightenment of coding in the night.
Let IntelliSense guide you through each line of code, And refactor the tech debt from before. Let your fingers type ‘till your mind is free! Only then, will this feature be complete.
Write some tests now: unit, integration. Run them. Debug them, until green indication. People won’t disturb you; no problem will deter you; You’ll code ‘till every function seems just right. That’s the beauty of coding in the night.
You, alone, without the sun’s harsh light, Will get stuff done while coding in the night.
2 notes
·
View notes
Text
The Real Stars: DevOps
To the tune of Stars, from Les Miserables.
There, deep in my logs, A rogue instance failing. Gone from my cluster; Gone from Terraform state. I check all the blogs. I can't find the “Why” Till I ask my teammate, And my ego deflate.
They know their way in the Cloud. Mine is the way of the code. Those who follow the path of DevOps, They sure have a tough road. And when nodes fail as this server failed, Their phones start to explode!
DevOps, a rare breed, it’s true. Scaling software Automated through config, only they can write. I need those engineers, Speedy and smart, Keeping watch in the night, Making sure things work right.
They know the commands to run. They know which logs must be read. And when problems arise (and they will), They will keep a straight head. And when nodes fail as my servers fail, It won’t be so widespread!
And so I say "thanks", because it’s thankless, When they save me from my own mistakes. And those that think that they always know better Will have the headaches!
Before I break things, Help me to make things That don't cause alarms. Then they might find rest, And then there’ll be time To vacation afar!
1 note
·
View note
Text
Why Don’t We Rewrite the Code?
To the tune of Rewrite the Stars, from the Greatest Showman.
You know I want to. It's not a secret I try to hide, But you don’t want me (to). You keep saying it’s not worth a try, Just look in our backlog. If we don’t add these stories now, We probably never will. Let’s take action, less talk. Let’s get started right now, oh wow, Before this goes downhill.
What if we rewrite the code? We know that the tech debt’s too high. Throw out all this stuff that is old. We’d be the heroes, yes, you and I. It’s up to you, and it’s up to me, We won’t even tell anybody. So why don’t we rewrite this code? We could just do it in Node, Tonight.
You think it’s easy? You think I don’t want to do it too? But there is logic, And tribal knowledge not known to you. I know you’re wondering why, Because our new code is so Easy, you'll see, It won’t take long. Cause if you give this a try, In a week, you will know That you were horribly wrong.
No one can rewrite this code. I don’t want to be the bad guy. There aren’t enough tests in the world To cover the smells that we will find. It’s not up to you; it’s not up to me. Our boss won’t approve something this carefree. How could we rewrite this code? Don’t you dare try to be this bold Tonight.
All I want is to pair with you, And build something cool with you. So just let me see this through. It feels impossible (it’s not impossible) Is it impossible? Say that it’s possible!
Why don’t we rewrite this code? We won’t really know ‘till we try. Create new abstractions and flows. We’ll both optimize and simplify! It’s up to you, and it’s up to me. And even though it won’t come for free, Come on let’s rewrite this code, Reduce our cognitive load…
You know I want to. It’s not a secret I try to hide. But I can’t let you. Things will break and deadlines will slide.
0 notes
Video
youtube
You're Doin' Git!
Written and performed by Jeremy Lindblom at php[tek] 2014
git help, config, and init. remote, fetch, pull, let's edit. diff, add, status, commit. you're doin' git.
log, branch, checkout, that's it! checkout, merge, rebase, don't quit. clean, reset, tag, push those bits! you're doin' git! you're doin' git.
fork and clone all the repos you know, submit pull requests, you'll steal the git show. you're doin' git. you're doin' git. you're doing it! check git blame and see your username. hope you ran the tests before your commit, or your friends will think you're an idiot. you're doin' git. you're doin' git. you're doin' git. you're doin' git.
exit.
0 notes
Video
youtube
A little song about Swagger in the middle of my Laracon 2016 presentation.
0 notes
Video
youtube
I sang (and cried a little) during the closing of PNWPHP 2015
0 notes
Text
It Feels Great to Decorate!
An epic poem about the Decorator design pattern.
I write lots of code, and I often rely On the Decorator Pattern to get by.
It's a design pattern straight from the Gang of Four, And it's really quite simple. Let me tell you more.
Decorating objects can help you out. You don't need to extend. It's a different route
To add on behavior or to make a change. It's a SOLID approach that's not too strange.
And decorators can be used a lot; With Iterator objects, or others you've got
That have an Interface declared. Let's take a closer look, so you need not be scared.
The Iterators feature in PHP, Is a good example for us to see.
An Iterator, you know, is a class that can be Used in a foreach, yielding value and key.
There's a base interface, that describes the way To work with the concrete iterators in play.
Implementing this base are two SPL types: LimitIterator receives little hype.
This little gem, simply limits the count Of the items yielded, when traversing about.
The other is the CallbackFilterIterator, Which is yet another useful collaborator.
This one drops items that do not return true When passed into the callback provided by you.
But what if we want both these features together? To limit and filter our items. Now, whether
We really want to, we most certainly cannot Make a class that extends both iterators we've got.
But fear not! For as I earlier alluded Decorators solve many problems, this included.
We can decorate an object, to add new behavior. So, we'll just do it twice to our iterator.
We'll wrap it once, to filter things out. We'll wrap it again, to limit the count.
We can decorate as many times as we need To the desired effect that will help us succeed.
There's no need to extend; we simply compose, Injecting the object we want to enclose.
The decorator then applies it's logic When we use it, just like the original object.
This is possible, because the interface is the same As the decorated object implements by name.
The decorator then acts as a proxy of sorts, Delegating the methods that the interface supports.
And it intercepts the ones it wants to augment. For iterators, this is usually the method current().
Decorators can be applied in other use cases, And caching is one I've seen in a few places.
Let's say, we have an object that makes a calculation. The math is too hard, so I'll skip that explanation.
We have an interface for this calculator of sorts, So it's usage is clear to its object cohorts.
There’s a calculate() method that takes one argument, And returns the result, after some time is spent.
The result is the same, as long as you call With the same argument; it won't change it all.
So, why do the work a second or third time? That would be a punishable crime!
Instead we make an object with which to decorate, And cache the result that we calculate.
That way subsequent calls will complete a lot faster, And our use of the calculator won't be a disaster.
To make our new class, we code to its interface, and we write a constructor with which to encase
The original object, which we'll use in our code. But we'll look in the cache first to reduce our load.
Our new calculate(), will see if we know The result for the argument in the current workflow.
If we've got it, then great, we'll return straight away. If not, then to the decorated class we'll relay.
Then we'll take the result and store it for later, So the next time we'll know how to better cater
To the caller using our calculator. (Whew!) Let's give a big hand to the pattern: Decorator.
4 notes
·
View notes
Link
We're In The Git Log, a parody of We Are The Champions (by Queen). Lyrics previously posted. Sung by Jeremy Lindblom (@jeremeamia). Filmed by Phil Sturgeon at the 2015 Pacific Northwest PHP Conference social event.
0 notes
Text
We Love Our PHP
A lovely, barbershop ballad about my favorite programming language, PHP.
A long time ago, on the interwebz, There was a man named Rasmus who stood up and said, "I need some better tools to make my homepage." So he wrote some code in C, which humbly set the stage...
For PHP. P—H—P—! We would not be here together, but for PHP. Whether hobby or profession, We give our firm confession, That we love our P—H—P—.
A few years later two guys stepped up to the plate. Andy and Zeev wanted to make PHP great. They helped rebuild the engine, and founded Zend, To help ensure our favorite language would not meet its end.
So PHP, P—H—P—, Is still going strong today, yes PHP. Whether you're using version seven, Or five-point-four-eleven, We still love our P—H—P—.
Recently, we've seen some great things come about. Composer, FIG, and frameworks have all helped us out. And our communities are growing, both in-person and online. With new features and performance upgrades all the time.
Yes PHP, P—H—P—, Will be here for while (hashtag #JobSecurity). So whether you're using Symfony, Or Zend Framework at your company, Wordpress for your freelance gig, Static pages gen'd from Twig, Laravel for routing actions, Magento processing transacitons, Guzzle making web requests, Or PHPUnit writing suites of tests; You should simply be elated, By what you have created, Using our beloved P—H—P—. We love our P—H—P—.
7 notes
·
View notes
Text
Parody #4 - We're In the Git Log
To the tune of We Are The Champions by Queen.
Fork and git clone. composer install. Now your dependencies. You've got'em all. Go write some code. Don't forget tests. Then git add, commit, and push, now look at that, It's your pull request!
(Get a plus-one and move on! Move on! Move on! Move on!)
We're in the Git log, my friends. Code contributed 'till the end. We're in the Git log! We're in the Git log! Unless it is rebased, we're in the Git log Of this repo!
Checkout a new branch. Fix a bug or two. Go add a line in the CHANGELOG about it. Hey, look at you! You've got GitHub green squares On every day last week. Now update your docs, and tag a release. It's an open source streak!
(But miss a day and then it's gone! It's gone! It's gone! It's gone!)
We're in the Git log, my friends. Code contributed 'till the end. We're in the Git log! We're in the Git log! Unless it is rebased, we're in the Git log Of this repo!
We're in the Git log, my friends. Code contributed 'till the end. We're in the Git log! We're in the Git log! Unless it is rebased, we're in the Git log...
0 notes
Text
Pacific Northwest PHP Song
It's true that I helped my friend Jeremy create A song for his Kickstarter video; it's great! So go watch their video, it isn't too late. You still have a few days to promote and donate.
The Pacific Northwest PHP (PNWPHP) conference Kickstarter
Lyrics
Well, up here in Seattle, We've got lots of tech companies. And we've got some PHP user groups Full of many talented peeps.
So we want to do something special To bring in knowledge from afar, To dispense to all our locals, And fraternize with PHP stars.
We want to have a conference, But we've got no money! So we're looking for some backers To make real our PHP dream.
So, please help us make it happen: Pacific Northwest PHP! And join with us next summer In the Emerald City.
0 notes
Audio
Bubble, a parody of Trouble (by Coldplay) about Exceptions (the kind you throw). Lyrics previously posted. Sung by Jeremy Lindblom (@jeremeamia). Mixed by Jared Nielson. Karaoke track by APM Karaoke.
1 note
·
View note
Audio
Legacy PHP
(To the tune of Jingle Bells)
Scrolling through the code, And debugging on the way. Looking at my vim window, I found, to my dismay,
A double dollar sign, Wrapped with braces, in a string. Why on earth was this designed To use interpolating?
Oh—, legacy— PHP—, var_dump your array. Are you still defining constructors By the class name? Not OK. Lame!
Legacy— PHP—, Globals aren't the way! Inheriting this old code base Makes me want to run away.
Refactoring the code, Adding tests along the way. Now it's in a Git repo, And improving every day.
Let's use a library Via composer install. My tests are green, and now I see It's not so bad at all.
Oh—, legacy— PHP—, You're slowing going away. I was in the depths of misery, But I now have time to play. Yay!
Legacy— PHP—, Curse the day that you were made! I'll keep hacking and refactoring, That's how I will get paid—!
12 notes
·
View notes
Text
Parody #3 - Bubble
To the tune of Trouble by Coldplay.
Oh no, I see— An Exception thrown that wasn't caught by me. And I have a catch, But what I thought was thrown and what was do not match.
Oh no, what's this? A condition that I didn't account for. If these docs are true, Clearly I have found a new issue.
And I never meant to let it bubble, And I didn't think my code was wrong. How did I let this Exception bubble? Now there's a bunch of crud all in my logs.
Oh no, I see— An Exception thrown that wasn't caught by me. So I'm glad I made— A handler, so I don't cause 500s.
Finally, I never meant to let it bubble, And I didn't think my code was wrong. How did I let this Exception bubble? Now there's a bunch of crud all in my logs.
Please show the trace to me. This code disgraces me. Please don't replace me.
0 notes
Text
An ElePHPant Named Guzzle

This is a story about an elePHPant named Guzzle. She consumes lots of data. But how? It's no puzzle.
Armed with HTTP, she knows how to transport Text and files of any size and sort.
From client to server, and from server to client, Her requests and responses are RFC compliant.
And beyond the basics of just cookie and header. There's much more to Guzzle that just makes her better:
From parallel requests, from events and plugins, To web service descriptions. And this just begins…
To show you all that Guzzle can do To help you consume your web services too.
First shown in @jeremeamia's lightning talk Guzzle Makes HTTP Not Hard
3 notes
·
View notes
Text
My Proposal to SunshinePHP 2015
SunshinePHP, here's my submission. I hope 'twill not be an omission.
Here is the title (please don't berate): "It Feels Great to Decorate".
And now the abstract I'll begin (And yes, it rhymes from start to end):
I'm not an expert, but I oft rely On the Decorator Pattern to get by.
Decorating classes can help you out Without extension, and, without a doubt,
To add on behavior or to make a change. It's a SOLID approach that's not too strange.
So let us talk about this technique For about an hour, though we could spend a week.
For Decorators can be used a lot; With Iterators, Streams, and ev'rything you've got
That has an Interface declared. Let's discuss, so we can be prepared!
Thank you for your consideration Of my Decorator Pattern presentation.
0 notes