Skip to content

Instantly share code, notes, and snippets.

Avatar

Hakim codehaks

View GitHub Profile
View Startup.cs
private Marten.StoreOptions BuildStoreOptions()
{
var connectionString = Configuration.GetConnectionString("Marten");
var options = new Marten.StoreOptions();
options.Connection(connectionString);
options.AutoCreateSchemaObjects = AutoCreate.CreateOrUpdate;
return options;
}
View SQL Docker Commands
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=1234@Abcd" -p 1500:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2019-latest
docker exec -it sql1 "bash"
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "1234@Abcd"
@codehaks
codehaks / note.txt
Last active May 10, 2021
SQL Server on docker remote
View note.txt
docker run -m=4g -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=1234@Abcd" -p 1433:1433 --name sql2 -h sql2 -d mcr.microsoft.com/mssql/server:2019-latest
docker exec -it sql2 "bash"
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "1234@Abcd"
sqlcmd -S 127.0.0.1,1434 -U SA -P "1234@Abcd"
View userroles.cs
[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,
@codehaks
codehaks / excuses.json
Created Jan 31, 2021 — forked from mhmda-83/excuses.json
Devloper Excuses (extracted from http://developerexcuses.com/)
View excuses.json
[
"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",
View launchsettings.json
"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 / launchsettings.json
Created Nov 23, 2020
dotnet watch visual studio
View launchsettings.json
"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"
View traffic_light.py
import turtle
t=turtle.getturtle()
t.speed(100)
t.fillcolor("yellow")
t.begin_fill()
t.pensize(5)
t.pencolor("black")
View roadmap.md

RoadMap

C# Programming

C# 6.0 -> C# 9.0 new features

ASP.NET Core

  • MVC
  • Razor Pages
  • Web API
@codehaks
codehaks / HomeController.cs
Created Jul 1, 2020
Expression-Bodied Members
View HomeController.cs
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
{