Skip to content

Instantly share code, notes, and snippets.

View jamiehollern's full-sized avatar

Jamie Hollern jamiehollern

  • Tag1 Consulting
  • Dùn Phris/Zürich
  • 15:34 (UTC +01:00)
View GitHub Profile
@jamiehollern
jamiehollern / iOSRegex.php
Created January 20, 2016 10:07
Regular expression to get the iOS version from the user agent string in PHP
<?php
// Sample user agent strings available at http://www.webapps-online.com/online-tools/user-agent-strings/dv/operatingsystem51849/ios.
$user_agent = 'Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_3 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B511 Safari/9537.53';
// Returns 7.0 with the above user agent string.
$version = preg_replace("/(.+)(iPhone|iPad|iPod)(.+)OS[\s|\_](\d)\_?(\d)?[\_]?(\d)?.+/i", "$4.$5", $user_agent);
@jamiehollern
jamiehollern / down.sh
Created May 27, 2020 08:03
Develop Drupal contrib and emulate Travis
# Delete everything we don't need.
ls | egrep -v 'AmazeeLabs|patches|down.sh|up.sh' | xargs rm -rf
# Kill any D8 router processes.
PID=$(ps -ef | grep d8-rs-router.php | grep -v grep | awk '{print $2}')
echo $PID
if [ "$PID" ]; then
kill $PID
fi
# Clear the Composer cache so we get the latest patches etc.
COMPOSER_MEMORY_LIMIT=-1 composer clear-cache
@jamiehollern
jamiehollern / app.php
Created June 22, 2017 08:25 — forked from drefined/app.php
This is the simple silex app.
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = new Silex\Application();
#!/bin/bash
sudo apt-get update
echo '
/$$$$$$ /$$ /$$
/$$__ $$ | $$ | $$
| $$ \__/ /$$$$$$ /$$$$$$$ /$$$$$$$ /$$$$$$$ /$$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$$
| $$$$$$ /$$__ $$| $$__ $$ /$$__ $$ | $$__ $$| $$ | $$ /$$__ $$ /$$__ $$ /$$_____/
\____ $$| $$$$$$$$| $$ \ $$| $$ | $$ | $$ \ $$| $$ | $$| $$ | $$| $$$$$$$$| $$$$$$
Jamies-MBP:gdms jamiehollern$ vagrant up
Bringing machine 'gdms' up with 'virtualbox' provider...
==> gdms: Importing base box 'geerlingguy/ubuntu1604'...
==> gdms: Matching MAC address for NAT networking...
==> gdms: Checking if box 'geerlingguy/ubuntu1604' is up to date...
==> gdms: Setting the name of the VM: gdms.dev
==> gdms: Clearing any previously set network interfaces...
==> gdms: Preparing network interfaces based on configuration...
gdms: Adapter 1: nat
gdms: Adapter 2: hostonly
jamiemacbook:test-cms-fork jamie.hollern$ vagrant up
Bringing machine 'test-cms' up with 'virtualbox' provider...
==> test-cms: Cloning VM...
==> test-cms: Matching MAC address for NAT networking...
==> test-cms: Setting the name of the VM: test-cms.local
==> test-cms: Clearing any previously set network interfaces...
==> test-cms: Preparing network interfaces based on configuration...
test-cms: Adapter 1: nat
test-cms: Adapter 2: hostonly
==> test-cms: Forwarding ports...
@jamiehollern
jamiehollern / drush_config_shortcut.php
Created July 26, 2016 13:22
Drush config shortcuts for settings.local.php
<?php
// Config import shortcuts.
$dirs = array(
'base',
'dev',
'stage',
'prod',
);
foreach ($dirs as $dir) {