Skip to content

Instantly share code, notes, and snippets.

View cagartner's full-sized avatar

Carlos Augusto Gartner cagartner

View GitHub Profile
@cagartner
cagartner / valet-plus-destroy
Created July 3, 2019 18:08 — forked from dannygsmith/valet-plus-destroy
Remove valet-plus - reboot required
#!/usr/bin/env bash
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
@cagartner
cagartner / diagonal-css.scss
Created May 27, 2019 14:51
Diagonal CSS container
.hero--diagonal {
position: relative;
background-color: transparent;
&::before {
content: '';
position: absolute;
top: -50px;
left: 0;
width: 100%;
@cagartner
cagartner / magento-url-build.js
Created April 26, 2019 12:48
Magento 2 url build js
define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/view/payment/default',
'mage/url'
], function (quote, Component, urlBuilder) {
'use strict';
return Component.extend({
defaults: {
template: 'VendorName_ModuleName/payment/mypaymentmethod'
@cagartner
cagartner / price-utils-magento2.js
Last active September 27, 2022 12:15
Formating price on JS for Magento 2
define(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Catalog/js/price-utils'
],
function ($,quote, priceUtils) {
"use strict";
......
formatedPrice = getFormattedPrice(price)
@cagartner
cagartner / mariaDB-magento-config.md
Last active January 29, 2019 12:29
Magento 2 MariaDB performance configuration

We would also like to add some instructions to MariaDB usage, which are not mentioned in the official manual. Use the latest stable version of MariaDB. Properly configured MariaDB provides performance increase up to 65%. The recommended settings for innodb_buffer_pool_size on a dedicated database server are 5GB for 6GB of RAM; 12GB for 10GB of RAM, and 18GB for 24GB of RAM. If you use combined web and database servers, don’t consume more that 50% or RAM. In case of a dedicated database server, utilize ~ 80%. Other vital settings:

innodb_thread_concurrency = 2 * [numberofCPUs] + 2

innodb_flush_log_at_trx_commit = 2

thread_concurrency = [number of CPUs] * 3

thread_cache_size = 32

@cagartner
cagartner / update-passwd-m2.sql
Created January 21, 2019 12:47
Magento 2 update password directly in MYSQL
# Admin Password
SET @email='email@provedor', @passwd='NOVASENHA', @salt=MD5(RAND());
UPDATE admin_user
SET password = CONCAT(SHA2(CONCAT(@salt, @passwd), 256), ':', @salt, ':1')
WHERE email = @email;
# Customer Password
SET @email='email@provedor', @passwd='NOVASENHA', @salt=MD5(RAND());
@cagartner
cagartner / slideDownMenuEffect.css
Created January 3, 2019 14:00
slide down menu effect with scss
@keyframes slideInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
100% {
opacity: 1;
transform: translateY(0);
}
document.onscroll = function () {
if ($(window).scrollTop() >= 135) {
$('body').addClass('menu-sticked');
} else {
$('body').removeClass('menu-sticked');
}
}
@cagartner
cagartner / update_customer_attribute_magento.php
Created December 12, 2018 17:07
Update customer attribute definitions
<?php
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('customer', 'sge_fonepri', 'frontend_label', 'Telefone Residencial');
$installer->updateAttribute('customer', 'sge_fonesec', 'frontend_label', 'Telefone Celular');
$installer->updateAttribute('customer', 'sge_fonesec', 'is_required', 1);
$installer->endSetup();
@cagartner
cagartner / bootstrap-4.1-dropdown-hover.js
Created December 10, 2018 13:04
Mudar ação do dropdown de click para hover na versão 4.1+ Change action of dropdown of click to hover in version 4.1+
function toggleDropdown (e) {
let _d = $(e.target).closest('.dropdown'),
_m = $('.dropdown-menu', _d);
setTimeout(function(){
let shouldOpen = e.type !== 'click' && _d.is(':hover');
_m.toggleClass('show', shouldOpen);
_d.toggleClass('show', shouldOpen);
$('[data-toggle="dropdown"]', _d).attr('aria-expanded', shouldOpen);
}, e.type === 'mouseleave' ? 300 : 0);
}