Skip to content

Instantly share code, notes, and snippets.

🍀
I'm working on stuff that I enjoy AND it pays the bills!

Richard Quadling rquadling

🍀
I'm working on stuff that I enjoy AND it pays the bills!
Block or report user

Report or block rquadling

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rquadling
rquadling / mb_str_pad.php
Last active Oct 7, 2019
Implementation of a multi-byte equivalent of PHP's str_pad function.
View mb_str_pad.php
/**
* Multibyte String Pad
*
* Functionally, the equivalent of the standard str_pad function, but is capable of successfully padding multibyte strings.
*
* @param string $input The string to be padded.
* @param int $length The length of the resultant padded string.
* @param string $padding The string to use as padding. Defaults to space.
* @param int $padType The type of padding. Defaults to STR_PAD_RIGHT.
* @param string $encoding The encoding to use, defaults to UTF-8.
@rquadling
rquadling / ProMiReD.md
Last active Apr 23, 2019
ProMiReD - One of many different ways to manage migrations and code.
View ProMiReD.md

ProMiReD

We needed a way to describe our pipeline deployment approach. How and when are things released. In what order do we modify the code and the database when it is not possible to do them all instantly.

And so we came up with this silly acronym. We know there are probably better approaches, but this has worked very well for us. To the point that our continuous integration and deployment pipelines can run all of these unattended, allowing our developers to develop and our reviewers to review and the poor release monkey can retire from running all those releases by hand.

Pro - Protect migrations

As migrations are developed and versioned using the current timestamp, and prior to Phinx 0.8, we needed to make sure that

@rquadling
rquadling / Dockerfile
Last active Mar 14, 2019
Adding XDebug to Bitnami's php-fpm container.
View Dockerfile
# An example Dockerfile to build a Bitnami PHP-FPM minimal container with xDebug and some other extensions installed.
# Please note, I have cobbled this together from limited understanding as well as dissecting the Dockerfiles that
# Bitnami have used.
#
# If you find problems, or suggestions, PLEASE PLEASE help me and the rest of the community with your comments,
# suggestions, fixes, etc. Let's all learn something new!!!!
#
# If you want to contact me directly, then RQuadling at the Google Mail, and I'll be happy to answer any questions.
View testCalculator.js
'use strict';
require('../../../bootstrap.js');
require(rootPath + '/src/js/lib/Calculator.js');
var calculatorDataProvider = {
'Empty calculator': {
amountDue: 0.00,
amountTenderedAfterAmountDueSet: 0.00,
changeGivenAfterAmountDueSet: 0.00,
amountTendered: 0.00,
@rquadling
rquadling / hipchat-v1.sh
Created Aug 24, 2017
Send an HTML message to HipChat using v1 of the api via cURL
View hipchat-v1.sh
MESSAGE="
<table><thead><tr><td colspan=\"2\"><b>Build starting</b></td></tr></thead>
<tbody>
<tr><td><b>Tag</b></td><td>${build_tag}</td></tr>
<tr><td><b>Built for</b></td><td>${built_for}</td></tr>
<tr><td><b>Built by</b></td><td>${built_by}</td></tr>
</tbody>
</table>
"
curl -s -X POST \
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@rquadling
rquadling / TestUTF8
Last active Aug 29, 2015
Testing PHP and unicode output.
View TestUTF8
@ECHO OFF
SETLOCAL
REM Force UTF8
chcp 65001
REM Call the script again, as chcp doesn't affect THIS context.
CALL :UTF8ready %0
GOTO Done
@rquadling
rquadling / gist_1.diff
Last active Dec 23, 2015
Patch to PHP to allow [SAPI] sections in INI files.
View gist_1.diff
diff --git a/main/main.c b/main/main.c
index 5942b23..e8171a5 100644
--- a/main/main.c
+++ b/main/main.c
@@ -2244,6 +2244,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
}
#endif
+ /* Activate SAPI specific section. */
+ if (php_ini_has_per_sapi_config() && sapi_module.name) {
You can’t perform that action at this time.