Skip to content

Instantly share code, notes, and snippets.

View benklocek's full-sized avatar

Ben Klocek benklocek

View GitHub Profile
// For 403 @ /admin/settings/customerror
// Title: Access Denied
<?php global $user; // http://www.kinetasystems.com/blog/creating-custom-error-pages-in-drupal ?>
<?php if ($user->uid): ?>
<p>Sorry <?php print $user->name; ?>, you don't have permission to view the page you've just tried to access.</p>
<p>If you feel that you have received this message in error, please
<a href="/about">contact us</a> with specific details so that we may review your access to this web site.</p>
<p>Thanks</p>
<?php else: ?>
<p>This page may be available to clients and registered users only. Please select from one of the other options available to you below.</p>
@trey
trey / my_git_workflow.md
Created May 18, 2012 03:14
My Git Workflow

My (somewhat outdated) Git Workflow

Local Branches

There are some common hickups I see in the day-to-day use of Git that can be fairly easily remedied by the liberal use of local branches.

When I start any new work (or at the very least before I commit my work), I create a new local branch named for the feature on which I'm working.

$ git co -b robotic-turtles
@philfreo
philfreo / QueryStringTest.php
Created June 22, 2011 19:44
add_querystring_var() and remove_querystring_var() improvements, with tests
<?php
class QueryStringTest extends PHPUnit_Framework_TestCase {
/**
* @covers remove_querystring_var
*/
public function testRemoveQueryStringVar() {
// tests without any other querystring params
@markjaquith
markjaquith / .all
Last active October 10, 2018 15:38
Bash stuff
for f in ~/Dropbox/bash/*; do source $f; done
@cliffordp
cliffordp / functions.php
Last active May 22, 2020 21:10
The Events Calendar (V2 Views): Remove the "This event has passed." notice from single events.
<?php
/**
* The Events Calendar (V2 Views): Remove the "This event has passed." notice from single events.
*
* FYI: There are other places this same notice displays, such as embed view. To remove the notice from everywhere,
* remove the code snippet's "if..." logic.
*
* @link https://gist.github.com/cliffordp/82836c507db01515745db6e5172f4f76 This snippet.
* @link https://share.getcloudapp.com/YEud5m7d Screenshot of the notice that gets removed.
*/

Web Design Contract (open-source)

Between [your name] and [their name]

Summary:

You ([their name]), located at [customer address] are hiring me ([your name]) located at [company address] to [design and develop a web site] for the estimated total price of [total] as outlined in our previous correspondence.

What do both parties agree to do?

@cliffordp
cliffordp / functions.php
Last active August 3, 2021 09:58
The Events Calendar: v2 Views: Include the next 3 upcoming events after each post unless it's a TEC post or archive.
<?php
/**
* The Events Calendar: v2 Views: Include the next 3 upcoming events after each post unless it's a TEC post or archive.
*
* Tested working with TEC v5.1.1.
* Outputs a portion of v2's List View's HTML rendering without full styles/scripts.
* But this isn't the best way to use v2's views. For a lot of scenarios, it's better to just create your own new view.
*
* @link https://gist.github.com/cliffordp/9994cf05f6475922f451eaeacef2cd3c This snippet.
@cliffordp
cliffordp / functions.php
Last active February 8, 2022 00:11
Override The Events Calendar's V2 Views from a custom plugin location
<?php
/**
* Add your own plugin as a template override location for The Events Calendar, Event Tickets, and related plugins. Only
* for TEC's V2 Views and ET's addons/overrides of TEC's V2 Views. Still need the old snippet for overriding ET's files.
*
* Each custom array's `path` is whatever you want it to be (i.e. customizable) up until the 'v2' part of each
* template's override path. We chose to keep it as `tribe/events` and `tribe/tickets` for simplicity.
* So if the TEC location for a view is:
* /wp-content/plugins/the-events-calendar/src/views/v2/list/event/featured-image.php
* Then this plugin's override location would be:
@herewithme
herewithme / script.sh
Created November 19, 2018 16:13
Set a role for each users for all sites for WordPress Multisite
for url in $( wp site list --allow-root --field="url" --url="https://XXX" );
do
echo $url;
wp --allow-root user list --network --url="https://XXX" --field=id | xargs -I % wp --allow-root user set-role % administrator --url=$url
done;
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/