Skip to content

Instantly share code, notes, and snippets.

View remcotolsma's full-sized avatar
🏢
Working @pronamic

Remco Tolsma remcotolsma

🏢
Working @pronamic
View GitHub Profile
@remcotolsma
remcotolsma / functions.php
Created May 29, 2015 19:19
WordPress filter to display only root categories and sub categories.
<?php
function prefix_get_the_terms( $terms, $post_id, $taxonomy ) {
if ( 'category' == $taxonomy ) {
if ( is_category() ) {
$current = get_queried_object();
$sub_terms = get_terms( $taxonomy, array(
'child_of' => $current->term_id,
'fields' => 'ids',
@remcotolsma
remcotolsma / infinitewp.sql
Last active June 1, 2016 17:27
Queries to delete InfiniteWP site history and stats of deleted sites.
DELETE FROM iwp_history WHERE siteID NOT IN ( SELECT siteID FROM iwp_sites );
DELETE FROM iwp_history_additional_data WHERE historyID NOT IN ( SELECT historyID FROM iwp_history );
DELETE FROM iwp_history_raw_details WHERE historyID NOT IN ( SELECT historyID FROM iwp_history );
DELETE FROM iwp_site_stats WHERE siteID NOT IN ( SELECT siteID FROM iwp_sites );
DELETE FROM iwp_user_access WHERE siteID NOT IN ( SELECT siteID FROM iwp_sites );
@Biont
Biont / mlp-autosync-terms.php
Last active October 3, 2017 09:34
MLP Autosync Terms
<?php
/**
* Plugin Name: MLP Autosync Terms
* Description: Automatically sync all linked terms when a post is saved
* Author: Biont
* Author URI: https://github.com/Biont
* License: GPLv3
*/
/**
@ryanscherler
ryanscherler / php-openssl.md
Last active August 16, 2018 20:06
Use Homebrew PHP with OpenSSL instead of SecureTransport
@remcotolsma
remcotolsma / index.php
Created January 28, 2019 09:10
Check if all files within a range are in a directory.
<?php
global $argv;
$dir = __DIR__;
if ( isset( $argv[1] ) ) {
$dir = $argv[1];
}
@zburgermeiszter
zburgermeiszter / JsonSerializableWithReflection.php
Last active September 10, 2020 18:40
PHP JsonSerializable with Reflection in Trait
<?php
trait JsonSerialize
{
function jsonSerialize()
{
$reflect = new ReflectionClass($this);
$props = $reflect->getProperties(ReflectionProperty::IS_STATIC | ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE);
@remcotolsma
remcotolsma / functions.php
Last active August 18, 2021 14:30
Extend Formidable Forms entries list with Pronamic Pay payment info/status.
<?php
/**
* Formidable Forms.
*
* @link https://github.com/Strategy11/formidable-forms/blob/v5.0.01/classes/controllers/FrmEntriesController.php#L31
* @link https://github.com/Strategy11/formidable-forms/blob/v5.0.01/classes/helpers/FrmEntriesListHelper.php#L289-L293
*/
$screen = 'formidable_page_formidable-entries';
@fer-ri
fer-ri / mirror.md
Last active November 5, 2021 11:06
Mirror Website Using Httrack Command Line
mkdir ~/Mirror

cd ~/Mirror

httrack --connection-per-second=8 --sockets=8 --keep-alive --display --verbose --advanced-progressinfo --disable-security-limits -i -s0 -m -F 'Mozilla/5.0 (X11;U; Linux i686; en-GB; rv:1.9.1) Gecko/20090624 Ubuntu/9.04 (jaunty) Firefox/3.5' -#L999999 http://domain.com
@noelvo
noelvo / download-multiple-files.js
Created December 6, 2015 23:22
Download multiple files then compress to one zip file using JSZip & JSZip-utils
var zip = new JSZip();
var count = 0;
var zipFilename = "zipFilename.zip";
var urls = [
'http://image-url-1',
'http://image-url-2',
'http://image-url-3'
];
urls.forEach(function(url){
@gagarine
gagarine / install-clamav-osx.md
Last active June 7, 2023 07:54
Howto Install clamav on OSX with brew

Howto Install clamav on OSX with brew

Note: on legacy intel system the path may be /usr/local/etc/clamav instead of /opt/homebrew/etc/clamav/

$ brew install clamav
$ cd /opt/homebrew/etc/clamav/
$ cp freshclam.conf.sample freshclam.conf