Skip to content

Instantly share code, notes, and snippets.

View postphotos's full-sized avatar
🎒

Leo Postovoit postphotos

🎒
View GitHub Profile
@postphotos
postphotos / keybase.md
Created October 15, 2019 18:59
Keybase

Keybase proof

I hereby claim:

  • I am postphotos on github.
  • I am postphotos (https://keybase.io/postphotos) on keybase.
  • I have a public key ASDCOBogH2y9yqwAoAdfTCox2cdECSay6L8cePwwRymhxAo

To claim this, I am signing this object:

@postphotos
postphotos / ampoverride.php
Created April 30, 2019 00:08
Simple plugin to turn off or change how AMP is used for themes that pre-declare it
<?php
/**
*
*
* Plugin Name: AMP Override: Turn off 'Default' amp settings
* Plugin URI: http://leopostovoit.com
* description: Change or disable 'Default' amp settings for themes with default AMP declaration (e.g. like WP Rig, Neva, Astra, etc.)
* Version: 0.1
* Author: Leo Postovoit
* Author URI: http://leopostovoit.com
@postphotos
postphotos / functions.php
Created October 19, 2018 06:05
Grab the enqueued stuff from WordPress
<?php
// Used to dequeue stuff - we're making text only stuff
function find_cripts() {
global $wp_scripts;
foreach( $wp_scripts->queue as $handle ) :
echo $handle . ' <br />';
endforeach;
}
@postphotos
postphotos / functions.php
Last active January 24, 2018 21:17
Injected ads into the_content() inside WordPress by leveraging Advanced Custom Fields
/**
* Injects ads into the content at a
* specified paragraph length
* by filtering the_content().
*
* @return \$content
*/
public function ad_injector( $content ) {
if( is_single( ) ){
@postphotos
postphotos / Includes-CacheBuster.php
Last active November 5, 2017 20:57
Cache Buster!
// CSS example: (see wp_enqueue_style in the WP Codex)
function appcss() {
$app = '/stylesheet/app.css'; // Local path in theme
$appURI = get_stylesheet_directory_uri() . $app;
$appPath = get_template_directory() . $app;
wp_enqueue_style('app', $appURI , array(),
filemtime( $appPath ) );
}
add_action( 'wp_enqueue_scripts', 'appcss' );
@postphotos
postphotos / functions.php
Created May 5, 2017 05:38
Enqueue Stylesheet (or javascript) in WordPress for cachebusting
<?php
wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), false, filemtime(get_stylesheet_directory() . '/style.css') );
?>
@postphotos
postphotos / push-emergency.sh
Last active March 30, 2017 20:29
Roll back a live repo to an older commit
## This is useful if you have an emergency break on a git-to-deploy site, like a Wordpress WPEngine git push site.
## you grab the hash and force it to the remote name - i.e. origin, production, staging, etc.
## Be sure to git blame to yell at whoever borked it (Unless you're the sole developer on the project!) and trace your bugs!
git push -f staging 17ee2f0b24b6af6e03352ed71b7384639e6239ed:master
@postphotos
postphotos / ChromeTo1password.txt
Created March 2, 2017 18:09
Export Google Chrome Passwords and Import to 1Password
Adapted from http://www.thewindowsclub.com/export-import-passwords-chrome-browser
Referencing: https://support.1password.com/create-csv-files/
1. In Google Chrome, then type “chrome://flags” in the address bar.
2. When the flags window loads, hit CMD+F/Ctrl+F and search for "password import and export." Select Enabled to turn the flag on. Click the link to relaunch your browser enact the changes.
3. After relaunching the browser, navigate to Chrome settings menu by entering chrome://settings in the address bar. Scroll down to the bottom and click on Show advanced settings.
4. Scroll down further through Advanced settings to section named "Passwords and Forms."
@postphotos
postphotos / rsync.sh
Last active October 19, 2016 00:57
There really should be a better GUI RSYNC out there...
# Preferred rsync attrs, requires v3.1.0 or higher
# h: human-readable | a: archive mode (equals -rlptgoD) | v: verbose | X: extended attrs
# --info=progress-2 is the bees' knees - gives you human readable progress
# --ignore-errors prevents crashing
# --append-verify to resume transfer
# Optional: --log-file=[file] - i.e. --log-file=/Users/me/wherever/rsync.log
# --checksum: md5 checking
rsync -havX --info=progress2 [source] [target]
@postphotos
postphotos / ExcelMacros.VBA
Last active February 24, 2016 19:51
A Variety of Excel Macros Used
Sub BoldHeaders()
'
' Bold Macro
'
'
Rows("1:1").Select
Selection.Font.Bold = True
End Sub