-
Install Ruby 2, x64
inside a directory without spaces -
Install a matching Ruby DevKit, instructions here
inside a directory without spaces -
Install extra dependencies:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Map a value in a domain to a value in a range | |
*/ | |
function scale(domainMin, domainMax, value, rangeMin, rangeMax) { | |
var perc = (value - domainMin) / (domainMax - domainMin) | |
return ((rangeMax - rangeMin) * perc) + rangeMin | |
} | |
scale(50, 100, 75, 100, 200) //=> 150 | |
scale(10, 110, 50, 200, 300) //=> 240 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin before-after { | |
@if $old-ie { | |
&:before, &:after { | |
@content; | |
} | |
} @else { | |
&::before, &::after { | |
@content; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Sass rem function and mixin | |
// https://gist.github.com/branneman/6762906 | |
// Based on and improved upon https://github.com/bitmanic/rem | |
// | |
// Baseline, measured in pixels | |
// The value should be the same as the font-size value for the html element | |
// If the html element's font-size is set to 62.5% (of the browser's default font-size of 16px), | |
// then the variable below would be 10px. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Articles controller | |
// Optional module description line. | |
// | |
'use strict'; | |
var fs = require('fs'); | |
var path = require('path'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Original class | |
*/ | |
class Todo { | |
constructor(name) { | |
this.name = name || 'Untitled'; | |
this.done = false; | |
} | |
do() { | |
this.done = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Mixin to provide short-hand positioning syntax | |
// https://gist.github.com/branneman/9248961 | |
// | |
// Usage: | |
// @include position(0 false 0 20rem); | |
// @include position(absolute, 0 false 0 20rem); | |
// | |
@mixin position ($position: relative, $coordinates: 0 0 0 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {HTMLElement} element - The element's coordinates to calulate | |
* @param {HTMLElement} relativeElement - An optional relative element, defaults to `document.body` | |
* @returns {{ offsetY: Number, offsetX: Number }} | |
*/ | |
const getElementCoordinates = function(element, relativeElement = document.body) { | |
const relativeRect = relativeElement.getBoundingClientRect(); | |
const elementRect = element.getBoundingClientRect(); | |
const offsetY = elementRect.top - relativeRect.top; | |
const offsetX = elementRect.left - relativeRect.left; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* getFormElementValue() | |
* Returns the value of a form element, given it's name and type | |
* | |
* @param {String} name - An element's `name=""` attribute | |
* @param {String} type - An element type string, e.g. 'text', 'radio', 'select' | |
* @returns {String|Boolean} | |
*/ | |
const getFormElementValue = (function(){ | |
const getElement = name => document.querySelector('[name="' + name + '"]'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function() { | |
var cssomPrefixes = 'Moz O ms Webkit'.split(' '); | |
var modElem = { | |
elem: document.createElement('modernizr') | |
}; | |
var mStyle = { | |
style: modElem.elem.style | |
}; |