Skip to content

Instantly share code, notes, and snippets.

View mjn666's full-sized avatar

Matthew Neville mjn666

  • Sydney, Australia
View GitHub Profile
@mjn666
mjn666 / gist:51dbc5aae0620e8b71f9
Created September 15, 2015 00:09
How to pre-select a choice/option in Gravity Forms using a dynamic field
/**
* Pre Select a dropdown choice/option in Gravity Forms
*
* Create a dynamic list of dropdown choices from a custom post type
* Based on the current page, pre-select a choice in the drop down
*
* @var howto_dynamic_field = the dynamic field set in Gravity Forms on the field group under the Advanced tab
* @var howto_post_type = Your custom post type you are listing in the drop down
*
*/
@mjn666
mjn666 / Delete .svn directories
Created September 2, 2014 04:40
Recursively remove .svn folders from directory(s)
find . -type d -name .svn -exec rm -rf {} \;
@mjn666
mjn666 / .bash_profile
Created August 28, 2014 06:27
$PS1 Environments
PS1='\e[42m\e[30m \u@\h \@ \e[47m\e[30m \w \e[m\]\n$ ' # LOCAL
PS1='\e[43m\e[30m \u@\h \@ \e[47m\e[30m \w \e[m\]\n$ ' # STAGING
PS1='\e[41m\e[1;37m \u@\h \@ \e[47m\e[30m \w \e[m\]\n$ ' # PRODUCTION
@mjn666
mjn666 / WordPress | PrePros | config.rb
Created February 20, 2014 05:31
PrePros config.rb for WordPress
# Require any additional compass plugins here.
# @link http://compass-style.org/help/tutorials/configuration-reference/
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/"
fonts_dir = "css/fonts"
sass_dir = "sass"
images_dir = "images"
@mjn666
mjn666 / WordPress | Composer JSON
Last active August 29, 2015 13:56
composer.json file for WordPress [WIP]
{
"name": "vendor/theme-name",
"description": "Theme Name",
"license": "GPL-3.0+",
"repositories":[
{
"type":"composer",
"url":"http://wpackagist.org"
},
{
@mjn666
mjn666 / WordPress | Shortcode | HealCode Embed
Last active January 3, 2016 20:29
What it says on the tin
/**
* Embed HealCode
* {@link https://www.healcode.com}
* Usage: [healcode id="_ID_" name="_NAME_"]
*/
if ( ! function_exists(healcode_shortcode) ) {
function healcode_shortcode($atts, $content = null) {
extract(shortcode_atts(array(
'id' => '',
@mjn666
mjn666 / WordPress | ACF Location Field | Template embed
Last active December 30, 2015 05:29
WordPress + ACF Location FieldFunction wrapper for outputting a GMAP using ACF's Location Field (http://www.advancedcustomfields.com/add-ons/google-maps/)To be used in the "loop".
/**
* Add Google Map via ACF Location field
*
* API added via @see theme/enqueue.php: https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false
*
* @param (int) $post_id
* @param (string) $width Width of the gmap to display
* @param (string) $height height of the gmap to display
*
* @return HTML for google map embed
@mjn666
mjn666 / SCSS | Dark or Light Text Shadow
Last active December 29, 2015 06:59
Automated textshadow color based on current font color being used- Courtesy of Woocommerce.
// Automated textshadow based on color being used
@mixin darkorlighttextshadow( $a, $opacity: 0.8 ) {
@if lightness( $a ) >= 65% {
@include text_shadow( 0, -1px, 0, rgba(0, 0, 0, $opacity) );
} @else {
@include text_shadow( 0, 1px, 0, rgba(255, 255, 255, $opacity) );
}
}
@mjn666
mjn666 / SCSS | Thumbnail Gallery
Last active December 25, 2015 20:29
Generate a list of thumbnails of n * items per row; Defaults to 4.