Skip to content

Instantly share code, notes, and snippets.

View DragonBe's full-sized avatar
:octocat:
The next step…

M van Dam DragonBe

:octocat:
The next step…
View GitHub Profile
@DragonBe
DragonBe / php_apache_homebrew.md
Last active November 20, 2022 18:15
Installation of Apache 2.4 and PHP 7.1 with Homebrew

I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install.

The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands.

I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial.

Apache and PHP with homebrew

I’ve made this according to the installation instructions given on GetGrav.

@DragonBe
DragonBe / php_conferences_fall_2017.md
Last active June 29, 2017 16:46
Overview of PHP conferences in the fall of 2017
@DragonBe
DragonBe / SortableDirectoryIterator.php
Created June 22, 2017 21:23
Sortable DirectoryIterator based on last modification time
class SortableDirectoryIterator extends RecursiveDirectoryIterator
{
/**
* \ArrayObject
*/
private $dirArray;
public function __construct(string $path)
{
parent::__construct($path);
@DragonBe
DragonBe / FinalClass.php
Created July 20, 2017 15:05
Testing final classes is tricky, but possible even though you cannot directly mock a "final" class
<?php
namespace FinalClass;
require_once __DIR__ . '/vendor/autoload.php';
use PHPUnit\Framework\TestCase;
final class Foo
{
protected $bar;
@DragonBe
DragonBe / plugins.txt
Created September 7, 2017 18:51
Jenkins plugins preloader for Jenkins Docker image
ant
bouncycastle-api
build-timeout
checkstyle
cloverphp
crap4j
credentials-binding
credentials
docker-commons
docker-workflow
@DragonBe
DragonBe / dnt-check.php
Created October 20, 2017 08:34
Functionality to verify if "Do not track" is set in the browser configuration.
<?php
/**
* Functionality to verify if "Do not track" is set
* in the browser configuration.
*/
if (array_key_exists('HTTP_DNT', $_SERVER) && (1 === (int) $_SERVER['HTTP_DNT'])) {
echo 'Do not track me enabled';
} else {
echo 'Do not track me disabled';
@DragonBe
DragonBe / azure-sdk-commands.md
Created December 1, 2017 08:38
Basic Microsoft Azure CLI/SDK commands to quickly launch a web app on Azure cloud services
azure login
azure group create -t project=<project_name> <group_name> westeurope
azure appserviceplan create <group_name> <service_name> westeurope F1
azure webapp create <group_name> <app_name> westeurope <service_name>
azure webapp config set --phpversion 7.1 --detailederrorloggingenabled true <group_name> <app_name>
@DragonBe
DragonBe / Vagrantfile
Created January 19, 2018 16:26
A quick-and-simple VM with PHP 7.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.host_name = "phpvm"
config.vm.box_check_update = false
config.vm.network "private_network", ip: "192.168.33.67"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
@DragonBe
DragonBe / Vagrantfile-php7.2
Created March 20, 2018 09:29
A quick Vagrant file to get started with PHP 7.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
@script = <<SCRIPT
# Fix for https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1561250
if ! grep -q "ubuntu-xenial" /etc/hosts; then
echo "127.0.0.1 ubuntu-xenial" >> /etc/hosts
fi
@DragonBe
DragonBe / gitarchive.sh
Created June 7, 2018 07:47
Creating a GPG signed archive of your GIT source code with SHA 256 checksums in bash
#!/bin/bash
# Getting the current project's directory
pf=$(printf '%q\n' "${PWD##*/}")
# Getting the current configured user's email
gpguser=$(git config user.email)
if [ -z $gpguser ]
then
echo "!!! ERROR: No user for GIT configured !!!"