Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@yratof
yratof / multisite.php
Created September 1, 2021 11:11
Show the site_name on sites.php with multisite wordpress
<?php
/* Add site_name as a column */
add_filter( 'wpmu_blogs_columns', 'add_useful_columns' );
function add_useful_columns( $site_columns ) {
$site_columns['site_name'] = 'Site Name';
return $site_columns;
}
/* Populate site_name with blogs site_name */
@yratof
yratof / brew-cleanup.sh
Created October 26, 2021 07:54
Brew permission fixer
# https://stackoverflow.com/questions/16432071/how-to-fix-homebrew-permissions
sudo chown -R "$USER":admin 'path-to-thing-brew-complains-about'
@yratof
yratof / ae_wiggle_posterise.js
Created October 14, 2021 11:27
After effects posterise wiggle
f = 2; // Freq
a = 10; // Amount
posterizeTime(f); // Posterise it
wiggle(f, a); // Wiggle that
@yratof
yratof / dbngin.sh
Created October 7, 2021 08:42
Avoiding socket error with dbngin
# Futher info here: https://github.com/TablePlus/DBngin/issues/38
mysql --socket /tmp/mysql_3306.sock -uroot
@yratof
yratof / functions.php
Created March 23, 2017 10:02
Filter ACF post_object by taxonomy when on taxonomy page
<?php
class acf_filter_post_object {
static function setup() {
add_filter( 'acf/fields/post_object/query/name=FIELD_NAME', __CLASS__ . '::only_current_terms', 10, 3 );
}
/*
Only current terms to be shown within the taxonomy
@yratof
yratof / permissions.sh
Last active August 12, 2021 08:07
Correct .git permissions for wordpress based systems
chown -R `whoami` * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
# For servers
chown -R www-data:www-data .
find . -type d -exec chmod 570 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 460 {} \; # Change file permissions rw-r--r--
@yratof
yratof / grep.sh
Created May 6, 2021 08:01
InDesign GREP to replace thousands separator
GREP thousands comma, replace with space
# https://community.adobe.com/t5/indesign/grep-find-change-decimal-and-thousands/m-p/6130240
Find: (?<=\d)[., ](?=\d\d\d)
Replace: ' ';
@yratof
yratof / plotting.md
Created August 8, 2019 07:24
HPGL Plotting
@yratof
yratof / add_title_to_image.sh
Created January 28, 2021 13:12
Adding a title to the bottom left of an image with imagemagick convert
convert image.jpg -resize 1200x\> -pointsize 18 -draw "gravity southwest text 20, 20 'Title of the image'" out-image.jpg;
@yratof
yratof / branding-stylesheet.php
Last active December 1, 2020 19:41
Using ACF to create a stylesheet
<?php /* Brand Colour */ $colour = get_field( 'colour', 'option' ); ?>
.brand--background{ background-color: <?php echo $colour ?>; }
.brand--colour{ color: <?php echo $colour ?>; }
.brand--border{ border-color: <?php echo $colour ?>; }