Skip to content

Instantly share code, notes, and snippets.

View joedooley's full-sized avatar

Joe Dooley joedooley

  • Florida
  • 02:46 (UTC -05:00)
View GitHub Profile
@joedooley
joedooley / 0_reuse_code.js
Created November 7, 2015 06:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joedooley
joedooley / sm-annotated.html
Created November 8, 2015 09:24 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@joedooley
joedooley / price.php
Created November 30, 2015 18:06 — forked from lmartins/price.php
Show the sale savings percentage besides the product price and sale flash
add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 );
function woocommerce_custom_sales_price( $price, $product ) {
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
return $price . sprintf( __(' Save %s', 'woocommerce' ), $percentage . '%' );
}
@joedooley
joedooley / woo.php
Created November 30, 2015 18:25 — forked from lmartins/woo.php
Get the top level categories assigned to a product
function mw_theme_categories( $context )
{
$args = array( 'taxonomy' => 'product_cat' );
$terms = wp_get_post_terms( $context['post']->ID ,'product_cat', $args );
foreach ($terms as $cat) {
if($cat->parent == 0){
$out = '<div class="prodLabel prodLabel--' . strtolower( $cat->name ) . '">';
$out .= "<a href='/product-category/$cat->slug'>$cat->name</a>";
$out .= '</div>';
echo $out;
@joedooley
joedooley / gulpfile.js
Created November 30, 2015 20:08 — forked from lmartins/gulpfile.js
Current Gulpfile configuration
'use strict';
var gulp = require('gulp'),
connect = require('gulp-connect'),
gulpLoadPlugins = require('gulp-load-plugins'),
cleanhtml = require('gulp-cleanhtml'),
dev = require('gulp-dev'),
browserSync = require('browser-sync'),
plugins = gulpLoadPlugins(),
webpack = require('webpack'),
@joedooley
joedooley / aa_login.php
Created December 1, 2015 20:44 — forked from ahmadawais/page-login.php
WordPress Frontend Login Page
<?php /* Template Name: Login Page AA */ ?>
<?php get_header(); ?>
<!-- section -->
<section class="aa_loginForm">
<?php global $user_login;
if(isset($_GET['login']) && $_GET['login'] == 'failed')
{
@joedooley
joedooley / README.md
Created February 4, 2016 06:17 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@joedooley
joedooley / .bash_profile
Created February 10, 2016 01:53 — forked from davidneedham/.bash_profile
Pantheon Development Workflow (pdw): Commands to improve your Pantheon to local development experience. Just copy these commands into your .bash_profile or .bashrc, update the pdw-auth command to use your credentials, install Terminus (https://github.com/pantheon-systems/cli/wiki/Installation), and go!
#------------------------------------------
# PANTHEON DEVELOPMENT WORKFLOW v1.01
# Using the Pantheon CLI (terminus) v0.71
#------------------------------------------
# Authenticate with Pantheon. The first step, most of the time.
# This is a little insecure, as it lists your password here. But it's convenient.
alias pdw-auth='terminus auth login YOURPANTHEONEMAILADDRESS --password=YOURPANTHEONPASSWORD'
# Update your local Pantheon site aliases
@joedooley
joedooley / acf-post-type-model-example-template.php
Created February 19, 2016 12:33 — forked from lucasstark/acf-post-type-model-example-template.php
Example template using a model representing the post.
<?php
$contact = AWP_CTP_Model_Contact::get_instance( get_the_ID() );
?>
<article id="post-<?php echo $contact->get_ID(); ?>">
<?php if ( $contact->get_featured_image_url() ) : ?>
<div class="ecc-contact-image">
<img class="th" src="<?php echo $contact->get_featured_image_url(); ?>" alt="<?php echo $contact->get_display_title(); ?>" title="<?php echo $contact->get_display_title(); ?>" />
@joedooley
joedooley / acf-post-type-model-example.php
Created February 19, 2016 12:33 — forked from lucasstark/acf-post-type-model-example.php
Example of wrapping a custom post type inside of a model
<?php
class AWP_CTP_Model_Contact {
/**
* Gets an array of data for the object. Use this to get data to pass to the constructor.
* @param int $id
* @return array
*/
public static function get_data( $id ) {