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.Linq; | |
using System.Collections.Generic; | |
public class Test | |
{ | |
public static int[] ReadInput(){ | |
string line; | |
var elems = new List<int>(); | |
while ((line = System.Console.ReadLine()) != 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
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
using System.IO; | |
public class Test | |
{ | |
public static bool IsAnagram(string a, string b){ | |
return a.OrderBy(c => c).SequenceEqual(b.OrderBy(c => c)); | |
} |
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.Linq; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class DefaultableDictionary<TKey, TValue> : IDictionary<TKey, TValue> { | |
private readonly IDictionary<TKey, TValue> dictionary; | |
private readonly TValue defaultValue; | |
public DefaultableDictionary(IDictionary<TKey, TValue> dictionary, TValue defaultValue) { |
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.Linq; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class DefaultableDictionary<TKey, TValue> : IDictionary<TKey, TValue> { | |
private readonly IDictionary<TKey, TValue> dictionary; | |
private readonly TValue defaultValue; | |
public DefaultableDictionary(IDictionary<TKey, TValue> dictionary, TValue defaultValue) { |
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
public class LazyConcurrentDictionary<TKey, TValue> | |
{ | |
private readonly ConcurrentDictionary<TKey, Lazy<TValue>> _concurrentDictionary; | |
public LazyConcurrentDictionary() | |
{ | |
_concurrentDictionary = new ConcurrentDictionary<TKey, Lazy<TValue>>(); | |
} | |
public TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory) |
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.Linq; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
using Xunit; | |
namespace OrAndAndInNewtonSoftJson | |
{ | |
public class NewtonSoftJsonTests | |
{ | |
[Fact] |
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
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | |
<script src="https://rawgit.com/dchester/jsonpath/master/jsonpath.js"></script> | |
</head> | |
<body> | |
Contexts: | |
<div><input type="text" class="contextInput"></input></div> | |
<div><input type="text" class="contextInput"></input></div> | |
<div><input type="text" class="contextInput"></input></div> |
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
public static class CaseInsensitiveStringExtensions | |
{ | |
public static bool CaseInsensitiveContains(this string source, string toCheck) | |
{ | |
return source.IndexOf(toCheck, StringComparison.OrdinalIgnoreCase) >= 0; | |
} | |
public static bool CaseInsensitiveStartsWith(this string source, string startsWith) | |
{ | |
return source.EndsWith(startsWith, StringComparison.OrdinalIgnoreCase); |
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
if object_id(N'RatingAggregate', N'U') is not null | |
drop table RatingAggregate | |
go | |
if object_id(N'Ratings', N'U') is not null | |
drop table Ratings | |
go | |
if object_id(N'Movies', N'U') is not null | |
drop table Movies | |
go | |
create table Movies( |
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
-- function declaration | |
if object_id(N'MovieController_Details', N'FN') is not null | |
drop function MovieController_Details | |
go | |
create function MovieController_Details | |
( | |
@Id int | |
) | |
returns xml | |
as |
NewerOlder