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
$base-font-size: 16px; | |
// Calculate rem value | |
@function calculateRem($size) { | |
$remSize: $size / $base-font-size; | |
@return $remSize * 1rem; | |
} | |
// Calculate Viewport-Width dependent value | |
@function calculateVW($size) { |
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
function assert (condition, message) { | |
if (!condition) { | |
message = message || "Assertion failed"; | |
if (typeof Error !== "undefined") { | |
throw new Error(message); | |
} | |
throw message; // Fallback | |
} | |
} |
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
Object.size = function ( obj ) { | |
var size = 0, key; | |
for (key in obj) { | |
if ( obj.hasOwnProperty(key) ) { size++; } | |
} | |
return size; | |
}; |
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
function $$(selector, context) { | |
context = context || document; | |
var elements = context.querySelectorAll(selector); | |
return Array.prototype.slice.call(elements); | |
} |
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
function unless(exp, func) { | |
if ( typeof func === 'function' && !exp ) { | |
func.apply(this, arguments); | |
} | |
return !exp; | |
} |
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
// Description: Get new width or height while preserving the aspect ratio | |
// TODO: Add AspectRatio related methods | |
var AspectRatio = { | |
getScaled: function ( currentW, currentH, newSize, property ) { | |
return ( property === 'width' )? ((currentH / currentW) * newSize) : (currentW / currentH) * newSize) | |
} | |
}; |
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
textInput.addEventListener('keydown', function (e) { | |
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || | |
(e.keyCode == 65 && e.ctrlKey === true) || // Allow: Ctrl+A | |
(e.keyCode == 67 && e.ctrlKey === true) || // Allow: Ctrl+C | |
(e.keyCode == 88 && e.ctrlKey === true) || // Allow: Ctrl+X | |
(e.keyCode >= 35 && e.keyCode <= 39)) // Allow: home, end, left, right | |
{ return; } | |
// Ensure that it is a number and stop the keypress | |
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { |
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
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
# set me | |
FILES=/Volumes/DATA/Drive/*/ | |
for f in $FILES | |
do | |
chflags nohidden "$f" | |
done | |
# restore $IFS | |
IFS=$SAVEIFS |
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
Object.prototype.data = function (prop, val) { | |
var _return, | |
notIE = ( this.dataset !== undefined ); | |
return ( notIE )? // not IE | |
( typeof val === "undefined" ) ? // get data value | |
this.dataset[prop] : this.dataset[prop] = val | |
: // is IE | |
( typeof val === "undefined" ) ? // get data value | |
this.getAttribute('data-' + prop) : this.setAttribute('data-' + prop, val); |
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
/** | |
* Add dataset support to elements | |
* No globals, no overriding prototype with non-standard methods, | |
* handles CamelCase properly, attempts to use standard | |
* Object.defineProperty() (and Function bind()) methods, | |
* falls back to native implementation when existing | |
* Inspired by http://code.eligrey.com/html5/dataset/ | |
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js ) | |
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (polyfills below) | |
* All code below is Licensed under the X11/MIT License |
OlderNewer