text:
<!DOCTYPE html>
<html>
<head>
	<title>EaselJS demo: bubbling events</title>
	<link href="../_shared/demo.css" rel="stylesheet" type="text/css">
	<script src="http://code.createjs.com/easeljs-0.7.0.min.js"></script>
	<script>
		var stage, output, lastPhase;

		function init() {
			stage = new createjs.Stage("demoCanvas");
			stage.name = "stage";

			output = new createjs.Text("try clicking on the background vs the label text\n\nthe background & label are both inside of a Container named 'button'", "13px courier");
			output.lineWidth = 280;
			output.lineHeight = 13;
			output.x = 190;
			output.y = 10;

			var background = new createjs.Shape();
			background.name = "background";
			background.graphics.beginFill("red").drawRoundRect(0, 0, 150, 60, 10);

			var label = new createjs.Text("click me!", "bold 24px Arial", "#FFFFFF");
			label.name = "label";
			label.textAlign = "center";
			label.textBaseline = "middle";
			label.x = 150/2;
			label.y = 60/2;

			var button = new createjs.Container();
			button.name = "button";
			button.x = 20;
			button.y = 20;
			button.addChild(background, label);
			// setting mouseChildren to false will cause events to be dispatched directly from the button instead of its children.
			// button.mouseChildren = false;

			stage.addChild(button, output);

			// set up listeners for all display objects, for both the non-capture (bubble / target) and capture phases:
			var targets = [stage,button,label,background];
			for (var i=0; i<targets.length; i++) {
				var target = targets[i];
				target.on("click", handleClick, null, false, null, false);
				target.on("click", handleClick, null, false, null, true);
				//target.addEventListener("click", handleClick, false);
				//target.addEventListener("click", handleClick, true);
			}

			stage.update();
		}

		function handleClick(evt) {
			if (evt.currentTarget == stage && evt.eventPhase == 1) {
				// this is the first dispatch in the event life cycle, clear the output.
				output.text = "target : eventPhase : currentTarget\n";
			}

			output.text += evt.target.name+" : "+evt.eventPhase+" : "+evt.currentTarget.name+"\n";

			if (evt.currentTarget == stage && evt.eventPhase == 3) {
				// this is the last dispatch in the event life cycle, render the stage.
				stage.update();
			}
		}
	</script>
</head>
<body onload="init();">
	<canvas id="demoCanvas" width="500" height="100">
		alternate content
	</canvas>
</body>
</html>


text:
'use strict';

var mongoose = require('mongoose'),
	Schema = mongoose.Schema;

var TypeProductSchema = {
	TypeProductId: Schema.ObjectId,
	Name: String,
	Description: String
};

module.exports = mongoose.model('TypeProduct', TypeProductSchema);

redpajama_set_name: RedPajamaGithub


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Flora, Jena 49: 371 (1866)

#### Original name
Lecidea atrofuscescens Nyl.

### Remarks
null


text:
package kafka.admin

import kafka.utils.Logging
import org.apache.kafka.common.errors.InvalidReplicationFactorException
import org.junit.Assert._
import org.junit.Test
import org.scalatest.Assertions._

import scala.collection.Map

class AdminRackAwareTest extends RackAwareTest with Logging {

  @Test
  def testGetRackAlternatedBrokerListAndAssignReplicasToBrokers(): Unit = {
    val rackMap = Map(0 -> "rack1", 1 -> "rack3", 2 -> "rack3", 3 -> "rack2", 4 -> "rack2", 5 -> "rack1")
    val newList = AdminUtils.getRackAlternatedBrokerList(rackMap)
    assertEquals(List(0, 3, 1, 5, 4, 2), newList)
    val anotherList = AdminUtils.getRackAlternatedBrokerList(rackMap - 5)
    assertEquals(List(0, 3, 1, 4, 2), anotherList)
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(rackMap), 7, 3, 0, 0)
    val expected = Map(0 -> List(0, 3, 1),
                       1 -> List(3, 1, 5),
                       2 -> List(1, 5, 4),
                       3 -> List(5, 4, 2),
                       4 -> List(4, 2, 0),
                       5 -> List(2, 0, 3),
                       6 -> List(0, 4, 2))
    assertEquals(expected, assignment)
  }

  @Test
  def testAssignmentWithRackAware(): Unit = {
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack1")
    val numPartitions = 6
    val replicationFactor = 3
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor, 2, 0)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor)
  }

  @Test
  def testAssignmentWithRackAwareWithRandomStartIndex(): Unit = {
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack1")
    val numPartitions = 6
    val replicationFactor = 3
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor)
  }

  @Test
  def testAssignmentWithRackAwareWithUnevenReplicas(): Unit = {
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack1")
    val numPartitions = 13
    val replicationFactor = 3
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor, 0, 0)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor, verifyLeaderDistribution = false, verifyReplicasDistribution = false)
  }

  @Test
  def testAssignmentWithRackAwareWithUnevenRacks(): Unit = {
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack1", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack1")
    val numPartitions = 12
    val replicationFactor = 3
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor, verifyReplicasDistribution = false)
  }

  @Test
  def testAssignmentWith2ReplicasRackAware(): Unit = {
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack1")
    val numPartitions = 12
    val replicationFactor = 2
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor)
  }

  @Test
  def testRackAwareExpansion(): Unit = {
    val brokerRackMapping = Map(6 -> "rack1", 7 -> "rack2", 8 -> "rack2", 9 -> "rack3", 10 -> "rack3", 11 -> "rack1")
    val numPartitions = 12
    val replicationFactor = 2
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor, startPartitionId = 12)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor)
  }

  @Test
  def testAssignmentWith2ReplicasRackAwareWith6Partitions(): Unit = {
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack1")
    val numPartitions = 6
    val replicationFactor = 2
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor)
  }

  @Test
  def testAssignmentWith2ReplicasRackAwareWith6PartitionsAnd3Brokers(): Unit = {
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 4 -> "rack3")
    val numPartitions = 3
    val replicationFactor = 2
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions, replicationFactor)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions, replicationFactor)
  }

  @Test
  def testLargeNumberPartitionsAssignment(): Unit = {
    val numPartitions = 96
    val replicationFactor = 3
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack1",
      6 -> "rack1", 7 -> "rack2", 8 -> "rack2", 9 -> "rack3", 10 -> "rack1", 11 -> "rack3")
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor)
    checkReplicaDistribution(assignment, brokerRackMapping, brokerRackMapping.size, numPartitions,
      replicationFactor)
  }

  @Test
  def testMoreReplicasThanRacks(): Unit = {
    val numPartitions = 6
    val replicationFactor = 5
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack2")
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions, replicationFactor)
    assertEquals(List.fill(assignment.size)(replicationFactor), assignment.values.toIndexedSeq.map(_.size))
    val distribution = getReplicaDistribution(assignment, brokerRackMapping)
    for (partition <- 0 until numPartitions)
      assertEquals(3, distribution.partitionRacks(partition).toSet.size)
  }

  @Test
  def testLessReplicasThanRacks(): Unit = {
    val numPartitions = 6
    val replicationFactor = 2
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack2", 2 -> "rack2", 3 -> "rack3", 4 -> "rack3", 5 -> "rack2")
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions,
      replicationFactor)
    assertEquals(List.fill(assignment.size)(replicationFactor), assignment.values.toIndexedSeq.map(_.size))
    val distribution = getReplicaDistribution(assignment, brokerRackMapping)
    for (partition <- 0 to 5)
      assertEquals(2, distribution.partitionRacks(partition).toSet.size)
  }

  @Test
  def testSingleRack(): Unit = {
    val numPartitions = 6
    val replicationFactor = 3
    val brokerRackMapping = Map(0 -> "rack1", 1 -> "rack1", 2 -> "rack1", 3 -> "rack1", 4 -> "rack1", 5 -> "rack1")
    val assignment = AdminUtils.assignReplicasToBrokers(toBrokerMetadata(brokerRackMapping), numPartitions, replicationFactor)
    assertEquals(List.fill(assignment.size)(replicationFactor), assignment.values.toIndexedSeq.map(_.size))
    val distribution = getReplicaDistribution(assignment, brokerRackMapping)
    for (partition <- 0 until numPartitions)
      assertEquals(1, distribution.partitionRacks(partition).toSet.size)
    for (broker <- brokerRackMapping.keys)
      assertEquals(1, distribution.brokerLeaderCount(broker))
  }

  @Test
  def testSkipBrokerWithReplicaAlreadyAssigned(): Unit = {
    val rackInfo = Map(0 -> "a", 1 -> "b", 2 -> "c", 3 -> "a", 4 -> "a")
    val brokerList = 0 to 4
    val numPartitions = 6
    val replicationFactor = 4
    val brokerMetadatas = toBrokerMetadata(rackInfo)
    assertEquals(brokerList, brokerMetadatas.map(_.id))
    val assignment = AdminUtils.assignReplicasToBrokers(brokerMetadatas, numPartitions, replicationFactor,
      fixedStartIndex = 2)
    checkReplicaDistribution(assignment, rackInfo, 5, 6, 4,
      verifyRackAware = false, verifyLeaderDistribution = false, verifyReplicasDistribution = false)
  }

  @Test
  def testReplicaAssignment(): Unit = {
    val brokerMetadatas = (0 to 4).map(new BrokerMetadata(_, None))

    // test 0 replication factor
    intercept[InvalidReplicationFactorException] {
      AdminUtils.assignReplicasToBrokers(brokerMetadatas, 10, 0)
    }

    // test wrong replication factor
    intercept[InvalidReplicationFactorException] {
      AdminUtils.assignReplicasToBrokers(brokerMetadatas, 10, 6)
    }

    // correct assignment
    val expectedAssignment = Map(
        0 -> List(0, 1, 2),
        1 -> List(1, 2, 3),
        2 -> List(2, 3, 4),
        3 -> List(3, 4, 0),
        4 -> List(4, 0, 1),
        5 -> List(0, 2, 3),
        6 -> List(1, 3, 4),
        7 -> List(2, 4, 0),
        8 -> List(3, 0, 1),
        9 -> List(4, 1, 2))

    val actualAssignment = AdminUtils.assignReplicasToBrokers(brokerMetadatas, 10, 3, 0)
    assertEquals(expectedAssignment, actualAssignment)
  }
}


text:
package com.quentindommerc.sentencify.utils;

/**
 * Interface to the JNI. All communication goes through this class.
 */

import java.util.ArrayList;

import android.os.Handler;

import com.quentindommerc.sentencify.listener.LoginDelegate;
import com.quentindommerc.sentencify.listener.PlayerUpdateDelegate;

public class LibSpotifyWrapper {

	private static Handler handler = new Handler();
	private static LoginDelegate mLoginDelegate;
	private static PlayerUpdateDelegate mPlayerPositionDelegate;

	native public static void init(ClassLoader loader, String storagePath);

	native public static void destroy();

	native private static void login(String username, String password);

	native private static void createplaylist(String name, Object[] tracksURI);

	native private static void toggleplay(String uri);

	native private static void playnext(String uri);

	native public static void seek(float position);

	native public static void star();

	native public static void unstar();

	public static void loginUser(String username, String password, LoginDelegate loginDelegate) {
		mLoginDelegate = loginDelegate;
		login(username, password);
	}

	public static void createPlaylist(String playlistName, ArrayList<String> tracksURI) {
		Object[] stockArr = new Object[tracksURI.size()];
		createplaylist(playlistName, tracksURI.toArray(stockArr));
	}

	public static void togglePlay(String uri, PlayerUpdateDelegate playerPositionDelegate) {
		mPlayerPositionDelegate = playerPositionDelegate;
		toggleplay(uri);
	}

	public static void playNext(String uri, PlayerUpdateDelegate playerPositionDelegate) {
		mPlayerPositionDelegate = playerPositionDelegate;
		playnext(uri);
	}

	public static void onLogin(final boolean success, final String message) {
		handler.post(new Runnable() {
			@Override
			public void run() {
				if (success)
					mLoginDelegate.onLogin();
				else
					mLoginDelegate.onLoginFailed(message);
			}
		});

	}

	public static void onPlayerEndOfTrack() {
		handler.post(new Runnable() {

			@Override
			public void run() {
				mPlayerPositionDelegate.onEndOfTrack();

			}
		});
	}

	public static void onPlayerPositionChanged(final float position) {
		handler.post(new Runnable() {

			@Override
			public void run() {
				mPlayerPositionDelegate.onPlayerPositionChanged(position);

			}
		});
	}

	public static void onPlayerPause() {
		handler.post(new Runnable() {

			@Override
			public void run() {
				mPlayerPositionDelegate.onPlayerPause();

			}
		});
	}

	public static void onPlayerPlay() {
		handler.post(new Runnable() {

			@Override
			public void run() {
				mPlayerPositionDelegate.onPlayerPlay();

			}
		});
	}

	public static void onTrackStarred() {
		handler.post(new Runnable() {

			@Override
			public void run() {
				mPlayerPositionDelegate.onTrackStarred();

			}
		});
	}

	public static void onTrackUnStarred() {
		handler.post(new Runnable() {

			@Override
			public void run() {
				mPlayerPositionDelegate.onTrackUnStarred();

			}
		});
	}

	static private float simTimer;

	static void simulateTimer() {
		handler.postDelayed(new Runnable() {

			@Override
			public void run() {

				mPlayerPositionDelegate.onPlayerPositionChanged(simTimer);
				simTimer += 0.1;
				simulateTimer();

			}
		}, 1000);
	}

}


text:
from cartodb_services.google.geocoder import GoogleMapsGeocoder
from cartodb_services.google.bulk_geocoder import GoogleMapsBulkGeocoder


text:
<?php

namespace Rb\Specification\Doctrine;

abstract class AbstractSpecification implements SpecificationInterface
{
    /**
     * @var string
     */
    protected $field;

    /**
     * @var string|null
     */
    protected $dqlAlias;

    /**
     * @param string      $field
     * @param string|null $dqlAlias
     */
    public function __construct($field, $dqlAlias = null)
    {
        $this->field    = $field;
        $this->dqlAlias = $dqlAlias;
    }

    /**
     * {@inheritdoc}
     */
    public function isSatisfiedBy($value)
    {
        return true;
    }

    /**
     * Create a formatted string for the given property prefixed with the DQL alias.
     *
     * @param string $dqlAlias
     *
     * @return string
     */
    protected function createPropertyWithAlias($dqlAlias)
    {
        return $this->createAliasedName($this->field, $dqlAlias);
    }

    /**
     * Create a formatted string where the value will be prefixed with DQL alias (if not already present).
     *
     * @param string $value
     * @param string $dqlAlias
     *
     * @return string
     */
    protected function createAliasedName($value, $dqlAlias)
    {
        if (strpos($value, '.') !== false) {
            return $value;
        }

        if (! empty($this->dqlAlias)) {
            $dqlAlias = $this->dqlAlias;
        }

        return sprintf('%s.%s', $dqlAlias, $value);
    }
}


text:
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

import json
import os

from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.subsystem.subsystem import Subsystem
from pants.util.contextutil import pushd

from pants.contrib.node.subsystems.package_managers import (PACKAGE_MANAGER_NPM,
                                                            PACKAGE_MANAGER_YARNPKG)
from pants.contrib.node.subsystems.resolvers.node_resolver_base import NodeResolverBase
from pants.contrib.node.targets.node_module import NodeModule
from pants.contrib.node.tasks.node_resolve import NodeResolve

class NpmResolver(Subsystem, NodeResolverBase):
  options_scope = 'npm-resolver'

  @classmethod
  def register_options(cls, register):
    super(NpmResolver, cls).register_options(register)
    register(
      '--install-optional', type=bool, default=False, fingerprint=True,
      help='If enabled, install optional dependencies.')
    NodeResolve.register_resolver_for_type(NodeModule, cls)

  def resolve_target(self, node_task, target, results_dir, node_paths):
    self._copy_sources(target, results_dir)
    with pushd(results_dir):
      if not os.path.exists('package.json'):
        raise TaskError(
          'Cannot find package.json. Did you forget to put it in target sources?')
      # TODO: remove/remodel the following section when node_module dependency is fleshed out.
      package_manager = node_task.get_package_manager(target=target).name
      if package_manager == PACKAGE_MANAGER_NPM:
        if os.path.exists('npm-shrinkwrap.json'):
          node_task.context.log.info('Found npm-shrinkwrap.json, will not inject package.json')
        else:
          node_task.context.log.warn(
            'Cannot find npm-shrinkwrap.json. Did you forget to put it in target sources? '
            'This package will fall back to inject package.json with pants BUILD dependencies '
            'including node_remote_module and other node dependencies. However, this is '
            'not fully supported.')
          self._emit_package_descriptor(node_task, target, results_dir, node_paths)
      elif package_manager == PACKAGE_MANAGER_YARNPKG:
        if not os.path.exists('yarn.lock'):
          raise TaskError(
            'Cannot find yarn.lock. Did you forget to put it in target sources?')

      result, command = node_task.install_module(
        target=target, install_optional=self.get_options().install_optional,
        workunit_name=target.address.reference(),
        workunit_labels=[WorkUnitLabel.COMPILER])
      if result != 0:
        raise TaskError('Failed to resolve dependencies for {}:\n\t{} failed with exit code {}'
                        .format(target.address.reference(), command, result))

  @staticmethod
  def _emit_package_descriptor(node_task, target, results_dir, node_paths):
    dependencies = {
      dep.package_name: node_paths.node_path(dep) if node_task.is_node_module(dep) else dep.version
      for dep in target.dependencies
    }

    package_json_path = os.path.join(results_dir, 'package.json')

    if os.path.isfile(package_json_path):
      with open(package_json_path, 'r') as fp:
        package = json.load(fp)
    else:
      package = {}

    if not package.has_key('name'):
      package['name'] = target.package_name
    elif package['name'] != target.package_name:
      raise TaskError('Package name in the corresponding package.json is not the same '
                      'as the BUILD target name for {}'.format(target.address.reference()))

    if not package.has_key('version'):
      package['version'] = '0.0.0'

    # TODO(Chris Pesto): Preserve compatibility with normal package.json files by dropping existing
    # dependency fields. This lets Pants accept working package.json files from standalone projects
    # that can be "npm install"ed without Pants. Taking advantage of this means expressing
    # dependencies in package.json and BUILD, though. In the future, work to make
    # Pants more compatible with package.json to eliminate duplication if you still want your
    # project to "npm install" through NPM by itself.
    dependencies_to_remove = [
      'dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'
    ]
    node_task.context.log.debug(
      'Removing {} from package.json for {}'.format(dependencies_to_remove, package['name']))
    for dependencyType in dependencies_to_remove:
      package.pop(dependencyType, None)

    node_task.context.log.debug(
      'Adding {} to package.json for {}'.format(dependencies, package['name']))
    package['dependencies'] = dependencies

    with open(package_json_path, 'wb') as fp:
      json.dump(package, fp, indent=2)


text:
class Viscosity < Cask
  url 'http://www.sparklabs.com/downloads/Viscosity.dmg'
  homepage 'http://www.sparklabs.com/viscosity/'
  version 'latest'
  sha256 :no_check
  link 'Viscosity.app'
end


text:
package org.acme.piemme.biancheria;
/**
 * Partecipante: AbstractProduct
 * dichiara un'interfaccia del prodotto astratto
 */
public interface Lenzuolo {

	String fantasia();

	String personaggio();

}


text:
<?php

namespace Flash\Bundle\DefaultBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Symfony\Component\Validator\Constraints as Assert;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;

/**
 * Account
 *
 * @ORM\Table(name="account")
 * @ORM\Entity
 * @ORM\Entity(repositoryClass="Flash\Bundle\DefaultBundle\Repository\AccountRepository")
 * @ExclusionPolicy("all")
 */
class Account implements AdvancedUserInterface {

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @Expose
     */
    protected $id;

    /**
     * @var string
     * @Type("string")
     * @ORM\Column(name="username", type="string", length=255, nullable=true)
     */
    protected $username;

    /**
     * @var string
     * @Type("string")
     * @ORM\Column(name="first_name", type="string", length=255)
     * @Assert\NotBlank(message = "Поле не может быть пустым")
     * @Assert\MinLength(limit=2, message = "Поле не может иметь менее 2 символов")
     * @Expose
     */
    protected $firstName;

    /**
     * @var string
     * @Type("string")
     * @ORM\Column(name="last_name", type="string", length=255)
     * @Assert\NotBlank(message = "Поле не может быть пустым")
     * @Assert\MinLength(limit=2, message = "Поле не может иметь менее 2 символов")
     * @Expose
     */
    protected $lastName;

    /**
     * @ORM\Column(type="string", length=32)
     */
    protected $salt;

    /**
     * @ORM\Column(type="string", length=60)
     * @Assert\NotBlank(message = "Поле email не может быть пустым")
     * @Assert\Email(message = "Введите корректный email")
     */
    protected $email;

    /**
     * @ORM\ManyToMany(targetEntity="Role", inversedBy="Account")
     * @Expose
     */
    protected $roles;

    /**
     * @ORM\Column(name="city_id", type="integer")
     * @Assert\NotBlank(message = "Поле не city может быть пустым")
     */
    protected $city;

    /**
     * @ORM\Column(name="country_id", type="integer")
     * @Assert\NotBlank(message = "Поле country не может быть пустым")
     */
    protected $country;

    /**
     * @var date
     *
     * @ORM\Column(name="registered", type="datetime")
     */
    protected $dateRegist;

    /**
     * @ORM\Column(name="is_active", type="boolean")
     */
    protected $isActive;

    /**
     * @var string
     *
     * @ORM\Column(name="password", type="string", length=255)
     * @Assert\NotBlank(message = "Поле password не может быть пустым")
     */
    protected $password;

    /**
     * @ORM\Column(type="text", nullable=true)
     */
    protected $about;

    /**
     * @ManyToOne(targetEntity="Group", inversedBy="accounts")
     */
    protected $group;

    /**
     * @ManyToOne(targetEntity="\Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment", inversedBy="rating")
     */
    protected $photoCommentLike;

    /**
     * @OneToMany(targetEntity="\Flash\Bundle\DefaultBundle\Entity\Event", mappedBy="account")
     */
    protected $events;

    /**
     * @OneToMany(targetEntity="Comment", mappedBy="account")
     */
    protected $comments;

    /**
     * @OneToMany(targetEntity="\Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment", mappedBy="account")
     */
    protected $photoComments;

    /**
     * @Expose
     * @ORM\ManyToMany(targetEntity="\Flash\Bundle\DefaultBundle\Entity\Calendar\CalendarEvent", inversedBy="\Flash\Bundle\DefaultBundle\Entity\Account")
     */
    protected $calendarEvents;

    /**
     * @Expose
     * @ORM\ManyToMany(targetEntity="Photo", inversedBy="rating")
     */
    protected $photoLike;

    /**
     * @OneToMany(targetEntity="Photo", mappedBy="account")
     */
    protected $photos;

    /**
     * @OneToMany(targetEntity="Album", mappedBy="account")
     */
    protected $albums;

    /**
     * @OneToMany(targetEntity="CustomRole", mappedBy="account")
     */
    protected $customRoles;

    /**
     * @ManyToOne(targetEntity="Account", inversedBy="followers")
     * @Expose
     */
    protected $following;

    /**
     * @OneToMany(targetEntity="Account", mappedBy="following")
     * @Expose
     */
    protected $followers;

    /**
     * @var boolean
     *
     * @ORM\Column(name="is_leader", type="boolean")
     * @Expose
     */
    protected $isLeader = false;

    /**
     * @OneToMany(targetEntity="Video", mappedBy="account")
     */
    protected $videos;

    public function __construct() {

        $this->isActive = true;
        $this->salt = md5(uniqid(null, true));
        $this->roles = new ArrayCollection();
        $this->customRoles = new ArrayCollection();
        $this->events = new ArrayCollection();
        $this->userEvents = new ArrayCollection();
        $this->photos = new ArrayCollection();
        $this->videos = new ArrayCollection();
        $this->photoComments = new ArrayCollection();
        $this->photoAlbums = new ArrayCollection();
        $this->photoLike = new ArrayCollection();
        $this->calendarEvents = new ArrayCollection();
        $this->followers = new ArrayCollection();
    }

    public function equals(\Symfony\Component\Security\Core\User\UserInterface $user) {
        return $this->getEmail() === $user->getEmail();
    }

