Skip to content

Instantly share code, notes, and snippets.

View phillipadsmith's full-sized avatar

Phillip Smith phillipadsmith

View GitHub Profile
@phillipadsmith
phillipadsmith / abstract-tracking.js
Created February 28, 2020 18:45
abstract-tracking.js
var adCampaignPicoHandler = function(){
var REGISTERED_EVENT_CAPTURED = "ad-reg-event-captured";
var PAID_EVENT_CAPTURED = "ad-paid-event-captured";
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
@phillipadsmith
phillipadsmith / download_user_data_from_slack.js
Created November 13, 2019 18:41
Quick and dirty client-side script to download names and titles from a Slack channel
// In the Web UI for Slack, navigate to a channel, click on "See All Members"
// and then scroll until you've hit the end of the list
// Open your browser's console and run this
var NameAndTitles = document.getElementsByClassName('c-base_entity__text-contents')
var NamesData = [];
for (var i=0; i < NameAndTitles.length; i++) {
var title = NameAndTitles[i].getElementsByClassName('c-member__title')[0];
@phillipadsmith
phillipadsmith / chartbeat.html
Last active July 14, 2016 22:31
Chartbeat weirdness
<script type='text/javascript'>
var _sf_async_config = _sf_async_config || {};
/** CONFIGURATION START **/
_sf_async_config.uid = #####; //CHANGE THIS
_sf_async_config.domain = 'YourDomain.com'; //CHANGE THIS
_sf_async_config.useCanonical = true;
_sf_async_config.sections = 'Change this to your Section name'; //CHANGE THIS
_sf_async_config.authors = 'Change this to your Author name'; //CHANGE THIS
/** CONFIGURATION END **/
(function() {
@phillipadsmith
phillipadsmith / .htaccess
Created November 19, 2015 19:46
Example .htaccess for prerender.io
<IfModule mod_headers.c>
#RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
<IfModule mod_proxy_http.c>
RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator [NC,OR]
@phillipadsmith
phillipadsmith / README.md
Last active August 29, 2015 19:35
Canada's GHGs since 1990

Canada's Greenhouse Gas Emissions

A quick look at Canada's GHG emissions since 1990.

@phillipadsmith
phillipadsmith / README.md
Created August 29, 2015 19:11
Test block!

hello markdown

Keybase proof

I hereby claim:

  • I am phillipadsmith on github.
  • I am phillipadsmith (https://keybase.io/phillipadsmith) on keybase.
  • I have a public key whose fingerprint is 25F7 F458 C261 B25B 5297 8F0A 518B F15D D63C 5D49

To claim this, I am signing this object:

@phillipadsmith
phillipadsmith / gist:4126431
Created November 21, 2012 17:47
A hack that let's the Wordpress JSON-API plug-in play nicely with Co-authors Plus
diff --git a/wp-content/plugins/json-api/models/post.php b/wp-content/plugins/json-api/models/post.php
index 4a8c492..c5b28cb 100644
--- a/wp-content/plugins/json-api/models/post.php
+++ b/wp-content/plugins/json-api/models/post.php
@@ -18,7 +18,6 @@ class JSON_API_Post {
var $modified; // String (modified by date_format query var)
var $categories; // Array of objects
var $tags; // Array of objects
- var $author; // Object
var $comments; // Array of objects
if ($_SERVER['REMOTE_ADDR']=='127.0.0.1') {
define('WP_ENV', 'local');
} elseif ($_SERVER['HTTP_HOST']=='develop.project.com') {
define('WP_ENV', 'develop');
} elseif ($_SERVER['HTTP_HOST']=='master.project.com') {
define('WP_ENV', 'develop');
} else {
define('WP_ENV', 'production');
}
@phillipadsmith
phillipadsmith / geocoder-british-columbia.pl
Created August 29, 2012 20:52
Example of using Google Maps geocoder and the Represent API to return a provincial riding name based on a partial address string
#!/usr/bin/perl
use strict;
use warnings;
use v5.14.2;
use Google::GeoCoder::Smart;
use LWP::Simple;
use JSON;
use Data::Dump qw(dump);