text:
"use strict";
define(['app','vendors/bootstrap'], function (app) {
	app.register.directive('aModal',['AtomicPath',function (aPath) {
		return {
			restrict: 'E',
			scope:{
				id:'@',
				title:'@',
				isLarge:'=?',
			},
			replace:true,
			transclude:true,
			templateUrl:function(elem,attr){
				return aPath.url('/view/atom/aModal.html');
			},
			link: function($scope,elem, attrs) {
				$scope.ResolveData = $scope.data;
				$scope.aModalId = $scope.id;
				$scope.aModalTitle = $scope.title;
				if($scope.isLarge){
					$scope.OptClass = 'modal-lg';
				}
				$scope.$watch('title',function(val){
					$scope.aModalTitle = val;
				});
			},
		}
	}]);
	app.register.directive('aModalHeader',['AtomicPath',function (aPath) {
		return {
			restrict: 'E',
			scope:{
				title:'=',
			},
			replace:true,
			templateUrl:function(elem,attr){
				return aPath.url('/view/atom/aModalHeader.html');
			}
		}
	}]);
	app.register.directive('aModalBody',['AtomicPath',function (aPath) {
		return {
			restrict: 'E',
			scope:{
				title:'=',
			},
			replace:true,
			transclude:true,
			templateUrl:function(elem,attr){
				return aPath.url('/view/atom/aModalBody.html');
			}
		}
	}]);
	app.register.directive('aModalFooter',['AtomicPath',function (aPath) {
		return {
			restrict: 'E',
			scope:{
				title:'=',
			},
			replace:true,
			transclude:true,
			templateUrl:function(elem,attr){
				return aPath.url('/view/atom/aModalFooter.html');
			}
		}
	}]);
	app.register.factory("aModal",[function(){
		return {
			open:function(id){
				return $('.modal[data-modal-id="'+id+'"]').modal({backdrop:'static'});
			},
			close:function(id){
				return $('.modal[data-modal-id="'+id+'"]').modal('hide');
			},

		};
	}]);

});

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/**
 * @author Borut Balazek <bobalazek124@gmail.com>
 */
namespace Game.Core {
	[Serializable]
	public class Options {
		// TODO: Implement ootii - EasyInput!
		// TODO: Fix gamepad stuff. Currently not working.

		/***** Game *****/
		public int gameDifficulty = 1; // 0 - Easy; 1 - Normal; 2 - Hard

		/***** Display *****/
		public int displayHUD = 1; // 0 - false; 1 - true
		public int displayMap = 1; // 0 - false; 1 - true
		public int displayFPSCounter = 0; // 0 - false; 1 - true

		/***** Video *****/
		public int videoFullscreen = 1; // 0 - false; 1 - true
		public string videoResolutionString = "800x600@60Hz";
		public int videoResolution = 0;
		public int videoTextureQuality = 1; // 0 - Low; 1 - Medium; 2 - High; 3 - Very High
		public int videoAntiAliasing = 1; // 0 - Off; 1 - 2x; 2 - 4x; 3 - 8x
		public int videoShadows = 1; // 0 - Off; 1 - Normal; 2 - High
		public int videoShadowResolution = 1; // 0 - Low; 1 - Medium; 2 - High; 3 - Very High
		public int videoVSync = 1; // 0 - Off; 1 - Normal; 2 - High

		/***** Audio *****/
		public float audioMasterVolume = 1f;
		public float audioMusicVolume = 1f;
		public float audioEffectsVolume = 1f;
		public float audioUIVolume = 1f;
		public float audioInGameVolume = 1f;

		/***** Controls *****/
		/** Inverse look **/
		public int controlsInverseLookMouse = 0; // 0 - false; 1 - true
		public int controlsInverseLookJoystick = 0; // 0 - false; 1 - true

		/** Look sensitivity **/
		public float controlsLookSensitivityMouse = 1f;
		public float controlsLookSensitivityJoystick = 1f;

		/** Joystick Look Axes **/
		// The Look axed differ from joystick to joystick,
		//   but the movement (Horizontal) axes are always the same &
		//   saved inside the Horizontal / Vertical axes.
		public KeyCode controlsJoystickLookXAxis = KeyCode.JoystickButton4;
		public KeyCode controlsJoystickLookYAxis = KeyCode.JoystickButton5;

		/***** Key Bindings *****/
		/*** Forward / Backward - Vertical ***/
		/* Forward */
		public KeyCode keyBindingsForward = KeyCode.UpArrow;
		public KeyCode keyBindingsForwardSecondary = KeyCode.W;
		// public KeyCode keyBindgingsForwardJoystick; // Not needed. Will be the "Vertical" / Y-axis on the joystick

		/* Backward */
		public KeyCode keyBindingsBackward = KeyCode.DownArrow;
		public KeyCode keyBindingsBackwardSecondary = KeyCode.S;
		// public KeyCode keyBindingsBackwardJoystick; // Not needed. Will be the "Vertical" / Y-axis on the joystick

		/*** Turn - Horizontal ***/
		/* Left */
		public KeyCode keyBindingsTurnLeft = KeyCode.LeftArrow;
		public KeyCode keyBindingsTurnLeftSecondary = KeyCode.A;
		// public KeyCode keyBindingsTurnLeftJoystick; // Not needed. Will be the "Horizontal" / X-axis on the joystick

		/* Right */
		public KeyCode keyBindingsTurnRight = KeyCode.RightArrow;
		public KeyCode keyBindingsTurnRightSecondary = KeyCode.D;
		// public KeyCode keyBindingsTurnRightJoystick; // Not needed. Will be the "Horizontal" / X-axis on the joystick

		/*** Strafe ***/
		/* Left */
		public KeyCode keyBindingsStrafeLeft = KeyCode.Q;
		public KeyCode keyBindingsStrafeLeftSecondary;
		public KeyCode keyBindingsStrafeLeftJoystick = KeyCode.JoystickButton12;

		/* Right */
		public KeyCode keyBindingsStrafeRight = KeyCode.E;
		public KeyCode keyBindingsStrafeRightSecondary;
		public KeyCode keyBindingsStrafeRightJoystick = KeyCode.JoystickButton13;

		/*** Actions ***/
		/* Attack */
		public KeyCode keyBindingsAttack = KeyCode.R;
		public KeyCode keyBindingsAttackSecondary;
		public KeyCode keyBindingsAttackJoystick = KeyCode.JoystickButton2;

		/* Use */
		public KeyCode keyBindingsUse = KeyCode.F;
		public KeyCode keyBindingsUseSecondary;
		public KeyCode keyBindingsUseJoystick = KeyCode.JoystickButton3;

		/* Crouch */
		public KeyCode keyBindingsCrouch = KeyCode.LeftControl;
		public KeyCode keyBindingsCrouchSecondary;
		public KeyCode keyBindingsCrouchJoystick = KeyCode.JoystickButton4;

		/* Walk */
		public KeyCode keyBindingsWalk = KeyCode.Y;
		public KeyCode keyBindingsWalkSecondary;
		public KeyCode keyBindingsWalkJoystick = KeyCode.JoystickButton5;

		/* Run */
		// TBD: That's the default state, not really needed anymore
		public KeyCode keyBindingsRun;
		public KeyCode keyBindingsRunSecondary;
		public KeyCode keyBindingsRunJoystick;

		/* Sprint */
		public KeyCode keyBindingsSprint = KeyCode.LeftShift;
		public KeyCode keyBindingsSprintSecondary;
		public KeyCode keyBindingsSprintJoystick = KeyCode.JoystickButton5;

		/* Jump */
		public KeyCode keyBindingsJump = KeyCode.Space;
		public KeyCode keyBindingsJumpSecondary;
		public KeyCode keyBindingsJumpJoystick = KeyCode.JoystickButton0;

		/* Switch camera perspective */
		public KeyCode keyBindingsSwitchCameraPerspective = KeyCode.C;
		public KeyCode keyBindingsSwitchCameraPerspectiveSecondary;
		public KeyCode keyBindingsSwithcCameraPerspectiveJoystick = KeyCode.JoystickButton5;

		/* Pause */
		public KeyCode keyBindingsPause = KeyCode.Escape;
		public KeyCode keyBindingsPauseSecondary = KeyCode.Pause;
		public KeyCode keyBindingsPauseJoystick = KeyCode.JoystickButton6;
	}
}


text:
// Gulp core
var gulp = require('gulp');

// minification and concatenation
var usemin = require('gulp-usemin');

// utils
var gutil = require('gulp-util');
var clean = require('gulp-clean');
var notify = require('gulp-notify');

// Linting Tools
var jshint = require('gulp-jshint');
var jshintStylish = require('jshint-stylish');
var csslint = require('gulp-csslint');

// Preprocessors
var less = require('gulp-less');
var coffee = require('gulp-coffee');

// Image handling
var imagemin = require('gulp-imagemin');
var cache = require('gulp-cache'); // cache files

/* Tasks in Gulp run concurrently together and have no order in which they'll
finish, so we need to make sure the clean task is completed before running
additional tasks.

Note: Are your tasks running before the dependencies are complete?
Make sure your dependency tasks are correctly using the async run hints:
take in a callback or return a promise or event stream.
 */

