Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / tribe-ical-alarm.php
Created May 5, 2012 03:17
Add alarm to The Events Calendar Pro WP Plugin
<?php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_add_alarm', 10, 2 );
function tribe_ical_add_alarm( $item, $eventPost ) {
$alarm = tribe_get_custom_field( 'Alarm', $eventPost->ID );
if ( !empty( $alarm ) && is_numeric( $alarm ) ) {
$item[] = 'BEGIN:VALARM';
$item[] = 'TRIGGER:-PT' . $alarm . "M";
$item[] = 'END:VALARM';
}
@afragen
afragen / tribe-events-calendar-pro-modevent.php
Created May 9, 2012 23:59
Modify the DESCRIPTION of generated ical feed
<?php
//Add to your theme's functions.php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_modify_event', 10, 2 );
function tribe_ical_modify_event( $item, $eventPost ) {
$searchValue = "DESCRIPTION";
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $item);
$key = array_values($fl_array);
$keynum = key($fl_array);
@afragen
afragen / deploy.sh
Created May 11, 2012 02:34
Git -> Subversion one-step deployment script
#! /bin/bash
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.
# main config
PLUGINSLUG="the-events-calendar-pro-alarm"
CURRENTDIR=`pwd`
MAINFILE="the-events-calendar-pro-alarm.php" # this should be the name of your main php file in the wordpress plugin
# git config
@afragen
afragen / tribe-google-calendar-event-strip-tags.php
Last active October 5, 2015 05:47
Truncate the details parameter of Google calendar link to 1000 characters.
<?php
//Add the following to your theme's functions.php
add_filter( 'tribe_google_calendar_parameters', 'tribe_google_calendar_link_modify', 10, 2 );
function tribe_google_calendar_link_modify( $params ) {
$mod = urldecode( $params['details'] );
$mod = strip_tags( $mod );
$mod = str_replace( ' ', '+', $mod );
unset($params['details']);
$params['details'] = $mod;
@afragen
afragen / webcal.html
Created May 24, 2012 22:16
iCal subscribe link for The Events Calendar PRO
<!--
I've added the following link in The Events Calendar Settings > Templates > Display after calendar field. You'll obviously need to change the href to your site.
-->
<a href="webcal://troop262ps.org/events/ical/" class="ical">iCal Subscribe</a>
@afragen
afragen / tribe-ical-outlook-modify.php
Last active June 8, 2022 21:07
Modify Event Calendar iCal feed properties for Outlook
<?php
//Add the following to your theme's functions.php
add_filter( 'tribe_ical_properties', 'tribe_ical_outlook_modify', 10, 2 );
function tribe_ical_outlook_modify( $content ) {
$properties = preg_split ( '/$\R?^/m', $content );
$searchValue = "X-WR-CALNAME";
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $properties);
$key = array_values($fl_array);
$keynum = key($fl_array);
@afragen
afragen / tribe-ical-fix-endDate.php
Created June 8, 2012 02:02
Fix the endDate in ECP iCal feed.
<?php
//Add to theme functions.php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_fix_endDate', 10, 2 );
function tribe_ical_fix_endDate( $item, $eventPost ) {
$searchValue = "DTEND;VALUE";
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $item);
$key = array_values($fl_array);
$keynum = key($fl_array);
@afragen
afragen / pf.conf
Created July 27, 2012 16:38
pf action.d filter for fail2ban
# Fail2Ban configuration file
#
# OpenBSD pf ban/unban
#
# Author: Nick Hilliard <nick@foobar.org>
# http://pastebin.com/wXESQ1b4
#
[Definition]
@afragen
afragen / iOS.css
Created September 21, 2012 16:41
The Events Calendar: iOS CSS media queries
/* iPad [portrait + landscape] and iPhone [portrait + landscape] */
@media only screen and (min-device-width: 320px) and (max-device-width: 1024px) {
/* code here */
}
/* iPad [portrait + landscape] */
@media only screen and (device-width: 768px) {
/* code here */
}
@afragen
afragen / iPhone.css
Created September 21, 2012 17:46
The Events Calendar: iPhone CSS
/* iPhone [portrait + landscape] */
@media only screen and (max-device-width: 480px) {
body { min-width: 550px; }
.tribe-events-thismonth, .tribe-events-othermonth { min-width: 50px; max-width:60px; }
#tribe-events-calendar-header { padding-top: 3em; }
.tribe-events-calendar-buttons { top:0; left:0; }
.tribe-events-calendar-widget td a.tribe-events-mini-has-event { cursor: pointer; }
}