Skip to content

Instantly share code, notes, and snippets.

View jrgcubano's full-sized avatar

Jorge Rodríguez Galán jrgcubano

View GitHub Profile
@jrgcubano
jrgcubano / X.Y.Z.Sources.csproj
Created April 18, 2024 08:52 — forked from attilah/X.Y.Z.Sources.csproj
X.Y.Z.Sources nuget package
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<IsPackable>true</IsPackable>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>contentFiles</ContentTargetFolders>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
@jrgcubano
jrgcubano / AsyncCache.cs
Created April 15, 2024 10:22 — forked from StephenCleary/AsyncCache.cs
Asynchronous cache
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
using Nito.Logging;
using System;
using System.Threading.Tasks;
namespace System.Collections.Concurrent
{
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>
@jrgcubano
jrgcubano / stripe-keys-and-ids.tsv
Created November 2, 2023 09:42 — forked from fnky/stripe-keys-and-ids.tsv
Stripe keys and IDs
Prefix Description Notes
ac_ Platform Client ID Identifier for an auth code/client id.
acct_ Account ID Identifier for an Account object.
aliacc_ Alipay Account ID Identifier for an Alipay account.
ba_ Bank Account ID Identifier for a Bank Account object.
btok_ Bank Token ID Identifier for a Bank Token object.
card_ Card ID Identifier for a Card object.
cbtxn_ Customer Balance Transaction ID Identifier for a Customer Balance Transaction object.
ch_ Charge ID Identifier for a Charge object.
cn_ Credit Note ID Identifier for a Credit Note object.
@jrgcubano
jrgcubano / kafka-server.properties
Created May 26, 2023 10:09 — forked from mansu/kafka-server.properties
Slack Kafka server config
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jrgcubano
jrgcubano / PortFinder.cs
Created November 8, 2022 08:51
PortFinder
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
namespace Ylp.ExampleTests.Fixtures;
public static class PortFinder
{
static readonly List<int> UsedPorts = new();
@jrgcubano
jrgcubano / Program.cs
Created May 24, 2022 17:41 — forked from ErikNoren/Program.cs
ASP.NET Core 6 configuration settings stored in a SQL database and acts just like appsettings.json
//Snippet from Program.cs which adds the provider and sets up a Settings class to map the settings
using ErikNoren.Configuration;
using TestMvcWebApplication;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddSqlDatabase(config =>
{
//We can get the connection string from previously added ConfigurationProviders to use in setting this up
config.ConnectionString = builder.Configuration.GetConnectionString("DemoDatabase");
@jrgcubano
jrgcubano / AbstractNodeNodeTypeResolver.cs
Created December 17, 2021 14:21 — forked from atruskie/AbstractNodeNodeTypeResolver.cs
Inferring abstract/interface types for YamlDotNet Deserialization
using System;
using System.Collections.Generic;
using System.Linq;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NodeDeserializers;
namespace Egret.Cli.Models
{
::Skip file with name .pdb, someFile.xml and .config$
msdeploy.exe -verb:sync -source:contentPath=SourcePath -dest:DestPath -skip:objectName=filepath,absolutepath="^*\.pdb$" -skip:objectName=filepath,absolutepath="^*\someFile.xml$" -skip:objectName=filepath,absolutepath="^*\someotherfile.aspx$" -skip:objectName=filepath,absolutepath=".config$"
@jrgcubano
jrgcubano / drop-disabled-enabled-fk-table-constraints.sql
Created November 10, 2020 14:24
SQL SERVER DROP, ADD, DISABLE AND ENABLE Foreign Key contraints: (edited)
-- Drop FK constraints
BEGIN
ALTER TABLE [Report].DailyOccupancyStats_Agg DROP CONSTRAINT [FK_Report.DailyOccupancyStats_Agg_DateId];
ALTER TABLE [Report].OccupancySessionsStats_Agg DROP CONSTRAINT [FK_Report.OccupancySessionsStats_Agg_DateId];
ALTER TABLE [Report].OccupancySessionsOspStats_Agg DROP CONSTRAINT [FK_Report.OccupancySessionsOspStats_Agg_DateId];
ALTER TABLE [Report].ParkeonSessionsStats_Agg DROP CONSTRAINT [FK_Report.ParkeonSessionsStats_Agg_DateId];
ALTER TABLE [Report].ParkingSessionsStats_Agg DROP CONSTRAINT [FK_Report.ParkingSessionsStats_Agg_DateId];
ALTER TABLE [Report].ParkingSessionsOspStats_Agg DROP CONSTRAINT [FK_Report.ParkingSessionsOspStats_Agg_DateId];
ALTER TABLE [Report].ParkingUsersCreationStats_Agg DROP CONSTRAINT [FK_Report.ParkingUsersCreationStats_Agg_CreationDateId]