Skip to content

Instantly share code, notes, and snippets.

View luizventurote's full-sized avatar

Luiz Venturote luizventurote

View GitHub Profile
@luizventurote
luizventurote / required-featured-image.php
Last active August 29, 2015 13:57
Alerta de uso obrigatório de imagem destacada antes da publicação de qualquer artigo.
<?php
// Nav Menu Dropdown Class
include_once( CHILD_DIR . '/lib/classes/nav-menu-dropdown.php' );
/**
* Mobile Menu
*
*/
function be_mobile_menu() {
<?php $helper = Mage::helper('cms');
$processor = $helper->getPageTemplateProcessor();
$html = $processor->filter($minha_variavel); ?>
@luizventurote
luizventurote / shopping_cart_sales_rule_with_coupon.php
Created October 9, 2015 20:03 — forked from antoinekociuba/shopping_cart_sales_rule_with_coupon.php
Magento - Create shopping cart price rule with a specific coupon code programmatically.
<?php
/**
* Create Shopping Cart Sales Rule with Specific Coupon Code Programmatically
*/
// All customer group ids
$customerGroupIds = Mage::getModel('customer/group')->getCollection()->getAllIds();
// SalesRule Rule model
$rule = Mage::getModel('salesrule/rule');
@luizventurote
luizventurote / robots.txt
Created October 9, 2015 20:04 — forked from antoinekociuba/robots.txt
Magento robots.txt template.
## Website Sitemap
# Sitemap: http://www.example.com/sitemap.xml
## Crawlers Setup
User-agent: *
# Crawl-delay: 30
## Do not crawl common Magento folders
Disallow: /app/
Disallow: /downloader/
@luizventurote
luizventurote / gahello.php
Created November 20, 2015 13:38 — forked from nitrix/gahello.php
Hello World! Testing Genetic Algorithms in PHP
<?php
$POPULATION = array(); //population of individuals
$POPULATION_SIZE = 100;
$DNA_SIZE = 12;
$GEN_COUNT = 1;
$TEST_COUNT = 0;
genInitPopulation();
while (true) {
naturalSelection();
@luizventurote
luizventurote / centos_install_compass.sh
Created January 8, 2016 14:43 — forked from amites/centos_install_compass.sh
bash script to install sass/compass onto centos
#! /bin/bash
# Sass: http://sass-lang.com/
# Sass is a "smart" form of css, supporting nested targeting of html, variables and logic
# scss is a variant of sass using a syntax much closer to css
# Compass: http://compass-style.org/
# Compass is a sass framework containing a range of shortcuts for cross-browser css effects.
# rounded corners, transparency...
@luizventurote
luizventurote / gist:2298848fb6cb23dd1c13cb2990489d5f
Created May 24, 2016 16:03 — forked from aleron75/gist:7304592
Programmaticalli create a Yes/No Magento Category Attribute
<?php
/** @var Mage_Eav_Model_Entity_Setup $installer */
$installer = $this;
$installer->startSetup();
$this->addAttribute(
'catalog_category',
'my_custom_attribute',
array(
'group' => 'General Information',
@luizventurote
luizventurote / gist:8270f909a1ed72e222526e6127d0b34a
Created July 23, 2016 02:47 — forked from jelmerdemaat/gist:4107273
JavaScript hasClass, addClass, removeClass
// JavaScript hasClass, addClass, removeClass
//source: http://www.avoid.org/?p=78
function hasClass(el, name) {
return new RegExp('(\\s|^)'+name+'(\\s|$)').test(el.className);
}
function addClass(el, name)
{
if (!hasClass(el, name)) { el.className += (el.className ? ' ' : '') +name; }
@luizventurote
luizventurote / instagram_api.php
Created September 12, 2016 22:01 — forked from arturmamedov/instagram_api.php
Instagram API retrive access token with PHP curl
<?php
// yo can follow this guide to http://www.benrlodge.com/blog/post/how-to-generate-an-instagram-access-token#
#1 first you need to create a Client in Instgram Developer Dashboard
// https://www.instagram.com/developer/clients/manage/
#2 after you need to retrive a oAuth code for after get access_token
// https://www.instagram.com/developer/authentication/
// change the params with your one and open link in browser