Skip to content

Instantly share code, notes, and snippets.

View jamiehs's full-sized avatar

Jamie Hamel‑Smith jamiehs

View GitHub Profile
@jamiehs
jamiehs / markup.html
Created April 14, 2015 22:53
Equal height strategy for Bootstrap columns
<div class="row equal-height">
<div class="hidden-xs equal-height-trigger"></div>
<div class="col-sm-6 col-md-3">
<div class="card">
<div class="inner">
<header>
<h3>Lorem</h3>
</header>
<p>Lorem ipsum Veniam eiusmod sunt velit deserunt ullamco cillum Duis dolore anim nulla Ut pariatur pariatur labore non esse qui proident ad.</p>
@jamiehs
jamiehs / functions.php
Created July 7, 2015 17:18
Snippet to add a smarter option to Mandrill for WordPress.
<?php
/**
* Add paragraph breaks to plain text notifications sent by Mandrill
*
* Mandrill's default option for handling this is a bit too
* agressive. This method checks the type of email, and attempts
* to detect whether or not it is HTML or not.
*
* @param array $message
@jamiehs
jamiehs / 01-update-domain-name.sql
Last active September 24, 2015 17:12
MySQL Find and replace for WordPress domain changing
# Table Prefix
SET @prefix = 'wp';
# Find and replace strings
SET @find = "www.example.com";
SET @replace = "www.example.dev";
# Build and execute the statements
SET @sql1 = CONCAT('UPDATE ', @prefix, '_options SET option_value = REPLACE(option_value,?,?)');
SET @sql2 = CONCAT('UPDATE ', @prefix, '_posts SET guid = REPLACE(guid,?,?)');
@jamiehs
jamiehs / functions.php
Created October 8, 2015 05:00
Force https for the scheme-relative URLs in Fluid Video Embeds (requires 1.2.9 or higher)
<?php // only keep the opening PHP tag if your functions.php doesn't have one.
// Filter the iframe URL for Vimeo
add_filter( 'fve_vimeo_iframe_url', 'fve_vimeo_iframe_url', 10, 2 );
function fve_vimeo_iframe_url( $vimeo_iframe_url, $video_meta ) {
return 'https://player.vimeo.com/video/' . $video_meta['id'] . '?portrait=0&byline=0&title=0';
}
// Filter the permalink for Vimeo
add_filter( 'fve_vimeo_permalink', 'fve_vimeo_permalink', 10, 2 );
@jamiehs
jamiehs / copy-array.js
Created September 11, 2012 17:49
A simple way to copy an array in JavaScript
var myArray = new Array(1, 2, 3);
var copy = myArray.slice();
// now I can change myArray[0] = 5; & it wont affect copy array
@jamiehs
jamiehs / lens.js
Created October 4, 2012 14:52
Addition to a SlideDeck 2 lens.js file for adding an external title (Tool kit)
// This should be added to your custom lens based on the Tool Kit lens, right after these functions near the end of the file:
deckNavigation();
overlay();
setOptions();
deckAdjustments();
bindScrollEventForDotUpdate();
bindScrollEventForThumbUpdate();
// Add the external title to the frame
@jamiehs
jamiehs / gist:3845164
Created October 6, 2012 15:07
Meta tag for viewport based devices that uses native DPI Scaling
<meta name="viewport" content="width=device-width, target-densityDpi=device-dpi">
@jamiehs
jamiehs / click-timer.js
Created October 8, 2012 20:24
Click Timer for jQuery
$('#my_awesome_element').click(function(event){
var element = this;
if (this.timer) clearTimeout(element.timer);
this.timer = setTimeout(function(){
console.log("Nothing Pressed for 1000ms");
},1000);
return true;
});
@jamiehs
jamiehs / intrinsic-width.css
Created October 16, 2012 20:58
Intrinsic width on a block level element
div {
width: intrinsic; /* Safari/WebKit uses a non-standard name */
width: -moz-max-content; /* Firefox/Gecko */
}
@jamiehs
jamiehs / gist:3962024
Created October 26, 2012 22:51
Example of how to place extra custom JavaScript after the wp_footer and before the closing body tag
</div>
</div>
</div>
<!-- /Footer -->
<?php wp_footer(); ?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.slidedeck-frame').bind('mouseenter', function(){
jQuery('.slidedeck').slidedeck().pauseAutoPlay = true;