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
| FluentValidationModelValidatorProvider.Configure(GlobalConfiguration.Configuration, config => | |
| { | |
| config.ValidatorFactory = new WebApiValidatorFactory(GlobalConfiguration.Configuration); | |
| }); | |
| public class WebApiValidatorFactory : ValidatorFactoryBase | |
| { | |
| private readonly HttpConfiguration _configuration; | |
| public WebApiValidatorFactory(HttpConfiguration configuration) |
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
| ### Keybase proof | |
| I hereby claim: | |
| * I am khalidabuhakmeh on github. | |
| * I am khalidabuhakmeh (https://keybase.io/khalidabuhakmeh) on keybase. | |
| * I have a public key whose fingerprint is 4292 F2BE 8F4F 22A3 7EB3 313C EE64 C1F6 9463 EB97 | |
| To claim this, I am signing this object: |
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 StructureMapDependencyResolver : ServiceLocatorImplBase | |
| { | |
| private const string StructuremapNestedContainerKey = "Structuremap.Nested.Container"; | |
| public IContainer Container { get; set; } | |
| private HttpContextBase HttpContext | |
| { | |
| get | |
| { | |
| // All the user to register where the context comes from |
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
| PerfMatter.TitleResolver = DependencyResolver.Current.GetService<ITitleResolver>(); | |
| public class MyTitleResolver : ITitleResolver { | |
| // pass in whatever values you need | |
| // The FlushHead() method automatically copies over any ViewData/ViewBag state, accepts an optional title parameter as well an optional model parameter, if required. Pass it in here | |
| public string Resolve(IDictionary<string,object> values) { | |
| var title = ""; | |
| // Figure out the title based on the context | |
| return title; |
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 BusinessMappingTests | |
| { | |
| public BusinessMappingTests() | |
| { | |
| Mapper.Initialize(cfg => cfg.AddProfile<BusinessMappingProfile>()); | |
| Mapper.AssertConfigurationIsValid(); | |
| } | |
| [Fact] | |
| public void Can_map_editmodel_to_business() |
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 async Task Refresh(ClaimsIdentity claim, bool? rememberMe) | |
| { | |
| var current = _authenticationManager.User; | |
| var remember = current.Claims.FirstOrDefault(x => x.Type == ClaimTypes.IsPersistent); | |
| if (rememberMe.HasValue) { | |
| // remember the "remember me" :) | |
| claim.AddClaim(new Claim(ClaimTypes.IsPersistent, rememberMe.ToString())); | |
| } | |
| else if (claim != null) { |
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 ActionResult Index() { | |
| return ProgressFlushResult(x => { | |
| x.PartialView("First"); | |
| x.PartialView("Second"); | |
| x.PartialView("Third"); | |
| }); | |
| } |
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 username = **YOUR USERNAME**; | |
| var password = **YOUR PASSWORD**; | |
| var url = "http://hackers-endpoint.com?username={0}&password={1}"; | |
| var client = new HttpClient(); | |
| var response = await client.GetAsync(string.Format(url, username, password)); | |
| response.EnsureSuccessStatusCode(); | |
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
| // put this in your browser | |
| https://api.github.com/search/code?q=kotlin+repo:hhariri/hhariri.github.io | |
| // Get a list of JSON results back :) | |
| // Potentially do some JSON / JavaScript magic to show the results and links. |
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
| [Documentation(Section = "Math", | |
| Intro = "addition_intro.md", | |
| Conclusion = "addition_conclusion.md", | |
| Order = 1 )] | |
| public class Addition | |
| { | |
| [Fact] | |
| [Documentation(Title = "Adding Two Numbers", Intro = "adding_two_numbers.md", Order = 1)] | |
| public void Adding_two_numbers() | |
| { |