text:
import React from "react";

import MenuSearch from "./MenuSearch";
import ResultSearch from "./ResultSearch"

export default class Informations extends React.Component {

	render() {
		return (

					<MenuSearch />
					<ResultSearch />

);
	}
}


text:
//
//  CruiserWebViewController.h
//  CruiserWebViewController
//  https://github.com/dzenbot/CruiserWebViewController
//
//  Created by Ignacio Romero Zurbuchen on 10/25/13.
//  Improved by Yuriy Pitomets on 23/01/2015
//  Copyright (c) 2014 DZN Labs. All rights reserved.
//  Copyright (c) 2015 Yuriy Pitomets. No rights reserved.
//  Licence: MIT-Licence
//

#import "CruiserWebView.h"
#import "IPNavBarSqueezableViewController.h"
#import <UIKit/UIKit.h>

/**
 Types of supported search services.
 */
typedef NS_ENUM(NSUInteger, CruiserSearchService) {
    CruiserSearchServicePrimary,    // Google.com by default
    CruiserSearchServiceAlternative // DuckDuckGo.com by default
};

/**
 Types of supported navigation tools.
 */
typedef NS_OPTIONS(NSUInteger, CruiserWebNavigationTools) {
    CruiserWebNavigationToolAll      = -1,
    CruiserWebNavigationToolNone     = 0,
    CruiserWebNavigationToolBackward = 1 << 0,
    CruiserWebNavigationToolForward  = 1 << 1,
    CruiserWebNavigationToolPin      = 1 << 2,
    CruiserWebNavigationToolDown     = 1 << 3,
    CruiserWebNavigationToolUp       = 1 << 4
};

/**
 Types of supported actions (i.e. Share & Copy link, Add to Reading List, Open in Safari/Chrome/Opera/Dolphin).
 */
typedef NS_OPTIONS(NSUInteger, CruiserSupportedWebActions) {
    CruiserWebActionAll                = -1,
    CruiserWebActionNone               = 0,
    CruiserSupportedWebActionshareLink = 1 << 0,
    CruiserWebActionCopyLink           = 1 << 1,
    CruiserWebActionReadLater          = 1 << 2,
    CruiserWebActionOpenSafari         = 1 << 3,
    CruiserWebActionOpenChrome         = 1 << 4,
    CruiserWebActionOpenOperaMini      = 1 << 5,
    CruiserWebActionOpenDolphin        = 1 << 6
};

/**
 A very simple web browser with useful navigation and tooling features.
 */
@interface CruiserWebViewController : IPNavBarSqueezableViewController <CruiserNavigationDelegate,
                                                                        WKUIDelegate,
                                                                        UITableViewDataSource,
                                                                        UITableViewDelegate,
                                                                        UITextFieldDelegate>

/** The web view that the controller manages. */
@property (nonatomic, strong) CruiserWebView *webView;
/** The URL identifying the location of the content to load. */
@property (nonatomic, readwrite) NSURL *URL;
/** The supported navigation tool bar items. Default is All. */
@property (nonatomic, readwrite) CruiserWebNavigationTools supportedWebNavigationTools;
/** The supported actions like sharing and copy link, add to reading list, open in Safari, etc. Default is All. */
@property (nonatomic, readwrite) CruiserSupportedWebActions supportedWebActions;
/** Yes if a progress bar indicates the . Default is YES. */
@property (nonatomic) BOOL showLoadingProgress;
/** YES if long pressing the backward and forward buttons the navigation history is displayed. Default is YES. */
@property (nonatomic) BOOL allowHistory;
/** YES if both, the navigation and tool bars should hide when panning vertically. Default is YES. */
@property (nonatomic) BOOL hideBarsWithGestures;

///------------------------------------------------
/// @name Initialization
///------------------------------------------------

/**
 Initializes and returns a newly created webview controller with an initial HTTP URL to be requested as soon as the view appears.

 @param URL The HTTP URL to be requested.
 @returns The initialized webview controller.
 */
- (instancetype)initWithURL:(NSURL *)URL;

/**
 Initializes and returns a newly created webview controller for local HTML navigation.

 @param URL The file URL of the main html.
 @returns The initialized webview controller.
 */
- (instancetype)initWithFileURL:(NSURL *)URL;

/**
 Starts loading a new request. Useful to programatically update the web content.

 @param URL The HTTP or file URL to be requested.
 */
- (void)loadURL:(NSURL *)URL NS_REQUIRES_SUPER;

///------------------------------------------------
/// @name UI outlets
///------------------------------------------------

// The text field for URL or Web search
@property (nonatomic, weak) IBOutlet UITextField *addressField;

///------------------------------------------------
/// @name Appearance customisation
///------------------------------------------------

// The back button displayed on the tool bar (requieres CruiserWebNavigationToolBackward)
@property (nonatomic, strong) UIImage *backwardButtonImage;
// The forward button displayed on the tool bar (requieres CruiserWebNavigationToolForward)
@property (nonatomic, strong) UIImage *forwardButtonImage;
// The pin button displayed on the tool bar (requieres CruiserWebNavigationToolPin)
@property (nonatomic, strong) UIImage *pinButtonImage;
// The down button displayed on the tool bar (requieres CruiserWebNavigationToolDown)
@property (nonatomic, strong) UIImage *downButtonImage;
// The up button displayed on the tool bar (requieres CruiserWebNavigationToolUp)
@property (nonatomic, strong) UIImage *upButtonImage;
// The action button displayed on the navigation bar (requieres at least 1 CruiserSupportedWebActions value)
@property (nonatomic, strong) UIImage *actionButtonImage;

// The stop button displayed in addressField
@property (nonatomic, strong) UIImage *stopButtonImage;
// The reload button displayed in addressField
@property (nonatomic, strong) UIImage *reloadButtonImage;
// The button for first search service displayed in addressField
@property (nonatomic, strong) UIImage *primarySearchButtonImage;
// The button for second search service displayed in addressField
@property (nonatomic, strong) UIImage *alternativeSearchButtonImage;

///------------------------------------------------
/// @name Search services
///------------------------------------------------

// String for request to primary search service
@property (nonatomic, copy) NSString *primarySearchService;
// String for request to alternative search service
@property (nonatomic, copy) NSString *alternativeSearchService;

///------------------------------------------------
/// @name Navigation logic
///------------------------------------------------

// Load saved locations for web pages from user defaults
- (void)loadPins;
// Store all saved locations for web pages to user defaults
- (void)storePins;

///------------------------------------------------
/// @name Delegate Methods Requiring Super
///------------------------------------------------

