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
function SlowLogger({ value = [] }) { | |
const cb = useCallback(() => { | |
console.log(value) | |
}, [value]) | |
return ( | |
<div onClick={cb}> | |
Log the array to the console! | |
</div> | |
) |
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
function MyHeavyComponent() { | |
const [counter, setCounter] = useState(0); | |
return ( | |
<button onClick={() => setCounter(counter + 1)}>Hit me</button> | |
) | |
} |
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
set -e | |
cat github-pat | docker login ghcr.io -u masious --password-stdin | |
docker pull ghcr.io/masious/my-front | |
docker-compose down front | |
docker-compose up front -d | |
docker ps |
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
version: '3.3' | |
services: | |
front: | |
image: ghcr.io/masious/my-front | |
volumes: | |
- ./static:/usr/share/nginx/html/static | |
ports: | |
- 5173:80 |
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
name: Docker Image CI | |
on: | |
push: | |
branches: [ "master" ] | |
jobs: | |
build: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- |
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
FROM node:16-alpine as build | |
WORKDIR /app | |
COPY package.json yarn.lock /app/ | |
RUN yarn | |
COPY src /app/src | |
COPY public /app/public | |
COPY index.html vite.config.js .env /app/ | |
RUN yarn build | |
FROM nginx:stable-alpine | |
COPY nginx.conf /etc/nginx/conf.d/default.conf |
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 function flatten (arr) { | |
return arr.reduce((result, current) => { | |
let items; | |
if (Array.isArray(current)) { | |
items = flatten(current); | |
} else if (typeof current === "number") { | |
items = [current]; | |
} else { | |
throw new Error(`Expected item to be number or array: ${current}`); | |
} |
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 { posts } from './posts'; | |
export const PostService = () => Promise.resolve(posts); |
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 posts = [ | |
{ | |
"id": 1, | |
"title": "نهمین جشنواره رسانههای دیجیتال", | |
"author": "ساسان", | |
"date": "۲۸ دی ۹۵", | |
"visits": 253, | |
"body": "نهمین جشنواره رسانههای دیجیتال در پنج بخش اصلی برگزار میشود. شما توسعهدهندگان گرامی میتوانید تا پایان دیماه برنامههای خود را در بخش «نرم افزارهای تلفن همراه و رسانه های هوشمند» این جشنواره ثبت کنید. برای کسب اطلاعات بیشتر میتوانید به این <a href='http://fair.saramad.ir/fa/home' target='_blank'>لینک </a> مراجعه کنید." | |
}, | |
{ |
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 posts = [ | |
{ | |
"id": 1, | |
"title": "نهمین جشنواره رسانههای دیجیتال", | |
"author": "ساسان", | |
"date": "۲۸ دی ۹۵", | |
"visits": 253, | |
"body": "نهمین جشنواره رسانههای دیجیتال در پنج بخش اصلی برگزار میشود. شما توسعهدهندگان گرامی میتوانید تا پایان دیماه برنامههای خود را در بخش «نرم افزارهای تلفن همراه و رسانه های هوشمند» این جشنواره ثبت کنید. برای کسب اطلاعات بیشتر میتوانید به این <a href='http://fair.saramad.ir/fa/home' target='_blank'>لینک </a> مراجعه کنید." | |
}, | |
{ |
NewerOlder