Skip to content

Instantly share code, notes, and snippets.

@idokd
idokd / strip-specific-tag-attribute.php
Last active September 10, 2021 08:02
Strip Specific HTML/XML tag attributes
<?php
// Based and altered from https://www.py4u.net/discuss/24287
function strip_tag_attributes( $html, $tag, $attr ) {
$domd = new DOMDocument();
libxml_use_internal_errors( true );
$domd->loadXML( $html );
libxml_use_internal_errors( false) ;
$domx = new DOMXPath( $domd );
$items = $domx->query('//' . $tag . '[@' . $attr . ']');
@idokd
idokd / gravityforms-unique-id-sequence.php
Last active January 6, 2022 18:14
GravityForms Unique ID - Generates a alphanumeric, numeric, or sequential "Unique ID" for the entry when submitted
<?php
/*
- Add this to your functions.php
- Add a form input normal
- give it a gf-sequence class
*/
$gfex_gsf = false;
@idokd
idokd / init-plugin.php
Last active July 12, 2021 13:09
WordPress Initialization MU-Plugin (Must Use Plugin)
<?php
/**
* Plugin Name: Initialization Plugin
* Plugin URI: https://gist.github.com/idokd/224dec722a22b664c59e8d6ec221d997
* Description: Plugin to hook and define necessary functions before other all other plugins
* Version: 1.0.0
* Author: Ido Kobelkowsky
* Author URI: https://github.com/idokd
*/
@idokd
idokd / exportMySQLUsersPDO.php
Created January 17, 2021 12:40 — forked from zaiddabaeen/exportMySQLUsersPDO.php
Exports MySQL Users and Privileges using PDO
* Feel free to improve it.
* Original by Janich: https://gist.github.com/janich/6121771
*
* @requires PHP 5.3+
* @package ExportMySQLUsers
* @author Zaid Daba'een
* @license http://www.dbad-license.org/ DBAD license
*/
// Set up database root credentials
$host = 'localhost';
@idokd
idokd / cloudbuild.yaml
Last active October 10, 2019 12:41
Deploy a Github Wordpress Plugin to Wordpress.org subversion using Google Cloud Build triggers
steps:
- name: 'debian:stable-slim'
args: ['bash', './deploy-plugin.sh']
env:
- 'BUILD=$BUILD_ID'
- 'PROJECT=$PROJECT_ID'
- 'REV=$REVISION_ID'
- 'VERSION=$TAG_NAME'
- 'SVN_USERNAME=$_SVN_USERNAME'
- 'SVN_PASSWORD=$_SVN_PASSWORD'
@idokd
idokd / scrap-ca-to-bundle.sh
Last active January 21, 2022 14:58
Scrap site for its certificates, validate and create a ca bundle, for the use in downloading a local copy of Certificate Authorities (CAs)
#!/bin/bash
# Download CA Certs (.crt) from a URL
# example: http://www.banxico.org.mx/servicios/certificados-ies-firma-electr.html
# Then check which certificates are valid and bundle them to a pem file
WEB_URL=http://www.banxico.org.mx/servicios/certificados-ies-firma-electr.html
SSL_CERT_DIR=ca
CA_BUNDLE=$SSL_CERT_DIR/ca-chain-bundle.pem
@idokd
idokd / postman-github-repos-batch-transfer
Last active November 1, 2021 18:29
Github Repository Ownership Transfer via Postman
# This script is to be used in Postman if you wish to transfer ownership of your repository in a batch
# Example; downgrading from organization account (25usd min) to pro user (7usd) monthly and keeping all
# your private repositories
# Instead of complicate with scripts etc. just use postman
# the repos api will list only 25 at a time, so you should run this script a few times if you have more
# repositories to transfer
GET /orgs/### CURRENT OWNER REPOSITORY ###/repos HTTP/1.1
Host: api.github.com
Authorization: token ### GITHUB API TOKEN HERE ###