    public function __toString() {
        return "Account object:  " . $this->username . " " . $this->email;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Account
     */
    public function setUsername($name) {
        $this->username = $name;
        return $this;
    }

    /**
     * Set password
     *
     * @param string $password
     * @return Account
     */
    public function setPassword($password) {
        $this->password = $password;
        return $this;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword() {
        return $this->password;
    }

    /**
     * Set salt
     *
     * @param string $salt
     * @return Account
     */
    public function setSalt($salt) {
        $this->salt = $salt;
        return $this;
    }

    /**
     * Set email
     *
     * @param string $email
     * @return Account
     */
    public function setEmail($email) {
        $this->email = $email;
        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail() {
        return $this->email;
    }

    /**
     * Set isActive
     *
     * @param boolean $isActive
     * @return Account
     */
    public function setIsActive($isActive) {
        $this->isActive = $isActive;
        return $this;
    }

    /**
     * Get isActive
     *
     * @return boolean
     */
    public function getIsActive() {
        return $this->isActive;
    }

    /**
     * @return boolean
     */
    public function isAccountNonExpired() {
        return true;
    }

    /**
     * @return boolean
     */
    public function isAccountNonLocked() {
        return true;
    }

    /**
     * @return boolean
     */
    public function isCredentialsNonExpired() {
        return true;
    }

    /**
     * @return boolean
     */
    public function isEnabled() {
        return true;
    }

    /**
     * Add roles
     *
     * @param \Symfony\Component\Security\Core\Role\RoleInterface $role
     * @return Account
     */
    public function addRole(\Symfony\Component\Security\Core\Role\RoleInterface $role) {
        $this->roles[] = $role;

        return $this;
    }

    /**
     * Remove roles
     *
     * @param \Symfony\Component\Security\Core\Role\RoleInterface $role
     */
    public function removeRole(\Symfony\Component\Security\Core\Role\RoleInterface $role) {
        $this->roles->removeElement($role);
    }

    /**
     * Get roles
     *
     * @return array
     */
    public function getRoles() {

        $roles = $this->roles->getValues();
        $roleNames = array();
        foreach ($roles as $role) {
            $rolesNames[] = $role->getRole();
        }

        if (NULL != $this->getCustomRoles()) {
            $cRoles = $this->customRoles->getValues();
            foreach ($cRoles as $r) {
                $rolesNames[] = $r->getRole();
            }
        }
        return $rolesNames;
    }

    public function eraseCredentials() {

    }

    public function getSalt() {
        return $this->salt;
    }

    public function getUsername() {
        return $this->username;
    }

    /**
     * Set about
     *
     * @param string $about
     * @return Account
     */
    public function setAbout($about) {
        $this->about = $about;

        return $this;
    }

    /**
     * Get about
     *
     * @return string
     */
    public function getAbout() {
        return $this->about;
    }

    /**
     * Set group
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Group $group
     * @return Account
     */
    public function setGroup(\Flash\Bundle\DefaultBundle\Entity\Group $group = null) {
        $this->group = $group;

        return $this;
    }

    /**
     * Get group
     *
     * @return \Flash\Bundle\DefaultBundle\Entity\Group
     */
    public function getGroup() {
        return $this->group;
    }

    /**
     * Add photos
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Photo $photos
     * @return Account
     */
    public function addPhoto(\Flash\Bundle\DefaultBundle\Entity\Photo $photos) {
        $this->photos[] = $photos;

        return $this;
    }

    /**
     * Remove photos
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Photo $photos
     */
    public function removePhoto(\Flash\Bundle\DefaultBundle\Entity\Photo $photos) {
        $this->photos->removeElement($photos);
    }

    /**
     * Get photos
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPhotos() {
        return $this->photos;
    }

    /**
     * Add videos
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Video $videos
     * @return Account
     */
    public function addVideo(\Flash\Bundle\DefaultBundle\Entity\Video $videos) {
        $this->videos[] = $videos;

        return $this;
    }

    /**
     * Remove videos
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Video $videos
     */
    public function removeVideo(\Flash\Bundle\DefaultBundle\Entity\Video $videos) {
        $this->videos->removeElement($videos);
    }

    /**
     * Get videos
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getVideos() {
        return $this->videos;
    }

    /**
     * Set city
     *
     * @param integer $city
     * @return Account
     */
    public function setCity($city) {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city
     *
     * @return integer
     */
    public function getCity() {
        return $this->city;
    }

    /**
     * Set country
     *
     * @param integer $country
     * @return Account
     */
    public function setCountry($country) {
        $this->country = $country;

        return $this;
    }

    /**
     * Get country
     *
     * @return integer
     */
    public function getCountry() {
        return $this->country;
    }

    /**
     * Add events
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Event $events
     * @return Account
     */
    public function addEvent(\Flash\Bundle\DefaultBundle\Entity\Event $events) {
        $this->events[] = $events;

        return $this;
    }

    /**
     * Remove events
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Event $events
     */
    public function removeEvent(\Flash\Bundle\DefaultBundle\Entity\Event $events) {
        $this->events->removeElement($events);
    }

    /**
     * Get events
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEvents() {
        return $this->events;
    }

    /**
     * Set dateRegist
     *
     * @param \DateTime $dateRegist
     * @return Account
     */
    public function setDateRegistration($dateRegist) {
        $this->dateRegist = $dateRegist;

        return $this;
    }

    /**
     * Get dateRegist
     *
     * @return \DateTime
     */
    public function getDateRegistration() {
        return $this->dateRegist;
    }

    /**
     * Add userEvents
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\UserEvent $userEvents
     * @return Account
     */
    public function addUserEvent(\Flash\Bundle\DefaultBundle\Entity\UserEvent $userEvents) {
        $this->userEvents[] = $userEvents;

        return $this;
    }

    /**
     * Remove userEvents
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\UserEvent $userEvents
     */
    public function removeUserEvent(\Flash\Bundle\DefaultBundle\Entity\UserEvent $userEvents) {
        $this->userEvents->removeElement($userEvents);
    }

    /**
     * Get userEvents
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getUserEvents() {
        return $this->userEvents;
    }

    /**
     * Set firstName
     *
     * @param string $firstName
     * @return Account
     */
    public function setFirstName($firstName) {
        $this->firstName = $firstName;

        return $this;
    }

    /**
     * Get firstName
     *
     * @return string
     */
    public function getFirstName() {
        return $this->firstName;
    }

    /**
     * Set lastName
     *
     * @param string $lastName
     * @return Account
     */
    public function setLastName($lastName) {
        $this->lastName = $lastName;

        return $this;
    }

    /**
     * Get lastName
     *
     * @return string
     */
    public function getLastName() {
        return $this->lastName;
    }

    /**
     * Add customRoles
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\CustomRole $customRoles
     * @return Account
     */
    public function addCustomRole(\Symfony\Component\Security\Core\Role\RoleInterface $customRoles) {
        $this->customRoles[] = $customRoles;

        return $this;
    }

    /**
     * Remove customRoles
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\CustomRole $customRoles
     */
    public function removeCustomRole(\Symfony\Component\Security\Core\Role\RoleInterface $customRoles) {
        $this->customRoles->removeElement($customRoles);
    }

    /**
     * Get customRoles
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCustomRoles() {

        $rolesNames = null;
        $cRoles = $this->customRoles->getValues();
        foreach ($cRoles as $r) {
            $rolesNames[] = $r->getRole();
        }
        return $rolesNames;
    }

    /**
     * Add comments
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Comment $comments
     * @return Account
     */
    public function addComment(\Flash\Bundle\DefaultBundle\Entity\Comment $comments) {
        $this->comments[] = $comments;

        return $this;
    }

    /**
     * Remove comments
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Comment $comments
     */
    public function removeComment(\Flash\Bundle\DefaultBundle\Entity\Comment $comments) {
        $this->comments->removeElement($comments);
    }

    /**
     * Get comments
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getComments() {
        return $this->comments;
    }

    /**
     * Add photoComments
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment $photoComments
     * @return Account
     */
    public function addPhotoComment(\Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment $photoComments) {
        $this->photoComments[] = $photoComments;

        return $this;
    }

    /**
     * Remove photoComments
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment $photoComments
     */
    public function removePhotoComment(\Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment $photoComments) {
        $this->photoComments->removeElement($photoComments);
    }

    /**
     * Get photoComments
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPhotoComments() {
        return $this->photoComments;
    }

    /**
     * Set dateRegist
     *
     * @param \DateTime $dateRegist
     * @return Account
     */
    public function setDateRegist($dateRegist) {
        $this->dateRegist = $dateRegist;

        return $this;
    }

    /**
     * Get dateRegist
     *
     * @return \DateTime
     */
    public function getDateRegist() {
        return $this->dateRegist;
    }

    /**
     * Set photoCommentLike
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment $photoCommentLike
     * @return Account
     */
    public function setPhotoCommentLike(\Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment $photoCommentLike = null) {
        $this->photoCommentLike = $photoCommentLike;

        return $this;
    }

    public function removePhotoCommentLike() {
        unset($this->photoCommentLike);

        return $this;
    }

    /**
     * Get photoCommentLike
     *
     * @return \Flash\Bundle\DefaultBundle\Entity\Comment\PhotoComment
     */
    public function getPhotoCommentLike() {
        return $this->photoCommentLike;
    }

    /**
     * Add calendarEvents
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Calendar\CalendarEvent $calendarEvents
     * @return Account
     */
    public function addCalendarEvent(\Flash\Bundle\DefaultBundle\Entity\Calendar\CalendarEvent $calendarEvents) {
        $this->calendarEvents[] = $calendarEvents;

        return $this;
    }

    /**
     * Remove calendarEvents
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Calendar\CalendarEvent $calendarEvents
     */
    public function removeCalendarEvent(\Flash\Bundle\DefaultBundle\Entity\Calendar\CalendarEvent $calendarEvents) {
        $this->calendarEvents->removeElement($calendarEvents);
    }

    /**
     * Get calendarEvents
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCalendarEvents() {
        return $this->calendarEvents;
    }

    /**
     * Set following
     *
     * @param \Symfony\Component\Security\Core\User\UserInterface $following
     * @return Account
     */
    public function setFollowing(\Symfony\Component\Security\Core\User\UserInterface $following = null)
    {
        $this->following = $following;

        return $this;
    }

    /**
     * Get following
     *
     * @return \Flash\Bundle\DefaultBundle\Entity\Account
     */
    public function getFollowing()
    {
        return $this->following;
    }

    /**
     * Add followers
     *
     * @param \Symfony\Component\Security\Core\User\UserInterface $follower
     * @return Account
     */
    public function addFollower(\Symfony\Component\Security\Core\User\UserInterface $follower)
    {
        $this->followers[] = $follower;

        return $this;
    }

    /**
     * Remove followers
     *
     * @param \Symfony\Component\Security\Core\User\UserInterface $follower
     */
    public function removeFollower(\Symfony\Component\Security\Core\User\UserInterface $follower)
    {
        $this->followers->removeElement($follower);
    }

    /**
     * Get followers
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFollowers()
    {
        return $this->followers;
    }

    /**
     * Set isLeader
     *
     * @param boolean $isLeader
     * @return Account
     */
    public function setIsLeader($isLeader)
    {
        $this->isLeader = $isLeader;

        return $this;
    }

    /**
     * Get isLeader
     *
     * @return boolean
     */
    public function getIsLeader()
    {
        return $this->isLeader;
    }

    /**
     * Add photoAlbums
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\PhotoAlbum $photoAlbums
     * @return Account
     */
    public function addAlbum(\Flash\Bundle\DefaultBundle\Entity\Album $album)
    {
        $this->albums[] = $album;

        return $this;
    }

    /**
     * Remove photoAlbums
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\PhotoAlbum
     */
    public function removeAlbum(\Flash\Bundle\DefaultBundle\Entity\Album $album)
    {
        $this->albums->removeElement($album);
    }

    /**
     * Get photoAlbums
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAlbums()
    {
        return $this->albums;
    }

    /**
     * Add photoLike
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Photo $photoLike
     * @return Account
     */
    public function addPhotoLike(\Flash\Bundle\DefaultBundle\Entity\Photo $photoLike)
    {
        $this->photoLike[] = $photoLike;

        return $this;
    }

    /**
     * Remove photoLike
     *
     * @param \Flash\Bundle\DefaultBundle\Entity\Photo $photoLike
     */
    public function removePhotoLike(\Flash\Bundle\DefaultBundle\Entity\Photo $photoLike)
    {
        $this->photoLike->removeElement($photoLike);
    }

    /**
     * Get photoLike
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPhotoLike()
    {
        return $this->photoLike;
    }
}


text:
class StandardSkillResultCalculator
  # describes whether the given competitor has any results associated
  def competitor_has_result?(competitor)
    competitor.standard_skill_scores.any?
  end

  # returns the result to be displayed for this competitor
  def competitor_result(competitor)
    if competitor.has_result?
      total_points(competitor)
    end
  end

  # returns the result for this competitor
  def competitor_comparable_result(competitor, with_ineligible: nil) # rubocop:disable Lint/UnusedMethodArgument
    if competitor.has_result?
      total_points(competitor)
    else
      0
    end
  end

  def competitor_tie_break_comparable_result(competitor)
    return 0 if competitor.standard_skill_scores.none?

    # maximum Execution score
    base_points = get_base_points(competitor)

    total_score = competitor.standard_skill_scores.to_a.sum do |skill_score|
      base_points - skill_score.total_execution_devaluation
    end

    total_score / competitor.standard_skill_scores.count
  end

  def eager_load_results_relations(competitors)
    competitors.includes(
      :standard_skill_scores,
      standard_kill_routine: [standard_skill_routine_entries: :standard_skill_entry]
    )
  end

  # Calculate the total number of points for a given competitor
  # Minimum value is 0
  #
  # return a numeric
  def total_points(competitor)
    base_points = get_base_points(competitor)

    total_score = competitor.standard_skill_scores.to_a.sum do |skill_score|
      [0, base_points - skill_score.total_execution_devaluation - skill_score.total_difficulty_devaluation].max
    end

    # minimum value is 0
    total_score / competitor.standard_skill_scores.count
  end

  private

  def get_base_points(competitor)
    competitor.standard_skill_routine.total_skill_points
  end
end


text:
RSpec.describe MainJob do
  it_behaves_like "sidekiq with options" do
    let(:options) do
      {
        "queue" => :customqueue,
        "retry" => true,
        "lock" => :until_executed,
      }
    end
  end
  it_behaves_like "a performing worker" do
    let(:args) { "one" }
  end
end


text:
<?php

namespace Arrayy\tests;

use function Arrayy\array_first;
use function Arrayy\array_last;
use Arrayy\Arrayy;
use Arrayy\Arrayy as A;
use Arrayy\ArrayyIterator;

/**
 * Copy of a test class from "https://github.com/bocharsky-bw/Arrayzy/"
 *
 * @internal
 */
final class BasicArrayTest extends \PHPUnit\Framework\TestCase
{
    const TYPE_ASSOC = 'assoc';

    const TYPE_EMPTY = 'empty';

    const TYPE_MIXED = 'mixed';

    const TYPE_NUMERIC = 'numeric';

    /**
     * @var class-string<\Arrayy\Arrayy<array-key, mixed>>
     */
    protected $arrayyClassName = A::class;

    /**
     * @return array
     */
    public function simpleArrayProvider(): array
    {
        return [
            'empty_array' => [
                [],
                self::TYPE_EMPTY,
            ],
            'indexed_array' => [
                [
                    1 => 'one',
                    2 => 'two',
                    3 => 'three',
                ],
                self::TYPE_NUMERIC,
            ],
            'assoc_array' => [
                [
                    'one'   => 1,
                    'two'   => 2,
                    'three' => 3,
                ],
                self::TYPE_ASSOC,
            ],
            'mixed_array' => [
                [
                    1     => 'one',
                    'two' => 2,
                    3     => 'three',
                    4     => ['1', '2'],
                ],
                self::TYPE_MIXED,
            ],
        ];
    }

    /**
     * @return array
     */
    public function stringWithSeparatorProvider(): array
    {
        return [
            [
                's,t,r,i,n,g',
                ',',
            ],
            [
                'He|ll|o',
                '|',
            ],
            [
                'Wo;rld',
                ';',
            ],
        ];
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testContains(array $array)
    {
        $element = 2;

        $arrayy = $this->createArrayy($array);
        $isContains = \in_array($element, $array, true);

        static::assertSame($isContains, $arrayy->contains($element));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testContainsKey(array $array)
    {
        $key = 2;

        $arrayy = $this->createArrayy($array);
        $isContainsKey = \array_key_exists($key, $array);

        static::assertSame($isContainsKey, $arrayy->containsKey($key));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testCount(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $count = \count($array);

        static::assertSame($count, $arrayy->count());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testCurrent(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $current = \current($array);
        $array = $arrayy->getArray();

        static::assertSame($current, \current($array));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testDebugReturn(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $printed = \print_r($array, true);

        static::assertSame($printed, \print_r($arrayy->toArray(), true));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testExists(array $array)
    {
        $callable = static function ($value, $key) {
            return $key === 2 && $value === 'two';
        };

        $arrayy = $this->createArrayy($array);
        $isExists = isset($array[2]) && $array[2] === 'two';

        static::assertSame($isExists, $arrayy->exists($callable));
    }

    public function testFind()
    {
        $callable = static function ($value, $key) {
            return $value === 'a' && $key > 2;
        };

        $a = $this->createArrayy(['a', 'b', 'c', 'b', 'a']);
        $found = $a->find($callable);

        static::assertSame('a', $found);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testFirstMutable(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $first = \reset($array);

        if ($first === false) {
            $first = [];
        } else {
            $first = (array) $first;
        }

        static::assertSame($first, $arrayy->firstsMutable()->getArray());
        static::assertSame($arrayy->firstsMutable(), $arrayy->firstsMutable());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testFirstInLoop(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $first = \reset($array);

        if ($first === false) {
            $first = [];
        } else {
            $first = (array) $first;
        }

        if ($arrayy->firstsMutable()->getArray() === []) {
            static::assertSame([], $first);
        }

        $count = $arrayy->count();
        $tmpCount = 0;
        foreach ($arrayy as $item) {
            ++$tmpCount;

            static::assertTrue(\is_int($item) || \is_string($item) || \is_array($item));
            /** @noinspection DisconnectedForeachInstructionInspection */
            static::assertSame($first, $arrayy->firstsMutable()->getArray());
        }

        static::assertSame($count, $tmpCount);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testFirstImmutable(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $first = \reset($array);

        if ($first === false) {
            $first = [];
        } else {
            $first = (array) $first;
        }

        static::assertSame($first, $arrayy->firstsImmutable()->getArray());
        static::assertNotSame($arrayy->firstsImmutable(), $arrayy->firstsImmutable());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testFirstImmutableInLoop(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $first = \reset($array);

        if ($first === false) {
            $first = [];
        } else {
            $first = (array) $first;
        }

        if ($arrayy->firstsMutable()->getArray() === []) {
            static::assertSame([], $first);
        }

        $count = $arrayy->count();
        $tmpCount = 0;
        foreach ($arrayy as $item) {
            ++$tmpCount;

            static::assertTrue(\is_int($item) || \is_string($item) || \is_array($item));
            /** @noinspection DisconnectedForeachInstructionInspection */
            static::assertSame($first, $arrayy->firstsImmutable()->getArray());
        }

        static::assertSame($count, $tmpCount);
    }

    public function testForEachWithInnerArrayy()
    {
        $arrayy = $this->createArrayy(['foo' => [3 => [33, 34, 35], 2 => [22, 23, 24], 1 => [11, 12, 13]]]);

        foreach ($arrayy as $arrayyInner) {
            static::assertInstanceOf(\Arrayy\Arrayy::class, $arrayyInner);
            static::assertSame([3, 2, 1], $arrayyInner->getKeys()->getArray());

            foreach ($arrayyInner as $arrayyInnerInnerKey => $arrayyInnerInner) {
                static::assertInstanceOf(\Arrayy\Arrayy::class, $arrayyInnerInner);

                if ($arrayyInnerInnerKey === 3) {
                    /* @var $arrayyInnerInner \Arrayy\Arrayy */
                    static::assertSame([33, 34, 35], $arrayyInnerInner->getArray());
                }
            }
        }
    }

    public function testGetIterator()
    {
        $arrayy = $this->createArrayy(['foo', 'bar', 1, null]);

        $result = $arrayy->getIterator();
        static::assertInstanceOf('ArrayIterator', $result);

        $result->next();
        static::assertSame('bar', $result->current());
    }

    public function testRecursiveIterator()
    {
        $arrayy = Arrayy::create(['1', '1', Arrayy::create(['2', '2', '2', Arrayy::create(['3', 3])]), 1]);

        $result = $arrayy->getArray(true);
        $expected = [
            0 => '1',
            1 => '1',
            2 => [
                0 => '2',
                1 => '2',
                2 => '2',
                3 => [
                    0 => '3',
                    1 => 3,
                ],
            ],
            3 => 1,
        ];

        static::assertSame($expected, $result);
    }

    public function testGetIteratorWithSubArray()
    {
        $arrayy = $this->createArrayy(['foo' => [3, 2, 1], 'bar' => [1, 2, 3], 1, null]);

        $result = $arrayy->getIterator();
        static::assertInstanceOf(\ArrayIterator::class, $result);
        static::assertInstanceOf(ArrayyIterator::class, $result);

        $result->next();
        static::assertSame([1, 2, 3], $result->current()->getArray());
        static::assertSame([1, 2, 3], $result->current()->getArray());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetKeys(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $keys = \array_keys($array);

        static::assertSame($keys, $arrayy->keys()->getArray());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetObject(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $result = \Arrayy\Arrayy::createFromObjectVars($arrayy->getObject())->toArray();

        static::assertSame($array, $result, \print_r($result, true));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetRandom(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $value = $arrayy->getRandom()->getArray();

        if (\count($value) > 0) {
            static::assertNotNull($value[0]);
            static::assertContains($value[0], $arrayy->toArray());
        } else {
            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($value);
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $value);
            }
        }
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetRandomKey(array $array)
    {
        $arrayy = $this->createArrayy($array);

        if ($arrayy->count() > 0) {
            /** @var array-key $key */
            $key = $arrayy->getRandomKey();

            static::assertNotNull($key);
            static::assertArrayHasKey($key, $arrayy->toArray());
        } else {
            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($arrayy->getArray());
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $arrayy->getArray());
            }
        }
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetRandomKeys(array $array)
    {
        $arrayy = $this->createArrayy($array);

        if (\count($array) < 2) {
            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($arrayy->getArray());
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $arrayy->getArray());
            }
        } else {
            $keys = $arrayy->getRandomKeys(2);

            static::assertCount(2, $keys);
            foreach ($keys as $key) {
                static::assertArrayHasKey($key, $array);
            }
        }
    }

    public function testGetRandomKeysLogicExceptionGivenZero()
    {
        $this->expectException(\RangeException::class);

        $arrayy = $this->createArrayy(['a', 'b', 'c']);
        $arrayy->getRandomKeys(0);
    }

    public function testGetRandomKeysRangeException()
    {
        $this->expectException(\RangeException::class);

        $arrayy = $this->createArrayy(['a', 'b', 'c']);
        $arrayy->getRandomKeys(4);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetRandomKeysShouldReturnArray(array $array)
    {
        $arrayy = $this->createArrayy($array);

        if (\count($array) === 0) {
            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($arrayy->getArray());
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $arrayy->getArray());
            }
        } else {
            $keys = $arrayy->getRandomKeys(\count($array))->getArray();

            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($keys);
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $keys);
            }
        }
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetRandomValueSingle(array $array)
    {
        $arrayy = $this->createArrayy($array);

        if (\count($array) === 0) {
            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($arrayy->getArray());
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $arrayy->getArray());
            }
        } else {
            $value = $arrayy->getRandomValue();

            if ($value instanceof \Arrayy\Arrayy) {
                $valueFirst = $value->first();
                static::assertTrue((new A($array))->contains($valueFirst, true, true));
            } else {
                static::assertContains($value, $array);
            }
        }
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetRandomValues(array $array)
    {
        $arrayy = $this->createArrayy($array);

        if (\count($array) < 2) {
            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($arrayy->getArray());
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $arrayy->getArray());
            }

            return;
        }

        $values = $arrayy->getRandomValues(2);

        static::assertCount(2, $values);
        foreach ($values as $value) {
            if (!$value instanceof \Arrayy\Arrayy) {
                static::assertContains($value, $array);
            }
        }
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testGetRandomValuesSingle(array $array)
    {
        $arrayy = $this->createArrayy($array);

        if (\count($array) === 0) {
            if (\method_exists(__CLASS__, 'assertIsArray')) {
                static::assertIsArray($arrayy->getArray());
            } else {
                /** @noinspection PhpUndefinedMethodInspection */
                static::assertInternalType('array', $arrayy->getArray());
            }

            return;
        }

        $values = $arrayy->getRandomValues(1)->getArray();

        static::assertCount(1, $values);
        if (\method_exists(__CLASS__, 'assertIsArray')) {
            static::assertIsArray($arrayy->getArray());
        } else {
            /** @noinspection PhpUndefinedMethodInspection */
            static::assertInternalType('array', $arrayy->getArray());
        }
        foreach ($values as $value) {
            if (!$value instanceof \Arrayy\Arrayy) {
                static::assertContains($value, $array);
            }
        }
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testIndexOf(array $array)
    {
        $element = 2;

        $arrayy = $this->createArrayy($array);
        $key = \array_search($element, $array, true);

        static::assertSame($key, $arrayy->indexOf($element));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array  $array
     * @param string $type
     */
    public function testIsAssoc(array $array, $type = null)
    {
        $arrayy = $this->createArrayy($array);
        $isAssoc = static::TYPE_ASSOC === $type;

        static::assertSame($isAssoc, $arrayy->isAssoc());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testIsEmpty(array $array)
    {
        $isEmpty = !$array;
        $arrayy = $this->createArrayy($array);

        static::assertSame($isEmpty, $arrayy->isEmpty());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array  $array
     * @param string $type
     */
    public function testIsNumeric(array $array, $type = null)
    {
        $arrayy = $this->createArrayy($array);
        $isNumeric = static::TYPE_NUMERIC === $type;

        static::assertSame($isNumeric, $arrayy->isNumeric());
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testKey(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $key = \key($array);
        $array = $arrayy->getArray();

        static::assertSame($key, \key($array));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testLast(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $last = \end($array);
        $result = $arrayy->last();

        if (empty($array)) {
            $last = null;
        }

        if ($result instanceof Arrayy) {
            $result = $result->getArray();
        }

        static::assertSame($last, $result);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testLastKey(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $last = \array_key_last($array);
        $result = $arrayy->lastKey();

        if (empty($array)) {
            $last = null;
        }

        /* @phpstan-ignore-next-line */
        if ($result instanceof Arrayy) {
            $result = $result->getArray();
        }

        static::assertSame($last, $result);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testArrayyFirst(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $first = array_first($array);
        $result = $arrayy->first();

        if (empty($array)) {
            $first = null;
        }

        if ($result instanceof Arrayy) {
            $result = $result->getArray();
        }

        static::assertSame($first, $result);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testArrayyLast(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $first = array_last($array);
        $result = $arrayy->last();

        if (empty($array)) {
            $first = null;
        }

        if ($result instanceof Arrayy) {
            $result = $result->getArray();
        }

        static::assertSame($first, $result);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testFirstKey(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $first = \array_key_first($array);
        $result = $arrayy->firstKey();

        if (empty($array)) {
            $first = null;
        }

        static::assertSame($first, $result);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testMostUsedValue(array $array)
    {
        $arrayy = $this->createArrayy($array);
        if ($arrayy->isMultiArray()) {
            // not supported by php (array_count_values)
            static::assertTrue(true);

            return;
        }

        $first = \array_count_values($array);
        \arsort($first);
        $first = \array_key_first($first);

        $result = $arrayy->mostUsedValue();

        if (empty($array)) {
            $first = null;
        }

        if ($result instanceof Arrayy) {
            $result = $result->getArray();
        }

        static::assertSame($first, $result);
    }

    public function testArrayyIterator()
    {
        $iterator = new ArrayyIterator(['foo' => 'bar']);

        $i = 0;
        foreach ($iterator as $key => $element) {
            ++$i;
            static::assertSame('foo', $key);
            static::assertSame('bar', $element);
        }

        static::assertSame(1, $i);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testMostUsedValues(array $array)
    {
        $arrayy = $this->createArrayy($array);
        if ($arrayy->isMultiArray()) {
            // not supported by php (array_count_values)
            static::assertTrue(true);

            return;
        }

        $firsts = \array_count_values($array);
        \arsort($firsts);
        $firsts = \array_keys($firsts);

        $result = $arrayy->mostUsedValues($arrayy->count());

        if (empty($array)) {
            $firsts = [];
        }

        if ($result instanceof Arrayy) {
            $result = $result->getArray();
        }

        static::assertSame($firsts, $result);
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testNext(array $array)
    {
        $arrayy = $this->createArrayy($array)->getArray();
        $next = \next($array);

        static::assertSame($next, \next($arrayy));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testOffsetExists(array $array)
    {
        $offset = 1;
        $isOffsetExists = isset($array[$offset]);

        $arrayy = $this->createArrayy($array);

        static::assertSame($isOffsetExists, $arrayy->offsetExists($offset));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testOffsetGet(array $array)
    {
        $offset = 1;
        $value = $array[$offset] ?? null;

        $arrayy = $this->createArrayy($array);

        static::assertSame($value, $arrayy->offsetGet($offset));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testPrevious(array $array)
    {
        $arrayy = $this->createArrayy($array)->getArray();
        $prev = \prev($array);

        static::assertSame($prev, \prev($arrayy));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testReIndex(array $array)
    {
        $arrayy = $this->createArrayy($array);
        $values = \array_values($array);

        static::assertSame($values, $arrayy->reindex()->getArray());
    }

    public function testReduce()
    {
        $func = static function ($resultArray, $value) {
            if ($value % 2 === 0) {
                $resultArray[] = $value;
            }

            return $resultArray;
        };

        // ---

        $array = [1, 2, 3, 4];
        $arrayy = $this->createArrayy($array);
        $arrayyReduced = $arrayy->reduce($func)->getArray();
        $arrayReduced = (array) \array_reduce($array, $func);

        static::assertSame($arrayReduced, $arrayyReduced);

        // ---

        $generator = static function () {
            return (new A([1, 2, 3, 4]))->getGenerator();
        };

        $arrayy = new A($generator);
        $arrayyReduced = $arrayy->reduce($func)->getArray();
        $arrayReduced = (array) \array_reduce($array, $func);

        static::assertSame($arrayReduced, $arrayyReduced);

        // ---

        $generator = static function () {
            return A::createWithRange(2, 4)->getGenerator();
        };
        $arrayy = A::createFromGeneratorFunction($generator);

        static::assertSame([2, 3, 4], $arrayy->getArray());

        // ---

        $generator = static function () {
            return A::createWithRange(2, 4)->getGenerator();
        };
        $arrayy = A::createFromGeneratorFunction($generator);

        static::assertSame(2, $arrayy->get(0));

        // ---

        $generator = static function () {
            return A::createWithRange(2, 4)->getGenerator();
        };
        $arrayy = A::createFromGeneratorFunction($generator);
        $arrayy->set(0, 99);

        static::assertSame([99, 3, 4], $arrayy->getArray());

        // ---

        $generator = static function () {
            return A::createWithRange(2, 4)->getGenerator();
        };
        $arrayy = A::createFromGeneratorFunction($generator);
        $arrayy->set(0, 99);
        $arrayy = A::createFromGeneratorFunction($generator);

        static::assertSame([2, 3, 4], $arrayy->getArray());
    }

    public function testGetArrayViaGenerator()
    {
        $generator = static function () {
            yield 1 => 2;
            yield 1 => 3;
        };
        $arrayy = A::createFromGeneratorFunction($generator);

        static::assertSame([1 => 3], $arrayy->getArray());

        static::assertSame([2, 3], $arrayy->getArray(false, false));
    }

    public function testGetListViaGenerator()
    {
        $generator = static function () {
            yield 1 => 2;
            yield 1 => 3;
        };
        $arrayy = A::createFromGeneratorFunction($generator);

        static::assertSame([2, 3], $arrayy->getList(false));

        static::assertSame([2, 3], $arrayy->getList(true));
    }

    /**
     * @dataProvider simpleArrayProvider
     *
     * @param array $array
     */
    public function testToJson(array $array)
    {
        $json = \json_encode($array);

        $arrayy = $this->createArrayy($array);

        static::assertSame($json, $arrayy->toJson());
    }

    /**
     * @dataProvider stringWithSeparatorProvider
     *
     * @param string           $string
     * @param non-empty-string $separator
     */
    public function testToString($string, $separator)
    {
        $array = \explode($separator, $string);
        \assert(\is_array($array));

        $arrayy = $this->createArrayy($array);
        $resultString = \implode(',', $array);

        static::assertSame($resultString, (string) $arrayy);
        static::assertSame($string, $arrayy->toString($separator));
    }

    /**
     * @param A<array-key,mixed> $arrayy
     * @param A<array-key,mixed> $resultArrayy
     * @param array              $array
     * @param array              $resultArray
     */
    protected function assertImmutable(A $arrayy, A $resultArrayy, array $array, array $resultArray)
    {
        static::assertNotSame($arrayy, $resultArrayy);
        static::assertSame($array, $arrayy->toArray());
        static::assertSame($resultArray, $resultArrayy->toArray());
    }

    /**
     * @param A<array-key,mixed> $arrayy
     * @param A<array-key,mixed> $resultArrayy
     * @param array              $resultArray
     */
    protected function assertMutable(A $arrayy, A $resultArrayy, array $resultArray)
    {
        static::assertSame($arrayy, $resultArrayy);
        static::assertSame($resultArray, $arrayy->toArray());
        static::assertSame($resultArray, $resultArrayy->toArray());
    }

    // The method list order by ASC

    /**
     * @param array $array
     *
     * @return A<array-key, mixed>
     */
    protected function createArrayy(array $array = []): A
    {
        return new $this->arrayyClassName($array);
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('title', models.CharField(max_length=255)),
                ('article', models.TextField()),
            ],
            options={
            },
            bases=(models.Model,),
        ),
    ]


text:
<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no, minimal-ui"/>
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="css/idangerous.swiper.css" rel="stylesheet" type="text/css" />
    <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href='http://fonts.googleapis.com/css?family=Raleway:300,400,500,600,700%7CDancing+Script%7CMontserrat:400,700%7CMerriweather:400,300italic%7CLato:400,700,900' rel='stylesheet' type='text/css' />
    <link href="css/style.css" rel="stylesheet" type="text/css" />

    <link rel="shortcut icon" href="img/favicon-6.ico" />
    <title>Catalog - PGP (product grid page)</title>

loading

English

                                Italian
                                Russian

Any question? Call Us +380630776632

                            AgentA

                                    Free Shipping
 on order over $200

                                    Support Center
 Working everyday 24/7

                                    Summer Sale
 Even 50% cheaper!

                            Settings
                            Log out

Navigation

                                        <form>
                                            <input type="text" placeholder="Search for product">

                                                <input type="submit">

                                        </form>

                                        Home

                                        Factories

Shop

Product

No Sidebar

Tab No Sidebar

                                        Products

Shop

Product

No Sidebar

Tab No Sidebar

                                        Clients

Shop

Product

No Sidebar

Tab No Sidebar

                                        Specifications

                                AgentA

Created by 8theme. All rights reserved

                    Home
                    All Products
                    Living

                                    1
                                    2
                                    3

...

Sorty by

                                            <select>
                                                <option>Position</option>
                                                <option>Price</option>
                                                <option>Category</option>
                                                <option>Rating</option>
                                                <option>Color</option>
                                            </select>

Show

                                            <select>
                                                <option>12</option>
                                                <option>20</option>
                                                <option>30</option>
                                                <option>40</option>
                                                <option>all</option>
                                            </select>

per page

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

                                        Men clothing
                                        Blue Pullover Batwing Sleeve Zigzag

25 reviews

Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, eiusmod tempor incididunt ut labore et dolore magna aliqua.

$199,99

$119,99

                                            Add to cart
                                             Add to Wishlist

Showing: 1-3 of 16

                                    1
                                    2
                                    3

...

Select space

                                <select class="form-control">
                                    <option selected="selected">Living</option>
                                    <option>Dining</option>
                                    <option>Bedroom</option>
                                    <option>Kitchen</option>
                                    <option>Bath</option>
                                    <option>Kids</option>
                                    <option>Outdoor</option>
                                    <option>Workspace</option>
                                    <option>Storage</option>
                                    <option>Lighting</option>
                                    <option>Accents</option>
                                </select>

Living

Seating

Sofas

Lounge Chairs

Rocking Chairs

Ottomans, Poufs + Bean Bags

Benches

Low Stools

Occasional Tables

Coffee Tables

Side Tables

Console Tables

Media + Storage

Media Cabinets

TV Stands + Mounts

Credenzas

Shelving + Bookcases

Magazine Racks

Accents

Indoor Fireplaces + Tools

Clocks

Mirrors

Area Rugs

Accent Pillows

Throws + Blankets

Style

                                            <input type="checkbox" />  Contemporary

                                            <input type="checkbox" />  Eclectic

                                            <input type="checkbox" />  Modern

                                            <input type="checkbox" />  Traditional

                                            <input type="checkbox" />  Asian

                                            <input type="checkbox" />  Beach Style

                                            <input type="checkbox" />  Craftsman

                                            <input type="checkbox" />  Farmhouse

                                            <input type="checkbox" />  Industrial

                                            <input type="checkbox" />  Mediterranean

                                            <input type="checkbox" />  Midcentury

                                            <input type="checkbox" />  Rustic

                                            <input type="checkbox" />  Scandinavian

                                            <input type="checkbox" />  Southwestern

                                            <input type="checkbox" />  Transitional

                                            <input type="checkbox" />  Tropical

                                            <input type="checkbox" />  Victorian

Price

                                        Price:

£0

                                        -

£200

                                    filter

Brand

                                            <input type="checkbox" />  View all Brands

                                            <input type="checkbox" />  Alessi

                                            <input type="checkbox" />  Blu Dot

                                            <input type="checkbox" />  Calligaris

                                            <input type="checkbox" />  Cattelan Italia

                                            <input type="checkbox" />  Cherner

                                            <input type="checkbox" />  Copeland Furniture

                                            <input type="checkbox" />  Domitalia

                                            <input type="checkbox" />  Fermob

                                            <input type="checkbox" />  Gus* Modern

                                            <input type="checkbox" />  Herman Miller

                                            <input type="checkbox" />  Huppe

                                            <input type="checkbox" />  Kartell

                                            <input type="checkbox" />  Knoll

                                            <input type="checkbox" />  Lapalma

                                            <input type="checkbox" />  Magis

                                            <input type="checkbox" />  Missoni Home

                                            <input type="checkbox" />  Modloft

                                            <input type="checkbox" />  Modernica

                                            <input type="checkbox" />  Moooi

                                            <input type="checkbox" />  Muuto

                                            <input type="checkbox" />  Nanimarquina

                                            <input type="checkbox" />  Steelcase

                                            <input type="checkbox" />  Tom Dixon

                                            <input type="checkbox" />  Vitra

                                            <input type="checkbox" />  Vondom

Sort by colors

                                    Site Map
                                    Terms and Conditions
                                    Advanced Search
                                    Provacy Policy
                                    Contact Us
                                    About Us

Created by AgentA Solutions. All right reserved

        <form>

                <input type="submit" />

All categories

Category 1

Category 2

Category 2

Category 4

Category 5

Lorem

Ipsum

Dollor

Sit Amet

                <input type="text" value="" placeholder="Search for product" />

        </form>


text:
<!doctype html>

	<meta charset='UTF-8' />
	<title>Webpack Starter</title>


text:
  Lugrin est
      une commune géographiquement positionnée dans le département de Haute-Savoie en Rhône-Alpes. Elle totalisait 2 134 habitants en 2008.

À Lugrin le salaire médian par mois par personne est situé à approximativement 1 893 €  net. Ceci est au dessous de la moyenne du pays.

Le nombre de logements, à Lugrin, était réparti en 2011 en 402 appartements et 997 maisons soit
 un marché relativement équilibré.

La commune offre quelques  équipements sportifs, elle propose entre autres un terrain de tennis et un terrain de sport.

À coté de Lugrin sont situées les villes de
Saint-Paul-en-Chablais située à 3 km, 2 027 habitants,
Thollon-les-Mémises située à 3 km, 720 habitants,
Chevenoz à 7 km, 539 habitants,
Vinzier localisée à 6 km, 784 habitants,
Meillerie à 3 km, 303 habitants,
Vacheresse localisée à 8 km, 715 habitants,
 entre autres. De plus, Lugrin est située à seulement quatorze km de Thonon-les-Bains.

À Lugrin, la valorisation moyenne à l'achat d'un appartement se situe à 3 749 € du m² en vente. La valeur moyenne d'une maison à l'achat se situe à 3 635 € du m². À la location la valeur moyenne se situe à 17,25 € du m² par mois.


text:
namespace OpenApoc
{

class TileObjectScenery : public TileObject
{
  public:
	virtual void draw(Renderer &r, TileView &view, Vec2<float> screenPosition, TileViewMode mode);
	virtual ~TileObjectScenery();

	std::weak_ptr<Scenery> scenery;

	sp<Scenery> getOwner();

	virtual sp<VoxelMap> getVoxelMap() override;

  private:
	friend class TileMap;
	TileObjectScenery(TileMap &map, sp<Scenery> scenery);
};

} // namespace OpenApoc


text:
#pragma once

#include "discrete_distribution.h"

#include <Eigen/Dense>

#include <complex>
#include <vector>
#include <cstdint>
#include <iostream>
#include <iomanip>

template<typename distribution = discrete_distribution>
class markov_chain
{
public:

  /// Constructor of a default, uniformly distributed markov chain.
  /// \param _state_count Total number of states.
  /// \param _emission_distribution A single emission probability distribution. It will be used
  ///   the same for every state.
  markov_chain(
    const std::uint64_t _state_count,
    const distribution& _emission_distribution
  );

  /// Constructor of a markov chain with the given initial state vector and its transition matrix
  /// \param _initial_state Vector of initial state probabilities.
  /// \param _transition_matrix Matrix of transition probabilities.
  /// \param _emission_distributions Vector of emission probability distributions. One for each
  ///   state.
  markov_chain(
    const Eigen::RowVectorXd& _initial_state,
    const Eigen::MatrixXd& _transition_matrix,
    const std::vector<distribution>& _emission_distributions
  );

  /// Conversion of the generator matrix of a continuous time markov chain (CTMC) with the given
  /// time step into a discrete transition matrix.
  /// \param _generator_matrix Matrix of expected values for a CTMC.
  /// \param _delta_t Size of a single, discrete time step.
  static Eigen::MatrixXd from_ctmc(const Eigen::MatrixXd& _generator_matrix, const double _delta_t);

  /// Estimate the state vector after the specified number of steps or if the rate of change
  /// threshold requirements are met. With default parameters the function tries to converge on a
  /// stationary solution.
  /// Uses the basic, iterative algorithm.
  /// \param _steps Number of steps to evaluate.
  /// \param _epsilon Threshold for the rate of change of the state vector between each step,
  ///   measured in euclidean distance. Set epsilon to a negative value to deactivate its break
  ///   condition. An epsilon of zero achieves the maximum available numerical precision obtainable
  ///   by the specific hard- & software.
  void estimate(
    const std::uint64_t _steps = std::numeric_limits<uint64_t>::max(),
    const double _epsilon = 0
  );

  /// Estimate the state vector after the specified number of steps or if the rate of change
  /// threshold requirements are met. With default parameters the function tries to converge on a
  /// stationary solution.
  /// Uses the power method.
  /// \param _steps Number of steps to evaluate.
  /// \param _epsilon Threshold for the rate of change of the state vector between each step,
  ///   measured in euclidean distance. Set epsilon to a negative value to deactivate its break
  ///   condition. An epsilon of zero achieves the maximum available numerical precision obtainable
  ///   by the specific hard- & software. Tests have proven numerically unstable at
  ///   epsilon < 1.0e-12.
  void estimate_power(
    const std::uint64_t _steps = std::numeric_limits<uint64_t>::max(),
    const double _epsilon = 1.0e-8
  );

private:
  /// Initial state vector.
  Eigen::RowVectorXd m_initial_state;

  /// Transition probability matrix.
  Eigen::MatrixXd m_transition_matrix;

  /// Vector of emission probability distributions. One for each state.
  std::vector<distribution> m_emission_distributions;

};

// -------------------------------------------------------------------------------------------------
// implementation
// -------------------------------------------------------------------------------------------------

template<typename distribution/* = discrete_distribution */>
markov_chain<distribution>::markov_chain(
  const std::uint64_t _state_count,
  const distribution& _emission_distribution
) : m_initial_state(Eigen::RowVectorXd::Ones(_state_count) / static_cast<double>(_state_count))
  , m_transition_matrix(Eigen::MatrixXd::Ones(_state_count,_state_count) / static_cast<double>(_state_count))
  , m_emission_distributions(_state_count,_emission_distribution)
{
  /* empty */
}

template<typename distribution/* = discrete_distribution */>
markov_chain<distribution>::markov_chain(
  const Eigen::RowVectorXd& _initial_state,
  const Eigen::MatrixXd& _transition_matrix,
  const std::vector<distribution>& _emission_distributions
) : m_initial_state(_initial_state)
  , m_transition_matrix(_transition_matrix)
  , m_emission_distributions(_emission_distributions)
{
  /* empty */
}

template<typename distribution/* = discrete_distribution */>
Eigen::MatrixXd markov_chain<distribution>::from_ctmc(const Eigen::MatrixXd& _generator_matrix, const double _delta_t)
{
  Eigen::MatrixXd identity_matrix = Eigen::MatrixXd::Identity(_generator_matrix.rows(),_generator_matrix.cols());
  return identity_matrix + _delta_t * _generator_matrix;
}

template<typename distribution/* = discrete_distribution */>
void markov_chain<distribution>::estimate(const std::uint64_t _steps, const double _epsilon)
{
  auto current = m_initial_state; // row vector

  std::uint64_t i;
  for (i = 0; i < _steps; i++)
  {
    auto last = current;
    current = last * m_transition_matrix;
    auto difference = current - last;
    auto distance = difference.norm();

    if (distance <= _epsilon) { break; }
  }

  std::cout << std::setprecision(10) << "estimate " << current << " after " << i << " steps with a precision of " << _epsilon << "." << std::endl;
}

template<typename distribution/* = discrete_distribution */>
void markov_chain<distribution>::estimate_power(const std::uint64_t _steps, const double _epsilon)
{
  auto current = m_transition_matrix; // square matrix

  std::uint64_t i;
  for (i = 0; i < _steps; i++)
  {
    auto last = current;
    // another way to efficient, precise runtime solutions of pow(matrix,n) without the danger of
    // aliasing would be a constexpr or expression templates
    current = last * last;
    auto difference = current.row(0) - last.row(0);
    auto distance = difference.norm();

    if (distance <= _epsilon) { break; }
  }

  std::cout << std::setprecision(10) << "estimate " << current.row(0) << " after " << i << " steps with a precision of " << _epsilon << "." << std::endl;
}