Created
February 26, 2016 17:19
-
-
Save jamescoxhead/5b86a2d88b19f6726c6d to your computer and use it in GitHub Desktop.
Linqpad Queries
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
<Query Kind="Statements"> | |
<Reference><RuntimeDirectory>\System.Security.dll</Reference> | |
<Namespace>System.Security.Cryptography</Namespace> | |
</Query> | |
string unhashed = "password"; | |
HMACSHA1 hash = new HMACSHA1(); | |
hash.Key = Encoding.Unicode.GetBytes(unhashed); | |
string hashed = Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(unhashed))); | |
Console.WriteLine(hashed); |
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
<Query Kind="Statements" /> | |
string regexExpression = @"^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)$"; | |
string term = "https://vimeo.com/23966422"; | |
Regex regex = new Regex(regexExpression); | |
Match match = regex.Match(term); | |
if(match.Success) | |
{ | |
Console.WriteLine("Match"); | |
} | |
else | |
{ | |
Console.WriteLine("No match"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment