This file contains hidden or 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 ValidationHelpers | |
| { | |
| public static bool IsValidHostAddress(string hostAddress) | |
| { | |
| Console.WriteLine(hostAddress); | |
| const string Pattern = | |
| @"^((([0-9]{1,3}|\*)\.){3}([0-9]{1,3}|\*)|localhost):\d+$"; | |
| var regex = new Regex(Pattern, RegexOptions.Compiled); | |
| return regex.Match(hostAddress).Success; |
This file contains hidden or 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 method = typeof (MyClass).GetMethod("Finalize", | |
| BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.DeclaredOnly); |
This file contains hidden or 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 static void StartConnecting() | |
| { | |
| socket.BeginConnect(host, 6500, ConnectCallback, socket); | |
| } | |
| private static void ConnectCallback(IAsyncResult asyncResult) | |
| { | |
| try | |
| { | |
| Socket connectingSocket = (Socket) asyncResult.AsyncState; |
This file contains hidden or 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
| Prices should be decimal, not double. Use double for physical quantities like length and mass; use decimal for exact decimal quantities. – Eric Lippert 7 mins ago |
This file contains hidden or 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 Configuration | |
| { | |
| public string Sender { get; private set; } | |
| public string Recipient { get; private set; } | |
| public Configuration(string sender, string recipient) | |
| { | |
| Sender = sender; | |
| Recipient = recipient; | |
| } |
This file contains hidden or 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
| namespace Messaging | |
| { | |
| interface IHandler | |
| { | |
| } | |
| interface IMessageHandler<in MessageType> : IHandler | |
| { | |
| void ProcessMessage(MessageType message); |
This file contains hidden or 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
| namespace InputSimulator | |
| { | |
| public class MouseSimulator | |
| { | |
| private readonly InputDispatcher inputDispatcher = new InputDispatcher(); | |
| public void MoveMouseTo(int absoluteX, int absoluteY) | |
| { | |
| Input input = new Input(); | |
| input.Type = InputType.Mouse; |
This file contains hidden or 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
| $(".post_author").find("a:first").each(function() { | |
| var profileAddress = $(this).attr("href"); | |
| var profileUid = profileAddress.match(/profile&uid=(\d+)/)[1]; | |
| var upgraded = $(this).children("span"); | |
| if (upgraded.length > 0) { | |
| upgraded.text(profileUid); | |
| } else { | |
| $(this).text(profileUid); | |
| } |
This file contains hidden or 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
| s'il vous plaît |
This file contains hidden or 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
| // Testing Whether a Substring Exists | |
| var cookbookString = [ "Joe's Cooking Book","Sam's Cookbook", "Javascript CookBook", "Javascript BookCook"]; | |
| var pattern = /Cook.*Book/; | |
| cookbookString.forEach(function(element) { | |
| console.log(element + " " + pattern.test(element)); | |
| }); | |
| // Testing for Case-Insensitive Substring Matches | |
| var cookbookString = [ "Joe's Cooking Book","Sam's Cookbook", "Javascript CookBook", "Javascript BookCook"]; |