Skip to content

Instantly share code, notes, and snippets.

View rubenRP's full-sized avatar

Rubén Rodríguez rubenRP

View GitHub Profile
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
@rubenRP
rubenRP / adding-prettier-to-projects.md
Last active September 26, 2019 13:32 — forked from whoisryosuke/adding-prettier-to-projects.md
Workflow - Adding ESLint (Airbnb) + Prettier to projects
# Install ESLint and Babel ESLint
# Make sure to install at least v5.1.0 of ESLint
npm install --save-dev eslint babel-eslint

# Install the Airbnb configs (3 of them, listed below)
npx install-peerdeps --dev eslint-config-airbnb

# Install Prettier + ESLint config
npm install --save-dev --save-exact prettier-eslint eslint-config-prettier
@rubenRP
rubenRP / AddImageToCompareProductsPlugin.php
Created February 14, 2019 15:44 — forked from denchev/AddImageToCompareProductsPlugin.php
Magento 2 show image in sidebar compare list
<?php
namespace Vendor\Namespace\Plugin;
use Magento\Catalog\Helper\ImageFactory;
use Magento\Catalog\Helper\Product\Compare;
use Magento\Catalog\Model\ProductRepository;
class AddImageToCompareProductsPlugin
{
@rubenRP
rubenRP / .bootstraprc
Created April 27, 2018 09:07
Bootstraprc file for support Bootstrap 4 in Deity.
---
# Output debugging info
# loglevel: debug
# Major version of Bootstrap: 3 or 4
bootstrapVersion: 4
# If Bootstrap version 4 is used - turn on/off flexbox model
useFlexbox: true
<?php
use Magento\Framework\App\Area;
require __DIR__ . '/app/bootstrap.php';
class testAbstractExtensibleModelApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface
{
/**
* @return \Magento\Framework\App\Response\Http
*/
@rubenRP
rubenRP / messages.phtml
Created February 16, 2018 12:48
Magento 2. Medium post snippet
<div data-bind="scope: 'messages'">
<div data-bind="visible: isVisible(), click: removeAll">
<!-- ko if: cookieMessages && cookieMessages.length > 0 -->
<div role="alert" data-bind="foreach: { data: cookieMessages, as: 'message' }" class="messages">
<div data-bind="attr: {
class: 'message-' + message.type + ' ' + message.type + ' message',
'data-ui-id': 'message-' + message.type
}">
<div data-bind="html: message.text"></div>
</div>
@rubenRP
rubenRP / messages.js
Last active February 16, 2018 12:47
Magento 2. Medium post snippet
define([
'jquery',
'uiComponent',
'Magento_Customer/js/customer-data',
'underscore',
'jquery/jquery-storageapi'
], function ($, Component, customerData, _) {
'use strict';
return Component.extend({
@rubenRP
rubenRP / HeaderPagination.php
Last active October 5, 2022 20:55 — forked from zack6849/HeaderPagination.php
SEO rel="next/prev" for Magento 2. Pagination in head
<?php
namespace Revival\Seo\Block;
use Magento\Framework\View\Element\Template;
/**
* To make this appear in the header for the catalog, you'd need to add this as a block in ${THEME_DIR}/Magento_Catalog/layout/catalog_category_view.xml
*
* EG:
@rubenRP
rubenRP / terminalControls
Last active May 30, 2017 13:24
Commands for terminal
Stop using the arrow keys and navigate the command line more quickly with
ctrl+A: moves to the start of the line
ctrl+E: moves to the end of the line
ctrl+B: move back one character
ctrl+F: move forward one character
@rubenRP
rubenRP / getBrowser.js
Created December 21, 2016 11:10
Get browser JavaScript function
function get_browser() {
var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem=/\brv[ :]+(\d+)/g.exec(ua) || [];
return {name:'IE',version:(tem[1]||'')};
}
if(M[1]==='Chrome'){
tem=ua.match(/\bOPR|Edge\/(\d+)/)
if(tem!=null) {return {name:'Opera', version:tem[1]};}
}