Skip to content

Instantly share code, notes, and snippets.


Jamie Hamel‑Smith jamiehs

View GitHub Profile
jamiehs / 01-modal_content.html
Last active Aug 29, 2015
Assuming the below HTML with the video class on the modal and the video URL as the data attribute on the video content.
View 01-modal_content.html
<a data-toggle="modal" data-target=".bs-modal-lg">Open Modal</a>
<div class="modal fade bs-modal-lg video" tabindex="-1" role="dialog" aria-labelledby="VideoModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content" data-video-url="//;byline=0&amp;title=0&amp;autoplay=1">
<div class="fve-video-wrapper fve-image-embed fve-thumbnail-image youtube" style="padding-bottom:56.25%;">
<iframe src="" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
View Contract Killer

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

jamiehs /
Created Feb 26, 2014
Recursively download a directory listing structure, filtering specific file types.
wget -r -A=jpeg,jpg,bmp,png,gif,tiff,xpm,ico
jamiehs / functions.php
Created Mar 3, 2014
Allows WordPress' importer to import media assets from one localhost site to another to (localhost sites). It seems that the WordPress wp_http_validate_url() function disallows the opening of URLs from the same host (
View functions.php
add_filter( 'http_request_host_is_external', 'explicitly_allow_same_host_requests_for_import' );
function explicitly_allow_same_host_requests_for_import(){
return true;
jamiehs / Pi setup
Last active Aug 29, 2015
Setup a new Raspberry Pi Dashing board based on cloned image of "raspberrypi2"
View Pi setup
# Find listening port 22 on the network
nmap -T5 -n -p 22 --open --min-parallelism 100
# edit hostname and hosts to change the hostname.
sudo nano /etc/hostname
sudo nano /etc/hosts
# edit the static IP address in the interfaces file.
sudo nano /etc/network/interfaces
jamiehs / update-domain-name-2.sql
Created Mar 19, 2014
Simple version of MySQL find and replace for WOrdPress database migration.
View update-domain-name-2.sql
# Update wp_options table
UPDATE wp_options SET option_value = REPLACE(option_value,'','');
# Update wp_posts table
UPDATE wp_posts SET guid = REPLACE(guid,'','');
jamiehs / sass-mixins.scss
Last active Aug 29, 2015
Magical mixins with trees
View sass-mixins.scss
@mixin gallery-items($size) {
.item {
float: left;
.thumbnail {
margin-bottom: $size/4;
text-align: center;
width: $size;
height: $size;
View popup_function.js
function openPopup(href, title, width, height){
var left = screen.availLeft + screen.width/2 - width/2,
top = screen.height/2 - height/2;, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
jamiehs /
Created Apr 24, 2014
Recursively loop over all files, then use simple string replacements.
find . -type f -name "file-pattern*" -exec sh -c 'echo mv "$0" "${0/find/replace}"' '{}' \;
#Remove the echo when you're sure this does what you want.
jamiehs / scrollto-pushstate.js
Created Sep 23, 2014
jQuery Scroll To with history.pushState support for using the back button and the location bar:
View scrollto-pushstate.js
$(document).on('click', 'a[href*=#]', function(event){
var targetId = this.hash;
var theTarget = $(targetId);
var customOffset = 0;
switch( targetId ){
case '#target1':
case '#target2':
customOffset = -80;