Skip to content

Instantly share code, notes, and snippets.

Guido Walter Pettinari coccoinomane

Block or report user

Report or block coccoinomane

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@coccoinomane
coccoinomane / laravel_socialite_migration.php
Created Dec 27, 2018
Laravel migration that adds the columns required by Google Login as per this tutorial => https://medium.com/employbl/add-login-with-google-to-your-laravel-app-d2205f01b895
View laravel_socialite_migration.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateUsersTableForGoogleLogin extends Migration
{
/**
* Run the migrations.
@coccoinomane
coccoinomane / google-forms-public-images.js
Last active May 22, 2018
Make images submitted via a Google Form publicly viewable.
View google-forms-public-images.js
/**
* Make images submitted via a Google Form publicly viewable.
*
* Updated version at https://gist.github.com/bef1b29628be234978f6d286f4e719ba
*
* INSTRUCTIONS
*
* 1. Open the response spreadsheet.
* 2. Open the script editor (Tools -> Script Editor), paste the content of this
* file inside the editor, and save (Ctrl+S or Cmd+S).
@coccoinomane
coccoinomane / woocommerce-emails-add-reply-to-and-bcc.php
Last active Dec 18, 2018
Add 'Reply-To' header to WooCommerce admin emails, so that the admin can reply directly to the buyer; optionally add also BCC field to all emails sent by WooCommerce (both to the customer and to the admin).
View woocommerce-emails-add-reply-to-and-bcc.php
<?php
/**
* Add 'Reply-To' header to admin emails, so that the admin can reply
* directly to the buyer; optionally add also BCC field to all emails
* sent by WooCommerce (both to the customer and to the admin).
*
* The $object argument can be any WooCommerce object (product, order,
* user...) depending on the email ID.
*
* Possible email IDs can be extracted from filenames in the
View google_sheets_linked_dropdowns.gs
/**
* Allow dependent drop downs in Google Sheets
*
* - Allows any number of nested dropdown columns.
* - Nested dropdowns can occur anywhere in the sheet.
* - All options for the dropdowns live in a unique separate sheet
* - Nesting works only for adjacent columns.
* - Works also when editing a range of cells.
*
* Updated code at https://gist.github.com/0bf358bafc2b4d143a0e33dfb912020c
@coccoinomane
coccoinomane / dialog.html
Last active Apr 24, 2018 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://gist.github.com/arthurattwell/aa5afc178624bdd6f46c2d0d28d06136, original credits to Alexander Ivanov https://www.youtube.com/watch?v=dm4z9l26O0I)
View dialog.html
<div style="font-family: sans-serif;">
<? var data = valid(); ?>
<form id="form" name="form">
<? if(Object.prototype.toString.call(data) === '[object Array]') { ?>
<? for (var i = 0; i < data.length; i++) { ?>
<? for (var j = 0; j < data[i].length; j++) { ?>
<input type="checkbox" id="ch<?= '' + i + j ?>" name="ch<?= '' + i + j ?>" value="<?= data[i][j] ?>"><?= data[i][j] ?><br>
<? } ?>
<? } ?>
<? } else { ?>
View main_social.inc.html
<script type="text/javascript">
prepaiderr_1 = "{PREPAIDERR_01}";
prepaiderr_2 = "{PREPAIDERR_02}";
prepaiderr_3 = "{PREPAIDERR_03}";
</script>
<script type="text/javascript">
var voucher_or_normal = {OPTIONAL} ; // 0 - no optional, 1 is basic, 2 is voucher code, 3 is SMS
var display_facebook_button = {DISPLAY_FACEBOOK_BUTTON} ; // 1 - visible, 0 hidden
var display_google_button = {DISPLAY_GOOGLE_BUTTON} ;// 1 - visible, 0 hidden
View Import Google form as pure text.js
/**
* Make sure that Google Forms are stored in Google Spreadsheet
* as plain text; among other things, this script solves the problem
* whereby leading zeros are stripped from Google Form answers.
*
* This is a Google Script and it needs to be attached to a Google
* Spreadsheet:
* 1) Open the Google Spreadsheet linked to the Google Form, and
* go to Tools -> Script editor.
* 2) Paste the content of this file in the editor and save.
View woocommerce_google_analytics_placed_order.php
<?php
/**
* Send an event to GA whenever a user is about to initiate payment.
*
* The event is fired not just after the user clicks on the "Place Order"
* button, but when WooCommerce is actually going to redirect the user
* to the Payment Gateway, using the woocommerce_checkout_order_processed
* action.
*
* Furthermore, additional information is passed with the event:
View get_ip_address.php
<?php
/**
* Return the client's IP address.
*
* Returns the IP address if found, an empty string if not. The
* output is santized via FILTER_VALIDATE_IP.
*
* The algorithm uses the HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR
* globals to infer the IP address; if they are not available (as
* it is the case in most cases), it uses the REMOTE_ADDR global.
@coccoinomane
coccoinomane / request.php
Last active Jun 6, 2016
Print to screen and save to file the most important global PHP variables: _POST, _GET, _SERVER, _FILES, _REQUEST.
View request.php
<?php
/**
* Print to screen and save to file the most important global PHP
* variables: _POST, _GET, _SERVER, _FILES, _REQUEST.
*
* As an alternative, consider also the free service http://requestb.in/.
*
* Created by Guido W. Pettinari on 06/06/2016.
* Latest version: https://gist.github.com/2eae82be7d5b4c35dbfd73fcf5c7eefb
*/
You can’t perform that action at this time.