Skip to content

Instantly share code, notes, and snippets.

View cagartner's full-sized avatar

Carlos Augusto Gartner cagartner

View GitHub Profile
@xhezairbey
xhezairbey / bitly_api_v3_shorten.php
Created October 27, 2011 23:42
BitLy API v3 Shorten PHP
<?php
function bitly_shorten($url) {
$login = "bitly_login";
$apikey = "bitly_apikey";
$format = "json";
$query = array("login" => $login,
"apiKey" => $apikey,
"longUrl" => urlencode($url),
"format" => $format);
@ceckoslab
ceckoslab / tinydump
Last active July 13, 2021 06:44
Simple PHP script, that creates a dump of Magento DB with smaller footprint ... the script just excludes the data some of the log tables, but keep the the schema of these tables.
<?php
define('DS', DIRECTORY_SEPARATOR);
function _getExtractSchemaStatement($sqlFileName, $db)
{
$dumpSchema = 'mysqldump' . ' ';
$dumpSchema .= '--no-data' . ' ';
$dumpSchema .= '-u ' . $db['user'] . ' ';
$dumpSchema .= '-p' . $db['pass'] . ' ';
$dumpSchema .= '-h ' . $db['host'] . ' ';
@claudiosanches
claudiosanches / woocommerce-installments-example.php
Last active October 12, 2022 19:03
WooCommerce - Displays the price in 3 installments without interest.
<?php
/**
* Plugin Name: WooCommerce Installments Example
* Plugin URI: http://claudiosmweb.com/
* Description: Added the price with 3 installments without interest.
* Author: claudiosanches
* Author URI: http://www.claudiosmweb.com/
* Version: 1.0
* License: GPLv2 or later
*/
@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
@WPprodigy
WPprodigy / functions.php
Created January 20, 2016 17:11
Remove the password strength meter from WooCommerce checkout
function wc_ninja_remove_password_strength() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 );
@claudiosanches
claudiosanches / functions.php
Last active June 1, 2022 17:20
WooCommerce - Hide the "In stock" message on product page.
<?php
/**
* Hide the "In stock" message on product page.
*
* @param string $html
* @param string $text
* @param WC_Product $product
* @return string
*/
function my_wc_hide_in_stock_message( $html, $text, $product ) {
@sergiojovanig
sergiojovanig / magento2-clear.sql
Last active January 15, 2024 12:25
Magento 2 Clear Database
##########################################################
# PRODUCTS
##########################################################
DELETE FROM `catalog_product_bundle_option`;
DELETE FROM `catalog_product_bundle_option_value`;
DELETE FROM `catalog_product_bundle_selection`;
DELETE FROM `catalog_product_entity_datetime`;
DELETE FROM `catalog_product_entity_decimal`;
DELETE FROM `catalog_product_entity_gallery`;
DELETE FROM `catalog_product_entity_int`;
@rodurma
rodurma / filters.php
Created October 27, 2016 19:57
Filtros estilo GMail
<?php
$input = 'nome:ps4 sku:SKU7889-988;OI99129 data:10/12/2016 nome:Playstation 4 nome:Nintendo Wii sku:TESTE123 9aos';
preg_match_all('/(?:([^: ]+):)([^: ]+(?:\s+[^: ]+\b(?!:))*)/', $input, $matches, PREG_SET_ORDER);
echo $input;
echo '<pre>';
print_r($matches);
echo '</pre>';
@aboritskiy
aboritskiy / SyncURLsCommand.php
Last active July 1, 2021 15:15
Magento2 EE Cloud tips and tricks
<?php
namespace Sitewards\SyncURLs\Console\Command;
use \Symfony\Component\Console\Command\Command;
use \Symfony\Component\Console\Input\InputInterface;
use \Symfony\Component\Console\Output\OutputInterface;
use \Magento\Framework\App\Config\ConfigResource\ConfigInterface;
use \Magento\Store\Model\StoreManagerInterface;
@peterjaap
peterjaap / Magento1ValetDriver.php
Created January 4, 2017 22:06
Magento 1 Driver for Valet (https://laravel.com/docs/5.3/valet) - we put Magento in a subdir called 'magento' in our Git repo. So place this in ~/.valet/Drivers/Magento1ValetDriver.php and you're good to go.
<?php
class Magento1ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri