Skip to content

Instantly share code, notes, and snippets.

View aristath's full-sized avatar
🏠

Ari Stathopoulos aristath

🏠
View GitHub Profile
@aristath
aristath / helperEl.js
Last active August 28, 2019 12:05
simple jQuery alternative for common functions, inspired by http://youmightnotneedjquery.com/
/* eslint no-unused-vars:off */
var fusionHelperEl = {
/**
* Find an element.
*
* @param {string|Object} selector - The css selector of the element.
* If object then it can either be document or an element.
* @param {Object} parent - The parent element, or undefined for document.
* @return {Object} - returns the fusionHelperEl object to allow chaining methods.
*/
<?php
/**
* Plugin Name: parent-theme-mods-loader
*/
add_action(
'customize_register',
/**
* Hooks in customize_register to load our control, register settings and do what needs to be done.
*
<?php
/**
* Requires ariColor: https://aristath.github.io/ariColor/
*/
add_action( 'wp', function() {
if ( ! class_exists( 'ariColor' ) ) {
return;
}
$colors = [];
var Colour = function( rgba ) {
var rgbaString = '';
if ( 'transparent' === rgba ) {
rgba = [ 0, 0, 0, 0 ];
} else if ( 'string' === typeof rgba ) {
rgbaString = rgba;
rgba = rgbaString.match( /rgba?\(([\d.]+), ([\d.]+), ([\d.]+)(?:, ([\d.]+))?\)/ );
if ( rgba ) {
rgba.shift();
Anonymous UUID: DEC44D6A-D5F1-35D4-FC46-A6E021923230
Tue Jul 24 11:20:44 2018
*** Panic Report ***
Machine-check capabilities: 0x0000000000000c0a
family: 6 model: 70 stepping: 1 microcode: 25
signature: 0x40661
Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
10 error-reporting banks
$wpe_common = WpeCommon::instance();
foreach ( array( 'trashed_post', 'delete_post', 'edit_post', 'publish_page', 'publish_post', 'save_post' ) as $hook ) {
remove_action( $hook, array( $wpe_common, 'purge_varnish_cache' ) );
}
@aristath
aristath / bbpress-gdpr.php
Created May 18, 2018 07:55
Removes IP & UA tracking from bbPress
<?php
add_filter( 'bbp_current_author_ip', function() {
return '127.0.0.1';
} );
add_filter( 'get_post_metadata', function( $metadata, $object_id, $meta_key, $single ) {
if ( isset( $meta_key ) && '_bbp_author_ip' === $meta_key ) {
return '';
<?php
/**
* Returns the URL for an option.
* If no option is defined, return all.
*
* @param string $option The key of the item for which we want to get the URL.
* @return string|array Returns string if $option is defined. Returns array if option is false.
*/
function my_cool_theme_get_radiobutton_option( $option = false ) {
@aristath
aristath / simplify-gutengerg.js
Created March 23, 2018 12:45 — forked from dennyf/simplify-gutengerg.js
This is an example of how we can simplify Gutenberg's custom block API - this is only an illustrative example
const { __ } = wp.i18n; // Import __() from wp.i18n
const { registerBlockType, RichText, UrlInput, InspectorControls, PanelColor, ColorPalette } = wp.blocks;
/**
* This class registers a custom block type, by creating the
* controls and updating the values automatically. It also allows passing a single
* render function to avoid repetitive code in edit and update.
*/
class MyCustomComponent{