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 / 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: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 / 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 / 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 / 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 / sbmedia-functions.php
Last active May 23, 2017 17:37
WPML - Multilingual Date Function
<?php
/*
* Friendly Date (WPML)
* Adds a date in the proper language based on a timestamp
* @param timestamp $timestamp A unix timestamp
* @param language $language The locale code. In most cases this will be ICL_LANGUAGE_CODE
* @param short $short The date format to output (eg: 'l F jS, Y')
*/
function friendly_date_wpml($timestamp, $language, $short) {
@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 / 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 / Apps and Config this Installs
Last active October 7, 2016 05:43
OSX Clean Install
1. ZSH + Oh My ZSH
2. Ruby + RVM
3. OSX Config to reflect a developer's install
4. Sets Hostname
5. Homebrew
6. Python
7. Git & Github config file
8. Atom.io Editor
9. Homebrew Cask
10. Mongodb
@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%; }