Skip to content

Instantly share code, notes, and snippets.

@tmlangley
tmlangley / SassMeister-input.scss
Created September 29, 2014 15:51
Generated by SassMeister.com.
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
$myVar: 3;
// I essentially want $myVar-1 to evaluate to 2n
&:nth-child((#{$myVar}-1)n) {
// do stuff...
@tmlangley
tmlangley / simpleCollapse.css
Created December 17, 2014 03:30
Simple CSS Collapse Technique
.simpleCollapse {
max-height: 0;
overflow: hidden;
-webkit-transform: scaleY(0) translate3d(0,0,0);
-ms-transform: scaleY(0) translate3d(0,0,0);
-o-transform: scaleY(0) translate3d(0,0,0);
transform: scaleY(0) translate3d(0,0,0);
-webkit-transform-origin: top left;
@tmlangley
tmlangley / ckeditor-image-fix
Created January 28, 2015 16:07
ckeditor inline image styles fix
/**
* Fix for ckeditor adding inline styles on images.
* TODO: Remove this once there is a patch for this issue. - TL 1/28/15
* Drupal issue: https://www.drupal.org/node/1909648
*/
.node > .content img[style*="height"],
.node > .content img[style*="width"] {
max-width: 100%;
width: auto !important;
height: auto !important;
@tmlangley
tmlangley / gist:91c11afcaba519f21f0a
Last active August 29, 2015 14:15
Responsive sprites
// In _base.scss
//
// Sprites
$icons: sprite-map("icons/standard/*.png");
$icons-2x: sprite-map("icons/retina/*.png");
// _mixins.scss
// Store SVG strings as a map.
$icons-svg: (
'email': '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="13" height="10" viewBox="0 0 13 10"><desc>Created with Avocode</desc><image class="test-svg" width="13" height="10" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAKCAYAAABv7tTEAAAA/0lEQVQoU4XRsWoCQRCAYVcLwUBErGIjKUJAUvoAPoCmsBDRUrQ8QiotLYIgaGMhgiAWthZiI1iFoLWNYikE0wUUBEVh/QfuYDkEDz5mdndmb/dOeVyP1jrMVAl5jNFWSm3MMuUMKI6SWyggaBRdyPto0ryUeUVxiDhEwv3WG+MFcxlpepEEFTzcaayz3pOmFUkZc+TQgNfV/MW4g1dUpUnbBd/ED/hRxBP26GKLGt6dO+1IHo2dLS7cYq+YXJyYYm1krO/lTQcmAvi3jxYhJiFf8w8TrCG/4Rkn53hTBjO8IW3s6qSy/oO4bChNn/bxskS56BFno9Fnn0TuNcDvFfr6UFvPNR40AAAAAElFTkSuQmCC"/></svg>',
'facebook': '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="7" height="14" viewBox="0 0 7 14"><desc>Created with Avocode</desc><image width="7" height="14" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAOCAYAAADjXQYbAAAAd0lEQVQYV2NkgIL
@tmlangley
tmlangley / delay_loop
Created April 8, 2015 16:54
loop delay with recursion
/**
* From Daniel Vassallo:
* http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop/3583740#3583740
*/
(function loop(i) {
setInterval(function() {
// do stuff...
if (--i) loop(i);
@tmlangley
tmlangley / gist:8c7fa1f8a73b3e675378
Last active August 29, 2015 14:23
Drush cache clear
# Clear specific drupal cache table with drush
# $1 - Cache table or "theme" for css-js.
# $2 - Environment drush alias. Ex: @mysite.dev
_drcc() {
# alias "css-js" to "theme" because I can never remember which comes first.
if [ "$1" == "theme" ] ; then
table="css-js"
else
table=$1
fi
@tmlangley
tmlangley / _icons.scss
Last active August 29, 2015 14:27
Example font icon usage
//*****************************
// Font Icons
//*****************************
@font-face {
font-family: 'fontello';
src: url('../icons/fontello.eot?48442214');
src: url('../icons/fontello.eot?48442214#iefix') format('embedded-opentype'),
url('../icons/fontello.woff?48442214') format('woff'),
url('../icons/fontello.ttf?48442214') format('truetype'),
@tmlangley
tmlangley / variables.scss
Created August 28, 2015 21:04
SASS variable selectors
$hover: '&:hover, &:active, &:focus';
$headings: 'h1, h2, h3, h4, h5, h6';
$headers: $headings;
//
// Usage
//
#{$headings} {
color: #222;
@tmlangley
tmlangley / sql-slurp.sh
Created November 6, 2015 16:20
sql-slurp
_sql-slurp () {
printf "This will overwrite the $2 database with the $1 database.\n"
printf "\n\t\t*** $1 -> $2 ***\n\n"
sleep 3s
read -p "Are you sure [Y/n]? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
drush $2 sql-drop -y
printf "\n"
drush $1 sql-dump | pv -br | drush $2 sql-cli -A
fi