##Sass Functions Cheat Sheet
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
// credit: Louis Lazaris | |
window.addEventListener('contextmenu', function (e) { | |
console.log('context menu disabled'); | |
e.preventDefault(); | |
}, false); | |
document.addEventListener('mouseup', function (e) { | |
if (e.button === 2) { | |
console.log('right-click enabled'); | |
} |
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
<table> | |
<thead> | |
<tr> | |
<th>Payment</th> | |
<th>Issue Date</th> | |
<th>Amount</th> | |
<th>Period</th> | |
</tr> | |
</thead> | |
<tbody> |
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
/* | |
First: determine the number of columns, ex.: 12 | |
Second: determine the width of a single (1/12) column using the following formula: | |
scw = (100 – (m * (mc – 1))) / mc | |
Where: | |
scw = single column width | |
m = margin (1.6%) | |
mc = maximum columns (12) | |
Ex.: scw = 6.86666666667% | |
Lastly: use the scw to calculate the rest of the column widths using the following formula: |
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
/* based on dbox.us */ | |
body { | |
background: linear-gradient(238deg, #fd8800, #fd008f, #9700fd, #003dfd, #05c7e6, #4bd58d); | |
background-size: 1200% 1200%; | |
-webkit-animation: rainbow 30s ease infinite; | |
animation: rainbow 30s ease infinite; | |
} | |
@-webkit-keyframes rainbow { | |
0% { background-position: 0% 50% } | |
50% { background-position: 100% 50% } |
From currying to closures there are quite a number of special words used in JavaScript. These will not only help you increase your vocabulary but also better understand JavaScript. Special terms are normally found in documentation and technical articles. But some of them like closures are pretty standard things to know about. Knowing what the word itself means can help you know the concept it's named for better.
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
*, | |
*:before, | |
*:after { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 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
// returns first element selected - $('input[name="food"]') | |
var $ = document.querySelector.bind(document); | |
// return array of selected elements - $$('img.dog') | |
var $$ = document.querySelectorAll.bind(document); | |
// Credit: https://twitter.com/wesbos/status/608341616173182977 |
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
/* iPhone 6 landscape */ | |
@media only screen and (min-device-width: 375px) | |
and (max-device-width: 667px) | |
and (orientation: landscape) | |
and (-webkit-min-device-pixel-ratio: 2) | |
{ } | |
/* iPhone 6 portrait */ | |
@media only screen | |
and (min-device-width: 375px) |
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 css(element, property) { | |
return window.getComputedStyle(element, null).getPropertyValue(property); | |
} | |
window.onload = function () { | |
var span = document.createElement('span'); | |
span.className = 'fa'; | |
span.style.display = 'none'; | |
document.body.insertBefore(span, document.body.firstChild); |
NewerOlder