Skip to content

Instantly share code, notes, and snippets.

View TimothyBJacobs's full-sized avatar
:shipit:
Ship it

Timothy Jacobs TimothyBJacobs

:shipit:
Ship it
View GitHub Profile
<?php
/*
Plugin Name: Easy Digital Downloads - Variable Pricing License Activation Limits
Plugin URL: http://easydigitaldownloads.com/extension/
Description: Limit the number of license activations permitted based on variable prices
Version: 1.0
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@krogsgard
krogsgard / template-file.php
Last active January 29, 2016 17:21
Stuff for wrangling Jetpack. End result is along these lines: https://cldup.com/8x050WNF_L.png
<?php echo krogs_output_related_posts(); ?>
@ffub
ffub / gist:1084424
Created July 15, 2011 10:10
Balsamiq HTML export
#!/usr/bin/php
<?php
error_reporting(E_ALL);
if (count($argv) <= 1) {
print("usage createMockup src_dir dst_dir images_dir\n");
print("\tsrc_dir : dir where all bmml file are\n");
print("\tdst_dir : dir where write all html files\n");
print("\timages_dir : dir where all export mockup png are (will be copied to the \$dst_dir/images directory)\n");
exit(1);
}
@taylorotwell
taylorotwell / gist:68f614deb9538f2e30108c2698266fda
Last active May 28, 2020 08:41
ADR out of the box for Brandon
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
@paulgv
paulgv / vimeoPutUpload.html.twig
Last active November 12, 2020 17:58
This is a basic example of how to perform a PUT upload using jQuery.fileupload and Vimeo's API https://developer.vimeo.com/api/upload#http-put-uploading
<script type="text/javascript" src="{{ asset('jquery.fileupload/js/vendor/jquery.ui.widget.js') }}"></script>
<script type="text/javascript" src="{{ asset('jquery.fileupload/js/jquery.iframe-transport.js') }}"></script>
<script type="text/javascript" src="{{ asset('jquery.fileupload/js/jquery.fileupload.js') }}"></script>
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
<script type="text/javascript">
$(document).on('change', '.btn-file :file', function() {
var input = $(this),
numFiles = input.get(0).files ? input.get(0).files.length : 1,
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@ichikaway
ichikaway / gist:2768801
Created May 22, 2012 12:37
RecursiveIteratorIterator example
<?php
Class TableRII extends RecursiveIteratorIterator {
private $parentKey = null;
public function beginIteration() {
echo '<table border=1><tr><th>key</th><th>value</th></tr>';
}
public function endIteration() {
echo '</table>';
@westonruter
westonruter / gist:5475349
Last active August 12, 2021 07:00 — forked from markjaquith/gist:2653957
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
@justintadlock
justintadlock / font-awesome.php
Last active September 28, 2021 11:09
PHP array of Font Awesome icons.
<?php
// Font Awesome v. 4.6.
function jt_get_font_icons() {
return array(
'fa-glass' => 'f000',
'fa-music' => 'f001',
'fa-search' => 'f002',
'fa-envelope-o' => 'f003',
@jasonbahl
jasonbahl / gutenberg-page-template-switcher.js
Created May 4, 2018 21:01
Gutenberg Page Template Switcher
import gql from 'graphql-tag'
import { client } from '../utils/apollo-client'
const { parse } = wp.blocks;
const { select, subscribe, dispatch } = wp.data;
const GET_PAGE_BLOCK_TEMPLATE = gql`
query GET_PAGE_BLOCK_TEMPLATE($id: ID!, $template: String) {
page( id: $id ) {
blockTemplate( pageTemplate: $template )
}
}