Skip to content

Instantly share code, notes, and snippets.

Ryan Burnette ryanburnette

Block or report user

Report or block ryanburnette

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View format-phone-number.php
<?php
function format_phone_number($phone) {
$phone = preg_replace("/[^0-9]/", "", $phone);
if ( strlen($phone) == 7 ) {
return preg_replace("/([0-9]{3})([0-9]{4})/", "$1-$2", $phone);
}
if ( strlen($phone) == 10 ) {
return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "($1) $2-$3", $phone);
}
return $phone;
View _helper.scss
// Helpers, adapted from HTML5 boilerplate
// Image replacement
@mixin ir {
background-color: transparent;
border: 0;
overflow: hidden;
/* IE 6/7 fallback */
*text-indent: -9999px;
&:before {
@ryanburnette
ryanburnette / gist:4055795
Created Nov 11, 2012
Do something if jQuery method is defined.
View gist:4055795
/*
This is one method that can be used to check if a method is valid. Then do something if that method proves valid.
*/
if ( $.isFunction($.fn.myFunction) === true ) {
/* Do stuff here */
}
@ryanburnette
ryanburnette / my-theme-options.php
Created Dec 2, 2012
WordPress Theme Options Plugin
View my-theme-options.php
<?php
/*
Plugin Name: My Theme Options
Plugin URI: /
Description: These are my theme options.
Version: 1.0.0
Author: Me
Author URI: /
*/
@ryanburnette
ryanburnette / my-plugin.php
Last active Oct 13, 2015
WordPress Plugin Seed
View my-plugin.php
<?php
/*
Plugin Name: My Theme Options
Plugin URI: /
Description: My Theme Options
Version: 1.0.0
Author: Me
Author URI: /
*/
View jquery.hovers.js
function init_hovers() {
var $hovers = $('.dohover'); // Elements that get the .hover class
$hovers.off('mouseenter mouseleave');
$hovers.hover(function() {
$(this).stop(true,true).toggleClass('hover', 1000);
});
}
View carousel-loop.liquid
@ryanburnette
ryanburnette / element-template.html
Last active Dec 17, 2015
Sequence.py is a Python script I use to iterate over HTML elements creating a large block of sequential elements from a template. I use it mostly with Shopify were there aren't always methods for looping over repeated elements.
View element-template.html
<div class="element" id="element-{{}}">
<span>Some stuff goes here. And it is sequential ... item #{{}}.</span>
</div>
You can’t perform that action at this time.