Skip to content

Instantly share code, notes, and snippets.

@gschoppe
gschoppe / bad-matt.php
Last active December 6, 2024 06:24
This is a protest plugin in response to the unacceptable behavior of Matt Mullenweg (BDFL of WordPress). In a propaganda interview, Matt claimed that one of the unacceptable things that WPEngine did was to strip out the stripe partner id from woocommerce's stripe gateway plugin. Not only does this appear to be false, but it is in no way a violat…
<?php defined('ABSPATH') or die();
/*
* Plugin Name: Bad Matt
* Plugin URI: https://gschoppe.com
* Description: A protest plugin that removes (or replaces via filter) the Automattic-owned woocommerce stripe gateway partner id.
* Version: 1.0.0
* Requires at least: 4.0
* Requires PHP: 7.2
* Author: Greg Schoppe
* Author URI: https://gschoppe.com/
@bahiirwa
bahiirwa / webpack.config.js
Created March 26, 2023 15:24
Multiple entry points for webpack.config.js using @wordpress/scripts
// Set from https://www.npmjs.com/package/@wordpress/scripts
// Add package.json with the @wordpress/scripts dependency.
// Add a root file called webpack.config.js
// Import the original config from the @wordpress/scripts package.
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
// Import the helper to find and generate the entry points in the src directory
const { getWebpackEntryPoints } = require( '@wordpress/scripts/utils/config' );
@axeleroy
axeleroy / wxr_utils.py
Created April 19, 2020 18:00
Python library for generating WXR files
"""Utility functions to create a WXR file for Wordpress.
"""
import datetime
import os
from lxml import etree as ET
from lxml.etree import CDATA
# XML namespaces declarations
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CloudContent]
"ConfigureWindowsSpotlight"=dword:00000002
"IncludeEnterpriseSpotlight"=dword:00000000
"DisableThirdPartySuggestions"=dword:00000001
"DisableTailoredExperiencesWithDiagnosticData"=dword:00000001
"DisableWindowsSpotlightFeatures"=dword:00000001
"DisableWindowsSpotlightWindowsWelcomeExperience"=dword:00000001
"DisableWindowsSpotlightOnActionCenter"=dword:00000001
@renventura
renventura / woocommerce-settings-page.php
Created December 26, 2017 02:52
Implement a custom WooCommerce settings page, including page sections
<?php
/**
* WooCommerce settings page
*
* This code creates a full WooCommerce settings page by extending the WC_Settings_Page class.
* By extending the WC_Settings_Page class, we can control every part of the settings page.
*
* @author Ren Ventura <renventura.com>
*/
@dannguyen
dannguyen / README.md
Last active September 10, 2024 19:41
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active November 19, 2024 09:35
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
#!/usr/bin/env python
# Linux usage: ./extract_tampermonkey_script.py "/home/<USER>/.config/<BROWSER>/Default/Local Extension Settings/<EXTENSION_ID>"
# i.e.: ./extract_tampermonkey_script.py "/home/foo/.config/google-chrome-beta/Default/Local Extension Settings/gcalenpjmijncebpfijmoaglllgpjagf"
# Mac usage: ./extract_tampermonkey_script.py "/Users/<USER>/Library/Application Support/Google/Chrome/Default/Local Extension Settings/<EXTENSION_ID>/"
# i.e.: ./extract_tampermonkey_script.py "/Users/foo/Library/Application Support/Google/Chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo/"
import leveldb
import sys
import re
@altrive
altrive / ToastNotification_Windows10.ps1
Last active May 12, 2024 09:34
Windows 10 toast notification sample
$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString()
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
#Convert to .NET type for XML manipuration
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null
@eduardozulian
eduardozulian / wp-get-image-sizes.php
Created September 6, 2013 18:23
Get all the registered image sizes along with their dimensions
<?php
/**
* Get all the registered image sizes along with their dimensions
*
* @global array $_wp_additional_image_sizes
*
* @link http://core.trac.wordpress.org/ticket/18947 Reference ticket
* @return array $image_sizes The image sizes
*/
function _get_all_image_sizes() {