Skip to content

Instantly share code, notes, and snippets.

View Redouane64's full-sized avatar

Redhouane Sobaihi Redouane64

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
// 1. this code lives in data access assembly/project
internal /* <- this is important modifier */ class DbContext {
public IQueryable<Object> SomeDbSet { get; }
}
public class SomeRepository {
@Redouane64
Redouane64 / Aggregates.Bill.md
Created November 3, 2022 08:26 — forked from amantinband/Aggregates.Bill.md
Buber Dinner Domain Aggregates

Domain Aggregates

Bill

class Bill
{
    // TODO: Add methods
}
Import-Module posh-git
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme ~/Documents/WindowsPowerShell/craver.omp.json
@Redouane64
Redouane64 / README.txt
Created August 16, 2021 16:18
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@Redouane64
Redouane64 / invalid_state_api_response_configuration.cs
Created February 27, 2021 07:46
AspNet Web API Invalid Model State Response Configuration
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
namespace MyApi.Extension
{
public static class ServiceColltectionExtensions
@Redouane64
Redouane64 / startup_cs_with_versioning_swagger.cs
Last active February 27, 2021 07:39
AspNet Web API with Versioning And Swagger Configuration - Sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Versioning;
@Redouane64
Redouane64 / footballTournamentSimulation.cs
Last active September 13, 2020 15:22
Football Tournament Simulation
using System;
using System.Collections.Generic;
namespace FootballTournamentSimulation
{
class Program
{
// A team model.
class Team
{
@Redouane64
Redouane64 / DotNet_DataAnnotation_Validation.cs
Created September 13, 2020 13:50
Validate POCOs in .NET - Examples
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Xunit;
using Xunit.Abstractions;
namespace DataAnnotationsAndValidation
{
public class ValidationTests
{
@Redouane64
Redouane64 / node_nginx_ssl.md
Created August 29, 2020 18:40 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

def flatten(source):
target = []
def flatten_recursively(source, current_target):
for element in source:
if isinstance(element, list):
flatten_recursively(element, current_target)
else:
current_target.append(element)
flatten_recursively(source, target)