Skip to content

Instantly share code, notes, and snippets.

View marcofugaro's full-sized avatar

Marco Fugaro marcofugaro

View GitHub Profile
@marcofugaro
marcofugaro / accurato.js
Last active December 4, 2020 09:10
Easter egg for the page https://www.accurat.it/about/
//
// $$$$$$$$\ $$$$$$\ $$$$$$\
// $$ _____|$$ __$$\ $$ __$$\
// $$ | $$ / \__|$$ / \__|
// $$$$$\ $$ |$$$$\ $$ |$$$$\
// $$ __| $$ |\_$$ |$$ |\_$$ |
// $$ | $$ | $$ |$$ | $$ |
// $$$$$$$$\ \$$$$$$ |\$$$$$$ |
// \________| \______/ \______/
//
@marcofugaro
marcofugaro / requestDeviceOrientation.js
Last active January 7, 2021 12:16
Function to request device orientation on Android and iOS devices, remember to use HTTPS
export function requestDeviceOrientation(fn, createTrigger) {
// iOS 13+
if (
window.DeviceOrientationEvent !== undefined &&
typeof window.DeviceOrientationEvent.requestPermission === 'function'
) {
// check if the user gave permissin in the past
window.DeviceOrientationEvent.requestPermission().then((response) => {
if (response == 'granted') {
fn()
@marcofugaro
marcofugaro / contact-form.js
Last active February 1, 2024 08:30
simple php mail snippet with PHPMailer through SMTP and Google reCAPTCHA
var form = $('#form');
form.find('[type="submit"]').on('click', function(e) {
var isFormValid = form[0].checkValidity();
var isCaptchaOk = $('#g-recaptcha-response').val();
if(isFormValid && isCaptchaOk) {
e.preventDefault();
var dataObj = {