Skip to content

Instantly share code, notes, and snippets.

View joedooley's full-sized avatar

Joe Dooley joedooley

  • Florida
  • 18:48 (UTC -04:00)
View GitHub Profile
@kelvinmo
kelvinmo / s3link-v4.php
Created October 25, 2014 00:17
PHP code to generate a pre-signed URL to access a restricted AWS S3 object
@zackkatz
zackkatz / gravityview-redirect-after-edit-entry.php
Last active November 30, 2017 04:47
Redirect after a GravityView entry is edited if the form ID matches defined cases
<?php
/**
* Add the following code to the end of your theme's functions.php file.
*
* Make sure it's inside the ?> if ?> is at the end of the file!!!
*
*/
@zackkatz
zackkatz / gravityview-edit-entry-hide-empty-fields.php
Last active September 5, 2022 04:10
GravityView - Hide Empty Fields in Edit Entry screen
<?php
/**
* Add filters to the edit entry inputs when GravityView starts to render an entry.
*/
add_action( 'gravityview/edit-entry/render/before', function() {
// GravityView methods are run at priority 10; by running at 20, this will run after GV.
add_filter( 'gform_field_content', 'gravityview_hide_empty_fields_in_edit_entry', 20, 5 );
} );
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@davidneedham
davidneedham / .bash_profile
Last active March 17, 2016 13:06
Pantheon Development Workflow (pdw): Commands to improve your Pantheon to local development experience. Just copy these commands into your .bash_profile or .bashrc, update the pdw-auth command to use your credentials, install Terminus (https://github.com/pantheon-systems/cli/wiki/Installation), and go!
#------------------------------------------
# PANTHEON DEVELOPMENT WORKFLOW v1.01
# Using the Pantheon CLI (terminus) v0.71
#------------------------------------------
# Authenticate with Pantheon. The first step, most of the time.
# This is a little insecure, as it lists your password here. But it's convenient.
alias pdw-auth='terminus auth login YOURPANTHEONEMAILADDRESS --password=YOURPANTHEONPASSWORD'
# Update your local Pantheon site aliases
@spivurno
spivurno / gw-gravity-forms-manual-entries.php
Last active February 21, 2023 20:45
Gravity Wiz // Gravity Forms // Manual Entries
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-manual-entries.php
*/
/**
* Gravity Wiz // Gravity Forms // Manual Entries
*
* Create entries manually for Gravity Forms. Adds an "Add New" button next to the page title on all entry-related pages.
@joedooley
joedooley / pulling-remote-site-copy-into-a- vagrant-vm
Created December 26, 2015 07:06
From https://tomjn.com/2014/03/01/wordpress-bash-magic/ Pulling Down a Remote site Copy Into a Vagrant VM I use something similar to this to pull down this website into a Virtual machine automatically. If you use password authentication to log into your server rather than SSH Keys, or your using SFTP details, you’ll be prompted for it. If you us…
#!/bin/sh
### SSH Info ###
SUSER="serverusername";
SHOST="example.com";
SDIR="/srv/www/example.com";
echo 'starting rsync'
rsync -e "/usr/bin/ssh" --compress --stats -rlDHS $SUSER@$SHOST:$SDIR /srv/www/example.com
@joedooley
joedooley / global-search-and-replace-query.sql
Last active August 23, 2021 16:56
SQL query that Find's all old URL's and Replaces with new URL values. This can be ran from phpmyadmin, etc... https://wpbeaches.com/updating-wordpress-mysql-database-after-moving-to-a-new-url/
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@tripflex
tripflex / functions.php
Last active February 13, 2024 19:03
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@zackkatz
zackkatz / gravityview-keep-hidden-fields-hidden.php
Created March 14, 2017 06:48
GravityView - Don't turn hidden fields into text fields in Edit Entry
<?php
add_action( 'gravityview_edit_entry', 'gravityview_dont_show_hidden_fields', 20 );
/**
* Don't turn hidden fields into text fields in GravityView Edit Entry
*/
function gravityview_dont_show_hidden_fields() {
if( ! class_exists('GravityView_Fields' ) ) {