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
// Welcome to Code in Framer | |
// Get Started: https://www.framer.com/developers | |
import { useEffect, useState } from "react" | |
import { addPropertyControls, ControlType } from "framer" | |
import { motion } from "framer-motion" | |
const isSafari = () => { | |
const ua = navigator.userAgent.toLowerCase() | |
return ua.includes("safari") && !ua.includes("chrome") | |
} |
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
import { useEffect, useState } from "react" | |
import { addPropertyControls, ControlType } from "framer" | |
import { motion } from "framer-motion" | |
/** | |
* These annotations control how your component sizes | |
* Learn more: https://www.framer.com/developers/#code-components-auto-sizing | |
* | |
* @framerSupportedLayoutWidth auto | |
* @framerSupportedLayoutHeight auto |
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
const PIXEL_RATIO = (() => { | |
const ctx = document.createElement('canvas').getContext('2d') | |
if (ctx) { | |
const dpr = window.devicePixelRatio || 1 | |
const bsr = | |
ctx.webkitBackingStorePixelRatio || | |
ctx.mozBackingStorePixelRatio || | |
ctx.msBackingStorePixelRatio || | |
ctx.oBackingStorePixelRatio || |
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
import bigInt, { BigInteger } from "big-integer"; | |
const c = [ | |
"0", | |
"20888961410941983456478427210666206549300505294776164667214940546594746570981", | |
"15265126113435022738560151911929040668591755459209400716467504685752745317193", | |
"8334177627492981984476504167502758309043212251641796197711684499645635709656", | |
"1374324219480165500871639364801692115397519265181803854177629327624133579404", | |
"11442588683664344394633565859260176446561886575962616332903193988751292992472", | |
"2558901189096558760448896669327086721003508630712968559048179091037845349145", |
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
export const replace = (array, index, value) => { | |
return [...array.slice(0, index), value, ...array.slice(index + 1)] | |
} | |
/** | |
* Finds and replaces an item inside an array | |
* @param {Array} array | |
* @param {Function} findPredicate Callback for Array.prototype.find | |
* @param {*|Function} replaceCallbackOrItem Any value: replaced value. Function: recieves old value as argument and should return a new value. | |
* |
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
import { useState, useEffect } from 'react' | |
const removeKeyFromState = (key, setState) => { | |
setState(({ [key]: deletedKey, ...restKeys }) => ({ ...restKeys })) | |
} | |
const useTimeout = () => { | |
const [timeouts, setTimeouts] = useState({}) | |
useEffect(() => { |
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
// Чуть-чуть поменял код отсюда: https://javascript.ru/forum/misc/27347-nadezhnyjj-dvukhstoronnijj-translit.html#post168115 | |
var transliterate = ( | |
function() { | |
var rus = "щ ш ч ц ю я ё ж з ъ ы э а б в г д е з и й к л м н о п р с т у ф х ь".split(/ +/g); | |
var eng = "shh sh ch cz yu ya yo zh th `` y' e` a b v g d e z i j k l m n o p r s t u f h `".split(/ +/g); | |
return function(text, engToRus) { | |
for (var x = 0; x < rus.length; x++) { | |
text = text.split(engToRus ? eng[x] : rus[x]).join(engToRus ? rus[x] : eng[x]); | |
text = text.split(engToRus ? eng[x].toUpperCase() : rus[x].toUpperCase()).join(engToRus ? rus[x].toUpperCase() : eng[x].toUpperCase()); |
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
import React, { Component } from "react"; | |
class Article extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
isOpen: props.defaultOpen, | |
idAd: props.idAd | |
} |
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
// in some react class component | |
handleChangeInput = (e) => { | |
this.setState({ [e.target.name]: e.target.value }) | |
} |
NewerOlder