Skip to content

Instantly share code, notes, and snippets.

View peazz's full-sized avatar

Andy Cresswell peazz

View GitHub Profile
@peazz
peazz / functions.php
Created February 12, 2016 23:57 — forked from jaybuys/functions.php
WordPress Visual Composer Mods
function vc_update_defaults() {
// Default single image to size "full"
$param = WPBMap::getParam( 'vc_single_image', 'img_size' );
$param['value'] = 'full';
vc_update_shortcode_param( 'vc_single_image', $param );
// Modify button 2 styles to use custom colors
$colors_arr = array(
__( 'Custom Color #1', 'js_composer' ) => 'custom_classname_1',
__( 'Custom Color #2', 'js_composer' ) => 'custom_classname_2'
@peazz
peazz / pixel-core-cpt.php
Created November 11, 2016 16:13
Minimal Class for creating Custom Post Types
<?php
Class Pixel_Core_Cpt {
private $cpt = array();
private $cat = array();
private $tax = array();
public function addCpt( $singular, $plural, $slug, $args = array()){
@peazz
peazz / gist:4fe0abe0b0d83161aecb7c6b29583d7f
Created December 3, 2016 02:03
Clean WordPress Head Output 2016
function pixel_wp_head_cleanup () {
remove_action('wp_head', 'wlwmanifest_link'); // remove wlwmanifest.xml (needed to support windows live writer)
remove_action('wp_head', 'wp_generator'); // remove wordpress version
remove_action('wp_head', 'rsd_link'); // remove really simple discovery link
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 ); // remove shortlink
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); // remove emojis
remove_action( 'wp_print_styles', 'print_emoji_styles' ); // remove emojis
@peazz
peazz / gulpfile.js
Created April 1, 2017 01:14 — forked from gaspanik/gulpfile.js
automate optimize images w/ gulp
var gulp = require('gulp')
, imagemin = require('gulp-imagemin');
var paths = {
srcDir: 'src/*',
destDir: 'images'
}
gulp.task('imagemin', function() {
gulp.src(paths.srcDir)
@peazz
peazz / svg-to-css-clip-path-polygon.js
Created March 27, 2019 17:37 — forked from lostfictions/svg-to-css-clip-path-polygon.js
convert an svg to a css clip-path polygon
// why do this? clip-path accepts a `url` reference to an svg element, right?
// the difference is that anything defined as a `basic-shape` can be animated:
// https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path
const input = `121.151,20.761 170.165,55.885 200.872,3.816 231.145,55.884 280.592,20.762 286.854,80.687 346.526,68.666
327.657,126.005 387.276,139.247 346.502,184 395.796,220.302 340.127,244.647 370.611,297.814 309.636,297.457 316.076,358.381
260.303,333.3 241.622,391.529 200.655,345.979 160.121,391.53 141.008,333.302 85.666,358.381 91.673,297.456 31.131,297.813
61.183,244.647 5.947,220.302 54.81,184 14.466,139.248 73.652,126.004 55.216,68.667 114.457,80.688 `
const viewBoxScale = 4
@peazz
peazz / delay_adsense_analytics.js
Last active August 11, 2021 11:12
Delay AdSense & Google Analytics Until After DOM Loaded
/**
* Delay Adnsense & Google Analytics Until After DOM Loaded
* by: Andy Cresswell (@andy_ppsu)
* https://twitter.com/andy_ppsu
* #JavaScript #JS #AdSense #Analytics #CWV #CoreWebVitals #PageExperience
*
* This script, written in pure javascript, will help your improve your Core Web Vitals by delaying Javascript
* until after the DOM has loaded. Use with caution as some site may see an earnings
* drop. This is because adverts above the fold will be slight delayed.
*
@peazz
peazz / Ohm-step-1.cs
Last active August 15, 2021 18:16
OHM Step One
using System;
using OpenHardwareMonitor.Hardware; // add the reference
@peazz
peazz / add-computer.css
Created August 15, 2021 18:17
OHM Step Two
/**
* Init OpenHardwareMonitor.dll Computer Object
**/
static Computer c = new Computer()
{
GPUEnabled = true,
CPUEnabled = true,
//RAMEnabled = true, // uncomment for RAM reports
//MainboardEnabled = true, // uncomment for Motherboard reports
@peazz
peazz / ohm-step-3.cs
Created August 15, 2021 18:18
OHM Step 3
computer.Open();
@peazz
peazz / ohm-step-4.cs
Created August 15, 2021 18:19
OHM Step 4
static void Main(string[] args)
{
c.Open();
// loop
while (true)
{
ReportSystemInfo();
}