text:
import {
    SemanticCOLORS,
    SemanticSIZES,
    SemanticTEXTALIGNMENTS,
    SemanticVERTICALALIGNMENTS,
    SemanticWIDTHSNUMBER,
    SemanticWIDTHSSTRING
} from '../..';
import * as React from 'react';

interface TableProps {

  /** An element type to render as (string or function). */
  as?: any;

  /** Attach table to other content */
  attached?: boolean | 'top' | 'bottom';

  /** A table can reduce its complexity to increase readability. */
  basic?: boolean | 'very';

  /** A table may be divided each row into separate cells. */
  celled?: boolean|'internally';

  /** Primary content. */
  children?: React.ReactNode;

  /** Additional classes. */
  className?: string;

  /** A table can be collapsing, taking up only as much space as its rows. */
  collapsing?: boolean;

  /** A table can be given a color to distinguish it from other tables. */
  color?: SemanticCOLORS;

  /** A table can specify its column count to divide its content evenly. */
  columns?: SemanticWIDTHSNUMBER | SemanticWIDTHSSTRING | number;

  /** A table may sometimes need to be more compact to make more rows visible at a time. */
  compact?: boolean | 'very';

  /** A table may be formatted to emphasize a first column that defines a rows content. */
  definition?: boolean;

  /**
   * A table can use fixed a special faster form of table rendering that does not resize table cells based on content
   */
  fixed?: boolean;

  /** Shorthand for a TableRow to be placed within Table.Footer. */
  footerRow?: any;

  /** Shorthand for a TableRow to be placed within Table.Header. */
  headerRow?: any;

  /** A table's colors can be inverted. */
  inverted?: boolean;

  /** A table may sometimes need to be more padded for legibility. */
  padded?: boolean | 'very';

  /**
   * A function that takes (data, index) and returns shorthand for a TableRow
   * to be placed within Table.Body.
   */
  renderBodyRow?: ()=>void;  // TODO - check;

  /** A table can have its rows appear selectable. */
  selectable?: boolean;

  /** A table can specify that its cell contents should remain on a single line and not wrap. */
  singleLine?: boolean;

  /** A table can also be small or large. */
  size?: SemanticSIZES;

  /** A table can specify how it stacks table content responsively. */
  stackable?: boolean;

  /** A table can stripe alternate rows of content with a darker color to increase contrast. */
  striped?: boolean;

  /** A table can be formatted to display complex structured data. */
  structured?: boolean;

  /** Data to be passed to the renderBodyRow function. */
  tableData?: any;

  /** A table can specify how it stacks table content responsively. */
  unstackable?: boolean;
}

interface TableClass extends React.ComponentClass<TableProps> {
  Body: typeof TableBody;
  Cell: typeof TableCell;
  Footer: typeof TableFooter;
  Header: typeof TableHeader;
  HeaderCell: typeof TableHeaderCell;
  Row: typeof TableRow;
}

export const Table: TableClass;

interface TableBodyProps {

  /** An element type to render as (string or function). */
  as?: any;

  /** Primary content. */
  children?: React.ReactNode;

  /** Additional classes. */
  className?: string;
}

export const TableBody: React.ComponentClass<TableBodyProps>;

interface TableCellProps {

  /** A cell can be active or selected by a user. */
  active?: boolean;

  /** An element type to render as (string or function). */
  as ?: any;

  /** Primary content. */
  children ?: React.ReactNode;

  /** Additional classes. */
  className?: string;

  /** A table can be collapsing, taking up only as much space as its rows. */
  collapsing ?: boolean;

  /** Shorthand for primary content. */
  content ?: any;

  /** A cell can be disabled. */
  disabled ?: boolean;

  /** A cell may call attention to an error or a negative value. */
  error ?: boolean;

  /** Add an Icon by name, props object, or pass an <Icon /> */
  icon ?: any;

  /** A cell may let a user know whether a value is bad. */
  negative ?: boolean;

  /** A cell may let a user know whether a value is good. */
  positive ?: boolean;

  /** A cell can be selectable. */
  selectable?: boolean;

  /** A cell can specify that its contents should remain on a single line and not wrap. */
  singleLine ?: boolean;

  /** A table cell can adjust its text alignment. */
  textAlign?: SemanticTEXTALIGNMENTS;

  /** A table cell can adjust its text alignment. */
  verticalAlign?: SemanticVERTICALALIGNMENTS;

  /** A cell may warn a user. */
  warning?: boolean;

  /** A table can specify the width of individual columns independently. */
  width?: number | SemanticWIDTHSSTRING | SemanticWIDTHSNUMBER;
}

export const TableCell: React.ComponentClass<TableCellProps>;

interface TableFooterProps {

  /** An element type to render as (string or function). */
  as?: any;
}

export const TableFooter: React.ComponentClass<TableFooterProps>;

interface TableHeaderProps {

  /** An element type to render as (string or function). */
  as?: any;

  /** Primary content. */
  children?: React.ReactNode;

  /** Additional classes. */
  className?: string;

  /** A definition table can have a full width header or footer, filling in the gap left by the first column. */
  fullWidth?: boolean;
}

export const TableHeader: React.ComponentClass<TableHeaderProps>;

interface TableHeaderCellProps {

  /** An element type to render as (string or function). */
  as?: any;
}

export const TableHeaderCell: React.ComponentClass<TableHeaderCellProps>;

interface TableRowProps {

  /** A row can be active or selected by a user. */
  active?: boolean;

  /** An element type to render as (string or function). */
  as ?: any;

  /** An element type to render as (string or function). */
  cellAs?: any;

  /** Shorthand array of props for TableCell. */
  cells?: any;

  /** Primary content. */
  children ?: React.ReactNode;

  /** Additional classes. */
  className?: string;

  /** A row can be disabled. */
  disabled ?: boolean;

  /** A row may call attention to an error or a negative value. */
  error ?: boolean;

  /** A row may let a user know whether a value is bad. */
  negative ?: boolean;

  /** A row may let a user know whether a value is good. */
  positive ?: boolean;

  /** A table row can adjust its text alignment. */
  textAlign?: SemanticTEXTALIGNMENTS;

  /** A table row can adjust its vertical alignment. */
  verticalAlign?: SemanticVERTICALALIGNMENTS;

  /** A row may warn a user. */
  warning?: boolean;
}

export const TableRow: React.ComponentClass<TableRowProps>;


text:
package s3crypto

import (
	"bytes"
	"encoding/base64"
	"errors"
	"io/ioutil"
	"strings"

	"github.com/gucumber/gucumber"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kms"
	"github.com/aws/aws-sdk-go/service/s3"
	"github.com/aws/aws-sdk-go/service/s3/s3crypto"
)

func init() {
	gucumber.When(`^I get all fixtures for "(.+?)" from "(.+?)"$`,
		func(cekAlg, bucket string) {
			prefix := "plaintext_test_case_"
			baseFolder := "crypto_tests/" + cekAlg
			s3Client := gucumber.World["client"].(*s3.S3)

			out, err := s3Client.ListObjects(&s3.ListObjectsInput{
				Bucket: aws.String(bucket),
				Prefix: aws.String(baseFolder + "/" + prefix),
			})
			if err != nil {
				gucumber.T.Errorf("expect no error, got %v", err)
			}

			plaintexts := make(map[string][]byte)
			for _, obj := range out.Contents {
				plaintextKey := obj.Key
				ptObj, err := s3Client.GetObject(&s3.GetObjectInput{
					Bucket: aws.String(bucket),
					Key:    plaintextKey,
				})
				if err != nil {
					gucumber.T.Errorf("expect no error, got %v", err)
				}
				caseKey := strings.TrimPrefix(*plaintextKey, baseFolder+"/"+prefix)
				plaintext, err := ioutil.ReadAll(ptObj.Body)
				if err != nil {
					gucumber.T.Errorf("expect no error, got %v", err)
				}

				plaintexts[caseKey] = plaintext
			}
			gucumber.World["baseFolder"] = baseFolder
			gucumber.World["bucket"] = bucket
			gucumber.World["plaintexts"] = plaintexts
		})

	gucumber.Then(`^I decrypt each fixture against "(.+?)" "(.+?)"$`, func(lang, version string) {
		plaintexts := gucumber.World["plaintexts"].(map[string][]byte)
		baseFolder := gucumber.World["baseFolder"].(string)
		bucket := gucumber.World["bucket"].(string)
		prefix := "ciphertext_test_case_"
		s3Client := gucumber.World["client"].(*s3.S3)
		s3CryptoClient := gucumber.World["decryptionClient"].(*s3crypto.DecryptionClient)
		language := "language_" + lang

		ciphertexts := make(map[string][]byte)
		for caseKey := range plaintexts {
			cipherKey := baseFolder + "/" + version + "/" + language + "/" + prefix + caseKey

			// To get metadata for encryption key
			ctObj, err := s3Client.GetObject(&s3.GetObjectInput{
				Bucket: aws.String(bucket),
				Key:    &cipherKey,
			})
			if err != nil {
				continue
			}

			// We don't support wrap, so skip it
			if ctObj.Metadata["X-Amz-Wrap-Alg"] == nil || *ctObj.Metadata["X-Amz-Wrap-Alg"] != "kms" {
				continue
			}

			ctObj, err = s3CryptoClient.GetObject(&s3.GetObjectInput{
				Bucket: aws.String(bucket),
				Key:    &cipherKey,
			},
			)
			if err != nil {
				gucumber.T.Errorf("expect no error, got %v", err)
			}

			ciphertext, err := ioutil.ReadAll(ctObj.Body)
			if err != nil {
				gucumber.T.Errorf("expect no error, got %v", err)
			}
			ciphertexts[caseKey] = ciphertext
		}
		gucumber.World["decrypted"] = ciphertexts
	})

	gucumber.And(`^I compare the decrypted ciphertext to the plaintext$`, func() {
		plaintexts := gucumber.World["plaintexts"].(map[string][]byte)
		ciphertexts := gucumber.World["decrypted"].(map[string][]byte)
		for caseKey, ciphertext := range ciphertexts {
			if e, a := len(plaintexts[caseKey]), len(ciphertext); e != a {
				gucumber.T.Errorf("expect %v, got %v", e, a)
			}
			if e, a := plaintexts[caseKey], ciphertext; !bytes.Equal(e, a) {
				gucumber.T.Errorf("expect %v, got %v", e, a)
			}
		}
	})

	gucumber.Then(`^I encrypt each fixture with "(.+?)" "(.+?)" "(.+?)" and "(.+?)"$`, func(kek, v1, v2, cek string) {
		var handler s3crypto.CipherDataGenerator
		var builder s3crypto.ContentCipherBuilder
		switch kek {
		case "kms":
			arn, err := getAliasInformation(v1, v2)
			if err != nil {
				gucumber.T.Errorf("expect nil, got %v", nil)
			}

			b64Arn := base64.StdEncoding.EncodeToString([]byte(arn))
			if err != nil {
				gucumber.T.Errorf("expect nil, got %v", nil)
			}
			gucumber.World["Masterkey"] = b64Arn

			handler = s3crypto.NewKMSKeyGenerator(kms.New(session.New(&aws.Config{
				Region: &v2,
			})), arn)
			if err != nil {
				gucumber.T.Errorf("expect nil, got %v", nil)
			}
		default:
			gucumber.T.Skip()
		}

		switch cek {
		case "aes_gcm":
			builder = s3crypto.AESGCMContentCipherBuilder(handler)
		case "aes_cbc":
			builder = s3crypto.AESCBCContentCipherBuilder(handler, s3crypto.AESCBCPadder)
		default:
			gucumber.T.Skip()
		}

		sess := session.New(&aws.Config{
			Region: aws.String("us-west-2"),
		})
		c := s3crypto.NewEncryptionClient(sess, builder, func(c *s3crypto.EncryptionClient) {
		})
		gucumber.World["encryptionClient"] = c
		gucumber.World["cek"] = cek
	})

	gucumber.And(`^upload "(.+?)" data with folder "(.+?)"$`, func(language, folder string) {
		c := gucumber.World["encryptionClient"].(*s3crypto.EncryptionClient)
		cek := gucumber.World["cek"].(string)
		bucket := gucumber.World["bucket"].(string)
		plaintexts := gucumber.World["plaintexts"].(map[string][]byte)
		key := gucumber.World["Masterkey"].(string)
		for caseKey, plaintext := range plaintexts {
			input := &s3.PutObjectInput{
				Bucket: &bucket,
				Key:    aws.String("crypto_tests/" + cek + "/" + folder + "/language_" + language + "/ciphertext_test_case_" + caseKey),
				Body:   bytes.NewReader(plaintext),
				Metadata: map[string]*string{
					"Masterkey": &key,
				},
			}

			_, err := c.PutObject(input)
			if err != nil {
				gucumber.T.Errorf("expect nil, got %v", nil)
			}
		}
	})
}

