Skip to content

Instantly share code, notes, and snippets.

View tommymarshall's full-sized avatar

Tommy Marshall tommymarshall

View GitHub Profile
{% set items = craft.entries.find({ section: section, limit: 5, order: 'postDate asc' }) %}
{% if items | length %}
<ul>
{% for entry in items %}
<li>
<a href="{{ entry.url }}">{{ entry.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
An exception has been thrown during the rendering of a template ("Database configuration errors: There is a problem connecting to the database with the credentials supplied in your db config file.") in "_shared/_sub-nav" at line 1.
// Running Command
tommy in ~/Sites/testing on guuuuuuuulp!
± gulp compass [17:19:30]
[gulp] Using file /Users/tommy/Sites/testing/gulpfile.js
[gulp] Working directory changed to /Users/tommy/Sites/testing
[gulp] Running 'compass'...
[gulp] Finished 'compass' in 5.4 ms
unchanged assets/images/structure/parts-s91986b218a.png
unchanged assets/images/structure/parts-s91986b218a.png
// My gulpfile.js
var browserify = require('gulp-browserify');
var compass = require('gulp-compass');
var concat = require('gulp-concat');
var exec = require('child_process').exec;
var gulp = require('gulp');
var lr = require('tiny-lr');
var refresh = require('gulp-livereload');
var server = lr();
var sys = require('sys');
@tommymarshall
tommymarshall / gist:11184530
Created April 22, 2014 15:55
Set Video Dimensions
setVideoDimensions: function() {
var $wrapper = $('.video-wrapper');
var $video = $('.video');
var height = $wrapper.height();
var width = $wrapper.width();
// Maintain 16 / 9 aspect ratio
if (width / height > 16 / 9) {
newWidth = height / 9 * 16;
newHeight = height;
# Submit PR for current branch against master
pr () {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
}
@tommymarshall
tommymarshall / merge_extend.js
Last active August 29, 2015 14:01
Compares Underscore's extend method with React's merge helper.
var merge = require('react/lib/merge');
var _ = require('underscore');
var a = {
name: 'Tommy',
specs: {
height: {
inches: 60,
feet: 6.085
},
@tommymarshall
tommymarshall / routes.php
Last active October 18, 2019 13:23
Simple Laravel + Craft integration
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
@tommymarshall
tommymarshall / menu.html
Last active August 29, 2015 14:01
Basic menu.
<header>
<nav>
<ul>
<li>
<div>
<h3>Heading</h3>
<ul>
<li><a href="#">Some link</a></li>
<li><a href="#">Some link</a></li>
<li><a href="#">Some link</a></li>
{
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",
"detect_indentation": true,
"draw_centered": true,
"draw_white_space": "all",
"folder_exclude_patterns":
[
"tmp/cache/assets/development",