Skip to content

Instantly share code, notes, and snippets.

View Nerko69's full-sized avatar

Nerko Nerko69

  • WebProgress.Net, Inc.
  • Chicago, IL
View GitHub Profile
@Nerko69
Nerko69 / multisite_attachment_url.php
Created November 4, 2022 15:08 — forked from ChrisHardie/multisite_attachment_url.php
Example WordPress plugin to help simplify attachment URLs on multisite sites with mapped domains
<?php
/**
* Plugin Name: Multisite Domain Mapping Attachment URL Fixes
* Description: Update attachment URLs to use mapped domain and remove mention of "sites" path.
* Author: Chris Hardie
*
* Rewrite attachment URLs (and related srcset URLs) to the non-multisite, mapped domain version if a domain is mapped
* Requires that the related nginx config that maps the non-multisite URL to the multisite URL be in place
**/
add_filter( 'wp_get_attachment_url', 'jch_attachment_url_with_domain_mapping' );
@Nerko69
Nerko69 / gist:f2c5da6213757c2861ceb09030809829
Created October 23, 2022 18:27 — forked from cranelab/gist:940d76283414908b464074dba1aaa7af
all wp plugins with over 100+ active installations
5,000,000+ : wpforms-lite
5,000,000+ : wordpress-seo
5,000,000+ : woocommerce
5,000,000+ : really-simple-ssl
5,000,000+ : jetpack
5,000,000+ : elementor
5,000,000+ : contact-form-7
5,000,000+ : classic-editor
5,000,000+ : akismet
4,000,000+ : wordpress-importer
<?php
/**
* Plugin Name: Add shortcode list all blog sites
* Description: Add shortcode list all blog sites ([wpmudev_list_all_blogs]) - 1155576029146873
* Author: Thobk @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
return;
@Nerko69
Nerko69 / noref.php
Created June 8, 2020 20:44 — forked from electricg/noref.php
Remove referer and anonymize links
<?php
$url = getenv('QUERY_STRING');
if ($url == '') {
die ('THIS SCRIPT CANNOT BE CALLED DIRECTLY!');
}
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; URL=<?php echo $url ?>">
@Nerko69
Nerko69 / rotUrl.php
Created April 21, 2020 15:30 — forked from mrclay/rotUrl.php
RotUrl: encode/obfuscate URLs for use in other URLs
<?php
/**
* Rot35 for URLs. To avoid increasing size during urlencode(), commonly encoded
* chars are mapped to more rarely used chars (end of the uppercase alpha).
*
* @param string $url
* @return string
*/
function rotUrl($url) {
@Nerko69
Nerko69 / color-scale.js
Created March 26, 2020 01:08 — forked from mlocati/color-scale.js
Javascript color scale from 0% to 100%, rendering it from red to yellow to green
function perc2color(perc) {
var r, g, b = 0;
if(perc < 50) {
r = 255;
g = Math.round(5.1 * perc);
}
else {
g = 255;
r = Math.round(510 - 5.10 * perc);
}
@Nerko69
Nerko69 / showspreadsheet.php
Created March 23, 2020 02:48 — forked from pamelafox/showspreadsheet.php
PHP for parsing the JSON output a published Google spreadsheet and displaying columns from each row.
<?php
// Parsing this spreadsheet: https://spreadsheets.google.com/pub?key=0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc&hl=en&output=html
$url = 'http://spreadsheets.google.com/feeds/list/0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc/od6/public/values?alt=json';
$file= file_get_contents($url);
$json = json_decode($file);
$rows = $json->{'feed'}->{'entry'};
foreach($rows as $row) {
echo '<p>';
@Nerko69
Nerko69 / README.md
Created March 9, 2020 15:58 — forked from williammalo/README.md
Make font size work with percentage
@Nerko69
Nerko69 / gist:1d0fe96f9dc1c83186d6313fcfc9bc53
Created December 4, 2019 17:43 — forked from afeld/gist:1254889
YouTube video ID regex
# Parses YouTube URLs directly or from iframe code. Handles:
# * Address bar on YouTube url (ex: http://www.youtube.com/watch?v=ZFqlHhCNBOI)
# * Direct http://youtu.be/ url (ex: http://youtu.be/ZFqlHhCNBOI)
# * Full iframe embed code (ex: <iframe src="http://www.youtube.com/embed/ZFqlHhCNBOI">)
# * Old <object> tag embed code (ex: <object><param name="movie" value="http://www.youtube.com/v/ZFqlHhCNBOI">...)
/(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/
$5 #=> the video ID
# test it on Rubular: http://rubular.com/r/eaJeSMkJvo