text:
<?php

namespace ZendTest\Form\TestAsset;

use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;
use Zend\Hydrator\ClassMethods as ClassMethodsHydrator;

class CountryFieldset extends Fieldset implements InputFilterProviderInterface
{
    public function __construct()
    {
        parent::__construct('country');
        $this->setHydrator(new ClassMethodsHydrator())
             ->setObject(new Entity\Country());

        $name = new \Zend\Form\Element('name', array('label' => 'Name of the country'));
        $name->setAttribute('type', 'text');

        $continent = new \Zend\Form\Element('continent', array('label' => 'Continent of the city'));
        $continent->setAttribute('type', 'text');

        $this->add($name);
        $this->add($continent);
    }

    /**
     * Should return an array specification compatible with
     * {@link Zend\InputFilter\Factory::createInputFilter()}.
     *
     * @return array
     */
    public function getInputFilterSpecification()
    {
        return array(
            'name' => array(
                'required' => true,
            ),
            'continent' => array(
                'required' => true
            )
        );
    }
}


text:
import styled from 'styled-components';
export default styled.div`
  text-align: ${p=>p.lang==='ar'?'right':'left'};
`;

redpajama_set_name: RedPajamaGithub


text:
set -e;
## All created files will have permission 760
umask 007;

### define script file locations.
user=$1;
project=$2;
main_dir=$(pwd)"/";

# load local installed program location variables.
. $main_dir/local_installed_programs.sh;

#user="darren";
#project="IEseq_Ct16_hap";
#main_dir="/heap/hapmap/bermanlab/";

#user="morlurie";
#project="BG2";
#main_dir="/heap/hapmap/bermanlab/";

##==============================================================================
## Define locations and names to be used later.
##------------------------------------------------------------------------------

projectDirectory=$main_dir"users/"$user"/projects/"$project"/";
logName=$projectDirectory"process_log.txt";
condensedLog=$projectDirectory"condensed_log.txt";

# Get genome name used from project's "genome.txt" file.
genome=$(head -n 1 $projectDirectory"genome.txt");
echo "\tgenome = '"$genome"'" >> $logName;

# Determine location of genome being used.
if [ -d $main_dir"users/"$user"/genomes/"$genome"/" ]
then
    genomeDirectory=$main_dir"users/"$user"/genomes/"$genome"/";
    genomeUser=$user;
elif [ -d $main_dir"users/default/genomes/"$genome"/" ]
then
    genomeDirectory=$main_dir"users/default/genomes/"$genome"/";
    genomeUser="default";
fi
echo "\tgenomeDirectory = '"$genomeDirectory"'" >> $logName;

# Get ploidy estimate from "ploidy.txt" in project directory.
ploidyEstimate=$(head -n 1 $projectDirectory"ploidy.txt");
echo "\tploidyEstimate = '"$ploidyEstimate"'" >> $logName;

# Get ploidy baseline from "ploidy.txt" in project directory.
ploidyBase=$(tail -n 1 $projectDirectory"ploidy.txt");
echo "\tploidyBase = '"$ploidyBase"'" >> $logName;

# Get parent name from "parent.txt" in project directory.
projectParent=$(head -n 1 $projectDirectory"parent.txt");
echo "\tparentProject = '"$projectParent"'" >> $logName;

# Determine location of project being used.
if [ -d $main_dir"users/"$user"/projects/"$projectParent"/" ]
then
    projectParentDirectory=$main_dir"users/"$user"/projects/"$projectParent"/";
    projectParentUser=$user;
elif [ -d $main_dir"users/default/projects/"$projectParent"/" ]
then
    projectParentDirectory=$main_dir"users/default/projects/"$projectParent"/";
    projectParentUser="default";
fi
echo "\tprojectParentDirectory = '"$projectParentDirectory"'" >> $logName;

##==============================================================================
## Perform CGH analysis, with GC-correction, on dataset.
##------------------------------------------------------------------------------
echo "#==========================#" >> $logName;
echo "# CGH analysis of dataset. #" >> $logName;
echo "#==========================#" >> $logName;
echo "Preprocessing CNV data.   (~10 min for 1.6 Gbase genome dataset.)" >> $condensedLog;

if [ -f $projectDirectory"preprocessed_CNVs.txt" ]
then
	echo "\t\tCNV data already preprocessed with python script : 'py/dataset_process_for_CNV_analysis.py'" >> $logName;
else
	echo "\t\tPreprocessing CNV data with python script : 'py/dataset_process_for_CNV_analysis.py'" >> $logName;
	$python_exec $main_dir"py/dataset_process_for_CNV_analysis.py" $user $project $genome $genomeUser $main_dir $logName  > $projectDirectory"preprocessed_CNVs.txt";
	echo "\t\tpre-processing complete." >> $logName;
fi

echo "Analyzing and mapping CNVs." >> $condensedLog;

echo "\t\tGenerating MATLAB script to perform CNV analysis of dataset, with GC-correction." >> $logName;
outputName=$projectDirectory"processing1.m";
echo "\t\toutputName = "$outputName >> $logName;

echo "function [] = processing1()" > $outputName;
echo "\tdiary('"$projectDirectory"matlab.CNV_and_GCbias.log');" >> $outputName;
echo "\tcd "$main_dir"Matlab/IonExpressSeq;" >> $outputName;
echo "\tanalyze_CNVs_1('$main_dir','$user','$genomeUser','$project','$genome','$ploidyEstimate','$ploidyBase');" >> $outputName;
echo "end" >> $outputName;

echo "\t|\tfunction [] = processing1()" >> $logName;
echo "\t|\t\tdiary('"$projectDirectory"matlab.CNV_and_GCbias.log');" >> $logName;
echo "\t|\t\tcd "$main_dir"Matlab/IonExpressSeq;" >> $logName;
echo "\t|\t\tanalyze_CNVs_1('$main_dir','$user','$genomeUser','$project','$genome','$ploidyEstimate','$ploidyBase');" >> $logName;
echo "\t|\tend" >> $logName;

echo "\t\tCalling MATLAB." >> $logName;
$matlab_exec -nosplash -r "run "$outputName"; exit;";
echo "\t\tMATLAB log from CNV analysis." >> $logName;
sed 's/^/\t\t\t|/;' $projectDirectory"matlab.CNV_and_GCbias.log" >> $logName;

##==============================================================================
## Perform ChARM analysis of dataset.
##------------------------------------------------------------------------------
echo "#============================#" >> $logName;
echo "# ChARM analysis of dataset. #" >> $logName;
echo "#============================#" >> $logName;
echo "Analyzing CNV edges." >> $condensedLog;

if [ -f $projectDirectory"Common_ChARM.mat" ]
then
	echo "\t\tChARM analysis already completed." >> $logName;
else
	echo "\t\tGenerating MATLAB script to perform ChARM analysis of dataset." >> $logName;
	outputName=$projectDirectory"processing2.m";
	echo "\t\toutputName = "$outputName >> $logName;

	echo "function [] = processing2()" > $outputName;
	echo "\tdiary('"$projectDirectory"matlab.ChARM.log');" >> $outputName;
	echo "\tcd "$main_dir"Matlab/ChARM;" >> $outputName;
	echo "\tChARM_v4('$project','$user','$genome','$genomeUser','$main_dir');" >> $outputName;
	echo "end" >> $outputName;

	echo "\t|\tfunction [] = processing2()" >> $logName;
	echo "\t|\t\tdiary('"$projectDirectory"matlab.ChARM.log');" >> $logName;
	echo "\t|\t\tcd "$main_dir"Matlab/ChARM;" >> $logName;
	echo "\t|\t\tChARM_v4('$project','$user','$genome','$genomeUser','$main_dir');" >> $logName;
	echo "\t|\tend" >> $logName;

	echo "\t\tCalling MATLAB." >> $logName;
	echo "================================================================================================";
	echo "== ChARM analysis ==============================================================================";
	echo "================================================================================================";
	$matlab_exec -nosplash -r "run "$outputName"; exit;";
	echo "\t\tMATLAB log from ChARM analysis." >> $logName;
	sed 's/^/\t\t\t|/;' $projectDirectory"matlab.ChARM.log" >> $logName;
fi

##==============================================================================
## Perform SNP/LOH analysis on dataset.
##------------------------------------------------------------------------------
if [ "$project" = "$projectParent" ]
then
	echo "#==========================#" >> $logName;
	echo "# SNP analysis of dataset. #" >> $logName;
	echo "#==========================#" >> $logName;
	echo "Preprocessing SNP data.   (~20 min for SNP analysis of 1.6 Gbase genome dataset.)" >> $condensedLog;
else
	echo "#==========================#" >> $logName;
	echo "# LOH analysis of dataset. #" >> $logName;
	echo "#==========================#" >> $logName;
	echo "Preprocessing SNP data.   (~4 hrs for LOH analysis of 1.6 Gbase genome dataset.)" >> $condensedLog;
fi

if [ -f $projectDirectory"preprocessed_SNPs.txt" ]
then
	echo "\t\tSNP data already preprocessed with python script : 'py/dataset_process_for_SNP_analysis.IonExpress.py'" >> $logName;
else
#	echo "\t\tPreprocessing SNP data with python script : 'py/dataset_process_for_SNP_analysis.1.py'" >> $logName;
#	$python_exec $main_dir"py/dataset_process_for_SNP_analysis.1.py" $genome $genomeUser $projectParent $projectParentUser $project $user $main_dir $logName  > $projectDirectory"preprocessed_SNPs.txt";
#	echo "\t\tpre-processing complete." >> $logName;

	echo "\t\tPreprocessing SNP data with python script : 'py/dataset_process_for_SNP_analysis.IonExpress.py'" >> $logName;
	if [ -f $projectParentDirectory"putative_SNPs_v4.txt" ]
	then
		echo "\t\tParent SNP data already decompressed." >> $logName;
		cp $projectParentDirectory"putative_SNPs_v4.txt" $projectDirectory"SNPdata_parent.txt";
	else
		echo "\t\tDecompressing parent SNP data." >> $logName;
		cd $projectParentDirectory;
		unzip -j putative_SNPs_v4.zip;
		cd $main_dir;
		cp $projectParentDirectory"putative_SNPs_v4.txt" $projectDirectory"SNPdata_parent.txt";
	fi

	# preprocess parent for comparison. abbey
	$python_exec $main_dir"py/hapmap.preprocess_parent.py" $genome $genomeUser $project $user $projectParent $projectParentUser $main_dir LOH > $projectDirectory"SNPdata_parent.temp.txt";

	rm $projectDirectory"SNPdata_parent.txt";
	mv $projectDirectory"SNPdata_parent.temp.txt" $projectDirectory"SNPdata_parent.txt";

	$python_exec $main_dir"py/dataset_process_for_SNP_analysis.IonExpress.py" $genome $genomeUser $projectParent $projectParentUser $project $user $main_dir $logName LOH > $projectDirectory"preprocessed_SNPs.txt";
	echo "\t\tpre-processing complete." >> $logName;
fi

echo "Mapping SNPs." >> $condensedLog;
echo "\t\tGenerating MATLAB script to perform SNP analysis of dataset." >> $logName;
outputName=$projectDirectory"processing3.m";
echo "\t\toutputName = "$outputName >> $logName;

echo "function [] = processing3()" > $outputName;
echo "\tdiary('"$projectDirectory"matlab.SNP_analysis.log');" >> $outputName;
echo "\tcd "$main_dir"Matlab/IonExpressSeq;" >> $outputName;
echo "\tanalyze_SNPs_hapmap('$main_dir','$user','$genomeUser','$project','$projectParent','$genome','$ploidyEstimate','$ploidyBase');" >> $outputName;
echo "end" >> $outputName;

echo "\t|\tfunction [] = processing3()" >> $logName;
echo "\t|\t\tdiary('"$projectDirectory"matlab.SNP_analysis.log');" >> $logName;
echo "\t|\t\tcd "$main_dir"Matlab/IonExpressSeq;" >> $logName;
echo "\t|\t\tanalyze_SNPs_hapmap('$main_dir','$user','$genomeUser','$project','$projectParent','$genome','$ploidyEstimate','$ploidyBase');" >> $logName;
echo "\t|\tend" >> $logName;

echo "\t\tCalling MATLAB." >> $logName;
echo "================================================================================================";
echo "== SNP analysis ================================================================================";
echo "================================================================================================";
$matlab_exec -nosplash -r "run "$outputName"; exit;";
echo "\t\tMATLAB log from SNP analysis." >> $logName;
sed 's/^/\t\t\t|/;' $projectDirectory"matlab.SNP_analysis.log" >> $logName;

##==============================================================================
## Generate final figures for dataset.
##------------------------------------------------------------------------------
echo "#==================================#" >> $logName;
echo "# Generate final combined figures. #" >> $logName;
echo "#==================================#" >> $logName;
echo "Generating final figures." >> $condensedLog;

echo "\t\tGenerating MATLAB script to generate combined CNV and SNP analysis figures from previous calculations." >> $logName;
outputName=$projectDirectory"processing4.m";
echo "\t\toutputName = "$outputName >> $logName;

echo "function [] = processing4()" > $outputName;
echo "\tdiary('"$projectDirectory"matlab.final_figs.log');" >> $outputName;
echo "\tcd "$main_dir"Matlab/IonExpressSeq;" >> $outputName;
echo "\tanalyze_CNV_SNPs_hapmap('$main_dir','$user','$genomeUser','$project','$projectParent','$genome','$ploidyEstimate','$ploidyBase');" >> $outputName;
echo "end" >> $outputName;

