Skip to content

Instantly share code, notes, and snippets.

View mgburns's full-sized avatar
🔥

Mike Burns mgburns

🔥
View GitHub Profile
@mgburns
mgburns / bu-versions-wp-seo.php
Last active January 3, 2016 06:39
Adds support for post excerpt and WordPress SEO meta fields to alternate versions
<?php
/*
Plugin Name: BU Versions - WordPress SEO Support
Description: Adds support for post excerpt and WordPress SEO meta fields to alternate versions
*/
/**
* Required as the WordPress SEO plugin doesn't use post type support, and BU Versions requires it.
*/
function wpseo_feature_support() {
@mgburns
mgburns / acf-field-registration-example.php
Created September 1, 2015 13:14
Example programmatic registration of Advanced Custom Fields fields
<?php
/**
* Example programmatic registration of Advanced Custom Fields fields
*
* @see http://www.advancedcustomfields.com/resources/register-fields-via-php/
*/
function register_custom_acf_fields() {
if ( function_exists( 'acf_add_local_field_group' ) ) {

Problem

Attempting to create an image transform that crops an image, using the upper right hand portion of the image.

Steps To Recreate

  1. Set up a image transform with Mode set to Crop and Focal Point set to Top-Right

Craft Admin - Image Transform

  1. Used this transform in my template
<?php
namespace craft\contentmigrations;
use Craft;
use craft\base\Field;
use craft\elements\Entry;
use craft\models\Section;
use craft\models\Section_SiteSettings;
use craft\db\Migration;
<?php
namespace craft\contentmigrations;
use Craft;
use craft\base\Field;
use craft\elements\Entry;
use craft\models\Section;
use craft\models\Section_SiteSettings;
use craft\db\Migration;
@mgburns
mgburns / fun-with-python-repl.py
Last active October 16, 2020 18:35
A lil' fun with the Python REPL
# Basic expressions
1 + 1
# Variables, strings, and tuples
knock_knock = "Who's there?"
knock_knock
knock_knock_joke = ("Interuppting Cow", "Interupting co-", "MOO!!")
call, response, punchline = knock_knock_joke
knock_knock
call