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 void Add(T item){ | |
lock(m_lock){ | |
_container.Add(item); | |
Monitor.PulseAll(m_lock); | |
} | |
} |
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
declare function SourceAccountIsValid(src, dst, req){ | |
} | |
declare function SourceAccountHasFunds(src, dst, req){ | |
} | |
declare function validate_transfer(src, dst, req){ | |
var rules = [SourceAccountIsValid, SourceAccountHasFunds, | |
SourceAccountDailyLimitNotExceed, DestinationAccountHasNoLiens, | |
DestinationAccountMaxAmountNotExceeded, MoneyTransferIsNotFromDirtyBitcoins | |
]; | |
var errors = rules.map(rule=> rule(src, dst, req).filter(x=>x!= null); |
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 async Task SendMoney(SendMoneyRequest req) | |
{ | |
var srcAccount = await _accountRepository.LoadAsync(req.SourceAccount); | |
var dstAccount = await _accountRepository.LoadAsync(req.DesinationAccount); | |
Guard.Null(srcAccount, "Source account must exists"); | |
Guard.Null(dstAccount, "Destination account must exists"); | |
var rules = _transferValidationRules.GetAll(); | |
var state = new TranfserValidationState(); |
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 async Task SendMoney(SendMoneyRequest req) | |
{ | |
var srcAccount = await _accountRepository.LoadAsync(req.SourceAccount); | |
var dstAccount = await _accountRepository.LoadAsync(req.DesinationAccount); | |
Guard.Null(srcAccount, "Source account must exists"); | |
Guard.Null(dstAccount, "Destination account must exists"); | |
var rules = _transferValidationRules.GetAll(); | |
foreach(var rule in rules) |
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
var dic = new Dictionary<string, int> { ["A"] = 0, ["B"] = 0, ["C"] = 0 }; | |
for (int i = 0; i < 10_000; i++) | |
{ | |
var list = new List<string> { "A", "B", "C" }; | |
list.Sort((x, y) => new Random().Next(0, 2)); | |
dic[list[0]]++; | |
} |
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 <string.h> | |
#include <assert.h> | |
#if WIN32 | |
#define strdup _strdup | |
#endif | |
struct val; |
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 <string.h> | |
#include <assert.h> | |
#if WIN32 | |
#define strdup _strdup | |
#endif | |
struct val; |
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 <string.h> | |
#include <assert.h> | |
#if WIN32 | |
#define strdup _strdup | |
#endif | |
struct val; |
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
[Route("/public/api/v1/tickets/{org}")] | |
public async Task<IActionResult> Get(string org, int skip = 0) | |
{ | |
var tickets = await session.Query<Domain.SupportTicket>() | |
.Where(x=>x.Organization == org) | |
.OrderByDescending(x => x.LastUpdate) | |
.Skip(skip) | |
.Select(ticket => new PublicTicketDto | |
{ | |
Subject = ticket.Subject, |
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
[Route("/public/api/v1/tickets/{org}")] | |
public async Task<IActionResult> Get(string org, int skip = 0) | |
{ | |
var tickets = await session.Query<Domain.SupportTicket>() | |
.Where(x=>x.Organization == org) | |
.OrderByDescending(x => x.LastUpdate) | |
.Skip(skip) | |
.ToListAsync(); | |
return Ok(tickets); |