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
private void UpdateStrategy() | |
{ | |
var newChange = (CurrentPrice - EnterPrice) / EnterPrice; | |
CurrentPercentChange = newChange * 100; | |
if (CurrentPercentChange >= MinWinPercentage) | |
{ | |
if (CurrentPercentChange > MaxWinPercentChange) | |
{ | |
MaxWinPercentChange = CurrentPercentChange; |
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 authConfig = configuration.GetSection("AuthConfiguration").Get<AuthConfiguration>(); | |
var metadataAddress = authConfig.Authority; | |
if (!metadataAddress.EndsWith("/", StringComparison.Ordinal)) | |
{ | |
metadataAddress += "/"; | |
} | |
metadataAddress += ".well-known/openid-configuration"; |
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 class QueueConsumer<T> | |
{ | |
readonly BlockingCollection<QueueConsumerItem<T>> queue; | |
readonly int numberOfThreads; | |
public QueueConsumer(int numberOfThreads, int capacity) | |
{ | |
queue = new BlockingCollection<QueueConsumerItem<T>>(capacity); | |
this.numberOfThreads = numberOfThreads; | |
} |
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 Newtonsoft.Json; | |
using Rebus.Messages; | |
using Rebus.Serialization; | |
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Rebus.Extensions; | |
using System.Linq; | |
using System.Collections.Concurrent; |
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 ActionContextExtensions | |
{ | |
public static void ValidateNullModel(this HttpActionContext actionContext) | |
{ | |
var notNullParametersDescriptors = actionContext.ActionDescriptor.GetParameters() | |
.Where(p => p.GetCustomAttributes<NotNullAttribute>().Count > 0); | |
foreach (var pd in notNullParametersDescriptors) | |
{ | |
var model = actionContext.ActionArguments[pd.ParameterName]; |
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 MvcHtmlString SwitchFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string trueString, string falseString) | |
{ | |
if (expression == null) | |
throw new ArgumentNullException("expression"); | |
var body = expression.Body as MemberExpression; | |
if (body == null) | |
throw new ArgumentNullException("expression"); | |
bool truthValue = (bool)ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData).Model; |
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
// Ariel Moraes | |
// https://www.linkedin.com/in/arielmoraes | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
int mathmod(int a, int b) { | |
return (abs(a * b) + a) % b; |