Skip to content

Instantly share code, notes, and snippets.

View fieldoffice's full-sized avatar
🚲
Out cycling

Andy Field fieldoffice

🚲
Out cycling
View GitHub Profile
@fieldoffice
fieldoffice / wordpress-html5-search
Created November 27, 2014 21:38
Replace the default search with an HTML5 version
@fieldoffice
fieldoffice / batch-resize.sh
Last active August 29, 2015 14:10
Batch image resize using the command-line
sips -Z 140 *.png
sips -Z 140 90 *.png
Verifying that +fieldoffice is my openname (Bitcoin username). https://onename.io/fieldoffice
@fieldoffice
fieldoffice / acf-repeater-count
Created November 8, 2014 18:39
ACF Repeater Count
<?php if( have_rows('repeater_name') ): ?>
<?php $counter = 1; ?>
<div class="items">
<?php while( have_rows('repeater_name') ): the_row(); ?>
<div class="item item-<?php echo $counter; ?>">
<a href="<?php the_sub_field('repeater_field_01'); ?>">
<h3><?php the_sub_field('repeater_field_02'); ?></h3>
<p><?php the_sub_field('repeater_field_03'); ?></p>
</a>
</div>
@fieldoffice
fieldoffice / toggle-text
Created October 30, 2014 11:50
Toggle text string on click
$('.link').click(function() {
$(this).text($(this).text() == 'Show Help' ? 'Hide Help' : 'Show Help');
return false;
});
@fieldoffice
fieldoffice / flexbox-mixins
Created October 29, 2014 15:19
Sass Flexbox Mixins
@mixin flexbox() {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
@mixin flex($values) {
-webkit-box-flex: $values;
@fieldoffice
fieldoffice / datatable-selects
Created October 3, 2014 12:01
Using Select2 or Chosen with DataTables
/* SELECT 2 */
'fnInitComplete': function(oSettings, json) {
$('select').select2({
minimumResultsForSearch: -1
});
}
/* CHOSEN 2 */
@fieldoffice
fieldoffice / background-gradient
Created September 23, 2014 12:51
Sass Background Gradient Mixin
@mixin background-gradient($startColor, $endColor) {
background: $startColor; /* Old browsers */
background: -moz-linear-gradient(top, $startColor 0%, $endColor 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$startColor), color-stop(100%,$endColor)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, $startColor 0%,$endColor 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, $startColor 0%,$endColor 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, $startColor 0%,$endColor 100%); /* IE10+ */
background: linear-gradient(to bottom, $startColor 0%,$endColor 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$startColor', endColorstr='$endColor',GradientType=0 ); /* IE6-8 */
}
@fieldoffice
fieldoffice / terminal-ipaddress
Created September 23, 2014 10:11
Terminal - Show IP Addresses
ifconfig | grep "inet " | grep -v 127.0.0.1
@fieldoffice
fieldoffice / wordpress-date-shortcode
Created September 21, 2014 11:26
WordPress Date Shortcode
function displaydate(){
return date('jS F Y');
}
add_shortcode('date', 'displaydate');