Skip to content

Instantly share code, notes, and snippets.

View tommaitland's full-sized avatar

Tom Maitland tommaitland

  • Raisely
  • Melbourne, Australia
View GitHub Profile
@tommaitland
tommaitland / campaign-dev-tasks.md
Last active November 10, 2019 06:05
Campaign Development Tasks

These are some of the things you might do each day working as our Campaign Developer at Raisely. Tell us out of this list two things you are excited about, two things you want to learn how to do and two you don't want to do.

  • Customising one of our pre-built themes to suit a customer's brand and campaign
  • Building a special kind of campaign leaderboard as a component in React
  • Brainstorming how to add a unique campaign requirement into Raisely, with only a day to complete it
  • Integrating Raisely to Salesforce, via Zapier
  • Building a suite of Google Cloud Functions in Node to send automatic e-cards to donors
  • Helping a customer create a rapid-response campaign to a current crisis, on a tight deadline
  • Looking at data (SQL or spreadsheets) to figure out the A/B test to set up in Google Optimize
  • Running a scoping call with a customer to figure out all the details about their campaign

These are some of the things you might do each day working in support at Raisely. Tell us out of this list two things you are excited about, two things you want to learn how to do and two you don't want to do.

  • Responding to 20 support emails
  • Running a training webinar
  • Importing data into a new Kepla account
  • Writing a new support article on how to optimise your donation form
  • Updating the developer docs to cover a new release
  • Create a video tutorial on how to set up a campaign
  • Recruit a new team member
  • Handle an upset customer worried about a missing feature
@tommaitland
tommaitland / instructions.md
Created January 20, 2016 00:00
NationBuilder Access Token

Get the access code

https://{SLUG}.nationbuilder.com/oauth/authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT}

Get access token

curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --data '{"grant_type":"authorization_code", "client_id":"{CLIENT_ID}", "client_secret":"{CLIENT_SECRET}", "redirect_uri":"{REDIRECT}", "code":"{CODE}"}' https://{SLUG}.nationbuilder.com/oauth/token

@tommaitland
tommaitland / nationbuilder-signup.js
Last active July 30, 2017 01:13
Code to provide callbacks and override how NationBuilder processes signups through AJAX
$(formSelector).submit( function(event) {
// Store the original NB function in a temp variable
var tmp = window.NB.EventHub.dispatch;
/**
* $(this) / $form is the entire signup form. onsubmit changes can be made by finding inputs/children
*
* ie. $form.find('input[type="submit"]').val('Loading');
*
@tommaitland
tommaitland / bulk-resize.php
Created December 24, 2013 03:02
A very crude WordPress plugin to search through imported content and replace full size images with a resized counterpart.
<?php
/*
Plugin Name: Bulk Attachment Resize
Description: Destructive operations on DB to replace full images with their resized version.
Author: Agency
Version: 1.0.0
Author URI: http://agency.sc
*/
@tommaitland
tommaitland / get-first-image.php
Created December 17, 2013 07:55
WordPress helper function that retrieves the first image from a post, with basic support for swapping the image size.
<?php
/*
Based on the original CSS-Tricks code (http://css-tricks.com/snippets/wordpress/get-the-first-image-from-a-post/)
## Usage
Include in functions.php
<?php echo get_first_image('thumbnail'); ?>
@tommaitland
tommaitland / list-subpages.php
Last active December 31, 2015 11:39
Basic subpage listing in WordPress
<?php
// List subpages on parent and child page. Outputs ul > li.
$child_of = ($post->post_parent > 0) ? $post->post_parent : $post->ID;
if ($child_of > 0 && is_page()) {
wp_list_pages('title_li=&child_of='.$child_of);
}
@tommaitland
tommaitland / ng-debounce.js
Last active November 9, 2018 02:17
Debounce/Throttling Directive for Angular JS 1.2+
angular.module('app', []).directive('ngDebounce', function($timeout) {
return {
restrict: 'A',
require: 'ngModel',
priority: 99,
link: function(scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;
elm.unbind('input');
<?php
$gallery = get_children( 'posts_per_page=5&post_type=attachment&post_mime_type=image&post_parent=' . $post->ID );
$attr = array(
'class' => "attachment-$size wp-post-image",
);
foreach( $gallery as $image ) {
echo '<a href="' . wp_get_attachment_url($image->ID) . '" rel="gallery-' . get_the_ID() . '">';
echo wp_get_attachment_image($image->ID, 'thumbnail', false, $attr);
echo '</a>';
}
@tommaitland
tommaitland / carousel-options.js
Last active December 20, 2015 12:29
How to use Carousel - http://carousel.io