Skip to content

Instantly share code, notes, and snippets.

building tomorrow's web.

Matheus Pratta MatheusMK3

building tomorrow's web.
View GitHub Profile
MatheusMK3 / espruino-serial-mixed-mode.js
Created Jun 4, 2022
Small Espruino thingy that allows for bidirectional serial communication while also detecting Espruino IDE for development
View espruino-serial-mixed-mode.js
// Start init
console.log('Preparing JS environment...');
console.log('Booting I2c...');
I2C1.setup({scl:NodeMCU.D1, sda:NodeMCU.D2});
// Command object
var COMMANDS = {};
// Response
MatheusMK3 / se-analog-basic-control.cs
Created Feb 20, 2022
🚀 Compiled SE AnalogThrottle sample script
View se-analog-basic-control.cs
* R e a d m e
* -----------
* In this file you can include any instructions or other comments you want to have injected onto the
* top of your final script. You can safely delete this file if you do not want any such comments.
// List of valid axis types
private readonly string[] AXIS_TYPES = new string[] { "Normal", "Center", "Reverse" };
MatheusMK3 / slimplicity.omp.json
Created Sep 6, 2021
🎨 Slimplicity, a modded "slim" theme for PowerShell & oh-my-posh
View slimplicity.omp.json
"$schema": "",
"final_space": true,
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{if .Root}}root :: {{end}}{{.Shell}} :: {{.Folder}}",
"blocks": [
"type": "prompt",
"alignment": "left",
MatheusMK3 / fn.flatten_redirect_chain.php
Created Aug 17, 2020
🔗 Follows a redirect chain path and either redirects to the final URL or returns it
View fn.flatten_redirect_chain.php
* fn.flatten_redirect_chain.php
* Follows a redirect chain path and either redirects to the final URL or returns it
* Author: Matheus Pratta <>
* License: 0BSD
* Version: 1.0.0
* @param string $destination The URL that is part of a redirect chain and shall be resolved
* @param mixed $redirect The redirect type to be used (301/302) or false for returning the final URL as string
MatheusMK3 /
Last active Apr 1, 2020
🔧 Fixes WordPress upload directories permissions being set to root, use it with crontab.
# Set this to your server's owner user (normally www-data)
# Set this to the path to your wp-content
# Gets current year and month numbers
year=`date +%Y`
MatheusMK3 / fix.wp-mysql8-onlyfullgroupby.php
Last active Oct 24, 2019
🔧 Fixes errors regarding ONLY_FULL_GROUP_BY when using WordPress with managed database services using MySQL 8.
View fix.wp-mysql8-onlyfullgroupby.php
Plugin Name: WP Managed MySQL 8 Fix
Plugin URI:
Description: Fixes issues regarding MySQL modes (ONLY_FULL_GROUP_BY) when on managed database services.
Author: Matheus Pratta
Version: 1.0.0
Author URI:
MatheusMK3 / fn.useragent-router.js
Created Sep 21, 2019
Very basic user-agent based router for, to be coupled with @now/static-build builds.
View fn.useragent-router.js
const https = require('https')
let cachedIndex = null
let cachedIndexHeaders = null
// Function to handle our OpenGraph tags
const handleOpenGraphUA = ['Twitterbot', 'Facebot', 'facebookexternalhit']
const handleOpenGraph = (req, res) => {
// Check if we're serving Twitter or Facebook bots
const requestUA = req.headers['user-agent']

Keybase proof

I hereby claim:

  • I am matheusmk3 on github.
  • I am matt_pratta ( on keybase.
  • I have a public key ASDtG3s8ze8nRwrdpdrAOs2cwtplnNiwkhHoXNAEzSTCvAo

To claim this, I am signing this object:

MatheusMK3 / fn.debounce.js
Last active Jul 31, 2019
Função para debounce de eventos em Javascript
View fn.debounce.js
function debounce (fn, time) {
// Estado do throttle
let throttling = false
// Retorna uma função especial para fazer o debounce
return () => {
// Se estiver com throttle ativo, retornar
if (throttling) return;
// Ativa o throttle