gulp.task('default', ['copy'], function() {
	gulp.start('imagemin', 'usemin');

});

gulp.task('compile', function() {
	return gulp.start('compile-less-all','compile-coffee-all');
});

gulp.task('compile-less-all', function() {

	return gulp.src('public/less/**/*.less')
	.pipe(less())
	.pipe(gulp.dest('public/css'))
	.pipe(notify({ message: 'Compile-less-all task complete' }));
});

/* Sintax errors on Coffee files will blow up your gulp!
You need to catch de error to avoid this*/
gulp.task('compile-coffee-all', function() {

	return gulp.src('public/coffee/**/*.coffee')
	.pipe(coffee().on('error', gutil.log))
	.pipe(gulp.dest('public/js'))
	.pipe(notify({ message: 'Compile-coffe-all task complete' }));
});

gulp.task('clean', function() {
    /* without return, we have a problem. It seems that the next task
    is executed before this task completes
	*/
	return gulp.src('dist', {read: false})
	.pipe(clean())
	.pipe(notify({ message: 'Clean task complete' }));

});

gulp.task('copy', ['clean', 'compile'], function() {

	return gulp.src('public/**/*')
	.pipe(gulp.dest('dist'))
	.pipe(notify({message: 'Copy task complete'}));
});

gulp.task('imagemin', function() {

	return gulp.src('dist/img/**/*')
    .pipe(cache(imagemin({ optimizationLevel: 7, progressive: true, interlaced: true })))
    .pipe(gulp.dest('dist/img'))
    .pipe(notify({ message: 'Imagemin task complete' }));
});

gulp.task('usemin', function() {
  return gulp.src('dist/**/*.html')
    .pipe(usemin({
      cssmin: true,
      htmlmin: true,
      jsmin: true
    }))
    .pipe(gulp.dest('dist'));
});

gulp.task('server', function() {

	 gulp.watch('public/less/**/*.less', function(event) {
	 	var msg =  'LESS COMPILED: ' + event.path;
	 	gulp.src(event.path)
		.pipe(less())
		.pipe(gulp.dest('public/css'))
		.pipe(notify({ message: msg}));
		gutil.log(msg);

	 });

	 gulp.watch('public/coffee/**/*.coffee', function(event) {
	 	var msg =  'COFFESCRIPT COMPILED: ' + event.path;
	 	gutil.log('File '+event.path+' was '+event.type+', running tasks...');
	 	gulp.src(event.path)
		.pipe(coffee().on('error', gutil.log))
		.pipe(gulp.dest('public/js'))
		.pipe(notify({ message: msg}));
		gutil.log(msg);

	 });

	 gulp.watch('public/js/**/*.js', function(event) {
	 	var msg =  'JSHINTED: ' + event.path;
	 	gulp.src(event.path)
	 	.pipe(jshint())
	 	.pipe(jshint.reporter(jshintStylish))
	 	.pipe(notify({ message: msg}));
		gutil.log(msg);
	 });

	 gulp.watch('public/css/**/*.css', function(event) {
	 	var msg =  'CSSLINTED: ' + event.path;
	 	gulp.src(event.path)
	 	.pipe(csslint())
	 	.pipe(csslint.reporter())
	 	.pipe(notify({ message: msg}));
		gutil.log(msg);
	 });
});


