Skip to content

Instantly share code, notes, and snippets.

View maxime-rainville's full-sized avatar

Maxime Rainville maxime-rainville

View GitHub Profile
@maxime-rainville
maxime-rainville / example.conf
Created March 14, 2018 05:49
Sample apache config to always redirect to `ServerName`
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName www.example.com
ServerAlias example.com www.example.org example.org
DocumentRoot /var/www/example
# Canonical name is important otherwise SERVER_NAME will always equals HTTP_HOST
UseCanonicalName On
RewriteEngine On
RewriteCond "%{SERVER_NAME} %{HTTP_HOST}" "!(^[^ ]*) \1" [NC]
@maxime-rainville
maxime-rainville / ubuntu_post_install_script.bash
Last active July 26, 2024 09:19
Post install script to configure my workstation for PHP5.6/PHP7 development
# !/bin/bash
# Install CURL
sudo apt-get install -y curl
## ADD ADDITIONAL PACKAGES SOURCES ##
# Support for Multiple PHP version
sudo add-apt-repository -y ppa:ondrej/php
@maxime-rainville
maxime-rainville / ByUrlSegmentQueryCreator.php
Created December 14, 2017 23:30
A simple Silverstripe 4 GraqhQL QueryCreator for returning a single DataObject by some unique field.
<?php
namespace SmartCookie\GraphQL;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\OperationResolver;
use SilverStripe\GraphQL\QueryCreator;
use SilverStripe\ORM\DataObject;
use SilverStripe\GraphQL\Scaffolding\Util\ScaffoldingUtil;
@maxime-rainville
maxime-rainville / swapPHP.bash
Last active January 10, 2018 20:45
This is a simple convenience script to switch between PHP 5 and PHP 7 on UBUNTU both for the CLI and APACHE.
#!/bin/bash
###############################################################################
# This is a simple convenience script to switch between PHP 5 and PHP 7 on
# UBUNTU both for the CLI and APACHE.
#
# Just call the script with the first argument set to `apache` or `cli`. The
# script will try to dectect if you are currently using PHP 5.6 or PHP 7.1
# and switch to the other version.
#