Skip to content

Instantly share code, notes, and snippets.

View kenmasters's full-sized avatar

Ken John Siosan kenmasters

View GitHub Profile
@kenmasters
kenmasters / gist:4cdf592f5486432d7fb453a9ba86e3a9
Last active January 27, 2023 04:39
GravityForms Display month name instead of numbers 1-12
/**
* NOTE: This is a jQuery code used withing Blunova websites {GetAJob|CB|Docreko|OrderPayroll...}
* Place this code inside WP active themes js folder
*/
/**
* Tweak for Gravity Forms month name
* This will target all instance of date field month dropdown
*/
@kenmasters
kenmasters / A. INSTRUCTIONS.txt
Last active January 21, 2022 08:31
MAKE XAMPP SSL
Reference: https://shellcreeper.com/how-to-create-valid-ssl-in-localhost-for-xampp/
1. Create folder named: `C:\xampp\apache\crt`
2. Create files and store those file inside the newly created folder.
2.1 cert.conf
2.2 make-cert.bat
3. Edit cert.conf and Run make-cert.bat
Change {{DOMAIN}} text using the domain we want to use, in this case site.test and save.
@kenmasters
kenmasters / gist:d58c1900e247309a93c571806dc1b279
Created June 28, 2021 03:11
LARAVEL CARBON DATE FROM FORMAT
CODE INPUT:
Route::get('sample', function(){
$date = '06-28-2021'; //@fromFormat" m-d-Y
$date2 = Carbon::createFromFormat('m-d-Y', $date)->format('Y-m-d'); //@toFormat" Y-m-d
return response()->json(['from:' => $date, 'to' => $date2]);
});
RESULT:
@kenmasters
kenmasters / Postman POST PUT Requests.txt
Created March 21, 2021 15:21 — forked from ethanstenis/Postman POST PUT Requests.txt
How to make Postman work with POST/PUT requests in Laravel...
To make Postman work with POST/PUT requests...
https://laravel.com/docs/5.2/routing#csrf-x-csrf-token
In addition to checking for the CSRF token as a POST parameter, the Laravel VerifyCsrfToken middleware will also check for the X-CSRF-TOKEN request header.
1. Store the token in a "meta" tag at the top of your root view file (layouts/app.blade.php)...
<meta name="csrf-token" content="{{ csrf_token() }}">
** If using jQuery, you can now instruct it to include the token in all request headers.
$.ajaxSetup({
Example: Uploading file to specific customer of a given ID.
$foldername = 'customers/customer-'.$customer->id;
$base64_image = $request->input('field_name'); // Image is sent as Base64
// Currently accepts image only
if (preg_match('/^data:image\/(\w+);base64,/', $base64_image)) {
$data = substr($base64_image, strpos($base64_image, ',') + 1);
$extension = getFileExtension($base64_image);
# References:
# https://docs.gravityforms.com/dynamically-populating-drop-down-fields/
# https://docs.gravityforms.com/gf_field_select/
add_filter( 'gform_pre_render_45', 'disable_ADA_ACA_transactions' );
add_filter( 'gform_pre_validation_45', 'disable_ADA_ACA_transactions' );
add_filter( 'gform_pre_submission_filter_45', 'disable_ADA_ACA_transactions' );
add_filter( 'gform_admin_pre_render_45', 'disable_ADA_ACA_transactions' );
function disable_ADA_ACA_transactions( $form ) {
@kenmasters
kenmasters / GFORM: GFAPI::get_entries + pagination
Created March 16, 2018 16:19
List gravityform entries using GFAPI class + pagination
# http://inlinedocs.gravityhelp.com/class-GFAPI.html
# https://docs.gravityforms.com/getting-started-with-the-gravity-forms-api-gfapi/
# working code
# notes: we are to going to lists submitted entries of the current loggedin user.
$form_ids = [19, 20, 21, 22, 23, 24, 25, 26]; // accepts single or array of form id's.
$search_criteria = array(
'field_filters' => array(
'mode' => 'any',
@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active December 21, 2023 22:55
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@kenmasters
kenmasters / Common-Currency.json
Created December 8, 2017 03:55 — forked from ksafranski/Common-Currency.json
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@kenmasters
kenmasters / GFORM: Product Order Summary
Last active December 7, 2017 02:03
Option to remove or show product order summary when using {all_fields} merge tag
# Docs: https://docs.gravityforms.com/gform_display_product_summary/
# Disable for all forms
add_filter( 'gform_display_product_summary', '__return_false' );
# Disable for a specific form
add_filter( 'gform_display_product_summary', function( $display_product_summary, $field, $form, $entry ) {
return $form['id'] == 10 ? false : $display_product_summary;
}, 10, 4 );