// CruiserNavigationDelegate
- (void)webView:(CruiserWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER;
- (void)webView:(CruiserWebView *)webView didCommitNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER;
- (void)webView:(CruiserWebView *)webView didUpdateProgress:(CGFloat)progress NS_REQUIRES_SUPER;
- (void)webView:(CruiserWebView *)webView didFinishNavigation:(WKNavigation *)navigation NS_REQUIRES_SUPER;
- (void)webView:(CruiserWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error NS_REQUIRES_SUPER;

// WKUIDelegate
- (CruiserWebView *)webView:(CruiserWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures NS_REQUIRES_SUPER;

// UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView NS_REQUIRES_SUPER;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section NS_REQUIRES_SUPER;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath NS_REQUIRES_SUPER;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath NS_REQUIRES_SUPER;

// UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath NS_REQUIRES_SUPER;

///------------------------------------------------
/// @name Toolbar Navigation Items Actions
///------------------------------------------------

- (void)goBackward:(id)sender;
- (void)goForward:(id)sender;
- (void)pinHere:(id)sender;
- (void)scrollDown:(id)sender;
- (void)scrollUp:(id)sender;
- (void)switchSearchService:(id)sender;

@end

redpajama_set_name: RedPajamaGithub


text:
namespace Microsoft.Azure.Management.Media.Models
{
    using System.Linq;

    /// <summary>
    /// Base class for specifying a clip time. Use sub classes of this class to
    /// specify the time position in the media.
    /// </summary>
    public partial class ClipTime
    {
        /// <summary>
        /// Initializes a new instance of the ClipTime class.
        /// </summary>
        public ClipTime()
        {
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

    }
}


text:
var expect = require('chai').expect;
var definition = require('../src/index');
var Hook = require('lore-utils').Hook;

describe('load', function() {
  var lore = null;
  var defaultConfig = null;
  var hook = null;

  beforeEach(function() {
    hook = new Hook(definition);
    defaultConfig = hook.defaults.dialog;

    lore = {
      dialog: defaultConfig
    };
  });

  it('should have the correct fields', function() {
    hook.load(lore);
    expect(lore.dialog).to.be.an('object');
    expect(lore.dialog.show).to.be.a('function');
  });

});


text:
#region License

#endregion

#region Imports

using System;
using System.Collections;
using System.Data;
using Spring.Data.Common;

#endregion

namespace Spring.Data
{
	/// <summary>
	/// Interface that defines ADO.NET related database operations.
	/// </summary>
	/// <author>Mark Pollack (.NET)</author>
	public interface IAdoOperations : ICommonAdoOperations
	{

        #region General Execute Methods with Callbacks
        /// <summary>
        /// Execute a ADO.NET operation on a command object using a delegate callback.
        /// </summary>
        /// <remarks>This allows for implementing arbitrary data access operations
        /// on a single command within Spring's managed ADO.NET environment.</remarks>
        /// <param name="del">The delegate called with a command object.</param>
        /// <returns>A result object returned by the action or null</returns>
        object Execute(CommandDelegate del);

        /// <summary>
        /// Execute a ADO.NET operation on a command object using an interface based callback.
        /// </summary>
        /// <param name="action">the callback to execute</param>
        /// <returns>object returned from callback</returns>
        object Execute(ICommandCallback action);

        /// <summary>
        /// Executes ADO.NET operations on a command object, created by the provided IDbCommandCreator,
        /// using the interface based callback IDbCommandCallback.
        /// </summary>
        /// <param name="commandCreator">The command creator.</param>
        /// <param name="action">The callback to execute based on IDbCommand</param>
        /// <returns>A result object returned by the action or null</returns>
        object Execute(IDbCommandCreator commandCreator, ICommandCallback action);

        /// <summary>
        /// Execute ADO.NET operations on a IDbDataAdapter object using an interface based callback.
        /// </summary>
        /// <remarks>This allows for implementing abritrary data access operations
        /// on a single DataAdapter within Spring's managed ADO.NET environment.
        /// </remarks>
        /// <param name="dataAdapterCallback">The data adapter callback.</param>
        /// <returns>A result object returned by the callback or null</returns>
	    object Execute(IDataAdapterCallback dataAdapterCallback);

        #endregion

        #region Queries With ResultSetExtractor

	    // Static Queries

        /// <summary>
        /// Execute a query given IDbCommand's type and text, processing a
        /// single result set with an instance of IResultSetExtractor
        /// </summary>
        /// <param name="cmdType">The type of command</param>
        /// <param name="cmdText">The text of the query.</param>
        /// <param name="resultSetExtractor">Object that will extract all rows of a result set</param>
        /// <returns>An arbitrary result object, as returned by the IResultSetExtractor</returns>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryWithResultSetExtractor(CommandType cmdType, string cmdText, IResultSetExtractor resultSetExtractor);

	    // Parameterized Queries

        //only input parameters can be used...

        /// <summary>
        /// Execute a query given IDbCommand's type and text with parameters set
        /// via the command setter, processing a
        /// single result set with an instance of IResultSetExtractor
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="resultSetExtractor">The result set extractor.</param>
        /// <param name="commandSetter">The command setter.</param>
        /// <returns>An arbitrary result object, as returned by the IResultSetExtractor</returns>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryWithResultSetExtractor(CommandType cmdType, string cmdText, IResultSetExtractor resultSetExtractor,
                                           ICommandSetter commandSetter);

        //only input parameters can be used.
        object QueryWithResultSetExtractor(CommandType commandType, string cmdText, IResultSetExtractor resultSetExtractor,
                                           string parameterName, Enum dbType, int size, object parameterValue);

        //iterate over one or more result sets and then assign output parameters.
        object QueryWithResultSetExtractor(CommandType commandType, string cmdText, IResultSetExtractor resultSetExtractor,
                                           IDbParameters parameters);

        #endregion

        #region Queries With ResultSetExtractorDelegate

        // Static Queries

        /// <summary>
        /// Execute a query given static SQL/Stored Procedure name
        /// and process a single result set with an instance of ResultSetExtractorDelegate
        /// </summary>
        /// <param name="cmdType">The type of command.</param>
        /// <param name="cmdText">The command text.</param>
        /// <param name="resultSetExtractorDelegate">Delegate that will extract all rows of a result set</param>
        /// <returns>An arbitrary result object, as returned by the IResultSetExtractor</returns>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryWithResultSetExtractorDelegate(CommandType cmdType, string cmdText, ResultSetExtractorDelegate resultSetExtractorDelegate);

        // Parameterized Queries

        //only input parameters can be used...
        object QueryWithResultSetExtractorDelegate(CommandType commandType, string sql, ResultSetExtractorDelegate resultSetExtractorDelegate,
                                                   ICommandSetter commandSetter);

        //only input parameters can be used.
        object QueryWithResultSetExtractorDelegate(CommandType commandType, string sql, ResultSetExtractorDelegate resultSetExtractorDelegate,
                                                   string parameterName, Enum dbType, int size, object parameterValue);

        //iterate over one or more result sets and then assign output parameters.
        object QueryWithResultSetExtractorDelegate(CommandType commandType, string sql, ResultSetExtractorDelegate resultSetExtractorDelegate,
                                                   IDbParameters parameter);

        #endregion

        #region Queries with RowMapperDelegate

        IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelgate);

        IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelgate, ICommandSetter commandSetter);

        IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelgate,
                                         string parameterName, Enum dbType, int size, object parameterValue);

        IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelgate, IDbParameters parameter);

        #endregion

        #region Queries with RowMapper

        // Static Queries

        /// <summary>
        /// Execute a query given static SQL, mapping each row to a .NET object
        /// iva a RowMapper
        /// </summary>
        /// <param name="cmdType">The type of command</param>
        /// <param name="cmdText">SQL query to execute</param>
        /// <param name="rowMapper">object that will map one object per row</param>
        /// <returns>the result list containing mapped objects</returns>
        IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper);

	    // Parameterized Queries

        //Using IRowMapper to process 1 result set
        IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper, ICommandSetter commandSetter);

        IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper,
                    string name, Enum dbType, int size, object parameterValue);

        IList QueryWithRowMapper(CommandType cmdType, string cmdText, IRowMapper rowMapper, IDbParameters parameter);

        #endregion

        #region Query for Object

        /// <summary>
        /// Execute a query with the specified command text, mapping a single result
        /// row to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapper">object that will map one object per row</param>
        /// <returns>The single mapped object.</returns>
        /// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
        /// If the query does not return exactly one row.
        /// </exception>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
	    object QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper);

        /// <summary>
        /// Execute a query with the specified command text and parameters set via the
        /// command setter, mapping a single result row to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapper">object that will map one object per row</param>
        /// <param name="commandSetter">The command setter.</param>
        /// <returns>The single mapped object.</returns>
        /// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
        /// If the query does not return exactly one row.
        /// </exception>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, ICommandSetter commandSetter);

        /// <summary>
        /// Execute a query with the specified command text and parameters, mapping a single result row
        /// to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapper">object that will map one object per row</param>
        /// <param name="parameters">The parameter collection to use in the query.</param>
        /// <returns>The single mapped object.</returns>
        /// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
        /// If the query does not return exactly one row.
        /// </exception>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper, IDbParameters parameters);

        /// <summary>
        /// Execute a query with the specified command text and parameter, mapping a single result row
        /// to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapper">object that will map one object per row</param>
        /// <param name="parameterName">The name of the parameter to map.</param>
        /// <param name="dbType">One of the database parameter type enumerations.</param>
        /// <param name="size">The length of the parameter. 0 if not applicable to parameter type.</param>
        /// <param name="parameterValue">The parameter value.</param>
        /// <returns>The single mapped object.</returns>
        /// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
        /// If the query does not return exactly one row.
        /// </exception>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryForObject(CommandType cmdType, string cmdText, IRowMapper rowMapper,
                              string parameterName, Enum dbType, int size, object parameterValue);

        #endregion

        #region Query for ObjectDelegate

        /// <summary>
        /// Execute a query with the specified command text, mapping a single result
        /// row to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapperDelgate">delegate that will map one object per row</param>
        /// <returns>The single mapped object.</returns>
        /// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
        /// If the query does not return exactly one row.
        /// </exception>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelgate);

        /// <summary>
        /// Execute a query with the specified command text and parameters set via the
        /// command setter, mapping a single result row to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapperDelegate">delegate that will map one object per row</param>
        /// <param name="commandSetter">The command setter.</param>
        /// <returns>The single mapped object.</returns>
        /// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
        /// If the query does not return exactly one row.
        /// </exception>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, ICommandSetter commandSetter);

        /// <summary>
        /// Execute a query with the specified command text and parameters, mapping a single result row
        /// to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapperDelegate">delegate that will map one object per row</param>
        /// <param name="parameters">The parameter collection to use in the query.</param>
        /// <returns>The single mapped object.</returns>
        /// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
        /// If the query does not return exactly one row.
        /// </exception>
        /// <exception cref="Spring.Dao.DataAccessException">
        /// If there is any problem executing the query.
        /// </exception>
        object QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, IDbParameters parameters);

        /// <summary>
        /// Execute a query with the specified command text and parameter, mapping a single result row
        /// to an object via a RowMapper.
        /// </summary>
        /// <param name="cmdType">The command type.</param>
        /// <param name="cmdText">The command text to execute.</param>
        /// <param name="rowMapperDelegate">delegate that will map one object per row</param>
        /// <param name="parameterName">The name of the parameter to map.</param>
        /// <param name="dbType">One of the database parameter type enumerations.</param>
        /// <param name="size">The length of the parameter. 0 if not applicable to parameter type.</param>
        /// <param name="parameterValue">The parameter value.</param>
        /// <returns></returns>
        object QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate,
                                      string parameterName, Enum dbType, int size, object parameterValue);

        #endregion

        #region Query With CommandCreator

        // Using IResultSetExtractor to process one result set.
        object QueryWithCommandCreator(IDbCommandCreator commandCreator, IResultSetExtractor resultSetExtractor);

	    IList QueryWithCommandCreator(IDbCommandCreator cc, IRowMapper rowMapper);

        // Using IResultSetExtractor to return one result set, multiple output parameters.
        object QueryWithCommandCreator(IDbCommandCreator commandCreator, IResultSetExtractor resultSetExtractor, IDictionary returnedParameters);

        // Using IRowMapper to return one result set, multiple output parameters.
        IList QueryWithCommandCreator(IDbCommandCreator commandCreator, IRowMapper rowMapper, IDictionary returnedParameters);

	    // Multiple return result sets, (A list of lists)
	    // each with either a IRowMapper, IResultSetExtractor, IRowCallback
	    // and multiple output parameters.
	    IDictionary QueryWithCommandCreator(IDbCommandCreator commandCreator, IList resultProcessors);

        #endregion

	    #region DataTable Create operations without parameters

        DataTable DataTableCreate(CommandType commandType, string sql);

        DataTable DataTableCreate(CommandType commandType, string sql,
                                  string tableMappingName);

        DataTable DataTableCreate(CommandType commandType, string sql,
                                  ITableMapping tableMapping);

        DataTable DataTableCreate(CommandType commandType, string sql,
                                  ITableMapping tableMapping,
                                  IDataAdapterSetter setter);

        #endregion

        #region DataTable Create operations with parameters

        DataTable DataTableCreateWithParams(CommandType commandType, string sql,
                                  IDbParameters parameters);

        DataTable DataTableCreateWithParams(CommandType commandType, string sql,
                                  IDbParameters parameters,
                                  string tableMappingName);

        DataTable DataTableCreateWithParams(CommandType commandType, string sql,
                                  IDbParameters parameters,
                                  ITableMapping tableMapping);

        DataTable DataTableCreateWithParams(CommandType commandType, string sql,
                                  IDbParameters parameters,
                                  ITableMapping tableMapping,
                                  IDataAdapterSetter dataAdapterSetter);

        #endregion

        #region DataTable Fill operations without parameters
        /// <summary>
        /// Fill a  <see cref="DataTable"/> based on a select command that requires no parameters.
        /// </summary>
        /// <param name="dataTable">The <see cref="DataTable"/> to populate</param>
        /// <param name="commandType">The type of command</param>
        /// <param name="sql">SQL query to execute</param>
        /// <returns>The number of rows successfully added to or refreshed in the  <see cref="DataTable"/></returns>
	    int DataTableFill(DataTable dataTable, CommandType commandType, string sql);

        int DataTableFill(DataTable dataTable, CommandType commandType, string sql,
                          string tableMappingName);

        int DataTableFill(DataTable dataTable, CommandType commandType, string sql,
                          ITableMapping tableMapping);

        int DataTableFill(DataTable dataTable, CommandType commandType, string sql,
                          ITableMapping tableMapping,
                          IDataAdapterSetter setter);

        #endregion

        #region DataTable Fill operations with parameters

        int DataTableFillWithParams(DataTable dataTable, CommandType commandType, string sql,
                          IDbParameters parameters);

        int DataTableFillWithParams(DataTable dataTable, CommandType commandType, string sql,
                          IDbParameters parameters,
                          string tableName);

        int DataTableFillWithParams(DataTable dataTable, CommandType commandType, string sql,
                          IDbParameters parameters,
                          ITableMapping tableMapping);

        int DataTableFillWithParams(DataTable dataTable, CommandType commandType, string sql,
                          IDbParameters parameters,
                          ITableMapping tableMapping,
                          IDataAdapterSetter dataAdapterSetter);

        #endregion

        #region DataTable Update operations

        int DataTableUpdateWithCommandBuilder(DataTable dataTable,
            CommandType commandType,
            string selectSql,
            IDbParameters parameters,
            string tableName);

        int DataTableUpdateWithCommandBuilder(DataTable dataTable,
            CommandType commandType,
            string selectSql,
            IDbParameters parameters,
            string tableName,
            IDataAdapterSetter dataAdapterSetter);

        int DataTableUpdateWithCommandBuilder(DataTable dataTable,
            CommandType commandType,
            string selectSql,
            IDbParameters parameters,
            ITableMapping tableMapping,
            IDataAdapterSetter dataAdapterSetter);

        int DataTableUpdate(DataTable dataTable,
            string tableName,
            CommandType insertCommandtype, string insertSql, IDbParameters insertParameters,
            CommandType updateCommandtype, string updateSql, IDbParameters updateParameters,
            CommandType deleteCommandtype, string deleteSql, IDbParameters deleteParameters);

        int DataTableUpdate(DataTable dataTable,
            string tableName,
            CommandType insertCommandtype, string insertSql, IDbParameters insertParameters,
            CommandType updateCommandtype, string updateSql, IDbParameters updateParameters,
            CommandType deleteCommandtype, string deleteSql, IDbParameters deleteParameters,
            IDataAdapterSetter dataAdapterSetter);

        int DataTableUpdate(DataTable dataTable,
            ITableMapping tableMapping,
            CommandType insertCommandtype, string insertSql, IDbParameters insertParameters,
            CommandType updateCommandtype, string updateSql, IDbParameters updateParameters,
            CommandType deleteCommandtype, string deleteSql, IDbParameters deleteParameters,
            IDataAdapterSetter dataAdapterSetter);

        #endregion

        #region DataSet Create operations without parameters

	    DataSet DataSetCreate(CommandType commandType, string sql);

        DataSet DataSetCreate(CommandType commandType, string sql,
                              string[] tableNames);

        DataSet DataSetCreate(CommandType commandType, string sql,
                              ITableMappingCollection tableMapping);

        DataSet DataSetCreate(CommandType commandType, string sql,
                              ITableMappingCollection tableMapping,
                              IDataAdapterSetter setter);

        DataSet DataSetCreate(CommandType commandType, string sql,
                              ITableMappingCollection tableMapping,
                              IDataAdapterSetter setter,
                              IDataSetFillLifecycleProcessor fillLifecycleProcessor);
        #endregion

        #region DataSet Create operations with parameters

        DataSet DataSetCreateWithParams(CommandType commandType, string sql,
                              IDbParameters parameters);

        DataSet DataSetCreateWithParams(CommandType commandType, string sql,
                              IDbParameters parameters,
                              string[] tableNames);

        DataSet DataSetCreateWithParams(CommandType commandType, string sql,
                              IDbParameters parameters,
                              ITableMappingCollection tableMapping);

        DataSet DataSetCreateWithParams(CommandType commandType, string sql,
                                IDbParameters parameters,
                                ITableMappingCollection tableMapping,
                                IDataAdapterSetter dataAdapterSetter);

        DataSet DataSetCreateWithParams(CommandType commandType, string sql,
                                IDbParameters parameters,
                                ITableMappingCollection tableMapping,
                                IDataAdapterSetter dataAdapterSetter,
                                IDataSetFillLifecycleProcessor fillLifecycleProcessor);

        #endregion

        #region DataSet Fill operations without parameters

	    /// <summary>
	    /// Fill a  <see cref="DataSet"/> based on a select command that requires no parameters.
	    /// </summary>
	    /// <param name="dataSet">The <see cref="DataSet"/> to populate</param>
	    /// <param name="commandType">The type of command</param>
	    /// <param name="sql">SQL query to execute</param>
	    /// <returns>The number of rows successfully added to or refreshed in the  <see cref="DataSet"/></returns>
	    int DataSetFill(DataSet dataSet, CommandType commandType, string sql);

	    /// <summary>
	    /// Fill a  <see cref="DataSet"/> based on a select command that requires no parameters
	    /// that returns one or more result sets that are added as
	    /// <see cref="DataTable"/>s to the <see cref="DataSet"/>
	    /// </summary>
	    /// <param name="dataSet">The <see cref="DataSet"/> to populate</param>
	    /// <param name="commandType">The type of command</param>
	    /// <param name="sql">SQL query to execute</param>
	    /// <param name="tableNames">The mapping of table names for each <see cref="DataTable"/>
	    /// created</param>
	    /// <returns></returns>
	    int DataSetFill(DataSet dataSet, CommandType commandType, string sql,
	                    string[] tableNames);

        int DataSetFill(DataSet dataSet, CommandType commandType, string sql,
                        ITableMappingCollection tableMapping);

	    int DataSetFill(DataSet dataSet, CommandType commandType, string sql,
	                    ITableMappingCollection tableMapping,
	                    IDataAdapterSetter setter);

        int DataSetFill(DataSet dataSet, CommandType commandType, string sql,
                        ITableMappingCollection tableMapping,
                        IDataAdapterSetter setter,
                        IDataSetFillLifecycleProcessor fillLifecycleProcessor);

        #endregion

	    #region DataSet Fill operations with parameters

	    int DataSetFillWithParameters(DataSet dataSet, CommandType commandType, string sql,
                        IDbParameters parameters);

	    int DataSetFillWithParameters(DataSet dataSet, CommandType commandType, string sql,
	                    IDbParameters parameters,
                        string[] tableNames);

        int DataSetFillWithParameters(DataSet dataSet, CommandType commandType, string sql,
                        IDbParameters parameters,
                        ITableMappingCollection tableMapping);

        int DataSetFillWithParameters(DataSet dataSet, CommandType commandType, string sql,
                        IDbParameters parameters,
                        ITableMappingCollection tableMapping,
                        IDataAdapterSetter dataAdapterSetter);

        int DataSetFillWithParameters(DataSet dataSet, CommandType commandType, string sql,
                        IDbParameters parameters,
                        ITableMappingCollection tableMapping,
                        IDataAdapterSetter dataAdapterSetter,
                        IDataSetFillLifecycleProcessor fillLifecycleProcessor);

        #endregion

        #region DataSet Update operations

        int DataSetUpdateWithCommandBuilder(DataSet dataSet,
            CommandType commandType,
            string selectSql,
            IDbParameters selectParameters,
            string tableName);

        int DataSetUpdateWithCommandBuilder(DataSet dataSet,
            CommandType commandType,
            string selectSql,
            IDbParameters selectParameters,
            string tableName,
            IDataAdapterSetter dataAdapterSetter);

        int DataSetUpdateWithCommandBuilder(DataSet dataSet,
            CommandType commandType,
            string selectSql,
            IDbParameters selectParameters,
            ITableMappingCollection tableMapping,
            IDataAdapterSetter dataAdapterSetter);

	    int DataSetUpdate(DataSet dataSet,
	                      string tableName,
	                      IDbCommand insertCommand,
	                      IDbCommand updateCommand,
	                      IDbCommand deleteCommand);

        int DataSetUpdate(DataSet dataSet,
            string tableName,
            CommandType insertCommandtype, string insertSql, IDbParameters insertParameters,
            CommandType updateCommandtype, string updateSql, IDbParameters updateParameters,
            CommandType deleteCommandtype, string deleteSql, IDbParameters deleteParameters);

        int DataSetUpdate(DataSet dataSet,
                            string tableName,
                            IDbCommand insertCommand,
                            IDbCommand updateCommand,
                            IDbCommand deleteCommand,
                            IDataAdapterSetter dataAdapterSetter);

        int DataSetUpdate(DataSet dataSet,
                          ITableMappingCollection tableMapping,
                          IDbCommand insertCommand,
                          IDbCommand updateCommand,
                          IDbCommand deleteCommand);

	    int DataSetUpdate(DataSet dataSet,
                            ITableMappingCollection tableMapping,
                            IDbCommand insertCommand,
                            IDbCommand updateCommand,
                            IDbCommand deleteCommand,
	                        IDataAdapterSetter dataAdapterSetter);

        #endregion

        #region Parameter Creation Helper Methods

	    IDbParameters CreateDbParameters();

	    /// <summary>
	    /// Note that output parameters are marked input/output after derivation....
	    /// (TODO - double check....)
	    /// </summary>
	    /// <param name="procedureName"></param>
	    /// <returns></returns>
	    IDataParameter[] DeriveParameters(string procedureName);

	    IDataParameter[] DeriveParameters(string procedureName, bool includeReturnParameter);

        #endregion
	}

}


