Skip to content

Instantly share code, notes, and snippets.

View MatheusR42's full-sized avatar
🤜
🤛

Matheus Araujo MatheusR42

🤜
🤛
View GitHub Profile
@MatheusR42
MatheusR42 / EletronicLife.js
Last active December 31, 2017 15:19
Eletronic Life - Node - Eloquent Javascript
var _ = require('lodash');
console.reset = function () {
return process.stdout.write('\033c');
}
var plan = [
"#####################",
"# # o ##",
"# #",
@MatheusR42
MatheusR42 / count.mysql
Created June 19, 2018 04:23
Include NULL values in aggregate function COUNT() in MySQL
CREATE TABLE example_table (
hour INT
);
INSERT INTO example_table (hour)
VALUES (1),(2),(2),(NULL),(NULL),(NULL);
COMMIT;
SELECT
@MatheusR42
MatheusR42 / GetAllDirectories.js
Created August 25, 2018 16:47
This script runs on VTEX /admin/a. It opens all the subfolders from a selected folder and return it as a Set(very similar to array)
class GetAllDirectories {
constructor(diretoryName, siteUrl, delay){
this.diretoryName = diretoryName;
this.siteUrl = siteUrl || '';
this.delay = delay || 6000;
this.directories = new Set();
this.openFirstFolder()
}
openFirstFolder() {
@MatheusR42
MatheusR42 / ROS Commands.md
Last active May 11, 2020 04:50
Commands from Ros Essentials Udemy Course (https://www.udemy.com/course/ros-essentials)

ROS

Creating workspace

mkdir -p ~/catkin_ws/src && cd ~/catkin_ws

Go to ROS workspace

roscd

Create a package

{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"breadcrumbs.enabled": false,
"explorer.compactFolders": false,
"window.zoomLevel": 1,
"emmet.includeLanguages": {
"javascript": "javascriptreact"
query productSearchV3($query: String, $fullText: String, $selectedFacets: [SelectedFacetInput], $orderBy: String, $from: Int, $to: Int, $hideUnavailableItems: Boolean = false, $skusFilter: ItemsFilter = ALL_AVAILABLE, $simulationBehavior: SimulationBehavior = default, $installmentCriteria: InstallmentsCriteria = MAX_WITHOUT_INTEREST, $productOriginVtex: Boolean = false, $fuzzy: String, $operator: Operator, $searchState: String) {
productSearch(query: $query, fullText: $fullText, selectedFacets: $selectedFacets, orderBy: $orderBy, from: $from, to: $to, hideUnavailableItems: $hideUnavailableItems, simulationBehavior: $simulationBehavior, productOriginVtex: $productOriginVtex, fuzzy: $fuzzy, operator: $operator, searchState: $searchState) {
products {
cacheId
productId
description
productName
productReference
linkText
brand
{
"data": {
"productSearch": {
"products": [
{
"cacheId": "batedeira-stand-mixer-artisan-empire-red-kitchenaid-outlet-kea33-kea30",
"productId": "2002499",
"description": "Um ícone no mundo inteiro!\r\n\r\n\r\n\r\nA Stand Mixer KitchenAid é um ícone mundial de design e performance, presente no MoMA em Nova York.",
"productName": "Batedeira Stand Mixer Artisan Empire Red - Outlet KEA33 KEA30",
"productReference": "KEA33_OUT,KEA30_OUT",
{
"above": "The {{field}} should be above {{argument.0}}.",
"accepted": "The {{field}} should have been accepted",
"after": "The {{field}} should be a date after {{argument.0}}",
"after_offset_of": "The {{field}} should be after {{argument.0}} {{argument.1}} from today’s date",
"alpha": "The {{field}} should contain letters only",
"alpha_numeric": "The {{field}} should contain letters and numbers only",
"array": "The {{field}} should be an ARRAY.",
"before": "The {{field}} should be a date before {{argument.0}}.",
"before_offset_of": "The {{field}} should be before {{argument.0}} {{argument.1}} from today’s date",
{
"above": "{{field}} deve ser acima de {{argument.0}}.",
"accepted": "{{field}} deve ter sido aceito",
"after": "{{field}} deve ser uma data após {{argument.0}}",
"after_offset_of": "{{field}} deve ser mais recente que {{argument.0}} {{argument.1}} a partir da data atual",
"alpha": "{{field}} deve conter apenas letras",
"alpha_numeric": "{{field}} deve conter apenas letras e números",
"array": "{{field}} deve ser um ARRAY.",
"before": "{{field}} deve ser uma data anterior a {{argument.0}}.",
"before_offset_of": "{{field}} deve ser aterior a {{argument.0}} {{argument.1}} a partir da data de hoje",
@MatheusR42
MatheusR42 / Buybutton.md
Last active October 26, 2020 14:25
Buybutton

-O buybutton só funciona dentro do contexto de produto da vtex

-O contexto de produto da vtex é bem simples, basta iniciar um contexto no react com o produto no formato do json da vtex

-Infelizmente não vai funcionar nas páginas de search porque o json de produto da chaordic é diferente, por isso vc vai precisar fazer uma validação para não exibir nessas páginas

-Para fazer funcionar na página de search precisariamos fazer uma customização bem grande mexendo com graphql

Passo a passo para exibir o buybutton: