Skip to content

Instantly share code, notes, and snippets.

View rayrutjes's full-sized avatar
🎸

Raymond Rutjes rayrutjes

🎸
View GitHub Profile
@rayrutjes
rayrutjes / Spitfire LABS Drums mapping.txt
Last active November 18, 2020 20:11
Spitfire LABS Drums mapping for Megababy 2
36 Bass
37 Bass alt.
38 Snare
39 Snare (Rim Hit)
40 Rim Click
41 Rim Click Alt.
42 High-Hat Closed
43 Floor Tom
44 High-Hat Half Open
45 Mid Tom
@rayrutjes
rayrutjes / base64-kubernetes-secret.sh
Created December 4, 2019 09:24
Base64 encode file as Kubernetes secret properly dealing with line breaks
echo -n "$(cat private.key)" | base64 | tr -d '\n' | pbcopy
@rayrutjes
rayrutjes / fix-broken-php-serialized-data.php
Created June 9, 2019 16:57
Helper to fix broken PHP serialized data. Helpful mostly on broken WordPress databases.
<?php
$data = <<< EOF
The broken serialized data goes here.
And can expand on multiple lines.
EOF;
$data = preg_replace_callback ('!s:(\d+):"(.*?)";!', function($match) {
return ($match[1] == strlen($match[2])) ? $match[0] : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
}, $data);
@rayrutjes
rayrutjes / remove-html-tags-wordpress-algolia-plugin.php
Created November 20, 2018 09:37
Remove HTML tags from title - Algolia WordPress plugin
<?php
function remote_html_tags( array $shared_attributes, WP_Post $post) {
$shared_attributes['post_title'] = strip_tags( $shared_attributes['post_title'] );
return $shared_attributes;
}
add_filter( 'algolia_post_shared_attributes', 'remote_html_tags', 10, 2 );
@rayrutjes
rayrutjes / autocomplete-show-more-link-footer-dynamic.js
Created September 13, 2018 14:55
Dynamic show more results like algolia autocomplete
@rayrutjes
rayrutjes / hide-autocomplete.php
Created July 23, 2018 14:42
Hide autocomplete snippet on custom condition - WordPress - Algolia
<?php
add_filter( 'algolia_autocomplete_config', function ( $config ) {
if (true) { // Replace this condition to match your needs.
// Autocomplete enabled.
return $config
}
@rayrutjes
rayrutjes / evicted-pods-cleanup.sh
Created July 19, 2018 13:37
Cleanup evicted pods - Kubernetes
kubectl get pod -a --all-namespaces -o json \
| jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains("Evicted")) | "kubectl delete pod \(.metadata.name) -n \(.metadata.namespace)"' \
| xargs -n 1 bash -c
@rayrutjes
rayrutjes / list-big-files.sh
Created April 24, 2018 07:05
List big files on your Mac
sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
@rayrutjes
rayrutjes / hide-instantsearch.php
Created March 12, 2018 15:06
Programatically hide instantsearch in Algolia plugin for WordPress
<?php
add_filter( 'algolia_should_override_search_with_instantsearch', function() {
return false;
} );
@rayrutjes
rayrutjes / replace-domain-wordpress-algolia-plugin.php
Created February 26, 2018 12:21
Replace domain in Algolia Search plugin for WordPress
<?php
/**
* @version 0.1.0
* Plugin Name: Replace domain in Algolia Search plugin for WordPress
*/
function custom_post_shared_attributes( array $shared_attributes ) {
$shared_attributes['permalink'] = str_replace( 'admin.rushlimbaugh.com', 'www.rushlimbaugh.com', $shared_attributes['permalink'] );
return $shared_attributes;
}