func getAliasInformation(alias, region string) (string, error) {
	arn := ""
	svc := kms.New(session.New(&aws.Config{
		Region: &region,
	}))

	truncated := true
	var marker *string
	for truncated {
		out, err := svc.ListAliases(&kms.ListAliasesInput{
			Marker: marker,
		})
		if err != nil {
			return arn, err
		}
		for _, aliasEntry := range out.Aliases {
			if *aliasEntry.AliasName == "alias/"+alias {
				return *aliasEntry.AliasArn, nil
			}
		}
		truncated = *out.Truncated
		marker = out.NextMarker
	}

	return "", errors.New("The alias " + alias + " does not exist in your account. Please add the proper alias to a key")
}
//Added a line for testing
//Adding another line for Git event testing part 2
//Adding another line for Git event testing part 2.1
//Adding another line for Git event testing part 2.2

redpajama_set_name: RedPajamaGithub


text:
package org.apache.jmeter.protocol.http.config;

import java.io.Serializable;

import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.http.util.HTTPArgument;
import org.apache.jmeter.protocol.http.util.HTTPFileArgs;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.util.JOrphanUtils;
import org.apache.oro.text.regex.Pattern;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;

/**
 * Configuration element which handles HTTP Parameters and files to be uploaded
 */
public class MultipartUrlConfig implements Serializable {

    private static final long serialVersionUID = 240L;

    private final String boundary;

    private final Arguments args;

    /**
     * HTTPFileArgs list to be uploaded with http request.
     */
    private final HTTPFileArgs files;

    /**
     * @deprecated only for use by unit tests
     */
    @Deprecated
    public MultipartUrlConfig(){
        this(null);
    }

    // called by HttpRequestHdr
    public MultipartUrlConfig(String boundary) {
        args = new Arguments();
        files = new HTTPFileArgs();
        this.boundary = boundary;
    }

    public String getBoundary() {
        return boundary;
    }

    public Arguments getArguments() {
        return args;
    }

    public void addArgument(String name, String value) {
        Arguments myArgs = this.getArguments();
        myArgs.addArgument(new HTTPArgument(name, value));
    }

    public void addArgument(String name, String value, String metadata) {
        Arguments myArgs = this.getArguments();
        myArgs.addArgument(new HTTPArgument(name, value, metadata));
    }

    public HTTPFileArgs getHTTPFileArgs() {
        return files;
    }

    /**
     * Add a value that is not URL encoded, and make sure it
     * appears in the GUI that it will not be encoded when
     * the request is sent.
     *
     * @param name
     * @param value
     */
    private void addNonEncodedArgument(String name, String value) {
        Arguments myArgs = getArguments();
        // The value is not encoded
        HTTPArgument arg = new HTTPArgument(name, value, false);
        // Let the GUI show that it will not be encoded
        arg.setAlwaysEncoded(false);
        myArgs.addArgument(arg);
    }

    /**
     * This method allows a proxy server to send over the raw text from a
     * browser's output stream to be parsed and stored correctly into the
     * UrlConfig object.
     *
     * @param queryString text to parse
     */
    public void parseArguments(String queryString) {
        String[] parts = JOrphanUtils.split(queryString, "--" + getBoundary()); //$NON-NLS-1$
        for (String part : parts) {
            String contentDisposition = getHeaderValue("Content-disposition", part); //$NON-NLS-1$
            String contentType = getHeaderValue("Content-type", part); //$NON-NLS-1$
            // Check if it is form data
            if (contentDisposition != null && contentDisposition.contains("form-data")) { //$NON-NLS-1$
                // Get the form field name
                final String namePrefix = "name=\""; //$NON-NLS-1$
                int index = contentDisposition.indexOf(namePrefix) + namePrefix.length();
                String name = contentDisposition.substring(index, contentDisposition.indexOf('\"', index)); //$NON-NLS-1$

                // Check if it is a file being uploaded
                final String filenamePrefix = "filename=\""; //$NON-NLS-1$
                if (contentDisposition.contains(filenamePrefix)) {
                    // Get the filename
                    index = contentDisposition.indexOf(filenamePrefix) + filenamePrefix.length();
                    String path = contentDisposition.substring(index, contentDisposition.indexOf('\"', index)); //$NON-NLS-1$
                    if (path != null && path.length() > 0) {
                        // Set the values retrieved for the file upload
                        files.addHTTPFileArg(path, name, contentType);
                    }
                } else {
                    // Find the first empty line of the multipart, it signals end of headers for multipart
                    // Agents are supposed to terminate lines in CRLF:
                    final String CRLF = "\r\n";
                    final String CRLFCRLF = "\r\n\r\n";
                    // Code also allows for LF only (not sure why - perhaps because the test code uses it?)
                    final String LF = "\n";
                    final String LFLF = "\n\n";
                    int indexEmptyCrLfCrLfLinePos = part.indexOf(CRLFCRLF); //$NON-NLS-1$
                    int indexEmptyLfLfLinePos = part.indexOf(LFLF); //$NON-NLS-1$
                    String value = null;
                    if (indexEmptyCrLfCrLfLinePos > -1) {// CRLF blank line found
                        value = part.substring(indexEmptyCrLfCrLfLinePos + CRLFCRLF.length(), part.lastIndexOf(CRLF));
                    } else if (indexEmptyLfLfLinePos > -1) { // LF blank line found
                        value = part.substring(indexEmptyLfLfLinePos + LFLF.length(), part.lastIndexOf(LF));
                    }
                    this.addNonEncodedArgument(name, value);
                }
            }
        }
    }

    private String getHeaderValue(String headerName, String multiPart) {
        String regularExpression = headerName + "\\s*:\\s*(.*)$"; //$NON-NLS-1$
        Perl5Matcher localMatcher = JMeterUtils.getMatcher();
        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
        if(localMatcher.contains(multiPart, pattern)) {
            return localMatcher.getMatch().group(1).trim();
        }
        else {
            return null;
        }
    }
}


text:
This is the μcaptcha plugin for WordPress.

See `wp-mucaptcha/readme.txt` for more details.


text:
/*
Financial document package - includes requested/received boxes from vetting worksheet
*/

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

var FinPackageSchema = new Schema({
	appID: { type: ObjectId},
	name : String,

	food_stamps : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	income_tax : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	employment : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	ss_ben : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	pension : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	house_assist : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	check_account : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	saving_account : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	ret_fund : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	invest : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	physical : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	other_resources : {
		desc : String,
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	},

	proof_own : {
		req : Boolean,
		rec : Boolean,
		na  : Boolean,
		note : String
	}

});

var FinPackage = mongoose.model('FinPackage', FinPackageSchema);
module.exports = FinPackage;


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

namespace Disunity.Data.Common
{
    public class Option<T> : IEnumerable<T>
    {
        private readonly bool _hasValue;
        private readonly T _value;

        public Option(bool hasValue, T value)
        {
            _hasValue = hasValue;
            _value = value;
        }

