Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn
.
Author: Kaspars Dambis
kaspars.net / @konstruktors
<?php | |
add_action( 'pre_get_posts', function( $query ) { | |
if ( !$query->is_main_query() || !$query->is_search() ) { | |
return $query; | |
} | |
$common_misspellings = [ | |
'lorem' => ['lorum', 'lorm', 'lormu', 'lormum', 'lormum'], | |
'ipsum' => ['ipusm', 'ipsums', 'ipsumz', 'ipsumz', 'ispum'], |
<?php | |
/* | |
Plugin Name: Hostile XMLRPC Responder | |
Plugin URI: https://kneejerk.dev | |
Description: A MUST use plugin designed to respond to XMLRPC requests with a little hostility =] | |
Version: 2.8.1 | |
Author: Ryan "Rohjay" Oeltjenbruns | |
Author URI: https://rohjay.one | |
Requires at least: 6.0 | |
Requires PHP: 8.0 |
<?php | |
// I PHP-ified Ben's work from here: https://github.com/ben-yocum/gestalt-pattern-matcher (thanks for sharing Ben!) | |
// made a few modifications and added comments to better understand how this works. Enjoy =] | |
function compare_strings(string $input1, string $input2, bool $case_insensitive = true): float { | |
if ( $input1 == '' || $input2 == '' ) { | |
return 0.0; | |
} | |
// Case insensitive is the preferred, but you do you |
# PS1 stuff... | |
reset=$(tput -Txterm sgr0) | |
color=$(tput -Txterm setaf 3) | |
altcolor=$(tput -Txterm setaf 2) | |
export PS1="\[$color\]\u\[$reset\]@\[$altcolor\]\h\[$reset\]::\w>" | |
## Quick nav | |
alias ..="cd ../" | |
alias ~="cd ~" |
<?php | |
/** | |
This is a simple class to help you render values into templates, rather than echoing large strings of html/whatever. | |
Usage: | |
// Set the base directory of all of your template files and instantiate the Templater | |
$base_dir = __DIR__ . '/templates'; | |
$templater = new Templater($base_dir); |
Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn
.
Author: Kaspars Dambis
kaspars.net / @konstruktors
<?php | |
function var_dump_to_error_log($data) { | |
ob_start(); | |
var_dump($data); | |
$error_log_this = ob_get_contents(); | |
ob_end_clean(); | |
error_log($error_log_this); | |
} |
I hereby claim:
To claim this, I am signing this object:
<?php | |
// I find myself grouping a lot of data... heres a quick helper function to do just that =] | |
function grouper($data, $key_to_group_by, $key_to_group_unfound='unfound', $unset_key_from_data=false) { | |
$grouped_results = array(); | |
foreach ( $data as $k => $value ) { | |
$value_key = isset($value[$key_to_group_by]) ? $value[$key_to_group_by] : $key_to_group_unfound; | |
if ( !isset($grouped_results[$value_key]) ) { | |
$grouped_results[$value_key] = array(); |