Skip to content

Instantly share code, notes, and snippets.

View garbinmarcelo's full-sized avatar
😁
Do You Come Here Often?

Marcelo Garbin garbinmarcelo

😁
Do You Come Here Often?
View GitHub Profile
@garbinmarcelo
garbinmarcelo / docker-install-mariadb-with-slow-query.txt
Created January 4, 2023 11:59
docker-install-mariadb-with-slow-query
# Docker image mariadb 10.2.24 (https://hub.docker.com/_/mariadb)
~$ docker run --name mariadb -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d docker.io/library/mariadb:10.2.24 --slow-query-log=TRUE --log-output=TABLE
# SQL check variables
SHOW VARIABLES LIKE 'slow_query%';
SHOW VARIABLES LIKE 'log_output%';
SHOW VARIABLES LIKE 'long_%';
SELECT benchmark(100000000, md5('running query'));
SELECT * FROM mysql.slow_log;
@garbinmarcelo
garbinmarcelo / beforeEach.js
Created July 29, 2020 12:19
Vue Router beforeEach.js
import store from '@/store'
const route = {
login: 'login',
dashboard: 'dashboard'
}
export default async (to, from, next) => {
// Set head title
document.title = (to.meta.title) ? `${to.meta.title} / ${process.env.VUE_APP_FULL_NAME}` : process.env.VUE_APP_FULL_NAME
@garbinmarcelo
garbinmarcelo / formatar_cnpj_cpf.md
Created January 30, 2020 13:31 — forked from davidalves1/formatar_cnpj_cpf.md
Função para formatar CNPJ e CPF, disponível em PHP e JS

PHP

function formatCnpjCpf($value)
{
  $cnpj_cpf = preg_replace("/\D/", '', $value);
  
  if (strlen($cnpj_cpf) === 11) {
    return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
  } 
 
@garbinmarcelo
garbinmarcelo / config.tabs.js
Created January 25, 2020 13:48
Bootstrap Tabs: I usually use 4 tabs, Records, Deleted, Files and Upload Files. So when I'm in the Send Files Tab and do the upload and click on the Files tab, this page is reloaded to show the listing (because I'm not using ajax on this listing), but it works fine, if you don't send files, the page is not reloaded when clicked on the Files tab.
// https://getbootstrap.com/docs/4.0/components/navs/#tabshow
$(document).ready(function(){
if($('#tabsCRUD').length > 0){
let urlAnterior = (localStorage.getItem('url_anterior') != null)? helpers.getPathFromUrl(localStorage.getItem('url_anterior')) : null;
let urlAtual = helpers.getPathFromUrl(ATUAL_URL);
let tabCookie = Cookies.get('tab_crud');
let activeTab = localStorage.getItem('activeTab');
let btnSubmit = $('.kt-form__actions');
// Verifica se possui cookie (vindo do controller)
@garbinmarcelo
garbinmarcelo / .htaccess
Created January 20, 2020 20:07 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@garbinmarcelo
garbinmarcelo / .gitignore
Created March 16, 2019 17:51 — forked from chhh/.gitignore
.gitignore file for IDEA, Eclipse, NetBeans
#
# Project specific excludes
#
tomcat
#
# Default excludes
#
@garbinmarcelo
garbinmarcelo / homestead-manual-install.md
Created January 12, 2019 11:42 — forked from idecardo/homestead-manual-install.md
Laravel Homestead Manual Installation

Getting Started

Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine. Read more...

Download

Download homestead box:

@garbinmarcelo
garbinmarcelo / git.md
Created June 13, 2018 12:40 — forked from leocomelli/git.md
Lista de comandos úteis do GIT

#GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@garbinmarcelo
garbinmarcelo / _toc.md
Created July 13, 2016 19:37
Major dependencies that I use on Grunt, Gulp, Bower, Karma and Node/CLI.