Skip to content

Instantly share code, notes, and snippets.

View Chrisedmo's full-sized avatar

Chris Mousdale Chrisedmo

View GitHub Profile
@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 / 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 / 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 / extras.sh
Last active November 15, 2016 06:13
Extra Requirements for Larval Valet + Craft 2.6
brew install php70-mcrypt
brew install php70-imagick
brew install homebrew/versions/mysql56
Then run valet restart after each.
@Chrisedmo
Chrisedmo / crontab_helper
Created July 20, 2016 14:27 — forked from khalwat/crontab_helper
Never struggle with editing your crontab again; put this in the beginning of each of your crontabs
# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
@Chrisedmo
Chrisedmo / screen-size.js
Created March 10, 2016 11:47
Responsive Screen Size Checker
// Get visible window sizes
function displayWindowSize(){
var e=window.innerWidth,
t=window.innerHeight;
document.getElementById("dev").innerHTML=t+"x"+e;
}
// Create DIV
var div=document.createElement("div");
/*===================================================================================
* Add global options
* =================================================================================*/
/**
*
* The page content surrounding the settings fields. Usually you use this to instruct non-techy people what to do.
*
*/
function theme_settings_page(){
@Chrisedmo
Chrisedmo / sketch-localtunnel.txt
Last active November 1, 2015 22:41 — forked from almonk/gist:1f67aad473be5166b3c0
Handy localtunnel script (For Sketch Preview).
$ npm -g install localtunnel
/usr/local/bin/lt -> /usr/local/lib/node_modules/localtunnel/bin/client
localtunnel@1.7.0 /usr/local/lib/node_modules/localtunnel
├── debug@0.7.4
├── openurl@1.1.0
├── request@2.11.4
└── yargs@3.15.0 (camelcase@1.2.1, decamelize@1.1.0, window-size@0.1.2, cliui@2.1.0)
$ lt --port 8080
your url is: https://htkzpnysxf.localtunnel.me
@Chrisedmo
Chrisedmo / SassMeister-input-HTML.html
Created October 21, 2015 13:12
Generated by SassMeister.com.
<div class="">
<div class="flexible-column"><span></span></div>
<div class="flexible-column"><span></span></div>
<div class="flexible-column"><span></span></div>
<div class="flexible-column"><span></span></div>
<div class="flexible-column"><span></span></div>
<div class="flexible-column"><span></span></div>
<div class="flexible-column"><span></span></div>
</div>
@Chrisedmo
Chrisedmo / ot_revolution_slider
Created September 2, 2015 14:14
Revolution Slider - Option Tree
/**
* Revolution Slider option type.
*
* See @ot_display_by_type to see the full list of available arguments.
*
* @param array An array of arguments.
* @return string
*
* @access public
* @since 2.0