Skip to content

Instantly share code, notes, and snippets.

@jdcauley
jdcauley / gist:8689338
Created January 29, 2014 14:41
gulp-file
var gulp = require('gulp'),
sass = require('gulp-less');
gulp.task('less', function() {
gulp.src('assets-v2/less/app.less')
.pipe(gulp.dest('assets-v2/css/'));
});
gulp.task('default', function() {
gulp.run('less');
@jdcauley
jdcauley / Ref Errof
Created January 31, 2014 17:03
Error
ReferenceError: HTTPStatus is not defined
at ClientRequest.<anonymous> (/Users/jordancauley/projects/posted/api/controllers/FileController.js:55:34)
at ClientRequest.EventEmitter.emit (events.js:117:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1669:21)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:120:23)
at CleartextStream.socketOnData [as ondata] (http.js:1564:20)
at CleartextStream.read [as _read] (tls.js:502:12)
at CleartextStream.Readable.read (_stream_readable.js:320:10)
at EncryptedStream.write [as _write] (tls.js:366:25)
at doWrite (_stream_writable.js:219:10)
@jdcauley
jdcauley / gist:8984009
Created February 13, 2014 21:16
HomeController
module.exports = {
index: function (req,res) {
File.find( function foundFiles(err, files) {
if (err) return next(err);
// pass the array down to the /views/index.ejs page
res.view({
files: files
});
@jdcauley
jdcauley / app.css
Created February 17, 2014 15:49
Static lead area with 1 large and 2 small areas.
.featured-post{
color: @white;
position: relative;
height: auto;
float: right;
min-height: 225px;
max-height: 225px;
width: 50%;
background-size: cover;
background-position: center center;
@jdcauley
jdcauley / gist:9498154
Created March 12, 2014 00:28
Sails.js user of Populate
index: function(req, res){
User.findOne(req.user).populate('files').exec(function( err, fileuser){
console.log(err);
console.log(fileuser);
res.view({
user : fileuser
});
@jdcauley
jdcauley / responsive videos
Created March 13, 2014 19:42
responsive videos
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
@jdcauley
jdcauley / UserController.js
Created March 18, 2014 17:59
Update Controller
update: function(req, res){
},
@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",