Skip to content

Instantly share code, notes, and snippets.

View joedooley's full-sized avatar

Joe Dooley joedooley

  • Florida
  • 07:55 (UTC -04:00)
View GitHub Profile
@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
@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
@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 / gf-import-entries-send-notifications.php
Created May 4, 2017 18:43
Gravity Forms Import Entries - Send notifications for each imported entry
<?php
add_action( 'gform_post_add_entry', 'gv_import_entry_send_notifications', 10, 2 );
/**
* Send notifications
*
* @param $entry
* @param $form
*/
@zackkatz
zackkatz / gravityview-trigger-gform_after_submission.php
Created June 19, 2017 19:09
GravityView - Trigger the `gform_after_submission` action when an entry is edited. This adds support for the Gravity Forms Zapier addon, for example.
<?php
/**
* GravityView doesn't trigger the `gform_after_submission` action when editing entries. This does that.
*
* @param array $form
* @param int $entry_id ID of the entry being updated
* @param GravityView_Edit_Entry_Render $object
*
* @return void
@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' ) ) {
@zackkatz
zackkatz / gravityforms-modify-value-after-update.php
Created August 14, 2017 20:41
Gravity Forms - Modify field value after updating in Gravity Forms OR GravityView
<?php
/**
* Modify a field value after updating an entry
*
* @param array $form Gravity Forms form object
* @param int $entry_id ID of the entry that was updated
* @param array $original_entry Original entry object, before update
*
* @return void
@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');
@nikasepiskveradze
nikasepiskveradze / http.ts
Created January 8, 2021 17:06
Http client example with TS and RXJs
import {Observable, of} from "rxjs";
import {catchError, map} from "rxjs/operators";
import {ajax} from "rxjs/ajax";
class Http {
public get<T extends Object = Object>(url: string, headers?: any): Observable<T> {
return ajax.get.apply(undefined, [`${url}`, headers]).pipe(catchError(this.catchError), map(this.map));
}
public post<T extends Object = Object>(url: string, body?: any, headers?: any): Observable<T> {
@OliverJAsh
OliverJAsh / README.md
Last active February 24, 2022 05:26
Flexbox gutters

Flexbox gutters

Problem

  • We use flexbox for our layout.
  • We want to add horizontal and vertical gutters inbetween these items.
  • Items wrap according to contents (flex-wrap: wrap), therefore we can't decide when/where to apply gutters using breakpoints.

Solution