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
//Как оказалось IOS автоматом добавляет эту штуку на событие :focus, если у select или input свойство font-size меньше 16px. Лаконичное решение из мета-тега: | |
<meta name=”viewport” content=”width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> | |
/* | |
* no input shadow on iOs devices | |
*/ | |
input[type=text], | |
input[type=tel], | |
input[type=email], |
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
<Formik> | |
{(formik) => ( | |
<form onSubmit={formik.handleSubmit}> | |
<Formik> | |
{(subformik) => ( | |
<form > | |
<input name="username" onChange={subformik.handleChange} value={subformik.values.username} /> | |
{/** i also have access to formik here too */} | |
<button onClick={() => subformik.submitForm()}>Submit Inner</button> |
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 compare(a, b, increase = true) { | |
if (a < b) { | |
return increase ? -1 : 1; | |
} | |
if (a > b) { | |
return increase ? 1 : -1; | |
} | |
return 0; | |
} |
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
// add | |
<meta name="pinterest" content="nopin"> |
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 formatTimeDiff(dateTime) { | |
const date = new Date(dateTime); | |
const currentDate = new Date(); | |
let diff = (+currentDate - +date) / 1000; | |
const days = Math.floor(diff / (3600 * 24)); | |
diff -= days * 86400; | |
const hours = Math.floor(diff / 3600) % 24; | |
diff -= hours * 3600; |
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
// Wrap ProductList, ProductTable to get the higher order components | |
const ProductListWithData = withProductData(ProductList); | |
const ProductTableWithData = withProductData(ProductTable); | |
// Use the higher order components just like normal components. | |
<div> | |
<ProductListWithData /> | |
<ProductTableWithData /> |
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, { Component } from "react"; | |
class ProductData extends Component { | |
state = { | |
products: [] | |
}; | |
componentDidMount() { | |
getProducts().then(products => { | |
this.setState({ |
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
Examine CSS for an element that appears via JavaScript - Hit F8 (same as “Pause script execution” button) while the element is visible | |
Search for an element using CSS selectors - after cmd+F write selector instead of text | |
Edit the box model directly - just double click on “Computed” box model | |
Increment/decrement values in the Styles panel | |
Up/Down arrow keys increment/decrement by 1 | |
ALT+Up/Down arrow keys increment/decrement by 0.1 |
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
transform: translateZ(0); | |
// or | |
will-change: transform; // (или что там меняется, может быть opacity, например). |
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
Examine CSS for an element that appears via JavaScript - Hit F8 (same as “Pause script execution” button) while the element is visible | |
Search for an element using CSS selectors - after cmd+F write selector instead of text | |
Edit the box model directly - just double click on “Computed” box model | |
Increment/decrement values in the Styles panel | |
Up/Down arrow keys increment/decrement by 1 | |
ALT+Up/Down arrow keys increment/decrement by 0.1 |
NewerOlder