text:
{-
-- Changes by Bjorn Bringert:
--
-- * produces XHTML 1.0 Transitional (<http://www.w3.org/TR/xhtml1/>)
--
-- * escapes characters inside attribute values
--
-- * changed 'height' to a String attribute
--
-- * added 'Monoid' instance for 'Html'.
--
-- * added elements from HTML 4.0: 'abbr', 'acronym', 'bdo', 'button', 'col',
--  'colgroup', 'del', 'iframe', 'ins', 'label', 'legend', 'noframes',
--  'noscript', 'object', 'optgroup', 'script', 'strike', 'tbody', 'tfoot',
--  'thead', and 'quote'.
--
-- * 'defList' no longer makes terms bold.
--
-- * deprecated functions for elements and attributes
--   deprecated in HTML 4.0
--
-- * hid or removed some internal functions.
--
-- TODO:
--
-- * add new attributes introduced in HTML 4.0
--
-- * character encoding
-}
module Text.XHtml (
                   module Text.XHtml.Transitional,
                   module Text.XHtml.Table,
                   module Text.XHtml.Debug
      ) where

import Text.XHtml.Transitional
import Text.XHtml.Table
import Text.XHtml.Debug


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

// NOTE: This code is derived from an implementation originally in dotnet/runtime:
// https://raw.githubusercontent.com/dotnet/runtime/v6.0.0-preview.5.21301.5/src/libraries/System.Collections.Immutable/tests/ImmutableListTest.cs
//
// See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the
// reference implementation.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis.Collections;
using Roslyn.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.UnitTests.Collections
{
    public class ImmutableSegmentedListTest : ImmutableListTestBase
    {
        private enum Operation
        {
            Add,
            AddRange,
            Insert,
            InsertRange,
            RemoveAt,
            RemoveRange,
            Last,
        }

        [Fact]
        public void RandomOperationsTest()
        {
            int operationCount = RandomOperationsCount;
            var expected = new List<int>();
            var actual = ImmutableSegmentedList<int>.Empty;

            int seed = unchecked((int)DateTime.Now.Ticks);
            Debug.WriteLine("Using random seed {0}", seed);
            var random = new Random(seed);

            for (int iOp = 0; iOp < operationCount; iOp++)
            {
                switch ((Operation)random.Next((int)Operation.Last))
                {
                    case Operation.Add:
                        int value = random.Next();
                        Debug.WriteLine("Adding \"{0}\" to the list.", value);
                        expected.Add(value);
                        actual = actual.Add(value);
                        break;
                    case Operation.AddRange:
                        int inputLength = random.Next(100);
                        int[] values = Enumerable.Range(0, inputLength).Select(i => random.Next()).ToArray();
                        Debug.WriteLine("Adding {0} elements to the list.", inputLength);
                        expected.AddRange(values);
                        actual = actual.AddRange(values);
                        break;
                    case Operation.Insert:
                        int position = random.Next(expected.Count + 1);
                        value = random.Next();
                        Debug.WriteLine("Adding \"{0}\" to position {1} in the list.", value, position);
                        expected.Insert(position, value);
                        actual = actual.Insert(position, value);
                        break;
                    case Operation.InsertRange:
                        inputLength = random.Next(100);
                        values = Enumerable.Range(0, inputLength).Select(i => random.Next()).ToArray();
                        position = random.Next(expected.Count + 1);
                        Debug.WriteLine("Adding {0} elements to position {1} in the list.", inputLength, position);
                        expected.InsertRange(position, values);
                        actual = actual.InsertRange(position, values);
                        break;
                    case Operation.RemoveAt:
                        if (expected.Count > 0)
                        {
                            position = random.Next(expected.Count);
                            Debug.WriteLine("Removing element at position {0} from the list.", position);
                            expected.RemoveAt(position);
                            actual = actual.RemoveAt(position);
                        }

                        break;
                    case Operation.RemoveRange:
                        position = random.Next(expected.Count);
                        inputLength = random.Next(expected.Count - position);
                        Debug.WriteLine("Removing {0} elements starting at position {1} from the list.", inputLength, position);
                        expected.RemoveRange(position, inputLength);
                        actual = actual.RemoveRange(position, inputLength);
                        break;
                }

                Assert.Equal<int>(expected, actual);
            }
        }

        [Fact]
        public void EmptyTest()
        {
            var empty = ImmutableSegmentedList<GenericParameterHelper?>.Empty;
            Assert.True(IsSame(empty, ImmutableSegmentedList<GenericParameterHelper>.Empty));
            Assert.True(IsSame(empty, empty.Clear()));
            Assert.True(IsSame(empty, ((System.Collections.Immutable.IImmutableList<GenericParameterHelper>)empty).Clear()));
            Assert.True(empty.IsEmpty);
            Assert.Equal(0, empty.Count);
            Assert.Equal(-1, empty.IndexOf(new GenericParameterHelper()));
            Assert.Equal(-1, empty.IndexOf(null));
        }

        [Fact]
        public void GetHashCodeVariesByInstance()
        {
            Assert.NotEqual(ImmutableSegmentedList.Create<int>().GetHashCode(), ImmutableSegmentedList.Create(5).GetHashCode());
        }

        [Fact]
        public void AddAndIndexerTest()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            for (int i = 1; i <= 10; i++)
            {
                list = list.Add(i * 10);
                Assert.False(list.IsEmpty);
                Assert.Equal(i, list.Count);
            }

            for (int i = 1; i <= 10; i++)
            {
                Assert.Equal(i * 10, list[i - 1]);
            }

            var bulkList = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(1, 10).Select(i => i * 10));
            Assert.Equal<int>(list.ToArray(), bulkList.ToArray());
        }

        [Fact]
        public void AddRangeTest()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            list = list.AddRange(new[] { 1, 2, 3 });
            list = list.AddRange(Enumerable.Range(4, 2));
            list = list.AddRange(ImmutableSegmentedList<int>.Empty.AddRange(new[] { 6, 7, 8 }));
            list = list.AddRange(new int[0]);
            list = list.AddRange(ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(9, 1000)));
            Assert.Equal(Enumerable.Range(1, 1008), list);
        }

        [Fact]
        public void AddRange_IOrderedCollection()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            ImmutableSegmentedList<int>.Builder builder = ImmutableSegmentedList.CreateBuilder<int>();
            builder.Add(1);

            list = list.AddRange(builder);
            Assert.Equal(new int[] { 1 }, list);
        }

        [Fact]
        public void AddRangeOptimizationsTest()
        {
            // All these optimizations are tested based on filling an empty list.
            var emptyList = ImmutableSegmentedList.Create<string>();

            // Adding an empty list to an empty list should yield the original list.
            Assert.True(IsSame(emptyList, emptyList.AddRange(new string[0])));

            // Adding a non-empty immutable list to an empty one should return the added list.
            var nonEmptyListDefaultComparer = ImmutableSegmentedList.Create("5");
            Assert.True(IsSame(nonEmptyListDefaultComparer, emptyList.AddRange(nonEmptyListDefaultComparer)));

            // Adding a Builder instance to an empty list should be seen through.
            var builderOfNonEmptyListDefaultComparer = nonEmptyListDefaultComparer.ToBuilder();
            Assert.True(IsSame(nonEmptyListDefaultComparer, emptyList.AddRange(builderOfNonEmptyListDefaultComparer)));
        }

        [Fact]
        public void AddRangeBalanceTest()
        {
            int randSeed = unchecked((int)DateTime.Now.Ticks);
            Debug.WriteLine("Random seed: {0}", randSeed);
            var random = new Random(randSeed);

            int expectedTotalSize = 0;

            var list = ImmutableSegmentedList<int>.Empty;

            // Add some small batches, verifying balance after each
            for (int i = 0; i < 128; i++)
            {
                int batchSize = random.Next(32);
                Debug.WriteLine("Adding {0} elements to the list", batchSize);
                list = list.AddRange(Enumerable.Range(expectedTotalSize + 1, batchSize));
                expectedTotalSize += batchSize;
            }

            // Add a single large batch to the end
            int largeBatchSize = random.Next(32768) + 32768;
            Debug.WriteLine("Adding {0} elements to the list", largeBatchSize);
            list = list.AddRange(Enumerable.Range(expectedTotalSize + 1, largeBatchSize));
            expectedTotalSize += largeBatchSize;

            Assert.Equal(Enumerable.Range(1, expectedTotalSize), list);
        }

        [Fact]
        public void InsertRangeRandomBalanceTest()
        {
            int randSeed = unchecked((int)DateTime.Now.Ticks);
            Debug.WriteLine("Random seed: {0}", randSeed);
            var random = new Random(randSeed);

            var immutableList = ImmutableSegmentedList.CreateBuilder<int>();
            var list = new List<int>();

            const int maxBatchSize = 32;
            int valueCounter = 0;
            for (int i = 0; i < 24; i++)
            {
                int startPosition = random.Next(list.Count + 1);
                int length = random.Next(maxBatchSize + 1);
                int[] values = new int[length];
                for (int j = 0; j < length; j++)
                {
                    values[j] = ++valueCounter;
                }

                immutableList.InsertRange(startPosition, values);
                list.InsertRange(startPosition, values);

                Assert.Equal(list, immutableList);
            }
        }

        [Fact]
        public void InsertTest()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.Insert(1, 5));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.Insert(-1, 5));

            list = list.Insert(0, 10);
            list = list.Insert(1, 20);
            list = list.Insert(2, 30);

            list = list.Insert(2, 25);
            list = list.Insert(1, 15);
            list = list.Insert(0, 5);

            Assert.Equal(6, list.Count);
            var expectedList = new[] { 5, 10, 15, 20, 25, 30 };
            var actualList = list.ToArray();
            Assert.Equal<int>(expectedList, actualList);

            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.Insert(7, 5));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.Insert(-1, 5));
        }

        [Fact]
        public void InsertBalanceTest()
        {
            var list = ImmutableSegmentedList.Create(1);

            list = list.Insert(0, 2);
            list = list.Insert(1, 3);
        }

        [Fact]
        public void InsertRangeTest()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(1, new[] { 1 }));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, new[] { 1 }));

            list = list.InsertRange(0, new[] { 1, 4, 5 });
            list = list.InsertRange(1, new[] { 2, 3 });
            list = list.InsertRange(2, new int[0]);
            Assert.Equal(Enumerable.Range(1, 5), list);

            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(6, new[] { 1 }));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, new[] { 1 }));
        }

        [Fact]
        public void InsertRangeImmutableTest()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            var nonEmptyList = ImmutableSegmentedList.Create(1);
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(1, nonEmptyList));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, nonEmptyList));

            list = list.InsertRange(0, ImmutableSegmentedList.Create(1, 104, 105));
            list = list.InsertRange(1, ImmutableSegmentedList.Create(2, 3));
            list = list.InsertRange(2, ImmutableSegmentedList<int>.Empty);
            list = list.InsertRange(3, ImmutableSegmentedList<int>.Empty.InsertRange(0, Enumerable.Range(4, 100)));
            Assert.Equal(Enumerable.Range(1, 105), list);

            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(106, nonEmptyList));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.InsertRange(-1, nonEmptyList));
        }

        [Fact]
        public void NullHandlingTest()
        {
            var list = ImmutableSegmentedList<GenericParameterHelper?>.Empty;
            Assert.False(list.Contains(null));
            Assert.Equal(-1, list.IndexOf(null));

            list = list.Add((GenericParameterHelper?)null);
            Assert.Equal(1, list.Count);
            Assert.Null(list[0]);
            Assert.True(list.Contains(null));
            Assert.Equal(0, list.IndexOf(null));

            list = list.Remove((GenericParameterHelper?)null);
            Assert.Equal(0, list.Count);
            Assert.True(list.IsEmpty);
            Assert.False(list.Contains(null));
            Assert.Equal(-1, list.IndexOf(null));
        }

        [Fact]
        public void Remove_NullEqualityComparer()
        {
            var collection = ImmutableSegmentedList.Create(1, 2, 3);
            var modified = collection.Remove(2, null);
            Assert.Equal(new[] { 1, 3 }, modified);

            // Try again through the explicit interface implementation.
            System.Collections.Immutable.IImmutableList<int> collectionIface = collection;
            var modified2 = collectionIface.Remove(2, null);
            Assert.Equal(new[] { 1, 3 }, modified2);
        }

        [Fact]
        public void RemoveTest()
        {
            ImmutableSegmentedList<int> list = ImmutableSegmentedList<int>.Empty;
            for (int i = 1; i <= 10; i++)
            {
                list = list.Add(i * 10);
            }

            list = list.Remove(30);
            Assert.Equal(9, list.Count);
            Assert.False(list.Contains(30));

            list = list.Remove(100);
            Assert.Equal(8, list.Count);
            Assert.False(list.Contains(100));

            list = list.Remove(10);
            Assert.Equal(7, list.Count);
            Assert.False(list.Contains(10));

            var removeList = new int[] { 20, 70 };
            list = list.RemoveAll(removeList.Contains);
            Assert.Equal(5, list.Count);
            Assert.False(list.Contains(20));
            Assert.False(list.Contains(70));

            System.Collections.Immutable.IImmutableList<int> list2 = ImmutableSegmentedList<int>.Empty;
            for (int i = 1; i <= 10; i++)
            {
                list2 = list2.Add(i * 10);
            }

            list2 = System.Collections.Immutable.ImmutableList.Remove(list2, 30);
            Assert.Equal(9, list2.Count);
            Assert.False(list2.Contains(30));

            list2 = System.Collections.Immutable.ImmutableList.Remove(list2, 100);
            Assert.Equal(8, list2.Count);
            Assert.False(list2.Contains(100));

            list2 = System.Collections.Immutable.ImmutableList.Remove(list2, 10);
            Assert.Equal(7, list2.Count);
            Assert.False(list2.Contains(10));

            list2 = list2.RemoveAll(removeList.Contains);
            Assert.Equal(5, list2.Count);
            Assert.False(list2.Contains(20));
            Assert.False(list2.Contains(70));
        }

        [Fact]
        public void RemoveNonExistentKeepsReference()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            Assert.True(IsSame(list, list.Remove(3)));
        }

        /// <summary>
        /// Verifies that RemoveRange does not enumerate its argument if the list is empty
        /// and therefore could not possibly have any elements to remove anyway.
        /// </summary>
        /// <remarks>
        /// While this would seem an implementation detail and simply an optimization,
        /// it turns out that changing this behavior now *could* represent a breaking change
        /// because if the enumerable were to throw an exception, that exception would not be
        /// observed previously, but would start to be thrown if this behavior changed.
        /// So this is a test to lock the behavior in place.
        /// </remarks>
        /// <!--<seealso cref="ImmutableSetTest.ExceptDoesEnumerateSequenceIfThisIsEmpty"/>-->
        [Fact]
        public void RemoveRangeDoesNotEnumerateSequenceIfThisIsEmpty()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            list.RemoveRange(Enumerable.Range(1, 1).Select<int, int>(n => { throw ExceptionUtilities.Unreachable(); }));
        }

        [Fact]
        public void RemoveAtTest()
        {
            var list = ImmutableSegmentedList<int>.Empty;
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.RemoveAt(0));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.RemoveAt(-1));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.RemoveAt(1));

            for (int i = 1; i <= 10; i++)
            {
                list = list.Add(i * 10);
            }

            list = list.RemoveAt(2);
            Assert.Equal(9, list.Count);
            Assert.False(list.Contains(30));

            list = list.RemoveAt(8);
            Assert.Equal(8, list.Count);
            Assert.False(list.Contains(100));

            list = list.RemoveAt(0);
            Assert.Equal(7, list.Count);
            Assert.False(list.Contains(10));
        }

        [Fact]
        public void IndexOfAndContainsTest()
        {
            var expectedList = new List<string>(new[] { "Microsoft", "Windows", "Bing", "Visual Studio", "Comics", "Computers", "Laptops" });

            var list = ImmutableSegmentedList<string>.Empty;
            foreach (string newElement in expectedList)
            {
                Assert.False(list.Contains(newElement));
                list = list.Add(newElement);
                Assert.True(list.Contains(newElement));
                Assert.Equal(expectedList.IndexOf(newElement), list.IndexOf(newElement));
                Assert.Equal(expectedList.IndexOf(newElement), System.Collections.Immutable.ImmutableList.IndexOf(list, newElement.ToUpperInvariant(), StringComparer.OrdinalIgnoreCase));
                Assert.Equal(-1, list.IndexOf(newElement.ToUpperInvariant()));

                foreach (string existingElement in expectedList.TakeWhile(v => v != newElement))
                {
                    Assert.True(list.Contains(existingElement));
                    Assert.Equal(expectedList.IndexOf(existingElement), list.IndexOf(existingElement));
                    Assert.Equal(expectedList.IndexOf(existingElement), System.Collections.Immutable.ImmutableList.IndexOf(list, existingElement.ToUpperInvariant(), StringComparer.OrdinalIgnoreCase));
                    Assert.Equal(-1, list.IndexOf(existingElement.ToUpperInvariant()));
                }
            }
        }

        [Fact]
        public void Indexer()
        {
            var list = ImmutableSegmentedList.CreateRange(Enumerable.Range(1, 3));
            Assert.Equal(1, list[0]);
            Assert.Equal(2, list[1]);
            Assert.Equal(3, list[2]);

            Assert.Throws<ArgumentOutOfRangeException>("index", () => list[3]);
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list[-1]);

            Assert.Equal(3, ((IList)list)[2]);
            Assert.Equal(3, ((IList<int>)list)[2]);
        }

        [Fact]
        public void IndexOf()
        {
            IndexOfTests.IndexOfTest(
                seq => ImmutableSegmentedList.CreateRange(seq),
                (b, v) => b.IndexOf(v),
                (b, v, i) => System.Collections.Immutable.ImmutableList.IndexOf(b, v, i),
                (b, v, i, c) => System.Collections.Immutable.ImmutableList.IndexOf(b, v, i, c),
                (b, v, i, c, eq) => b.IndexOf(v, i, c, eq));
            IndexOfTests.IndexOfTest(
                seq => (System.Collections.Immutable.IImmutableList<int>)ImmutableSegmentedList.CreateRange(seq),
                (b, v) => b.IndexOf(v),
                (b, v, i) => System.Collections.Immutable.ImmutableList.IndexOf(b, v, i),
                (b, v, i, c) => System.Collections.Immutable.ImmutableList.IndexOf(b, v, i, c),
                (b, v, i, c, eq) => b.IndexOf(v, i, c, eq));
        }

        [Fact]
        public void LastIndexOf()
        {
            IndexOfTests.LastIndexOfTest(
                seq => ImmutableSegmentedList.CreateRange(seq),
                (b, v) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v),
                (b, v, eq) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v, eq),
                (b, v, i) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v, i),
                (b, v, i, c) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v, i, c),
                (b, v, i, c, eq) => b.LastIndexOf(v, i, c, eq));
            IndexOfTests.LastIndexOfTest(
                seq => (System.Collections.Immutable.IImmutableList<int>)ImmutableSegmentedList.CreateRange(seq),
                (b, v) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v),
                (b, v, eq) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v, eq),
                (b, v, i) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v, i),
                (b, v, i, c) => System.Collections.Immutable.ImmutableList.LastIndexOf(b, v, i, c),
                (b, v, i, c, eq) => b.LastIndexOf(v, i, c, eq));
        }

        [Fact]
        public void ReplaceTest()
        {
            // Verify replace at beginning, middle, and end.
            var list = ImmutableSegmentedList<int>.Empty.Add(3).Add(5).Add(8);
            Assert.Equal<int>(new[] { 4, 5, 8 }, list.Replace(3, 4));
            Assert.Equal<int>(new[] { 3, 6, 8 }, list.Replace(5, 6));
            Assert.Equal<int>(new[] { 3, 5, 9 }, list.Replace(8, 9));
            Assert.Equal<int>(new[] { 4, 5, 8 }, System.Collections.Immutable.ImmutableList.Replace((System.Collections.Immutable.IImmutableList<int>)list, 3, 4));
            Assert.Equal<int>(new[] { 3, 6, 8 }, System.Collections.Immutable.ImmutableList.Replace((System.Collections.Immutable.IImmutableList<int>)list, 5, 6));
            Assert.Equal<int>(new[] { 3, 5, 9 }, System.Collections.Immutable.ImmutableList.Replace((System.Collections.Immutable.IImmutableList<int>)list, 8, 9));

            // Verify replacement of first element when there are duplicates.
            list = ImmutableSegmentedList<int>.Empty.Add(3).Add(3).Add(5);
            Assert.Equal<int>(new[] { 4, 3, 5 }, list.Replace(3, 4));
            Assert.Equal<int>(new[] { 4, 4, 5 }, list.Replace(3, 4).Replace(3, 4));
            Assert.Equal<int>(new[] { 4, 3, 5 }, System.Collections.Immutable.ImmutableList.Replace((System.Collections.Immutable.IImmutableList<int>)list, 3, 4));
            Assert.Equal<int>(new[] { 4, 4, 5 }, System.Collections.Immutable.ImmutableList.Replace(System.Collections.Immutable.ImmutableList.Replace((System.Collections.Immutable.IImmutableList<int>)list, 3, 4), 3, 4));
        }

        [Fact]
        public void ReplaceWithEqualityComparerTest()
        {
            var list = ImmutableSegmentedList.Create(new Person { Name = "Andrew", Age = 20 });
            var newAge = new Person { Name = "Andrew", Age = 21 };
            var updatedList = list.Replace(newAge, newAge, new NameOnlyEqualityComparer());
            Assert.Equal(newAge.Age, updatedList[0].Age);

            // Try again with a null equality comparer, which should use the default EQ.
            updatedList = list.Replace(list[0], newAge);
            Assert.False(IsSame(list, updatedList));

            // Finally, try one last time using the interface implementation.
            System.Collections.Immutable.IImmutableList<Person> iface = list;
            var updatedIface = System.Collections.Immutable.ImmutableList.Replace(iface, list[0], newAge);
            Assert.NotSame(iface, updatedIface);
        }

        [Fact]
        public void ReplaceMissingThrowsTest()
        {
            Assert.Throws<ArgumentException>("oldValue", () => ImmutableSegmentedList<int>.Empty.Replace(5, 3));
        }

        [Fact]
        public void EqualsTest()
        {
            Assert.False(ImmutableSegmentedList<int>.Empty.Equals(null));
            Assert.False(ImmutableSegmentedList<int>.Empty.Equals("hi"));
            Assert.True(ImmutableSegmentedList<int>.Empty.Equals(ImmutableSegmentedList<int>.Empty));
            Assert.False(ImmutableSegmentedList<int>.Empty.Add(3).Equals(ImmutableSegmentedList<int>.Empty.Add(3)));
        }

        [Fact]
        public void Create()
        {
            var comparer = StringComparer.OrdinalIgnoreCase;

            ImmutableSegmentedList<string> list = ImmutableSegmentedList.Create<string>();
            Assert.Equal(0, list.Count);

            list = ImmutableSegmentedList.Create("a");
            Assert.Equal(1, list.Count);

            list = ImmutableSegmentedList.Create("a", "b");
            Assert.Equal(2, list.Count);

            list = ImmutableSegmentedList.CreateRange((IEnumerable<string>)new[] { "a", "b" });
            Assert.Equal(2, list.Count);
        }

        [Fact]
        public void ToImmutableList()
        {
            ImmutableSegmentedList<string> list = new[] { "a", "b" }.ToImmutableSegmentedList();
            Assert.Equal(2, list.Count);

            list = new[] { "a", "b" }.ToImmutableSegmentedList();
            Assert.Equal(2, list.Count);
        }

        [Fact]
        public void ToImmutableListOfSameType()
        {
            var list = ImmutableSegmentedList.Create("a");
            Assert.True(IsSame(list, list.ToImmutableSegmentedList()));
        }

        [Fact]
        public void RemoveAllNullTest()
        {
            Assert.Throws<ArgumentNullException>("match", () => ImmutableSegmentedList<int>.Empty.RemoveAll(null!));
        }

        [Fact]
        public void RemoveRangeArrayTest()
        {
            Assert.True(ImmutableSegmentedList<int>.Empty.RemoveRange(0, 0).IsEmpty);

            var list = ImmutableSegmentedList.Create(1, 2, 3);
            Assert.Throws<ArgumentOutOfRangeException>("index", () => list.RemoveRange(-1, 0));
            Assert.Throws<ArgumentOutOfRangeException>("count", () => list.RemoveRange(0, -1));
            Assert.Throws<ArgumentException>(() => list.RemoveRange(4, 0));
            Assert.Throws<ArgumentException>(() => list.RemoveRange(0, 4));
            Assert.Throws<ArgumentException>(() => list.RemoveRange(2, 2));
            Assert.Equal(list, list.RemoveRange(3, 0));
        }

        [Fact]
        public void RemoveRange_EnumerableEqualityComparer_AcceptsNullEQ()
        {
            var list = ImmutableSegmentedList.Create(1, 2, 3);
            var removed2eq = list.RemoveRange(new[] { 2 }, null);
            Assert.Equal(2, removed2eq.Count);
            Assert.Equal(new[] { 1, 3 }, removed2eq);
        }

        [Fact]
        public void RemoveRangeEnumerableTest()
        {
            var list = ImmutableSegmentedList.Create(1, 2, 3);
            Assert.Throws<ArgumentNullException>("items", () => list.RemoveRange(null!));

            ImmutableSegmentedList<int> removed2 = list.RemoveRange(new[] { 2 });
            Assert.Equal(2, removed2.Count);
            Assert.Equal(new[] { 1, 3 }, removed2);

            ImmutableSegmentedList<int> removed13 = list.RemoveRange(new[] { 1, 3, 5 });
            Assert.Equal(1, removed13.Count);
            Assert.Equal(new[] { 2 }, removed13);
            Assert.Equal(new[] { 2 }, System.Collections.Immutable.ImmutableList.RemoveRange((System.Collections.Immutable.IImmutableList<int>)list, new[] { 1, 3, 5 }));

            Assert.True(IsSame(list, list.RemoveRange(new[] { 5 })));
            Assert.True(IsSame(ImmutableSegmentedList.Create<int>(), ImmutableSegmentedList.Create<int>().RemoveRange(new[] { 1 })));

            var listWithDuplicates = ImmutableSegmentedList.Create(1, 2, 2, 3);
            Assert.Equal(new[] { 1, 2, 3 }, listWithDuplicates.RemoveRange(new[] { 2 }));
            Assert.Equal(new[] { 1, 3 }, listWithDuplicates.RemoveRange(new[] { 2, 2 }));

            Assert.Throws<ArgumentNullException>("items", () => System.Collections.Immutable.ImmutableList.RemoveRange((System.Collections.Immutable.IImmutableList<int>)ImmutableSegmentedList.Create(1, 2, 3), null!));
            Assert.Equal(new[] { 1, 3 }, System.Collections.Immutable.ImmutableList.RemoveRange((System.Collections.Immutable.IImmutableList<int>)ImmutableSegmentedList.Create(1, 2, 3), new[] { 2 }));
        }

        [Fact]
        public void EnumeratorTest()
        {
            var list = ImmutableSegmentedList.Create("a");
            var enumerator = list.GetEnumerator();
            Assert.Null(enumerator.Current);
            Assert.True(enumerator.MoveNext());
            Assert.Equal("a", enumerator.Current);
            Assert.False(enumerator.MoveNext());
            Assert.Null(enumerator.Current);

            enumerator.Reset();
            Assert.Null(enumerator.Current);
            Assert.True(enumerator.MoveNext());
            Assert.Equal("a", enumerator.Current);
            Assert.False(enumerator.MoveNext());
            Assert.Null(enumerator.Current);

            enumerator.Dispose();
            enumerator.Reset();
        }

        [Fact]
        public void EnumeratorRecyclingMisuse()
        {
            var collection = ImmutableSegmentedList.Create(1);
            var enumerator = collection.GetEnumerator();
            var enumeratorCopy = enumerator;
            Assert.True(enumerator.MoveNext());
            enumerator.Dispose();
            Assert.False(enumerator.MoveNext());
            enumerator.Reset();
            Assert.Equal(0, enumerator.Current);
            Assert.True(enumeratorCopy.MoveNext());
            enumeratorCopy.Reset();
            Assert.Equal(0, enumeratorCopy.Current);
            enumerator.Dispose(); // double-disposal should not throw
            enumeratorCopy.Dispose();

            // We expect that acquiring a new enumerator will use the same underlying Stack<T> object,
            // but that it will not throw exceptions for the new enumerator.
            enumerator = collection.GetEnumerator();
            Assert.True(enumerator.MoveNext());
            Assert.Equal(collection[0], enumerator.Current);
            enumerator.Dispose();
        }

        [Fact]
        public void ReverseTest2()
        {
            var emptyList = ImmutableSegmentedList.Create<int>();
            Assert.True(IsSame(emptyList, emptyList.Reverse()));

            var populatedList = ImmutableSegmentedList.Create(3, 2, 1);
            Assert.Equal(Enumerable.Range(1, 3), populatedList.Reverse());
        }

        [Fact]
        public void SetItem()
        {
            var emptyList = ImmutableSegmentedList.Create<int>();
            Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[-1]);
            Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[0]);
            Assert.Throws<ArgumentOutOfRangeException>("index", () => emptyList[1]);

            var listOfOne = emptyList.Add(5);
            Assert.Throws<ArgumentOutOfRangeException>("index", () => listOfOne[-1]);
            Assert.Equal(5, listOfOne[0]);
            Assert.Throws<ArgumentOutOfRangeException>("index", () => listOfOne[1]);
        }

        [Fact]
        public void IsSynchronized()
        {
            ICollection collection = ImmutableSegmentedList.Create<int>();
            Assert.True(collection.IsSynchronized);
        }

        [Fact]
        public void IListIsReadOnly()
        {
            IList list = ImmutableSegmentedList.Create<int>();
            Assert.True(list.IsReadOnly);
            Assert.True(list.IsFixedSize);
            Assert.Throws<NotSupportedException>(() => list.Add(1));
            Assert.Throws<NotSupportedException>(() => list.Clear());
            Assert.Throws<NotSupportedException>(() => list.Insert(0, 1));
            Assert.Throws<NotSupportedException>(() => list.Remove(1));
            Assert.Throws<NotSupportedException>(() => list.RemoveAt(0));
            Assert.Throws<NotSupportedException>(() => list[0] = 1);
        }

        [Fact]
        public void IListOfTIsReadOnly()
        {
            IList<int> list = ImmutableSegmentedList.Create<int>();
            Assert.True(list.IsReadOnly);
            Assert.Throws<NotSupportedException>(() => list.Add(1));
            Assert.Throws<NotSupportedException>(() => list.Clear());
            Assert.Throws<NotSupportedException>(() => list.Insert(0, 1));
            Assert.Throws<NotSupportedException>(() => list.Remove(1));
            Assert.Throws<NotSupportedException>(() => list.RemoveAt(0));
            Assert.Throws<NotSupportedException>(() => list[0] = 1);
        }

        [Fact(Skip = "Not implemented: https://github.com/dotnet/roslyn/issues/54429")]
        public void DebuggerAttributesValid()
        {
            DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSegmentedList.Create<int>());
            ImmutableSegmentedList<double> list = ImmutableSegmentedList.Create<double>(1, 2, 3);
            DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(list);

            object? rootNode = DebuggerAttributes.GetFieldValue(ImmutableSegmentedList.Create<string>("1", "2", "3"), "_root")!;
            DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode);
            PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>()!.State == DebuggerBrowsableState.RootHidden);
            double[]? items = itemProperty.GetValue(info.Instance) as double[];
            Assert.Equal(list, items);
        }

        [Fact(Skip = "Not implemented: https://github.com/dotnet/roslyn/issues/54429")]
        public static void TestDebuggerAttributes_Null()
        {
            Type proxyType = DebuggerAttributes.GetProxyType(ImmutableSegmentedList.Create<double>());
            TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object?)null));
            Assert.IsType<ArgumentNullException>(tie.InnerException);
        }

