This file contains hidden or 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
window.addEventListener("deviceorientation", function (e) { | |
var all = document.querySelectorAll('*'); | |
for(var i = 0;i < all.length;i++) { | |
all[i].style.transform = 'rotateX('+e.alpha+'deg) rotateY('+e.gamma+'deg) rotateX('+e.beta+'deg)'; | |
} | |
}, true); |
This file contains hidden or 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
var Vehicle = { | |
describe: function () { | |
return `This ${this.type} is the ${this.make} ${this.model}.`; | |
} | |
} | |
var Car = Object.create(Vehicle, { | |
type: {value: 'Car', writable: true} | |
}); |
This file contains hidden or 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
/** | |
* Handlebars KeystoneJS Debug helper | |
* @param optionalValue | |
*/ | |
_helpers.debug = function(optionalValue) { | |
console.log("Current Context"); | |
console.log("===================="); | |
console.log(this); | |
if (optionalValue) { |
This file contains hidden or 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
{ | |
"Print to console": { | |
"prefix": "l", | |
"body": [ | |
"console.log('$1');", | |
"$2" | |
], | |
"description": "Log output to console" | |
}, | |
"Simple function":{ |
This file contains hidden or 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
// font-size needs to be PX | |
// Line height needs to be em. | |
@mixin multilineTextWithEllipsis ($font-size, $line-height, $lines-to-show) { | |
display: block; /* Fallback for non-webkit */ | |
display: -webkit-box; | |
max-width: 400px; | |
height: $font-size*$line-height*$lines-to-show; /* Fallback for non-webkit */ | |
margin: 0 auto; | |
font-size: $font-size; | |
line-height: $line-height; |
This file contains hidden or 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
_.chain(123) | |
.thru(function(num) { | |
return _.every([ // or _.some for any item | |
_.isNumber(num), | |
_.anotherCheck(num), | |
_.anotherCheck(num) | |
]); | |
}) | |
.value(); |
This file contains hidden or 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
/** | |
* Lodash JSON Parse with error handling. | |
* The _.attempt prevents JSON.parse from throwing an application error. Instead, it return an Error object. | |
* @requires _ | |
* @param str | |
* @returns {*} | |
*/ | |
function lodashJSONParse (str) { | |
return _.attempt(JSON.parse.bind(null, str)); | |
} |
This file contains hidden or 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
.whatever{ | |
&::-webkit-scrollbar { | |
width: 10px; | |
} | |
/* Track */ | |
&::-webkit-scrollbar-track, | |
&::-webkit-scrollbar-track { | |
box-shadow: inset 0 0 6px rgba(0,0,0,0); | |
border-radius: 10px; | |
} |
This file contains hidden or 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
/** | |
* Parse an ISO string with or without an offset | |
* e.g. '2014-04-02T20:00:00-0600' | |
* '2014-04-02T20:00:00Z' | |
* '2014-02' | |
* | |
* Allows decimal seconds if supplied | |
* e.g. '2014-04-02T20:00:00.123-0600' | |
* | |
* If no offset is supplied (or it's Z), treat as UTC (per ECMA-262) |
This file contains hidden or 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
// JSON Chart Data Maker | |
var points = []; | |
var days = 31; | |
var months = 12; | |
for (var x = 1; x < months; x++) { | |
for (var i = 1; i < days; i++) { | |
var day = i < 10 ? "0" + i : i; |