Skip to content

Instantly share code, notes, and snippets.

Pedro Reys pedroreys

Block or report user

Report or block pedroreys

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Yes, assuming all four machines' Dispense and Deposit methods share the same contract, all you need is to create an interface that they all implement:

public interface IMachine
    void Dispense();
    void Deposit();

Keybase proof

I hereby claim:

  • I am pedroreys on github.
  • I am pedroreys ( on keybase.
  • I have a public key ASArm9QdTrzFw6VyQzQe25SpFbdA74G78NRCkRSuqjHz3Qo

To claim this, I am signing this object:

View PurchaseItemValidator.cs
public class PurchaseItemValidator : IValidator<PurchaseItem>
private IEnumerable<IValidationRule<PurchaseItem>> _rules;
public PurchaseItemValidator(IEnumerable<IValidationRule<PurchaseItem>> rules)
_rules = rules;
public IEnumerable<ValidationResult> Validate(PurchaseItem command)
pedroreys / query.sql
Last active Apr 22, 2019
SQL Server version of this recursive query example to traverse a tree depth-first
View query.sql
declare @empl table(name nvarchar(max) null, boss nvarchar(max) null);
insert into @empl values ('Paul',null);
insert into @empl values ('Luke','Paul');
insert into @empl values ('Kate','Paul');
insert into @empl values ('Marge','Kate');
insert into @empl values ('Edith','Kate');
insert into @empl values ('Pam','Kate');
insert into @empl values ('Carol','Luke');
insert into @empl values ('John','Luke');
pedroreys / gulpfile.js
Created Sep 3, 2014
Appending multiple src streams in a gulp task
View gulpfile.js
var streamqueue = require('streamqueue');
gulp.task('zipit', ['clean', 'less'], function () {
var stream = streamqueue({objectMode: true});
gulp.src(['**', '!./protobuffer/**', '!./node_modules/**', '!./archive/**', '!./.idea/**', '!./db/**', '!./docs/**', '!./logs/**'], {base: "."})
View ExampleApiController.cs
public class AssembleWipItemController : ApiController
private readonly IMediator _mediator;
public AssembleWipItemController(IMediator mediator)
_mediator = mediator;
pedroreys / .gitconfig
Created Feb 5, 2014
Configuring git to use p4merge on Windows
View .gitconfig
tool = p4merge
[mergetool "p4merge"]
path = c:/Program Files/Perforce/p4merge.exe
cmd = \"c:/Program Files/Perforce/p4merge.exe\" \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
pedroreys / chat_log
Created Apr 24, 2013
Amazon customer service rocks
View chat_log
You are now connected to Hernan from
Me: I'm a Prime Member and Free Shipping is not available for an item that is shipped and sold by amazon.
Hernan:Hi there! I'm Hernan. I hope you're doing well! I'm really sorry about this issue, Pedro. I'd be glad to help you clarify this, What is the item you're referring to?
Me:Hey, I'm trying to buy this set of books: <url> and I have a Prime Membership but I don't know why it's not available for Free Shipping
Hernan:What is the address you're selecting?
pedroreys / Message.cs
Created Apr 12, 2013
Defining a custom JsonConverter and using it with the built-in JsonConverterAttribute
View Message.cs
public class Message
public string Password { get; set; }
pedroreys / gist:5292915
Created Apr 2, 2013
find the potential bug
View gist:5292915
public static class Foo
private static async Task DelayAsync()
await Task.Delay(1000);
public static void Test()
var delayTask = DelayAsync();
You can’t perform that action at this time.