Skip to content

Instantly share code, notes, and snippets.

View jasonlancaster's full-sized avatar

Jason Lancaster jasonlancaster

View GitHub Profile
@jasonlancaster
jasonlancaster / terminus-blind-update.sh
Last active January 26, 2021 14:56
Terminus/Pantheon blind automated deploy from dev to live
#!/bin/bash
# just a quick script i wrote to meet need to sometimes blind update a site with zero code review/testing :( but :)
# sometimes steps must be delayed due to pantheon not responding right away without a little delay in script timing (like committing and then immediately pushing)
# Jason Lancaster jlancaster@lmdagency.com
DELAY=10
function sleepme() {
echo "### sleeping for $DELAY seconds ###"
sleep $DELAY
}
@jasonlancaster
jasonlancaster / check-all-pantheon-sites.sh
Last active November 18, 2019 19:57
Run through terminus output for pantheon live sites you access to and report on any security updates
#!/bin/bash
# exec on cmd line running ./check-all-pantheon-sites.sh
#
# Script will run through terminus output for pantheon live sites you access to and
# will report on modules requiring security updates. The awk process in each ends up
# limiting output to only things that require security updates.
#
# This is the kind of script that could email you nightly or you can just run when
# you perform routine updates. If emailing, you'd want to suppress output for sites
# that don't have any updates so that's TBD if we work on this more.
@jasonlancaster
jasonlancaster / pantheon-redirect-all-admin.php
Created June 27, 2019 20:34
Redirect all prod Drupal access to dev or alt environment
// Redirect user/admin pages to dev site while we are in active dev
/*
if ((
$_ENV['PANTHEON_ENVIRONMENT'] === 'live' ||
$_ENV['PANTHEON_ENVIRONMENT'] === 'test'
) && (
(strpos($_SERVER['REQUEST_URI'], '/user') !== false) ||
(strpos($_SERVER['REQUEST_URI'], '/admin') !== false)
)) {
echo 'https://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
@jasonlancaster
jasonlancaster / responsive-video-resize.js
Created May 9, 2019 14:32
Resize videos responsively
// ----------------------------------------
// Find all YouTube and Vimeo videos
var $allVideos = $(“iframe[src*=’www.youtube.com'], iframe[src*=‘player.vimeo.com’]“);
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
$(this)
.data(‘aspectRatio’, this.height / this.width)
// and remove the hard coded width/height
.removeAttr(‘height’)
terminus remote:wp journalism.dev -- plugin update --all