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
| export function isDocumentElement(el: Element) { | |
| return [document.documentElement, document.body, window].indexOf(el) > -1; | |
| } | |
| // Normalized Scroll Top | |
| // ------------------------------ | |
| export function normalizedHeight(el: Element): number { | |
| if (isDocumentElement(el)) { | |
| return window.innerHeight; |
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
| // @flow | |
| type Config = { | |
| ignoreCase?: boolean, | |
| ignoreAccents?: boolean, | |
| stringify?: Object => string, | |
| trim?: boolean, | |
| matchFrom?: 'any' | 'start', | |
| }; |
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 React from "react"; | |
| import "./styles.css"; | |
| function EditUser({ user }) { | |
| function saveUser(ev) { | |
| ev.preventDefault(); | |
| const elementsArray = [...ev.target.elements]; | |
| const formData = elementsArray.reduce((acc, elem) => { | |
| if (elem.id) { |
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
| function handleFile(e) { | |
| var files = e.target.files, f = files[0]; | |
| var reader = new FileReader(); | |
| reader.onload = function(e) { | |
| var data = new Uint8Array(e.target.result); | |
| var workbook = XLSX.read(data, {type: 'array'}); | |
| var json = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]], { raw: true }); | |
| console.log(JSON.stringify(json)); | |
| }; | |
| reader.readAsArrayBuffer(f); |
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(https://fonts.googleapis.com/css?family=Open+Sans:400italic); | |
| blockquote{ | |
| font-size: 1.4em; | |
| width:60%; | |
| margin:50px auto; | |
| font-family:Open Sans; | |
| font-style:italic; | |
| color: #555555; | |
| padding:1.2em 30px 1.2em 75px; | |
| border-left:8px solid #78C0A8 ; |
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
| <body> | |
| <a href="#content">Skip to main content</a> | |
| <header> | |
| … | |
| </header> | |
| <main id="content"> <!-- The skip link jumps to here --> |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>My test page</title> | |
| </head> | |
| <body> | |
| <img src="images/your-image-filename" alt="My test image"> | |
| </body> | |
| </html> |
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
| function promisify(fn) { | |
| return function(...args) { | |
| return new Promise(function (resolve, reject) { | |
| function cb(result) { | |
| resolve(result); | |
| } | |
| fn.apply(this, args.concat(cb)); | |
| }); | |
| } |
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
| const sleep = time => new Promise((resolve) => { | |
| setTimeout(()=>{ | |
| resolve(); | |
| }, time); | |
| }); |
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
| function moveElement(duration, distance, element) { | |
| const start = performance.now(); | |
| function move(currentTime) { | |
| const elapsedTime = currentTime - start; | |
| const progress = elapsedTime / duration; | |
| const amountToMove = progress * distance; | |
| element.style.transform = `translateX(${amountToMove}px)`; |
NewerOlder