text:
package org.apache.archiva.metadata.repository;

import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.model.ProjectVersionReference;
import org.apache.archiva.filter.ExcludesFilter;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
import org.apache.archiva.metadata.repository.storage.RepositoryStorage;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
import org.apache.archiva.components.cache.Cache;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 *

 * Default implementation of the metadata resolver API. At present it will handle updating the content repository
 * from new or changed information in the model and artifacts from the repository storage.
 *

 *

 * This is a singleton component to allow an alternate implementation to be provided. It is intended to be the same
 * system-wide for the whole content repository instead of on a per-managed-repository basis. Therefore, the session is
 * passed in as an argument to obtain any necessary resources, rather than the class being instantiated within the
 * session in the context of a single managed repository's resolution needs.
 *

 *

 * Note that the caller is responsible for the session, such as closing and saving (which is implied by the resolver
 * being obtained from within the session). The {@link RepositorySession#markDirty()} method is used as a hint to ensure
 * that the session knows we've made changes at close. We cannot ensure the changes will be persisted if the caller
 * chooses to revert first. This is preferable to storing the metadata immediately - a separate session would require
 * having a bi-directional link with the session factory, and saving the existing session might save other changes
 * unknowingly by the caller.
 *

 */
@Service("metadataResolver#default")
public class DefaultMetadataResolver
    implements MetadataResolver
{

    private Logger log = LoggerFactory.getLogger( DefaultMetadataResolver.class );

    /**
     *

     * FIXME: this needs to be configurable based on storage type - and could also be instantiated per repo. Change to a
     * factory, and perhaps retrieve from the session. We should avoid creating one per request, however.
     *

     *

     * TODO: Also need to accommodate availability of proxy module
     * ... could be a different type since we need methods to modify the storage metadata, which would also allow more
     * appropriate methods to pass in the already determined repository configuration, for example, instead of the ID
     *

     */
    @Inject
    @Named(value = "repositoryStorage#maven2")
    private RepositoryStorage repositoryStorage;

    @Inject
    @Autowired(required = false)
    private List<RepositoryListener> listeners = new ArrayList<>();

    /**
     * Cache used for namespaces
     */
    @Inject
    @Named( value = "cache#namespaces" )
    private Cache<String, List<String>> namespacesCache;

    @Override
    public ProjectVersionMetadata resolveProjectVersion( RepositorySession session, String repoId, String namespace,
                                                         String projectId, String projectVersion )
        throws MetadataResolutionException
    {
        MetadataRepository metadataRepository = session.getRepository();

        ProjectVersionMetadata metadata =
            metadataRepository.getProjectVersion( session, repoId, namespace, projectId, projectVersion );
        // TODO: do we want to detect changes as well by comparing timestamps? isProjectVersionNewerThan(updated)
        //       in such cases we might also remove/update stale metadata, including adjusting plugin-based facets
        //       This would also be better than checking for completeness - we can then refresh only when fixed (though
        //       sometimes this has an additional dependency - such as a parent - requesting the user to force an update
        //       may then work here and be more efficient than always trying again)
        if ( metadata == null || metadata.isIncomplete() )
        {
            try
            {
                ReadMetadataRequest readMetadataRequest =
                    new ReadMetadataRequest().repositoryId( repoId ).namespace( namespace ).projectId(
                        projectId ).projectVersion( projectVersion ).browsingRequest( true );
                metadata = repositoryStorage.readProjectVersionMetadata( readMetadataRequest );

                log.debug( "Resolved project version metadata from storage: {}", metadata );

                // FIXME: make this a more generic post-processing that plugins can take advantage of
                //       eg. maven projects should be able to process parent here
                if ( !metadata.getDependencies().isEmpty() )
                {
                    ProjectVersionReference ref = new ProjectVersionReference();
                    ref.setNamespace( namespace );
                    ref.setProjectId( projectId );
                    ref.setProjectVersion( projectVersion );
                    ref.setReferenceType( ProjectVersionReference.ReferenceType.DEPENDENCY );
                }
                try
                {
                    for ( RepositoryListener listener : listeners )
                    {
                        listener.addArtifact( session, repoId, namespace, projectId, metadata );
                    }
                    metadataRepository.updateProjectVersion( session, repoId, namespace, projectId, metadata );
                }
                catch ( MetadataRepositoryException e )
                {
                    log.warn( "Unable to persist resolved information: {}", e.getMessage(), e );
                }

                session.markDirty();
            }
            catch ( RepositoryStorageMetadataInvalidException e )
            {
                for ( RepositoryListener listener : listeners )
                {
                    listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e );
                }
                throw new MetadataResolutionException( e.getMessage(), e );
            }
            catch ( RepositoryStorageMetadataNotFoundException e )
            {
                for ( RepositoryListener listener : listeners )
                {
                    listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e );
                }
                // no need to rethrow - return null
            }
            catch ( RepositoryStorageRuntimeException e )
            {
                for ( RepositoryListener listener : listeners )
                {
                    listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e );
                }
                throw new MetadataResolutionException( e.getMessage(), e );
            }

        }
        return metadata;
    }

    @Override
    public Collection<ProjectVersionReference> resolveProjectReferences( RepositorySession session, String repoId,
                                                                         String namespace, String projectId,
                                                                         String projectVersion )
        throws MetadataResolutionException
    {
        // TODO: is this assumption correct? could a storage mech. actually know all references in a non-Maven scenario?
        // not passed to the storage mechanism as resolving references would require iterating all artifacts
        MetadataRepository metadataRepository = session.getRepository();
        return metadataRepository.getProjectReferences( session, repoId, namespace, projectId, projectVersion );
    }

    @Override
    public Collection<String> resolveRootNamespaces( RepositorySession session, String repoId )
        throws MetadataResolutionException
    {
        try
        {

            List<String> namespaces = namespacesCache.get( repoId );
            if ( namespaces != null )
            {
                return namespaces;
            }

            MetadataRepository metadataRepository = session.getRepository();
            namespaces = metadataRepository.getRootNamespaces( session, repoId );
            Collection<String> storageNamespaces =
                repositoryStorage.listRootNamespaces( repoId, new ExcludesFilter<String>( namespaces ) );
            if ( storageNamespaces != null && !storageNamespaces.isEmpty() )
            {

                log.debug( "Resolved root namespaces from storage: {}", storageNamespaces );

                for ( String n : storageNamespaces )
                {
                    try
                    {
                        metadataRepository.updateNamespace( session, repoId, n );
                        // just invalidate cache entry
                        String cacheKey = repoId + "-" + n;
                        namespacesCache.remove( cacheKey );
                    }
                    catch ( MetadataRepositoryException e )
                    {
                        log.warn( "Unable to persist resolved information: {}", e.getMessage(), e );
                    }
                }
                session.markDirty();

                namespaces = new ArrayList<>( namespaces );
                namespaces.addAll( storageNamespaces );
            }

            namespacesCache.put( repoId, namespaces );

            return namespaces;
        }
        catch ( RepositoryStorageRuntimeException e )
        {
            throw new MetadataResolutionException( e.getMessage(), e );
        }
    }

    @Override
    public Collection<String> resolveNamespaces( RepositorySession session, String repoId, String namespace )
        throws MetadataResolutionException
    {
        try
        {
            MetadataRepository metadataRepository = session.getRepository();
            String cacheKey = repoId + "-" + namespace;
            List<String> namespaces = namespacesCache.get( cacheKey );
            if ( namespaces == null )
            {
                namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
                namespacesCache.put( cacheKey, namespaces );
            }
            Collection<String> exclusions = new ArrayList<>( namespaces );
            exclusions.addAll( metadataRepository.getProjects( session, repoId, namespace ) );
            Collection<String> storageNamespaces =
                repositoryStorage.listNamespaces( repoId, namespace, new ExcludesFilter<String>( exclusions ) );
            if ( storageNamespaces != null && !storageNamespaces.isEmpty() )
            {

                log.debug( "Resolved namespaces from storage: {}", storageNamespaces );

                for ( String n : storageNamespaces )
                {
                    try
                    {
                        metadataRepository.updateNamespace( session, repoId, namespace + "." + n );
                        // just invalidate cache entry
                        cacheKey = repoId + "-" + namespace + "." + n;
                        namespacesCache.remove( cacheKey );
                    }
                    catch ( MetadataRepositoryException e )
                    {
                        log.warn( "Unable to persist resolved information: {}", e.getMessage(), e );
                    }
                }
                session.markDirty();

                namespaces = new ArrayList<>( namespaces );
                namespaces.addAll( storageNamespaces );
            }
            return namespaces;
        }
        catch ( RepositoryStorageRuntimeException e )
        {
            throw new MetadataResolutionException( e.getMessage(), e );
        }
    }

    @Override
    public Collection<String> resolveProjects( RepositorySession session, String repoId, String namespace )
        throws MetadataResolutionException
    {
        try
        {
            MetadataRepository metadataRepository = session.getRepository();
            Collection<String> projects = metadataRepository.getProjects( session, repoId, namespace );
            Collection<String> exclusions = new ArrayList<>( projects );

            String cacheKey = repoId + "-" + namespace;
            List<String> namespaces = namespacesCache.get( cacheKey );
            if ( namespaces == null )
            {
                namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
                namespacesCache.put( cacheKey, namespaces );
            }

            exclusions.addAll( namespaces );

            Collection<String> storageProjects =
                repositoryStorage.listProjects( repoId, namespace, new ExcludesFilter<>( exclusions ) );
            if ( storageProjects != null && !storageProjects.isEmpty() )
            {

                log.debug( "Resolved projects from storage: {}", storageProjects );
                for ( String projectId : storageProjects )
                {
                    ProjectMetadata projectMetadata =
                        repositoryStorage.readProjectMetadata( repoId, namespace, projectId );
                    if ( projectMetadata != null )
                    {
                        try
                        {
                            metadataRepository.updateProject( session, repoId, projectMetadata );
                        }
                        catch ( MetadataRepositoryException e )
                        {
                            log.warn( "Unable to persist resolved information: {}", e.getMessage(), e );
                        }
                    }
                }
                session.markDirty();

                projects = new ArrayList<>( projects );
                projects.addAll( storageProjects );
            }
            return projects;
        }
        catch ( RepositoryStorageRuntimeException e )
        {
            throw new MetadataResolutionException( e.getMessage(), e );
        }
    }

    @Override
    public Collection<String> resolveProjectVersions( RepositorySession session, String repoId, String namespace,
                                                      String projectId )
        throws MetadataResolutionException
    {
        try
        {
            MetadataRepository metadataRepository = session.getRepository();

            Collection<String> projectVersions = metadataRepository.getProjectVersions( session, repoId, namespace, projectId );
            Collection<String> storageProjectVersions =
                repositoryStorage.listProjectVersions( repoId, namespace, projectId,
                                                       new ExcludesFilter<String>( projectVersions ) );
            if ( storageProjectVersions != null && !storageProjectVersions.isEmpty() )
            {
                log.debug( "Resolved project versions from storage: {}", storageProjectVersions );

                for ( String projectVersion : storageProjectVersions )
                {
                    try
                    {
                        ReadMetadataRequest readMetadataRequest =
                            new ReadMetadataRequest().repositoryId( repoId ).namespace( namespace ).projectId(
                                projectId ).projectVersion( projectVersion );
                        ProjectVersionMetadata versionMetadata =
                            repositoryStorage.readProjectVersionMetadata( readMetadataRequest );
                        for ( RepositoryListener listener : listeners )
                        {
                            listener.addArtifact( session, repoId, namespace, projectId, versionMetadata );
                        }

                        metadataRepository.updateProjectVersion( session, repoId, namespace, projectId, versionMetadata );
                    }
                    catch ( MetadataRepositoryException e )
                    {
                        log.warn( "Unable to persist resolved information: {}", e.getMessage(), e );
                    }
                    catch ( RepositoryStorageMetadataInvalidException e )
                    {
                        log.warn(
                            "Not update project in metadata repository due to an error resolving it from storage: {}",
                            e.getMessage() );

                        for ( RepositoryListener listener : listeners )
                        {
                            listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e );
                        }
                    }
                    catch ( RepositoryStorageMetadataNotFoundException e )
                    {
                        for ( RepositoryListener listener : listeners )
                        {
                            listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e );
                        }
                    }
                }
                session.markDirty();

                projectVersions = new ArrayList<>( projectVersions );
                projectVersions.addAll( storageProjectVersions );
            }
            return projectVersions;
        }
        catch ( RepositoryStorageRuntimeException e )
        {
            throw new MetadataResolutionException( e.getMessage(), e );
        }
    }

    @Override
    public Collection<ArtifactMetadata> resolveArtifacts( RepositorySession session, String repoId, String namespace,
                                                          String projectId, String projectVersion )
        throws MetadataResolutionException
    {
        try
        {
            MetadataRepository metadataRepository = session.getRepository();
            Collection<ArtifactMetadata> artifacts =
                metadataRepository.getArtifacts( session, repoId, namespace, projectId, projectVersion );
            ExcludesFilter<String> filter = new ExcludesFilter<String>( createArtifactIdList( artifacts ) );

            ReadMetadataRequest readMetadataRequest =
                new ReadMetadataRequest().repositoryId( repoId ).namespace( namespace ).projectId(
                    projectId ).projectVersion( projectVersion ).filter( filter );

            Collection<ArtifactMetadata> storageArtifacts =
                repositoryStorage.readArtifactsMetadata( readMetadataRequest );
            if ( storageArtifacts != null && !storageArtifacts.isEmpty() )
            {

                log.debug( "Resolved artifacts from storage: {}", storageArtifacts );

                for ( ArtifactMetadata artifact : storageArtifacts )
                {
                    try
                    {
                        metadataRepository.updateArtifact( session, repoId, namespace, projectId, projectVersion, artifact );
                    }
                    catch ( MetadataRepositoryException e )
                    {
                        log.warn( "Unable to persist resolved information: {}", e.getMessage(), e );
                    }
                }
                session.markDirty();

                artifacts = new ArrayList<>( artifacts );
                artifacts.addAll( storageArtifacts );
            }
            return artifacts;
        }
        catch ( RepositoryStorageRuntimeException e )
        {
            for ( RepositoryListener listener : listeners )
            {
                listener.addArtifactProblem( session, repoId, namespace, projectId, projectVersion, e );
            }
            throw new MetadataResolutionException( e.getMessage(), e );
        }
    }

    private Collection<String> createArtifactIdList( Collection<ArtifactMetadata> artifacts )
    {
        Collection<String> artifactIds = new ArrayList<>();
        for ( ArtifactMetadata artifact : artifacts )
        {
            artifactIds.add( artifact.getId() );
        }
        return artifactIds;
    }
}


