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 findSubsequence (arr = [], subArr = []) { | |
| let prevIndex = 0; | |
| for(let i = 0; i < subArr.length; i++) { | |
| const item = subArr[i]; | |
| const index = arr.indexOf(item); | |
| if ( index >= 0) { | |
| if (prevIndex > index) return false; |
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
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| type ErrNegativeSqrt float64 | |
| func (e ErrNegativeSqrt) Error() string { | |
| return fmt.Sprint("Can't Sqrt negative number: ", float64(e)) |
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 generateURL = (data = {}) => { | |
| const domain = 'http://testurl.bitfinix.com'; | |
| let queryString = ''; | |
| for (const key in data) { | |
| if (data[key]) | |
| queryString += `${key}=${data[key]}&`; | |
| } | |
| return `${domain}/${queryString ? '?' + queryString.slice(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
| import React, {useEffect} from 'react'; | |
| import {connect} from 'react-redux'; | |
| // React Component | |
| const A = props => { | |
| useEffect(() => { | |
| // fetch data from a remote server | |
| props.fetchData() | |
| }, [props]); |
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
| .close__btn { | |
| position: absolute; | |
| right: -18px; | |
| top: -18px; | |
| border: 1px solid white; | |
| box-shadow: -6px 1em 3em 0px rgba(0, 0, 0, 0.1); | |
| border-radius: 25px 25px 25px 25px; | |
| width: 40px; | |
| text-align: center; | |
| background: white; |
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
| {str}.replace(/[\t\n\r]/gm,'') |
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
| # Install python, 3.xx recommended | |
| # Run the following commands: | |
| # pip install pyttsx3 | |
| # save below code in a file and name as whatever you want. | |
| # To run this code, type "python <your filename.py>" | |
| # the above command will prompt to write something, once you write, press Enter | |
| # and it will say the text you wrote. | |
| # import library into code | |
| # know about this library at: https://pyttsx.readthedocs.io/en/latest/ |
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 SHA256(s){ | |
| var chrsz = 8; | |
| var hexcase = 0; | |
| function safe_add (x, y) { | |
| var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
| var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
| return (msw << 16) | (lsw & 0xFFFF); | |
| } | |
| function S (X, n) { return ( X >>> n ) | (X << (32 - n)); } | |
| function R (X, n) { return ( X >>> n ); } |
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 wait (timeout) { | |
| return new Promise((resolve) => { | |
| setTimeout(() => { | |
| resolve() | |
| }, timeout) | |
| }) | |
| } | |
| async function requestWithRetry (url) { | |
| const MAX_RETRIES = 10 |
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 isEmpty (obj) { | |
| for (var key in obj) { | |
| if (obj.hasOwnProperty(key)) { return false } | |
| } | |
| return true | |
| } |