Skip to content

Instantly share code, notes, and snippets.

View greggles's full-sized avatar

Greg Knaddison greggles

View GitHub Profile
@greggles
greggles / covid19apps.md
Last active November 10, 2020 18:23
Some information on covid19 apps in the USA 🇺🇸

List of Coronavirus Apps

  • State
  • App links with rating + number of reviews
  • Consulting provider, if known
  • Technologies (GPS, GAEN, TCN, etc.)
  • Date launched
  • Screenshots (followup)
  • What is their diagnosis key server?
```
ddev exec drush config-import -y --source=../config/default
+------------+--------------------------------------------------------------------------+-----------+
| Collection | Config | Operation |
+------------+--------------------------------------------------------------------------+-----------+
| | core.entity_form_display.paragraph.two_column_paragraph_group.default | Delete |
| | core.entity_view_display.paragraph.two_column_paragraph_group.default | Delete |
| | core.entity_form_display.paragraph.three_column_paragraph_group.default | Delete |
| | core.entity_view_display.paragraph.three_column_paragraph_group.default | Delete |
| | field.field.paragraph.three_column_paragraph_group.field_paragraph_group | Delete |
<?php
print "<pre>";
$urls = [
[
'url' => 'https://badssl.com/',
'expected_http' => 200,
'expected_curl_errno' => 0,
'expected_curl_error' => '',
sudo netstat -plunt | grep LISTEN | grep -v :: | awk -F/ '{print $1 " " $2}' | awk -F: '{print $2 " " $3}' | awk '{print $1 "\11" $6}' | sort -n
@greggles
greggles / php-7-probo.yaml
Created March 7, 2017 20:12
this probo.yaml snippet will install and configure php 7 for probo.ci
- name: Add php7
plugin: Script
script: |
echo 'exit 0' > /usr/sbin/policy-rc.d
apt-get update
apt-get install -y software-properties-common language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y php7.0 libapache2-mod-php7.0 php7.0-gd php7.0-curl php7.0-json php7.0-mbstring php7.0-mysql php7.0-mcrypt php7.0-imagick php7.0-dev php7.0-gmp php7.0-xml php7.0-bcmath php7.0-redis php7.0-uploadprogress php7.0-soap php7.0-pgsql
cp /etc/php5/mods-available/general_settings.ini /etc/php/7.0/apache2/conf.d/20-general_settings.ini
@greggles
greggles / gist:f6110e6a593109a7227c
Last active January 14, 2016 21:35
Mac: Check a ticket sales website every 30 seconds and when tickets go on sale, play a sound and open chrome to buy the tickets
# This url happens to be for a Tedeschi Trucks Band concert.
# You can go to any concert you want.
# But you *should* go to a Tedeschi Trucks Band concert at least once in your life.
watch -n 30 "curl -s https://events.applauze.com/events/3083244 | grep -i 'Coming Soon' || open -a Google\ Chrome https://events.applauze.com/events/3083244 ; say 'tickets are for sale' "
@greggles
greggles / gist:df1faa38ab27798e8e38
Last active November 12, 2015 18:37
Which database methods in Drupal are used most often?
# Grep for db_select and grab the next 5 lines
# grep and sed those lines to find db methods
# isolate the methods
# count them.
# I ran this in the core: modules/ directory, would be interesting to see results from a mix of sites/all/modules/ directories
➜ grep -hr -A 5 "db_select" . | grep "\->" | sed 's/^[ ]*//' | sed 's/\$[a-z]*//' | grep "^-" | awk -F\( '{print $1}' | sort | uniq -c | sort -rn
184 ->condition
168 ->fields
87 ->addField
70 ->execute
@greggles
greggles / find-drupal-files-by-where-they-are-being-used.php
Last active March 5, 2016 00:17
Finds Drupal files by name and lists out where they are being used (i.e. what nodes or users are associated with it)
<?php
// Save this, edit it and then...
// Run this with something like drush -v @sitename scr filename.php
// If a file is found and known to be in use, the use will be listed as an array of data.
// Edit the "card-1.xls" part.
$fid = db_query("SELECT fid FROM {file_managed} WHERE filename = 'card-1.xls'")->fetchField();
if ($fid) {
$file = file_load($fid);
@greggles
greggles / gist:dc14aba7222c2cece348
Created May 1, 2015 21:25
Find code style errors in modules in the subdirectory
find . -type d -d 1 -exec phpcs --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,js,css,info,txt' --report-file={}_new.txt {} \;
# typical output:
# mani:contrib-patched greggles$ ls -lS *.txt
# -rw-r--r-- 1 greggles staff 10970 May 1 15:21 password_policy_style_issues.txt
# -rw-r--r-- 1 greggles staff 4887 May 1 15:21 code_coverage_style_issues.txt
# -rw-r--r-- 1 greggles staff 2681 May 1 15:21 quantcast_style_issues.txt
# mani:contrib-patched greggles$
diff --git a/sites/all/modules/custom/card_member/card_member.form.inc b/sites/all/modules/custom/card_member/card_member.form.inc
index 6b6fe25..f62abf5 100644
--- a/sites/all/modules/custom/card_member/card_member.form.inc
+++ b/sites/all/modules/custom/card_member/card_member.form.inc
@@ -13,11 +13,11 @@ function card_member_notifications($form, &$form_state, $account, $category = 'a
array(':uid' => $account->uid))->fetchField();
$default_values = isset($result) ? unserialize($result) : '';
$mail_choices = array(
- 'Activation Outreach',
- 'Training Outreach',