Skip to content

Instantly share code, notes, and snippets.

View jonbellah's full-sized avatar

Jon Bellah jonbellah

View GitHub Profile
@jonbellah
jonbellah / header.php
Last active December 19, 2015 10:58
Mobile Navigation Toggle: The HTML
<?php if(!is_mobile()) { ?>
<nav id="navigation" class="site-navigation" role="navigation">
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- #site-navigation -->
<?php } else { ?>
<!-- Start mobile nav menu -->
<nav class="mobile-dropdown">
@jonbellah
jonbellah / gist:5896196
Created June 30, 2013 18:04
Vendor Prefixes
@mixin prefix($name, $value) {
-webkit-#{$name}: $value;
-moz-#{$name}: $value;
-ms-#{$name}: $value;
-o-#{$name}: $value;
#{$name}: $value;
}
@jonbellah
jonbellah / gist:5896145
Created June 30, 2013 17:49
Transition Mixin
@mixin transition($property, $speed) {
transition: $property $speed linear;
-o-transition: $property $speed linear;
-ms-transition: $property $speed linear;
-moz-transition: $property $speed linear;
-webkit-transition: $property $speed linear;
}
@jonbellah
jonbellah / gist:5896122
Created June 30, 2013 17:43
Border Radius Sass Mixin
@mixin border-radius($property) {
border-radius: $property;
-o-border-radius: $property;
-moz-border-radius: $property;
-webkit-border-radius: $property;
}
@jonbellah
jonbellah / gist:5896100
Created June 30, 2013 17:40
Retina Image Sass Mixin
@mixin image-2x($image, $width, $height) {
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: url($image);
background-size: $width $height;
}
}
@jonbellah
jonbellah / gist:5896071
Created June 30, 2013 17:31
Sass Gradients Mixin
@mixin gradient($from, $to) {
background: $from;
background: -moz-linear-gradient(top, $to 0%, $from 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$to), color-stop(100%,$from));
background: -webkit-linear-gradient(top, $to 0%, $from 100%);
background: -o-linear-gradient(top, $to 0%, $from 100%);
background: -ms-linear-gradient(top, $to 0%, $from 100%);
background: linear-gradient(to bottom, $to 0%, $from 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$to', endColorstr='$from',GradientType=0 );
}
@jonbellah
jonbellah / portfolio-template.php
Created May 15, 2013 18:54
Integrating isotope with custom post types - the HTML
<!-- Begin filter links -->
<div class="portfolio-filters">
<ul id="filters">
<li><a href="#" data-filter="*">All</a></li>
<!-- Begin filter loop -->
<?php
// Create an array and assign the projects taxonomy to it
$args = array( 'taxonomy' => 'skills' );
// Call the categories from this array
@jonbellah
jonbellah / functions.php
Created May 15, 2013 18:50
Integrating isotope with custom post types - the functions.php code
/** Set up custom taxonomy query */
function custom_taxonomies_terms_links() {
global $post, $post_id;
// get post by post id
$post = &get_post($post->ID);
// get post type by post
$post_type = $post->post_type;
// get post type taxonomies
$taxonomies = get_object_taxonomies($post_type);
foreach ($taxonomies as $taxonomy) {
@jonbellah
jonbellah / gist:5462674
Last active December 16, 2015 16:19
Random Image with PHP
<img src="http://www.example.com/images/image-<?php echo rand(1,7); ?>.jpg">
@jonbellah
jonbellah / Single media query
Created April 16, 2013 15:57
Designing for Retina: CSS and background-images
.logo {
background: url(images/example.jpg);
}
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.logo {
background: url(images/[email protected]);
background-size: 100px 100px;
}