Skip to content

Instantly share code, notes, and snippets.

View tayvano's full-sized avatar

Taylor Monahan tayvano

View GitHub Profile
@tayvano
tayvano / Equal-Heights-JS.js
Created January 24, 2016 23:24
Equal Heights JS
//Gives Containers equal heights, using the tallest height and applying it to the other containers
//the function takes two arguments, the class of the container of all to-be-equalized containers, and the class of the containers themselves
function equalizeContainers(containerClass, targetClass) {
//Get all containers of to-be-equalized elements...
var containerElements = document.getElementsByClassName(containerClass);
//... and iterate through them
for(var i = 0; i < containerElements.length; i++) {
// Smooth Scolling https://css-tricks.com/snippets/jquery/smooth-scrolling/
// the higher the "400" number is, the slower is goes.
$(function() {
$('a[href*=\\#]:not([href=\\#])').click(function(e) {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') || location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top - 110
function limit_char($limit, $source=null) {
global $post;
($source) ? '<p>'.$source.'</p>' : $source = '<p>'.get_the_excerpt().'</p>';
$read_more = '... <a href="'. get_permalink($post->ID) . '" class="more-link" title="Read '.get_the_title($post->ID).'">Read more</a>';
$limited = strlen($source) > $limit ? substr($source,0,strpos($source,' ',$limit)) . $read_more : $source;
echo $limited;
}

Keybase proof

I hereby claim:

  • I am tayvano on github.
  • I am tayvano (https://keybase.io/tayvano) on keybase.
  • I have a public key ASBa64mpsHMVdrXgqF_bPTqz7pZxKiudr_d_f-sVvfwDqQo

To claim this, I am signing this object:

@tayvano
tayvano / primary_category.php
Created March 17, 2017 00:58 — forked from jawinn/primary_category.php
Display Primary Category (Yoast's WordPress SEO)
<?php
// SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category){
$category_display = '';
$category_link = '';
if ( class_exists('WPSEO_Primary_Term') )
@tayvano
tayvano / .htaccess
Last active April 5, 2017 00:10 — forked from boogah/.htaccess
Expire headers .htaccess code.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 3 days"
# Favicon
ExpiresByType image/x-icon "access plus 1 month"
# Media: images, video, audio
ExpiresByType image/gif "access plus 1 month"
<div class="lazyImg lazyImg--notloaded" style="background-image: url(<?php echo $hero_bg['sizes']['lazyImg']?>)" data-image="<?php echo $hero_bg['sizes']['hero-bg']?>"></div>
<noscript><div style="background-image: url(<?php echo $hero_bg['sizes']['hero-bg']?>)"></div></noscript>
function loadLazyImg() {
$.each( $('.lazyImg'), function(index, val) {
var img = new Image()
var src = $(this).attr('data-image')
img.src = src
var image = $(this)
@tayvano
tayvano / wp-query-ref.php
Last active April 21, 2017 07:15 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@tayvano
tayvano / osx-setup.sh
Created April 26, 2017 05:15 — forked from somebox/osx-setup.sh
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
#!/usr/bin/env bash
#Install command-line tools using Homebrew.
#Make sure we’re using the latest Homebrew.
brew update
#Upgrade any already-installed formulae.
brew upgrade