Skip to content

Instantly share code, notes, and snippets.

View A-Programmer's full-sized avatar

Kamran Sadin A-Programmer

  • Sadin
  • Iran
  • X @MrSadin
View GitHub Profile
@A-Programmer
A-Programmer / GoogleReCaptchaV2.txt
Last active August 23, 2023 04:52
How to use reCaptcha v2 in ASP.NET
(Another way : https://github.com/tanveery/recaptcha-net)
1. Get secret key and site key from : https://www.google.com/recaptcha/admin
2. Add them to web config :
<add key="recaptcha-secret-key" value="...[secret key]" />
<add key="recaptcha-public-key" value="...[public-key]" />
3. Install Package :
PM > Install-Package ReCaptcha-AspNet
@A-Programmer
A-Programmer / Dockerfile
Created March 6, 2022 16:36
NETCore 6.0 project Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
@A-Programmer
A-Programmer / .vimrc
Created October 4, 2021 16:16
My .vimrc file
let s:using_snippets = 0
call plug#begin('~/.vim/plugged')
" Git
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/gv.vim'
set nocompatible
filetype off
"Add Vundle to runtime path
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
"""""""""""""""""""""""
"" Add new plugins here
"""""""""""""""""""""""
@A-Programmer
A-Programmer / ngrok.txt
Last active February 29, 2020 05:11
ngrok چیست و چطور استفاده كنیم
تبدیل آدرس لوكال لوكال (localhost) به آدرس http و https به صورتی كه در اینترنت در دسترس باشد:
زمانی كه یك پروژه وب را میخواهید در اینترنت نمایش دهید(به دوستان و یا حتی تست) و یا پروژه نیاز به اجرا شدن در آدرس https دارد باید یك هاست و دامنه و گواهی نامه ssl تهیه كنید و هربار وب سایت را آپلود كنید.
با استفاده از این آموزش به راحتی می توانیم آدرس localhost:port را در حالت http و https در بستر اینترنت به صورتی كه تمام كاربران به آن دسترسی داشته باشند اجرا كنیم.
برای این كار وارد سایت www.ngrok.com می شوید
ثبت نام می كنید
از قسمت دانلود نرم افزار مربوط به سیستم عامل خودتان را دانلود میكنید
بعد از دانلود نرم افزار آن را از حالت فشرده خارج كرده و در پوشه ای(هر جای سیستم مهم نیست) ذخیره میكنید.
پروژه خود را اجرا كنید (مثلا عزیزانی كه دات نت كار میكنند در Visual Studio با فشردن کلید F5 اجرا میکنند)
با توجه به نرم افزار شما و زبان برنامه نویسی شما آدرس شما شبیه localhost:port خواهد بود که port عدد می باشد.
حالا با Command Prompt وارد آدرس پوشه ای كه ساختیم می شوید و دستور زیر را اجرا میكنید:
@A-Programmer
A-Programmer / liveSassCompiler
Last active November 23, 2019 10:41
Install and Config LiveSassCompiler extension
Create a .vscode folder in the root of project. Inside of .vscode folder create a json file named settings.json. Inside of the settings.json, type following key-value pairs. By the way you’ll get intelli-sense.
{
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css"
},
{
@A-Programmer
A-Programmer / SqlQueries2.md
Last active June 23, 2018 19:53
75 SQL queries that makes a programmer's life easier. Part 2

75 SQL queries that makes a programmer's life easier. Part 2

In this article we will learn about some of the mostly used SQL Server queries every developer should know. These queries can be asked you as an Interview Question or they are handy for you in your day to day tasks.

11. Get all column names from table:

In this query we will learn about How to get all column names from Sql Server table.

select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='TableName';

Get column names with data type:

@A-Programmer
A-Programmer / SqlQueries.md
Created May 4, 2018 15:51
75 SQL queries that makes a programmer's life easier. Part 1

75 SQL queries that makes a programmer's life easier. Part 1

In this article we will learn about some of the mostly used SQL Server queries every developer should know. These queries can be asked you as an Interview Question or they are handy for you in your day to day tasks.

1. Create Table:

In this SQL Server query we will learn How to create table in SQL Server.

CREATE TABLE TableName ( Id INT, Name Nvarchar(500),

@A-Programmer
A-Programmer / CustomTagHelper.md
Last active May 6, 2018 05:13
ساخت TagHelper اختصاصی در ASP.NET Core

آموزش ساخت TagHelper اختصاصی در DotNet Core:

اگر در مورد تگ هلپرها نمی دانید، می توانید به صفحه اینستاگرام یا كانال تلگرامی كه در انتهای مقاله نوشته شده است مراجعه كنید.

در این مقاله می خواهیم یك تگ هلپر برای پراگرس بار بوت استرپ بنویسیم. با توجه به مستندات بوت استرپ كد زیر یك پراگرس بار ساده را برای ما نمایش می دهد:

'

60% Complete
@A-Programmer
A-Programmer / LazyLoading.md
Last active May 1, 2018 14:31
What is Lazy Loading and introduce some JQuery Lazy Loading Plugins

Lazy Loading چیست؟

Lazy Loading یا بارگذاری احمقانه یك تكنیك برای به تاخیر انداختن بارگذاری تصاویر و ویدئو در صفحات وب به جای بارگذاری كل صفحه می باشد. این تكنیك باعث كم شدن زمان انتظار كاربر برای بارگذاری می شود.

در ادامه به چند افزونه جی كوئری برای Lazy Loading اشاره خواهیم كرد.

1.LazyYT.js

این افزونه برای بارگذاری ویدئو های یوتیوب بسیار مفید است.