Skip to content

Instantly share code, notes, and snippets.

View edrdesigner's full-sized avatar

Eduardo Reichert edrdesigner

View GitHub Profile
/**
* Add funcionality to change the focus using tab and shiftkey
*/
function matrixTabIndex() {
var tabKey = 9;
$('#product-matrix-std .owl-item').each(function(){
$(this).find('INPUT[type=hidden]').attr('tabindex', '-1');
/**
* For mobile banner.
*/
$.smartbanner({
title: 'TITULO DO SITE',
author: 'DESCRICAO OU AUTHOR',
price: 'GRÁTIS',
appStoreLanguage: 'pt-br',
inAppStore: 'Disponível na App Store',
inGooglePlay: 'Disponível no Google Play',
@edrdesigner
edrdesigner / Observer.php
Created August 2, 2017 14:29 — forked from mystix/Observer.php
Delete abandoned Magento shopping carts -- see http://www.magentocommerce.com/boards/viewthread/53981/P15/
<?php
/*
To make the cleaning expired carts automatic, override cleanExpiredQuotes with the following
version which will also take care of the old active carts: app/code/core/Mage/Sales/Model/Observer.php
*/
public function cleanExpiredQuotes($schedule)
{
// extending limit
// @overright = app/code/core/Mage/Core/Controller/Response/Http.php
public function sendHeaders()
{
if (!$this->canSendHeaders()) {
Mage::log('HEADERS ALREADY SENT: '.mageDebugBacktrace(true, true, true));
return $this;
}
if (in_array(substr(php_sapi_name(), 0, 3), array('cgi', 'fpm')))
{
<?php
$isMobile = Zend_Http_UserAgent_Mobile::match(
Mage::helper('core/http')->getHttpUserAgent(),
$_SERVER
);
@edrdesigner
edrdesigner / robots.txt
Created November 7, 2018 13:19 — forked from petskratt/robots.txt
Magento robots.txt
# robots.txt for Magento 1.9.x / v1.6 2018-08-19 / Peeter Marvet
# (original version from 2015, edited in 2017 to add filter query parameter disallow samples + some wildcards,
# edited in 2018 to add query params blocking to Yandex as named User-agent does not read *)
# based on:
# http://inchoo.net/ecommerce/ultimate-magento-robots-txt-file-examples/
# http://www.byte.nl/blog/magento-robots-txt/
# https://astrio.net/blog/optimize-robots-txt-for-magento/
#
# comment and clone at https://gist.github.com/petskratt/016c9dbf159a81b9d6aa
# Keep in mind that by standard robots.txt should NOT contain empty lines, except between UA blocks!
@edrdesigner
edrdesigner / radioTabbable.ng.js
Created April 5, 2019 14:03 — forked from jonathanconway/radioTabbable.ng.js
Angular Directive that makes individual radio-buttons focusable using the keyboard only. (Useful for accessibility, on a case-by-case basis.)
/**
* @ngdoc directive
* @name radioTabbable
* @requires none
* @description
* Makes individual radio buttons focuseable using the TAB key.
* (By default, pressing TAB while on a radio button would have shifted focus to the next control outside of the radio group.)
* @usage
* <input type="radio" name="radioGroup" value="0" radio-tabbable="" />
* <input type="radio" name="radioGroup" value="1" radio-tabbable="" />
@edrdesigner
edrdesigner / nginx_config_deploy
Created June 23, 2019 19:17
Nginx config para react deploy
## cmd vim /etc/nginx/sites-available/default
upstream node {
server 127.0.0.1:8080;
keepalive 64;
}
server {
listen 80;
# server_name domain.com;
@edrdesigner
edrdesigner / media-query.css
Created August 12, 2019 11:36 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
export default function flatten(arr) {
return arr.reduce((flat, toFlatten) => {
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
}, []);
}
// Test
flatten([[1,2,[3]],4]);