Skip to content

Instantly share code, notes, and snippets.

View morewry's full-sized avatar
💭
⛈ 🌩 ☁️ 🌧 ☁️ ⛈ 🌧 🌩 ☁️

Rhy Moore morewry

💭
⛈ 🌩 ☁️ 🌧 ☁️ ⛈ 🌧 🌩 ☁️
View GitHub Profile
@morewry
morewry / respond-to.scss
Last active October 1, 2015 21:07
Sass mixin for nicknamed, comma-separated "or" media queries
/*
# Responsive Design Utilties
A few Sass functions and mixins helpful for responsive designs including a function to convert between CSS measurement units and a respond-to media query mixin that supports comma-separated "or" queries.
*/
// ---------------------------------------
// ---------------------------------------
/*
@morewry
morewry / sass-extend-or-include-wish
Created April 3, 2014 03:23
Something I wish I could do in Sass
// ---------------------------------------
/*
## Set / Get
http://cdpn.io/hgLal
*/
// ---------------------------------------
@morewry
morewry / _convert-units.scss
Created May 26, 2014 22:18
Sass convert length units
/*
# Convert Units (function)
TODO: Description
*/
// ---------------------------------------
@function convert-units ( $length, $as: rem, $root: 16, $ppi: 96 ) {
$unit: unit($length);
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
// Prototypal inheritance in Sass
// Disclaimer: might be totally contrived and useless...
// “It’s not about the destination, but the journey.”
// New operator
// A named buffer. Will append to existing content captured there.
// The buffer can be accessed via get-capture("foo") or @emit "foo".
@capture "foo" {
@media screen {
.asdf {
.qwerty {
/* This is a comment */
color: red;
}
}
@morewry
morewry / dispatch-touch-event.coffee
Created February 28, 2015 08:50
Programmatically trigger touch event
# http://codepen.io/morewry/pen/pvLxPV
# manually create touch event
touchStartOn = (el, x = 0, y = 0) ->
try
e = document.createEvent('TouchEvent')
e.initTouchEvent("touchstart", true, true)
catch err
try
e = document.createEvent('UIEvent')
@morewry
morewry / angularjs_directive_attribute_explanation.md
Created June 24, 2016 20:09 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@morewry
morewry / what-forces-layout.md
Created August 18, 2016 23:24 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@morewry
morewry / css_regression_testing.md
Created January 26, 2017 19:50 — forked from cvrebert/css_regression_testing.md
Survey of screenshot-based CSS testing tools

Currently considering https://github.com/webdriverio/webdrivercss


Core Goals:

  • Can test in up-to-date versions of all major browsers
  • Can test on up-to-date versions of all major OSes
  • Can test in IE9 (because Bootstrap v4 will support IE9+)
  • Don't want to have to setup/maintain our own cluster of VMs running all the necessary OSes (and all the versions of Windows)
  • Workflow for management of reference/baseline/norm screenshots
@morewry
morewry / check.sh
Created February 14, 2017 22:18 — forked from jusopi/check.sh
Set node version per project using .nvmrc file
#!/bin/sh
enter_directory(){
if [ "$PWD" != "$PREV_PWD" ]; then
PREV_PWD="$PWD";
if [ -e ".nvmrc" ]; then
nvm use;
fi
fi
}