Skip to content

Instantly share code, notes, and snippets.

View ianmjones's full-sized avatar
Proudly powered by ✨ 🦄 💩 & ☕, mostly ☕

Ian M. Jones ianmjones

Proudly powered by ✨ 🦄 💩 & ☕, mostly ☕
View GitHub Profile
@ianmjones
ianmjones / pixie-article.php
Last active August 29, 2015 14:23
A tiny little article plugin to demo Custom Post Types code to almost match Extended CPTs (no sortable admin columns or filters, and no "At a Glance" entry.
<?php
/**
* @link https://deliciousbrains.com/blog/
* @since 1.0
* @package Pixie_Article
*
* @wordpress-plugin
* Plugin Name: Pixie Article
* Plugin URI: https://deliciousbrains.com/blog/
@ianmjones
ianmjones / runNow.js
Last active April 8, 2016 12:51
Simple runNow() function for wp-cron-pixie
runNow: function() {
// Only bother to run update if not due before next refresh.
var seconds_due = this.model.get( 'seconds_due' );
if ( seconds_due > CronPixie.timer_period ) {
var timestamp = this.model.get( 'timestamp' ) - seconds_due;
this.model.save(
{ timestamp: timestamp, seconds_due: 0 }
);
}
@ianmjones
ianmjones / class-cron-pixie-construct.php
Last active April 11, 2016 10:40
Cron_Pixie::__construct
<?php
/**
* Cron_Pixie constructor.
*
* Registers all action and filter hooks if user can use widget.
*
* @param array $plugin_meta
*/
public function __construct( $plugin_meta = array() ) {
if ( empty( $plugin_meta ) ) {
@ianmjones
ianmjones / class-cron-pixie-dashboard-widget-content.php
Last active April 11, 2016 11:29
Cron_Pixie::dashboard_widget_content()
<?php
/**
* Provides the initial content for the widget.
*/
public function dashboard_widget_content() {
?>
<!-- Schedule Item template -->
<script type="text/template" id="cron-pixie-schedule-item-tmpl">
<span class="cron-pixie-schedule-display"><%= display %></span>
<ul class="cron-pixie-events"></ul>
@ianmjones
ianmjones / class-cron-pixie-enqueue-scripts.php
Last active April 11, 2016 11:30
Cron_Pixie::enqueue_scripts()
<?php
/**
* Enqueues the JS scripts when the main dashboard page is loading.
*
* @param string $hook_page
*/
public function enqueue_scripts( $hook_page ) {
if ( 'index.php' !== $hook_page ) {
return;
}
@ianmjones
ianmjones / class-cron-pixie-_get-schedules.php
Last active April 11, 2016 11:31
Cron_Pixie::_get_schedules()
<?php
/**
* Returns list of cron schedules.
*
* @return array
*/
private function _get_schedules() {
// Get list of schedules.
$schedules = wp_get_schedules();
@ianmjones
ianmjones / main.js
Last active April 8, 2016 12:48
WP Cron Pixie's Backbone.js based JavaScript
var CronPixie = CronPixie || {};
(function( $, CronPixie ) {
'use strict';
/**
* A mixin for collections/models.
* Based on http://taylorlovett.com/2014/09/28/syncing-backbone-models-and-collections-to-admin-ajax-php/
*/
var AdminAjaxSyncableMixin = {
@ianmjones
ianmjones / wp-cron-pixie.php
Created April 8, 2016 14:47
wp-cron-pixie.php
<?php
/**
* @link https://github.com/ianmjones/wp-cron-pixie
* @since 1.0
* @package Cron_Pixie
*
* @wordpress-plugin
* Plugin Name: WP Cron Pixie
* Plugin URI: https://github.com/ianmjones/wp-cron-pixie
version: '2'
services:
#
# Base services.
#
data:
image: deliciousbrains/data@sha256:6fbc27c3c84c0e4d40b261e2c8246a2065a96916481ab475facfcd6e81548f31
labels:
com.deliciousbrains.service: "data"
com.deliciousbrains.project: "${COMPOSE_PROJECT_NAME}"
#!/usr/bin/env bash
cd `dirname $0`
source ./.env
while getopts "u:p:h:d:ct:z:s:vkge:" ARG
do
case ${ARG} in
e) TEST_ENV=$OPTARG;;