Skip to content

Instantly share code, notes, and snippets.

View micc83's full-sized avatar

Alessandro Benoit micc83

View GitHub Profile
@mboynes
mboynes / term-split-update-examples.md
Last active December 7, 2015 19:57
Term split update examples

Preparing Plugins for Term Splitting

Historically, two terms in different taxonomies with the same slug (for instance, a tag and a category sharing the slug "news") have shared a single term ID. Beginning in WordPress 4.2, when one of these shared terms is updated, it will be split: the updated term will be assigned a new term ID.

In the vast majority of situations, this update will be seamless and uneventful. However, some plugins and themes store term IDs in options, post meta, user meta, or elsewhere. WP 4.2 will include two different tools to help authors of these plugins and themes with the transition.

The 'split_shared_term' action

When a shared term is assigned a new term ID, a new 'split_shared_term' action is fired. Plugins and themes that store term IDs should hook to this action to perform necessary migrations. The documentation for the hook is as follows:

@rfvcorreia
rfvcorreia / functions.php
Created June 27, 2013 11:18
Remove Cron Job
add_action("init", "clear_crons_left");
function clear_crons_left() {
wp_clear_scheduled_hook("cron_name");
}
@rubemlrm
rubemlrm / gist:63cd8eb7e9ba10b4319d
Created September 16, 2015 11:39
Gitlab-ci.yml
before_script:
- composer install --prefer-dist > /dev/null
- export APP_ENV=testing
unitTesting:
script:
- echo "Running PHP Unit tet"
- php vendor/bin/phpunit --colors --debug --coverage-text
codeSniffer:
script:
@miziomon
miziomon / composer.json
Created July 31, 2012 15:26
WordPress MonoLog integration
{
"require": {
"monolog/monolog": "1.1.*"
}
}
@pdewouters
pdewouters / new_gist_file
Created June 21, 2013 15:00
whitelist gitignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@adampatterson
adampatterson / sample.php
Created October 18, 2017 00:50
Whoops PHP Storm Config
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
@mhedges1
mhedges1 / SeedResource.php
Last active June 5, 2020 02:50
Quickly build boilerplate for your Laravel 5.1 application's resources. Builds a Model, Migration, Controller, FormRequests, Commands, and Events in one expression. Simply place this file into App/Console/Commands/ and add " \App\Console\Commands\Resource\SeedResource::class" to your $commands array in App\Console\Kernel.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
/**
* Class SeedResource
* @package App\Console\Commands\Resource
*/
# Before Script
before_script:
- composer self-update
- composer install --prefer-dist > /dev/null
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh
# Services
services:
@jrmadsen67
jrmadsen67 / gist:bd0f9ad0ef1ed6bb594e
Last active February 15, 2022 08:41
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@anthonny
anthonny / webpack.config.js
Created March 15, 2019 14:38
Use dotenv with NativeScript
// ...
const dotenv = require("dotenv");
// ...
console.log(`Bundling application for entryPath ${entryPath}...`);
dotenv.config()
const isUppercase = key => key.toUpperCase() === key;
const envKeys = Object.keys(env);