Skip to content

Instantly share code, notes, and snippets.

View chuckreynolds's full-sized avatar
🤖
building things

Chuck Reynolds chuckreynolds

🤖
building things
View GitHub Profile
Verifying that "chuckreynolds.id" is my Blockstack ID. https://onename.com/chuckreynolds
@chuckreynolds
chuckreynolds / sample-wordpress-options-cache.php
Created September 18, 2017 21:04
Sample WordPress options with time-based cache flag
<?php
function get_twitter_followers() {
$ttl = 2 * HOUR_IN_SECONDS;
$cache = get_option( 'my_twitter_followers' );
if ( empty( $cache['timeout'] ) || $cache['timeout'] < time() ) {
$followers = wp_remote_get( ... );
$cache = array(
'count' => $followers,
@chuckreynolds
chuckreynolds / ngrok-to-local-vagrant.sh
Created August 30, 2017 21:43
ngrok to local vagrant box
./ngrok http -host-header=rewrite localsitename.app:80
@chuckreynolds
chuckreynolds / gist:c28d0957300b6b540dc295190ddfc1cb
Created August 29, 2017 00:03
WordPress: Disable users REST API endpoints
// Disable users REST API endpoints
add_action( 'rest_endpoints', function( $endpoints) {
foreach ( $endpoints as $endpoint => $args ){
if( false !== strpos( '/wp/v2/users', $endpoint ) ){
unset( $endpoints[ $endpoint ] );
}
}
return $endpoints;
});
@chuckreynolds
chuckreynolds / .editorconfig
Created June 8, 2017 02:16
my default starter editorconfig file.
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
{
"name": "gablaxian",
"version": "1.0.0",
"description": "gablaxian website",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/gablaxian/gablaxian.com.git"
},
@chuckreynolds
chuckreynolds / TwiMLbin-forwarding.xml
Created May 2, 2017 20:10
How to forward SMS and/or Calls with Twilio and TwiMLbins.
// to forward a call and setup voicemail on timeout
<Response>
<Dial timeout="20" record="record-from-answer">xxx-xxx-xxxx</Dial>
</Response>
// to forward a sms to another number
<Response>
<Message to="+1xxxxxxxxxx">{{From}}: {{Body}}</Message>
</Response>
@chuckreynolds
chuckreynolds / antispambot-wordpress-shortcode.php
Created April 26, 2017 22:43
Antispambot WordPress shortcode function
<?php
/**
* Hide email from Spam Bots using a shortcode.
* Anti-Spambot Email Shortcode, v1.1.1
* https://wordpress.org/plugins/antispambot
*
* @param array $atts Shortcode attributes. Not used.
* @param string $content The shortcode content. Should be an email address.
*
* @return string The obfuscated email address.
@chuckreynolds
chuckreynolds / block.twitter.live.txt
Last active April 13, 2019 21:40
Block script to put into Ublock Origin Filters to get rid of Twitter's Live Video sidebar object
twitter.com##.is-playing.module.LiveVideoHomePageModule
twitter.com##.roaming-module.LiveVideoHomePageModuleContainer