text:
class RemoveRunStatusFromTestRuns < ActiveRecord::Migration
  def up
    remove_column :test_runs, :run_status
  end

  def down
    add_column :test_runs, :run_status, :integer
  end
end


text:
import entity.Libro;
import servicios.LibroMysqlFactory;
import spark.ModelAndView;
import spark.template.freemarker.FreeMarkerEngine;

import java.util.HashMap;
import java.util.Map;

import static spark.Spark.*;

public class Main {

  public static void main(String[] args) {

    //port(Integer.valueOf(System.getenv("PORT")));
    port(8080);
    staticFileLocation("/public");

    get("/hello", (req, res) -> "Hello " +
            "World");

    get("/resultados", (req, res) -> {
      Libro libro =  LibroMysqlFactory.obtener(req.queryParams("codigo"));
      Map<String, Object> attributes = new HashMap<>();
      attributes.put("libro", libro);
      return new ModelAndView(attributes, "resultados.ftl");
    }, new FreeMarkerEngine());

    /*get("/formulario", (request, response) -> {
        //Map<String, Object> attributes = new HashMap<>();
        //attributes.put("message", "Hello World!");

        return new ModelAndView(null, "form.ftl");
    }, new FreeMarkerEngine());*/

      get("/formulario", (request, response) -> {
          //Map<String, Object> attributes = new HashMap<>();
          //attributes.put("message", "Hello World!");

          return new ModelAndView(null, "form.ftl");
      }, new FreeMarkerEngine());

    /*get("/", (request, response) -> {
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("message", "Hello World!");

        return new ModelAndView(attributes, "index.ftl");
    }, new FreeMarkerEngine());*/

  }

}


