Skip to content

Instantly share code, notes, and snippets.

View edrdesigner's full-sized avatar

Eduardo Reichert edrdesigner

View GitHub Profile
@edrdesigner
edrdesigner / designer.html
Created December 16, 2014 15:59
designer
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@edrdesigner
edrdesigner / ssl-serverpilot.md
Created December 22, 2016 12:15 — forked from arjenblokzijl/ssl-serverpilot.md
How To Add SSL to ServerPilot nginx

How To Add SSL to ServerPilot nginx

Requirements

  1. Domain (i.e. example.com)
  2. Subdomain(s): (i.e. www.example.com)
  3. Username
  4. App name

Create the Certificate

@edrdesigner
edrdesigner / magento-design-exception.txt
Created January 10, 2017 13:15 — forked from r-martins/magento-design-exception.txt
Magento Design Exception - Para Mobile
iP(hone|od)|(a|A)ndroid.*(m|M)(obile|ini)|(a|A)ndroid 3|BlackBerry|IEMobile|Windows Mobile|Windows Phone|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune|Googlebot-Mobile
new Promise(function(resolve,reject){
setTimeout(function(){ console.log('1500'); resolve('ok1') },1500)
}).then(
function(result) {
new Promise(function(resolve,reject){
setTimeout(function(){ console.log('1500'); resolve('ok2') },1500)
}).then(function(result){
console.log(result);
new Promise(function(resolve,reject){
setTimeout(function(){ console.log('6500'); resolve('ok3') },6500)
@edrdesigner
edrdesigner / local.xml
Created June 20, 2017 11:54
How to show address fields in register magento 1.9 at local.xml
<customer_account_create>
<reference name="customer_form_register">
<action method="setData"><key>show_address_fields</key><value>1</value></action>
</reference>
</customer_account_create>

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
<?php
$date_plus_60_days = new DateTime("30-06-2017");
$date_plus_60_days->modify("+1 days");
$date_plus_60_days->modify("+3 days");
//echo $date_plus_60_days->format("D");
$d_leadtime = 3;
$date = "30/06/2014";
SELECT DISTINCT(p.ID), p.post_title, p.post_content FROM `wp_posts` p
LEFT JOIN wp_posts im ON p.ID = im.post_parent AND im.post_type = "attachment"
WHERE p.post_status ='publish'
AND p.post_type = "post"
AND im.ID IS NULL
AND p.post_content NOT REGEXP 'src=".*"'
@edrdesigner
edrdesigner / customermagento.php
Created July 5, 2017 11:35
Get Logged In Customer’s Magento 1.9 details
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
// Load the customer's data
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customer->getPrefix();
$customer->getName(); // Full Name
$customer->getFirstname(); // First Name
$customer->getMiddlename(); // Middle Name
@edrdesigner
edrdesigner / magento_varien_types.php
Created July 7, 2017 18:37
Magento Varien Types
const TYPE_BOOLEAN = 'boolean';
const TYPE_SMALLINT = 'smallint';
const TYPE_INTEGER = 'integer';
const TYPE_BIGINT = 'bigint';
const TYPE_FLOAT = 'float';
const TYPE_NUMERIC = 'numeric';
const TYPE_DECIMAL = 'decimal';
const TYPE_DATE = 'date';
const TYPE_TIMESTAMP = 'timestamp'; // Capable to support date-time from 1970 + auto-triggers in some RDBMS
const TYPE_DATETIME = 'datetime'; // Capable to support long date-time before 1970