Skip to content

Instantly share code, notes, and snippets.

View tomdurkin's full-sized avatar

Tom Durkin tomdurkin

View GitHub Profile
@tomdurkin
tomdurkin / gist:fb342265b8327408af63abf4079f74b1
Created October 11, 2022 09:20
Stop Safari Turning phone number into a link
<meta name="format-detection" content="telephone=no">
@tomdurkin
tomdurkin / gist:2045969676b19d9113c7d57c30e8c74d
Created February 10, 2017 12:42
Fix MYSQL not starting issue mamp
Quit MAMP
Remove all files (but not directories) in the mysql dir.
/Applications/MAMP/db/mysql/
Relaunch MAMP
@tomdurkin
tomdurkin / if-else-category-wp.php
Created October 31, 2016 22:28
If / else based on category in wordpress
<?php if(in_category('videos')) : ?>
// show video
<?php else: ?>
// show the other thing you want
<?php endif ?>
@tomdurkin
tomdurkin / acf-flexslider
Created October 29, 2016 22:03
ACF with Flexslider
// this seems to work perfectly
<div class="flexslider">
<ul class="slides">
<?php if(have_rows('home_slider')): ?>
<?php while( have_rows('home_slider') ): the_row(); ?>
<li>
<?php the_sub_field('slide_title'); ?><br/>
@tomdurkin
tomdurkin / modal-external-link
Created June 30, 2016 09:27
Modal before leaving the site
@tomdurkin
tomdurkin / gist:9cca58f0296eaeb4891f94e5c603b88b
Created June 12, 2016 10:32
Humanise the wordpress timestamp
Posted <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
@tomdurkin
tomdurkin / vanilla-js-click-event
Last active April 29, 2016 14:01
Vanilla JavaScript Click Event
document.getElementById('your-id').onclick = function(){
// action
}
// or
document.getElementByClassName('your-class').onclick = function(){
// action
}
@tomdurkin
tomdurkin / gist:fd5c00b1ad5fa0e6eabc
Created January 7, 2016 23:43
Show current year in webpage
<script type="text/javascript">
document.write(new Date().getFullYear());
</script>
// wordpress
<?php echo date("Y"); ?>
// More examples
http://updateyourfooter.com/
@tomdurkin
tomdurkin / gist:f771e8444c5d6ff24090
Created December 8, 2015 14:32
Redirect to https
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://{HTTP_HOST}/$1 [R=301,L]
@tomdurkin
tomdurkin / gist:56c21ab50557aeff829f
Last active November 24, 2015 10:35
Pass a pre-defined function with a click event
function youHovered(e){
e.preventDefault();
console.log('wow, you clicked. You\'re great');
}
$('p').on('click', youHovered);