Skip to content

Instantly share code, notes, and snippets.

@sareiodata
sareiodata / wp_remove_assets.php
Last active January 23, 2024 16:43
WP Remove Assets
<?php
/*
* Plugin Name: WP Remove Assets
* Plugin URI: https://www.cozmsolabs.com
* Version: 0.1
* Description: Filter particular scripts and style to load in posts or pages that don't need it.
* Author: Cristian Antohe
* Author URI: https://www.cozmoslabs.com/
*/
var gulp = require('gulp'),
pot = require( 'gulp-wp-pot' ),
fs = require('fs'),
git = require('gulp-git');
var addons = [ 'pms-add-on-bbpress', 'pms-add-on-content-dripping', 'pms-add-on-discount-codes', 'pms-add-on-email-reminders',
'pms-add-on-global-content-restriction', 'pms-add-on-invoices', 'pms-add-on-member-subscription-fixed-period', 'pms-add-on-multiple-subscriptions-per-user'
, 'pms-add-on-navigation-menu-filtering', 'pms-add-on-paypal-express-pro', 'pms-add-on-paypal-standard-recurring-payments', 'pms-add-on-recaptcha'
, 'pms-add-on-stripe', 'pms-add-on-pay-what-you-want', 'pms-add-on-group-memberships', 'pms-add-on-tax' ];
@sareiodata
sareiodata / post-sitemap1.xml
Created February 18, 2020 07:51
xml sitemap with translated url's
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://tp.test/sitemaps_xsl.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://tp.test/blog/</loc>
<xhtml:link rel='alternate' hreflang='en-US' href='http://tp.test/blog/' />
<xhtml:link rel='alternate' hreflang='ro-RO' href='http://tp.test/ro/blog/' />
</url>
<url>
<loc>http://tp.test/ro/blog/</loc>
@sareiodata
sareiodata / gist:d0948bac308400eb7d90612b6cf1539c
Created November 6, 2019 13:21
Questions about Elm language
https://guide.elm-lang.org/effects/http.html
main =
Browser.element
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}
@sareiodata
sareiodata / gist:ad5909c20ede6d520ac0ea950f8054b4
Created September 26, 2019 12:15
nginx sareiodatadynamic servername
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
<?php
add_action( 'trp_before_running_hooks', 'trpc_remove_hooks_to_disable_gettext_translation', 10, 1);
function trpc_remove_hooks_to_disable_gettext_translation( $trp_loader ){
$trp_loader->remove_hook( 'init', 'create_gettext_translated_global' );
$trp_loader->remove_hook( 'shutdown', 'machine_translate_gettext' );
}
#!/bin/bash
# Version: 2.0
# Release: November 24, 2017
# Based on https://github.com/leehblue/texpander/
# Get window id, pass to getwindow pid to output the pid of current window
pid=$(xdotool getwindowfocus getwindowpid)
# Store text name of process based on pid of current window
@sareiodata
sareiodata / svg.html
Last active September 19, 2019 08:47
svg with text node
Original SVG
<svg style="width: 253px; height: 54px;" viewbox="0 0 238 54">
<defs>
<mask id="button-text-mask-0">
<rect width="100%" height="100%" fill="#ffffff"></rect>
<text class="mask-text button-text" fill="#000000" text-anchor="middle" font-size="16" transform="matrix(1 0 0 1 126.5 32.72727272727273)">Discover JB-Power</text>
</mask>
</defs>
<rect fill="#ffd700" width="100%" height="100%" id="masked-rect-id-0"></rect>
@sareiodata
sareiodata / mysql.txt
Created December 28, 2018 21:20
Possible solution for similar string search
SELECT * FROM `wp_trp_dictionary_en_us_ro_ro` WHERE
MATCH original AGAINST( '“That is why, I suppose, you wished him to go on to Bukovina. You cannot
deceive me, my friend; I know too much, and my horses are swift.” As he
spoke he smiled, and the lamplight fell on a hard-looking mouth, with
very red lips and sharp-looking teeth, as white as ivory. One of my
companions whispered to another the line from Burger’s “Lenore”:—' )
AND
function ginger_parse_dom($output)
{
$ginger_script_tags = array(
'platform.twitter.com/widgets.js',
'apis.google.com/js/plusone.js',
'apis.google.com/js/platform.js',
'connect.facebook.net',
'platform.linkedin.com',
'assets.pinterest.com',