        public T OrElse(T defaultValue)
        {
            return _hasValue ? _value : defaultValue;
        }

        public Option<TOut> Select<TOut>(Func<T, TOut> selector)
        {
            return _hasValue ? Option.Some(selector(_value)) : Option.None<TOut>();
        }

        public IEnumerator<T> GetEnumerator()
        {
            if (_hasValue)
                yield return _value;
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }

    public static class Option
    {
        public static Option<T> Some<T>(T value)
        {
            return new Option<T>(true, value);
        }

        public static Option<T> None<T>()
        {
            return new Option<T>(false, default(T));
        }
    }
}


text:
'use strict';

var TASK_NAME = 'angular-builder';

var TASK_DESCRIPTION = 'Generates a release/debug build of an AngularJS project.';

/**
 * Utility functions.
 */
var util = require ('./lib/gruntUtil')
  , types = require ('./lib/types');

var Context = types.Context
  , ContextEvent = types.ContextEvent
  , TaskOptions = types.TaskOptions
  , extend = util.extend
  , fatal = util.fatal
  , info = util.info;
/**
 * Exports a function that will be called by Grunt to register tasks for this plugin.
 * @param grunt The Grunt API.
 */
module.exports = function (grunt)
{
  util.init (grunt);

//------------------------------------------------------------------------------
// GRUNT TASK
//------------------------------------------------------------------------------

  grunt.registerMultiTask (TASK_NAME, TASK_DESCRIPTION, function ()
  {
    //------------------
    // SETUP
    //------------------

    if (!this.files.length)
      fatal ('No source files were defined.');

    /**
     * The default values for all of the Angular Builder's options.
     * @type {TaskOptions}
     */
    var defaultOptions = new TaskOptions ();

    /**
     * An ordered list of middleware classes from which the middleware stack will be created later on.
     *
     * Note: when loading the middleware modules, the TaskOptions class becomes augmented with middleware-specific
     * options.
     * @type {MiddlewareInterface[]}
     */
    var middlewareStackClasses = loadMiddlewareModules (defaultOptions);

    //-------------------------
    // Process each file group
    //-------------------------

    this.files.forEach (function (/** GruntFilesArrayExt */ fileGroup)
    {
      // Note: source code analysis information for each file group is reset for each file group,
      // i.e. each group is an independent build.

      var context = new Context (grunt, this, defaultOptions);

      if (!context.options.mainModule)
        fatal ('No main module is defined.');

      /**
       * The sequential list of loaded middleare.
       * These will be reset for each file group.
       * @type {MiddlewareInterface[]}
       */
      var middlewareStack = assembleMiddleware (middlewareStackClasses, context);

      context.trigger (ContextEvent.ON_INIT);

      //------------------
      // LOAD SOURCE CODE
      //------------------

      if (!fileGroup.dest)
        fatal ('No target script is defined.');

      // Pass all the source code trough the 1st stage of the middleware stack.

      middlewareStack.forEach (function (/*MiddlewareInterface*/ middleware)
      {
        middleware.analyze (fileGroup);
      });

      context.trigger (ContextEvent.ON_AFTER_ANALYZE);

      //------------------
      // BUILD
      //------------------

      // Trace the dependency graph and pass each module trough the 2nd stage of the middleware stack.

      traceModule (context.options.mainModule, context, function (/*ModuleDef*/module)
      {
        middlewareStack.forEach (function (/*MiddlewareInterface*/ middleare)
        {
          middleare.trace (module);
        });
      });

      context.trigger (ContextEvent.ON_AFTER_TRACE);

      // Pass all the analysed source code trough the 3rd stage of the middleware stack.

      middlewareStack.forEach (function (/*MiddlewareInterface*/ middleware)
      {
        middleware.build (fileGroup.dest);
      });

      context.trigger (ContextEvent.ON_AFTER_BUILD);

    }.bind (this));
  });

  /**
   * Loads all middlewares (both internal and external).
   *
   * @param {TaskOptions} options The task's base default options. Extended options contributed by middleware will be
   * set in turn by each loaded middleware module.
   * @return {Array}
   */
  function loadMiddlewareModules (options)
  {
    var middlewareStackClasses = [];

    options.internalMiddleware.forEach (function (moduleName)
    {
      var module = require (moduleName);
      if (!module.middleware)
        util.fatal ('No middleware found on module %.', moduleName);
      if (module.options)
        extend (options, module.options);
      middlewareStackClasses.push (module.middleware);
    });

    if (options.externalMiddleware)
      options.externalMiddleware.forEach (function (info)
      {
        var module = require (info.load);
        if (module.options)
          extend (options, new module.options ());
        var target = info.before || info.after
          , i = middlewareStackClasses.indexOf (target);
        if (~i)
          util.fatal ("Can't locate the % middleware module for inserting %.", target, info.load);
        middlewareStackClasses.splice (i + (info.before ? 0 : 1), 0, module.middleware);
      });

    return middlewareStackClasses;
  }

  /**
   * Creates a new instance of each loaded middleware and assembles them into a sequential list.
   * @param {MiddlewareInterface[]} middlewareStackClasses An ordered list of classes to be instantiated.
   * @param {Context} context The build execution context.
   * @returns {MiddlewareInterface[]}
   */
  function assembleMiddleware (middlewareStackClasses, context)
  {
    var middlewares = [];
    middlewareStackClasses.forEach (function (MiddlewareClass)
    {
      middlewares.push (new MiddlewareClass (context));
    });
    return middlewares;
  }

  /**
   * Traces a dependency graph for the specified module and calls the given callback
   * to process each required module in the correct loading order.
   * @param {string} moduleName
   * @param {Context} context The execution context for the middleware stack.
   * @param {function(ModuleDef)} processHook
   */
  function traceModule (moduleName, context, processHook)
  {
    var module = context.modules[moduleName];
    if (!module)
      fatal ('Module <cyan>%</cyan> was not found.', moduleName);
    // Ignore the module if it's external.
    if (module.external)
      return;
    // Include required submodules first.
    if (module.requires) {
      module.requires.forEach (function (modName)
      {
        traceModule (modName, context, processHook);
      });
    }
    // Ignore references to already loaded modules or to explicitly excluded modules.
    if (!context.loaded[module.name] && !~context.options.excludedModules.indexOf (module.name)) {
      info ('Including module <cyan>%</cyan>.', moduleName);
      context.loaded[module.name] = true;
      processHook (module);
    }
  }

};


text:
using ::net::test::IsError;
using ::net::test::IsOk;
using ::testing::StrictMock;
using ::testing::TestWithParam;
using ::testing::Values;
using ::testing::_;

namespace net {
namespace {

enum HandshakeStreamType { BASIC_HANDSHAKE_STREAM, HTTP2_HANDSHAKE_STREAM };

// This class encapsulates the details of creating a mock ClientSocketHandle.
class MockClientSocketHandleFactory {
 public:
  MockClientSocketHandleFactory()
      : pool_(1, 1, socket_factory_maker_.factory()) {}

  // The created socket expects |expect_written| to be written to the socket,
  // and will respond with |return_to_read|. The test will fail if the expected
  // text is not written, or if all the bytes are not read.
  std::unique_ptr<ClientSocketHandle> CreateClientSocketHandle(
      const std::string& expect_written,
      const std::string& return_to_read) {
    socket_factory_maker_.SetExpectations(expect_written, return_to_read);
    auto socket_handle = std::make_unique<ClientSocketHandle>();
    socket_handle->Init("a", scoped_refptr<MockTransportSocketParams>(), MEDIUM,
                        SocketTag(), ClientSocketPool::RespectLimits::ENABLED,
                        CompletionOnceCallback(), &pool_, NetLogWithSource());
    return socket_handle;
  }

 private:
  WebSocketMockClientSocketFactoryMaker socket_factory_maker_;
  MockTransportClientSocketPool pool_;

  DISALLOW_COPY_AND_ASSIGN(MockClientSocketHandleFactory);
};

class TestConnectDelegate : public WebSocketStream::ConnectDelegate {
 public:
  ~TestConnectDelegate() override = default;

  void OnCreateRequest(URLRequest* request) override {}
  void OnSuccess(std::unique_ptr<WebSocketStream> stream) override {}
  void OnFailure(const std::string& failure_message) override {}
  void OnStartOpeningHandshake(
      std::unique_ptr<WebSocketHandshakeRequestInfo> request) override {}
  void OnFinishOpeningHandshake(
      std::unique_ptr<WebSocketHandshakeResponseInfo> response) override {}
  void OnSSLCertificateError(
      std::unique_ptr<WebSocketEventInterface::SSLErrorCallbacks>
          ssl_error_callbacks,
      const SSLInfo& ssl_info,
      bool fatal) override {}
  int OnAuthRequired(scoped_refptr<AuthChallengeInfo> auth_info,

                     scoped_refptr<HttpResponseHeaders> response_headers,
                     const HostPortPair& host_port_pair,
                     base::OnceCallback<void(const AuthCredentials*)> callback,
                     base::Optional<AuthCredentials>* credentials) override {
    *credentials = base::nullopt;
    return OK;
  }
};

class MockWebSocketStreamRequestAPI : public WebSocketStreamRequestAPI {
 public:
  ~MockWebSocketStreamRequestAPI() override = default;

