Skip to content

Instantly share code, notes, and snippets.

View A-Programmer's full-sized avatar

Kamran Sadin A-Programmer

View GitHub Profile
@A-Programmer
A-Programmer / ImageHelper.cs
Created April 7, 2017 19:58
Some methods for working with images in C#
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
namespace Helpers
{
public class ImageHelper
{
/// <summary>
@A-Programmer
A-Programmer / app.js
Created November 16, 2017 21:17
ajax post
$(dosument).ready(function()
{
$.ajax()
{
url:'url of action',
data:{json:data},
type:'POST',
success: function()
{
alert('done');
@A-Programmer
A-Programmer / get.js
Created November 16, 2017 21:20
ajax get
$(dosument).ready(function()
{
$.ajax()
{
url:'url of action',
type:'GET',
success: function(data)
{
$('#divid').html(data);
},
@A-Programmer
A-Programmer / DropDownListTagHelper.txt
Created December 18, 2017 07:50
How to set drop down list items in ASP.NET Core from database
In action method of HomeController.cs :
[HttpGet]
public ActionResult TestAction()
{
ViewBag.Categories = db.Categories.ToList();
return View();
}
in View (TestAction.cshtml):
<select asp-for="Menu.Id" asp-items="@(new SelectList(@ViewBag.Categories,"Id","Title"))">
@A-Programmer
A-Programmer / CreateWebApp.md
Created February 27, 2018 16:52
how to create web application in dotnet core 2 from scratch.

Table of Content

  1. Create new app
  2. Config app and install packages
  3. Add controllers and views
  4. Add model and data context,Update database
  5. Using Layout
  6. Using Bundle and minification
  7. Areas
  8. Identity manager
  9. Working with static files
@A-Programmer
A-Programmer / ErrorConvertor.cs
Created March 23, 2018 18:50
Bank Mellat Error Convertor
//This is a fuction that gets error number and returns error text of MellatBank Gateway methods.
public string GetErrorText(string errorId)
{
var errorText = "خطای ناشناخته";
switch(errorId)
{
case "0":
{
errorText = "تراکنش با موفقيت انجام شد";
break;
@A-Programmer
A-Programmer / index.html
Created April 15, 2018 09:47
vue data binding
<div id="vue-app">
<a v-bind:href="websiteTag">My Site<a/>
<br/>
<input v-bind:value="name"/>
</div>
@A-Programmer
A-Programmer / bind-html-tag-from-data-in-vue.markdown
Created April 15, 2018 15:33
Bind html tag from data in vue

Bind html tag from data in vue

In this example i show how we can render html tag from a data on page by vue

A Pen by Kamran on CodePen.

License.

@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 / 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 وارد آدرس پوشه ای كه ساختیم می شوید و دستور زیر را اجرا میكنید: