Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / how-i-work-template.md
Created June 14, 2023 13:46 — forked from jazzsequence/how-i-work-template.md
Template for How I Like to Work posts

How I work

This is my own interpretation of how I like to work, feedback welcome! Especially if my own view of how I think I like to work doesn't match your experience of how it seems I like to work!

When I work

@spivurno
spivurno / sse.php
Created June 5, 2023 13:16 — forked from jordymeow/sse.php
SSE (Server-Sent Events) with PHP and JS / Streaming with PHP
<?php
// Various links
// https://serverfault.com/questions/488767/how-do-i-enable-php-s-flush-with-nginxphp-fpm
// https://stackoverflow.com/questions/72394213/nginx-configuration-for-server-sent-event
// https://serverfault.com/questions/801628/for-server-sent-events-sse-what-nginx-proxy-configuration-is-appropriate
// https://qiita.com/okumurakengo/items/cbe6b3717b95944083a1 (in Japanese)
// If '?SSE' is set, send Server-Sent events, otherwise we'll display the page.
if ( isset( $_GET['SSE'] ) ) {
@spivurno
spivurno / gravity-forms-move-progress-bar-bottom.php
Last active October 23, 2023 15:32 — forked from n7studios/gravity-forms-move-progress-bar-bottom.php
Gravity Forms - Move Progress Bar to Bottom of Form
/**
* Plugin Name: Gravity Forms: Move Progress Bar to Bottom of Form
* Plugin URI: http://www.n7studios.co.uk
* Version: 1.0.1
* Author: n7 Studios
* Author URI: http://www.n7studios.co.uk
* Description: Moves the progress bar from the top to the bottom of the Gravity Form. The Start Paging section of the form MUST have a CSS class = progress-bar-bottom
*/
/**
@spivurno
spivurno / gw-gravity-forms-first-error-focus.php
Last active October 23, 2023 15:33 — forked from hirejordansmith/add-cursor-focus-first-gf-field-validation-error-all-forms.php
Gravity Wiz // Gravity Forms // Give First Validation Error Focus
<?php
/**
* Gravity Wiz // Gravity Forms // Give First Validation Error Focus
* http://gravitywiz.com/
*
* Plugin Name: Gravity Forms First Error Focus
* Plugin URI: https://gravitywiz.com/make-gravity-forms-validation-errors-mobile-friendlyer/
* Description: Automatically focus (and scroll) to the first field with a validation error.
* Author: Gravity Wiz
* Version: 1.1
@spivurno
spivurno / gw-gravity-forms-set-input-as-tel.php
Last active October 23, 2023 15:33 — forked from hirejordansmith/convert-text-field-tel-field.php
Gravity Wiz // Gravity Forms // Set Input Type as Tel
<?php
/**
* Gravity Wiz // Gravity Forms // Set Input Type as Tel
* http://gravitywiz.com/
*/
add_filter( 'gform_field_content_723_10', 'gw_set_tel_input_type' );
function gw_set_tel_input_type( $input ) {
$input = preg_replace( "/type='[\\w]+'/", "type='tel'", $input );
return $input;
}
@spivurno
spivurno / gw-gravity-forms-disable-autocomplete.php
Last active October 23, 2023 15:33 — forked from ronalfy/gravity-forms-disable-autocomplete.php
Gravity Wiz // Gravity Forms // Disable Auto-complete
<?php
// Disable auto-complete on form.
add_filter( 'gform_form_tag', function( $form_tag ) {
return str_replace( '>', ' autocomplete="off">', $form_tag );
}, 11 );
// Diable auto-complete on each field.
add_filter( 'gform_field_content', function( $input ) {
return preg_replace( '/<(input|textarea)/', '<${1} autocomplete="off" ', $input );
@spivurno
spivurno / keyboard-shortcuts.md
Created October 9, 2013 14:01
Here are some things you can do with Gists in GistBox.

Create documentation for your projects. Like so:


Most popular keyboard shortcuts within GistBox

  • Up/Down - Previous/Next Gist
  • Ctrl+e - Edit a selected Gist
  • Ctrl+s - Save Gist
@spivurno
spivurno / gw-gravity-forms-submission-limit.php
Last active October 23, 2023 15:33 — forked from spivurno/gist:3710653
Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
<?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-submission-limit.php
*/
/**
* Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
*
* Limit the number of times a form can be submitted per a specific time period. You modify this limit to apply to
@spivurno
spivurno / gw-limit-checkboxes-usage.php
Last active October 23, 2023 15:33 — forked from spivurno/gist:4005779
Gravity Wiz // Limit Checkboxes Usage
<?php
// standard usage
new GFLimitCheckboxes(115, array(
5 => array(
'min' => 2,
'max' => 3
)
));
new GFLimitCheckboxes(FORM_ID, array(
FIELD_ID => array(
'min' => MIN_NUMBER,
'max' => MAX_NUMBER
)
));