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
const handle = promise => promise | |
.then(res => [null, res]) | |
.catch(err => [err, null]); |
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
var subset = new[] { 2, 4, 6, 8 }; | |
var superset = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; | |
// (when comparing small sets, consider O(n*m) solution:) | |
public static bool ContainsAll<T>(this IEnumerable<T> source, IEnumerable<T> values) | |
{ | |
bool contained = !subset.Except(superset).Any | |
return contained; |
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
using System; | |
using System.Collections.Generic; | |
namespace Next.Whs.DDespatch.Framework.Models.Mapping.Custom | |
{ | |
public class ExampleImplementationClass | |
{ | |
public ExampleImplementationClass() | |
{ | |
MapperBase<Entity, DTO> userMapper = new UserMapper(); |
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
var idsOnly = new List<int>(); | |
var myList = db.Items.Where(item => idsOnly.Contains(item.ID.Value)) | |
.Select(a => a.Title).ToList(); |
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
[TestMethod] | |
[ExpectedException(typeof(ArgumentException), | |
"A userId of null was inappropriately allowed.")] | |
public void NullUserIdInConstructor() | |
{ | |
LogonInfo logonInfo = new LogonInfo(null, "P@ss0word"); | |
} |
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
[TestMethod] | |
[ExpectedException(typeof(ArgumentException), | |
"A userId of null was inappropriately allowed.")] | |
public void NullUserIdInConstructor() | |
{ | |
LogonInfo logonInfo = new LogonInfo(null, "P@ss0word"); | |
} |
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
string name = new System.Diagnostics.StackTrace().GetFrame(1).GetMethod().Name; | |
Console.WriteLine(name); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<RunSettings> | |
<!-- Configurations that affect the Test Framework --> | |
<RunConfiguration> | |
<MaxCpuCount>1</MaxCpuCount> | |
<!-- Path relative to solution directory --> | |
<ResultsDirectory>.\TestResults</ResultsDirectory> | |
<!-- x86 or x64 --> | |
<!-- You can also change it from menu Test > Test Settings > Default Processor Architecture --> |
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
string keys = string.Join(",", table.Keys.Cast<object>() | |
.Select(x => x.ToString()) | |
.ToArray()); |
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
IMedia content = UmbracoContext.Current.Application.Services.MediaService.GetById(Guid.Parse("bc6de686-25fa-49fa-a46b-a2a19c70bd8b")); |