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
MatheusMK3 / smooth.jquery.js
Last active Dec 3, 2015
jQuery plugin to smoothly scroll the page when a link referencing an element ID is clicked.
View smooth.jquery.js
/* smooth.jquery.js (ver 1.0.3)
* by Matheus Pratta (http://matheus.io)
* Requires: jQuery
* Optional: jQuery UI (for animations other than 'linear' and 'swing') - required by default
*/
// Thanks Sebastien Lorber for this snippet
function canonicalize (url) {
var div = document.createElement('div');
div.innerHTML = '<a></a>';
@MatheusMK3
MatheusMK3 / responsive.js
Created Jul 25, 2015
Fixes page scroll "jumping" on mobile devices with auto-hiding address bar, when it contains a 100% height element.
View responsive.js
/* responsive.js (v. 1.0.0)
* by Matheus Pratta (matheus.io)
* Fixes the page scroll from "jumping" when the user scrolls from a mobile device which auto-hides the address bar.
* Note: for 100% height elements, instead of seeing a jump in the scroll, the user may see a jump on the element itself (mostly when it's vertically centered)
* Requires: jQuery
*/
$(document).ready(function() {
$(window)
.scroll(function() {
window._scroll_pos = $(window).scrollTop();
@MatheusMK3
MatheusMK3 / normalize.min.css
Created Sep 1, 2015
My default CSS normalize, plus box reset
View normalize.min.css
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}
View proxy.shoutcast.php
<?php
/*
-=- Script de proxy para SHOUTcast -=-
// v1.0
Script original de referência: http://support.spacialaudio.com/forums/viewtopic.php?f=13&t=16858
@MatheusMK3
MatheusMK3 / Benchmark.php
Created Jan 13, 2017
PHP / Laravel 5 Benchmark Tool
View Benchmark.php
<?php
namespace App;
class Benchmark {
private static $_times = [];
private static $_last_time = null;
private static $_last_name = null;
public static function run ($name = 'Unnamed Test') {
@MatheusMK3
MatheusMK3 / array_multilevel.php
Last active Jan 18, 2017
PHP helper to retrieve and set data on multi-level arrays
View array_multilevel.php
public static function array_multilevel (&$array, $name, $fn = null, $separator = '.') {
$name_tree = explode($separator, $name);
if (count($name_tree) > 1) {
$name_tree = array_reverse($name_tree);
$name = array_pop($name_tree);
$name_tree = array_reverse($name_tree);
$name_tree = implode($separator, $name_tree);
if (!isset($array[$name]))
@MatheusMK3
MatheusMK3 / whatever.css
Created May 8, 2017
Always-visible element with shadows
View whatever.css
/* Apply this to a class, so the object is always visible */
.some-class {
box-shadow: inset 0px 0px 2px rgba(255,255,255,0.35), 0px 0px 2px rgba(0, 0, 0, 0.5);
}
@MatheusMK3
MatheusMK3 / cf7_cidades_estados.js
Last active Jul 7, 2017
Plugin para o Contact Form 7 que converte campos de texto "Cidade/Estado" em campos select de preenchimento automático
View cf7_cidades_estados.js
// Plugin de Cidade/Estado para ContactForm7
// Por Matheus Pratta <eu@matheus.io>
// Uso: cf7_cidades_estados('#seletorEstado', '#seletorCidade');
function cf7_cidades_estados (iEstado, iCidade) {
var base_dados = {"Acre":[{"id":79,"nome":"Acrelândia","estado_id":1,"created_at":null,"updated_at":null},{"id":80,"nome":"Assis Brasil","estado_id":1,"created_at":null,"updated_at":null},{"id":81,"nome":"Brasiléia","estado_id":1,"created_at":null,"updated_at":null},{"id":82,"nome":"Bujari","estado_id":1,"created_at":null,"updated_at":null},{"id":83,"nome":"Capixaba","estado_id":1,"created_at":null,"updated_at":null},{"id":84,"nome":"Cruzeiro do Sul","estado_id":1,"created_at":null,"updated_at":null},{"id":85,"nome":"Epitaciolândia","estado_id":1,"created_at":null,"updated_at":null},{"id":86,"nome":"Feijó","estado_id":1,"created_at":null,"updated_at":null},{"id":87,"nome":"Jordão","estado_id":1,"created_at":null,"updated_at":null},{"id":88,"nome":"Mâncio Lima","estado_id":1,"created_at":null,"updated_at":null},{"
View Keybase.gist
### Keybase proof
I hereby claim:
* I am matheusmk3 on github.
* I am matt_pratta (https://keybase.io/matt_pratta) on keybase.
* I have a public key ASCmjAFCKokPiTDRDM9RhHwXtS0RX3qh2bb6EBfWYz4Vzgo
To claim this, I am signing this object:
@MatheusMK3
MatheusMK3 / google-font-packager.php
Created Feb 11, 2018
CLI tool to download Google Fonts into a local directory, in WOFF2 format, while rewriting Google Fonts CSS to point to local files.
View google-font-packager.php
<?php
/************************************************************************************************
* Google Font Packager
* Version 1.0 (2018-02-11)
* by Matheus Pratta (https://github.com/matheusmk3)
*/
if (!isset($argv[1]))
die ('Usage: google-font-packager.php [google-font-import-url [output-file.css]]');
You can’t perform that action at this time.