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 OrderingServiceImpl implements OrderingService { | |
@Override | |
public List<SearchResult> orderWithComparator(List<SearchResult>) { | |
return results | |
.stream() | |
.distinct() | |
.sorted((a, b) -> r.getName().compareTo(b.getName())) | |
.collect(toList()); | |
} | |
} |
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 OrderingServiceImpl implements OrderingService { | |
@Override | |
public List<SearchResult> orderWithComparator(List<SearchResult>) { | |
return results | |
.stream() | |
.distinct() | |
.sorted(Comparator.comparing(SearchResult::getName)) | |
.collect(toList()); | |
} | |
} |
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 SearchResultComparator implements Comparator<SearchResult> { | |
@Override | |
public int compare(final SearchResult o1, final SearchResult o2) { | |
// TODO: address null references for getName() | |
return o1.getName().compareToIgnoreCase(o2.getName()); | |
} | |
} | |
public class OrderingServiceImpl implements OrderingService { | |
@Override |
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
using System.Drawing; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
namespace Infra.Assets.TestUtils | |
{ | |
public static class TestHttpContentUtils | |
{ | |
const string FileFormFieldName = "file"; |
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<AuthenticationResult> Authenticate(Credentials credentials) | |
{ | |
var user = await SignInManager.UserManager.FindByEmailAsync(credentials.EmailAddress); | |
var signIn = await SignInManager.CheckPasswordSignInAsync(user, credentials.Password, false); | |
if (signIn.Succeeded) | |
return SuccessFor(user, JwtTokenFor(user)); | |
return Failure(); | |
} |
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<AuthenticationResult> Authenticate(Credentials credentials) | |
{ | |
var user = await SignInManager.UserManager.FindByEmailAsync(credentials.EmailAddress); | |
var signIn = await SignInManager.CheckPasswordSignInAsync(user, credentials.Password, false); | |
if (signIn.Succeeded) | |
return SuccessFor(user); | |
return Failure(); | |
} |
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
docker images | grep \<none\> | awk '{print $3}' | xargs docker rmi -f && \ | |
docker ps -a | grep Exited | awk '{print $1}' | xargs docker rm -f |
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
using System; | |
using System.Threading; | |
namespace Magicas { | |
public static class IoC<TInterface> { | |
private static ReaderWriterLockSlim syncLock = new ReaderWriterLockSlim(); | |
private static TInterface singleton; | |
public static TInterface Singleton => NewOrGetSingleton(); |
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
using System.Text.RegularExpressions; | |
using System.Linq; | |
using System.Text; | |
namespace Sample | |
{ | |
public class PhoneNumberFormatter | |
{ | |
private readonly string number; |
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
using Xunit; | |
namespace Sample | |
{ | |
public class PhoneNumberFormatterTest | |
{ | |
[Theory] | |
[InlineData( "44274499", "4427-4499")] | |
[InlineData( "944274499", "9-4427-4499")] | |
[InlineData( "1144274499", "11-4427-4499")] |
NewerOlder