#if NETCOREAPP
        [Fact]
        public void UsableWithCollectibleAssemblies()
        {
            var assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("dynamic_assembly"), AssemblyBuilderAccess.RunAndCollect);
            var module = assembly.DefineDynamicModule("dynamic");
            var typeBuilder = module.DefineType("Dummy");

            typeBuilder.DefineDefaultConstructor(MethodAttributes.Public);
            var dummType = typeBuilder.CreateTypeInfo();

            var createMethod = typeof(ImmutableSegmentedList).GetMethods().Where(m => m.Name == "Create" && m.GetParameters().Length == 0).Single().MakeGenericMethod(dummType!.AsType());
            var list = Assert.IsAssignableFrom<IEnumerable>(createMethod.Invoke(null, null));

            var addMethod = list.GetType().GetMethod("Add");
            list = Assert.IsAssignableFrom<IEnumerable>(addMethod!.Invoke(list, new object?[] { Activator.CreateInstance(dummType.AsType()) }));

            list.GetEnumerator(); // ensure this doesn't throw
        }
#endif

        [Fact]
        public void ItemRef()
        {
            var list = new[] { 1, 2, 3 }.ToImmutableSegmentedList();

            ref readonly var safeRef = ref list.ItemRef(1);
            ref var unsafeRef = ref Unsafe.AsRef(safeRef);

            Assert.Equal(2, list.ItemRef(1));

            unsafeRef = 4;

            Assert.Equal(4, list.ItemRef(1));
        }

        [Fact]
        public void ItemRef_OutOfBounds()
        {
            var list = new[] { 1, 2, 3 }.ToImmutableSegmentedList();

            Assert.Throws<ArgumentOutOfRangeException>(() => list.ItemRef(5));
        }

        protected override IEnumerable<T> GetEnumerableOf<T>(params T[] contents)
        {
            return ImmutableSegmentedList<T>.Empty.AddRange(contents);
        }

        private protected override void RemoveAllTestHelper<T>(ImmutableSegmentedList<T> list, Predicate<T> test)
        {
            var expected = list.ToList();
            expected.RemoveAll(test);
            var actual = list.RemoveAll(test);
            Assert.Equal<T>(expected, actual.ToList());
        }

        private protected override void ReverseTestHelper<T>(ImmutableSegmentedList<T> list, int index, int count)
        {
            var expected = list.ToList();
            expected.Reverse(index, count);
            var actual = list.Reverse(index, count);
            Assert.Equal<T>(expected, actual.ToList());
        }

        private protected override List<T> SortTestHelper<T>(ImmutableSegmentedList<T> list)
        {
            return list.Sort().ToList();
        }

        private protected override List<T> SortTestHelper<T>(ImmutableSegmentedList<T> list, Comparison<T> comparison)
        {
            return list.Sort(comparison).ToList();
        }

        private protected override List<T> SortTestHelper<T>(ImmutableSegmentedList<T> list, IComparer<T>? comparer)
        {
            return list.Sort(comparer).ToList();
        }

        private protected override List<T> SortTestHelper<T>(ImmutableSegmentedList<T> list, int index, int count, IComparer<T>? comparer)
        {
            return list.Sort(index, count, comparer).ToList();
        }

        internal override IReadOnlyList<T> GetListQuery<T>(ImmutableSegmentedList<T> list)
        {
            return list;
        }

        private protected override ImmutableSegmentedList<TOutput> ConvertAllImpl<T, TOutput>(ImmutableSegmentedList<T> list, Converter<T, TOutput> converter)
            => list.ConvertAll(converter);

        private protected override void ForEachImpl<T>(ImmutableSegmentedList<T> list, Action<T> action)
            => list.ForEach(action);

        private protected override ImmutableSegmentedList<T> GetRangeImpl<T>(ImmutableSegmentedList<T> list, int index, int count)
            => list.GetRange(index, count);

        private protected override void CopyToImpl<T>(ImmutableSegmentedList<T> list, T[] array)
            => list.CopyTo(array);

        private protected override void CopyToImpl<T>(ImmutableSegmentedList<T> list, T[] array, int arrayIndex)
            => list.CopyTo(array, arrayIndex);

        private protected override void CopyToImpl<T>(ImmutableSegmentedList<T> list, int index, T[] array, int arrayIndex, int count)
            => list.CopyTo(index, array, arrayIndex, count);

        private protected override bool ExistsImpl<T>(ImmutableSegmentedList<T> list, Predicate<T> match)
            => list.Exists(match);

        private protected override T? FindImpl<T>(ImmutableSegmentedList<T> list, Predicate<T> match)
            where T : default
            => list.Find(match);

        private protected override ImmutableSegmentedList<T> FindAllImpl<T>(ImmutableSegmentedList<T> list, Predicate<T> match)
            => list.FindAll(match);

        private protected override int FindIndexImpl<T>(ImmutableSegmentedList<T> list, Predicate<T> match)
            => list.FindIndex(match);

        private protected override int FindIndexImpl<T>(ImmutableSegmentedList<T> list, int startIndex, Predicate<T> match)
            => list.FindIndex(startIndex, match);

        private protected override int FindIndexImpl<T>(ImmutableSegmentedList<T> list, int startIndex, int count, Predicate<T> match)
            => list.FindIndex(startIndex, count, match);

        private protected override T? FindLastImpl<T>(ImmutableSegmentedList<T> list, Predicate<T> match)
            where T : default
            => list.FindLast(match);

        private protected override int FindLastIndexImpl<T>(ImmutableSegmentedList<T> list, Predicate<T> match)
            => list.FindLastIndex(match);

        private protected override int FindLastIndexImpl<T>(ImmutableSegmentedList<T> list, int startIndex, Predicate<T> match)
            => list.FindLastIndex(startIndex, match);

        private protected override int FindLastIndexImpl<T>(ImmutableSegmentedList<T> list, int startIndex, int count, Predicate<T> match)
            => list.FindLastIndex(startIndex, count, match);

        private protected override bool TrueForAllImpl<T>(ImmutableSegmentedList<T> list, Predicate<T> test)
            => list.TrueForAll(test);

        private protected override int BinarySearchImpl<T>(ImmutableSegmentedList<T> list, T item)
            => list.BinarySearch(item);

        private protected override int BinarySearchImpl<T>(ImmutableSegmentedList<T> list, T item, IComparer<T>? comparer)
            => list.BinarySearch(item, comparer);

        private protected override int BinarySearchImpl<T>(ImmutableSegmentedList<T> list, int index, int count, T item, IComparer<T>? comparer)
            => list.BinarySearch(index, count, item, comparer);

        private struct Person
        {
            public string Name { get; set; }
            public int Age { get; set; }
        }

        private class NameOnlyEqualityComparer : IEqualityComparer<Person>
        {
            public bool Equals(Person x, Person y)
            {
                return x.Name == y.Name;
            }

            public int GetHashCode(Person obj)
            {
                return obj.Name.GetHashCode();
            }
        }
    }
}


text:
package org.apache.hadoop.yarn.server.federation.policies.amrmproxy;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.server.federation.policies.FederationPolicyInitializationContext;
import org.apache.hadoop.yarn.server.federation.policies.FederationPolicyInitializationContextValidator;
import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyException;
import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyInitializationException;
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId;
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo;

/**
 * An implementation of the {@link FederationAMRMProxyPolicy} that simply
 * sends the {@link ResourceRequest} to the home subcluster.
 */
public class HomeAMRMProxyPolicy extends AbstractAMRMProxyPolicy {

  /** Identifier of the local subcluster. */
  private SubClusterId homeSubcluster;

  @Override
  public void reinitialize(
      FederationPolicyInitializationContext policyContext)
      throws FederationPolicyInitializationException {

    FederationPolicyInitializationContextValidator
        .validate(policyContext, this.getClass().getCanonicalName());
    setPolicyContext(policyContext);

    this.homeSubcluster = policyContext.getHomeSubcluster();
  }

  @Override
  public Map<SubClusterId, List<ResourceRequest>> splitResourceRequests(
      List<ResourceRequest> resourceRequests) throws YarnException {

    if (homeSubcluster == null) {
      throw new FederationPolicyException("No home subcluster available");
    }

    Map<SubClusterId, SubClusterInfo> active = getActiveSubclusters();
    if (!active.containsKey(homeSubcluster)) {
      throw new FederationPolicyException(
          "The local subcluster " + homeSubcluster + " is not active");
    }

    List<ResourceRequest> resourceRequestsCopy =
        new ArrayList<>(resourceRequests);
    return Collections.singletonMap(homeSubcluster, resourceRequestsCopy);
  }
}


text:
using System;
using System.Threading.Tasks;
using Foundatio.Caching;
using Foundatio.Lock;
using Foundatio.Messaging;
using Xunit;
using Xunit.Abstractions;
using Foundatio.Utility;
using Microsoft.Extensions.Logging;
using Foundatio.Xunit;

namespace Foundatio.Tests.Locks {
    public class InMemoryLockTests : LockTestBase, IDisposable {
        private readonly ICacheClient _cache;
        private readonly IMessageBus _messageBus;

        public InMemoryLockTests(ITestOutputHelper output) : base(output) {
            _cache = new InMemoryCacheClient(o => o.LoggerFactory(Log));
            _messageBus = new InMemoryMessageBus(o => o.LoggerFactory(Log));
        }

        protected override ILockProvider GetThrottlingLockProvider(int maxHits, TimeSpan period) {
            return new ThrottlingLockProvider(_cache, maxHits, period, Log);
        }

        protected override ILockProvider GetLockProvider() {
            return new CacheLockProvider(_cache, _messageBus, Log);
        }

        [Fact]
        public override Task CanAcquireAndReleaseLockAsync() {
            using (TestSystemClock.Install()) {
                return base.CanAcquireAndReleaseLockAsync();
            }
        }

        [Fact]
        public override Task LockWillTimeoutAsync() {
            return base.LockWillTimeoutAsync();
        }

        [Fact]
        public override Task LockOneAtATimeAsync() {
            return base.LockOneAtATimeAsync();
        }

        [Fact]
        public override Task CanAcquireMultipleResources() {
            return base.CanAcquireMultipleResources();
        }

        [Fact]
        public override Task CanAcquireLocksInParallel() {
            return base.CanAcquireLocksInParallel();
        }

        [Fact]
        public override Task CanAcquireMultipleScopedResources() {
            return base.CanAcquireMultipleScopedResources();
        }

        [RetryFact]
        public override Task WillThrottleCallsAsync() {
            Log.SetLogLevel<InMemoryCacheClient>(LogLevel.Trace);
            Log.SetLogLevel<InMemoryMessageBus>(LogLevel.Trace);

            return base.WillThrottleCallsAsync();
        }

        [Fact]
        public override Task CanReleaseLockMultipleTimes() {
            return base.CanReleaseLockMultipleTimes();
        }

        public void Dispose() {
            _cache.Dispose();
            _messageBus.Dispose();
        }
    }
}


text:
all = cli clui bnez beqz jr jalr
all += lw ld lwsp ldsp sdsp swsp
all += addi subw addw sub xor or and andi slli srai srli
all += addi4spn addi16sp

include ../common64.mk


text: {{each.date}}


text:
import * as React from "react";
import ButtonToggle from "../button-toggle/button-toggle.component";
import ButtonToggleGroup from "./button-toggle-group.component";
import {
  buttonTogglePreview,
  buttonToggleInput,
} from "../../../cypress/locators/button-toggle";
import {
  buttonToggleGroup,
  buttonToggleGroupHelp,
  buttonToggleGroupHelpIcon,
} from "../../../cypress/locators/button-toggle-group";
import { positionOfElement } from "../../../cypress/support/helper";
import { getDataElementByValue, icon } from "../../../cypress/locators";
import CypressMountWithProviders from "../../../cypress/support/component-helper/cypress-mount";

const specialCharacters = [
  "label",
  "mp150ú¿¡üßä",
  "!@#$%^*()_+-=~[];:.,?{}&\"'<>",
];
const testPropValue = "cypress_test";

const ButtonToggleGroupComponent = ({ ...props }) => {
  return (

      <ButtonToggleGroup
        id="button-toggle-group-default-id"
        name="button-toggle-group-default"
        label="Default example"
        labelHelp="help message"
        helpAriaLabel="Help"
        fieldHelp="field help message"
        onChange={function noRefCheck() {}}
        {...props}
      >
        <ButtonToggle key="foo" value="foo">
          Foo
        </ButtonToggle>
        <ButtonToggle key="bar" value="bar">
          Bar
        </ButtonToggle>
        <ButtonToggle key="baz" value="baz">
          Baz
        </ButtonToggle>
      </ButtonToggleGroup>

  );
};

const ButtonToggleGroupDefaultChecked = () => {
  return (

      <ButtonToggleGroup
        fieldHelp="field help mesage"
        helpAriaLabel="Help"
        id="button-toggle-group-controlled-id-sage"
        label="Controlled example"
        labelHelp="help message"
        name="button-toggle-group-controlled-sage"
      >
        <ButtonToggle value="foo">Foo</ButtonToggle>
        <ButtonToggle value="bar" defaultChecked>
          Bar
        </ButtonToggle>
        <ButtonToggle value="baz">Baz</ButtonToggle>
      </ButtonToggleGroup>

  );
};

context("Testing Button-Toggle-Group component", () => {
  describe("should render Button-Toggle-Group component", () => {
    it("should render Button-Toggle-Group with data-component prop set to Cypress-Test", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent data-component={testPropValue} />
      );

      buttonToggleGroupHelp()
        .parent()
        .should("have.attr", "data-component", testPropValue);
    });

    it("should render Button-Toggle-Group with data-element prop set to Cypress-Test", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent data-element={testPropValue} />
      );

      buttonToggleGroup().should("have.attr", "data-element", testPropValue);
    });

    it("should render Button-Toggle-Group with data-role prop set to Cypress-Test", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent data-role={testPropValue} />
      );

      buttonToggleGroup().should("have.attr", "data-role", testPropValue);
    });

    it("should render Button-Toggle-Group with all button toggle input name props set to Cypress-Test", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent name={testPropValue} />
      );

      buttonToggleInput().eq(0).should("have.attr", "name", testPropValue);
      buttonToggleInput().eq(1).should("have.attr", "name", testPropValue);
      buttonToggleInput().eq(2).should("have.attr", "name", testPropValue);
    });

    it.each([
      ["error", "Error Message", "", "", "rgb(203, 55, 74)"],
      ["warning", "", "Warning Message", "", "rgb(239, 103, 0)"],
      ["info", "", "", "Info Message", "rgb(0, 96, 167)"],
    ])(
      "should render Button-Toggle-Group with %s icon",
      (prop, errorMessage, warningMessage, infoMessage, bottomColor) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent
            error={errorMessage}
            warning={warningMessage}
            info={infoMessage}
          />
        );

        buttonToggleGroup()
          .children()
          .children()
          .eq(1)
          .children()
          .eq(3)
          .children()
          .should("have.attr", "type", prop);
        icon().parent().should("have.attr", "data-component", "help");
        buttonTogglePreview()
          .children()
          .eq(1)
          .should("have.css", "border-bottom-color", bottomColor);
      }
    );

    it("should render Button-Toggle-Group with validation icon on label", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent info="Info Message" validationOnLabel />
      );

      buttonToggleGroup()
        .children()
        .children()
        .children()
        .eq(1)
        .children()
        .children()
        .should("have.attr", "data-element", "info");
    });

    it.each(specialCharacters)(
      "should render Button-Toggle-Group with %s as label",
      (labelText) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent label={labelText} />
        );

        buttonToggleGroup().should("contain.text", labelText);
      }
    );

    it("should render Button-Toggle-Group with tooltip set to Cypress-Test", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent labelHelp={testPropValue} />
      );

      buttonToggleGroup().find('[data-element="question"]').realHover();
      getDataElementByValue("tooltip")
        .should("be.visible")
        .and("has.text", testPropValue);
    });

    it.each(specialCharacters)(
      "should render Button-Toggle-Group with %s as field help text",
      (fieldHelpText) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent fieldHelp={fieldHelpText} />
        );

        buttonToggleGroupHelp().should("have.text", fieldHelpText);
      }
    );

    it.each([
      ["inline", true],
      ["outline", false],
    ])(
      "should render Button-Toggle-Group with field help %s if fieldHelpInline is %s",
      (alignment, state) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent
            fieldHelp="fieldHelpText"
            fieldHelpInline={state}
          />
        );

        if (state === true) {
          buttonToggleGroup()
            .children()
            .eq(0)
            .children()
            .eq(1)
            .should("have.attr", "data-element", "help");
        } else {
          buttonToggleGroup()
            .children()
            .eq(1)
            .should("have.attr", "data-element", "help");
        }
      }
    );

    it.each([
      ["inline", true],
      ["outline", false],
    ])(
      "should render Button-Toggle-Group with label %s if labelInline is %s",
      (alignment, state) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent labelInline={state} />
        );

        if (state === true) {
          buttonToggleGroup()
            .children()
            .children()
            .should("have.css", "box-sizing", "border-box")
            .and("have.css", "margin-bottom", "0px");
        } else {
          buttonToggleGroup()
            .children()
            .children()
            .should("not.have.css", "box-sizing", "border-box")
            .and("have.css", "margin-bottom", "8px");
        }
      }
    );

    it.each([
      ["left", "have.css", "justify-content", "flex-start"],
      ["right", "not.have.css", "box-sizing", "flex-end"],
    ])(
      "should render Button-Toggle-Group with label inline and %s aligned",
      (alignment, condition, css, flex) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent labelInline labelAlign={alignment} />
        );

        buttonToggleGroup().children().children().should(condition, css, flex);
      }
    );

    it("should render Button-Toggle-Group with second button toggle checked", () => {
      CypressMountWithProviders(<ButtonToggleGroupDefaultChecked />);

      buttonToggleInput()
        .eq(positionOfElement("second"))
        .should("have.attr", "checked");
    });

    it.each([
      [25, "337.5px"],
      [50, "675px"],
      [100, "1350px"],
    ])(
      "should render Button-Toggle-Group with labelWidth prop of %s and width of %s",
      (labelWidth, width) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent inputWidth={labelWidth} />
        );

        buttonToggleInput()
          .parent()
          .parent()
          .should("have.css", "width", width);
      }
    );

    it("should render Button-Toggle-Group with label width = %s", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent helpAriaLabel={testPropValue} />
      );

      buttonToggleGroupHelpIcon().should(
        "have.attr",
        "aria-label",
        testPropValue
      );
    });

    it.each([
      ["8px", 1],
      ["16px", 2],
    ])(
      "should render Button-Toggle-Group with padding of %s if labelSpacing prop is %s",
      (padding, spacing) => {
        CypressMountWithProviders(
          <ButtonToggleGroupComponent labelInline labelSpacing={spacing} />
        );

        buttonToggleGroup()
          .children()
          .children()
          .should("have.css", "padding-right", padding);
      }
    );
  });

  describe("should render Button-Toggle-Group component for event tests", () => {
    let callback;

    beforeEach(() => {
      callback = cy.stub();
    });

    it("should call onChange callback when a click event is triggered", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent onChange={callback} />
      );

      buttonTogglePreview()
        .eq(positionOfElement("first"))
        .click()
        .then(() => {
          // eslint-disable-next-line no-unused-expressions
          expect(callback).to.have.been.calledOnce;
        });
    });

    it("should call onBlur callback when a blur event is triggered", () => {
      CypressMountWithProviders(
        <ButtonToggleGroupComponent onBlur={callback} />
      );

      buttonToggleInput().eq(positionOfElement("first")).focus();

      buttonToggleInput()
        .eq(positionOfElement("first"))
        .blur()
        .then(() => {
          // eslint-disable-next-line no-unused-expressions
          expect(callback).to.have.been.calledOnce;
        });
    });
  });
});


text:
#include "muon_tree_processor.h"

#include "TH2D.h"

#include <memory>

class Lxy_weight_calculator
{
public:
	// Look up and calculate the weight table
	inline virtual ~Lxy_weight_calculator() {};

	// Region can be 0 == A, 1 == B, 2 == C, 3 == D
	virtual double operator() (int region, double lxy1, double lxy2) const = 0;

	// Return a copy, and the caller will own it
	virtual std::unique_ptr<TH1> clone_weight(int region) const = 0;

private:
};

class Lxy_weight_calculator1D : public Lxy_weight_calculator
{
public:
	// Look up and calculate the weight table
	Lxy_weight_calculator1D(const muon_tree_processor &reader);
	~Lxy_weight_calculator1D();

	// Region can be 0 == A, 1 == B, 2 == C, 3 == D
	double operator() (int region, double lxy1, double lxy2) const;

	// Return a copy, and the caller will own it
	std::unique_ptr<TH1> clone_weight(int region) const {
		if (region < 0 || region > 3) {
			throw std::runtime_error("Illegial region number");
		}
		auto a = std::unique_ptr<TH1>(static_cast<TH1*>(_pass_weight[region]->Clone()));
		a->SetDirectory(nullptr);
		return a;
	}

private:
	std::unique_ptr<TH1D> _pass_weight[4];
};

class Lxy_weight_calculator2D : public Lxy_weight_calculator
{
public:
	// Look up and calculate the weight table
	Lxy_weight_calculator2D(const muon_tree_processor &reader);
	~Lxy_weight_calculator2D();

	// Region can be 0 == A, 1 == B, 2 == C, 3 == D
	double operator() (int region, double lxy1, double lxy2) const;

	// Return a copy, and the caller will own it
	std::unique_ptr<TH1> clone_weight(int region) const {
		if (region < 0 || region > 3) {
			throw std::runtime_error("Illegial region number");
		}
		auto a = std::unique_ptr<TH1>(static_cast<TH1*>(_pass_weight[region]->Clone()));
		a->SetDirectory(nullptr);
		return a;
	}

private:
	std::unique_ptr<TH2D> _pass_weight[4];
};


text:
Process execution.

Process execution in Java is harder than it seems. {@link
java.lang.ProcessBuilder} simplifies some of the necessary steps, but
still does not address several aspects of process management that this
package addresses. Specifically, {@link
org.marketcetera.util.exec.Exec} provides execution of a process
with the following enhancements:

Routing/capture of its standard output and error streams. Both
streams are always routed to the same destination {@link
org.marketcetera.util.exec.Disposition}, which can be in-memory
capture, or redirection to the parent process standard output or error
stream (both child streams go to the same parent stream).

Exit code capture. The exit code of the child process is
captured (always) alongside the process output (if in-memory
disposition was elected) in {@link
org.marketcetera.util.exec.ExecResult}.

Synchronous execution. The parent blocks while waiting for the
child to complete. The package assumes children do not need any data
to be provided in their standard input steam, or else the parent may
wait indefinitely on a blocked child.

Setting working directory. The working directory of the child
can be set before the child process is started.

All of the above functionality is available via simple static calls
into methods of {@link org.marketcetera.util.exec.Exec}.


text:
OPTIND=1         # Reset in case getopts has been used previously in the shell.

interface="eth0"
output_file="out.csv"
test_name="test"

lockfile=nattorture.lock
touch $lockfile

while getopts "h?i:f:r:o:t:" opt; do
    case "$opt" in
    h|\?)
        show_help
        exit 0
        ;;
    r)  runs=$OPTARG
        ;;
    i)  interface=$OPTARG
        ;;
    f)  output_file=$OPTARG
        ;;
    t)  test_name=$OPTARG
        ;;
    esac
done

shift $((OPTIND-1))

[ "$1" = "--" ] && shift

printf "Time, transInUse, maxTransInuse, pkt cnt, max pkt_cnt, byte cnt, max byte cnt, kbps, max kbps, user, nice, system, idle, iowait\n" > $output_file
build/dist/bin/stunserver -i $interface --csv >> $output_file

rm $lockfile


text:
using System.Data.Entity.ModelConfiguration;
using Nop.Core.Domain.Common;

namespace Nop.Data.Mapping.Common
{
    public partial class SearchTermMap : EntityTypeConfiguration<SearchTerm>
    {
        public SearchTermMap()
        {
            this.ToTable("SearchTerm");
            this.HasKey(st => st.Id);
        }
    }
}


text:
require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'
require 'sinatra/activerecord'

#Создание подключения к БД при помощи Active Record
set :database, "sqlite3:pizzashop.db"

#Создание сущности Продукт с наследованием
class Product < ActiveRecord::Base
end

#Создание сущности Заказ с наследованием
class Order < ActiveRecord::Base
end

#Отображение всех продуктов (пиц)
get '/' do
	@products = Product.all
	erb :index
end

get '/about' do
	erb :about
end

#Отображение содержимого корзины
post '/cart' do
#Помещаем в переменную список выбранных товаров в виде строки order_#=#...
	@orders_input = params[:orders]
#Создание массива с индексами товаров и их количествами вида id_товара = количество_товара
	@orders = parse_order_line @orders_input

#если корзина буста, сообщаем об этом.
	if @orders.length == 0
		return erb :cart_is_empty
	end
#если корзина не пуста помещаем в ячейку с id товара его сущность
	@orders.each do |order|
		order[0] = Product.find(order[0])
	end

	erb :cart
end

#функция, которая разбирает строку заказа и преобразовывает ее в массив id = количество
def parse_order_line orders_input
	arr = (orders_input.delete "product_").split(',').map{|el| el.split('=')}
	return arr
end

#обработчие post-запроса /place_order
#браузер отправляет страницу на сервер
post '/place_order' do
#Производим создание и запись заказа в БД
  order = Order.new params[:order]
  order.save
  erb :order_placed
end

#вывод списка всех заказов в обратном порядке (самые свежие вверху)
get '/orders' do
  @list = Order.order('created_at DESC')
  erb :orders
end


text:
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using AdventureWorks.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AdventureWorks.ViewModel
{
    /// <summary>
    /// ViewModelLocator ensures that viewmodels can be instantiated with a common reference to the TripStore.
    /// This allows for easier decoupling of the store implementation and the view models, and allows for
    /// less viewmodel specific code in the views.
    /// </summary>
    public class ViewModelLocator
    {
        private Dictionary<string, ViewModelBase> modelSet = new Dictionary<string, ViewModelBase>();

        /// <summary>
        /// Set up all of the known view models, and instantiate the trip repository.
        /// </summary>
        public ViewModelLocator()
        {
            TripStore store = new TripStore();
            InitializeStore(store);
            modelSet.Add("TripListViewModel", new TripListViewModel(store));
            modelSet.Add("TripViewModel", new TripViewModel(store));
        }

        private async void InitializeStore(TripStore store)
        {
            await store.LoadTrips();
        }

        /// <summary>
        /// TripList (main page) view model. The TripListView is databound to this property.
        /// </summary>
        public TripListViewModel TripListViewModel
        {
            get
            {
                return (TripListViewModel)modelSet["TripListViewModel"];
            }
        }

        /// <summary>
        /// Trip (detail page) view model. TripDetails page is databound to this property.
        /// </summary>
        public TripViewModel TripViewModel
        {
            get
            {
                return (TripViewModel)modelSet["TripViewModel"];
            }
        }
    }
}


text:
Multiplayer Bed Room Shooter Game.
================================

#####Play here: http://crazywolf132.github.io/BedRoomShooterGame

Feel free to comment on what we could add or change in the "Issues" Section