If you need to order results from a MySQL query by a specific field value first then there’s a couple of approaches you can use. Let’s use as an example a table of countries where we want to order alphabetically but put the United Kingdom first.
PHP traits provide a convenient means of sharing methods between classes. There are times though that we may need to override or extend a method defined in a trait attached to a class. Let’s take a look at how we can achieve this.
Using CDNs is great for improving site performance and lowering bandwidth usage on your server. However, they can also open up a security hole in your site. Troy Hunt has written a great piece about how you can protect your embedded content with subresource integrity.
The SRI Hash Generator website is a great resource for getting started with using subresource integrity (SRI).
I’ve written a piece on my Test Payment Cards cheat sheet for Smashing Magazine explaining the motivations behind it. You can read Testing Credit-Card Numbers In E-Commerce Checkouts over on the Smashing Magazine website now.
I’ve just released a new beta version of arc_meta for Textpattern 4.6.
As with the previous beta release, this one has a minimum requirement of Textpattern 4.6 which is also still in beta release; so neither of them are recommended for use on a live production site. However, if you use arc_meta and are testing the new version of Textpattern please check out this new release.
I’m a keen advocate for following coding standards. They help maintain consistency in code, especially when developing with others, and can generally help you to write better code. I work with Sublime Text for developing in PHP and have it set up to check against whichever coding standard I am currently using as I code. For PHP development the tool to use is PHP CodeSniffer which I’ve previously written about setting up for Sublime Text 3 on this site.
TinyMCE’s pagebreak plugin is a handy way of providing users a way of marking breaks in content by placing a HTML comment in the source code denoting the break. However, if you are using the editor’s
valid_elements attribute to restrict HTML elements used in the content (a good idea if you don’t want all sorts of messy markup getting added) you need to make sure you allow comment tags.
Earlier today I found myself needing to configure Rocketeer to deploy to a server that required commands to be run with
sudo. I’m not sure that this is particularly well documented so I thought I’d share how I did this here.
Fed up with searching for documentation of test payment cards for specific payment gateways the other day I decided to start compiling a cheatsheet of them. It can be frustrating trying to figure out what card numbers can be used for testing especially considering the many poorly documented payment gateways out there. So I created the Test Payment Cards cheatsheet repository.