Skip to content

Instantly share code, notes, and snippets.

View andrewadcock's full-sized avatar

Andrew Adcock andrewadcock

View GitHub Profile
@andrewadcock
andrewadcock / simplesaml nginx config
Created August 28, 2019 12:56
simplesaml nginx config
server {
listen 80;
server_name www.{{WEBSITE}}.com {{WEBSITE}}.com;
return 301 https://{{WEBSITE}}.com$request_uri;
}
server {
error_log /var/log/nginx/{{WEBSITE}}.log warn;
access_log /var/log/nginx/{{WEBSITE}}.access;
listen 443 ssl http2;
/**
* Implements hook_webform_submission_presave().
*
* If changes to establishments are made during AAP, save them to node before
* form is complete
*
* @param WebformSubmissionInterface $webform_submission
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
@andrewadcock
andrewadcock / simple-clean-phone.php
Last active July 4, 2016 18:14
Simple Clean Phone Output
/*
* Pass in the phone number in it's natural state, return the numeric only version or pass 'true' as the second parameter and get ther anchor tag as well
*/
function aad_clean_phone( $number_to_clean, $return_type = false ) {
// Simple regex removes any non-numeric characters
$clean = preg_replace( '/\D/', "", $number_to_clean );
// Return full anchor tag is $return_type is true, else just return the stripped phone number