Skip to content

Instantly share code, notes, and snippets.

@Integralist
Integralist / RTL.md
Created November 1, 2013 18:42
BBC News' RTL (right to left) solution

Right-to-Left (RTL)

Implementation

There are two methods to use in order to flip CSS styles: interpolated properties and the flip() function.

  • Interpolation should be used for any property which has a direction (e.g. padding-left, margin-right, border-right, left, etc.)
  • flip() should be used for all other properties

Which properties need to be flipped?

@Idealien
Idealien / .lando.yml
Last active October 4, 2021 21:04
Lando .yml with separate DB for phpunit testing
name: local
recipe: wordpress
config:
webroot: .
xdebug: true
services:
appserver:
type: php
@stevenschobert
stevenschobert / load_remote_content_mail_dot_app.scpt
Last active January 12, 2022 11:19
Apple Script to click the "Load Remote Content" button. I like to disable all remote content in Mail.app, and then bind this script to a keyboard shortcut using Keyboard Maestro. https://www.keyboardmaestro.com
tell application "System Events" to tell process "Mail"
set mainWindow to a reference to the first window
set rootSplitter to a reference to the first splitter group of the mainWindow
set firstSplitter to a reference to the last splitter group of the rootSplitter
set scrollArea to a reference to the last scroll area of the firstSplitter
set scrollGroup to a reference to the first group of the scrollArea
if number of groups of the scrollGroup is greater than 1 then
set maybeRemoteContentGroup to a reference to the first group of the scrollGroup
@polevaultweb
polevaultweb / edd_perpetual_discounts.php
Last active June 28, 2022 08:31
EDD - Allow discounts to be set to apply to all renewals
<?php
// Add new Discount setting the to discount add and edit forms
add_action( 'edd_add_discount_form_before_use_once', array( $this, 'edd_perpetual_discounts_setting_add_form' ) );
add_action( 'edd_edit_discount_form_before_use_once', array( $this, 'edd_perpetual_discounts_setting_edit_form' ) );
// Handle saving the settings on form submission
add_filter( 'edd_update_discount', 'edd_perpetual_discounts_add_meta' );
add_filter( 'edd_insert_discount', 'edd_perpetual_discounts_add_meta' );
@kellenmace
kellenmace / add-unfiltered_html-capability-to-admins-or-editors.php
Last active September 20, 2022 18:29
Add unfiltered_html Capability to Admins or Editors in WordPress Multisite
<?php
/**
* Enable unfiltered_html capability for Editors.
*
* @param array $caps The user's capabilities.
* @param string $cap Capability name.
* @param int $user_id The user ID.
* @return array $caps The user's capabilities, with 'unfiltered_html' potentially added.
*/
@webzunft
webzunft / canceled-subscriptions.sql
Last active October 4, 2022 13:15
SQL queries to analyse canceled subscriptions managed with EDD Recurring Payments
# Basic queries to analyse canceled subscriptions using EDD Recurring Payments pre EDD 3.0
# Use EXPLAIN if you have large stores since the "notes" column is not indexed and queries can take some time
# Some of these reports might be worth storing as Views and look at the graphs PHPMyAdmin can also create from them
# List subscription cancelation with creation and cancelation date, as well as the user who canceled
# good as a basis for further queries
SELECT ID,
created,
REGEXP_SUBSTR( REGEXP_SUBSTR( notes, '.* Status changed from active to cancelled .*' ), '^[a-z]+ [0-9]+, [0-9]+' ) AS 'date',
@zourbuth
zourbuth / user_meta_key.php
Created October 17, 2012 07:39
Get All WordPress User Meta Keys
<?php
/**
* Returns all unique meta key from user meta database
*
* @param no parameter right now
* @retun std Class
* @todo do what you do for each meta key.
*/
function get_user_meta_key() {
@danieliser
danieliser / rename-plugins-after-update.php
Last active November 28, 2022 18:40
This code works to update addon/extension plugin slugs during update from a premapped list. Code likely needs to be run in separate plugin/theme/mu-plugin/drop-in.
<?php
/**
* This code works to update addon/extension plugin slugs during update from a premapped list.
*
* Code likely needs to be run in separate plugin/theme/mu-plugin/drop-in.
*
* Tested Working On:
* - Single Site: Updates Page - Singe Plugin.
@ericmann
ericmann / Fortress.Options.php
Last active September 20, 2023 04:13
Encrypted Options
<?php
/**
* Encryption operations for working with WordPress options to store data
* in the options table. Not all options will be encrypted. You will need
* to wire up selection of options to be protected separately.
*
* @package Fortress
*/
namespace DisplaceTech\Fortress\Options;
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"