text:
Patented Project Management Dev Dice!
=====================================

> Are you pressed for time? Do you need to make a technology selection before the
> close of business but feel overwhelmed by the myriad choices? Are you neither
> interested in doing nor qualified to perform a cost/benefit analysis? Do you
> just need to get the ball rolling and make a recommendation to your
> stakeholders? Then put your trust in our patented "Project Management Dev Dice"
> and leave the technology selection to us!

Use it now: <https://dev-dice.herokuapp.com/>

#### Ha ha, OK what is this?

This started as a joke a couple of years ago when a friend/co-worker was brought
onto a new project and we observed that its technology stack appeared to have
nothing to do with the technology stack currently in place. And while this was
not necessarily a Bad Thing™, it also seemed... Strange. Thus was the idea
of Project Management Dev Dice born. It incubated for a while, simmering in our
brains until finally I decided to cook this up.

I wanted to play around with a couple of things, and this provided an excuse to
do so. As for which things:

- [React](https://reactjs.org/)
- [Heroku](https://www.heroku.com/)
- [MongoDB](https://www.mongodb.org/) and [Mongo Atlas](https://www.mongodb.com/cloud/atlas)
- [Node.js](https://nodejs.org/) and [Express](https://expressjs.com/)

redpajama_set_name: RedPajamaGithub


text:
'use strict';

describe('docs.angularjs.org', function () {
  describe('App', function () {
    // it('should filter the module list when searching', function () {
    //   browser.get();
    //   browser.waitForAngular();

    //   var search = element(by.model('q'));
    //   search.clear();
    //   search.sendKeys('ngBind');

    //   var firstModule = element(by.css('.search-results a'));
    //   expect(firstModule.getText()).toEqual('ngBind');
    // });

    it('should change the page content when clicking a link to a service', function () {
      browser.get('');

      var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
      ngBindLink.click();

      var pageBody = element(by.css('h1'));
      expect(pageBody.getText()).toEqual('ngClick');
    });

    it('should show the functioning input directive example', function () {
      browser.get('index-debug.html#!/api/ng/directive/input');

      // Ensure that the page is loaded before trying to switch frames.
      browser.waitForAngular();

      browser.switchTo().frame('example-input-directive');

      var nameInput = element(by.model('user.name'));
      nameInput.sendKeys('!!!');

      var code = element.all(by.css('tt')).first();
      expect(code.getText()).toContain('guest!!!');
    });

    it('should be resilient to trailing slashes', function() {
      browser.get('index-debug.html#!/api/ng/function/angular.noop/');
      var pageBody = element(by.css('h1'));
      expect(pageBody.getText()).toEqual('angular.noop');
    });

    it('should be resilient to trailing "index"', function() {
      browser.get('index-debug.html#!/api/ng/function/angular.noop/index');
      var pageBody = element(by.css('h1'));
      expect(pageBody.getText()).toEqual('angular.noop');
    });

    it('should be resilient to trailing "index/"', function() {
      browser.get('index-debug.html#!/api/ng/function/angular.noop/index/');
      var pageBody = element(by.css('h1'));
      expect(pageBody.getText()).toEqual('angular.noop');
    });

    it('should display formatted error messages on error doc pages', function() {
      browser.get('index-debug.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
      expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
    });
  });

  describe("templates", function() {
    it("should show parameter defaults", function() {
      browser.get('index-debug.html#!/api/ng/service/$timeout');
      expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
    });
  });
});


text:
var count = 0;
var inc = new GlideRecord('incident');
inc.addQuery('active', 'true');
inc.addQuery('incident_state', '!=', '11');
inc.addQuery('opened_by', '96a33bd70a0a3c4900ba4558b6f34650');
inc.addQuery('short_description', email.subject);
inc.query();
while (inc.next()) {
    inc.work_notes = 'Duplicate ' + email.subject + '\n\n' + email.body_text;
    inc.update();
    count++;
}

if (count == 0) {

    current.comments = "Email received from: " + email.origemail;
    current.description = "Email received from: " + email.origemail + "\n\n" + email.body_text;

    current.u_first_response = 'Emailed';
    current.caller_id.setDisplayValue('DH Report');
    current.opened_by.setDisplayValue('DH Report');
    current.u_business_service.setDisplayValue('dunnhumby iPulse');
    current.assignment_group = '2c94e4e1d9d34c006bb601d89dc1b279'; //Business Intell
    current.category = 'data_i';
    current.contact_type = 'Monitoring';
    current.comments = email.body_text;
    current.incident_state = 2;
    current.notify = 2;

    var subject = email.subject;
    current.short_description = subject;

    var subcat = 'job error';
    var pri = 'high';

    gs.include('OnCallRotation');
    var rota = new OnCallRotation();
    rota.who(current.assignment_group);

    if (pri.toLowerCase().indexOf('medium') > -1) {
        //Medium
        current.impact = 2;
        current.urgency = 3;
        current.priority = 3;
    }
    else if (pri.toLowerCase().indexOf('high') > -1) {
        //High
        current.impact = 2;
        current.urgency = 1;
        current.priority = 2;
        if (rota.next()) {
            current.assigned_to = rota.getPrimaryUser();
        }
        if (current.assigned_to != '') {
            gs.eventQueue('oncall.sms.notify', current, current.assigned_to.name, current.assignment_group.name);
        }
    }
    else {
        //Low
        current.impact = 3;
        current.urgency = 3;
        current.priority = 4;
    }

    if (subcat.toLowerCase().indexOf('space alert') > -1) {
        current.subcategory = 'Space Alert';
    }
    else if (subcat.toLowerCase().indexOf('job error') > -1) {
        current.subcategory = 'Job Error';
    }
    else if (subcat.toLowerCase().indexOf('job alert') > -1) {
        current.subcategory = 'Job Alert';
    }

    current.insert();
}

//CONDITION
email.from.toLowerCase().indexOf('bi_prod') > -1 && email.subject.toLowerCase().indexOf('production') > -1 && email.body.toLowerCase().indexOf('failed') > -1


text:
#ifndef _PcreTest_RegExp_h_
#define _PcreTest_RegExp_h_

//#include <Core/Core.h>

class RegExp : public Moveable<RegExp> {
public:
	enum
	{
		PARTIAL   = PCRE_PARTIAL,
		/* compile options */
		UNICODE   = PCRE_UTF8,
		CASELESS  = PCRE_CASELESS,
		MULTILINE = PCRE_MULTILINE,
		UNGREEDY  = PCRE_UNGREEDY
	};

private:
	String pattern;
	String text;
	pcre * cpattern;
	const char * error_string;
	int error_offset;
	int error_code;
	int pos[30];
	int rc;
	bool first;
	int compile_options;
	int execute_options;

public:
	RegExp(int options = UNICODE);
	RegExp(const char * p, int options = UNICODE);
	RegExp(const String &p, int options = UNICODE);
	~RegExp();

	void Clear(bool freemem = false);
	void SetOptions(int options);
	void SetPattern(const char * p);
	void SetPattern(const String &p);
	bool Compile(bool recompile = false);
	int  Execute(const String &t, int offset = 0);
	bool Match(const String &t, bool copy = true);
	bool FastMatch(const String &t);
	bool GlobalMatch(const String &t);
	String operator[](const int i);
	int GetCount();
	Vector<String> GetStrings();
	String GetString(int i);

	bool IsError() { return error_code != 0; }
	const char * GetError() { return error_string; }
	int GetErrorCode() { return error_code; }
};

#endif


text:
package com.arimaa.api;

import com.arimaa.api.movement.type.BasicMovementType;
import com.arimaa.api.movement.type.MovementType;
import com.arimaa.core.Color;
import com.arimaa.core.Piece;
import java.util.List;
import java.util.Arrays;

/**
 *
 * @author Rajmahendra Hegde <rajmahendra@gmail.com>
 */
public enum PieceType {

    ELEPHANT(5,
            BasicMovementType.LINEAL_LEFT_ONE_STEP,
            BasicMovementType.LINEAL_RIGHT_ONE_STEP,
            BasicMovementType.LINEAL_FORWARD_ONE_STEP,
            BasicMovementType.LINEAL_BACKWARD_ONE_STEP
    ),
    CAMEL(4,
            BasicMovementType.LINEAL_LEFT_ONE_STEP,
            BasicMovementType.LINEAL_RIGHT_ONE_STEP,
            BasicMovementType.LINEAL_FORWARD_ONE_STEP,
            BasicMovementType.LINEAL_BACKWARD_ONE_STEP
    ),
    HORSE(3,
            BasicMovementType.LINEAL_LEFT_ONE_STEP,
            BasicMovementType.LINEAL_RIGHT_ONE_STEP,
            BasicMovementType.LINEAL_FORWARD_ONE_STEP,
            BasicMovementType.LINEAL_BACKWARD_ONE_STEP
    ),
    DOG(2,
            BasicMovementType.LINEAL_LEFT_ONE_STEP,
            BasicMovementType.LINEAL_RIGHT_ONE_STEP,
            BasicMovementType.LINEAL_FORWARD_ONE_STEP,
            BasicMovementType.LINEAL_BACKWARD_ONE_STEP
    ),
    CAT(1,
            BasicMovementType.LINEAL_LEFT_ONE_STEP,
            BasicMovementType.LINEAL_RIGHT_ONE_STEP,
            BasicMovementType.LINEAL_FORWARD_ONE_STEP,
            BasicMovementType.LINEAL_BACKWARD_ONE_STEP
    ),
    RABBIT(0,
            BasicMovementType.LINEAL_LEFT_ONE_STEP,
            BasicMovementType.LINEAL_RIGHT_ONE_STEP,
            BasicMovementType.LINEAL_FORWARD_ONE_STEP
    );

    private final List<MovementType> availableMovementTypes;
    private final int relativeValue;

    private PieceType(int value, MovementType... movementTypes) {
        this.availableMovementTypes = Arrays.asList(movementTypes);
        this.relativeValue = value;
    }

    public Piece withColor(Color color) {
        return Piece.with(this, color);
    }

    public List<MovementType> getMovementTypes() {
        return availableMovementTypes;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NinePatchRect" inherits="Control" category="Core" version="3.2">
	<brief_description>
		Scalable texture-based frame that tiles the texture's centers and sides, but keeps the corners' original size. Perfect for panels and dialog boxes.
	</brief_description>
	<description>
		Also known as 9-slice panels, NinePatchRect produces clean panels of any size, based on a small texture. To do so, it splits the texture in a 3×3 grid. When you scale the node, it tiles the texture's sides horizontally or vertically, the center on both axes but it doesn't scale or tile the corners.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="get_patch_margin" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="margin" type="int" enum="Margin">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_patch_margin">
			<return type="void">
			</return>
			<argument index="0" name="margin" type="int" enum="Margin">
			</argument>
			<argument index="1" name="value" type="int">
			</argument>
			<description>
			</description>
		</method>
	</methods>
	<members>
		<member name="axis_stretch_horizontal" type="int" setter="set_h_axis_stretch_mode" getter="get_h_axis_stretch_mode" enum="NinePatchRect.AxisStretchMode" default="0">
			Doesn't do anything at the time of writing.
		</member>
		<member name="axis_stretch_vertical" type="int" setter="set_v_axis_stretch_mode" getter="get_v_axis_stretch_mode" enum="NinePatchRect.AxisStretchMode" default="0">
			Doesn't do anything at the time of writing.
		</member>
		<member name="draw_center" type="bool" setter="set_draw_center" getter="is_draw_center_enabled" default="true">
			If [code]true[/code], draw the panel's center. Else, only draw the 9-slice's borders.
		</member>
		<member name="patch_margin_bottom" type="int" setter="set_patch_margin" getter="get_patch_margin" default="0">
			The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
		</member>
		<member name="patch_margin_left" type="int" setter="set_patch_margin" getter="get_patch_margin" default="0">
			The height of the 9-slice's left column.
		</member>
		<member name="patch_margin_right" type="int" setter="set_patch_margin" getter="get_patch_margin" default="0">
			The height of the 9-slice's right column.
		</member>
		<member name="patch_margin_top" type="int" setter="set_patch_margin" getter="get_patch_margin" default="0">
			The height of the 9-slice's top row.
		</member>
		<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect" default="Rect2( 0, 0, 0, 0 )">
			Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one.
		</member>
		<member name="texture" type="Texture" setter="set_texture" getter="get_texture" default="null">
			The node's texture resource.
		</member>
	</members>
	<signals>
		<signal name="texture_changed">
			<description>
				Fired when the node's texture changes.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="AXIS_STRETCH_MODE_STRETCH" value="0" enum="AxisStretchMode">
			Doesn't do anything at the time of writing.
		</constant>
		<constant name="AXIS_STRETCH_MODE_TILE" value="1" enum="AxisStretchMode">
			Doesn't do anything at the time of writing.
		</constant>
		<constant name="AXIS_STRETCH_MODE_TILE_FIT" value="2" enum="AxisStretchMode">
			Doesn't do anything at the time of writing.
		</constant>
	</constants>
</class>


text:
* [Basic of Vim] (https://www.linux.com/learn/vim-101-beginners-guide-vim)
* [Vim Commands](http://www.radford.edu/~mhtay/CPSC120/VIM_Editor_Commands.htm)
* [Vim Cheat Sheet](http://vim.rtorr.com/)


text:
package info.archinnov.achilles.internals.utils;

import static info.archinnov.achilles.internals.parser.TypeUtils.*;
import static org.assertj.core.api.Assertions.assertThat;

import java.math.BigDecimal;

import org.junit.Test;

import com.datastax.driver.core.LocalDate;
import com.squareup.javapoet.TypeName;

public class TypeNameHelperTest {

    @Test
    public void should_convert_type_name_to_string() throws Exception {
        //Given
        final TypeName nativeBool = TypeName.get(boolean.class);
        final TypeName objectLong = TypeName.get(Long.class);
        final TypeName localDate = TypeName.get(LocalDate.class);
        final TypeName bigDecimal = TypeName.get(BigDecimal.class);
        final TypeName listString = genericType(LIST, STRING);
        final TypeName mapStringTuple = genericType(MAP, STRING, JAVA_DRIVER_TUPLE_VALUE_TYPE);
        final TypeName mapStringListUDT = genericType(MAP, STRING, genericType(LIST, JAVA_DRIVER_UDT_VALUE_TYPE));

        //When
        assertThat(TypeNameHelper.asString(nativeBool)).isEqualTo("Boolean");
        assertThat(TypeNameHelper.asString(objectLong)).isEqualTo("Long");
        assertThat(TypeNameHelper.asString(localDate)).isEqualTo("DriverLocalDate");
        assertThat(TypeNameHelper.asString(bigDecimal)).isEqualTo("BigDecimal");
        assertThat(TypeNameHelper.asString(listString)).isEqualTo("List_String");
        assertThat(TypeNameHelper.asString(mapStringTuple)).isEqualTo("Map_String_TupleValue");
        assertThat(TypeNameHelper.asString(mapStringListUDT)).isEqualTo("Map_String_List_UDTValue");

        //Then

    }

}


text:
using System;

namespace EventStreams.Persistence.Streams {
    internal static class EventStreamTokens {
        public static readonly byte HeadIndicator = 0x02;
        public static readonly byte TailIndicator = 0x03;
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Ramalina dilacerata var. semigeniculata Räsänen

### Remarks
null


text:
Image
=====

The Image constraint works exactly like the :doc:`File </reference/constraints/File>`
constraint, except that its `mimeTypes`_ and `mimeTypesMessage`_ options
are automatically setup to work for image files specifically.

Additionally it has options so you can validate against the width and height
of the image.

See the :doc:`File </reference/constraints/File>` constraint for the bulk
of the documentation on this constraint.

+----------------+-----------------------------------------------------------------------+
| Applies to     | :ref:`property or method <validation-property-target>`                |
+----------------+-----------------------------------------------------------------------+
| Options        | - `mimeTypes`_                                                        |
|                | - `minWidth`_                                                         |
|                | - `maxWidth`_                                                         |
|                | - `maxHeight`_                                                        |
|                | - `minHeight`_                                                        |
|                | - `maxRatio`_                                                         |
|                | - `minRatio`_                                                         |
|                | - `allowSquare`_                                                      |
|                | - `allowLandscape`_                                                   |
|                | - `allowPortrait`_                                                    |
|                | - `mimeTypesMessage`_                                                 |
|                | - `sizeNotDetectedMessage`_                                           |
|                | - `maxWidthMessage`_                                                  |
|                | - `minWidthMessage`_                                                  |
|                | - `maxHeightMessage`_                                                 |
|                | - `minHeightMessage`_                                                 |
|                | - `maxRatioMessage`_                                                  |
|                | - `minRatioMessage`_                                                  |
|                | - `allowSquareMessage`_                                               |
|                | - `allowLandscapeMessage`_                                            |
|                | - `allowPortraitMessage`_                                             |
|                | - See :doc:`File </reference/constraints/File>` for inherited options |
+----------------+-----------------------------------------------------------------------+
| Class          | :class:`Symfony\\Component\\Validator\\Constraints\\Image`            |
+----------------+-----------------------------------------------------------------------+
| Validator      | :class:`Symfony\\Component\\Validator\\Constraints\\ImageValidator`   |
+----------------+-----------------------------------------------------------------------+

Basic Usage
-----------

This constraint is most commonly used on a property that will be rendered
in a form as a :doc:`FileType </reference/forms/types/file>` field. For
example, suppose you're creating an author form where you can upload a
"headshot" image for the author. In your form, the ``headshot`` property
would be a ``file`` type. The ``Author`` class might look as follows::

    // src/AppBundle/Entity/Author.php
    namespace AppBundle\Entity;

    use Symfony\Component\HttpFoundation\File\File;

    class Author
    {
        protected $headshot;

        public function setHeadshot(File $file = null)
        {
            $this->headshot = $file;
        }

        public function getHeadshot()
        {
            return $this->headshot;
        }
    }

To guarantee that the ``headshot`` ``File`` object is a valid image and
that it is between a certain size, add the following:

.. configuration-block::

    .. code-block:: php-annotations

        // src/AppBundle/Entity/Author.php
        namespace AppBundle\Entity;

        use Symfony\Component\Validator\Constraints as Assert;

        class Author
        {
            /**
             * @Assert\Image(
             *     minWidth = 200,
             *     maxWidth = 400,
             *     minHeight = 200,
             *     maxHeight = 400
             * )
             */
            protected $headshot;
        }

    .. code-block:: yaml

        # src/AppBundle/Resources/config/validation.yml
        AppBundle\Entity\Author
            properties:
                headshot:
                    - Image:
                        minWidth: 200
                        maxWidth: 400
                        minHeight: 200
                        maxHeight: 400

    .. code-block:: xml

        <!-- src/AppBundle/Resources/config/validation.xml -->
        <?xml version="1.0" encoding="UTF-8" ?>
        <constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

            <class name="AppBundle\Entity\Author">
                <property name="headshot">
                    <constraint name="Image">
                        <option name="minWidth">200</option>
                        <option name="maxWidth">400</option>
                        <option name="minHeight">200</option>
                        <option name="maxHeight">400</option>
                    </constraint>
                </property>
            </class>
        </constraint-mapping>

    .. code-block:: php

        // src/AppBundle/Entity/Author.php
        namespace AppBundle\Entity;

        use Symfony\Component\Validator\Mapping\ClassMetadata;
        use Symfony\Component\Validator\Constraints as Assert;

        class Author
        {
            public static function loadValidatorMetadata(ClassMetadata $metadata)
            {
                $metadata->addPropertyConstraint('headshot', new Assert\Image(array(
                    'minWidth' => 200,
                    'maxWidth' => 400,
                    'minHeight' => 200,
                    'maxHeight' => 400,
                )));
            }
        }

The ``headshot`` property is validated to guarantee that it is a real image
and that it is between a certain width and height.

You may also want to guarantee the ``headshot`` image to be square. In this
case you can disable portrait and landscape orientations as shown in the
following code:

.. configuration-block::

    .. code-block:: php-annotations

        // src/AppBundle/Entity/Author.php
        namespace AppBundle\Entity;

        use Symfony\Component\Validator\Constraints as Assert;

        class Author
        {
            /**
             * @Assert\Image(
             *     allowLandscape = false,
             *     allowPortrait = false
             * )
             */
            protected $headshot;
        }

    .. code-block:: yaml

        # src/AppBundle/Resources/config/validation.yml
        AppBundle\Entity\Author
            properties:
                headshot:
                    - Image:
                        allowLandscape: false
                        allowPortrait: false

    .. code-block:: xml

        <!-- src/AppBundle/Resources/config/validation.xml -->
        <class name="AppBundle\Entity\Author">
            <property name="headshot">
                <constraint name="Image">
                    <option name="allowLandscape">false</option>
                    <option name="allowPortrait">false</option>
                </constraint>
            </property>
        </class>

    .. code-block:: php

        // src/AppBundle/Entity/Author.php
        namespace AppBundle\Entity;

        use Symfony\Component\Validator\Mapping\ClassMetadata;
        use Symfony\Component\Validator\Constraints as Assert;

        class Author
        {
            // ...

            public static function loadValidatorMetadata(ClassMetadata $metadata)
            {
                $metadata->addPropertyConstraint('headshot', new Assert\Image(array(
                    'allowLandscape'    => false,
                    'allowPortrait'     => false,
                )));
            }
        }

You can mix all the constraint options to create powerful validation rules.

Options
-------

This constraint shares all of its options with the :doc:`File </reference/constraints/File>`
constraint. It does, however, modify two of the default option values and
add several other options.

mimeTypes
~~~~~~~~~

**type**: ``array`` or ``string`` **default**: ``image/*``

You can find a list of existing image mime types on the `IANA website`_.

mimeTypesMessage
~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``This file is not a valid image.``

minWidth
~~~~~~~~

**type**: ``integer``

If set, the width of the image file must be greater than or equal to this
value in pixels.

maxWidth
~~~~~~~~

**type**: ``integer``

If set, the width of the image file must be less than or equal to this
value in pixels.

minHeight
~~~~~~~~~

**type**: ``integer``

If set, the height of the image file must be greater than or equal to this
value in pixels.

maxHeight
~~~~~~~~~

**type**: ``integer``

If set, the height of the image file must be less than or equal to this
value in pixels.

maxRatio
~~~~~~~~

**type**: ``float``

If set, the aspect ratio (``width / height``) of the image file must be less
than or equal to this value.

minRatio
~~~~~~~~

**type**: ``float``

If set, the aspect ratio (``width / height``) of the image file must be greater
than or equal to this value.

allowSquare
~~~~~~~~~~~

**type**: ``Boolean`` **default**: ``true``

If this option is false, the image cannot be a square. If you want to force
a square image, then set leave this option as its default ``true`` value
and set `allowLandscape`_ and `allowPortrait`_ both to ``false``.

allowLandscape
~~~~~~~~~~~~~~

**type**: ``Boolean`` **default**: ``true``

If this option is false, the image cannot be landscape oriented.

allowPortrait
~~~~~~~~~~~~~

**type**: ``Boolean`` **default**: ``true``

If this option is false, the image cannot be portrait oriented.

sizeNotDetectedMessage
~~~~~~~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The size of the image could not be detected.``

If the system is unable to determine the size of the image, this error will
be displayed. This will only occur when at least one of the size constraint
options has been set.

maxWidthMessage
~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image width is too big ({{ width }}px).
Allowed maximum width is {{ max_width }}px.``

The error message if the width of the image exceeds `maxWidth`_.

minWidthMessage
~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image width is too small ({{ width }}px).
Minimum width expected is {{ min_width }}px.``

The error message if the width of the image is less than `minWidth`_.

maxHeightMessage
~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image height is too big ({{ height }}px).
Allowed maximum height is {{ max_height }}px.``

The error message if the height of the image exceeds `maxHeight`_.

minHeightMessage
~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image height is too small ({{ height }}px).
Minimum height expected is {{ min_height }}px.``

The error message if the height of the image is less than `minHeight`_.

maxRatioMessage
~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image ratio is too big ({{ ratio }}).
Allowed maximum ratio is {{ max_ratio }}``

The error message if the aspect ratio of the image exceeds `maxRatio`_.

minRatioMessage
~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image ratio is too small ({{ ratio }}).
Minimum ratio expected is {{ min_ratio }}``

The error message if the aspect ratio of the image is less than `minRatio`_.

allowSquareMessage
~~~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image is square ({{ width }}x{{ height }}px).
Square images are not allowed``

The error message if the image is square and you set `allowSquare`_ to ``false``.

allowLandscapeMessage
~~~~~~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image is landscape oriented ({{ width }}x{{ height }}px).
Landscape oriented images are not allowed``

The error message if the image is landscape oriented and you set `allowLandscape`_ to ``false``.

allowPortraitMessage
~~~~~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``The image is portrait oriented ({{ width }}x{{ height }}px).
Portrait oriented images are not allowed``

The error message if the image is portrait oriented and you set `allowPortrait`_ to ``false``.

.. _`IANA website`: http://www.iana.org/assignments/media-types/image/index.html


text:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var userSchema = new Schema({
	user: {
		id: {
			type: String,
			required: true,
			unique: true
		},
		_token: {
			type: String,
			required: true,
		},
		_social: {
			type: String,
			required: true,
		},
	},
	display_name: {
		type: String,
		required: true,
	},
	email: {
		type: String,
		lowercase: true,
		unique: true
	},
	profile_picture: {
		type: String,
		default: ''
	},
});

var playlistSchema = new Schema({
	_id: {
		type: Schema.Types.ObjectId,
		required: true
	},
	_name: {
		type: String,
		required: true
	},
	user_id: {
		type: String,
		required: true
	},
});

var itemSchema = new Schema({
	_id: {
		type: String,
		required: true
	},
	playlist_id: {
		type: Schema.Types.ObjectId,
		required: true
	}
});

var User = mongoose.model('User', userSchema);
var Playlist = mongoose.model('Playlist', playlistSchema);
var Item = mongoose.model('Item', itemSchema);

module.exports = {
	User: User,
	Playlist: Playlist,
	Item: Item
}


text:
import zeit.cms.interfaces
import zeit.cms.section.interfaces
import zeit.content.article.interfaces
import zeit.content.cp.interfaces

class IWebsiteSection(zeit.cms.section.interfaces.ISection):
    pass

class IWebsiteContent(
        zeit.cms.interfaces.ICMSContent,
        zeit.cms.section.interfaces.ISectionMarker):
    pass

class IWebsiteFolder(
        zeit.cms.repository.interfaces.IFolder,
        zeit.cms.section.interfaces.ISectionMarker):
    pass

class IWebsiteArticle(
        zeit.content.article.interfaces.IArticle,
        zeit.cms.section.interfaces.ISectionMarker):
    pass

class IWebsiteCenterPage(
        zeit.content.cp.interfaces.ICenterPage,
        zeit.cms.section.interfaces.ISectionMarker):
    pass