echo "\t|\tfunction [] = processing4()" >> $logName;
echo "\t|\t\tdiary('"$projectDirectory"matlab.final_figs.log');" >> $logName;
echo "\t|\t\tcd "$main_dir"Matlab/IonExpressSeq;" >> $logName;
echo "\t|\t\tanalyze_CNV_SNPs_hapmap('$main_dir','$user','$genomeUser','$project','$projectParent','$genome','$ploidyEstimate','$ploidyBase');" >> $logName;
echo "\t|\tend" >> $logName;

echo "\t\tCalling MATLAB.   (Log will be appended here after completion.)" >> $logName;
echo "================================================================================================";
echo "== Final figures ===============================================================================";
echo "================================================================================================";
$matlab_exec -nosplash -r "run "$outputName"; exit;";
echo "\t\tMATLAB log from final figure generation." >> $logName;
sed 's/^/\t\t|/;' $projectDirectory"matlab.final_figs.log" >> $logName;

##==============================================================================
## Cleanup intermediate processing files.
##------------------------------------------------------------------------------
sh $main_dir"scripts_seqModules/scripts_IonExpressSeq/cleaning_IonExpressSeq.sh" $user $project $main_dir;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace task1_Extract_emails
{
    public class task1_Extract_emails
    {
        public static void Main()
        {
            var text = Console.ReadLine();
            var regex = new Regex(@"([\w-.]+)\@[\w-]+(\.[a-zA-Z]+)+");

            var result = regex.Matches(text);

            foreach (Match item in result)
            {
                var email = item.ToString();
                if (!(email.StartsWith(".") || email.StartsWith("_") || email.StartsWith("-") ||
                    email.EndsWith(".") || email.EndsWith("_") || email.EndsWith("-")))
                {
                    Console.WriteLine(email);
                }

            }
        }
    }
}


text:
Community software platform

##License

Trident is licensed under the Creative Commons Public License, see license.txt for full details.

##Help

