Skip to content

Instantly share code, notes, and snippets.

View codehaks's full-sized avatar

Hakim codehaks

View GitHub Profile
@codehaks
codehaks / LocalizeNumbers.cs
Created January 27, 2020 20:25
Farsi numbers
using System;
using System.Linq;
using System.Text.RegularExpressions;
namespace Portal.Infrastructure.Extentions
{
public static class StringExtentions
{
private const int ZeroCharCode = '0';
private const int LocalizedZeroCharCode = '۰';
@codehaks
codehaks / Test.cs
Last active March 27, 2020 07:54
test
.class public auto ansi beforefieldinit MyApp.IndexModel
extends [Microsoft.AspNetCore.Mvc.RazorPages]Microsoft.AspNetCore.Mvc.RazorPages.PageModel
{
// Nested Types
.class nested private auto ansi sealed beforefieldinit '<OnGet>d__0'
extends [System.Runtime]System.Object
implements [System.Runtime]System.Runtime.CompilerServices.IAsyncStateMachine
{
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
using System;
using static Domain.Result;
namespace Domain
{
public readonly struct Result
{
private readonly Result<int, StringError> _result => new Result<int, StringError>(0);
public int Value => _result.Value;
@codehaks
codehaks / HomeController.cs
Created July 1, 2020 08:24
Expression-Bodied Members
using Microsoft.AspNetCore.Mvc;
using MyProfile.Common;
using PeopleApp.Common;
using PeopleApp.Data;
using System;
using System.Linq;
using System.Linq.Expressions;
namespace PeopleApp.Controllers
{
@codehaks
codehaks / roadmap.md
Last active July 23, 2020 03:13
Roadmap

RoadMap

C# Programming

C# 6.0 -> C# 9.0 new features

ASP.NET Core

  • MVC
  • Razor Pages
  • Web API
import turtle
t=turtle.getturtle()
t.speed(100)
t.fillcolor("yellow")
t.begin_fill()
t.pensize(5)
t.pencolor("black")
@codehaks
codehaks / launchsettings.json
Created November 23, 2020 07:32
dotnet watch visual studio
"Watch": {
"commandName": "Executable",
"executablePath": "dotnet.exe",
"workingDirectory": "$(ProjectDir)",
"commandLineArgs": "watch run",
"launchBrowser": true,
"launchUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
@codehaks
codehaks / launchsettings.json
Created December 6, 2020 19:03
Tye run in VS
"Tye": {
"commandName": "Executable",
"executablePath": "tye",
"commandLineArgs": "run",
"workingDirectory": "$(SolutionDir)",
"launchBrowser": true,
"launchUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
@codehaks
codehaks / excuses.json
Created January 31, 2021 16:46 — forked from mhmda-83/excuses.json
Devloper Excuses (extracted from http://developerexcuses.com/)
[
"That code seemed so simple I didn't think it needed testing",
"That isn't covered by my job description",
"I can't test everything",
"That's not a bug it's a configuration issue",
"That wasn't in the original specification",
"It's just some unlucky coincidence",
"Oh, you said you DIDN'T want that to happen?",
"There were too many developers working on that same thing",
"I have too many other high priority things to do right now",
[Route("api/user/roles")]
public IActionResult UserRoles()
{
var q1 = from userRole in _shopDbContext.UserRoles
join role in _shopDbContext.Roles on userRole.RoleId equals role.Id
join user in _shopDbContext.Users on userRole.UserId equals user.Id
select new
{
user.Id,
user.FirstName,