Skip to content

Instantly share code, notes, and snippets.

Avatar

Ibrahim Šuta Ibro

View GitHub Profile
@Ibro
Ibro / Index.razor.cs
Created Apr 11, 2021
Connect4 - Live game with SignalR and Blazor
View Index.razor.cs
public class IndexComponent: ComponentBase
{
private IdentityUser _currentUser;
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected UserManager < IdentityUser > UserManager { get; set; }
View Microsoft.PowerShell_profile.ps1
Import-Module posh-git
Import-Module oh-my-posh
Import-Module PSReadLine
Set-PoshPrompt -Theme AgnosterPlus
# Set-PoshPrompt -Theme jandedobbeleer
Set-PSReadLineKeyHandler -Key Tab -Function Complete
Set-PSReadlineOption -BellStyle None
Set-PSReadLineOption -PredictionSource History
@Ibro
Ibro / MyScopedService.cs
Last active Jan 18, 2020
ASP.NET Core DI
View MyScopedService.cs
public class MyScopedService : IMyScopedService
{
private readonly ILogger<MyScopedService> _logger;
public MyScopedService (ILogger<MyScopedService> logger)
{
_logger = logger;
}
public void DoSomething ()
View MyConnectionManager.cs
public class MyConnectionManager : IMyConnectionManager
{
private readonly ILogger<MyConnectionManager> _logger;
private readonly IMyScopedService _myScopedService;
public MyConnectionManager(ILogger<MyConnectionManager> logger, IMyScopedService myScopedService)
{
_logger = logger;
_myScopedService = myScopedService;
}
@Ibro
Ibro / Startup.cs
Created Jan 18, 2020
ASP.NET Core DI
View Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IMyScopedService, MyScopedService>();
services.AddSingleton<IMyConnectionManager, MyConnectionManager>();
}
View Dockerfile
FROM microsoft/dotnet:2.2-sdk 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
View config.yml
version: 2
jobs:
build:
machine: true
steps:
- checkout
# build image
- run: |
docker info
View Span.cs
using System;
using System.Collections.Generic;
namespace SpanOfT_Dev
{
public class Program
{
private static void Main(string[] args)
{
int[] arr = { 1, 2, 3, 4, 5 };
View Span.cs
using System;
using System.Collections.Generic;
namespace SpanOfT_Dev
{
public class Program
{
private static void Main(string[] args)
{
int[] arr = { 1, 2, 3, 4, 5 };