Skip to content

Instantly share code, notes, and snippets.

@tmlangley
tmlangley / resize.js
Created February 11, 2016 15:51
Do something on resize and load.
$(function() {
$(window).resize(function() {
// Do stuff...
}).trigger('resize');
});
@tmlangley
tmlangley / z-index.scss
Created March 18, 2016 17:48
Contextual z-index
// z-index organization
//
// References:
// - https://css-tricks.com/handling-z-index/
// - http://www.sitepoint.com/using-sass-maps/
// _config.scss
$z-layers: (
bottomless-pit: -9999,
@tmlangley
tmlangley / tabs.scss
Created March 22, 2016 17:52
Drupal Admin Tabs Styling
//
// _config.scss
//
$tabs-config: (
wrap: (
background: #fafafa,
border: #efefef
),
link: (
color: #251923,
@tmlangley
tmlangley / _buttons.scss
Created August 18, 2016 15:54
Config based button SASS styles
$buttons: (
default: ()
) !defualt;
// Button mixin
@mixin btn($button-key, $size: small) {
$button: extend-in-map($buttons, $button-key);
display: inline-block;
line-height: 1;
@tmlangley
tmlangley / _buttons.scss
Created September 2, 2016 17:07
Advanced config based SASS buttons
$buttons: () !default;
// Extract the common styles into a placeholder
%btn-base {
display: inline-block;
line-height: 1;
font-weight: 700;
overflow: hidden;
position: relative;
vertical-align: middle;
transition: 50ms transform;
@tmlangley
tmlangley / _nav-boilerplate.scss
Created September 21, 2016 19:58
Dropdown navigation boilerplate
nav {
// wrapper styles...
// All tier menus (ul selector)
.menu {}
// All list items
li {}
// All links
@tmlangley
tmlangley / themekit.php
Last active October 5, 2016 23:20
Get inline style for entity field
<?php
function themekit_preprocess_paragraph(&$variables) {
$paragraph = $variables['paragraph'];
$bundle = $variables['paragraph']->bundle();
switch ($bundle) {
case 'simple_small_cta':
$variables['image_inline_style'] = themekit_get_entity_image_inline_style($paragraph, 'field_image', 'small_cta');
break;
case 'simple_large_cta':
@tmlangley
tmlangley / .htaccess
Created June 2, 2017 15:24
Redirect "/index.php" to "/"
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^index.php(.*)$ /$1 [R=301,L]
@tmlangley
tmlangley / buttercal-usage.md
Created June 11, 2017 20:20
ButterCal usage ideas

link custom UI

myCal = new ButterCal({
	defaultUI: false
});

myCal.linkUI({
	nextMonth: document.querySelector('.next-month'),
	prevMonth: document.querySelector('.prev-month'),
@tmlangley
tmlangley / machine.js
Created March 19, 2020 16:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions