Skip to content

Instantly share code, notes, and snippets.

View luizventurote's full-sized avatar

Luiz Venturote luizventurote

View GitHub Profile
@luizventurote
luizventurote / findLocalItems.js
Created December 25, 2017 18:55 — forked from n0m4dz/findLocalItems.js
how to filter keys from localStorage with a regex
// returns an array of localStorage items in key/value pairs based on a query parameter
// returns all localStorage items if query isn't specified
// query can be a string or a RegExp object
function findLocalItems (query) {
var i, results = [];
for (i in localStorage) {
if (localStorage.hasOwnProperty(i)) {
if (i.match(query) || (!query && typeof i === 'string')) {
value = JSON.parse(localStorage.getItem(i));
@luizventurote
luizventurote / WordPress.class.php
Created October 7, 2017 20:39 — forked from Jamesking56/WordPress.class.php
Read Wordpress Export XML to PHP
<?php
/**
* WordPress class - Manages the WordPress XML file and gets all data from that.
*/
class Wordpress
{
public static $wpXML;
@luizventurote
luizventurote / 0_reuse_code.js
Created June 17, 2017 17:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@luizventurote
luizventurote / debug_xml_magento2.md
Created June 2, 2017 05:12 — forked from gelanivishal/debug_xml_magento2.md
Debugging layout XML loading in Magento 2

Open following file :

{root}/vendor/magento/framework/View/Model/Layout/Merge.php

and find _loadFileLayoutUpdatesXml function at line number 681.

Just echo $file->getFilename(); in foerach. You can see list of layout xml files adding in that action.

@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
@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 / 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 / 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 / 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 / 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/