Skip to content

Instantly share code, notes, and snippets.

View luizventurote's full-sized avatar

Luiz Venturote luizventurote

View GitHub Profile
@luizventurote
luizventurote / m2theme.sh
Last active August 29, 2019 17:46
Bash script to deploy Magento 2 theme static content.
#!/usr/bin/env bash
echo "M2 - Deploy Static Content $1/$2 🚀"
rm -rf var/view_preprocessed/pub/static/frontend/$1/$2
rm -rf var/view_preprocessed/source/frontend/$1/$2
grunt exec:$2
@luizventurote
luizventurote / valet-sample-magento.sh
Last active December 4, 2019 08:38
Bash script to install a Magento store with sample data automatically using Valet Plus and n98-magerun.
#!/usr/bin/env bash
folderName=${PWD##*/}
magentoUser="MAGENTO_PUBLIC_KEY"
magentoPassword="MAGENTO_SECRET_KEY"
n98-magerun2.phar install --dbHost="localhost" --dbUser="root" --dbPass="root" --dbName="${folderName}" --installationFolder="magento-folder" --installSampleData=yes --baseUrl="http://${folderName}.test/"
mv magento-folder/* .
@luizventurote
luizventurote / fix-header-script.js
Last active April 5, 2018 13:25
Javascript code to fix the header in the top.
jQuery(function($){
var header = document.querySelector('header.page-header .header.content'),
panel = document.querySelector('header.page-header .panel'),
$panel = jQuery(panel),
$header = jQuery(header),
headerContainer = document.querySelector('header.page-header'),
$headerContainer = jQuery(headerContainer),
lastScroll = 0,
upSign = -1,
@luizventurote
luizventurote / magento1-layout-cms.xml
Created March 2, 2018 16:28
Add head text by on a CMS page - Magento 1
<reference name="head">
<block type="core/text" name="custom_css">
<action method="setText">
<text><![CDATA[
<style type="text/css">
@luizventurote
luizventurote / opencv-load-video.cpp
Created February 3, 2018 19:23
OpenCV load a video.
#include <iostream>
#include <stdio.h>
#include "opencv2/highgui/highgui.hpp"
int main( int argc, const char** argv ) {
cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCreateFileCapture( argv[1] );
@luizventurote
luizventurote / opencv-load-image.cpp
Created February 3, 2018 19:15
OpenCV Open Image
#include <iostream>
#include <stdio.h>
#include "opencv2/highgui/highgui.hpp"
int main( int argc, const char** argv ) {
IplImage* img = cvLoadImage( argv[1] );
cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE);
cvShowImage("Example1", img);
cvWaitKey(0);
@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 / install-php-extensions-mamp-pro-4.md
Created August 12, 2017 05:27
Install custom PHP extensions for MAMP PRO 4

Install custom PHP extensions for MAMP PRO 4

Example extension: gmp on a MAMP PRO with PHP 5.6.27 installation. For other versions it's just replacing the php version in the paths. Steps below are tested on MacOS Sierra (10.12.2).

Prerequisites

Install Brew and MAMP PRO.

@luizventurote
luizventurote / download-commit-bitbucker.md
Created July 25, 2017 16:21
Download source code for a particular commit in Bitbucket
https://bitbucket.org/USERNAME/REPONAME/get/COMMITCODE.tar.gz