Skip to content

Instantly share code, notes, and snippets.

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)
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));
}
@lemmit
lemmit / AoC3.cs
Created December 11, 2017 10:13
AoC03.cs
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) {
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) {
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)
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Xunit;
namespace OrAndAndInNewtonSoftJson
{
public class NewtonSoftJsonTests
{
[Fact]
<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>
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);
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(
-- 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