Displays characters remaining from a given total. Used with form inputs. Adds classes when active/above/below/equal the total character allowance.
Tests [y] Accessibility tested [n]
Popover.prototype.isOverlappingViewport = function($el) { | |
return this.getElementBoundaries($el).top < 0? true : false || | |
this.getElementBoundaries($el).bottom > $('body').height()? true : false || | |
this.getElementBoundaries($el).left < 0? true : false || | |
this.getElementBoundaries($el).right > $('body').width()? true : false; | |
}; |
def is_active?(path) | |
!!request.url.match(option[:path]) ? " is-active" : "" | |
end |
// ---- | |
// Sass (v3.4.9) | |
// Compass (v1.0.1) | |
// ---- | |
@mixin property($property, $multiple) { | |
@supports($property: 1rem){ | |
#{$property}: ($multiple / $base-font-size) * 1rem; | |
}; | |
#{$property}: $multiple * 1px; |
function getFunctionName (fn) { | |
return fn.toString().substr(0, fn.toString().indexOf('(')).replace('function ', ''); | |
} |
Displays characters remaining from a given total. Used with form inputs. Adds classes when active/above/below/equal the total character allowance.
Tests [y] Accessibility tested [n]
/** | |
* remove_from_array() | |
* Based on str param supplied, finds and removes matching item from array | |
* @param {Array} array Array to query | |
* @param {String} str String to look for | |
* @return {Bool} returns true after item is found and remove from array | |
*/ | |
function remove_from_array(array, str) { | |
var i; | |
for(i = 0; i < array.length; i++){ |
/** | |
* get_keys() | |
* @param {Array} data JSON array | |
* @param {String} label Value to return | |
* @return {Array} array of matched property | |
*/ | |
function get_keys(data, label) { | |
var key, values = []; | |
for(key in data){ | |
values.push(data[key][label]); |
<!DOCTYPE html> | |
<html lang="en-gb"> | |
<head> | |
<title>Animator</title> | |
<meta charset="utf-8" /> | |
<style> | |
.block{ | |
background: #ccc; | |
box-sizing: border-box; | |
height: 100px; |
function getComputedStyle(elem, property, pseudoelem){ | |
return window.getComputedStyle(elem, (pseudoelem || null)).getPropertyValue(property); | |
}; | |
getComputedStyle(myElem, "height").width; | |
getComputedStyle(myElem, "height", ":after").width; |
function substitute(s, o){ | |
return s.replace( /{([^{}]*)}/g , | |
function (a, b) { | |
var r = o[b]; | |
return typeof r === 'string' || typeof r === 'number' ? r : a; | |
} | |
); | |
} | |
substitute("My name is {name} and I work at {workplace}",{ | |
name: "Justin Perry", |