Skip to content

Instantly share code, notes, and snippets.

View greg-1-anderson's full-sized avatar

Greg Anderson greg-1-anderson

View GitHub Profile
@greg-1-anderson
greg-1-anderson / gist:56d640c4c6c067b479d0
Last active August 29, 2015 14:19
Convert 'drush cc all' into 'drush cache-rebuild' on Drupal 8 sites.
<?php
// Put this in ~/.drush/policy.drush.inc
function policy_drush_command_alter(&$command) {
if (($command['command'] == 'cache-clear') && (drush_drupal_major_version() >= 8)) {
$command['command'] = 'cache-rebuild';
$command['command-hook'] = 'cache-rebuild';
$command['primary function'] = FALSE;
$command['arguments'] = array();
drush_set_command($command);
}
@greg-1-anderson
greg-1-anderson / gist:fb1dba054c35c46af644
Last active November 22, 2016 11:43
Workaround for lack of ssl support at fastly for updates.drupal.org
<?php
// Place in $HOME/.drush/drushrc.php
// OBSOLETE workaround for lack of SSL cert handling at fastly for updates.drupal.org.
// Running without ssl exposes you to man-in-the-middle attacks, so REMOVE THIS, since
// https support is now unofficially provided again.
// $command_specific['pm-download']['source'] = 'http://updates.drupal.org/release-history';
#!/usr/bin/env php
<?php
/**
* This script will download and install https://github.com/pantheon-systems/wp-native-php-sessions
* on your Pantheon Wordpress site.
*
* Works on Macintosh / Linux.
*
* Usage:
*
@greg-1-anderson
greg-1-anderson / pantheon-database-access.php
Created July 22, 2015 23:29
Proof-of-concept script to access Pantheon Database, e.g. for recovery. We need more info from Terminus before this is generally useful
<?php
$self=array_shift($argv);
$prefix="wp_";
while (count($argv) > 0) {
$arg = array_shift($argv);
if ($arg[0] == '-') {
switch ($arg) {
case "--port":
@greg-1-anderson
greg-1-anderson / rmwysiwyg.drush.inc
Last active August 29, 2015 14:26
DEPRECATED: Remove wysiwyg profiles prior to running `drush rs`
<?php
// n.b. there is a better way:
//
// https://gist.github.com/greg-1-anderson/a57271f74981de32b878
/**
* If any active input filters have wysiwyg profiles,
* then ask the user if they should be removed.
*/
@greg-1-anderson
greg-1-anderson / mycustommodule.module
Created August 7, 2015 02:17
Disable wysiwyg profiles when running with the php built-in webserver to avoid problems
<?php
// When running via the php built-in webserver, disable wysiwyg profiles
function mycustommodule_boot() {
if (php_sapi_name() == 'cli-server') {
cache_set('wysiwyg_profiles', array());
}
}
$ phpunit -c core --filter UnroutedUrlAssemblerTest
PHPUnit 4.8.11 by Sebastian Bergmann and contributors.
.....................FF..
Time: 5.63 seconds, Memory: 144.75Mb
There were 2 failures:
1) Drupal\Tests\Core\Utility\UnroutedUrlAssemblerTest::testAssembleWithLocalUri with data set #11 ('base:core/authorize.php', array(), false, 'core/authorize.php', '/core/authorize.php')
@greg-1-anderson
greg-1-anderson / btool-converge.log
Last active November 17, 2015 20:28
btool converge -s
$ btool converge -s
Converging on the command line is dangerous since it does not check if a converge is in progress in jenkins. Are you sure you don't want to run converge within jenkins?
Please confirm that you want to do this (yes/no). yes
Converging site 180788fb-b5ce-4dd3-9b9e-1cccdff62c20 environment dev
{"max_bindings": "", "run_list": ["recipe[endpoint::bindings]"], "binding_id": "3e13d6e5ab8d4c5db2f9f26c75432625"}
/tmp/1447792009.22_3e13d6e5ab8d4c5db2f9f26c75432625_bindings.json
Starting Chef Client, version 12.4.1
Compiling Cookbooks...
Recipe: chef_handler::default
* remote_directory[/var/chef/handlers] action create
@greg-1-anderson
greg-1-anderson / fastcgi_params
Created November 18, 2015 19:20
fastcgi_param for Pantheon
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
@greg-1-anderson
greg-1-anderson / keybase.md
Created July 26, 2016 18:53
Keybase identity verification

Keybase proof

I hereby claim:

  • I am greg-1-anderson on github.
  • I am greg1anderson (https://keybase.io/greg1anderson) on keybase.
  • I have a public key whose fingerprint is 5345 348A BEC7 B3DD ADBB F996 2850 D252 D5F5 25A6

To claim this, I am signing this object: