Skip to content

Instantly share code, notes, and snippets.

View saifsultanc's full-sized avatar
🏠
Remote

Saif Sultan saifsultanc

🏠
Remote
View GitHub Profile
@saifsultanc
saifsultanc / main.js
Created December 18, 2018 11:03
JSPlayground created by saifsultanc - https://repl.it/@saifsultanc/JSPlayground
// Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
@saifsultanc
saifsultanc / main.js
Created December 18, 2018 11:03
JSPlayground created by saifsultanc - https://repl.it/@saifsultanc/JSPlayground
// Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
@saifsultanc
saifsultanc / main.js
Created December 18, 2018 11:54
JSProfile Lookup created by saifsultanc - https://repl.it/@saifsultanc/JSProfile-Lookup
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
@saifsultanc
saifsultanc / index.html
Created December 10, 2019 13:49
KKwzwEd
<div class="base">
<div class="div col-md-6 p-3 p-md-5 purple">
<h2>Take your websites to the next level!</h2>
Works like a perfect website.
</div>
<div class="div col-md-6 p-5 d-flex flex-column full-height yellow">
<h2>Get your website & mobile app together!</h2>
Works like a perfect mobile app.
</div>
</div>
@saifsultanc
saifsultanc / gw-validate-that-a-value-exists.php
Created January 18, 2023 03:10
gw-validate-that-a-value-exists.php (AJAX fix)
<?php
/**
* Gravity Wiz // Gravity Forms // Validate that a Value Exists
*
* Ensure that a value entered in Form A has been previously submitted on Form B. This is useful if you're generating a reference number of some sort
* on Form B and would like the user to enter it on Form A.
*
* @version 1.9
* @author David Smith <[email protected]>
* @license GPL-2.0+
@saifsultanc
saifsultanc / gw-validate-that-a-value-exists-for-two-forms.php
Created January 23, 2023 13:41
gw-validate-that-a-value-exists-for-two-forms.php
<?php
// Gravity Wiz // Gravity Forms // Validate that a Value Exists
class GW_Value_Exists_Validation {
protected static $is_script_output = false;
public function __construct( $args = array() ) {
// set our default arguments, parse against the provided arguments, and store for use throughout the class
<?php
class GW_Value_Exists_Validation {
protected static $is_script_output = false;
public function __construct( $args = array() ) {
// set our default arguments, parse against the provided arguments, and store for use throughout the class
$this->_args = wp_parse_args( $args, array(
'target_form_id' => false,
@saifsultanc
saifsultanc / gw-date-merge-tags-for-non-date-field.php
Last active February 2, 2023 17:53
gw-date-merge-tags-for-non-date-field
add_filter( 'gform_pre_replace_merge_tags', function( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) {
preg_match_all( '/{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/mi', $text, $matches, PREG_SET_ORDER );
foreach ( $matches as $match ) {
$input_id = $match[1];
$field = GFFormsModel::get_field( $form, $input_id );
if ( ! $field ) {
@saifsultanc
saifsultanc / 45960-stack-trace.txt
Created March 31, 2023 15:48
45960-stack-trace.txt
Fatal error: Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in /Users/saif/Local Sites/45960/app/public/wp-content/plugins/gravityforms/common.php:1373
Stack trace:
#0 /Users/saif/Local Sites/45960/app/public/wp-content/plugins/gravityforms/common.php(1373): strpos(Array, '{')
#1 /Users/saif/Local Sites/45960/app/public/wp-content/plugins/gravityforms/includes/fields/class-gf-field.php(2028): GFCommon::replace_variables_prepopulate(Array)
#2 /Users/saif/Local Sites/45960/app/public/wp-content/plugins/gravityforms/includes/fields/class-gf-field.php(1996): GF_Field->get_value_default()
#3 /Users/saif/Local Sites/45960/app/public/wp-content/plugins/gravityforms/form_display.php(4099): GF_Field->get_value_default_if_empty(Array)
#4 /Users/saif/Local Sites/45960/app/public/wp-content/plugins/gravityforms/form_display.php(4021): GFFormDisplay::get_field_content(Object(GF_Field_Address), Array, false, 109, Array)
#5 /Users/saif/Local Sites/45960/app/public/wp-content
@saifsultanc
saifsultanc / gw-validate-that-a-value-exists.php
Created April 19, 2023 18:29
46674-gw-validate-that-a-value-exists.php
<?php
/**
* Gravity Wiz // Gravity Forms // Validate that a Value Exists
*
* Ensure that a value entered in Form A has been previously submitted on Form B. This is useful if you're generating a reference number of some sort
* on Form B and would like the user to enter it on Form A.
*
* @version 1.8.1
* @author David Smith <[email protected]>
* @license GPL-2.0+