Skip to content

Instantly share code, notes, and snippets.

never stop.

Matheus Pratta MatheusMK3

never stop.
Block or report user

Report or block MatheusMK3

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
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
MatheusMK3 / fn.textToCharBlocks.js
Created May 24, 2019
Converts a string of text into an array of text blocks
View fn.textToCharBlocks.js
* Converts a string of text into an array of text blocks with a maximum size of blockSize.
* @author Matheus Pratta <>
* @param {string} text
* @param {int} blockSize
* @returns {array}
function textToCharBlocks (text, blockSize) {
let textBlocks = []; // Array containing our text blocks
let currentBlock = ''; // accumulator
MatheusMK3 / OneDarkProX.itermcolors
Created Apr 17, 2019
My settings for CMD.exe colors, use with colortool
View OneDarkProX.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<key>Ansi 0 Color</key>
<key>Color Space</key>
<key>Blue Component</key>
MatheusMK3 / fn.debug_object.js
Last active May 24, 2019
Returns a complete human-readable breakdown of a Javascript object
View fn.debug_object.js
* debug_object (1.0.0)
* Returns a complete human-readable breakdown of a Javascript object
* Author: Matheus Pratta <>
function debug_object (obj, braces, level) {
// Recursion level
if (!level) level = braces ? 1 : 0;
// Identation
View wpu_get_nav_menu.fn.php
* Processa um menu do WordPress de acordo com a localização no tema
* Sintaxe: wpu_get_nav_menu ($localização, $returns = null)
* Sintaxe: wpu_get_nav_menu_array ($menu, $args = array())
* Autor: Matheus Pratta <>
function wpu_get_nav_menu ($location, $returns = null) {
// Obtemos as posições de menu no tema
View fn.find_best_match.php
* string find_best_match (string $word, array $db, float &$best_match_score);
* Compares $word with each ocurrence in $db, then results the closest matching string.
* Also returns how much both words matched in %.
function find_best_match ($word, $db, &$best_match_score) {
// Initialize our comparison variables
$best_match = $word;
$best_match_score = 0;
You can’t perform that action at this time.