Skip to content

Instantly share code, notes, and snippets.

View mannieschumpert's full-sized avatar

Mannie Schumpert mannieschumpert

View GitHub Profile
@mannieschumpert
mannieschumpert / gist:8477368
Last active January 3, 2016 14:39
Domain propagation auto-checking. Checks IP of a domain every ten minutes.
while :
do
nslookup domain.com
sleep 600
done
@mannieschumpert
mannieschumpert / SassMeister-input-HTML.haml
Created January 11, 2014 18:41 — forked from a5e/SassMeister-input-HTML.haml
Generated by SassMeister.com.
%h1
= "π"
.pi
-(1..300).each do |j|
.digit
<?php
/**
* Filters the next, previous and submit buttons.
* Replaces the forms <input> buttons with <button> while maintaining attributes from original <input>.
* @param string $button Contains the <input> tag to be filtered.
* @param object $form Contains all the properties of the current form.
* @return string The filtered submit button.
*/
add_filter( 'gform_next_button', 'input_to_button', 10, 2 );
add_filter( 'gform_previous_button', 'input_to_button', 10, 2 );
@mannieschumpert
mannieschumpert / gist:8334811
Last active August 20, 2023 14:58
Filter the submit button in Gravity Forms to change the <input type="submit> element to a <button> element. There's an example in the Gravity Forms documentation, but it lacks the proper code to show your custom button text, AND removes important attributes like the onclick that prevents multiple clicks. I was trying to solve that.
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
// The following line is from the Gravity Forms documentation - it doesn't include your custom button text
// return "<button class='button' id='gform_submit_button_{$form["id"]}'>'Submit'</button>";
// This includes your custom button text:
return "<button class='button' id='gform_submit_button_{$form["id"]}'>{$form['button']['text']}</button>";
}
// Oops this strips important stuff
@mannieschumpert
mannieschumpert / enqueue.php
Last active December 31, 2015 04:29
Optionally enqueue LiveReload for local development.
<?php
/**
* Enqueue LiveReload if local install
*
* Assumes livereload.js is in the root folder of your local site
*
* This should be fairly reliable,
* but may need to be changed for some environments
*/
@mannieschumpert
mannieschumpert / SassMeister-input.sass
Created December 6, 2013 16:59 — forked from scottkellum/SassMeister-input.sass
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.7)
// ----
=e($name)
@at-root #{&}__#{$name}
@content
=m($name)
@at-root #{&}--#{$name}
@mannieschumpert
mannieschumpert / SassMeister-input.scss
Created December 6, 2013 16:58
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@import "SassyLists";
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
@mannieschumpert
mannieschumpert / SassMeister-input.scss
Created December 4, 2013 16:50 — forked from lunelson/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
/*
A slightly more automated approach to BEM modifier classes:
using '&' parent selector interpolation, modifiers extend their bases,
so that HTML markup requires only the modifier class not the base *and* modifier
*/
@mannieschumpert
mannieschumpert / gist:7250269
Created October 31, 2013 13:59
When using ACF, and registering fields via PHP (and not using Lite mode), your fields might not show, the likely problem being that your registration code ran before the ACF plugin was initiated. To solve, wrap your fields registrations in a plugins_loaded hook.
<?php
add_action( 'plugins_loaded', 'register_my_fields' );
function register_my_fields(){
// put the exported PHP field registration code here
}
@mannieschumpert
mannieschumpert / gist:7200062
Created October 28, 2013 16:29
A quick filter to allow the editor role to edit theme options.
<?php
/**
* Allow editor role to edit theme options
*/
add_filter('user_has_cap',
function( $caps ){
if (! empty( $caps['edit_pages'] ) )
$caps['edit_theme_options'] = true;
return $caps;
});