Skip to content

Instantly share code, notes, and snippets.

View thomasbennett's full-sized avatar

Thomas Bennett thomasbennett

View GitHub Profile
<?php
// put the code from this section into the if/else below around line 615
// if ( in_array( $request_method, array( 'GET', 'DELETE' ) ) && ! empty( $request_data ) ) {
// this garbage code will make their API work
if ( $request_method === 'GET' && 'json' === $feed['meta']['requestFormat'] ) {
// Add content type header.
$request_headers['Content-Type'] = 'application/json';
@thomasbennett
thomasbennett / show-hide.html
Last active October 24, 2017 17:12
Show / Hide an element with Bootstrap
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#button-id-here').on('click', function() {
jQuery('#form-id-here').toggleClass('hidden');
});
});
</script>
<button id="button-id-here">Click Me</button>
<div itemscope itemtype="http://schema.org/Product">
<a href="http://lbemuoil.com/ultra-emu-oil.html" title="{name}">
<img src="{img}.jpg" alt="{name}" title="{name}">
</a>
<span itemprop="name">{name}</span>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
Rated <span itemprop="ratingValue">{rating}</span>/{totalStars} based on <span itemprop="reviewCount">{totalReviews}</span> customer reviews
</div>
Product description:
<a href="http://lbemuoil.com/ultra-emu-oil.html" title="Ultra Emu Oil">
<img src="http://lbemuoil.com/media/catalog/product/cache/1/small_image/170x170/9df78eab33525d08d6e5fb8d27136e95/2/o/2oz-ultra-01.jpg" alt="Ultra Emu Oil" title="Ultra Emu Oil">
</a>
<label>Store Description</label>
<span class="edit">
<textarea id="js-store-name" class="count-check"></textarea>
<span class="icon">d</span>
</span>
<span class="count-help">
<span class="count-limit">200</span> characters remaining
</span>
<div class="eight columns">
<label>Store Name</label>
<a class="edit edited"><input type="text" value="Kate's Flowers"><span class="icon">d</span></a>
<label>Store Name</label>
<a class="edit">
<textarea id="js-store-name" class="count-check"></textarea>
<span class="icon">d</span>
</a>
<span class="count-help">
var editInPlace = $('a.edit');
editInPlace.on('focus', 'input, textarea', function(){
t.parents('a.edit').toggleClass('edited');
}).on('blur', 'input, textarea', function() {
var t = $(this);
if ( t.val() != '' || t.text() != '' ) {
t.parents('a.edit').addClass('edited');
} else {