Skip to content

Instantly share code, notes, and snippets.

View sidharrell's full-sized avatar

Sidney Harrell sidharrell

  • Vivian-Harrell Web Development Studios, LLC
  • Harpers Ferry, WV, United States
View GitHub Profile
@sidharrell
sidharrell / espresso_delete_orphaned_session_transients.php
Created February 9, 2015 17:08
Delete orphaned session transients
/**
* espresso_delete_orphaned_session_transients
* @param int $expired_session_transient_delete_query_limit
*/
function espresso_delete_orphaned_session_transients( $expired_session_transient_delete_query_limit ) {
global $wpdb;
// DELETE ORPHANED SESSION TRANSIENTS
$SQL = "
SELECT option_name
FROM wp_options
@sidharrell
sidharrell / espresso-delete-transients.php
Created February 9, 2015 17:10
Delete Expired EE4 Session Transients plugin
<?php
/*
Plugin Name: Event Espresso - Delete Expired EE4 Session Transients
Plugin URI: http://www.eventespresso.com/
Description: Deletes Expired EE4 Session Transients. Requires version of Event Espresso 4 and greater.
Version: 0.0.1
Author: Event Espresso
Author URI: http://www.eventespresso.com
Copyright (c) 2014 Event Espresso All Rights Reserved.
@sidharrell
sidharrell / gist:54c9cf75f6328f35c4b3
Last active August 29, 2015 14:15
debug to file
if(\Drupal::service('kernel')) { // make a conditional test for debug or not
ob_start();
// insert var below
var_dump(true);
// insert var above
$data = ob_get_clean();
$fp = fopen("textfile.html", "a");
// write $data or custom string, ie "I'm here".
fwrite($fp, "true");
<?php
use Drupal\Core\Config\Schema\SchemaCheckTrait;
/**
* Implements hook_drush_command().
*/
function ef_drush_command() {
$items['schema-validate'] = [
'description' => dt('Validates all config schemaj'),
];
@sidharrell
sidharrell / gist:7b63c4c24aeb453bb8dd
Created March 22, 2015 22:12
spotify alarm command
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri string:spotify:user:sidharrell:playlist:2ycW6R4SRTPEIFru2YB2Uq
@sidharrell
sidharrell / gist:ebe5e09e8fde8225d44b
Created March 25, 2015 00:29
fstab entries for external drives
UUID=0367-83D9 /home/sidney/Mount/video_fiction_2 vfat async,auto,rw,user,uid=1000,gid=1000 0 0
UUID=F474B7AA74B76DCC /home/sidney/Mount/mix ntfs async,auto,rw,user,uid=1000,gid=1000 0 0
UUID=A2E8CC08E8CBD925 /home/sidney/Mount/video_fiction_1 ntfs async,auto,rw,user,uid=1000,gid=1000 0 0
UUID=9B98-9ADB /home/sidney/Mount/video_nonfiction_1 vfat async,auto,rw,user,uid=1000,gid=1000 0 0
UUID=4C77-09B3 /home/sidney/Mount/video_nonfiction_2 vfat async,auto,rw,user,uid=1000,gid=1000 0 0
@sidharrell
sidharrell / setupd8
Last active March 20, 2016 19:14 — forked from timplunkett/setupd8
Reinstall D8
#!/bin/bash
# edits if using:
# current hostname: dev01.vhwebdev.com
# this only affects the message output with the link to the new site, not any functionality
# current local git clone of Drupal 8: /home/$user/Development/drupal
# you will need to locally clone drupal 8. It's a lot more efficient on whatever hosts drupal's git repo.
# current OS: Centos6
# you would need to modify it to work on straight apache2 on Ubuntu, or make a symlink of /etc/httpd to /etc/apache2
# and modify the apache2 main conf file to pick up .conf files in /etc/httpd/conf.d/
# You will need to put https://gist.github.com/sidharrell/47767f2bb468ec65a84d , the template file,
@sidharrell
sidharrell / template
Last active October 20, 2016 23:55
vhost template
<VirtualHost *:80>
ServerName XXXXXX.localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/XXXXXX/htdocs
LogLevel warn
ErrorLog "|/sbin/cronolog /var/www/XXXXXX/logs/%Y/%m/%Y-%m-%d-error.log"
CustomLog "|/sbin/cronolog /var/www/XXXXXX/logs/%Y/%m/%Y-%m-%d-access.log" combined
<Directory /var/www/XXXXXX/htdocs/>
RewriteEngine on
RewriteBase /
@sidharrell
sidharrell / gist:be2cc397ba2e6827fbab
Created March 15, 2016 10:22
minimum mysqld settings. /etc/my.cnf
[mysqld]
## General
ignore-db-dir = lost+found
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
tmpdir = /var/lib/mysqltmp
performance_schema=off
innodb_buffer_pool_size=5M
@sidharrell
sidharrell / setupd8
Last active March 21, 2016 10:29
setupd8.ubuntu
#!/bin/bash
# edits if using:
# current hostname: localhost
# this only affects the message output with the link to the new site, not any functionality
# current local git clone of Drupal 8: /home/$user/Development/drupal
# you will need to locally clone drupal 8. It's a lot more efficient on whatever hosts drupal's git repo.
# current OS: Ubuntu
# requires pwgen, drush, sed, awk, git
# requires the template at https://gist.github.com/sidharrell/47767f2bb468ec65a84d in /etc/apache2/sites-available/template
# requires a "127.0.0.1 *.localhost" in /etc/hosts to fix firefox problem