text:
namespace DRVEngine {

using InputAction = uint16_t;

//=============================================================================
class InputState {
public:
    float GetAxis( InputAction action ) const;
    bool  Pressed( InputAction action ) const;
    bool  PressedThisFrame( InputAction action ) const;

private:
    struct Entry {
        float axis;
        bool  pressed;
        bool  pressedThisFrame;
    };

    friend class InputHandler;
    friend class InputContext;
    std::vector<Entry> m_entries;
};

//=============================================================================
inline float InputState::GetAxis( InputAction action ) const {
    return m_entries[action].axis;
}

//=============================================================================
inline bool InputState::Pressed( InputAction action ) const {
    return m_entries[action].pressed;
}

//=============================================================================
inline bool InputState::PressedThisFrame( InputAction action ) const {
    const Entry& entry = m_entries[action];
    return entry.pressed && entry.pressedThisFrame;
}

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>com.google.code.play2.provider.api (Play! 2.x Provider API 1.0.0-beta1 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

com.google.code.play2.provider.api

Interfaces

CoffeescriptCompilationResult

JavascriptCompilationResult

LessCompilationResult

Play2CoffeescriptCompiler

Play2EbeanEnhancer

Play2JavaEnhancer

Play2JavascriptCompiler

Play2LessCompiler

Play2Provider

Play2RoutesCompiler

Play2TemplateCompiler

Classes

Play2Providers

Exceptions

AssetCompilationException

RoutesCompilationException

SourceGenerationException

TemplateCompilationException


text:
package org.apache.flink.table.generated;

import org.apache.flink.table.dataformat.BaseRow;

/**
 * Interface for code generated hash code of {@link BaseRow}, which will select some
 * fields to hash.
 */
public interface HashFunction {

	int hashCode(BaseRow row);

}


text:
using NUnit.Framework;
using Hyperboliq.Domain;

namespace Hyperboliq.Tests.TokenGeneration
{
    [TestFixture]
    public class SimpleUpdateTests
    {
        [Test]
        public void ItShouldBePossibleToPerformAGlobalUpdate()
        {
            var expr = Update<Person>.Set(p => p.Name, "Kalle");
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.globalUpdateExpression));
        }

        [Test]
        public void ItShouldBePossibleToSetMultipleValues()
        {
            var expr = Update<Person>.Set(p => p.Age, 42)
                                     .Set(p => p.Name, "Kalle");
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.multipleSetsExpression));
        }

        [Test]
        public void ItShouldBePossibleToSetMultipleValueInASingleStatement()
        {
            var expr = Update<Person>.Set(p => new { p.Name, p.Age },
                                          new { Name = "Kalle", Age = 42});
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.multipleSetsExpression));
        }

        [Test]
        public void ItShouldBePossibleToUpdateInPlace()
        {
            var expr = Update<Person>.Set(p => p.Age, p => p.Age + 1);
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.updateInPlaceExpression));
        }

        [Test]
        public void ItShouldBePossibleToUpdateMultipleInPlace()
        {
            var expr = Update<Person>.Set(p => new { p.Name, p.Age },
                                          p => new { Name = "Kalle" + p.Name, Age = p.Age - 2 });
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.updateMultipleColumnsInPlaceExpression));
        }

        [Test]
        public void ItShouldBePossibleToUpdateValuesToASubExpression()
        {
            var expr = Update<Person>.Set(p => p.Age,
                                          Select.Column<Car>(c => Sql.Max(c.Age)).From<Car>());
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.updateValuesToSubExpression));
        }

        [Test]
        public void ItShouldBePossibleToPerformAConditionalUpdate()
        {
            var expr = Update<Person>.Set(p => p.Age, 42)
                                     .Where(p => p.Name == "Kalle");
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.conditionalUpdateExpression));
        }

        [Test]
        public void ItShouldBePossibleToHaveMultipleConditionsOnTheUpdate()
        {
            var expr = Update<Person>.Set(p => p.Age, 42)
                                     .Where(p => p.Name == "Kalle")
                                     .Or(p => p.Name == "Pelle")
                                     .And(p => p.Age < 18);
            var result = expr.ToSqlExpression();
            Assert.That(result, Is.EqualTo(TokenGeneration_SimpleUpdateTests_Results.multipleConditionsUpdateExpression));
        }
    }
}


