Skip to content

Instantly share code, notes, and snippets.

r-a-y

Block or report user

Report or block r-a-y

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@r-a-y
r-a-y / youtube-adblock.txt
Created May 5, 2018
Youtube Adblock Filter List
View youtube-adblock.txt
# Google pageads
/pagead/lvz?
-pagead-id.
# https://r5---sn-uxa0n-t8gz.googlevideo.com/generate_204
/generate_204$image
# https://www.youtube.com/youtubei/v1/log_interaction?alt=json&key=XXX
/log_interaction?
/log_event?
@r-a-y
r-a-y / force-ssl.php
Last active Apr 7, 2017
WordPress - Force HTTPS for logins and admin dashboard, while leaving frontend HTTP. This is the real force_ssl_admin()!
View force-ssl.php
<?php
// Change the login URL to use HTTPS.
add_filter( 'login_url', function( $retval ) {
return set_url_scheme( $retval, 'https' );
} );
add_filter( 'site_url', function( $retval, $path, $scheme ) {
if ( 'login_post' === $scheme ) {
$retval = set_url_scheme( $retval, 'https' );
}
@r-a-y
r-a-y / _readme.md
Last active Apr 17, 2019
Using PortableGit with a portable HOME directory
View _readme.md

Prologue

I develop on Windows (yeah, I hear your jeers, linux users!), so to use Git, I use Git for Windows

However, I use Git For Windows (portable version) so I can keep my dev environment centrally located. This is so I can reuse this environment simply by copying my msysgit directory to a USB drive.

Installation

@r-a-y
r-a-y / blogs.php
Last active Mar 15, 2017
Modify SQL query for BP's Sites Directory
View blogs.php
<?php
/**
* Modify BP's site query for non-super-admins.
*/
add_action( 'bp_include', function() {
// If you're doing checks against More Privacy Options, make sure MPO is active.
if ( ! class_exists( 'ds_more_privacy_options' ) ) {
return;
}
@r-a-y
r-a-y / _bp_rbe_imap_object_cache.php
Last active Jul 28, 2016
BP Reply By Email - IMAP Object Cache extension. Replaces the default filesystem IMAP locking system in RBE with a persistent object cache.
View _bp_rbe_imap_object_cache.php
<?php
/*
Plugin Name: BP Reply By Email - IMAP Object Cache extension
Description: Replaces the default filesystem IMAP locking system in RBE with a persistent object cache.
Author: r-a-y
Author URI: http://profiles.wordpress.org/r-a-y
License: GPLv2 or later
*/
/*
@r-a-y
r-a-y / bp-page-title.php
Created Jun 13, 2016
Use page title as set in admin area on BP directory pages.
View bp-page-title.php
/**
* Use page title for BP directory pages.
*/
function my_set_bp_page_title() {
// Check to see if current reset post is a BP directory; if not, bail.
if ( false == in_array( $GLOBALS['post']->ID, bp_core_get_directory_page_ids() ) ) {
return;
}
// Use WP page title for the_title().
@r-a-y
r-a-y / xmlrpc.php
Created May 13, 2016
Block all XMLRPC requests on WordPress
View xmlrpc.php
<?php
// Put this in /wp-content/mu-plugins/.
add_action( 'plugins_loaded', function() {
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && false !== strpos( $_SERVER['SCRIPT_NAME'], '/xmlrpc.php' ) ) {
// Reject with 403.
header( 'HTTP/1.1 403 Forbidden' );
exit;
}
}, 0 );
@r-a-y
r-a-y / gestures.js
Last active Feb 20, 2016
Mouse gestures script for the Conkeror browser - http://conkeror.org
View gestures.js
// Mouse Gestures for Conkeror by r-a-y.
//
// Modified from the Mouse Gestures By Sing Chu userscript:
// http://userscripts-mirror.org/scripts/show/162193
var BTN_RIGHT = 2;
var SENSITIVITY = 15; //Pixels moved until gesture is registered
var startX;
var startY;
var gesture = "";
@r-a-y
r-a-y / cbox-distro
Last active Aug 29, 2015
CBOX wp.org distro bash script
View cbox-distro
#!/bin/bash
# CBOX wp.org distro script
#
# Before using:
# 1. Ensure that 1.0.x branch has pinned all plugins to latest version.
# 2. Checkout a new branch for wp.org. @todo decide on a branch name.
# 3. Create the following folder - 'includes/zip'
#
# Next, run this bash script.
@r-a-y
r-a-y / warnings.php
Last active Apr 15, 2016
Suppress warnings created by certain plugins and themes in WordPress.
View warnings.php
/**
* Suppress errors generated by specified WordPress plugins.
*
* Put this in /wp-content/mu-plugins/
*
* @param string $errno The error number.
* @param string $errstr The error message.
* @param string $errfile Path to the file that caused the error.
* @param int $errline Line number of the error.
* @return bool True to suppress error reporting; false to use default error handler.
You can’t perform that action at this time.