Skip to content

Instantly share code, notes, and snippets.

View robinbastien's full-sized avatar
Just a developer in a quarantined world

Robin Bastien robinbastien

Just a developer in a quarantined world
View GitHub Profile
@robinbastien
robinbastien / reset-sample.css
Created March 10, 2014 13:41
A sample of some common HTML elements to override a reset stylesheet.
ul, ol { margin-bottom: 20px; }
ul { list-style: none outside; }
ol { list-style: decimal; }
blockquote { margin: 0 0 20px; padding: 9px 20px 0 19px;}
em { font-style: italic; }
strong { font-weight: bold; }
small { font-size: 80%; }
@robinbastien
robinbastien / text_with_image.php
Created July 8, 2014 17:41
ACF - Text with Image
<?php
$content = get_sub_field('content');
$title = get_sub_field('title');
$position = get_sub_field('image_position');
$image = get_sub_field('image')['url'];
if(!empty($title)) {
$title = "<h2 class='section__heading'>" . $title . "</h2>\r\n";
}
@robinbastien
robinbastien / accordion.js
Last active August 29, 2015 14:04
ACF + jQuery accordion w/ ScrollTo support
/*!
* _accordion.js
*
* It's an accordion built with jQuery!
*
*
$('.accordion').accordion();
*
@robinbastien
robinbastien / gist:be0754fb8150cf194470
Last active August 29, 2015 14:07
Gravity Forms sample user meta
<?php
/**
* Save the confirmation number of the wire transfer to the user's meta
*/
add_action("gform_after_submission_12", "save_wire_transfer", 10, 2);
function save_wire_transfer($entry, $form){
$current_user = wp_get_current_user();
$user_id = $current_user->id;
//getting post
@robinbastien
robinbastien / admin.js
Last active August 29, 2015 14:11
ACF 5 - Close all flexible sections
/* Enqueue this in your admin JS file */
jQuery(document).ready(function($) {
// minimize ACF flexible content layouts
$('.acf-flexible-content .layout[data-toggle=open]').find('.acf-fc-layout-handle').click();
});
@robinbastien
robinbastien / main.js
Last active August 29, 2015 14:16
Owl Carousel Reset on Resize
jQuery(document).ready(function($) {
// When user resizes window...
$(window).on('resize',function() {
// Set interval until timer is cleared, indicating end of the resize event
waitForFinalEvent(function() {
// Get owl carousel
var owldata = $(".owl-carousel").data('owlCarousel');
@robinbastien
robinbastien / main.js
Last active August 29, 2015 14:16
Gravity Forms - Grid Framework for gform fields
// Make form work with grid framework
$(document).bind('gform_post_render', function(){
$('.gform_fields').addClass('grid');
$('.gfield input, .gfield_html, .gfield textarea,.gfield select,.gfield h3, .gfield h2, .gfield p').each(function() {
if($(this).parents('.gfield').hasClass('cell')) {
} else if($(this).hasClass('small')) {
@robinbastien
robinbastien / machine-filters.php
Last active August 29, 2015 14:16
Gravity Forms - Common Filters
<?php
if( function_exists('gravity_form') ) {
add_filter( 'gform_submit_button', 'form_submit_button', 10, 2 );
add_filter( 'gform_init_scripts_footer', 'init_gform_scripts');
}
/*
* Add framework classes to the submit buttons
*/
@robinbastien
robinbastien / main.js
Last active August 29, 2015 14:22
jQuery Square blocks in grid system. Simple responsive stay-square listings
jQuery(document).ready(function($) {
// Assuming the items we want to square are .film-listing...
if( $('.film-listing').length ) {
makeItSquare('.film-listing');
// This handles resizing and preserving the nice squareness
$(window).bind('resizeEnd', function() {
makeItSquare('.film-listing');
});
@robinbastien
robinbastien / machine-actions.php
Created July 14, 2015 15:33
Remove WP Emoji Scripts
<?php
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
?>