Skip to content

Instantly share code, notes, and snippets.

Jason Purdy purdy

Block or report user

Report or block purdy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
purdy / config.yml
Created Apr 22, 2019
This is our circleci config.yml file
View config.yml
# This is Journalistic's A&O CI workflow. Whenever we push code to github
# that's not the master branch, it needs to download the branch, push it up to
# Pantheon, create a CI environment, run the visual regression testing, and
# then run the cypress testing.
defaults: &defaults
- image:
working_directory: ~/app
purdy /
Created Apr 18, 2019
Pantheon build script for master-lite environment
# This is a daily script to build an updated master-lite database for our various pubs.
for site in site1 site2 site3
echo "Building master-lite for $site"
# First, make sure the master-lite env is woke.
echo "Making sure master-lite environment is woke - $site."
purdy / index.js
Created Aug 23, 2018
This is the Lambda function for taking SNS messages from SES and saving them into a DynamoDB table.
View index.js
var aws = require('aws-sdk');
var ddb = new aws.DynamoDB({
params: {
TableName: process.env.ddb_table_name
exports.handler = function(event, context, callback) {
var result = true;
for (var i=0, len = event.Records.length; i < len; i++) {
saveToDynamoDB(event.Records[i], context);
purdy / aws-sns-lambda-example.json
Created Aug 15, 2018
Example event from SNS when posting to Lambda
View aws-sns-lambda-example.json
"Records": [
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:us-east-1:123412341234:LambdaTesting:12b6a0a7-bbbb-ffff-cccc-7a7d21e25123",
"Sns": {
"Type": "Notification",
"MessageId": "614a0b34-bbbb-ffff-cccc-58ffddd9745f",
"TopicArn": "arn:aws:sns:us-east-1:123412341234:LambdaTesting",
View send-email.php
* Quick utility script to send email out ... before you send this out,
* run this to load up the Sendgrid API key into your environment:
* source ./sendgrid.env
* Also, this code uses composer and the sendgrid/sendgrid library:
* composer require sendgrid/sendgrid
purdy / confirm_form_example.module
Created Apr 14, 2014
confirm_form module example
View confirm_form_example.module
* @file
* confirm form example module
* */
function confirm_form_example_menu() {
$items['confirm_form_example_delete_object'] = array(
purdy / gist:3919058
Created Oct 19, 2012
Drupal drupal_write_record() recipe
View gist:3919058
function MYFORM_submit( $form, &$form_state ) {
$msg = '';
$msg_type = 'status';
$redirect = 'admin/MYMODULE/INDEX_PATH';
$action = 'save your changes';
$expected = SAVED_UPDATED;
$update_msg = 'Your changes to the %category category have been saved.';
if ( is_numeric( $form_state['values']['id'] ) ) {
$TABLE_DATA['id'] = $form_state['values']['id'];
$result = drupal_write_record( 'MYTABLE', $TABLE_DATA, 'id' );
You can’t perform that action at this time.