Skip to content

Instantly share code, notes, and snippets.

@panicoenlaxbox
panicoenlaxbox / gist:5c6784e2be1171eed003
Created May 20, 2014 08:55
MongoCSharpDriver deserialize anonymous type
public class TempDataDocument
{
public string Id { get; set; }
public string Key { get; set; }
public object Value { get; set; } // Aquí puede ir cualquier cosa
}
public static void Main()
{
var client = new MongoClient("mongodb://localhost:27017");
@panicoenlaxbox
panicoenlaxbox / gist:894a904afabf90ecdd6f
Last active December 21, 2016 09:24
View Nuget dependencies hierarchy
using System;
using System.Linq;
using System.Runtime.Versioning;
using NuGet;
namespace ConsoleApplication1
{
/// <summary>
/// View Nuget dependencies hierarchy
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
{
public class DbCException : Exception
{
public DbCException()
{
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
function memoize(fn: any): any {
console.log('memoize');
const cache = {};
return function () {
const key: string = JSON.stringify(arguments);
if (cache[key]) {
console.log(`${key} found in cache`);
return cache[key];
}
else {
@panicoenlaxbox
panicoenlaxbox / DownloadFileAndBlobInWrongAndRightWay.cs
Last active September 12, 2019 19:32
Download file and blob in wrong and right way
//<Project Sdk="Microsoft.NET.Sdk">
// <PropertyGroup>
// <OutputType>Exe</OutputType>
// <TargetFramework>netcoreapp2.2</TargetFramework>
// </PropertyGroup>
// <ItemGroup>
// <PackageReference Include="CsvHelper" Version="12.1.2" />
// <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
// <PackageReference Include="TinyCsvParser" Version="2.5.2" />
// <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
param(
[Parameter(Mandatory = $True)]
[string]$RootPath,
[Parameter(Mandatory = $True)]
[string]$BucketName,
[Parameter(Mandatory = $True)]
[string]$AccessKey,
[Parameter(Mandatory = $True)]
[string]$SecretKey,
[switch]$RemoveRootPathFromS3Key
@panicoenlaxbox
panicoenlaxbox / GenericHostWithEf.csproj
Last active August 4, 2023 04:52
.NET Core Generic host with EF Core
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
@panicoenlaxbox
panicoenlaxbox / Program.cs
Last active August 29, 2019 18:52
EF Core playground
// <Project Sdk="Microsoft.NET.Sdk">
// <PropertyGroup>
// <OutputType>Exe</OutputType>
// <TargetFramework>netcoreapp2.2</TargetFramework>
// <LangVersion>latest</LangVersion>
// </PropertyGroup>
// <ItemGroup>
// <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
@panicoenlaxbox
panicoenlaxbox / packageversiontype.yml
Last active August 5, 2021 11:37
Variable PackageVersionType
- pwsh: |
if ($env:PACKAGEVERSIONTYPE -eq '' -and $env:BUILD_SOURCEBRANCHNAME -ne 'main') {
Write-Host "##vso[task.setvariable variable=PACKAGEVERSIONTYPE]-alpha"
}