Skip to content

Instantly share code, notes, and snippets.

@i556
i556 / gist:1661623
Created January 23, 2012 08:10
Cross Domain iframe Resizing
http://mohumohu/parent.html
http://hogehoge.com/iframe.html
//parent.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
@mikejolley
mikejolley / gist:2044101
Last active October 28, 2024 06:14
WooCommerce - Show number of items in cart and total
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@ronanguilloux
ronanguilloux / gist:5317541
Last active February 21, 2018 19:07 — forked from i556/gist:1661623
//parent.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script type="text/javascript">
window.addEventListener("message", receiveSize, false);
function receiveSize(e) {
//console.log("parent: message received", e);
@robneu
robneu / wordpress-typekit-enqueue.php
Last active January 17, 2023 23:04 — forked from FernE97/typekit-enqueue.php
Enqueue typekit fonts to WordPress using wp_enqueue_scripts.
<?php
/**
* Enqueue typekit fonts into WordPress using wp_enqueue_scripts.
*
* @author Robert Neu
* @author Eric Fernandez
* @copyright Copyright (c) 2014, Robert Neu
* @license GPL-2.0+
* @link http://typekit.com
*/
@aderaaij
aderaaij / yoast
Last active April 3, 2024 20:11
Wordpress - Move yoast seo boxes to bottom of post/page
// Move Yoast to bottom
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
@elijahmanor
elijahmanor / _mixins.scss
Created November 6, 2013 21:11
Placeholder SASS Mixin
/*
Usage:
$placeholder: #999;
input {
@include placeholder { color: $placeholder; }
}
*/
@mixin placeholder {
&::-webkit-input-placeholder { @content } /* webkit */
&:-moz-placeholder { @content } /* ff 4-18 */
@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
@nicolaracco
nicolaracco / datepicker-html5-glue.js
Created January 31, 2014 10:11
Glue to allow you to work with date inputs using the native datepicker when supported and JQuery UI as a fallback
(function() {
var setupDatePickerGlue = function($el, format) {
var elName = $el.attr("name"), // field name
elId = $el.attr("id"), // field id
elValue = $el.attr("value"); // field raw value
// remove the name to prevent value conflict on submit
$el.removeAttr("name");
// prepend an hidden input field with the same name
$el.before($("<input type='hidden' name='" + elName + "' id='raw-" + elId + "' />"));
@colelawrence
colelawrence / client.js
Created February 23, 2014 02:40
Javascript window resize timeout
// Do stuff after 100ms of no resizing
var resizeTimeout;
$(window).on("resize", function () {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function () {
// Do stuff
}, 100);
});
@jeffreyd00
jeffreyd00 / gist:fed7606c1d7e47685ecf
Created June 22, 2015 13:44
List of states in the United States for ACF
AL : Alabama
AK : Alaska
AZ : Arizona
AR : Arkansas
CA : California
CO : Colorado
CT : Connecticut
DE : Delaware
DC : District of Columbia
FL : Florida