  MOCK_METHOD1(OnBasicHandshakeStreamCreated,
               void(WebSocketBasicHandshakeStream* handshake_stream));
  MOCK_METHOD1(OnHttp2HandshakeStreamCreated,
               void(WebSocketHttp2HandshakeStream* handshake_stream));
  MOCK_METHOD1(OnFailure, void(const std::string& message));
};

class WebSocketHandshakeStreamCreateHelperTest
    : public TestWithParam<HandshakeStreamType>,
      public WithScopedTaskEnvironment {
 protected:
  std::unique_ptr<WebSocketStream> CreateAndInitializeStream(
      const std::vector<std::string>& sub_protocols,
      const WebSocketExtraHeaders& extra_request_headers,
      const WebSocketExtraHeaders& extra_response_headers) {
    const char kPath[] = "/";
    const char kOrigin[] = "http://origin.example.org";
    const GURL url("wss://www.example.org/");
    NetLogWithSource net_log;

    WebSocketHandshakeStreamCreateHelper create_helper(&connect_delegate_,
                                                       sub_protocols);
    create_helper.set_stream_request(&stream_request_);

    switch (GetParam()) {
      case BASIC_HANDSHAKE_STREAM:
        EXPECT_CALL(stream_request_, OnBasicHandshakeStreamCreated(_)).Times(1);
        break;

      case HTTP2_HANDSHAKE_STREAM:
        EXPECT_CALL(stream_request_, OnHttp2HandshakeStreamCreated(_)).Times(1);
        break;

      default:
        NOTREACHED();
    }

    EXPECT_CALL(stream_request_, OnFailure(_)).Times(0);

    HttpRequestInfo request_info;
    request_info.url = url;
    request_info.method = "GET";
    request_info.load_flags = LOAD_DISABLE_CACHE;
    request_info.traffic_annotation =
        MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS);

    auto headers = WebSocketCommonTestHeaders();

    switch (GetParam()) {
      case BASIC_HANDSHAKE_STREAM: {
        std::unique_ptr<ClientSocketHandle> socket_handle =
            socket_handle_factory_.CreateClientSocketHandle(
                WebSocketStandardRequest(
                    kPath, "www.example.org",
                    url::Origin::Create(GURL(kOrigin)), "",
                    WebSocketExtraHeadersToString(extra_request_headers)),
                WebSocketStandardResponse(
                    WebSocketExtraHeadersToString(extra_response_headers)));

        std::unique_ptr<WebSocketHandshakeStreamBase> handshake =
            create_helper.CreateBasicStream(std::move(socket_handle), false,
                                            &websocket_endpoint_lock_manager_);

        // If in future the implementation type returned by CreateBasicStream()
        // changes, this static_cast will be wrong. However, in that case the
        // test will fail and AddressSanitizer should identify the issue.
        static_cast<WebSocketBasicHandshakeStream*>(handshake.get())
            ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ==");

        int rv =
            handshake->InitializeStream(&request_info, true, DEFAULT_PRIORITY,
                                        net_log, CompletionOnceCallback());
        EXPECT_THAT(rv, IsOk());

        HttpResponseInfo response;
        TestCompletionCallback request_callback;
        rv = handshake->SendRequest(headers, &response,
                                    request_callback.callback());
        EXPECT_THAT(rv, IsOk());

        TestCompletionCallback response_callback;
        rv = handshake->ReadResponseHeaders(response_callback.callback());
        EXPECT_THAT(rv, IsOk());
        EXPECT_EQ(101, response.headers->response_code());
        EXPECT_TRUE(response.headers->HasHeaderValue("Connection", "Upgrade"));
        EXPECT_TRUE(response.headers->HasHeaderValue("Upgrade", "websocket"));
        return handshake->Upgrade();
      }
      case HTTP2_HANDSHAKE_STREAM: {
        SpdyTestUtil spdy_util;
        spdy::SpdyHeaderBlock request_header_block = WebSocketHttp2Request(
            kPath, "www.example.org", kOrigin, extra_request_headers);
        spdy::SpdySerializedFrame request_headers(
            spdy_util.ConstructSpdyHeaders(1, std::move(request_header_block),
                                           DEFAULT_PRIORITY, false));
        MockWrite writes[] = {CreateMockWrite(request_headers, 0)};

        spdy::SpdyHeaderBlock response_header_block =
            WebSocketHttp2Response(extra_response_headers);
        spdy::SpdySerializedFrame response_headers(
            spdy_util.ConstructSpdyResponseHeaders(
                1, std::move(response_header_block), false));
        MockRead reads[] = {CreateMockRead(response_headers, 1),
                            MockRead(ASYNC, 0, 2)};

        SequencedSocketData data(reads, writes);

        SSLSocketDataProvider ssl(ASYNC, OK);
        ssl.ssl_info.cert =
            ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem");

        SpdySessionDependencies session_deps;
        session_deps.socket_factory->AddSocketDataProvider(&data);
        session_deps.socket_factory->AddSSLSocketDataProvider(&ssl);

        std::unique_ptr<HttpNetworkSession> http_network_session =
            SpdySessionDependencies::SpdyCreateSession(&session_deps);
        const SpdySessionKey key(HostPortPair::FromURL(url),
                                 ProxyServer::Direct(), PRIVACY_MODE_DISABLED,
                                 SocketTag());
        base::WeakPtr<SpdySession> spdy_session =
            CreateSpdySession(http_network_session.get(), key, net_log);
        std::unique_ptr<WebSocketHandshakeStreamBase> handshake =
            create_helper.CreateHttp2Stream(spdy_session);

        int rv = handshake->InitializeStream(
            &request_info, true, DEFAULT_PRIORITY, NetLogWithSource(),
            CompletionOnceCallback());
        EXPECT_THAT(rv, IsOk());

        HttpResponseInfo response;
        TestCompletionCallback request_callback;
        rv = handshake->SendRequest(headers, &response,
                                    request_callback.callback());
        EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
        rv = request_callback.WaitForResult();
        EXPECT_THAT(rv, IsOk());

        TestCompletionCallback response_callback;
        rv = handshake->ReadResponseHeaders(response_callback.callback());
        EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
        rv = response_callback.WaitForResult();
        EXPECT_THAT(rv, IsOk());

        EXPECT_EQ(200, response.headers->response_code());
        return handshake->Upgrade();
      }
      default:
        NOTREACHED();
        return nullptr;
    }
  }

 private:
  MockClientSocketHandleFactory socket_handle_factory_;
  TestConnectDelegate connect_delegate_;
  StrictMock<MockWebSocketStreamRequestAPI> stream_request_;
  WebSocketEndpointLockManager websocket_endpoint_lock_manager_;
};

INSTANTIATE_TEST_CASE_P(,
                        WebSocketHandshakeStreamCreateHelperTest,
                        Values(BASIC_HANDSHAKE_STREAM, HTTP2_HANDSHAKE_STREAM));

// Confirm that the basic case works as expected.
TEST_P(WebSocketHandshakeStreamCreateHelperTest, BasicStream) {
  std::unique_ptr<WebSocketStream> stream =
      CreateAndInitializeStream({}, {}, {});
  EXPECT_EQ("", stream->GetExtensions());
  EXPECT_EQ("", stream->GetSubProtocol());
}

// Verify that the sub-protocols are passed through.
TEST_P(WebSocketHandshakeStreamCreateHelperTest, SubProtocols) {
  std::vector<std::string> sub_protocols;
  sub_protocols.push_back("chat");
  sub_protocols.push_back("superchat");
  std::unique_ptr<WebSocketStream> stream = CreateAndInitializeStream(
      sub_protocols, {{"Sec-WebSocket-Protocol", "chat, superchat"}},
      {{"Sec-WebSocket-Protocol", "superchat"}});
  EXPECT_EQ("superchat", stream->GetSubProtocol());
}

// Verify that extension name is available. Bad extension names are tested in
// websocket_stream_test.cc.
TEST_P(WebSocketHandshakeStreamCreateHelperTest, Extensions) {
  std::unique_ptr<WebSocketStream> stream = CreateAndInitializeStream(
      {}, {}, {{"Sec-WebSocket-Extensions", "permessage-deflate"}});
  EXPECT_EQ("permessage-deflate", stream->GetExtensions());
}

// Verify that extension parameters are available. Bad parameters are tested in
// websocket_stream_test.cc.
TEST_P(WebSocketHandshakeStreamCreateHelperTest, ExtensionParameters) {
  std::unique_ptr<WebSocketStream> stream = CreateAndInitializeStream(
      {}, {},
      {{"Sec-WebSocket-Extensions",
        "permessage-deflate;"
        " client_max_window_bits=14; server_max_window_bits=14;"
        " server_no_context_takeover; client_no_context_takeover"}});

  EXPECT_EQ(
      "permessage-deflate;"
      " client_max_window_bits=14; server_max_window_bits=14;"
      " server_no_context_takeover; client_no_context_takeover",
      stream->GetExtensions());
}

}  // namespace
}  // namespace net


text:
@interface NSArray (JSONString)

- (NSString*)JSONString;

@end


text:
package junit.org.rapidpm.reflections;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.rapidpm.ddi.reflections.ReflectionUtils;

public class ReflectionUtils001Test {

