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 / 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 / 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 / gist:78b192aafd2631506025b65c62091f19
Last active July 31, 2020 20:05
Create {asset types} for {your company name or industry} marketing campaigns
{Description of your company, target audience, and goal of marketing campaign}
We're searching for a talented designer to help us bring our next branding campaign to life. We're looking for someone to design {asset types}. Please see the attached document for examples of our past campaigns.
Deliverables needed:
- {List of assets needed}
Special skills needed for this project:
- Advanced knowledge of {Sketch, Invision Studio, Figma, Adobe Creative Cloud or other software}
- {Other requirements for industry, marketing or acquisition campaign experience, software, design principles}
@yratof
yratof / twiddle-example.rb
Created October 30, 2019 08:21
Sonic Pi codes
in_thread do
live_loop :harm do
with_fx :bitcrusher, sample: 100, bits: 2, mix: 1, amp: 0.7 do
a = 2.4
use_synth :chipbass
play chord(:b3,:add9).tick, decay: a
sleep a
end
end
end
@yratof
yratof / DashboardResolver.php
Last active October 29, 2019 10:29
Remove Wordpress dashboard, replace it with WooCommerce Product archive view
<?php
/**
* Removing the useless Dashboard from Wordpress
*
* Required: Wordpress, Woocommerce
*/
/**
* Class Dashboard Resolver
@yratof
yratof / good.curaprofile
Created October 19, 2019 14:35
cura cr10
504b 0304 1400 0000 0000 0000 2100 552d
4bfd ff00 0000 ff00 0000 1d00 0000 6372
6561 6c69 7479 5f63 7231 3073 355f 6578
7472 615f 6661 7374 5f23 325b 6765 6e65
7261 6c5d 0a76 6572 7369 6f6e 203d 2034
0a6e 616d 6520 3d20 4578 7472 6120 4661
7374 2023 320a 6465 6669 6e69 7469 6f6e
203d 2066 646d 7072 696e 7465 720a 0a5b
6d65 7461 6461 7461 5d0a 7365 7474 696e
675f 7665 7273 696f 6e20 3d20 370a 7175
@yratof
yratof / brands.php
Created September 20, 2019 09:20
Create brand taxonomy in Woocommerce
<?php
/**
* Plugin Name: Brand taxonomy
* Plugin URI: https://drivdigital.no
* Description: Force a brand taxonomy to thrive
* Version: 1.0.0
*/
class brand_taxonomy {
// Nope. brand is still a taxonomy
@yratof
yratof / gravity-pdf-date.php
Created September 6, 2019 07:48
Get the date of the last payment on a gravity PDF invoice
<?php
// Used within a PDF template
// [...]
$invoice_date = date( $date_format, strtotime( $form_data['misc']['date_time'] ) );
// Fetch last payment date in database
global $wpdb;
$last_payment_date = $wpdb->get_var( $wpdb->prepare( "SELECT date_created FROM {$wpdb->prefix}gf_addon_payment_transaction WHERE lead_id=%d ORDER BY date_created DESC", $entry['id'] ) );
@yratof
yratof / ssh.sh
Created August 20, 2019 09:39
Sssh!!!
letsencrypt --authenticator webroot --webroot-path . --installer nginx -d hello.com