Skip to content

Instantly share code, notes, and snippets.

Ibrahim Šuta Ibro

Block or report user

Report or block Ibro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View config.yml
version: 2
jobs:
build:
machine: true
steps:
- checkout
# build image
- run: |
docker info
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 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 };
View Span.cs
using System;
namespace SpanOfT_Dev
{
public class Program
{
private static void Main(string[] args)
{
int[] arr = { 0, 1, 2, 3, 4, 5 };
Span<int> span = arr.AsSpan();
@Ibro
Ibro / Span.cs
Created May 23, 2018
More C# 7 goodness - Span<T> - Span of T - CodingBlast
View Span.cs
int[] arr = { 0, 1, 2, 3, 4, 5 };
Span<int> span = arr.AsSpan();
foreach (var number in span)
{
Console.WriteLine(number);
}
View CategoriesController.cs
[HttpPost]
[ValidateAntiForgeryToken]
[AuthorizeResource(typeof(InsertCategoryRequirement))]
public async Task<IActionResult> Create([Bind("Id,Name,UserId")] Category category)
{
ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", category.UserId);
// If ModelState isn't valid, return to view immediately
if (!ModelState.IsValid)
{
View AuthorizeResourceAttribute.cs
public class AuthorizeResourceAttribute : TypeFilterAttribute
{
public AuthorizeResourceAttribute(Type requirementType)
: base(typeof(AuthorizeResourceFilter))
{
Arguments = new object[] { requirementType };
}
private class AuthorizeResourceFilter : IAsyncActionFilter
{
View CategoriesController.cs
public class CategoriesController : Controller
{
private readonly ApplicationDbContext _context;
private readonly IAuthorizationService _authorizationService;
public CategoriesController(ApplicationDbContext context, IAuthorizationService authorizationService)
{
_context = context;
_authorizationService = authorizationService;
}
You can’t perform that action at this time.