Skip to content

Instantly share code, notes, and snippets.

View ashhitch's full-sized avatar
💭
Slinging Divs

Ash Hitchcock ashhitch

💭
Slinging Divs
View GitHub Profile
@ashhitch
ashhitch / Social Media Tags.html
Last active January 3, 2016 08:19
Social Media Meta Tag Template for Google, Twitter and Facebook (Open Graph)
<!-- Google Authorship and Publisher Markup -->
<link rel="author" href="https://plus.google.com/[Google+_Profile]/posts"/>
<link rel="publisher" href=”https://plus.google.com/[Google+_Page_Profile]"/>
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
<!-- Twitter Card data -->
@ashhitch
ashhitch / update-urls.sql
Last active July 31, 2025 09:21
Update your site URL in Wordpress to a new one. If you have changed your table prefix from wp_ the update the code below first.
/* update all post permalinks */
update wp_posts
set guid = REPLACE(guid, 'http://www.oldsite.com', 'http://www.newsite.com')
where guid LIKE '%http://www.oldsite.com%';
/* update all post content */
update wp_posts
SET post_content = REPLACE(post_content, 'http://www.oldsite.com', 'http://www.newsite.com')
where post_content LIKE '%http://www.oldsite.com%';
@ashhitch
ashhitch / sprite.less
Created January 31, 2014 09:19
Retina Sprites with LESS variables
//Less Variables
@spritePath: "../img/sprite.png"; //Path of standard sprite
@spritePathx2: "../img/sprite-retina.png"; //Path of retina sprite
@1xSpriteSizeW: 1000px; //Width of standard sprite
@1xSpriteSizeH: 1000px; //Height of standard sprite
//Sprite defaults
[class^="sprite-"],
[class*=" sprite-"] {
@ashhitch
ashhitch / checck-heights.js
Created February 20, 2014 16:00
jQuery functions to make all columns/objects the the same height. Runs through each element and then sets each the the highest one.
function checkAllHeights(row, item) {
if ($(row).length !== 0) {
var itemHeight = 0;
//reset size
$(row + ' ' + item).removeAttr('style');
//Check heights
$(row + ' ' + item).each(function (index) {
@ashhitch
ashhitch / svg-img-tag.css
Created April 4, 2014 16:25
Enhance IMG tags with SVGs using modernizr.
.svg .img-class {
content: url('filename.svg');
}
@ashhitch
ashhitch / check-height.js
Created April 30, 2014 10:05
Function to make all elements within a wrapper, the same height with jQuery.
function checkAllHeights(row, item) {
if ($(row).length !== 0) {
var itemHeight = 0;
//reset size
$(row + ' ' + item).removeAttr('style');
//Check heights to get tallest
$(row + ' ' + item).each(function (index) {
@ashhitch
ashhitch / browserversion.js
Created May 21, 2014 10:46
Append Browser Name to HTML Tag
$.each($.browser, function (key, value) {
if (key != 'version') {
$('html').addClass(key);
}
});
@ashhitch
ashhitch / Mobile-Detect.js
Created June 24, 2014 11:10
Simple Mobile Detect
//Mobile Detect
var testMobile;
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
@ashhitch
ashhitch / centrered-bootstrap-3-nav.less
Created July 14, 2014 09:41
Centrered Bootstrap 3 Navbar
//Update navbar.less
// Uncollapse the nav
@media (min-width: @grid-float-breakpoint) {
float: none;
margin: 0 auto;
display: table;
table-layout: fixed;
> li {
@ashhitch
ashhitch / nav-script.js
Created August 27, 2014 11:12
Make drop down navigation more accessibile via tabs. Uses Bootstrap classes
//If on dropdown link keep it open
$( document ).ready(function() {
$("ul.dropdown-menu li a").on('focus', function() {
$(this).closest('ul.dropdown-menu').addClass('show');
});
$("ul.dropdown-menu li a").on('blur', function() {
$(this).closest('ul.dropdown-menu').removeClass('show');
});
});