Skip to content

Instantly share code, notes, and snippets.

View Chrisedmo's full-sized avatar

Chris Mousdale Chrisedmo

View GitHub Profile
@Chrisedmo
Chrisedmo / Gulpfile.js
Last active January 8, 2019 11:09 — forked from AugustMiller/Gulpfile.js
Craft + Gulp Setup
var gulp = require('gulp'),
gutil = require('gulp-util'),
coffee = require('gulp-coffee'),
coffeeify = require('gulp-coffeeify'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
test = require('gulp-if'),
del = require('del'),
rename = require('gulp-rename'),
@Chrisedmo
Chrisedmo / example.twig
Last active November 14, 2016 16:46
#CraftCMS: SRCset Macro
{# can define custom sizes, if required #}
{% set outputWidths = [580, 690, 768] %}
{% set aspectRatio = (3/5) %}
{{ srcset(entry.image, outputWidths, aspectRatio) }}
@Chrisedmo
Chrisedmo / responsive-bg-img.twig
Last active November 14, 2016 16:46
#CraftCMS Easy Responsive Background Images
{% set image = entry.image.first %}
<style type="text/css">
.hero-image {
background-image: url('{{ image.url({ width: 600 }) }}');
}
@media (min-width: 600px) {
.hero-image {
background-image: url('{{ image.url({ width: 1000 }) }}');
@Chrisedmo
Chrisedmo / eager-loading.twig
Created December 11, 2016 22:13
#CraftCMS: Eager-Load Nested Sets of Elements
{#
According to docs (https://craftcms.com/docs/templating/eager-loading-elements),
this is how you Eager-Load Nested Sets of Elements
#}
{% set entries = craft.entries({
section: 'news',
with: [
'entriesField.assetsField'
]
@Chrisedmo
Chrisedmo / Craft3ValetDriver.php
Created February 1, 2017 10:29
Craft 3 Composer Install Valet Driver
<?php
class Craft3ValetDriver extends ValetDriver
/* https://github.com/laravel/valet/blob/master/cli/drivers/CraftValetDriver.php */
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
@Chrisedmo
Chrisedmo / caskconfig.sh
Last active June 7, 2017 14:10
My Cask Config
#!/bin/sh
#
# Some cask packages that I like.
#
brew cask install sketch
brew cask install atom
brew cask install alfred
brew cask install slack
brew cask install paparazzi
brew cask install transmit
@Chrisedmo
Chrisedmo / osx_bootstrap.sh
Last active November 14, 2017 23:00 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Notes:
#
# - If installing full Xcode, it's better to install that first from the app
# store before running the bootstrap script. Otherwise, Homebrew can't access
@Chrisedmo
Chrisedmo / craftblockwrap.twig
Created November 16, 2017 21:24 — forked from croxton/craftblockwrap.twig
Craft CMS matrix blocks intelligent wrapping
{# _partials/blocks/blocks.html #}
{#
Blocks component
Outputs a matrix field blocks, intelligently wrapping blocks that need to be inset from the edges
@param {object} contentBlocks (MatrixBlockModel)
#}
{# Parameters #}
@Chrisedmo
Chrisedmo / styles.less
Created December 29, 2017 23:18 — forked from brandondurham/styles.less
Using Operator Mono in Atom
/**
* Using Operator Mono in Atom
*
* 1. Open up Atom Preferences.
* 2. Click the “Open Config Folder” button.
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up.
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden!
* 5. Tweak away.
*
* Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png):