// jQuery
$(document).ready(function() {
// code
})
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SITE = SITE || {}; | |
SITE.fileInputs = function() { | |
var $this = $(this), | |
$val = $this.val(), | |
valArray = $val.split('\\'), | |
newVal = valArray[valArray.length-1], | |
$button = $this.siblings('.button'), | |
$fakeFile = $this.siblings('.file-holder'); | |
if(newVal !== '') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for app in $(heroku apps); do heroku apps:destroy --app $app --confirm $app; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name "*.html" | while read i; do mv "$i" "${i%.html}.php"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* normal flexbox */ | |
.flexbox .flex-container { | |
display: -webkit-flex; | |
display: -moz-flex; | |
display: -ms-flex; | |
display: flex; | |
} | |
.flexbox .flex-container.vertical { | |
display: -webkit-flex; | |
display: -moz-flex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
No jQuery necessary. | |
Thanks to Dan's StackOverflow answer for this: | |
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport | |
*/ | |
function isElementInViewport(el) { | |
var rect = el.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && |
Here are a few common tasks you might do in your templates, as they would be written in ExpressionEngine vs. Craft CMS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Determine if an element is in the visible viewport | |
function isInViewport(element) { | |
var rect = element.getBoundingClientRect(); | |
var html = document.documentElement; | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || html.clientHeight) && | |
rect.right <= (window.innerWidth || html.clientWidth) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
{# Base #} | |
{% includeCssFile 'layouts/base/css/base.css' %} | |
{% includeJsFile 'layouts/base/js/base.js' %} | |
{# Header #} | |
{% includeCssFile 'modules/header/css/header.css' %} | |
{% includeJsFile 'modules/header/js/header.js' %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if craft.request.isAjax %} | |
{% set layout = "_ajaxLayout" %} | |
{% else %} | |
{% set layout = "_layout" %} | |
{% endif %} | |
{% extends layout %} | |
{% set limit = 10 %} | |
{% set params = { section: 'news', limit: limit} %} |
OlderNewer