Skip to content

Instantly share code, notes, and snippets.

@tacensi
tacensi / bad-matt.php
Created September 27, 2024 12:37 — forked from gschoppe/bad-matt.php
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
/*
* 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/
<?php
class WPLazyLoadImages {
function __construct() {
// Add Our Filters and actions for the plugin
add_action('wp_enqueue_scripts', array($this, 'enqueue_lazyload'));
add_filter('the_content', array($this, 'filter_lazyload'));
add_action('wp_footer', array($this, 'footer_lazyload'));
#!/bin/bash
# Anh Nguyen <[email protected]>
# 2016-04-30
# MIT License
# This script takes in images from a folder and make a crossfade video from the images using ffmpeg.
# Make sure you have ffmpeg installed before running.
# The output command looks something like the below, but for as many images as you have in the folder.
@tacensi
tacensi / Create meta box
Created June 18, 2019 22:47
Create Meta Field
<?php
/**
* Plugin Name: Movie Review - Atores
* Plugin URI: https://example.com/plugins/the-basics/
* Description: Acrescenta uma metabox para preenchimento dos atores para um blog de review de cinema
* Version: 20190625
* Author: WP&etc
* Author URI: https://wp.etc.br/
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
@tacensi
tacensi / Remove script tags from wp_content
Created May 21, 2019 19:12
Remove script tags from wp_content
UPDATE wp_posts
SET post_content = CONCAT(
SUBSTRING(
post_content, 1, INSTR(post_content, '<script') - 1
),
SUBSTRING(
post_content, INSTR(post_content, '</script>') + 9
)
)
WHERE post_content LIKE '%<script%'
@tacensi
tacensi / diceware.wordlist.pt.txt
Created April 22, 2019 19:09 — forked from patxipierce/diceware.wordlist.pt.txt
A diceware wordlist for the Portuguese language.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
11111 a
11112 aa
11113 aaa
11114 aaaa
11115 ab
11116 aba
11121 abaco
@tacensi
tacensi / getScript.js
Created April 22, 2019 18:33 — forked from kmonsoor/getScript.js
jquery $.getScript() replacement with vanilla JavaScript
"use strict";
// src: https://stackoverflow.com/a/28002292
const getScript = (source, callback) => {
var script = document.createElement('script');
var prior = document.getElementsByTagName('script')[0];
script.async = 1;
script.onload = script.onreadystatechange = (_, isAbort) => {
if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {
@tacensi
tacensi / WP empty trash sql query
Created April 4, 2019 18:29
WP empty trash sql query
DELETE wp_posts,wp_term_relationships,wp_postmeta,wp_term_taxonomy
FROM wp_posts
LEFT JOIN wp_term_relationships ON ( wp_posts.ID = wp_term_relationships.object_id )
LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )
LEFT JOIN wp_term_taxonomy ON ( wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id )
WHERE wp_posts.post_status='trash';
@tacensi
tacensi / gist:e4c981b755eb7c703f86d819d8f59824
Created March 21, 2019 18:01
Rename multiple files in bash
for f in $(find ./ -name "*ã*")
do
mv -i "${f}" "${f/ã/ã}"
done
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {