Skip to content

Instantly share code, notes, and snippets.

@revocengiz
revocengiz / MyTestApi.csproj
Created November 29, 2023 11:33 — forked from joperezr/MyTestApi.csproj
How to use Redaction in Logging using the new Microsoft.Extensions.Compliance.Redaction package. For the full Guide, checkout the README.md file on the gist.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
<ItemGroup>
@revocengiz
revocengiz / craver-vs.omp.json
Created October 7, 2021 13:50 — forked from DamianEdwards/craver-vs.omp.json
My oh-my-posh profile
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{if .Root}}(Admin) {{end}}{{.Folder}}",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
Import-Module posh-git
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme ~/Documents/WindowsPowerShell/craver.omp.json
namespace System.Collections.Generic
{
public static class ConcurrentDictionaryExtensions
{
/// <summary>
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
/// <param name="dictionary"></param>
using System.IO;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
namespace WebApplication1
{
public class Program
{
@revocengiz
revocengiz / GetCustomerById.cs
Created May 11, 2018 10:02
GetCustomerById by ValueTask
// Özellikle cachlenen verinin dönüldüğü yerlerde çoğu zaman method sync çalışacağı için
// Task<T> yerine ValueTask<T> dönmek daha performanslı olacaktır (daha az allocation)
// Ancak bu method TPL'deki Task.WhenAll veya Task.WhenAny ile kullanıldığı zaman
// ValueTask<T> Task<T>'ye dönüştürüleceği için daha çok allocation sebep olabilir
// http://blog.i3arnon.com/2015/11/30/valuetask/
// https://www.productivecsharp.com/2017/07/practical-csharp-generalized-async-return-types/
// “ValueTask<T> is a discriminated union of a T and a Task<T>, making it allocation-free
// for ReadAsync<T> to synchronously return a T value it has available (in contrast to using Task.FromResult<T>,
// // which needs to allocate a Task<T> instance).
@revocengiz
revocengiz / swagger.json
Last active June 12, 2017 11:05
swagger
{"swagger":"2.0","info":{"version":"v1","title":"ePlatform Bussiness Suite API","description":"ePlatform Ticari Muhasebe Portali","termsOfService":"","contact":{"name":"","url":"","email":""},"license":{"name":"","url":""}},"basePath":"/","paths":{"/v{version}/account/list":{"get":{"tags":["Account"],"summary":"Kullanıcıya ait hesapları listeler.","operationId":"V{versionAccountListGet","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"pageIndex","in":"query","description":"Sayfa sıra numarası(Default:1)","required":false,"type":"integer","format":"int32"},{"name":"pageSize","in":"query","description":"Sayfadaki kayıt sayısı(Default:10)","required":false,"type":"integer","format":"int32"},{"name":"filterQuery","in":"query","required":false,"type":"string"},{"name":"sortedColumn","in":"query","description":"'AccountId','CreateDate' (Default:CreateDate)","required":false,"type":"string"},{"name":"isDesc","in":"query","description":"(Default:false)","required":
@revocengiz
revocengiz / knockout.bindings.js
Created March 7, 2016 19:40 — forked from ivanovvitaly/knockout.bindings.js
My simple and usefull knockout binding handlers I always use
// Requires BlockUI
ko.bindingHandlers.blockUI = {
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var isEnabled = ko.unwrap(valueAccessor()) || false;
if (isEnabled) {
$(element).block();
}
else {
$(element).unblock();
}