- [Wiki](https://github.com/boonex/trident/wiki)
- [Auto generated documentation](http://ci.boonex.com/docs)
- [Forum](http://www.boonex.com/forums)
- [Contact us](http://www.boonex.com/help/contact)


text:
						#
						Name
						Style
						Fermentation Start
						Fermentation End
						Dry Hopping Start
						Dry Hopping End
						Conditioning Start
						Conditioning End
						Rating (0-10)
						Comments

					{{#each beers}}

						{{ beer_id }}
						{{ name }}
						{{ style }}
						{{ prettyDate "date" fermenting_from }}
						{{ prettyDate "date" fermenting_to }}
						{{ prettyDate "date" dryhopping_from }}
						{{ prettyDate "date" dryhopping_to }}
						{{ prettyDate "date" conditioning_from }}
						{{ prettyDate "date" conditioning_to }}
						{{ rating }}
						{{ pruneLongText comments }}{{ comments }}

					{{/each}}

		<input id="create-beer-button" class="btn btn-default" type="submit" value="Create New Beer">
		<input id="update-beers-button" class="btn btn-default" type="submit" value="Save Changes">
		<input id="delete-beer-button" class="btn btn-default" type="submit" value="Delete Beer" disabled>


text:
import { Component } from '@angular/core';

@Component({
  moduleId: module.id,
  selector: 'contact',
  templateUrl: 'contact.component.html'
})

export class ContactComponent {}


text:
describe('table-scraper', function() {
  'use strict';

  var fs = require('fs');
  var expect = require('chai').expect;
  var nock = require('nock');
  var scraper = require('../index');

  var singleTablePage;
  var multipleTablePage;
  var fakeUrl;
  var tableData;

  before(function() {
    singleTablePage = fs.readFileSync(__dirname + '/singleTablePage.html', 'utf8');
    multipleTablePage= fs.readFileSync(__dirname + '/multiTablePage.html', 'utf8');
    fakeUrl = 'https://www.url.com';
  });

  beforeEach(function() {
    // Matches the fake data found in the mock html pages
    tableData = [
      {State: 'Minnesota', 'Capital City': 'Saint Paul', 'Pop.': '3'},
      {State: 'New York', 'Capital City': 'Albany', 'Pop.': 'Eight Million'}
    ];
    nock(fakeUrl).get('/single').reply(200, singleTablePage);
    nock(fakeUrl).get('/multi').reply(200, multipleTablePage);
    nock(fakeUrl).get('/404').reply(404);
  });

  it('can scrape a page with a single table', function(done) {
    scraper
        .get(fakeUrl + '/single')
        .then(function(response) {
          expect(response).to.deep.equal([tableData]);
          done();
        })
        .catch(function(err) { done(err); });
  });

  it('can scrape a page with multiple tables', function(done) {
    scraper
        .get(fakeUrl + '/multi')
        .then(function(response) {
          expect(response).to.deep.equal([
            tableData,
            tableData,
            // no headers for this table; default to indices
            [
              {'0': 'a', '1': 'b', '2': 'c'},
              {'0': '1', '1': '2', '2': '3'}
            ]
          ]);
          done();
        })
        .catch(function(err) { done(err); });
  });

  it('fails gracefully', function(done) {
    scraper
        .get(fakeUrl + '/404')
        .then(function(response) {
          // the .get should've returned an error, should not get into this block
          done(new Error('should have thrown an error!'));
        })
        .catch(function(err) {
          expect(err.message).to.equal('The website requested returned an error!');
          done();
        })
        // second catch block necessary to catch any errors from previous block
        .catch(function(err) {
          // should never reach here
          done(new Error(err));
        });
  });
});


text:
package org.jpublish.page.db;

import java.io.StringReader;
import java.sql.ResultSet;
import java.util.Iterator;

import org.jpublish.page.PageInstance;
import org.jpublish.JPublishRuntimeException;
import org.jpublish.page.PageDefinition;

/** Page iterator which uses a database for retrieving Pages.  This iterator
    requires a valid ResultSet from a page table.

    @author Anthony Eden
    @since 1.1
*/

public class DBPageIterator implements Iterator{

    private DBPageManager pageManager;
    private ResultSet resultSet;

    private PageInstance nextPage;

    /** Construct a new DBPageIterator for the given DBPageManager with the
        specified ResultSet.

        @param pageManager The page manager
        @param resultSet The result set
    */

    public DBPageIterator(DBPageManager pageManager, ResultSet resultSet){
        this.pageManager = pageManager;

        if(resultSet == null){
            throw new IllegalArgumentException("ResultSet can not be null");
        }
        this.resultSet = resultSet;
    }

    /** Returns true if the iteration has more elements. (In other words,
        returns true if next would return an element rather than throwing
        an exception.)

        @return True if the iteration has more elements
    */

    public boolean hasNext(){
        return getNext() != null;
    }

    /** Returns the next element in the iteration.

        @return The next element in the iteration
    */

    public Object next(){
        try{
            return getNext();
        } finally {
            nextPage = null;
        }
    }

    /** Removes from the underlying collection the last element returned by
        the iterator (optional operation). This method can be called only
        once per call to next. The behavior of an iterator is unspecified
        if the underlying collection is modified while the iteration is in
        progress in any way other than by calling this method.

        @throws UnsupportedOperationException
    */

    public void remove(){
        throw new UnsupportedOperationException();
    }

    protected PageInstance getNext(){
        if(nextPage == null){
            try{
                if(resultSet.next()){

                    String pageXML = resultSet.getString("data");
                    String pagePath = resultSet.getString("path");

                    PageDefinition pageDefinition = new PageDefinition(
                        pageManager.getSiteContext(), pagePath);
                    pageDefinition.loadConfiguration(new StringReader(pageXML));

                    // note that the type will be set to XML.  This is because
                    // the actual page type depends on the request URL, which
                    // is not available to the iterator, so the page path is
                    // used instead.

                    nextPage = pageDefinition.getPageInstance(pagePath);
                } else {
                    return null;
                }
            } catch(Exception e){
                    throw new JPublishRuntimeException(
                        "Error getting page instance", e);
            }
        }
        return nextPage;
    }

}


text:
package org.apache.lucene.gdata.gom.core;

import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;

import org.apache.lucene.gdata.gom.GOMAuthor;
import org.apache.lucene.gdata.gom.GOMContributor;
import org.apache.lucene.gdata.gom.GOMNamespace;
import org.apache.lucene.gdata.gom.writer.GOMOutputWriter;

/**
 * @author Simon Willnauer
 *
 */
public class GOMContributorImpl extends GOMPersonImpl implements GOMContributor {

	/**
	 * @see org.apache.lucene.gdata.gom.core.GOMPersonImpl#writeRssOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter)
	 */
	@Override
	public void writeRssOutput(GOMOutputWriter aStreamWriter)
			throws XMLStreamException {
		writeRssOutput(aStreamWriter, GOMAuthor.LOCALNAME);
	}

	/**
	 *
	 */
	public GOMContributorImpl() {
		this.localName = GOMContributor.LOCALNAME;
		this.qname = new QName(GOMNamespace.ATOM_NS_URI, this.localName);
	}

}