Skip to content

Instantly share code, notes, and snippets.

View Camwyn's full-sized avatar
🐫
yup

Stephen Page Camwyn

🐫
yup
View GitHub Profile
@Camwyn
Camwyn / functions.php
Last active June 10, 2022 20:49 — forked from cliffordp/functions.php
Limit Essential Grid's WP_Query to only include posts with featured images
<?php
/**
* Limit Essential Grid's WP_Query to only include posts with featured images
*
* From https://gist.github.com/cliffordp/fbbaad70b9b8748819ac73f00260ac5e
* Similar code for Slider Revolution: https://gist.github.com/cliffordp/9f0d7cc5e86b2a721cd646d953bb1261
* Same Essential Grid code except with additional requirement to be a Featured Event from The Events Calendar: https://gist.github.com/cliffordp/a6aad3c60f469970b1ecb209d85ec755
*
* essgrid_get_posts filter is from /wp-content/plugins/essential-grid/includes/base.class.php
@Camwyn
Camwyn / functions.php
Last active June 10, 2022 20:45 — forked from cliffordp/functions.php
Limit Slider Revolution's WP_Query to only include posts with featured images
<?php
/**
* Limit Slider Revolution's WP_Query to only include posts with featured images
*
* Based on: https://gist.github.com/cliffordp/9f0d7cc5e86b2a721cd646d953bb1261
* Similar code for Essential Grid: https://gist.github.com/Camwyn/cc191bc1c95581c38f7ed5f8ba61da11
* Same Slider Revolution code except with additional requirement to be a Featured Event from The Events Calendar: https://gist.github.com/Camwyn/ce34677cafe52d46c12c11c8b9119371
*
* Tested working with version 6.5.24
@Camwyn
Camwyn / functions.php
Last active June 10, 2022 20:48 — forked from cliffordp/functions.php
Limit Essential Grid's WP_Query to only include Featured Events that have a featured image
<?php
/**
* Limit Essential Grid's WP_Query to only include Featured Events that have a featured image
*
* @link https://theeventscalendar.com/knowledgebase/featured-events/
*
* Based on https://gist.github.com/cliffordp/a6aad3c60f469970b1ecb209d85ec755
* Similar code for Slider Revolution: https://gist.github.com/Camwyn/ce34677cafe52d46c12c11c8b9119371
* Same Essential Grid code except without requirement for being a Featured Event (works for more than just The Events Calendar): https://gist.github.com/Camwyn/cc191bc1c95581c38f7ed5f8ba61da11
*
@Camwyn
Camwyn / functions.php
Last active June 10, 2022 20:46 — forked from cliffordp/functions.php
Limit Slider Revolution's WP_Query to only include Featured Events that have a featured image
<?php
/**
* Limit Slider Revolution's WP_Query to only include Featured Events that have a featured image
*
* @link https://theeventscalendar.com/knowledgebase/k/integrating-the-events-calendar-with-slider-revolution-and-essential-grid/
*
* Based on https://gist.github.com/cliffordp/30ac2152a8264ef27235b46b7d16332d
* Similar code for Essential Grid: https://gist.github.com/Camwyn/15e1936639a5ea7b1575b35f252ebd40
* Same Slider Revolution code except without requirement for being a Featured Event (works for more than just The Events Calendar): https://gist.github.com/Camwyn/d7128fb83074d75e1562adac2735a834
*
@Camwyn
Camwyn / add-export-links-to-email.php
Last active July 30, 2021 20:56 — forked from andrasguseo/add-export-links-to-email.php
Add the 'Export to Google Calendar / iCal' links to the bottom of the ticket email for Event Tickets
@Camwyn
Camwyn / example.php
Last active January 5, 2021 17:50 — forked from skyshab/example.php
Hide QR code from email if event has virtual event url
<?php
add_filter(
'tribe_tickets_plus_qr_enabled',
function( $enabled, $ticket ) {
if ( empty( $ticket['event_id'] ) ) {
return $enabled;
}
$event = tribe_get_event( $ticket['event_id'] );
@Camwyn
Camwyn / sample function with changed text.php
Last active January 24, 2020 15:31 — forked from theeventscalendar/sample functions with changed text.php
This is an example of a functions.php file with custom text added. It tries to be comprehensive and address all translation methods (contextual and singular/plural)
<?php
/*
* EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
* See the codex to learn more about WP text domains:
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
*/
function tribe_custom_theme_text ( $translation, $text, $domain ) {
// If this text domain doesn't start with "tribe-", "the-events-", or "event-" bail.
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
#!/bin/pseudo-bash
# Read through this and modify to taste.
# Tested on:
# dataset_uuid: c36a3d28-80c2-11e1-9ec6-df5bd8b43f76
# sdc:sdc:smartosplus:3.2.0
mkdir /data
useradd -d /data dev
groupadd dev
cd /data

Goal: To take this: https://graph.facebook.com/105464892820215 And derive this: America/Los Angeles From which we can then derive UTC-0800 or UTC-0700, as appropriate under the daylight madness scheme in effect on the date of interest.

It seems oddly hard to figure out what timezone a given point in space is located in. Looking around, there are only a few APIs which provide this information (http://www.earthtools.org/webservices.htm#timezone and http://www.worldweatheronline.com/time-zone-api.aspx), and only a few datasets which seem to contain it; most of them are in serious GIS formats, and expect you to query them in some manual fashion using a proprietary GIS tool.

I'm not really interested in that; I want a piece of code I can just ask "what timezone is this in" and get an answer, without installing some huge piece of software I don't have a license to or worrying about rate limits from somebody's API. So I'm going to take a shapefile I found here (http://efele.net/maps/tz/world/) and see if we can