Skip to content

Instantly share code, notes, and snippets.

View rafaelstz's full-sized avatar
👨‍🔬

Rafael Corrêa Gomes rafaelstz

👨‍🔬
View GitHub Profile
@rafaelstz
rafaelstz / Category.sql
Created September 23, 2016 16:45 — forked from ticean/Category.sql
A series of queries for selecting Magento entity EAV attributes, and their values. Lots of union here...
SET @entityid = '3';
SELECT ea.attribute_id, ea.attribute_code, eav.value AS 'value', 'varchar' AS 'type'
FROM catalog_category_entity e
JOIN catalog_category_entity_varchar eav
ON e.entity_id = eav.entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.entity_id = @entityid
UNION
@rafaelstz
rafaelstz / .gitignore
Last active April 12, 2022 12:55
Gitignore to Magento 2
#=========================#
# LeSite eCommerce Agency #
#=========================#
# Custom
#=========================#
/.dep/*
/.github
/*.sql
/*.sql.gz
@rafaelstz
rafaelstz / get.js
Last active October 6, 2023 14:35
AJAX GET and POST with pure Javascript
// Exemplo de requisição GET
var ajax = new XMLHttpRequest();
// Seta tipo de requisição e URL com os parâmetros
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true);
// Envia a requisição
ajax.send();
// Cria um evento para receber o retorno.
@rafaelstz
rafaelstz / magento-code-snippets.md
Created March 21, 2016 13:36 — forked from arosenhagen/magento-code-snippets.md
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@rafaelstz
rafaelstz / nginx_VPS.conf
Last active March 16, 2016 20:15
Magento Nginx VPS Config
server {
listen 80;
server_name localhost;
root /var/www/cabocla;
autoindex off;
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
@rafaelstz
rafaelstz / after-body-start.phtml
Created March 10, 2016 16:07
Facebook Pixel Code for Magento Stores
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', 'Put your pixel ID here');
fbq('track', "PageView");
@rafaelstz
rafaelstz / nginx.conf
Created January 27, 2016 20:54 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance).
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@rafaelstz
rafaelstz / permissoes_magento
Created November 27, 2015 13:01
Permissões Magento
# With Sudo
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
sudo chmod 777 -R app/etc/;
sudo chmod 777 -R var/;
sudo chmod 777 -R media/;
# Without Sudo
@rafaelstz
rafaelstz / Add_breadcrumbs_xml.xml
Created November 11, 2015 14:00
Add breadcrumbs XML
<reference name="breadcrumbs">
<action method="addCrumb">
<crumbname>Home</crumbname>
<crumbinfo>
<label>Home</label>
<title>Home</title>
<link>/</link>
</crumbinfo>
</action>
<action method="addCrumb">
@rafaelstz
rafaelstz / foreign_key_check.sql
Created October 28, 2015 19:21
Remove checks to FOREIGN_KEY
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE my_first_table_to_drop;
DROP TABLE my_second_table_to_drop;
SET FOREIGN_KEY_CHECKS=1;