Skip to content

Instantly share code, notes, and snippets.

View heyfletch's full-sized avatar
🏠
Working from home

Joe Fletcher heyfletch

🏠
Working from home
View GitHub Profile
@mbijon
mbijon / wordpress-remove-media_buttons.php
Last active July 10, 2023 23:30
Remove 'Add Media' button from above WP editor, per post-type
function check_post_type_and_remove_media_buttons() {
global $current_screen;
// use 'post', 'page' or 'custom-post-type-name'
if( 'post' == $current_screen->post_type ) add_action( 'media_buttons_context' , create_function('', 'return;') );
}
add_action('admin_head','check_post_type_and_remove_media_buttons');
@freshlogic
freshlogic / app.js
Last active July 8, 2019 18:53
Check an area code for available Google Voice numbers and post the results to Campfire
var Campfire = require('campfire').Campfire;
var request = require('request');
var areaCode = 972;
var campfire = new Campfire({ ssl: true, token: 'YOUR CAMPFIRE API TOKEN HERE', account: 'YOUR CAMPFIRE SUBDOMAIN NAME HERE' });
var headers = { Cookie: 'YOUR www.google.com COOKIE HERE' };
var url = 'https://www.google.com/voice/setup/searchnew/?ac=' + areaCode + '&start=0&country=US';
request.get({ url: url, headers: headers }, function(error, response, body) {
var json = JSON.parse(body);
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active January 8, 2024 13:24
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@arunoda
arunoda / gist:7790979
Last active February 16, 2024 14:05
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@markthethomas
markthethomas / gist:6b114f5fd7d55d29eca3
Created May 31, 2014 19:28
Roots gruntfile with imagemin and autoprefixer
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@codesprint
codesprint / 1.js
Last active February 28, 2017 16:07
Magento: countryRegions not defined
countryRegions is not defined
@eriteric
eriteric / movegfjstofooter.php
Last active October 13, 2021 16:55
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );
@bhubbard
bhubbard / view-all-shortcodes.php
Created March 27, 2015 18:58
All available shortcodes
<?php
/*
Plugin Name: Paulund View All Shortcodes
Plugin URI: http://www.paulund.co.uk
Description: View all the available shortcodes on your WordPress blog. This page will show you everything that is currently registered so you can use these in the text editor of WordPress
Version: 1
Author: Paul Underwood
Author URI: http://www.paulund.co.uk
http://www.paulund.co.uk/get-list-of-all-available-shortcodes