  @Test
  public void test001() {

    ReflectionUtils utils = new ReflectionUtils();

    Assertions.assertTrue(Service.class.isInterface());
    Assertions.assertTrue(ServiceA.class.isInterface());

    Assertions.assertNull(ServiceA.class.getSuperclass());

    Assertions.assertTrue(utils.checkInterface(Service.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(ServiceA.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(ServiceB.class, Service.class));
//
    Assertions.assertTrue(utils.checkInterface(ServiceImplA.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(ServiceImplB.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(ServiceImplAB.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(ServiceImplBB.class, Service.class));

    Assertions.assertFalse(utils.checkInterface(A.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(B.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(C.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(D.class, Service.class));
    Assertions.assertTrue(utils.checkInterface(E.class, Service.class));

    Assertions.assertTrue(utils.checkInterface(F.class, Service.class));
  }

  public interface Service {
  }

  public interface ServiceA extends Service {
  }

  public interface ServiceB extends ServiceA {
  }

  public static class ServiceImplA implements Service {
  }

  public static class ServiceImplB implements ServiceA {
  }

  public static class ServiceImplAB extends ServiceImplA {
  }

  public static class ServiceImplBB extends ServiceImplB {
  }

  public static class A {
  }

  public static class B extends A implements Service {
  }

  public static class C extends B {
  }

  public static class D extends A implements ServiceA {
  }

  public static class E extends A implements ServiceB {
  }

  public static class F extends ServiceImplAB {
  }

}


text:
using System;
using System.Collections.Generic;
using Marten.Internal.Sessions;
using Marten.Internal.Storage;
using Marten.Linq.Filters;
using Marten.Patching;
using Marten.Schema;
using Marten.Services;
using Marten.Services.Json;
using Marten.Storage;
using Marten.Testing.Documents;
using Marten.Testing.Harness;
using NSubstitute;
using Shouldly;
using Xunit;

namespace Marten.Testing.Patching
{
    public class PatchExpressionTests : IntegrationContext
    {
        private readonly PatchExpression<Target> _expression;
        private readonly ITenant _schema = Substitute.For<ITenant>();

        public PatchExpressionTests(DefaultStoreFixture fixture) : base(fixture)
        {
            var storage = Substitute.For<IDocumentStorage>();
            storage.DocumentType.Returns(typeof(Target));

            var session = theStore.LightweightSession();

            Disposables.Add(session);

            _expression = new PatchExpression<Target>(new ByGuidFilter(Guid.NewGuid()), (DocumentSessionBase)session);
        }

        [Fact]
        public void builds_patch_for_set_name()
        {
            _expression.Set("Float", 7.7f);

            _expression.Patch["path"].ShouldBe("Float");
            _expression.Patch["type"].ShouldBe("set");
            _expression.Patch["value"].ShouldBe(7.7f);
        }

        [Fact]
        public void builds_patch_for_set_name_deep()
        {
            _expression.Set("Double", x => x.Inner, 99.9d);

            _expression.Patch["path"].ShouldBe("Inner.Double");
            _expression.Patch["type"].ShouldBe("set");
            _expression.Patch["value"].ShouldBe(99.9d);
        }

        [Fact]
        public void builds_patch_for_set_shallow()
        {
            _expression.Set(x => x.Number, 5);

            _expression.Patch["path"].ShouldBe("Number");
            _expression.Patch["type"].ShouldBe("set");
            _expression.Patch["value"].ShouldBe(5);
        }

        [Fact]
        public void builds_patch_for_set_2_deep()
        {
            _expression.Set(x => x.Inner.Number, 5);

            _expression.Patch["path"].ShouldBe("Inner.Number");
            _expression.Patch["type"].ShouldBe("set");
            _expression.Patch["value"].ShouldBe(5);
        }

        [Fact]
        public void builds_patch_for_set_3_deep()
        {
            _expression.Set(x => x.Inner.Inner.Number, 5);

            _expression.Patch["path"].ShouldBe("Inner.Inner.Number");
            _expression.Patch["type"].ShouldBe("set");
            _expression.Patch["value"].ShouldBe(5);
        }

        [Fact]
        public void increment_int_with_default()
        {
            _expression.Increment(x => x.Number);

            _expression.Patch["path"].ShouldBe("Number");
            _expression.Patch["type"].ShouldBe("increment");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_int_with_default_deep()
        {
            _expression.Increment(x => x.Inner.Inner.Number);

            _expression.Patch["path"].ShouldBe("Inner.Inner.Number");
            _expression.Patch["type"].ShouldBe("increment");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_int_with_explicit_interval()
        {
            _expression.Increment(x => x.Number, 5);

            _expression.Patch["path"].ShouldBe("Number");
            _expression.Patch["type"].ShouldBe("increment");
            _expression.Patch["increment"].ShouldBe(5);
        }

        [Fact]
        public void increment_long_with_default()
        {
            _expression.Increment(x => x.Long);

            _expression.Patch["path"].ShouldBe("Long");
            _expression.Patch["type"].ShouldBe("increment");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_long_with_default_deep()
        {
            _expression.Increment(x => x.Inner.Inner.Long);

            _expression.Patch["path"].ShouldBe("Inner.Inner.Long");
            _expression.Patch["type"].ShouldBe("increment");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_long_with_explicit_interval()
        {
            _expression.Increment(x => x.Long, 5);

            _expression.Patch["path"].ShouldBe("Long");
            _expression.Patch["type"].ShouldBe("increment");
            _expression.Patch["increment"].ShouldBe(5);
        }

        [Fact]
        public void increment_double_with_default()
        {
            _expression.Increment(x => x.Double);

            _expression.Patch["path"].ShouldBe("Double");
            _expression.Patch["type"].ShouldBe("increment_float");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_double_with_default_deep()
        {
            _expression.Increment(x => x.Inner.Inner.Double);

            _expression.Patch["path"].ShouldBe("Inner.Inner.Double");
            _expression.Patch["type"].ShouldBe("increment_float");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_double_with_explicit_interval()
        {
            _expression.Increment(x => x.Double, 5);

            _expression.Patch["path"].ShouldBe("Double");
            _expression.Patch["type"].ShouldBe("increment_float");
            _expression.Patch["increment"].ShouldBe(5);
        }

        [Fact]
        public void increment_float_with_default()
        {
            _expression.Increment(x => x.Float);

            _expression.Patch["path"].ShouldBe("Float");
            _expression.Patch["type"].ShouldBe("increment_float");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_float_with_default_deep()
        {
            _expression.Increment(x => x.Inner.Inner.Float);

            _expression.Patch["path"].ShouldBe("Inner.Inner.Float");
            _expression.Patch["type"].ShouldBe("increment_float");
            _expression.Patch["increment"].ShouldBe(1);
        }

        [Fact]
        public void increment_float_with_explicit_interval()
        {
            _expression.Increment(x => x.Float, 5);

            _expression.Patch["path"].ShouldBe("Float");
            _expression.Patch["type"].ShouldBe("increment_float");
            _expression.Patch["increment"].ShouldBe(5);
        }

        [Fact]
        public void append_shallow()
        {
            _expression.Append(x => x.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("NumberArray");
            _expression.Patch["type"].ShouldBe("append");
            _expression.Patch["value"].ShouldBe(5);
        }

        [Fact]
        public void append_if_not_exists_shallow()
        {
            _expression.AppendIfNotExists(x => x.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("NumberArray");
            _expression.Patch["type"].ShouldBe("append_if_not_exists");
            _expression.Patch["value"].ShouldBe(5);
        }

        [Fact]
        public void append_deep()
        {
            _expression.Append(x => x.Inner.Inner.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("Inner.Inner.NumberArray");
            _expression.Patch["type"].ShouldBe("append");
            _expression.Patch["value"].ShouldBe(5);
        }

        [Fact]
        public void append_if_not_exists_deep()
        {
            _expression.AppendIfNotExists(x => x.Inner.Inner.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("Inner.Inner.NumberArray");
            _expression.Patch["type"].ShouldBe("append_if_not_exists");
            _expression.Patch["value"].ShouldBe(5);
        }

        [Fact]
        public void insert_shallow()
        {
            _expression.Insert(x => x.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("NumberArray");
            _expression.Patch["type"].ShouldBe("insert");
            _expression.Patch["value"].ShouldBe(5);
            _expression.Patch["index"].ShouldBe(0);
        }

        [Fact]
        public void insert_if_not_exists_shallow()
        {
            _expression.InsertIfNotExists(x => x.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("NumberArray");
            _expression.Patch["type"].ShouldBe("insert_if_not_exists");
            _expression.Patch["value"].ShouldBe(5);
            _expression.Patch["index"].ShouldBe(0);
        }

        [Fact]
        public void insert_deep()
        {
            _expression.Insert(x => x.Inner.Inner.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("Inner.Inner.NumberArray");
            _expression.Patch["type"].ShouldBe("insert");
            _expression.Patch["value"].ShouldBe(5);
            _expression.Patch["index"].ShouldBe(0);
        }

        [Fact]
        public void insert_if_not_exists_deep()
        {
            _expression.InsertIfNotExists(x => x.Inner.Inner.NumberArray, 5);

            _expression.Patch["path"].ShouldBe("Inner.Inner.NumberArray");
            _expression.Patch["type"].ShouldBe("insert_if_not_exists");
            _expression.Patch["value"].ShouldBe(5);
            _expression.Patch["index"].ShouldBe(0);
        }

        [Fact]
        public void insert_at_a_nonzero_index()
        {
            _expression.Insert(x => x.NumberArray, 5, 2);

            _expression.Patch["path"].ShouldBe("NumberArray");
            _expression.Patch["type"].ShouldBe("insert");
            _expression.Patch["value"].ShouldBe(5);
            _expression.Patch["index"].ShouldBe(2);
        }

        [Fact]
        public void rename_shallow()
        {
            _expression.Rename("Old", x => x.Double);

            _expression.Patch["type"].ShouldBe("rename");
            _expression.Patch["to"].ShouldBe("Double");
            _expression.Patch["path"].ShouldBe("Old");
        }

        [Fact]
        public void rename_2_deep()
        {
            _expression.Rename("Old", x => x.Inner.Double);

            _expression.Patch["type"].ShouldBe("rename");
            _expression.Patch["to"].ShouldBe("Double");
            _expression.Patch["path"].ShouldBe("Inner.Old");
        }

        [Fact]
        public void rename_3_deep()
        {
            _expression.Rename("Old", x => x.Inner.Inner.Double);

            _expression.Patch["type"].ShouldBe("rename");
            _expression.Patch["to"].ShouldBe("Double");
            _expression.Patch["path"].ShouldBe("Inner.Inner.Old");
        }

        [Fact]
        public void remove_first()
        {
            _expression.Remove(x => x.NumberArray, 5);

            _expression.Patch["type"].ShouldBe("remove");
            _expression.Patch["value"].ShouldBe(5);
            _expression.Patch["path"].ShouldBe("NumberArray");
            _expression.Patch["action"].ShouldBe((int)RemoveAction.RemoveFirst);
        }

        [Fact]
        public void remove_all()
        {
            _expression.Remove(x => x.NumberArray, 5, RemoveAction.RemoveAll);

            _expression.Patch["type"].ShouldBe("remove");
            _expression.Patch["value"].ShouldBe(5);
            _expression.Patch["path"].ShouldBe("NumberArray");
            _expression.Patch["action"].ShouldBe((int) RemoveAction.RemoveAll);
        }

        [Fact]
        public void delete_name()
        {
            _expression.Delete("Foo");

            _expression.Patch["type"].ShouldBe("delete");
            _expression.Patch["path"].ShouldBe("Foo");
        }

        [Fact]
        public void delete_nested_name()
        {
            _expression.Delete("Foo", x => x.Inner.Inner);

            _expression.Patch["type"].ShouldBe("delete");
            _expression.Patch["path"].ShouldBe("Inner.Inner.Foo");
        }

        [Fact]
        public void delete_nested_property()
        {
            _expression.Delete(x => x.NumberArray);

            _expression.Patch["type"].ShouldBe("delete");
            _expression.Patch["path"].ShouldBe("NumberArray");
        }

        [Fact]
        public void duplicate_property()
        {
            _expression.Duplicate(x => x.String, x => x.AnotherString);

            _expression.Patch["type"].ShouldBe("duplicate");
            _expression.Patch["path"].ShouldBe("String");
            ((string[]) _expression.Patch["targets"]).ShouldHaveTheSameElementsAs("AnotherString");
        }

        [Fact]
        public void duplicate_property_to_multiple_targets()
        {
            _expression.Duplicate(x => x.String, x => x.AnotherString, x => x.Inner.String, x => x.Inner.AnotherString);

            _expression.Patch["type"].ShouldBe("duplicate");
            _expression.Patch["path"].ShouldBe("String");
            ((string[])_expression.Patch["targets"]).ShouldHaveTheSameElementsAs("AnotherString", "Inner.String", "Inner.AnotherString");
        }

        [Fact]
        public void duplicate_property_no_target()
        {
            SpecificationExtensions.ShouldContain(Assert.Throws<ArgumentException>(() => _expression.Duplicate(x => x.String))
                    .Message, "At least one destination must be given");
        }

        [Fact]
        public void check_camel_case_serialized_property()
        {
            StoreOptions(_ =>
            {
                _.UseDefaultSerialization(casing: Casing.CamelCase);
            });

            using var session = theStore.LightweightSession();

            var expressionWithSimpleProperty = new PatchExpression<Target>(new ByGuidFilter(Guid.NewGuid()), (DocumentSessionBase) session);
            expressionWithSimpleProperty.Set(x => x.Color, Colors.Blue);
            expressionWithSimpleProperty.Patch["path"].ShouldBe("color");

            var expressionWithNestedProperty = new PatchExpression<Target>(new ByGuidFilter(Guid.NewGuid()), (DocumentSessionBase) session);
            expressionWithNestedProperty.Delete(x => x.Inner.AnotherString);
            expressionWithNestedProperty.Patch["path"].ShouldBe("inner.anotherString");
        }

        public class Item
        {
            public string Name { get; set; }
        }

        public class ColoredItem: Item
        {
            public string Color { get; set; }
        }

        public class NumberedItem: Item
        {
            public int Number { get; set; }
        }

        public class ItemGroup
        {
            public Guid Id { get; set; }
            public List<Item> Items { get; set; } = new List<Item>();
        }

        [SerializerTypeTargetedFact(RunFor = SerializerType.Newtonsoft)]
        public void can_append_with_sub_types_in_collection()
        {
            var group = new ItemGroup();
            theSession.Store(group);
            theSession.SaveChanges();

            using (var session = theStore.LightweightSession())
            {
                session.Patch<ItemGroup>(group.Id).Append(x => x.Items, new Item{Name = "One"});
                session.Patch<ItemGroup>(group.Id).Append(x => x.Items, new ColoredItem{Name = "Two", Color = "Blue"});
                session.Patch<ItemGroup>(group.Id).Append(x => x.Items, new NumberedItem(){Name = "Three", Number = 3});
                session.SaveChanges();
            }

            using (var query = theStore.QuerySession())
            {
                var group2 = query.Load<ItemGroup>(group.Id);

                group2.Items.Count.ShouldBe(3);
                group2.Items[0].ShouldBeOfType<Item>();
                group2.Items[1].ShouldBeOfType<ColoredItem>();
                group2.Items[2].ShouldBeOfType<NumberedItem>();
            }
        }

        [SerializerTypeTargetedFact(RunFor = SerializerType.Newtonsoft)]
        public void can_append_if_not_exists_with_sub_types_in_collection()
        {
            var group = new ItemGroup();
            theSession.Store(group);
            theSession.SaveChanges();

            using (var session = theStore.LightweightSession())
            {
                session.Patch<ItemGroup>(group.Id).AppendIfNotExists(x => x.Items, new Item{Name = "One"});
                session.Patch<ItemGroup>(group.Id).AppendIfNotExists(x => x.Items, new ColoredItem{Name = "Two", Color = "Blue"});
                session.Patch<ItemGroup>(group.Id).AppendIfNotExists(x => x.Items, new NumberedItem(){Name = "Three", Number = 3});
                session.SaveChanges();
            }

            using (var query = theStore.QuerySession())
            {
                var group2 = query.Load<ItemGroup>(group.Id);

                group2.Items.Count.ShouldBe(3);
                group2.Items[0].ShouldBeOfType<Item>();
                group2.Items[1].ShouldBeOfType<ColoredItem>();
                group2.Items[2].ShouldBeOfType<NumberedItem>();
            }
        }

        [SerializerTypeTargetedFact(RunFor = SerializerType.Newtonsoft)]
        public void can_insert_if_not_exists_with_sub_types_in_collection()
        {
            var group = new ItemGroup
            {
                Items = new List<Item>{new Item{Name = "regular"}}
            };
            theSession.Store(group);
            theSession.SaveChanges();

            using (var session = theStore.LightweightSession())
            {
                session.Patch<ItemGroup>(group.Id).Insert(x => x.Items, new ColoredItem{Name = "Two", Color = "Blue"});
                session.SaveChanges();
            }

            using (var query = theStore.QuerySession())
            {
                var group2 = query.Load<ItemGroup>(group.Id);

                group2.Items.Count.ShouldBe(2);
                group2.Items[0].ShouldBeOfType<ColoredItem>();
            }
        }
    }
}


text:
#ifndef TORRENT_RSS_HPP_INCLUDED
#define TORRENT_RSS_HPP_INCLUDED

#include "libtorrent/torrent_handle.hpp"
#include "libtorrent/add_torrent_params.hpp"

#include <boost/enable_shared_from_this.hpp>
#include <string>

#ifndef TORRENT_NO_DEPRECATE
namespace libtorrent
{
	namespace aux
	{ struct session_impl; }

	// represents one item from an RSS feed. Specifically
	// a feed of torrents.
	//
	struct TORRENT_EXPORT feed_item
	{
		feed_item();
		~feed_item();

		// these are self explanatory and may be empty if the feed does not specify
		// those fields.
		std::string url;
		std::string uuid;
		std::string title;
		std::string description;
		std::string comment;
		std::string category;

		// the total size of the content the torrent refers to, or -1
		// if no size was specified by the feed.
		boost::int64_t size;

		// the handle to the torrent, if the session is already downloading
		// this torrent.
		torrent_handle handle;

		// the info-hash of the torrent, or cleared (i.e. all zeroes) if
		// the feed does not specify the info-hash.
		sha1_hash info_hash;
	};

	// given a feed_item ``f``, add the torrent it refers to to session ``s``.
#ifndef BOOST_NO_EXCEPTIONS
	torrent_handle TORRENT_EXPORT add_feed_item(session& s, feed_item const& fi
		, add_torrent_params const& p);
#endif
	torrent_handle TORRENT_EXPORT add_feed_item(session& s, feed_item const& fi
		, add_torrent_params const& p, error_code& ec);

	// the feed_settings object is all the information
	// and configuration for a specific feed. All of
	// these settings can be changed by the user
	// after adding the feed
	struct TORRENT_EXPORT feed_settings
	{
		feed_settings()
			: auto_download(true)
			, auto_map_handles(true)
			, default_ttl(30)
		{}

   	std::string url;

		// By default ``auto_download`` is true, which means all torrents in
		// the feed will be downloaded. Set this to false in order to manually
		// add torrents to the session. You may react to the rss_alert when
		// a feed has been updated to poll it for the new items in the feed
		// when adding torrents manually. When torrents are added automatically,
		// an add_torrent_alert is posted which includes the torrent handle
		// as well as the error code if it failed to be added. You may also call
		// ``session::get_torrents()`` to get the handles to the new torrents.
		bool auto_download;

		// ``auto_map_handles`` defaults to true and determines whether or
		// not to set the ``handle`` field in the feed_item, returned
		// as the feed status. If auto-download is enabled, this setting
		// is ignored. If auto-download is not set, setting this to false
		// will save one pass through all the feed items trying to find
		// corresponding torrents in the session.
		bool auto_map_handles;

		// The ``default_ttl`` is the default interval for refreshing a feed.
		// This may be overridden by the feed itself (by specifying the ``<ttl>``
		// tag) and defaults to 30 minutes. The field specifies the number of
		// minutes between refreshes.
		int default_ttl;

		// If torrents are added automatically, you may want to set the
		// ``add_args`` to appropriate values for download directory etc.
		// This object is used as a template for adding torrents from feeds,
		// but some torrent specific fields will be overridden by the
		// individual torrent being added. For more information on the
		// add_torrent_params, see async_add_torrent() and add_torrent().
		add_torrent_params add_args;
	};

	// holds information about the status of an RSS feed. Retrieved by
	// calling get_feed_status() on feed_handle.
	struct TORRENT_EXPORT feed_status
	{
		feed_status(): last_update(0), next_update(0)
			, updating(false), ttl(0) {}

		// the URL of the feed.
		std::string url;

		// the name of the feed (as specified by the feed itself). This
		// may be empty if we have not recevied a response from the RSS server yet,
		// or if the feed does not specify a title.
		std::string title;

		// the feed description (as specified by the feed itself).
		// This may be empty if we have not received a response from the RSS server
		// yet, or if the feed does not specify a description.
		std::string description;

		// the posix time of the last successful response from the feed.
		time_t last_update;

		// the number of seconds, from now, when the feed will be
		// updated again.
		int next_update;

		// true if the feed is currently being updated (i.e. waiting for
		// DNS resolution, connecting to the server or waiting for the response to the
		// HTTP request, or receiving the response).
		bool updating;

		// a vector of all items that we have received from the feed. See
		// feed_item for more information.
		std::vector<feed_item> items;

		// set to the appropriate error code if the feed encountered an
		// error. See error_code for more info.
		error_code error;

		// the current refresh time (in minutes). It's either the configured
		// default ttl, or the ttl specified by the feed.
		int ttl;
	};

	struct feed;

	// The ``feed_handle`` refers to a specific RSS feed that is watched by the session.
	struct TORRENT_EXPORT feed_handle
	{
		feed_handle() {}

		// Forces an update/refresh of the feed. Regular updates of the feed is managed
		// by libtorrent, be careful to not call this too frequently since it may
		// overload the RSS server.
		void update_feed();

		// Queries the RSS feed for information, including all the items in the feed.
		// see feed_status.
		feed_status get_feed_status() const;

		// Sets and gets settings for this feed. For more information on the
		// available settings, see add_feed().
		void set_settings(feed_settings const& s);
		feed_settings settings() const;
	private:
		friend struct aux::session_impl;
		friend struct feed;
		feed_handle(boost::weak_ptr<feed> const& p);
		boost::weak_ptr<feed> m_feed_ptr;
	};

	struct feed_state;
	class http_parser;

	boost::shared_ptr<feed> TORRENT_EXPORT new_feed(aux::session_impl& ses, feed_settings const& sett);

	// this is the internal object holding all state about an
	// RSS feed. All user interaction with this object
	// goes through the feed_handle, which makes sure all calls
	// are posted to the network thread
	struct TORRENT_EXTRA_EXPORT feed : boost::enable_shared_from_this<feed>
	{
		friend void parse_feed(feed_state& f, int token, char const* name, char const* val);

		feed(aux::session_impl& ses, feed_settings const& feed);

		void on_feed(error_code const& ec, http_parser const& parser
			, char const* data, int size);

		int update_feed();

		aux::session_impl& session() const { return m_ses; }

		void set_settings(feed_settings const& s);
		void get_settings(feed_settings* s) const;
   	void get_feed_status(feed_status* ret) const;

		int next_update(time_t now) const;

		void load_state(bdecode_node const& rd);
		void save_state(entry& rd) const;

	private:
		friend struct aux::session_impl;

		// explicitly disallow assignment, to silence msvc warning
		feed& operator=(feed const&);

		void add_item(feed_item const& item);

		feed_handle my_handle();

		error_code m_error;
		std::vector<feed_item> m_items;

		// these are all the URLs we've seen in the items list.
		// it's used to avoid adding duplicate entries to the actual
		// item vector
		std::set<std::string> m_urls;

		// these are URLs that have been added to the session
		// once. If we see them again, and they're not in the
		// session, don't add them again, since it means they
		// were removed from the session. It maps URLs to the
		// posix time when they were added. The timestamp is
		// used to prune this list by removing the oldest ones
		// when the size gets too big
		std::map<std::string, time_t> m_added;

		std::string m_title;
		std::string m_description;
		time_t m_last_attempt;
		time_t m_last_update;
		// refresh rate of this feed in minutes
		int m_ttl;
		// the number of update failures in a row
		int m_failures;
		// true while waiting for the server to respond
		bool m_updating;
		feed_settings m_settings;

		aux::session_impl& m_ses;
	};

}
#endif // TORRENT_NO_DEPRECATE

#endif


text:
package com.amazonaws.services.elasticsearch.model;

import com.amazonaws.AmazonServiceException;

/**
 * <p>
 * An error occured because the client wanted to access a not supported
 * operation. Gives http status code of 409.
 * </p>
 */
public class DisabledOperationException extends AmazonServiceException {
    private static final long serialVersionUID = 1L;

    /**
     * Constructs a new DisabledOperationException with the specified error
     * message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public DisabledOperationException(String message) {
        super(message);
    }

}


text:
<!DOCTYPE html>
<meta charset="utf-8">
<title>Cross-document navigations during cross-document traversals</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<!--
  Apparently if a cross-document traversal is in progress, a cross-document
  navigation just gets ignored. (Instead of, as you might expect, a race.)
  This does not match the spec. This test instead asserts browser behavior.
-->

<body>
<script type="module">
import { createIframe, waitForLoad, delay, waitForPotentialNetworkLoads } from "./resources/helpers.mjs";

promise_test(async t => {
  const iframe = await createIframe(t);
  const slowURL = (new URL("resources/slow.py", location.href)).href;

  // Setup
  // Extra delay()s are necessary because if we navigate "inside" the load
  // handler (i.e. in a promise reaction for the load handler) then it will
  // be a replace navigation.
  iframe.contentWindow.location.href = slowURL;
  await waitForLoad(iframe);
  await delay(t, 0);
  iframe.contentWindow.location.href = "/common/blank.html?2";
  await waitForLoad(iframe);
  await delay(t, 0);

  iframe.contentWindow.history.back();

  assert_equals(iframe.contentWindow.location.search, "?2", "must not go back synchronously");

  iframe.contentWindow.location.href = "/common/blank.html?3";
  assert_equals(iframe.contentWindow.location.search, "?2", "must not navigate synchronously");

  // We end up at slow.py and never at /common/blank.html?3
  await waitForLoad(iframe);
  assert_equals(iframe.contentWindow.location.href, slowURL, "first load after the nav");

  await waitForPotentialNetworkLoads(t);
  assert_equals(iframe.contentWindow.location.href, slowURL, "must stay on slow.py");
}, "slow cross-document traversal and then fast cross-document navigation: traversal wins and nav is ignored");

promise_test(async t => {
  const iframe = await createIframe(t);
  const slowURL = (new URL("resources/slow.py", location.href)).href;

  // Setup
  // Extra delay()s are necessary because if we navigate "inside" the load
  // handler (i.e. in a promise reaction for the load handler) then it will
  // be a replace navigation.
  iframe.contentWindow.location.search = "?1";
  await waitForLoad(iframe);
  await delay(t, 0);
  iframe.contentWindow.location.search = "?2";
  await waitForLoad(iframe);
  await delay(t, 0);

  iframe.contentWindow.history.back();

  assert_equals(iframe.contentWindow.location.search, "?2", "must not go back synchronously");

  iframe.contentWindow.location.href = slowURL;
  assert_equals(iframe.contentWindow.location.search, "?2", "must not navigate synchronously");

  // We end up at ?1 and never at slowURL
  await waitForLoad(iframe);
  assert_equals(iframe.contentWindow.location.search, "?1", "first load after the nav");

  // The long timeout is because slow.py would take 2 seconds, if it did load.
  await delay(t, 3000);
  assert_equals(iframe.contentWindow.location.search, "?1", "must stay on ?1");
}, "fast cross-document traversal and then slow cross-document navigation: traversal wins and nav is ignored");
</script>


text: Copyright © 2014 {{ site.author.name }}.


text:
#!/usr/bin/php
<?php

namespace NPP;

require_once(dirname(__FILE__).'/autoload.php');
require_once(dirname(__FILE__).'/include/utils.php');

$app = new \NPP\Application(new \NPP\ArgumentParser($argv));

$applicationName  = $app->getName();
//@todo convert functional calls to application/class calls

if (!configuration_file_exists()) {
  if (configuration_dist_file_exists()) {
    $app->errorMessage("Configuration file does not exist.  Please rename the '$applicationName.json.dist' file.");
  } else {
    $app->errorMessage("Configuration file '$applicationName.json' not found.");
  }
  die(1);
}

$app->argParser()->parse();

$config = new \JsonConfiguration(realpath(dirname(__FILE__))."/".$app->getConfigFilename('json'));
$config->load();
$config->setSetting("year", date('Y'));

//used by LicenseTemplate to get variable values and to format them
$getVariable =
  function($name) use ($config) {
    $ret = $config->getSetting($name);
    if ($name=="email") //wrap email address in "< .. >"
      $ret = "<$ret>";
    return $ret;
  };

if ($app->argParser()->hasOneOfArguments("help","h")) {
  usage(basename(__FILE__,".php"));
  die(0);
}

if ($app->argParser()->getOperandCount() == 0) {
  usage(basename(__FILE__,".php"));
  die(1);
}

$projectName      = trim($app->argParser()->getOperand(0));
$targetBasePath   = realpath(".");
$targetPath       = "$targetBasePath/$projectName";

if (project_exists($projectName)) {
  $app->errorMessage("Invalid project name: project already exists.");
  die(1);
}

if (!valid_project_name($projectName)) {
  $app->errorMessage("Invalid project name.");
  die(1);
}

$pathsArgValue          = $app->argParser()->getArgumentValueIfExists("paths",    "");
$classesArgValue        = $app->argParser()->getArgumentValueIfExists("classes",  "");
$generateReadme         = $app->argParser()->hasOneOfArguments(array("readme",    "R"));
$generateTests          = $app->argParser()->hasOneOfArguments(array("tests",     "T"));
$generatePhpUnitConfig  = $app->argParser()->hasOneOfArguments(array("phpunit",   "U"));
$codeCoverage           = $app->argParser()->hasOneOfArguments(array("coverage",  "C"));
$generateGitIgnore      = $app->argParser()->hasOneOfArguments(array("gitignore", "gi"));
$generateLicense        = $app->argParser()->hasOneOfArguments(array("license",   "L"));
$makeProjectFileExec    = $app->argParser()->hasOneOfArguments(array("exec",      "X"));
$generateWebProject     = $app->argParser()->hasOneOfArguments(array("web",       "W"));

$gitIgnoreData = "";

//generate a .gitignore file using https://www.gitignore.io API if types were passed
//using --gitignore=a,b,c; see https://www.gitignore.io/api/list
if ($generateGitIgnore) {
  //by default, have git ignore the php error log
  $gitIgnoreData .= "### php error log ###\n".ini_get('error_log')."\n\n";

  $gitIgnoreIoAPI = new \NPP\Http\GitIgnoreAPI(new \NPP\Http\HttpClient());
  $gitIgnoreItems = $app->argParser()->getArgumentValueIfExists("gitignore", "");
  if (!$gitIgnoreItems || $gitIgnoreItems == "")
    $gitIgnoreItems = $app->argParser()->getArgumentValueIfExists("gi", "");

  if ($gitIgnoreItems != "" && $gitIgnoreItems !== false) {
    $gitIgnoreIoAPI->addItemsStr($gitIgnoreItems);
    $gitIgnoreIoAPI->getHttpClient()->init(10, $config->getSetting("user-agent"));
    $gitIgnoreIoAPI->getHttpClient()->setGzipEncoding(true);
    $gitIgnoreData .= $gitIgnoreIoAPI->getGitIgnore();
  }
}

$licenseName = $app->argParser()->getArgumentValueIfExists("license", false);
if (!$licenseName)
  $licenseName = $app->argParser()->getArgumentValueIfExists("L", false);

if ($app->argParser()->hasOneOfArguments(array("license","L"))) {
  $lt = \NPP\LicenseTemplate::create(realpath(dirname(__FILE__))."/data/licenses/$licenseName.xml");
  $lt->processNoticeVariables($getVariable);
  $lt->processLicenseVariables($getVariable);
  //wrap notice in a multi-line comment
  $lt->notice = "/**\n".str_replace("\n", "\n * ", " * ".trim($lt->notice))."\n*/\n";
} else {
  $lt = \NPP\LicenseTemplate::create(false); //creates an empty LicenseTemplate object
}
$licenseData = trim($lt->license);

$phpUnitCodeCoverage    = ($generatePhpUnitConfig && $codeCoverage ? 1 : 0);

if ($generatePhpUnitConfig) //phpUnitConfig flag implies --tests
  $generateTests = true;

if ($generateTests)
  $pathsArgValue .= ",".$config->getSetting("tests-path");

$paths    = explode(',', $config->getSetting("default-paths").",$pathsArgValue");  //paths to create other than classes,include
$classes  = explode(',', $classesArgValue); //classes to generate, comma-seperated

if ($generateWebProject) {
  $webPaths = $config->getSetting("default-paths-web");
  $webPathParts = explode(',', $webPaths);
  foreach($webPathParts as $wpp)
    if (trim($wpp)!='')
      $paths[] = trim($wpp);
}

$project = new \NPP\PHPProject($projectName, $targetBasePath);
$project->setPaths($paths);       //paths to create
$project->setClasses($classes);   //classnames to generate

$files = array(
  new \NPP\File("autoload.php", ".",     \NPP\CodeGeneration\PHPAutoloadCodeGenerator::generate($project)),
  new \NPP\File("$projectName.php",".",  \NPP\CodeGeneration\PHPProjectCodeGenerator::generate($project, array('exec'=>$makeProjectFileExec))),
  ($generateReadme        ? new \NPP\File("README.md",".", \NPP\CodeGeneration\ReadmeMarkdownCodeGenerator::generate($project)) : false),
  ($generatePhpUnitConfig ? new \NPP\File("phpunit.xml",".", \NPP\CodeGeneration\PHPUnitConfigurationCodeGenerator::generate($project, array('coverage'=>$phpUnitCodeCoverage))) : false),
  ($generateGitIgnore     ? new \NPP\File(".gitignore", ".", $gitIgnoreData) : false),
  ($generateLicense       ? new \NPP\File("LICENSE", ".",    $licenseData) : false),
  ($generateWebProject    ? new \NPP\File("index.php", ".",  "<?php\n\n") : false),
);

//default files to generate for a web project
if ($generateWebProject) {
  $defaultWebFiles = explode(',', $config->getSetting('default-files-web'));
  foreach($defaultWebFiles as $dwf)
    $files[] = new \NPP\File($dwf, ".",  "");
}

$project->setFiles($files);       //files to create
$project->addClassFiles($generateTests); //generate new class filenames and add them to files
$project->createProject();        //generate the new project

if ($makeProjectFileExec)
  chmod($project->getProjectFilename(), 0755); //make project file executable


text:
<?php
namespace AppBundle\Factory;

use League\FactoryMuffin\Faker\Facade as Faker;
use AppBundle\Entity\Group;

$fm->define(Group::class)->setDefinitions([
    ]
);


text:
package test.net.ssehub.easy.reasoning.sseReasoner.qm;

import test.net.ssehub.easy.reasoning.sseReasoner.TestDescriptor;

/**
 * Hardware constraint: flow error from the presentation test.
 * typeCheck(PriorityPipCfg::PriorityPip_FamilyElement2, PriorityPipCfg::PriorityPip_FamilyElement2.output)
 *
 * @author Sizonenko
 * @author El-Sharkawy
 */
public class QMPipelinesTest1 extends test.net.ssehub.easy.reasoning.core.qm.QMPipelinesTest1 {

    /**
     * Creates a specific test instance.
     */
    public QMPipelinesTest1() {
        super(TestDescriptor.INSTANCE);
    }

}


text:
// This is a generated file. Not intended for manual editing.
package ws.epigraph.url.parser.psi.impl;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static ws.epigraph.url.lexer.UrlElementTypes.*;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import ws.epigraph.url.parser.psi.*;

public class UrlUrlImpl extends ASTWrapperPsiElement implements UrlUrl {

  public UrlUrlImpl(ASTNode node) {
    super(node);
  }

  public void accept(@NotNull UrlVisitor visitor) {
    visitor.visitUrl(this);
  }

  public void accept(@NotNull PsiElementVisitor visitor) {
    if (visitor instanceof UrlVisitor) accept((UrlVisitor)visitor);
    else super.accept(visitor);
  }

  @Override
  @Nullable
  public UrlOutputProjection getOutputProjection() {
    return findChildByClass(UrlOutputProjection.class);
  }

  @Override
  @NotNull
  public UrlQid getQid() {
    return findNotNullChildByClass(UrlQid.class);
  }

  @Override
  @NotNull
  public UrlReqTrunkFieldProjection getReqTrunkFieldProjection() {
    return findNotNullChildByClass(UrlReqTrunkFieldProjection.class);
  }

  @Override
  @NotNull
  public List<UrlRequestParam> getRequestParamList() {
    return PsiTreeUtil.getChildrenOfTypeAsList(this, UrlRequestParam.class);
  }

  @Override
  @Nullable
  public PsiElement getPlus() {
    return findChildByType(U_PLUS);
  }

  @Override
  @NotNull
  public PsiElement getSlash() {
    return findNotNullChildByType(U_SLASH);
  }

}


text:
<title>Moxie Options - Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Submodel-Options.html#Submodel-Options" title="Submodel Options">
<link rel="prev" href="MN10300-Options.html#MN10300-Options" title="MN10300 Options">
<link rel="next" href="MSP430-Options.html#MSP430-Options" title="MSP430 Options">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: MSP430 Options,
Previous: MN10300 Options,
Up: Submodel Options

3.17.30 Moxie Options

-meb
Generate big-endian code.  This is the default for ‘<samp>moxie-*-*</samp>’
configurations.

-mel
Generate little-endian code.

-mno-crt0
Do not link in the C run-time initialization object file.


text:
const path = require(`path`)
const { createFilePath } = require(`gatsby-source-filesystem`)
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')

exports.onCreateWebpackConfig = ({ actions }) => {
    actions.setWebpackConfig({
        resolve: {
            plugins: [new TsconfigPathsPlugin()],
        },
    })
}

exports.onCreateNode = ({ node, getNode, actions }) => {
    const { createNodeField } = actions
    if (node.internal.type === `MarkdownRemark`) {
        const slug = `/p${createFilePath({ node, getNode, basePath: `posts` })}`
        console.log('slug:', slug)
        createNodeField({
            node,
            name: `slug`,
            value: slug,
        })
    }
}

exports.createPages = async ({ graphql, actions }) => {
    const { createPage } = actions

    const result = await graphql(`
        {
            allMarkdownRemark {
                edges {
                    node {
                        fields {
                            slug
                        }
                    }
                }
            }
        }
    `)

    const posts = result.data.allMarkdownRemark.edges
    const pageSize = 9
    const numPages = Math.ceil(posts.length / pageSize)
    Array.from({ length: numPages }).forEach((_, pageIndex) => {
        // skip first page, since we have index page
        if (pageIndex > 0) {
            createPage({
                path: `/page/${pageIndex + 1}`,
                component: path.resolve('./src/templates/postList.tsx'),
                context: {
                    limit: pageSize,
                    skip: pageIndex * pageSize,
                    numPages,
                    currentPage: pageIndex + 1,
                },
            })
        }
    })

    // pages for each post
    posts.forEach(({ node }) => {
        const slug = node.fields.slug
        createPage({
            path: slug,
            component: path.resolve(`./src/templates/post.tsx`),
            context: {
                // Data passed to context is available
                // in page queries as GraphQL variables.
                slug: slug,
            },
        })
    })
}


text:
<?php
namespace learn\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use common\models\LoginForm;
use yii\filters\VerbFilter;

/**
 * Site controller
 */
class SiteController extends Controller
{
    public function actionIndex()
    {
        return $this->render('index');
    }

    public function actionAdd(){
        return $this->render('add');
    }

    public function actionLogin()
    {
        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        } else {
            return $this->render('login', [
                'model' => $model,
            ]);
        }
    }

    public function actionLogout()
    {
        Yii::$app->user->logout();

        return $this->goHome();
    }
}