Skip to content

Instantly share code, notes, and snippets.

@jdcauley
jdcauley / excerpt.php
Last active August 29, 2015 13:57
Variable WP Excerpt Lengths
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
@jdcauley
jdcauley / the_post_thumbnail
Created March 26, 2014 17:45
WP Post Thumb in one line
<?php if (has_post_thumbnail()): the_post_thumbnail('', array('class' => 'img-responsive')); endif; ?>
@jdcauley
jdcauley / untitled
Created April 5, 2014 22:13
gistforbraidn
/**
* MailController.js
*
* @description ::
* @docs :: http://sailsjs.org/#!documentation/controllers
*/
var async = require('async');
var nodemailer = require('nodemailer');
var smtpTransport = nodemailer.createTransport("SMTP",{
service: "Mandrill",
/Users/jordancauley/projects/group/api/controllers/MainController.js:9
exec("git reset --hard HEAD && git pull origin
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
destroyMembersSubjectLine: function(data, cb){
console.log('destroy members');
// Get Addresses from Body
var destroyText = data.bodyText;
var bodyAddresses = [];
parser.addRule(/([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+)/gi, function(tag) {
var cleanTag = tag;
@jdcauley
jdcauley / blockquotes.js
Created May 30, 2014 16:47
Format Blockquotes
$(function quotes() {
blockquotes = document.getElementsByTagName('blockquote');
if (blockquotes) {
for (var i = 0; i < blockquotes.length; i++){
var blockquote = blockquotes[i];
var currentId = 'block-' + i;
blockquote.id = currentId;
paragraphs = blockquote.getElementsByTagName('p');
if ( 1 < paragraphs.length ){
var citation = document.getElementById(currentId);
@jdcauley
jdcauley / carousel.php
Last active August 29, 2015 14:02
Better BS + WP Carousel
@jdcauley
jdcauley / carousel-fade.css
Created June 19, 2014 18:17
Bootstrap Carousel Fade
@jdcauley
jdcauley / loop.js
Created July 8, 2014 12:46
jQuery Text Loop
$(function() {
var headline = $("#headline");
var copy = ['Entrepreneurs', 'Innovators', 'Industrialists', 'Disruptors'];
var position = -1;
!function loop() {
position = (position + 1) % copy.length;
headline.html(copy[position])
.fadeIn(1000)
.delay(3000)
@jdcauley
jdcauley / postloop.php
Created July 8, 2014 19:45
Recent Post Loop
<?php $the_query = new WP_Query('showposts=3'); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="recent-post-wrapper">
<?php if (has_post_thumbnail()): ?>
<div class="recent-post-img">
<?php the_post_thumbnail('', array('class' => 'img-responsive')); ?>
</div>
<div class="recent-post-copy">
<h4><?php the_title(); ?></h4>