text:
package io.brooklyn.camp.brooklyn.spi.dsl;

import java.io.Serializable;

import io.brooklyn.camp.spi.Assembly;
import io.brooklyn.camp.spi.AssemblyTemplate;
import io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationNode;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import brooklyn.config.ConfigKey;
import brooklyn.entity.Entity;
import brooklyn.entity.basic.Entities;
import brooklyn.entity.basic.EntityInternal;
import brooklyn.entity.effector.EffectorTasks;
import brooklyn.management.Task;
import brooklyn.management.TaskFactory;
import brooklyn.util.exceptions.Exceptions;
import brooklyn.util.task.DeferredSupplier;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/** provide an object suitable to resolve chained invocations in a parsed YAML / Deployment Plan DSL,
 * which also implements {@link DeferredSupplier} so that they can be resolved when needed
 * (e.g. when entity-lookup and execution contexts are available).
 *

 * implementations of this abstract class are expected to be immutable,
 * as instances must support usage in multiple {@link Assembly} instances
 * created from a single {@link AssemblyTemplate}
 *

 * subclasses which return a deferred value are typically only
 * resolvable in the context of a {@link Task} on an {@link Entity};
 * these should be only used as the value of a {@link ConfigKey} set in the YAML,
 * and should not accessed until after the components / entities are created
 * and are being started.
 * (TODO the precise semantics of this are under development.)
 *

 **/
public abstract class BrooklynDslDeferredSupplier<T> implements DeferredSupplier<T>, TaskFactory<Task<T>>, Serializable {

    private static final long serialVersionUID = -8789624905412198233L;

    private static final Logger log = LoggerFactory.getLogger(BrooklynDslDeferredSupplier.class);

    // TODO json of this object should *be* this, not wrapped this ($brooklyn:literal is a bit of a hack, though it might work!)
    @JsonInclude
    @JsonProperty(value="$brooklyn:literal")
    // currently marked transient because it's only needed for logging
    private transient Object dsl = "(gone)";

    public BrooklynDslDeferredSupplier() {
        PlanInterpretationNode sourceNode = BrooklynDslInterpreter.currentNode();
        dsl = sourceNode!=null ? sourceNode.getOriginalValue() : null;
    }

    /** returns the current entity; for use in implementations of {@link #get()} */
    protected final static EntityInternal entity() {
        // rely on implicit ThreadLocal for now
        return (EntityInternal) EffectorTasks.findEntity();
    }

    @Override
    public final synchronized T get() {
        try {
            if (log.isDebugEnabled())
                log.debug("Queuing task to resolve "+dsl);
            T result = Entities.submit(entity(), newTask()).get();
            if (log.isDebugEnabled())
                log.debug("Resolved "+result+" from "+dsl);
            return result;
        } catch (Exception e) {
            throw Exceptions.propagate(e);
        }
    }

    @Override
    public abstract Task<T> newTask();

}


text:
<?php

namespace Realboard\Component\Database\DBInstance\Security\Security;

class SecurityApiKeyIp extends SecurityIp
{
    /**
     * [isValid description].
     *
     * @param [type] $key [description]
     *
     * @return bool [description]
     */
    public function isValid($key = null)
    {
        if (parent::isValid()) {
            if ($key && parent::getKey() && parent::getKey() == $key) {
                return true;
            }
        }

        return false;
    }
}


text:
export function install(options?: any): void;

export function getExtensions(): any;


text:
import itertools
import random
import numpy as np

class Box:
	def __init__(self, point1, point2):
		if len(point1) != 2 or len(point2) != 2:
			raise ValueError("Expected two (x,y) pairs")

		self.xmin = min(point1[0], point2[0])
		self.ymin = min(point1[1], point2[1])
		self.xmax = max(point1[0], point2[0])
		self.ymax = max(point1[1], point2[1])

	def containspoint(self, other):
		if len(other) != 2:
			raise ValueError("Expected an (x,y) pair")

		x,y = other
		return (self.xmin <= x <= self.xmax) and (self.ymin <= y <= self.ymax)

	def containsbox(self, other):
		if not isinstance(other, Box):
			raise ValueError("Expected a box")

		return (self.xmin <= other.xmin <= other.xmax <= self.xmax and
		        self.ymin <= other.ymin <= other.ymax <= self.ymax)

	__contains__ = containspoint

	def overlaps(self, other):
		if not isinstance(other, Box):
			raise ValueError("Expected a box")

		# Two boxes overlap if, on each axis, both min coords are less than both max coords
		xmins = (self.xmin, other.xmin)
		xmaxs = (self.xmax, other.xmax)
		ymins = (self.ymin, other.ymin)
		ymaxs = (self.ymax, other.ymax)
		for xmin,xmax in itertools.product(xmins, xmaxs):
			if xmax < xmin:
				return False

		for ymin,ymax in itertools.product(ymins, ymaxs):
			if ymax < ymin:
				return False

		return True

	def __repr__(self):
		return "Box(({},{}),({},{}))".format(self.xmin,self.ymin, self.xmax, self.ymax)

def makeRandomBoxes(countrange, sizerange, *, xlim=(0.,1.), ylim=(0.,1.), maxFailures = 999):
	assert len(xlim)==2 and xlim[0] < xlim[1]
	assert len(ylim)==2 and ylim[0] < ylim[1]

	# allow specifying a fixed size
	if isinstance(sizerange, (float, int)):
		sizerange = (sizerange, sizerange)

	# allow specifying a fixed count
	if isinstance(countrange, int):
		countrange = (countrange, countrange+1)

	if sizerange[1] > min(xlim[1]-xlim[0], ylim[1]-ylim[0]):
		raise ValueError("Max size in sizerange is larger than the available space!")

	boundsbox = Box((xlim[0], ylim[0]), (xlim[1], ylim[1]))

	failedAttempts = 0
	boxes = []

	count = random.randrange(*countrange)
	while len(boxes) < count:
		w = random.uniform(*sizerange)
		h = random.uniform(*sizerange)

		x1 = random.uniform(xlim[0], xlim[1]-w)
		y1 = random.uniform(ylim[0], ylim[1]-h)

		newbox = Box((x1, y1), (x1+w, y1+h))

		assert boundsbox.containsbox(newbox)

		for oldbox in boxes:
			if newbox.overlaps(oldbox):
				failedAttempts += 1
				break
		else:
			boxes.append(newbox)

		if failedAttempts >= maxFailures:
			raise RuntimeError("maxFailures={} reached when trying to generate boxes".format(maxFailures))

	return boxes

# FIXME: Assumes limits on each axis are 0. to 1., even though some other parts of code
#   allow lengths to be specified.
def potentialFromBoxes(shape, boxes, potentials):
	if len(shape) != 2:
		raise RuntimeError("Only implemented for 2D")

	# allow boxes and potentials to either be iterables or single items
	# (note: if at any point I ever make the Box class iterable, thus breaking this portion
	#    of code entirely, then allow me to say this:  "I told me so!")
	try:    boxes = list(boxes)
	except: boxes = [boxes]
	try:    potentials = list(potentials)
	except: potentials = [potentials]

	if len(boxes) != len(potentials):
		raise RuntimeError("Number of boxes must match number of potentials")

	# Brute force method.  O(n*m*p) (p being number of potentials)
	# This could be made O(log(n) log(m) p) by using bisection, but this code isn't exactly critical.
	n,m = shape
	potgrid = np.zeros(shape)
	for i,j in itertools.product(range(n),range(m)):

		# FIXME: technically, this method needs to be aware of the boundary condition.
		# For REFLECTING, spacing is 1/(N+1), and full space at each end.  |---o---o---o---|
		# For PERIODIC,   spacing is 1/N, with a half-space at each end.   |-o---o---o---o-|
		x,y = (float(j+1)/(m+1), float(i+1)/(n+1)) # suitable for REFLECTING

		for boxidx in range(len(boxes)):
			if (x,y) in boxes[boxidx]:
				potgrid[i,j] = potentials[boxidx]
				break
	return potgrid


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

@Component({
  selector: 'home',
  template: require('./home.component.pug')(),
})
export class HomeComponent implements OnInit {
  constructor() {  }

  ngOnInit() {}
}


text: export { SkipForwardFilled as default } from "./";


text:
package org.restlet.engine.header;

import java.util.Collection;

import org.restlet.data.Dimension;

