Skip to content

Instantly share code, notes, and snippets.

View valakhosravi's full-sized avatar
🤓
Work hard

Vala Khosravi valakhosravi

🤓
Work hard
  • Iran
View GitHub Profile
import React, { useEffect, useState } from "react";
export default function TimerButton({
duration,
action,
}: {
duration: number;
action: () => void;
}) {
const [counter, setCounter] = useState(duration);
import React, { useEffect, useRef } from "react";
export default function InputCode({ length }: { length: number }) {
const inputRefs = Array.from({ length }, () =>
useRef<HTMLInputElement>(null)
);
useEffect(() => {
const handleKeyPress = (index: number, event: KeyboardEvent) => {
setTimeout(() => {
1. Grid System:
- Replace `.container` with `.container` in Tailwind.
- Replace `.row` with `.flex` in Tailwind.
- Replace `.col-*-*` with `.w-*` in Tailwind, where the asterisks represent the appropriate width classes.
- Update any additional grid-related classes to their respective Tailwind equivalents.
2. Typography:
- Replace heading classes like `.h1`, `.h2`, etc., with `.text-<size>` in Tailwind.
- Replace paragraph classes like `.lead` with `.text-lg` in Tailwind.
- Update text alignment classes, such as `.text-left`, `.text-right`, etc., to their Tailwind equivalents.
To deploy a Next.js project to a Windows Server running IIS using Docker, you can follow these steps:
Build a Docker image for your Next.js application using a Dockerfile. Here's an example Dockerfile:
bash
# Use the official Node.js runtime as a parent image
FROM node:14
# Set the working directory to /app
WORKDIR /app
Deploying a Next.js project to a Windows Server running IIS involves several steps. Here are the high-level steps you can follow:
Build your Next.js project using the following command:
npm run build
This will create a production build of your project in the ./out directory.
Create a new website in IIS and configure it to use the ./out directory as the physical path.
Set up the Node.js IIS HTTP Module on your server if it's not already installed. You can download and install it from the official Microsoft website.
.sk-loading {
background: linear-gradient( 90deg, #f4f4f5, #e6e6e6, #f4f4f5, #e6e6e6, #f4f4f5);
background-size: 500% 500%;
animation: gradient 1s ease infinite;
color: transparent !important;
border-radius: .5rem;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@valakhosravi
valakhosravi / niazpardaz_send_sms.py
Last active April 27, 2021 11:17
Niazpardaz sms sending in python
def send_test_msg() {
url = "http://www.payamak.vip/api/v1/RestWebApi/SendBatchSms"
body = {
'userName': username,
'password': password,
'fromNumber': sender_number,
'toNumbers': number_list, # array
'messageContent': message,
'isFlash': False,
}
@valakhosravi
valakhosravi / update_django_app.bash
Last active April 4, 2020 14:26
Updating django app on nginx
sudo systemctl restart gunicorn
sudo systemctl daemon-reload
sudo systemctl restart gunicorn.socket gunicorn.service
sudo nginx -t && sudo systemctl restart nginx
@valakhosravi
valakhosravi / convertPersianNumberToEnglishNumbers.js
Created March 29, 2020 15:15
converting Persian or Arabic number to english numbers
convertPersianNumberToEnglishNumbers(num) {
const persianNumberList = [/۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g, /۰/g];
const englishNumberList = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
persianNumberList.forEach((persianNumber, index) => {
num = num.replace(persianNumber, englishNumberList[index]);
});
return num;
}