Skip to content

Instantly share code, notes, and snippets.

@jdcauley
jdcauley / single.php
Last active August 29, 2015 14:04
Image Empty State
<div class="blog-img">
<?php if (has_post_thumbnail()): ?>
<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' ); ?>
<div class="blog-feature" style="background-image: url(<?php echo $src[0]; ?>);"></div>
<?php else: ?>
<div class="blog-feature-empty"></div>
<?php endif; ?>
</div>
@jdcauley
jdcauley / empty-thumb.php
Created July 16, 2014 18:51
Featured Image with Empty State
<div class="blog-img">
<?php if (has_post_thumbnail()): ?>
<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' ); ?>
<div class="blog-feature" style="background-image: url(<?php echo $src[0]; ?>);"></div>
<?php else: ?>
<div class="blog-feature-empty"></div>
<?php endif; ?>
</div>
@jdcauley
jdcauley / equalheight.js
Last active August 29, 2015 14:04
Box Height
function boxHeight(target){
var pricingBox = document.getElementsByClassName(target);
var boxHeights = []
for (var i = 0; i < pricingBox.length; i++){
var heights = window.getComputedStyle(pricingBox[i], null).getPropertyValue('height').replace("px", "");
boxHeights.push(heights);
}
var tallest = Math.max.apply( null, boxHeights );
for (var i = 0; i < pricingBox.length; i++){
pricingBox[i].style.height=tallest+'px' ;
@jdcauley
jdcauley / grayscale-img.scss
Created July 23, 2014 14:03
Quick Gray Scale
&.grayscale img {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */
}
&.grayscale:hover img {
filter: none;
-webkit-filter: none;
}
@jdcauley
jdcauley / scripts.js
Created August 7, 2014 11:34
style-to-head
function dribbleVideoPosition(){
if($('body').hasClass('home') ){
var currentWindow = $(window).width();
if (currentWindow < 1628){
var difference = 1628 - currentWindow;
var half = Math.round(difference/2);
var newMarginLeft = half;
var css = '.dribble{margin-left: -'+ newMarginLeft + 'px !important;}',
head = document.head || document.getElementsByTagName('head')[0],
@jdcauley
jdcauley / getParams.js
Last active August 29, 2015 14:05
getParams from URL and turn into object
function getParams(){
var params = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
params[hash[0]] = hash[1];
}
return params;
}
@jdcauley
jdcauley / app.less
Created September 5, 2014 13:21
css header
@import '_bootstrap';
@import '_variables';
/* ===================================
Utilities
=================================== */
.social{
list-style: none;
@jdcauley
jdcauley / Gulpfile.js
Created October 10, 2014 13:02
Sass Gulpfile.js
var gulp = require('gulp');
var compass = require('gulp-compass');
var watch = require('gulp-watch');
var minifyCSS = require('gulp-minify-css');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var uglify = require('gulp-uglify');
gulp.task('scss', function(){
console.log('running scss');
@jdcauley
jdcauley / gist:b7f2f232277cb481ccc5
Created October 13, 2014 18:50
file permissions wp
chown www-data:www-data -R * # Let apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
@jdcauley
jdcauley / sortedlist
Last active August 29, 2015 14:07
li Sort
function alphabatizeMenu(target){
var continent = document.getElementById('tab_' + target);
if(continent){
var listParent = document.getElementById(target + '-offices');
var listItems = continent.getElementsByClassName('in-' + target);
var listItemText = [];
for(var i = 0; i < listItems.length; i++){
listItemText.push({
country: listItems[i].textContent,
item: listItems[i]