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
type LinkedNode = { | |
value: number, | |
next: LinkedNode | null | |
} | |
class LinkedList { | |
head: LinkedNode; | |
tail: LinkedNode; | |
length: number; |
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 default class RedisDatabase { | |
redis: any; | |
constructor() { | |
this.redis = require('redis'); | |
} | |
connectDB() { | |
const client = this.redis.createClient({ | |
host: '127.0.0.1', |
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 { Request } from 'express'; | |
export const getClientIp = function (req: Request) { | |
const ipInfo: any = req.socket.address(); | |
let ipAddress = ipInfo.address; | |
if (!ipAddress) { | |
return ''; | |
} | |
// convert from "::ffff:192.0.0.1" to "192.0.0.1" | |
if (ipAddress.substr(0, 7) == "::ffff:") { |
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 { Request, Response, NextFunction } from 'express'; | |
import { getClientIp } from '../utils/getIpAddress'; | |
import RedisDatabase from '../db/redisConnection'; | |
export default (req: Request, res: Response, next: NextFunction) => { | |
const redis_client = new RedisDatabase().connectDB(); | |
const ipAddress = getClientIp(req); | |
redis_client | |
.multi() |
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 express, { Application, Request, Response, NextFunction } from 'express'; | |
import rateLimiter from './middleware/rateLimiter'; | |
import bodyParser from 'body-parser'; | |
const app: Application = express(); | |
app.use(bodyParser.json()); | |
app.get('/', rateLimiter, (req: Request, res: Response) => { | |
res.send('test'); |
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
interface Draggable { | |
dragStartHandler(event: DragEvent): void; | |
dragEndHandler(event: DragEvent): void; | |
} | |
interface DragTarget { | |
dragOverHandler(event: DragEvent): void; | |
dropHandler(event: DragEvent): void; | |
dragLeaveHandler(event: DragEvent): void; | |
} |
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 LoadingPlaceHolder from './LoadingPlaceHolder'; | |
export default LoadingPlaceHolder; |
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 styled from 'styled-components'; | |
export const S = { | |
PlaceHolderContainer: styled.div` | |
width: 100%; | |
min-height: 120px; | |
padding: 5px 10px; | |
display: flex; | |
flex-direction: column; | |
align-items: flex-start; |
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 axios from 'axios'; | |
import { DCARD_POPULAR_POSTS_BASE_URL, API_POST_LIMIT } from '../constant/api'; | |
export interface FetchPostHook { | |
loading: boolean; | |
error: boolean; | |
posts: any[]; | |
hasMore: boolean; |
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 size = { | |
mobileS: '320px', | |
mobileM: '375px', | |
mobileL: '425px', | |
mobileXL: '450px', | |
tablet: '768px', | |
} | |
export const device = { | |
mobileS: `(max-width: ${size.mobileS})`, |
OlderNewer