Skip to content

Instantly share code, notes, and snippets.


Jamie Hamel‑Smith jamiehs

View GitHub Profile
jamiehs / gist:3364281
Created Aug 15, 2012
jQuery Array Intersect One Liner
View gist:3364281
// Find the common intersection between the arrays
$.map(a1,function(a){return $.inArray(a, a2) < 0 ? null : a;})
jamiehs / copy-array.js
Created Sep 11, 2012
A simple way to copy an array in JavaScript
View copy-array.js
var myArray = new Array(1, 2, 3);
var copy = myArray.slice();
// now I can change myArray[0] = 5; & it wont affect copy array
jamiehs / lens.js
Created Oct 4, 2012
Addition to a SlideDeck 2 lens.js file for adding an external title (Tool kit)
View lens.js
// This should be added to your custom lens based on the Tool Kit lens, right after these functions near the end of the file:
// Add the external title to the frame
jamiehs / mq.css
Created Oct 4, 2012 — forked from chriscoyier/mq.css
Media Query Breakpoints for Retina Displays
View mq.css
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
jamiehs / youtube-regex.js
Created Oct 6, 2012
YouTube JavaScript Regex
View youtube-regex.js
var youTubeRegex = /(\/|v\/|u\/\w\/|embed\/|watch\?v=|[a-zA-Z0-9_\-]+\?v=)([^#\&\?\n<>\'\"]*)/gi;
jamiehs / gist:3845164
Created Oct 6, 2012
Meta tag for viewport based devices that uses native DPI Scaling
View gist:3845164
<meta name="viewport" content="width=device-width, target-densityDpi=device-dpi">
jamiehs / click-timer.js
Created Oct 8, 2012
Click Timer for jQuery
View click-timer.js
var element = this;
if (this.timer) clearTimeout(element.timer);
this.timer = setTimeout(function(){
console.log("Nothing Pressed for 1000ms");
return true;
jamiehs / intrinsic-width.css
Created Oct 16, 2012
Intrinsic width on a block level element
View intrinsic-width.css
div {
width: intrinsic; /* Safari/WebKit uses a non-standard name */
width: -moz-max-content; /* Firefox/Gecko */
jamiehs / gist:3962024
Created Oct 26, 2012
Example of how to place extra custom JavaScript after the wp_footer and before the closing body tag
View gist:3962024
<!-- /Footer -->
<?php wp_footer(); ?>
<script type="text/javascript">
jQuery('.slidedeck-frame').bind('mouseenter', function(){
jQuery('.slidedeck').slidedeck().pauseAutoPlay = true;
jamiehs / YouTube HD Embed
Created Dec 14, 2012
Force YouTube to embed a player with modest branding, autoplay, and 720p
View YouTube HD Embed