Skip to content

Instantly share code, notes, and snippets.

View coccoinomane's full-sized avatar
🎯
Focusing

coccoinomane coccoinomane

🎯
Focusing
View GitHub Profile
@coccoinomane
coccoinomane / Excel Password Generator.md
Last active April 8, 2024 23:19
Copy this formula into an Excel cell to generate a random 9-character password

Copy this formula into an Excel cell to generate a random 9-character password. Then Copy & Paste Special (as value) in place in order to avoid the cell being continuosly re-evaluated. Formula taken from: http://ficility.net/2013/04/26/easy-excel-based-password-generator/.

English version

=CHAR(RANDBETWEEN(65;90))&CHAR(RANDBETWEEN(97;122))&CHAR(RANDBETWEEN(97;122))&CHAR(RANDBETWEEN(65;90))&RANDBETWEEN(1000;9999)&CHAR(RANDBETWEEN(42;43))

English version (with commas)

@coccoinomane
coccoinomane / google-forms-public-images.js
Last active January 13, 2024 10:00
Make images submitted via a Google Form publicly viewable.
/**
* 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 / README.md
Last active November 18, 2022 15:29
Bash / zsh function to easily create, activate and deactivate virtual environments for Python 3

Run dotvenv in an empty folder to create a virtual env from scratch and activate it immediately:

$ dotvenv
Created virtual env
Activated virtual env
(.venv) $

Run again to deactivate the virtual env:

@coccoinomane
coccoinomane / dialog.html
Last active July 1, 2020 03:42 — 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)
<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 { ?>
@coccoinomane
coccoinomane / mailup_form_submission.js
Last active November 26, 2019 19:37
MailUp subscription via Javascript
/**
* Subscribe user in MailUp upon form completion, using MailUp
* HTTP API.
*
* To hook into the form submission we use button click rather than
* actual submission, because the latter approach (using $('form').submit)
* does not seem to work.
*
* The MailUp API specifications can be found here:
* http://help.mailup.com/display/mailupapi/HTTP+API+Specifications
/**
* Javascript for use with Universal Google Analytics (GA) that tracks the
* scrolling actions performed by the user of a website.
*
* This script is a version of the fantastic Advanced Content Tracking script
* by Justin Cutroni, slightly modified by Guido Pettinari to include extra
* documentation and adjust some parameters (see doc below). The original script
* can be found at http://cutroni.com/blog/2014/02/12/advanced-content-tracking-
* with-universal-analytics/, while the latest version of this script can be
* found at https://gist.github.com/a1c715e2a448da2dfd69.
@coccoinomane
coccoinomane / laravel_socialite_migration.php
Created December 27, 2018 20:45
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
<?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 / woocommerce-emails-add-reply-to-and-bcc.php
Last active December 18, 2018 21:36
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).
<?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
/**
* 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.
<?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: