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
| // Eliminate FOIT (Flash of Invisible Text) caused by web fonts loading slowly | |
| // Using font events with Font Face Observer | |
| var roboto = new FontFaceObserver('Roboto', { | |
| weight: 400 | |
| }); | |
| observer.check().then(function () { | |
| document.getElement.className += 'fonts-loaded'; | |
| }); | |
| // Load multiple fonts using a Promise |
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
| @import url(http://fonts.googleapis.com/css?family=Open+Sans); | |
| html { | |
| background: #444; | |
| box-sizing: border-box; | |
| font-family: "Open Sans", sans-serif; | |
| line-height: 1.4; | |
| } | |
| *, *:before, *:after { | |
| box-sizing: inherit; | |
| } |
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
| // Using the unique-id() function with a simple mixin you only have to provide keyframe values, not names | |
| @mixin animation-keyframes { | |
| $animation-name: unique-id(); | |
| animation-name: $animation-name; | |
| @keyframes #{$animation-name} { | |
| @content; | |
| } | |
| } | |
| .some-element { | |
| animation: 10s linear infinite; |
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
| /* | |
| 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 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
| <table> | |
| <thead> | |
| <tr> | |
| <th>Payment</th> | |
| <th>Issue Date</th> | |
| <th>Amount</th> | |
| <th>Period</th> | |
| </tr> | |
| </thead> | |
| <tbody> |
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
| // Return zero if the number isn't prime | |
| function isPrime(value) { | |
| for (var i = 2; i < value; i++) { | |
| if (value % i === 0) { | |
| return false; | |
| } | |
| } | |
| return 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
| // When using appendChild() or insertBefore() on an element that's already been added to the document, the element will be removed from its place and put into the new place | |
| var b1 = document.querySelector('.box1'), | |
| b2 = document.querySelector('.box2'), | |
| el = document.createElement('div'), | |
| t; | |
| b1.appendChild(el); | |
| t = window.setTimeout(function () { | |
| b2.appendChild(el); | |
| clearTimeout(t); |
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
| // edit these | |
| $farColor: #ffe4c7; | |
| $nearColor: #2f4645; | |
| $layer: 7; // make sure it is +1 the number of layered divs in the HTML | |
| $perspective: 1; | |
| .bg { | |
| background-color: $farColor; | |
| height: 100%; | |
| position: absolute; |
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
| @import url(http://fonts.googleapis.com/css?family=Roboto:400,500,600,700); | |
| $pink: #e91e63; | |
| $paper: #efefef; | |
| $clouds: #ecf0f1; | |
| $cubic: cubic-bezier(.64,.09,.08,1); | |
| html, body { | |
| background: $clouds; | |
| height: 100%; |
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 myScript = document.createElement('script'); | |
| myScript.src = 'http://code.jquery.com/jquery-2.1.4.min.js'; | |
| myScript.onload = function() { | |
| console.log('jQuery loaded.'); | |
| }; | |
| document.body.appendChild(myScript); |