رقصنده با کد
782 subscribers
1.69K photos
850 videos
207 files
666 links
Here are some interesting things I've come across during my learning process. That's it. Admin ID:
@alithecodeguy
Download Telegram
تبدیل کد hex به نام رنگ
https://chir.ag/projects/name-that-color

#css #tips #tricks #design
------
مطالب برنامه نویسی بیشتر در کانال :
https://t.iss.one/alithecodeguy
با subscribe یوتیوب هم می‌تونید انرژیمون رو بیشتر کنید:
https://youtube.com/alithecodeguy
اینجوری می‌تونید با جاوا اسکریپت و بدون استفاده از کتابخانه ثانویه ، تاریخ شمسی رو استفاده کنید.
توی المانی استفاده کنید که راست به چپ باشه ، نمایشش هم درست میشه.
@alithecodeguy #js #tips
موقع کار با فرم‌ها به صورت uncontrolled و همراه با typescript در react ، نکاتی که توی این تصویر میبینید رو اگر رعایت کنید ، گیر و گورهای تایپ اسکریپت رفع میشه.
تصویر از آموزش آقای ماش همدانی هستش.
#react #typescript #tips
افزونه vs-code برای اجرای کد‌ها
شرتکات اضافه میکنه که بتونید راحت‌تر کدها رو اجرا کنید و دیگه نیاز نباشه دستور بزنید.
#tips #extension
در جاوا اسکریپت برای مقایسه ، متد Object.is نیز وجود دارد که حتی از عملگر === نیز بهتر عمل کرده (more strict) و برای 0 و -0 و NaN هم به درستی عمل می‌کند.
#js #tips
نکته خوبی از Nextjs
#tips #nextjs
@alithecodeguy
متد groupBy در خود جاوااسکریپت که می‌تونید آرایه‌ای از آبجکت‌ها رو بر اساس فیلد خاصی گروه بندی کنید. قبلا با کتابخانه‌های دیگه مثل لودش باید این کار رو میکردید یا دستی می‌نوشتید
#js #tips
تشریح مفهوم اسکوپ‌چین در جاوااسکریپت

اسکرین شات از جلسات یک به یکمون

#js #javascript #tips
نکته وی‌اس‌کد
#js #vscode #tips
اگر روی اینپوت فیلد‌هاتون مشکل عدد فارسی دارید (مخصوصا برای دیوایس‌های اپل) ، می‌تونید از کد‌های زیر استفاده کنید.


const e2p = s => s.replace(/\d/g, d => '۰۱۲۳۴۵۶۷۸۹'[d])
const e2a = s => s.replace(/\d/g, d => '٠١٢٣٤٥٦٧٨٩'[d])

const p2e = s => s.replace(/[۰-۹]/g, d => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d))
const a2e = s => s.replace(/[٠-٩]/g, d => '٠١٢٣٤٥٦٧٨٩'.indexOf(d))

const p2a = s => s.replace(/[۰-۹]/g, d => '٠١٢٣٤٥٦٧٨٩'['۰۱۲۳۴۵۶۷۸۹'.indexOf(d)])
const a2p = s => s.replace(/[٠-٩]/g, d => '۰۱۲۳۴۵۶۷۸۹'['٠١٢٣٤٥٦٧٨٩'.indexOf(d)])

e2p("asdf1234") // asdf۱۲۳۴
e2a("asdf1234") // asdf١٢٣٤
p2e("asdf۱۲۳۴") // asdf1234
a2e("asdf١٢٣٤") // asdf1234
p2a("asdf۱۲۳۴") // asdf١٢٣٤
a2p("asdf١٢٣٤") // asdf۱۲۳۴


اینم ورژن تایپ اسکریپتش:


const e2p = (s: string): string => {
return s.replace(/\d/g, (d: string): string => '۰۱۲۳۴۵۶۷۸۹'[parseInt(d, 10)]);
};

const e2a = (s: string): string => {
return s.replace(/\d/g, (d: string): string => '٠١٢٣٤٥٦٧٨٩'[parseInt(d, 10)]);
};

const p2e = (s: string): string => {
return s.replace(/[۰-۹]/g, (d: string): string => String('۰۱۲۳۴۵۶۷۸۹'.indexOf(d)));
};

const a2e = (s: string): string => {
return s.replace(/[٠-٩]/g, (d: string): string => String('٠١٢٣٤٥٦٧٨٩'.indexOf(d)));
};

const p2a = (s: string): string => {
return s.replace(/[۰-۹]/g, (d: string): string => '٠١٢٣٤٥٦٧٨٩'['۰۱۲۳۴۵۶۷۸۹'.indexOf(d)]);
};

const a2p = (s: string): string => {
return s.replace(/[٠-٩]/g, (d: string): string => '۰۱۲۳۴۵۶۷۸۹'['٠١٢٣٤٥٦٧٨٩'.indexOf(d)]);
};

console.log(e2p("asdf1234")); // asdf۱۲۳۴
console.log(e2a("asdf1234")); // asdf١٢٣٤
console.log(p2e("asdf۱۲۳۴")); // asdf1234
console.log(a2e("asdf١٢٣٤")); // asdf1234
console.log(p2a("asdf۱۲۳۴")); // asdf١٢٣٤
console.log(a2p("asdf١٢٣٤")); // asdf۱۲۳۴


لینک استک اورفلو:
https://stackoverflow.com/questions/31439604/how-to-convert-persian-and-arabic-digits-of-a-string-to-english-using-javascript

#number #js #tips
@alithecodeguy
ذخیره خودکار لاگ‌های کنسول کروم در یک فایل با استفاده از نود‌جی‌اس
#chrome #tips
@alithecodeguy
به عنوان یه پیشنهاد:

سی اس اس سلکتورها رو خوب بلد باشید.

خوندنش شاید بیشتر از نیم ساعت زمان نبره ولی توی نقاط حساسی از مصاحبه‌ها نجاتتون میده

#interview #tips