Skip to content

Instantly share code, notes, and snippets.

Avatar

protorob

View GitHub Profile
@protorob
protorob / woocommerce-add-sku-on-order.php
Created Dec 27, 2019
Add SKU to items in order email - woocommerce
View woocommerce-add-sku-on-order.php
function artomultiplo_add_sku_woocommerce_emails( $output, $order ) {
// set a flag so we don't recursively call this filter
static $run = 0;
// if we've already run this filter, bail out
if ( $run ) {
return $output;
}
@protorob
protorob / scrap.py
Created Nov 21, 2019
Scrapper for a website
View scrap.py
# Import libraries
import requests
from bs4 import BeautifulSoup
website = 'https://www.sito.it/bombon/bomboniere-matrimonio.html?p='
output_file = open('bomboniere.csv', 'w+')
counter = 1
@protorob
protorob / style.css
Last active May 13, 2020
Artomultiplo's Generatepress Woocommerce Starter Child
View style.css
/*
Theme Name: Artomultiplo GP Child
Template: generatepress
Theme URI: https://generatepress.com
Author: Roberto Enrique Briceno Garcia
Author URI: https://artomultiplo.eu
Description: A woocommerce optimized GP child
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@protorob
protorob / cart.php
Created Oct 29, 2019
Artomultiplo's Generatepress Cart Mods (cart.php)
View cart.php
<?php
/**
* Cart Page
*
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@protorob
protorob / remove-bg-from-files-in-a-folder.py
Last active May 14, 2019
A simple Python script to batch remove backgrounds from images in a directory
View remove-bg-from-files-in-a-folder.py
# This script asumes that you have two directories
# One directory called "origin" with your original images
# Another directory valled "results" that is going to be filled with your processed images :-)
# The name of the directories should be exactly like that "origin" and "results" respectively
# The script also need a remove.bg API key, so you should get one of those
# https://www.remove.bg/api
# it also require "requests" to be installed (see python-requests.org)
import requests
import os
@protorob
protorob / findwords.py
Last active May 2, 2019
Python scrypt for finding pairs of words that behave in curious ways
View findwords.py
#inserire il file del vocabolario
words = open("zingarelli.txt", "r")
# cambiare questo valore per stabilire il numero di lettere delle parole (dev'essere un numero % 2 = 0)
maxlenght = 6
wordarray = []
for word in words:
if len(word) == maxlenght + 1:
View csvcleaner.py
import html
just_open = open('art.csv', 'r')
output_file = open('freshnclean.csv', 'w')
i = 0
for row in just_open:
if (i >= 0 and i < 5000):
lariga = html.unescape(row)
View Tampermonkey.js
// ==UserScript==
// @name Get div contents and print it to console on OAM course
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.myatoma.com/Simulatore/*
// @require https://code.jquery.com/jquery-2.2.4.min.js
// ==/UserScript==
@protorob
protorob / standardplugs.sh
Last active Jan 28, 2019
Standard Plugin Install for WP-CLI
View standardplugs.sh
#!/bin/bash -e
# Defining Database Variables:
echo "=================================================================="
echo "We're going to install the standard plugins and Generatepress:"
echo "Plugins to be installed in no particular order:"
echo " - The Seo Framework"
echo " - SiteOrigin Page Builder with Official Extra Widgets and Livemesh ones"
echo " - Widget CSS Classes"
@protorob
protorob / processwire_json_page_create.php
Last active Apr 9, 2018
Processwire Page Create From Webtic JSON
View processwire_json_page_create.php
<?php
$movies = json_decode(file_get_contents('https://secure.webtic.it/frame/wtjsonservices.ashx?wtid=getFullScheduling&localid=1000'));
foreach ($movies->DS->Scheduling->Events as $movie) {
$p = new Page(); // create new page object
$p->template = 'single-movie'; // set template
$p->parent = wire('pages')->get('/programmazione/'); // set the parent
$p->name = $movie->Title; // give it a name used in the url for the page
$p->title = ucfirst($movie->Title); // set page title (not neccessary but recommended)