This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Curiously Recurring Pattern | |
// http://blogs.msdn.com/b/ericlippert/archive/2011/02/03/curiouser-and-curiouser.aspx | |
public class VersionedExecutorBase<T, TFunc> | |
where T : VersionedExecutorBase<T, TFunc> | |
{ | |
private readonly Func<Version> _versionProvider; | |
private readonly Dictionary<Version, TFunc> _functions; | |
private TFunc _default; | |
public VersionedExecutorBase(Func<Version> versionProvider) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.Options; | |
namespace AspNetCoreRateLimit.Demo | |
{ | |
public class MPRateLimitConfiguration : RateLimitConfiguration | |
{ | |
public MPRateLimitConfiguration( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | |
public class DisableFormValueModelBindingAttribute : Attribute, IResourceFilter | |
{ | |
public void OnResourceExecuting(ResourceExecutingContext context) | |
{ | |
var factories = context.ValueProviderFactories; | |
factories.RemoveType<FormValueProviderFactory>(); | |
factories.RemoveType<JQueryFormValueProviderFactory>(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* TRUNCATE ALL TABLES IN A DATABASE */ | |
DECLARE @dropAndCreateConstraintsTable TABLE | |
( | |
DropStmt VARCHAR(MAX) | |
,CreateStmt VARCHAR(MAX) | |
) | |
/* Gather information to drop and then recreate the current foreign key constraints */ | |
INSERT @dropAndCreateConstraintsTable | |
SELECT DropStmt = 'ALTER TABLE [' + ForeignKeys.ForeignTableSchema | |
+ '].[' + ForeignKeys.ForeignTableName + '] DROP CONSTRAINT [' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DatabaseExtensions | |
{ | |
public static SqlQuery<T> SqlQuery<T>(this DatabaseFacade database, string sqlQuery, object parameters = null) | |
where T : class | |
{ | |
return new SqlQuery<T> | |
{ | |
Database = database, | |
Query = sqlQuery, | |
Parameters = GetParameters(parameters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern alias redis; | |
using Castle.Core.Logging; | |
using redis::StackExchange.Redis; | |
using System; | |
using System.Net; | |
using UiPath.Core; | |
namespace UiPath.Web.Communication | |
{ | |
public static class RedisConnector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
public async Task<IEnumerable<AddressModel>> GetAddresses(ODataQueryOptions<AddressModel> queryOptions, CancellationToken cancellationToken) | |
{ | |
var repository = new AddressRepository(_context); | |
var service = new AddressService(repository); | |
var filter = queryOptions.ToModelQueryFilter<AddressModel>(); | |
return await service.QueryByStreetAsync("StreetName", filter, cancellationToken); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/time.h> | |
double **new_matrix(int n) | |
{ | |
double **m; | |
double *buf; | |
buf = (double *) calloc(n * n, sizeof(double)); | |
int i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef LIB | |
#define LIB | |
typedef struct { | |
int type; | |
int len; | |
char payload[1400]; | |
} msg; | |
void init(char* remote,int remote_port); |
NewerOlder