Skip to content

Instantly share code, notes, and snippets.

View OneMohrTime's full-sized avatar
🤘
Working the Front End

Derek OneMohrTime

🤘
Working the Front End
View GitHub Profile
@brianmaierjr
brianmaierjr / mixitup-filter.js
Last active November 19, 2023 00:54
Filter MixItUp on load from hash in URL
// Setup MixItUp for card filtering
var mixer = mixitup('.program-card-container');
if ($('.program-card-container')) {
var container = $('.program-card-container')
var mixer = mixitup(container, {
callbacks: {
onMixStart: function(state, futureState) {
},
onMixEnd: function() {
@argyleink
argyleink / easings.css
Created February 26, 2018 22:34
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
@shaneturner
shaneturner / craft-cms-entries-by-category-group.twig
Created December 4, 2017 00:26
Craft CMS: Getting entries grouped by category in order of the category type drag & drop order.
{# Get the categories related to my "entrySection" entries in structure order #}
{% set entries = craft.entries.section('entrySection') %}
{% set relatedCats = craft.categories.relatedTo(entries) %}
{# Loop the categories #}
{% for category in relatedCats %}
{{ category.title }}
{# Get and loop through entries related to this cat #}
@adamthebig
adamthebig / craft.request.twig
Created February 13, 2016 18:54
Craft request cheat sheet
{# Properties #}
{{ craft.request.firstSegment }}
{{ craft.request.isAjax }}
{{ craft.request.isLivePreview }}
{{ craft.request.isSecure }}
{{ craft.request.lastSegment }}
{{ craft.request.pageNum }}
{{ craft.request.path }}
{{ craft.request.segments }}
{{ craft.request.serverName }}
@jarednova
jarednova / functions.php
Last active November 24, 2018 21:00
example of easy shortcodes you can add in functions.php
<?php
add_shortcode( 'section-break', function($attributes = array(), $content = null) {
return '<div class="article-body-section-break"></div>';
} );
add_shortcode( 'email-tease', function($attributes = array(), $content = null) {
return Timber::compile('partials/newsletter.twig', array('context_class' => 'newsletter-signup--in-article', 'text' => $content));
} );
@budparr
budparr / bourbon-headers-scale
Created May 3, 2015 04:54
Automatically scale header font sizes in Bourbon/Bitters
@for $i from 1 through 6 {
h#{$i} {
font-size: modular-scale((6 - $i), 1em, 1.2);
}
}
// via https://github.com/thoughtbot/bitters/issues/153#issuecomment-85744338
$context = Timber::get_context();
$context['slides'] = Timber::get_posts('post_type=slides');
$context['pages'] = Timber::get_posts('post_type=page&posts_per_page=2');
$context['portfolio'] = Timber::get_posts('post_type=portfolio');
$context['posts'] = Timber::get_posts(); //leave blank for default page query
Timber::render('front-page.twig', $context);
@cferdinandi
cferdinandi / stop-video.js
Last active February 15, 2024 17:03
A simple method to stop YouTube, Vimeo, and HTML5 videos from playing.
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;
@joyrexus
joyrexus / README.md
Last active February 19, 2024 17:15 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@hyperking
hyperking / Barrel Mixitup Url Filter
Created September 24, 2013 22:31
Using Barrel's MixitUp jquery filter to automatically filter based on url hash
$('#grid').mixitup({
onMixLoad: function(){
var hash = window.location.hash;
var noHash=hash.replace("#","");
if(hash){
$('#grid').mixitup('filter', noHash);
}
}
});