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 { call, all, takeLatest, put, fork } from 'redux-saga/effects'; | |
import { push } from 'react-router-redux'; | |
// api | |
import * as AuthApi from 'api/auth'; | |
// helper | |
import { getToken, clearToken } from 'utils/token'; | |
// actions |
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 debounce = <F extends (...args: any[]) => any>( | |
func: F, | |
waitFor: number, | |
) => { | |
let timeout: NodeJS.Timeout; | |
return (...args: Parameters<F>): Promise<ReturnType<F>> => | |
new Promise((resolve) => { | |
if (timeout) { | |
clearTimeout(timeout); |
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
'use strict'; | |
var bcrypt = require('bcrypt-nodejs'); | |
const { | |
Model | |
} = require('sequelize'); | |
module.exports = (sequelize, DataTypes) => { | |
class User extends Model { |
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, { useState } from "react"; | |
import { useDebounce } from "use-debounce"; | |
export default function Input() { | |
const [text, setText] = useState("Hello"); | |
const [value] = useDebounce(text, 1000); | |
return ( | |
<div> | |
<input |
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 reverse = (data) => { | |
if ( !data || !data.length) { | |
return false | |
} | |
const length = data.length | |
const reversed = data.split("").reverse().join(""); | |
for ( let index = 0; index < length / 2; index ++ ) | |
{ |
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
// get web3 | |
let web3 = await initAccount() | |
// get contract instance | |
let main = new web3.eth.Contract( | |
JSON_ABI, | |
CONTRACT_ADDRESS, | |
) | |
// usdc contract instance |
const book = {
title:"My Favorite JS Functions",
author:{
firstName:"John",
lastName:"Doe"
}
}
// (1)
Digital root is the recursive sum of all the digits in a number.
Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. The input will be a non-negative integer.
16 --> 1 + 6 = 7
942 --> 9 + 4 + 2 = 15 --> 1 + 5 = 6
132189 --> 1 + 3 + 2 + 1 + 8 + 9 = 24 --> 2 + 4 = 6
OlderNewer