Skip to content

Instantly share code, notes, and snippets.

@alpha1
alpha1 / append_site_options_to_wp_json_index.php
Created November 30, 2022 03:20
Append Site Options to WP JSON API Index
<?php
//https://developer.wordpress.org/reference/hooks/rest_index/
add_filter( 'rest_index', 'append_site_public_settings_to_rest_api_index', 10, 2 );
function append_site_public_settings_to_rest_api_index( $response, $request ){
$options_to_include = array(
'date_format',
'time_format',
'gmt_offset',
'blog_public',
@alpha1
alpha1 / cname_tracking.domains
Created November 30, 2019 19:38
CNAME Tracking Domains
0.0.0.0 smetrics.washingtonpost.com
0.0.0.0 smetrics.politico.com
0.0.0.0 omniture-ssl.walmart.com
0.0.0.0 smetrics.cnn.com
0.0.0.0 ssl.o.webmd.com
0.0.0.0 srepdata.usatoday.com
0.0.0.0 sstats.arstechnica.com
@alpha1
alpha1 / gravity_forms_sane_starter_validations_rules.php
Last active June 15, 2022 20:16
Gravity Forms Sane Validation Rules
<?php
/*
Plugin Name: WP Hacks Gravity Forms Validation Rules
Description:
Author: WP Hacks
Version: 0.1.0
Author URI: https://wphacks.org
*/
/*
#!/bin/bash
#wpbpfile=$(wp export --allow-root')
#cd to wordpress directory if needed
#cd /srv/www/wordpress-directory
wp_db_bk_filename=$(wp db export --allow-root --porcelain)
curl --ftp-ssl -T $wp_db_bk_filename ftp://HOSTNAME --user USERNAME:PASSWORD
unset wp_db_bk_filename
77.69.102.145
39.50.235.181
213.141.197.253
41.200.122.73
117.198.49.50
76.68.71.95
177.149.95.194
177.47.169.240
176.88.51.253
154.121.7.26
0.0.0.0 doubleverify.com
0.0.0.0 tps.doubleverify.com
0.0.0.0 app.adust.com
0.0.0.0 pixel-geo.prfct.co
0.0.0.0 x.bidswitch.net
0.0.0.0 dpm.demdex.net
0.0.0.0 beacons4.gvt2.com
0.0.0.0 pixel.rubiconproject.com
0.0.0.0 pubmatic.com
0.0.0.0 ads.yahoo.com
@alpha1
alpha1 / gist:19b2e3856833d0efd3f3887970463737
Created November 1, 2018 03:43
List of Email Addresses that have spammed me. Please spam them
@alpha1
alpha1 / gist:da0192de8e6cc91c43ee9f86950d69c3
Last active October 11, 2018 22:20
Table Based UL for HTML emails
<table width="100%" style="border-collapse:collapse; width:100%">
<tbody>
<tr>
<td valign="top" width="30" style="width:30px;">&nbsp;</td><!--remove this row is you don't want the default indent-->
<td valign="top">&bull;&nbsp;</td>
<td valign="top" style="">Bullet A</td>
</tr>
<tr>
<td valign="top" width="30" style="width:30px;">&nbsp;</td>
<td valign="top">&bull;&nbsp;</td>
@alpha1
alpha1 / append_iteration_array.php
Created August 9, 2018 04:50
Append Character to each item on Array [PHP]
<?php
foreach($input_array as &$value) {
$value = '`'. $value .'`';
}
unset($value);
?>
@alpha1
alpha1 / revive_ad_server.sql
Last active June 12, 2018 02:51
Revive Ad Server raw SQL
#Show all active campaigns
SELECT * FROM `rv_campaigns` WHERE `activate_time` <= now() and expire_time >= now()
#show all past campaigns
SELECT * FROM `rv_campaigns` WHERE `activate_time` <= now() and expire_time <= now()
#show all upcoming campaigns
SELECT * FROM `rv_campaigns` WHERE `activate_time` >= now()
#show campaigns with clients (advertiser) information