Skip to content

Latest commit

 

History

History
198 lines (144 loc) · 4.43 KB

PITCHME.md

File metadata and controls

198 lines (144 loc) · 4.43 KB

@cssaz @colorgrey

... don't take me
@color[orange](so seriously)


@snap[north span-80] @emoji[wave text-14] @css[text-14](Hi, I'm David Pine) @snapend


@snap[south-west] [@csstwitter @davidpine7](https://twitter.com/davidpine7) [@color#f5f5f5 github.com/IEvangelist](https://github.com/IEvangelist) @snapend

@snap[west clear fit] @snapend

@snap[north-west clear fit] @snapend

@snap[south-east] [davidpine.net @colorred](https://davidpine.net/) [docs.microsoft.com @color#008AD7](https://docs.microsoft.com/azure) @snapend

@snap[east clear fit] @snapend

@snap[north-east clear fit] @snapend


@colorwhite @colorred @colorwhite

#DeveloperCommunity @csstwitter

---?image=profanity-filter.png&size=contain

GitHub @colorgrey

@colorgreen


public bool IsPayloadSignatureValid(
	byte[] bytes, 
	string receivedSignature)
{
    using var hmac = new HMACSHA1(
		_options.WebhookSecret.ToByteArray());

    var hash = hmac.ComputeHash(bytes);
    var actualSignature =
		$"sha1={hash.ToHexString()}";

    return IsSignatureValid(
		actualSignature, receivedSignature);
}

@snap[south span-100] @[1-3, zoom-12](Method signature, bool return, parameters byte[] and signature) @[5-6, zoom-12](C# 8, simplified using) @[8-13, zoom-12](Compute the hash and call IsSignatureValid) @snapend


static bool IsSignatureValid(
	string a,
	string b)
{
    var length = Math.Min(a.Length, b.Length);
    var equals = a.Length == b.Length;
    for (var i = 0; i < length; ++ i)
    {
        equals &= a[i] == b[i];
    }

    return equals;
}

@snap[south span-100] @[1-3, zoom-12](A bool return, two string parameters) @[5, zoom-12](Determine the shortest length) @[6, zoom-12](Declare and assign equals) @[7-12, zoom-12](Compare each char in both string instances for equality) @snapend


public ValueTask DispatchAsync(
	string eventName,
	string payloadJson) => 
	eventName switch
    {
        "issues" => 
			_issueHandler.HandleIssueAsync(
				payloadJson),
        "pull_request" => 
			_pullHandler.HandlePullRequestAsync(
				payloadJson),

        _ => new ValueTask(),
    };

@snap[south span-100] @[1-3, zoom-14](A ValueTask return, eventName and JSON parameters) @[4-5,14, zoom-14](C# 8, switch expressions) @[4-5,14,6-8, zoom-12](Handle issues) @[4-5,14,9-11, zoom-12](Handle pull requests) @[4-5,14,13, zoom-12](Handle default case, "catch-all") @snapend


@colormagenta Handler

@ul[no-bullets text-14]

  • @colorcyan   Conditionally Apply Filtering
  • @colorred   Add 😕 Reaction
  • @colorgreen   Add @color[lightblue]("Profane Content") Label

@ulend


GitHub @colorgrey

@colorred



GitHub @colorgrey

@colormagenta




Lint Licker

---?image=assets/slide-one.png&size=contain

@snap[north-west]

🔎 @colorteal

@snapend


@colorgrey Source @colorcyan


## [bit.ly/ProfanityFilter](https://bit.ly/ProfanityFilter)

@snap[south-west] [@csstwitter @davidpine7](https://twitter.com/davidpine7) [@color#f5f5f5 github.com/IEvangelist](https://github.com/IEvangelist) @snapend

@snap[north] @emoji[clap text-14] @css[text-14](Thank You) @snapend

@snap[south-east] [davidpine.net @colorred](https://davidpine.net/) [docs.microsoft.com @color#008AD7](https://docs.microsoft.com/azure) @snapend