/**
 * Dimension header writer.
 *
 * @author Thierry Boileau
 */
public class DimensionWriter extends HeaderWriter<Dimension> {

    /**
     * Creates a vary header from the given dimensions.
     *
     * @param dimensions
     *            The dimensions to copy to the response.
     * @return Returns the Vary header or null, if dimensions is null or empty.
     */
    public static String write(Collection<Dimension> dimensions) {
        return new DimensionWriter().append(dimensions).toString();
    }

    /**
     * Appends a collection of dimensions as a header.
     *
     * @param dimensions
     *            The dimensions to format.
     * @return This writer.
     */
    public DimensionWriter append(Collection<Dimension> dimensions) {
        if ((dimensions != null) && !dimensions.isEmpty()) {
            if (dimensions.contains(Dimension.CLIENT_ADDRESS)
                    || dimensions.contains(Dimension.TIME)
                    || dimensions.contains(Dimension.UNSPECIFIED)) {
                // From an HTTP point of view the representations can
                // vary in unspecified ways
                append("*");
            } else {
                boolean first = true;

                for (Dimension dimension : dimensions) {
                    if (first) {
                        first = false;
                    } else {
                        append(", ");
                    }

                    append(dimension);
                }
            }
        }

        return this;
    }

    @Override
    public HeaderWriter<Dimension> append(Dimension dimension) {
        if (dimension == Dimension.CHARACTER_SET) {
            append(HeaderConstants.HEADER_ACCEPT_CHARSET);
        } else if (dimension == Dimension.CLIENT_AGENT) {
            append(HeaderConstants.HEADER_USER_AGENT);
        } else if (dimension == Dimension.ENCODING) {
            append(HeaderConstants.HEADER_ACCEPT_ENCODING);
        } else if (dimension == Dimension.LANGUAGE) {
            append(HeaderConstants.HEADER_ACCEPT_LANGUAGE);
        } else if (dimension == Dimension.MEDIA_TYPE) {
            append(HeaderConstants.HEADER_ACCEPT);
        } else if (dimension == Dimension.AUTHORIZATION) {
            append(HeaderConstants.HEADER_AUTHORIZATION);
        }

        return this;
    }

}


text:
package io.domisum.lib.auxiliumlib.contracts;

import io.domisum.lib.auxiliumlib.annotations.API;

import java.util.Collection;

public interface SmartComparable<T>
	extends Comparable<T>
{

	// COMPARISON
	@API
	default boolean isLessThan(T other)
	{
		return compareTo(other) < 0;
	}

	@API
	default boolean isLessThanOrEqual(T other)
	{
		return compareTo(other) <= 0;
	}

	@API
	default boolean isEqual(T other)
	{
		return compareTo(other) == 0;
	}

	@API
	default boolean isGreaterThanOrEqual(T other)
	{
		return compareTo(other) >= 0;
	}

	@API
	default boolean isGreaterThan(T other)
	{
		return compareTo(other) > 0;
	}

	// ALL COMPARISON
	@API
	default boolean isLessThanAll(Collection<? extends T> collection)
	{
		for(T t : collection)
			if(!isLessThan(t))
				return false;

		return true;
	}

	@API
	default boolean isLessThanOrEqualAll(Collection<? extends T> collection)
	{
		for(T t : collection)
			if(!isLessThanOrEqual(t))
				return false;

		return true;
	}

	@API
	default boolean isEqualAll(Collection<? extends T> collection)
	{
		for(T t : collection)
			if(!isEqual(t))
				return false;

		return true;
	}

	@API
	default boolean isGreaterThanOrEqualAll(Collection<? extends T> collection)
	{
		for(T t : collection)
			if(!isGreaterThanOrEqual(t))
				return false;

		return true;
	}

	@API
	default boolean isGreaterThanAll(Collection<? extends T> collection)
	{
		for(T t : collection)
			if(!isGreaterThan(t))
				return false;

		return true;
	}

	// MIN MAX
	@API
	static <T extends SmartComparable<T>> T max(T a, T b)
	{
		return a.isLessThan(b) ? b : a;
	}

	@API
	static <T extends SmartComparable<T>> T min(T a, T b)
	{
		return b.isLessThan(b) ? b : a;
	}

	@API
	static <T extends SmartComparable<T>> T max(Collection<T> collection)
	{
		if(collection.isEmpty())
			throw new IllegalArgumentException("Can't get maximum from empty collection");

		T max = null;
		for(T t : collection)
			if(max == null || t.isGreaterThan(max))
				max = t;

		return max;
	}

	@API
	static <T extends SmartComparable<T>> T min(Collection<T> collection)
	{
		if(collection.isEmpty())
			throw new IllegalArgumentException("Can't get minimum from empty collection");

		T min = null;
		for(T t : collection)
			if(min == null || t.isLessThan(min))
				min = t;

		return min;
	}

}


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

