Skip to content

Instantly share code, notes, and snippets.

View uxjw's full-sized avatar

James Wilcox uxjw

  • Primal Communications Ltd.
  • BC, Canada
View GitHub Profile
@robhurring
robhurring / fuzzy_date.php
Created February 11, 2010 15:01
PHP fuzzy date function
<?php
function fuzzy_date($timestamp)
{
$myDays = array("Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat");
if( preg_match("/[-\/:]/", $timestamp) )
$timestamp = strtotime($timestamp);
if($timestamp > time())
// All future dates
@jakebellacera
jakebellacera / ICS.php
Last active July 26, 2024 07:48
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@joeldbirch
joeldbirch / supposition.js
Created April 12, 2013 12:22
Updated version of Supposition. This version is compatible with Superfish 1.6+. See this ancient page for description, example and caveats: http://users.tpg.com.au/j_birch/plugins/superfish/supposition-test/
/*
* Supposition v0.3a - an optional enhancer for Superfish jQuery menu widget
*
* Copyright (c) 2013 Joel Birch - based on work by Jesse Klaasse - credit goes largely to him.
* Special thanks to Karl Swedberg for valuable input.
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
@nateswart
nateswart / com.nateofnine.FlaggedEmailToReminder.plist
Created January 9, 2014 03:54
plist to run this AppleScript every minute via launchd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>com.nateofnine.FlaggedMailToReminders</string>
<key>Program</key>
<string>/usr/bin/osascript</string>
@idleberg
idleberg / Install-Mcrypt.md
Last active May 31, 2023 17:13
Install Mcrypt on macOS

Setup php-mcrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew and PECL (comes with PHP)

# PHP 7.3
@yratof
yratof / functions.php
Created March 25, 2015 16:43
Advanced Custom Fields - Update Gallery with Gravity Forms
$gravity_form_id = 6; // gravity form id, or replace {$gravity_form_id} below with this number
add_filter("gform_after_submission_{$gravity_form_id}", 'jdn_set_post_acf_gallery_field', 10, 2);
function jdn_set_post_acf_gallery_field($entry, $form)
{
$gf_images_field_id = 42; // the upload field id
$acf_field_id = 'field_54804833b3067'; // the acf gallery field id
// get post
@wpchannel
wpchannel / mu-yoast-seo-disable-notifications.php
Last active April 16, 2023 08:33
Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices
<?php if (!defined('ABSPATH')) die('Restricted Area');
/*
* Plugin Name: Disable Yoast SEO Notifications
* Description: Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices.
* Version: 1.1
* Author: Aurélien Denis
* Author URI: https://wpchannel.com/
*/
@codearachnid
codearachnid / filter_gf_select_optgroup.php
Last active July 16, 2024 15:51
Add the optgroup ability to Gravity Forms default select field.
/**
* Filter Gravity Forms select field display to wrap optgroups where defined
* USE:
* set the value of the select option to `optgroup` within the form editor. The
* filter will then automagically wrap the options following until the start of
* the next option group
*/
add_filter( 'gform_field_content', 'filter_gf_select_optgroup', 10, 2 );
function filter_gf_select_optgroup( $input, $field ) {
@sjaved87
sjaved87 / change_theme_on_all_subsites.php
Last active July 12, 2016 06:22
This mu-plugin will switch theme on all subsites (except main site) at once. Just change the theme directory slug, save chagnes and move it to wp-content/mu-plugins folder (create if not exists). Be care full if you have hundreds of sites then its not the right approach (will take some time and needs some resources) but good for handsome sites, …
<?php
function wpmu_change_theme_on_all_subsites(){
global $switched;
$theme_directory_slug = 'twentyfourteen';
$sites = wp_get_sites( $args );
if($sites){