namespace NancyApiTokenAuth.Infrastructure.Database
{
    public class ConnectionStringProvider : IConnectionStringProvider
    {
        public ConnectionStringSettings GetConnectionString()
        {
            if (ConfigurationManager.ConnectionStrings["UserDB"] != null)
            {
                var connectionString = ConfigurationManager.ConnectionStrings["UserDB"];

                return new ConnectionStringSettings
                {
                    ConnectionString = connectionString.ConnectionString,
                    ProviderName = connectionString.ProviderName
                };
            }

            throw new InvalidOperationException("ConnectionString with Name UserDB was not found");
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Globalization;

namespace MarkerMetro.Unity.WinLegacy.Reflection
{
    [Flags]
    public enum BindingFlags
    {
        Default,
        Public,
        Instance,
        InvokeMethod,
        NonPublic,
        Static,
        FlattenHierarchy,
        DeclaredOnly,
        IgnoreCase
    }

    public enum TypeCode
    {
        Byte,
        Int16,
        Int32,
        Int64,
        SByte,
        UInt16,
        UInt32,
        UInt64,
        Single,
        Double,
        Char,
        Boolean,
        String,
        DateTime,
        Decimal,
        Empty,
        DBNull, // Never used
        Object
    }

    public static class ReflectionExtensions
    {

        private static readonly Dictionary<Type, TypeCode> _typeCodeTable =
           new Dictionary<Type, TypeCode>()
            {
                    { typeof( Boolean ), TypeCode.Boolean },
                    { typeof( Char ), TypeCode.Char },
                    { typeof( Byte ), TypeCode.Byte },
                    { typeof( Int16 ), TypeCode.Int16 },
                    { typeof( Int32 ), TypeCode.Int32 },
                    { typeof( Int64 ), TypeCode.Int64 },
                    { typeof( SByte ), TypeCode.SByte },
                    { typeof( UInt16 ), TypeCode.UInt16 },
                    { typeof( UInt32 ), TypeCode.UInt32 },
                    { typeof( UInt64 ), TypeCode.UInt64 },
                    { typeof( Single ), TypeCode.Single },
                    { typeof( Double ), TypeCode.Double },
                    { typeof( DateTime ), TypeCode.DateTime },
                    { typeof( Decimal ), TypeCode.Decimal },
                    { typeof( String ), TypeCode.String },
            };

        public static bool IsValueType(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsValueType;
#else
            return type.IsValueType;
#endif
        }

        public static bool IsGenericType(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsGenericType;
#else
            return type.IsGenericType;
#endif
        }

        public static object[] GetCustomAttributes(this Type type, bool inherit)
        {
#if NETFX_CORE
            var customAttributes = type.GetTypeInfo().GetCustomAttributes(inherit);
            if (customAttributes == null) return null;
            return customAttributes.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        public static object[] GetCustomAttributes(this Type type, Type attrType)
        {
#if NETFX_CORE
            var customAttributes = type.GetTypeInfo().GetCustomAttributes(attrType);
            if (customAttributes == null) return null;
            return customAttributes.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        public static object[] GetCustomAttributes(this Type type, Type attrType, bool inherit)
        {

#if NETFX_CORE
            var customAttributes = type.GetTypeInfo().GetCustomAttributes(attrType, inherit);
            if (customAttributes == null) return null;
            return customAttributes.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        public static Assembly GetAssembly(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().Assembly;
#else
            throw new NotImplementedException();
#endif
        }

        public static bool IsAbstract(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsAbstract;
#else
            return type.IsAbstract;
#endif
        }

        public static bool IsDefined(this Type type, Type attributeType)
        {
#if NETFX_CORE

            return type.GetTypeInfo().IsDefined(attributeType);
#else
            throw new NotImplementedException();
#endif
        }

        public static bool IsDefined(this Type type, Type attributeType, bool inherit)
        {
#if NETFX_CORE

            return type.GetTypeInfo().IsDefined(attributeType, inherit);
#else
            throw new NotImplementedException();
#endif
        }

        public static bool IsClass(this Type type)
        {
#if NETFX_CORE

            return type.GetTypeInfo().IsClass;
#else
            return type.IsClass;
#endif
        }

        public static bool IsEnum(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsEnum;
#else
            return type.IsEnum;
#endif
        }

        public static bool IsPublic(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsPublic;
#else
            return type.IsPublic;
#endif
        }

        public static bool IsVisible(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsVisible;
#else
            return type.IsVisible;
#endif
        }

        public static ConstructorInfo GetParameterlessConstructor(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().DeclaredConstructors.FirstOrDefault(c => !c.GetParameters().Any());
#else
            throw new NotImplementedException();
#endif
        }

        public static ConstructorInfo[] GetConstructors(this Type type)
        {
#if NETFX_CORE
            var decConstructors = type.GetTypeInfo().DeclaredConstructors;
            if (decConstructors == null) return null;
            return decConstructors.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        public static Type GetInterface(this Type type, string name)
        {
            return GetInterface(type, name, false);
        }

        public static Type GetInterface(this Type type, string name, bool ignoreCase)
        {
#if NETFX_CORE
            var interfaces = type.GetTypeInfo().ImplementedInterfaces;

            foreach (var interfaceType in interfaces)
            {
                /*We must compare against the generic type definition*/
                var t = interfaceType.IsGenericType() ? interfaceType.GetGenericTypeDefinition() : interfaceType;

                if (t.Name.Equals(name, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal))
                    return interfaceType;
                if (t.FullName.Equals(name, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal))
                    return interfaceType;
            }

            return null;
#else
            throw new NotImplementedException();
#endif
        }

        public static PropertyInfo[] GetProperties(this Type type)
        {
            if (type == null)
                throw new NullReferenceException();
#if NETFX_CORE
            var members = type.GetRuntimeProperties();
            return members == null ? null : members.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        /**
        * This implementation currently ignores BindingFlags.FlattenHierarchy.
        */
        public static PropertyInfo[] GetProperties(this Type type, BindingFlags flags)
        {
#if NETFX_CORE
            var props = type.GetProperties();
            var result = new List<PropertyInfo>();
            foreach (var prop in props)
                if (TestBindingFlags(type, prop.GetMethod, flags) || TestBindingFlags(type, prop.SetMethod, flags))
                    result.Add(prop);
            return result.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        /**
         * Attention: This implementation does not throw AmbiguousMatchException when more than one
         * property is found with the specified name and matching the specified binding constraints.
         *
         * This implementation currently ignores BindingFlags.FlattenHierarchy.
         */
        public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingAttr)
        {
#if NETFX_CORE
            var props = type.GetProperties(bindingAttr);
            if (!props.Any()) return null;
            return props.FirstOrDefault(f => bindingAttr.HasFlag(BindingFlags.IgnoreCase) ?
                f.Name.ToLower() == name.ToLower() : f.Name == name);
#else
            throw new NotImplementedException();
#endif
        }

        public static PropertyInfo GetProperty(this Type type, string name)
        {
            var props = type.GetProperties();
            if (!props.Any()) return null;
            return props.FirstOrDefault(f => f.Name == name);
        }

        public static MethodInfo[] GetMethods(this Type type)
        {
            if (type == null)
                throw new NullReferenceException();
#if NETFX_CORE
            var members = type.GetRuntimeMethods();
            return members == null ? null : members.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        /**
         * This implementation currently ignores BindingFlags.FlattenHierarchy.
         */
        public static MethodInfo[] GetMethods(this Type t, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance)
        {
#if NETFX_CORE
            if (!flags.HasFlag(BindingFlags.Instance) && !flags.HasFlag(BindingFlags.Static)) return null;

            var allMethods = t.GetMethods();
            var resultList = new List<MethodInfo>();
            foreach (var method in allMethods)
            {
                if (TestBindingFlags(t, method, flags))
                    resultList.Add(method);
            }
            return resultList.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        /**
         * Tests the following BindingFlags:
         * Public, NonPublic, Static, Instance, DeclaredOnly.
         */
        private static bool TestBindingFlags(Type t, MethodInfo method, BindingFlags flags)
        {
#if NETFX_CORE
            var isValid = (flags.HasFlag(BindingFlags.Public) && method.IsPublic)
                || (flags.HasFlag(BindingFlags.NonPublic) && !method.IsPublic);
            isValid &= (flags.HasFlag(BindingFlags.Static) && method.IsStatic) || (flags.HasFlag(BindingFlags.Instance) && !method.IsStatic);
            if (flags.HasFlag(BindingFlags.DeclaredOnly))
                isValid &= method.DeclaringType == t;
            return isValid;
#else
            throw new NotImplementedException();
#endif
        }
        public static MemberInfo[] GetMembers(this Type type)
        {
            if (type == null)
                throw new NullReferenceException();
#if NETFX_CORE
            var ti = type.GetTypeInfo();
            var result = new List<MemberInfo>();
            if (ti.DeclaredMembers != null)
            {
                result.AddRange(ti.DeclaredMembers);
            }
            return result.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        public static MemberInfo[] GetMembers(this Type t, BindingFlags flags)
        {
#if NETFX_CORE
            if (!flags.HasFlag(BindingFlags.Instance) && !flags.HasFlag(BindingFlags.Static)) return null;
            return t.GetMembers();
#else
            throw new NotImplementedException();
#endif
        }

        public static Object InvokeMember(this Type t, string name, BindingFlags flags, object binder, object target, object[] args)
        {
#if NETFX_CORE
            if (binder != null || target != null)
                throw new ArgumentException("doesn't support binder or target when invoking");
            // We only support invoking a normal method, not a field/property/other member
            var members = t.GetMethods();
            foreach (var m in members)
            {
                if (m.Name.Equals(name))
                {
                    return m.Invoke(t, args);
                }
            }
            return null;
#else
            throw new NotImplementedException();
#endif
        }

        public static FieldInfo[] GetFields(this Type type)
        {
#if NETFX_CORE
            var fields = type.GetRuntimeFields();
            return fields == null ? null : fields.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        public static FieldInfo[] GetFields(this Type t, BindingFlags flags)
        {
#if NETFX_CORE
            if (!flags.HasFlag(BindingFlags.Instance) && !flags.HasFlag(BindingFlags.Static))
                return null;

            var origFields = t.GetFields();
            var results = new List<FieldInfo>();
            foreach (var field in origFields)
            {
                var isValid = (flags.HasFlag(BindingFlags.Public) && field.IsPublic)
                    || (flags.HasFlag(BindingFlags.NonPublic) && !field.IsPublic);
                isValid &= (flags.HasFlag(BindingFlags.Static) && field.IsStatic) || (flags.HasFlag(BindingFlags.Instance) && !field.IsStatic);
                if (flags.HasFlag(BindingFlags.DeclaredOnly))
                    isValid &= field.DeclaringType == t;

                results.Add(field);
            }
            return results.ToArray();
#else
            throw new NotImplementedException();
#endif
        }

        public static FieldInfo GetField(this Type type, string name)
        {
#if NETFX_CORE
            var fields = type.GetFields();
            if (!fields.Any()) return null;
            return fields.FirstOrDefault(f => f.Name == name);
#else
            throw new NotImplementedException();
#endif
        }

        public static FieldInfo GetField(this Type type, string name, BindingFlags flags)
        {
#if NETFX_CORE
            FieldInfo[] fields = type.GetFields(flags);
            if (fields != null)
                for (int i = 0; i < fields.Length; i++)
                    if (fields[i].Name.Equals(name))
                        return fields[i];
            return null;
#else
            throw new NotImplementedException();
#endif
        }

        public static MethodInfo GetMethod(this Type type, string name)
        {
            return GetMethod(type, name, BindingFlags.Default, null);
        }

        public static MethodInfo GetMethod(this Type type, string name, Type[] types)
        {
            return GetMethod(type, name, BindingFlags.Default, types);
        }

        public static MethodInfo GetMethod(this Type t, string name, BindingFlags flags)
        {
            return GetMethod(t, name, flags, null);
        }
        public static Type GetBaseType(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().BaseType;
#endif
            throw new NotImplementedException();
        }

        public static MethodInfo GetMethod(Type t, string name, BindingFlags flags, Type[] parameters)
        {
#if NETFX_CORE
            var methods = t.GetMethods();
            foreach (var m in methods)
            {
                var plist = m.GetParameters();
                bool match = true;
                foreach (var param in plist)
                {
                    bool valid = true;
                    if (parameters != null)
                    {
                        foreach (var ptype in parameters)
                            valid &= ptype == param.ParameterType;
                    }
                    match &= valid;
                }
                if (match)
                    return m;
            }
            return null;
#else
            throw new NotImplementedException();
#endif
        }

        public static Type[] GetGenericArguments(this Type t)
        {
#if NETFX_CORE
            var ti = t.GetTypeInfo();
            return ti.GenericTypeArguments;
#else
            throw new NotImplementedException();
#endif
        }

        public static bool IsAssignableFrom(this Type current, Type toCompare)
        {
#if NETFX_CORE
            return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo());
#else
            throw new NotImplementedException();
#endif
        }

        public static bool IsInterface(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsInterface;
#else
            return type.IsInterface;
#endif
        }

        public static bool IsPrimitive(this Type type)
        {
#if NETFX_CORE
            return type.GetTypeInfo().IsPrimitive;
#else
            return type.IsPrimitive;
#endif
        }

        /**
         * Missing IsSubclassOf, this works well
         */
        public static bool IsSubclassOf(this Type type, global::System.Type parent)
        {
#if NETFX_CORE
            return parent.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo());
#else
            throw new NotImplementedException();
#endif
        }

        public static Type[] GetTypes(this Assembly assembly)
        {
#if NETFX_CORE
            if (assembly.DefinedTypes == null) return null;
            if (assembly.DefinedTypes.Count() == 0) return new Type[0];
            var typeInfos = assembly.DefinedTypes.ToArray();
            Type[] types = new Type[typeInfos.Count()];
            for (var x = 0; x < types.Length; x++)
            {
                types[x] = typeInfos[x].AsType();
            }
            return types;

#else
            throw new NotImplementedException();
#endif
        }

        public static Type GetType(this Assembly assembly)
        {
#if NETFX_CORE
            if (assembly.DefinedTypes == null) return null;
            return assembly.GetType();
#else
            throw new NotImplementedException();
#endif
        }

        public static TypeCode GetTypeCode(this Type type)
        {
            if (type == null)
            {
                return TypeCode.Empty;
            }

            TypeCode result;
            if (!_typeCodeTable.TryGetValue(type, out result))
            {
                result = TypeCode.Object;
            }

            return result;
        }

    }

}


text:
/** @jsx h */

import h from '../../helpers/h'

export default function(value) {
  return value
    .change()
    .addMark('bold')
    .value.change()
    .undo().value
}

export const input = (
  <value>
    <document>
      <paragraph>
        o<anchor />ne
      </paragraph>
      <paragraph>
        tw<focus />o
      </paragraph>
    </document>
  </value>
)

export const output = input


text:
"""
Unittests for nwid.terminal.sgr module.
"""

from __future__ import absolute_import

from nwid.terminal import codes as code
from nwid.terminal import sgr
import pytest

## SGR unit tests ##

def test_sgr_can_create_codes():
    """SGR escape sequences can be combined to create one SGR code."""
    assert sgr.create(code.BLACK) == code.CSI + code.BLACK + 'm'
    assert sgr.create(code.BG_BLACK) == code.CSI + code.BG_BLACK + 'm'

def test_sgr_create():
    """SGR create returns an empty string when no args are passed."""
    assert sgr.create() == ''

def test_can_combine_sgr_codes():
    """Multiple SGR escape codes can be combined in one SGR code."""
    assert sgr.create(code.BLACK, code.BG_RED) == \
        code.CSI + code.BLACK + code.DELIMITER + code.BG_RED + 'm'
    assert sgr.create(code.UNDERLINE, code.BLACK, code.BG_RED) == \
        code.CSI + code.UNDERLINE + code.DELIMITER + code.BLACK + \
        code.DELIMITER + code.BG_RED + 'm'

def test_cannot_use_non_sgr_escape_sequence_as_sgr():
    """Only SGR escape sequences can be used as an SGR code."""
    with pytest.raises(sgr.SGRError):
        sgr.create(code.CURSOR_HIDE)

def test_sgr_reset():
    """SGR reset test."""
    assert sgr.create(code.RESET) == sgr.reset()
    assert sgr.reset() == code.CSI + code.RESET + 'm'

def test_can_wrap_string_with_sgr():
    """SGR function wrap can wrap a string with an SGR sequence ending in a
    reset."""
    assert sgr.wrap('This is a string.', code.BLACK, code.BG_RED) == \
        code.CSI + code.BLACK + code.DELIMITER + code.BG_RED + 'm' + \
        'This is a string.' + code.CSI + code.RESET + 'm'

def test_can_wrap_string_with_reset_with_sgr():
    """SGR function wrap can wrap a string with an SGR sequence ending in a
    reset."""
    string = 'This ' + sgr.create(code.RED) + 'is' + sgr.reset() + ' a string.'
    modified_string = sgr.create(code.BG_BLUE) + 'This ' + \
            sgr.create(code.RED) + 'is' + sgr.reset() + \
            sgr.create(code.BG_BLUE) + ' a string.' + sgr.reset()

    assert sgr.wrap(string, code.BG_BLUE) == modified_string

def test_can_wrap_string_with_trailing_reset_with_sgr():
    """SGR function wrap can wrap a string with an SGR sequence ending in a
    reset at the end of the string. The reset is not duplicated."""
    string = 'This ' + sgr.create(code.RED) + 'is a string.' + sgr.reset()
    modified_string = sgr.create(code.BG_BLUE) + 'This ' + \
            sgr.create(code.RED) + 'is a string.' + sgr.reset()

    assert sgr.wrap(string, code.BG_BLUE) == modified_string


text:
'use strict';

/**
 * Omit any properties starting with `_`, which are fake-private
 *
 * @type {import('stylelint').Formatter}
 */
module.exports = function jsonFormatter(results) {
	const cleanedResults = results.map((result) =>
		Object.entries(result)
			.filter(([key]) => !key.startsWith('_'))
			.reduce((/** @type {{ [key: string]: any }} */ obj, [key, value]) => {
				obj[key] = value;

				return obj;
			}, {}),
	);

	return JSON.stringify(cleanedResults);
};


text:
***

## Purpose

The idea is to **demonstrate how to write a single-page app that authenticates with OAuth using AngularJS**.

## Stack

* AngularJS on the front-end.
* [grunt-ngdocs](https://github.com/m7r/grunt-ngdocs) to generate front-end documentation
* Simple node.js static file server to serve documentation and the front-end app
* **Not included:** an OAuth backend.

### Platform & tools

You need to install Node.js and then the development tools. Node.js comes with a package manager called [npm](http://npmjs.org) for installing NodeJS applications and libraries.
* [Install node.js](http://nodejs.org/download/) (requires node.js version >= 0.8.4)
* Install Grunt-CLI and Karma as global npm modules:

    ```
    npm install -g grunt-cli karma
    ```

(Note that you may need to uninstall grunt 0.3 globally before installing grunt-cli)

### App Server

The backend application server is a NodeJS application that relies upon some 3rd Party npm packages.  You need to install these:

* Install local dependencies:

    ```
    cd server
    npm install
    cd ..
    ```

### Client App

This client application is a straight HTML/Javascript application but the development process uses a Node.js build tool
[Grunt.js](gruntjs.com). Grunt relies upon some 3rd party libraries that we need to install as local dependencies using npm.

* Install local dependencies:

    ```
    cd client
    npm install
    cd ..
    ```

### Build the client app
The app made up of a number of javascript, css and html files that need to be merged into a final distribution for running.  We use the Grunt build tool to do this.
* Build client application:

    ```
    cd client
    grunt build
    ```

## Running
### Start the Server
* Run the server

    ```
    cd server
    node server.js
    ```
* Browse to the application at [http://localhost:4000]

## Development

### Folders structure
At the top level, the repository is split into a client folder and a server folder.  The client folder contains all the client-side AngularJS application.  The server folder contains a very basic Express based webserver that delivers and supports the application.
Within the client folder you have the following structure:
* `build` contains build tasks for Grunt
* `dist` contains build results
* `src` contains application's sources
* `test` contains test sources, configuration and dependencies *(no tests yet!)*
* `vendor` contains external dependencies for the application

### Default Build

*Note: there are currently no tests, but the app is set up to support testing with Jasmine and Karma*

The default grunt task will build (checks the javascript (lint), runs the unit tests (test:unit) and builds distributable files) and run all unit tests: `grunt` (or `grunt.cmd` on Windows).  The tests are run by karma and need one or more browsers open to actually run the tests.
* `cd client`
* `grunt`
* Open one or more browsers and point them to [http://localhost:8080/__test/].  Once the browsers connect the tests will run and the build will complete.
* If you leave the browsers open at this url then future runs of `grunt` will automatically run the tests against these browsers.

### Continuous Building
The watch grunt task will monitor the source files and run the default build task every time a file changes: `grunt watch`.

### Build without tests
If for some reason you don't want to run the test but just generate the files - not a good idea(!!) - you can simply run the build task: `grunt build`.

### Building release code
You can build a release version of the app, with minified files.
* `cd client`
* Run `grunt release`
* Open one or more browsers and point them to [http://localhost:8080/__test/].  Once the browsers connect the tests will run and the build will complete.
* If you leave the browsers open at this url then future runs of `grunt` will automatically run the tests against these browsers.

### Continuous testing
You can have grunt (karma) continuously watch for file changes and automatically run all the tests on every change, without rebuilding the distribution files.  This can make the test run faster when you are doing test driven development and don't need to actually run the application itself.

* `cd client`
* Run `grunt test-watch`.
* Open one or more browsers and point them to [http://localhost:8080/__test/].
* Each time a file changes the tests will be run against each browser.


text:
<?php

class UpdateController extends \BaseController
{

    public function index()
    {
        return View::make('update.index');
    }

}