text:
package net.bither.qrcode;

import net.bither.BitherApplication;
import net.bither.R;
import net.bither.bitherj.core.Address;
import net.bither.bitherj.core.AddressManager;
import net.bither.bitherj.core.Tx;
import net.bither.bitherj.exception.AddressFormatException;
import net.bither.bitherj.utils.Base58;
import net.bither.bitherj.utils.QRCodeUtil;
import net.bither.bitherj.utils.Utils;
import net.bither.util.LogUtil;
import net.bither.util.StringUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class QRCodeEnodeUtil {

    private static final String QR_CODE_LETTER = "*";

    public static String getPublicKeyStrOfPrivateKey() {
        String content = "";
        List<Address> addresses = AddressManager.getInstance().getPrivKeyAddresses();
        for (int i = 0; i < addresses.size(); i++) {
            Address address = addresses.get(i);
            String pubStr = "";
            if (address.isFromXRandom()) {
                pubStr = QRCodeUtil.XRANDOM_FLAG;
            }
            pubStr = pubStr + Utils.bytesToHexString(address.getPubKey());
            content += pubStr;
            if (i < addresses.size() - 1) {
                content += QRCodeUtil.QR_CODE_SPLIT;
            }
        }
        content.toUpperCase(Locale.US);
        return content;
    }

    public static List<Address> formatPublicString(String content) {
        String[] strs = QRCodeUtil.splitString(content);
        ArrayList<Address> wallets = new ArrayList<Address>();
        for (String str : strs) {
            boolean isXRandom = false;
            if (str.indexOf(QRCodeUtil.XRANDOM_FLAG) == 0) {
                isXRandom = true;
                str = str.substring(1);
            }
            byte[] pub = StringUtil.hexStringToByteArray(str);
            String addString = Utils.toAddress(Utils.sha256hash160(pub));
            Address address = new Address(addString, pub, null, false);
            address.setFromXRandom(isXRandom);
            wallets.add(address);
        }
        return wallets;

    }

    private static QRCodeTxTransport fromSendRequestWithUnsignedTransaction(Tx tx) {
        QRCodeTxTransport qrCodeTransport = new QRCodeTxTransport();
        qrCodeTransport.setMyAddress(tx.getFromAddress());
        String toAddress = tx.getFirstOutAddress();
        if (Utils.isEmpty(toAddress)) {
            toAddress = BitherApplication.mContext.getString(R.string.address_cannot_be_parsed);
        }
        qrCodeTransport.setToAddress(toAddress);
        qrCodeTransport.setTo(tx.amountSentToAddress(toAddress));
        qrCodeTransport.setFee(tx.getFee());
        List<String> hashList = new ArrayList<String>();
        for (byte[] h : tx.getUnsignedInHashes()) {
            hashList.add(Utils.bytesToHexString(h));
        }
        qrCodeTransport.setHashList(hashList);
        return qrCodeTransport;
    }

    public static String getPresignTxString(Tx tx) {
        QRCodeTxTransport qrCodeTransport = fromSendRequestWithUnsignedTransaction(tx);
        String preSignString = "";
        try {
            preSignString = Base58.bas58ToHexWithAddress(qrCodeTransport.getMyAddress())
                    + QRCodeUtil.QR_CODE_SPLIT
                    + Long.toHexString(qrCodeTransport.getFee())
                    .toLowerCase(Locale.US)
                    + QRCodeUtil.QR_CODE_SPLIT
                    + Base58.bas58ToHexWithAddress(qrCodeTransport.getToAddress())
                    + QRCodeUtil.QR_CODE_SPLIT
                    + Long.toHexString(qrCodeTransport.getTo())
                    .toLowerCase(Locale.US) + QRCodeUtil.QR_CODE_SPLIT;
            for (int i = 0; i < qrCodeTransport.getHashList().size(); i++) {
                String hash = qrCodeTransport.getHashList().get(i);
                if (i < qrCodeTransport.getHashList().size() - 1) {
                    preSignString = preSignString + hash + QRCodeUtil.QR_CODE_SPLIT;
                } else {
                    preSignString = preSignString + hash;
                }
            }
            preSignString.toUpperCase(Locale.US);
        } catch (AddressFormatException e) {
            e.printStackTrace();
        }

        return preSignString;
    }

    public static QRCodeTxTransport formatQRCodeTransport(String str) {
        try {
            String[] strArray = QRCodeUtil.splitString(str);
            QRCodeTxTransport qrCodeTransport = new QRCodeTxTransport();
            LogUtil.d("qrcode", "str," + str);
            LogUtil.d("qrcode", "0," + strArray[0]);

            String address = Base58.hexToBase58WithAddress(strArray[0]);
            LogUtil.d("qrcode", "address," + address);
            if (!Utils.validBicoinAddress(address)) {
                return null;
            }
            qrCodeTransport.setMyAddress(address);
            qrCodeTransport.setFee(Long.parseLong(
                    strArray[1], 16));
            qrCodeTransport.setToAddress(Base58.hexToBase58WithAddress(strArray[2]));
            qrCodeTransport.setTo(Long.parseLong(
                    strArray[3], 16));
            List<String> hashList = new ArrayList<String>();
            for (int i = 4; i < strArray.length; i++) {
                String text = strArray[i];
                if (!Utils.isEmpty(text)) {
                    hashList.add(text);
                }
            }
            qrCodeTransport.setHashList(hashList);
            return qrCodeTransport;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    private static QRCodeTxTransport oldFromSendRequestWithUnsignedTransaction(Tx tx) {
        QRCodeTxTransport qrCodeTransport = new QRCodeTxTransport();
        qrCodeTransport.setMyAddress(tx.getFromAddress());
        String toAddress = tx.getFirstOutAddress();
        if (Utils.isEmpty(toAddress)) {
            toAddress = BitherApplication.mContext.getString(R.string.address_cannot_be_parsed);
        }
        qrCodeTransport.setToAddress(toAddress);
        qrCodeTransport.setTo(tx.amountSentToAddress(toAddress));
        qrCodeTransport.setFee(tx.getFee());
        List<String> hashList = new ArrayList<String>();
        for (byte[] h : tx.getUnsignedInHashes()) {
            hashList.add(Utils.bytesToHexString(h));
        }
        qrCodeTransport.setHashList(hashList);
        return qrCodeTransport;
    }

    public static String oldGetPreSignString(Tx tx) {
        QRCodeTxTransport qrCodeTransport = oldFromSendRequestWithUnsignedTransaction(tx);
        String preSignString = qrCodeTransport.getMyAddress()
                + QRCodeUtil.OLD_QR_CODE_SPLIT
                + Long.toHexString(qrCodeTransport.getFee())
                .toLowerCase(Locale.US)
                + QRCodeUtil.OLD_QR_CODE_SPLIT
                + qrCodeTransport.getToAddress()
                + QRCodeUtil.OLD_QR_CODE_SPLIT
                + Long.toHexString(qrCodeTransport.getTo())
                .toLowerCase(Locale.US) + QRCodeUtil.OLD_QR_CODE_SPLIT;
        for (int i = 0; i < qrCodeTransport.getHashList().size(); i++) {
            String hash = qrCodeTransport.getHashList().get(i);
            if (i < qrCodeTransport.getHashList().size() - 1) {
                preSignString = preSignString + hash + QRCodeUtil.OLD_QR_CODE_SPLIT;
            } else {
                preSignString = preSignString + hash;
            }
        }

        return preSignString;
    }

    public static String oldEncodeQrCodeString(String text) {
        Pattern pattern = Pattern.compile("[A-Z]");
        Matcher matcher = pattern.matcher(text);
        StringBuffer sb = new StringBuffer();
        while (matcher.find()) {
            String letter = matcher.group(0);
            matcher.appendReplacement(sb, QR_CODE_LETTER + letter);
        }
        matcher.appendTail(sb);

        return sb.toString().toUpperCase(Locale.US);
    }

}


text:
.actionBar {
	display: flex;
	flex-direction: row;
}

.actionBar > * {
	flex-grow: 1;
}

.actionBar > .createButton {
	background-color: lightgreen;
}

redpajama_set_name: RedPajamaGithub


text:
<md-data-table-toolbar><button class="md-icon-button md-button md-default-theme" ng-click="delete($event)" ng-show="selected.length">
        <md-icon md-svg-icon="delete"></md-icon>
    </button></md-data-table-toolbar>
<md-table-container>

                Time to Remove
 (1 dev-day = 6h)

                    <trello-avatar member="member"></trello-avatar>

                {{ day.date | date : 'EEEE, MMMM d' }}

                    <md-input-container class="timeBox__input-container" md-no-float="md-no-float"><input nss-round="nss-round" ng-model="day.timebox" ng-change="onUpdate()" placeholder="hours" /></md-input-container>

                    <md-slider class="md-primary" min="0" max="1" step="0.1" ng-model="matrix[$parent.$index][$index]" ng-change="onUpdate()"></md-slider>

</md-table-container>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WHOperation
{
    class handleUSBDevice
    {

          //DisableDevice(n => n.ToUpperInvariant().Contains("VID_3F20&PID_8A1D"),true);
    }

    public static class DisableHardware
    {
        const uint DIF_PROPERTYCHANGE = 0x12;
        const uint DICS_ENABLE = 1;
        const uint DICS_DISABLE = 2;  // disable device
        const uint DICS_FLAG_GLOBAL = 1; // not profile-specific
        const uint DIGCF_ALLCLASSES = 4;
        const uint DIGCF_PRESENT = 2;
        const uint ERROR_NO_MORE_ITEMS = 259;
        const uint ERROR_ELEMENT_NOT_FOUND = 1168;

        static DEVPROPKEY DEVPKEY_Device_DeviceDesc;
        static DEVPROPKEY DEVPKEY_Device_HardwareIds;

        [StructLayout(LayoutKind.Sequential)]
        struct SP_CLASSINSTALL_HEADER
        {
            public UInt32 cbSize;
            public UInt32 InstallFunction;
        }

        [StructLayout(LayoutKind.Sequential)]
        struct SP_PROPCHANGE_PARAMS
        {
            public SP_CLASSINSTALL_HEADER ClassInstallHeader;
            public UInt32 StateChange;
            public UInt32 Scope;
            public UInt32 HwProfile;
        }

        [StructLayout(LayoutKind.Sequential)]
        struct SP_DEVINFO_DATA
        {
            public UInt32 cbSize;
            public Guid classGuid;
            public UInt32 devInst;
            public UInt32 reserved;
        }

        [StructLayout(LayoutKind.Sequential)]
        struct DEVPROPKEY
        {
            public Guid fmtid;
            public UInt32 pid;
        }

        [DllImport("setupapi.dll", SetLastError = true)]
        static extern IntPtr SetupDiGetClassDevsW(
            [In] ref Guid ClassGuid,
            [MarshalAs(UnmanagedType.LPWStr)]
    string Enumerator,
            IntPtr parent,
            UInt32 flags);

        [DllImport("setupapi.dll", SetLastError = true)]
        static extern bool SetupDiDestroyDeviceInfoList(IntPtr handle);

        [DllImport("setupapi.dll", SetLastError = true)]
        static extern bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet,
            UInt32 memberIndex,
            [Out] out SP_DEVINFO_DATA deviceInfoData);

        [DllImport("setupapi.dll", SetLastError = true)]
        static extern bool SetupDiSetClassInstallParams(
            IntPtr deviceInfoSet,
            [In] ref SP_DEVINFO_DATA deviceInfoData,
            [In] ref SP_PROPCHANGE_PARAMS classInstallParams,
            UInt32 ClassInstallParamsSize);

        [DllImport("setupapi.dll", SetLastError = true)]
        static extern bool SetupDiChangeState(
            IntPtr deviceInfoSet,
            [In] ref SP_DEVINFO_DATA deviceInfoData);

        [DllImport("setupapi.dll", SetLastError = true)]
        static extern bool SetupDiGetDevicePropertyW(
                IntPtr deviceInfoSet,
                [In] ref SP_DEVINFO_DATA DeviceInfoData,
                [In] ref DEVPROPKEY propertyKey,
                [Out] out UInt32 propertyType,
                IntPtr propertyBuffer,
                UInt32 propertyBufferSize,
                out UInt32 requiredSize,
                UInt32 flags);

        static DisableHardware()
        {
            DisableHardware.DEVPKEY_Device_DeviceDesc = new DEVPROPKEY();
            DEVPKEY_Device_DeviceDesc.fmtid = new Guid(
                    0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67,
                    0xd1, 0x46, 0xa8, 0x50, 0xe0);
            DEVPKEY_Device_DeviceDesc.pid = 2;

            DEVPKEY_Device_HardwareIds = new DEVPROPKEY();
            DEVPKEY_Device_HardwareIds.fmtid = new Guid(
                0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67,
                0xd1, 0x46, 0xa8, 0x50, 0xe0);
            DEVPKEY_Device_HardwareIds.pid = 3;
        }

        public static void DisableDevice(Func<string, bool> filter, bool disable = true)
        {
            IntPtr info = IntPtr.Zero;
            Guid NullGuid = Guid.Empty;
            try
            {
                info = SetupDiGetClassDevsW(
                    ref NullGuid,
                    null,
                    IntPtr.Zero,
                    DIGCF_ALLCLASSES);
                CheckError("SetupDiGetClassDevs");

                SP_DEVINFO_DATA devdata = new SP_DEVINFO_DATA();
                devdata.cbSize = (UInt32)Marshal.SizeOf(devdata);

                // Get first device matching device criterion.
                for (uint i = 0; ; i++)
                {
                    SetupDiEnumDeviceInfo(info,
                        i,
                        out devdata);
                    // if no items match filter, throw
                    if (Marshal.GetLastWin32Error() == ERROR_NO_MORE_ITEMS)
                        CheckError("No device found matching filter.", 0xcffff);
                    CheckError("SetupDiEnumDeviceInfo");

                    string devicepath = GetStringPropertyForDevice(info,
                                               devdata, DEVPKEY_Device_HardwareIds);
                    // Uncomment to print name/path
                    //Console.WriteLine(GetStringPropertyForDevice(info,
                    //                         devdata, DEVPKEY_Device_DeviceDesc));
                    //Console.WriteLine("   {0}", devicepath);
                    if (devicepath != null && filter(devicepath)) break;

                }

                SP_CLASSINSTALL_HEADER header = new SP_CLASSINSTALL_HEADER();
                header.cbSize = (UInt32)Marshal.SizeOf(header);
                header.InstallFunction = DIF_PROPERTYCHANGE;

                SP_PROPCHANGE_PARAMS propchangeparams = new SP_PROPCHANGE_PARAMS();
                propchangeparams.ClassInstallHeader = header;
                propchangeparams.StateChange = disable ? DICS_DISABLE : DICS_ENABLE;
                propchangeparams.Scope = DICS_FLAG_GLOBAL;
                propchangeparams.HwProfile = 0;

                SetupDiSetClassInstallParams(info,
                    ref devdata,
                    ref propchangeparams,
                    (UInt32)Marshal.SizeOf(propchangeparams));
                CheckError("SetupDiSetClassInstallParams");

                SetupDiChangeState(
                    info,
                    ref devdata);
                CheckError("SetupDiChangeState");
            }
            finally
            {
                if (info != IntPtr.Zero)
                    SetupDiDestroyDeviceInfoList(info);
            }
        }
        private static void CheckError(string message, int lasterror = -1)
        {

            int code = lasterror == -1 ? Marshal.GetLastWin32Error() : lasterror;
            if (code != 0)
                throw new ApplicationException(
                    String.Format("Error disabling hardware device (Code {0}): {1}",
                        code, message));
        }

        private static string GetStringPropertyForDevice(IntPtr info, SP_DEVINFO_DATA devdata,
            DEVPROPKEY key)
        {
            uint proptype, outsize;
            IntPtr buffer = IntPtr.Zero;
            try
            {
                uint buflen = 512;
                buffer = Marshal.AllocHGlobal((int)buflen);
                SetupDiGetDevicePropertyW(
                    info,
                    ref devdata,
                    ref key,
                    out proptype,
                    buffer,
                    buflen,
                    out outsize,
                    0);
                byte[] lbuffer = new byte[outsize];
                Marshal.Copy(buffer, lbuffer, 0, (int)outsize);
                int errcode = Marshal.GetLastWin32Error();
                if (errcode == ERROR_ELEMENT_NOT_FOUND) return null;
                CheckError("SetupDiGetDeviceProperty", errcode);
                return Encoding.Unicode.GetString(lbuffer);
            }
            finally
            {
                if (buffer != IntPtr.Zero)
                    Marshal.FreeHGlobal(buffer);
            }
        }
    }
}


text:
package models

import java.util.Date
import models.swagger._

import org.joda.time.DateTime
import play.api.libs.json.{Reads, Writes, JsPath, Format}
import play.api.libs.functional.syntax._
import scala.util.Random

case class Lawyer(_id: Option[Any],
                  email: String,
                  password: String,
                  avatar: Option[String],
                  bearerToken: Option[BearerToken],
                  createdAt: DateTime)

object Lawyer {

}

object Status extends Enumeration {
  type Status = Value
  val Active, Blocked, Pending, Inactive = Value
}


text:
from .account import account_api
from .user import user_api
from .report import report_api
from .analytics import analytics_api


text:
OVERRIDE(HanulWiki.ArticleModel, function(origin) {
	'use strict';

	HanulWiki.ArticleModel = OBJECT({

		preset : function() {
			return origin;
		},

		init : function(inner, self, params) {

			var
			// view.
			view,

			// find history.
			findHistory,

			// search ids.
			searchIds;

			self.view = view = function(id, callback) {
				//REQUIRED: id

				self.getRoom().send({
					methodName : 'view',
					data : id
				}, callback);
			};

			self.findHistory = findHistory = function(params, callback) {
				//REQUIRED: params
				//REQUIRED: params.id
				//OPTIONAL: params.page

				self.getRoom().send({
					methodName : 'findHistory',
					data : params
				}, callback);
			};

			self.searchIds = searchIds = function(query, callback) {
				//REQUIRED: query

				self.getRoom().send({
					methodName : 'searchIds',
					data : query
				}, callback);
			};
		}
	});
});


text:
package com.hp.autonomy.hod.caching;

import com.hp.autonomy.hod.sso.HodAuthentication;
import com.hp.autonomy.hod.sso.HodAuthenticationPrincipal;
import org.springframework.cache.interceptor.AbstractCacheResolver;
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * CacheResolver that prefixes cache names with the Micro Focus Haven OnDemand domain and the Micro Focus Haven OnDemand application in
 * the current security context. This allows caching to be used across multiple domains without interference.
 * <p>
 * The domain and application will be joined with colons, so cache name must not contain the ":" character if
 * {@link HodCacheNameResolver#getOriginalName(String)} is to be used
 */
abstract class AbstractHodCacheResolver extends AbstractCacheResolver {
    @Override
    protected Collection<String> getCacheNames(final CacheOperationInvocationContext<?> context) {
        final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

        if (!(authentication instanceof HodAuthentication)) {
            throw new IllegalStateException("There is no HOD authentication token in the security context holder");
        }

        final HodAuthenticationPrincipal principal = ((HodAuthentication) authentication).getPrincipal();

        final Set<String> contextCacheNames = context.getOperation().getCacheNames();
        final Collection<String> resolvedCacheNames = contextCacheNames.stream().map(cacheName -> resolveName(cacheName, principal)).collect(Collectors.toCollection(HashSet::new));

        return resolvedCacheNames;
    }

    /**
     * Resolve the cache for the given name, qualified by the HOD application.
     *
     * @param cacheName The original cache name
     * @param principal HoD authentication principal retrieved from context
     * @return The cache name qualified with the application
     */
    protected abstract String resolveName(final String cacheName, final HodAuthenticationPrincipal principal);
}


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

namespace Gale.Exception.SqlClient
{
    /// <summary>
    /// Defines a Custom Database Exception in SQL SERVER , (ErrorNumber > 5000)
    /// https://msdn.microsoft.com/en-us/library/ms178592.aspx
    /// </summary>
    public class CustomDatabaseException : System.Exception
    {
        private string _code;

        public CustomDatabaseException(string code, string message)
            : base(message)
        {
            this._code = code;
        }

        public String Code
        {
            get
            {
                return _code;
            }
        }

    }
}


text:
package stdlib

import (
	"container/heap"
	"reflect"
)

func init() {
	Symbols["container/heap"] = map[string]reflect.Value{
		// function, constant and variable definitions
		"Fix":    reflect.ValueOf(heap.Fix),
		"Init":   reflect.ValueOf(heap.Init),
		"Pop":    reflect.ValueOf(heap.Pop),
		"Push":   reflect.ValueOf(heap.Push),
		"Remove": reflect.ValueOf(heap.Remove),

		// type definitions
		"Interface": reflect.ValueOf((*heap.Interface)(nil)),

		// interface wrapper definitions
		"_Interface": reflect.ValueOf((*_container_heap_Interface)(nil)),
	}
}

// _container_heap_Interface is an interface wrapper for Interface type
type _container_heap_Interface struct {
	WLen  func() int
	WLess func(i int, j int) bool
	WPop  func() interface{}
	WPush func(x interface{})
	WSwap func(i int, j int)
}

func (W _container_heap_Interface) Len() int               { return W.WLen() }
func (W _container_heap_Interface) Less(i int, j int) bool { return W.WLess(i, j) }
func (W _container_heap_Interface) Pop() interface{}       { return W.WPop() }
func (W _container_heap_Interface) Push(x interface{})     { W.WPush(x) }
func (W _container_heap_Interface) Swap(i int, j int)      { W.WSwap(i, j) }


text:
'use strict';

adsApp.controller('EditProfileCtrl', [
    '$scope',
    '$location',
    'townsData',
    'userData',
    'notification',
    function ($scope, $location, townsData, userData, notification) {

        $scope.homeLink = 'user/home';
        $scope.pass = {
            oldPassword: null,
            newPassword: null,
            confirmPassword: null
        };

        $scope.towns = townsData.getTowns();
        $scope.user = userData.getUserProfile();

        $scope.edit = function (user) {
            userData.edit(user)
                .$promise
                .then(
                function success() {
                    notification.showInfo('User profile successfully updated.');
                    $location.path('/user/home');
                },
                function error(error) {
                    notification.showError('User profile is not updated.', error);
                }
            );
        };

        $scope.changePassword = function (pass) {
            userData.changePassword(pass)
                .$promise
                .then(
                function success() {
                    notification.showInfo('Password successfully updated.');
                    $location.path('/user/home');
                },
                function error(error) {
                    notification.showError('Password is not updated.', error);
                }
            );
        }
    }]);


text:
class Syncker
  def ignore_directory? dir
    false
  end

  def ignore_file? file
    false
  end

  def ignore_other? other
    false
  end

  def process_directory dir
  end

  def process_file file
  end

  def process_other other
  end

  def sync_directory dir
    ignore_directory?(dir) || process_directory(dir)
  end

  def sync_file file
    ignore_file?(file) || process_file(file)
  end

  def sync_other other
    ignore_other?(other) || process_other(other)
  end

  def sync pn
    if pn.directory?
      sync_directory pn
    elsif pn.file?
      sync_file pn
    else
      sync_other pn
    end
  end
end


text:
package org.parosproxy.paros.extension.history;

import java.awt.Component;
import javax.swing.JTree;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.db.DatabaseException;
import org.parosproxy.paros.extension.ExtensionPopupMenuItem;
import org.parosproxy.paros.extension.manualrequest.ManualRequestEditorDialog;
import org.parosproxy.paros.model.HistoryReference;
import org.parosproxy.paros.model.SiteNode;
import org.parosproxy.paros.network.HttpMalformedHeaderException;
import org.parosproxy.paros.network.HttpMessage;

/** @deprecated No longer used/needed. It will be removed in a future release. */
@Deprecated
public class PopupMenuResendSites extends ExtensionPopupMenuItem {

    private static final long serialVersionUID = 1L;

    private static final Logger logger = LogManager.getLogger(PopupMenuResendSites.class);

    private JTree treeSite = null;

    private ExtensionHistory extension;

    public PopupMenuResendSites() {
        super();
        initialize();
    }

    /** @param label */
    public PopupMenuResendSites(String label) {
        super(label);
    }

    public void setExtension(ExtensionHistory extension) {
        this.extension = extension;
    }

    /** This method initialises this */
    private void initialize() {
        this.setText(Constant.messages.getString("sites.resend.popup"));

        this.addActionListener(
                new java.awt.event.ActionListener() {

                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent evt) {

                        if (treeSite != null) {
                            SiteNode node = (SiteNode) treeSite.getLastSelectedPathComponent();

                            ManualRequestEditorDialog dialog = extension.getResendDialog();
                            HistoryReference ref = node.getHistoryReference();
                            HttpMessage msg = null;
                            try {
                                msg = ref.getHttpMessage().cloneRequest();
                                dialog.setMessage(msg);
                                dialog.setVisible(true);
                            } catch (HttpMalformedHeaderException | DatabaseException e) {
                                logger.error(e.getMessage(), e);
                            }
                        }
                    }
                });
    }

    @Override
    public boolean isEnableForComponent(Component invoker) {
        treeSite = getTree(invoker);
        if (treeSite != null) {
            SiteNode node = (SiteNode) treeSite.getLastSelectedPathComponent();
            if (node != null && !node.isRoot()) {
                this.setEnabled(true);
            } else {
                this.setEnabled(false);
            }
            return true;
        }
        return false;
    }

    private JTree getTree(Component invoker) {
        if (invoker instanceof JTree) {
            JTree tree = (JTree) invoker;
            if (tree.getName().equals("treeSite")) {
                return tree;
            }
        }

        return null;
    }
}


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

<title>GROW-SUGAR-DELAYED</title>

The environment postpones growing sugar until agents are finished

	collecting it.

	Begin micro-behaviour

GROW-SUGAR-DELAYED

	Begin NetLogo code:

do-after .003
   [add-behaviour GROW-SUGAR]

	End NetLogo code

Related Micro-behaviours

This relies upon

	GROW-SUGAR to do the real work.

How this works

This starts the repeating process of growing sugar .003 time units late

	to ensure that the agents have completed collecting sugar with

	COLLECT-SUGAR.

Source

Based upon page 24 of [1].

History

This was implemented by Ken Kahn.

References

[1] Growing Artificial Societies by Joshua M. Epstein and Robert

	Axtell, Brookings Institute Press, The MIT Press, 1996.


text:
<?php
/**
 *  Localisation cache storage based on PHP files and static arrays.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 */

/**
 * @since 1.26
 */
class LCStoreStaticArray implements LCStore {
	/** @var string|null Current language code. */
	private $currentLang = null;

	/** @var array Localisation data. */
	private $data = array();

	/** @var string File name. */
	private $fname = null;

	/** @var string Directory for cache files. */
	private $directory;

	public function __construct( $conf = array() ) {
		global $wgCacheDirectory;

		if ( isset( $conf['directory'] ) ) {
			$this->directory = $conf['directory'];
		} else {
			$this->directory = $wgCacheDirectory;
		}
	}

	public function startWrite( $code ) {
		$this->currentLang = $code;
		$this->fname = $this->directory . '/' . $code . '.l10n.php';
		$this->data[$code] = array();
		if ( file_exists( $this->fname ) ) {
			$this->data[$code] = require $this->fname;
		}
	}

	public function set( $key, $value ) {
		$this->data[$this->currentLang][$key] = self::encode( $value );
	}

	/**
	 * Encodes a value into an array format
	 *
	 * @param mixed $value
	 * @return array
	 * @throws RuntimeException
	 */
	public static function encode( $value ) {
		if ( is_scalar( $value ) || $value === null ) {
			// [V]alue
			return array( 'v', $value );
		}
		if ( is_object( $value ) ) {
			// [S]erialized
			return array( 's', serialize( $value ) );
		}
		if ( is_array( $value ) ) {
			// [A]rray
			return array( 'a', array_map( function ( $v ) {
				return LCStoreStaticArray::encode( $v );
			}, $value ) );
		}

		throw new RuntimeException( 'Cannot encode ' . var_export( $value, true ) );
	}

	/**
	 * Decode something that was encoded with encode
	 *
	 * @param array $encoded
	 * @return array|mixed
	 * @throws RuntimeException
	 */
	public static function decode( array $encoded ) {
		$type = $encoded[0];
		$data = $encoded[1];

		switch ( $type ) {
		case 'v':
			return $data;
		case 's':
			return unserialize( $data );
		case 'a':
			return array_map( function ( $v ) {
				return LCStoreStaticArray::decode( $v );
			}, $data );
		default:
			throw new RuntimeException(
				'Unable to decode ' . var_export( $encoded, true ) );
		}
	}

	public function finishWrite() {
		file_put_contents(
			$this->fname,
			"<?php\n" .
			"// Generated by LCStoreStaticArray.php -- do not edit!\n" .
			"return " .
			var_export( $this->data[$this->currentLang], true ) . ';'
		);
		$this->currentLang = null;
		$this->fname = null;
	}

	public function get( $code, $key ) {
		if ( !array_key_exists( $code, $this->data ) ) {
			$fname = $this->directory . '/' . $code . '.l10n.php';
			if ( !file_exists( $fname ) ) {
				return null;
			}
			$this->data[$code] = require $fname;
		}
		$data = $this->data[$code];
		if ( array_key_exists( $key, $data ) ) {
			return self::decode( $data[$key] );
		}
		return null;
	}
}


text:
/**
 * @fileoverview Tests for wrap-iife rule.
 * @author Ilya Volodin
 */

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const rule = require("../../../lib/rules/wrap-iife"),
    { RuleTester } = require("../../../lib/rule-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const ruleTester = new RuleTester();

const wrapInvocationError = { messageId: "wrapInvocation", type: "CallExpression" };
const wrapExpressionError = { messageId: "wrapExpression", type: "CallExpression" };
const moveInvocationError = { messageId: "moveInvocation", type: "CallExpression" };

ruleTester.run("wrap-iife", rule, {
    valid: [
        {
            code: "(function(){ }());",
            options: ["any"]
        },
        {
            code: "(function(){ })();",
            options: ["any"]
        },
        {
            code: "(function a(){ }());",
            options: ["any"]
        },
        {
            code: "(function a(){ })();",
            options: ["any"]
        },
        {
            code: "(function(){ }())",
            options: ["any"]
        },
        {
            code: "(function(){ })()",
            options: ["any"]
        },
        {
            code: "(function a(){ }());",
            options: ["outside"]
        },
        {
            code: "(function a(){ })();",
            options: ["inside"]
        },
        {
            code: "foo.bar();",
            options: ["any"]
        },
        {
            code: "var a = function(){return 1;};",
            options: ["any"]
        },
        {
            code: "var a = ((function(){return 1;})());", // always allows existing extra parens (parens both inside and outside)
            options: ["any"]
        },
        {
            code: "var a = ((function(){return 1;})());", // always allows existing extra parens (parens both inside and outside)
            options: ["inside"]
        },
        {
            code: "var a = ((function(){return 1;})());", // always allows existing extra parens (parens both inside and outside)
            options: ["outside"]
        },
        {
            code: "if (function (){}()) {}",
            options: ["any"]
        },
        {
            code: "while (function (){}()) {}",
            options: ["any"]
        },
        {
            code: "do {} while (function (){}())",
            options: ["any"]
        },
        {
            code: "switch (function (){}()) {}",
            options: ["any"]
        },
        {
            code: "with (function (){}()) {}",
            options: ["any"]
        },
        {
            code: "foo(function (){}());",
            options: ["any"]
        },
        {
            code: "new foo(function (){}());",
            options: ["any"]
        },
        {
            code: "import(function (){}());",
            options: ["any"],
            parserOptions: { ecmaVersion: 2020 }
        },
        {
            code: "if ((function (){})()) {}",
            options: ["any"]
        },
        {
            code: "while (((function (){})())) {}",
            options: ["any"]
        },
        {
            code: "if (function (){}()) {}",
            options: ["outside"]
        },
        {
            code: "while (function (){}()) {}",
            options: ["outside"]
        },
        {
            code: "do {} while (function (){}())",
            options: ["outside"]
        },
        {
            code: "switch (function (){}()) {}",
            options: ["outside"]
        },
        {
            code: "with (function (){}()) {}",
            options: ["outside"]
        },
        {
            code: "foo(function (){}());",
            options: ["outside"]
        },
        {
            code: "new foo(function (){}());",
            options: ["outside"]
        },
        {
            code: "import(function (){}());",
            options: ["outside"],
            parserOptions: { ecmaVersion: 2020 }
        },
        {
            code: "if ((function (){})()) {}",
            options: ["outside"]
        },
        {
            code: "while (((function (){})())) {}",
            options: ["outside"]
        },
        {
            code: "if ((function (){})()) {}",
            options: ["inside"]
        },
        {
            code: "while ((function (){})()) {}",
            options: ["inside"]
        },
        {
            code: "do {} while ((function (){})())",
            options: ["inside"]
        },
        {
            code: "switch ((function (){})()) {}",
            options: ["inside"]
        },
        {
            code: "with ((function (){})()) {}",
            options: ["inside"]
        },
        {
            code: "foo((function (){})());",
            options: ["inside"]
        },
        {
            code: "new foo((function (){})());",
            options: ["inside"]
        },
        {
            code: "import((function (){})());",
            options: ["inside"],
            parserOptions: { ecmaVersion: 2020 }
        },
        {
            code: "while (((function (){})())) {}",
            options: ["inside"]
        },
        {
            code: "window.bar = (function() { return 3; }.call(this, arg1));",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "window.bar = (function() { return 3; }).call(this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "window.bar = (function() { return 3; }.apply(this, arg1));",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "window.bar = (function() { return 3; }).apply(this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "window.bar = function() { return 3; }.call(this, arg1);",
            options: ["inside"]
        },
        {
            code: "window.bar = function() { return 3; }.call(this, arg1);",
            options: ["inside", {}]
        },
        {
            code: "window.bar = function() { return 3; }.call(this, arg1);",
            options: ["inside", { functionPrototypeMethods: false }]
        },
        {
            code: "window.bar = function() { return 3; }[call](this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "window.bar = function() { return 3; }[apply](this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "window.bar = function() { return 3; }[foo](this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "var a = function(){return 1;}.bind(this);",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "var a = function(){return 1;}.bind(this).apply(that);",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "var a = ((function(){return 1;}).call());", // always allows existing extra parens (parens both inside and outside)
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "var a = ((function(){return 1;}).call());", // always allows existing extra parens (parens both inside and outside)
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "var a = ((function(){return 1;}).call());", // always allows existing extra parens (parens both inside and outside)
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "if (function (){}.call()) {}",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "while (function (){}.call()) {}",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "do {} while (function (){}.call())",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "switch (function (){}.call()) {}",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "with (function (){}.call()) {}",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "foo(function (){}.call())",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "new foo(function (){}.call())",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "import(function (){}.call())",
            options: ["any", { functionPrototypeMethods: true }],
            parserOptions: { ecmaVersion: 2020 }
        },
        {
            code: "if ((function (){}).call()) {}",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "while (((function (){}).call())) {}",
            options: ["any", { functionPrototypeMethods: true }]
        },
        {
            code: "if (function (){}.call()) {}",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "while (function (){}.call()) {}",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "do {} while (function (){}.call())",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "switch (function (){}.call()) {}",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "with (function (){}.call()) {}",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "foo(function (){}.call())",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "new foo(function (){}.call())",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "import(function (){}.call())",
            options: ["outside", { functionPrototypeMethods: true }],
            parserOptions: { ecmaVersion: 2020 }
        },
        {
            code: "if ((function (){}).call()) {}",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "while (((function (){}).call())) {}",
            options: ["outside", { functionPrototypeMethods: true }]
        },
        {
            code: "if ((function (){}).call()) {}",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "while ((function (){}).call()) {}",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "do {} while ((function (){}).call())",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "switch ((function (){}).call()) {}",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "with ((function (){}).call()) {}",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "foo((function (){}).call())",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "new foo((function (){}).call())",
            options: ["inside", { functionPrototypeMethods: true }]
        },
        {
            code: "import((function (){}).call())",
            options: ["inside", { functionPrototypeMethods: true }],
            parserOptions: { ecmaVersion: 2020 }
        },
        {
            code: "if (((function (){}).call())) {}",
            options: ["inside", { functionPrototypeMethods: true }]
        }
    ],
    invalid: [
        {
            code: "0, function(){ }();",
            output: "0, (function(){ }());",
            errors: [wrapInvocationError]
        },
        {
            code: "[function(){ }()];",
            output: "[(function(){ }())];",
            errors: [wrapInvocationError]
        },
        {
            code: "var a = function(){ }();",
            output: "var a = (function(){ }());",
            errors: [wrapInvocationError]
        },
        {
            code: "(function(){ }(), 0);",
            output: "((function(){ }()), 0);",
            errors: [wrapInvocationError]
        },
        {
            code: "(function a(){ })();",
            output: "(function a(){ }());",
            options: ["outside"],
            errors: [moveInvocationError]
        },
        {
            code: "(function a(){ }());",
            output: "(function a(){ })();",
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "new foo((function (){}()))",
            output: "new foo((function (){})())",
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "new (function (){}())",
            output: "new ((function (){})())", // wrap function expression, but don't remove necessary grouping parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "new (function (){}())()",
            output: "new ((function (){})())()", // wrap function expression, but don't remove necessary grouping parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "if (function (){}()) {}",
            output: "if ((function (){})()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "if ((function (){}())) {}",
            output: "if ((function (){})()) {}", // wrap function expression and remove unnecessary grouping parens around the call expression
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "while (function (){}()) {}",
            output: "while ((function (){})()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "do {} while (function (){}())",
            output: "do {} while ((function (){})())", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "switch (function (){}()) {}",
            output: "switch ((function (){})()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "with (function (){}()) {}",
            output: "with ((function (){})()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "foo(function (){}())",
            output: "foo((function (){})())", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "new foo(function (){}())",
            output: "new foo((function (){})())", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "import(function (){}())",
            output: "import((function (){})())", // wrap function expression, but don't remove mandatory parens
            options: ["inside"],
            parserOptions: { ecmaVersion: 2020 },
            errors: [wrapExpressionError]
        },
        {

            // Ensure all comments get preserved when autofixing.
            code: "( /* a */ function /* b */ foo /* c */ ( /* d */ bar /* e */ ) /* f */ { /* g */ return; /* h */ } /* i */ ( /* j */ baz /* k */) /* l */ ) /* m */ ;",
            output: "( /* a */ function /* b */ foo /* c */ ( /* d */ bar /* e */ ) /* f */ { /* g */ return; /* h */ }) /* i */ ( /* j */ baz /* k */) /* l */  /* m */ ;",
            options: ["inside"],
            errors: [wrapExpressionError]
        },
        {
            code: "( /* a */ function /* b */ foo /* c */ ( /* d */ bar /* e */ ) /* f */ { /* g */ return; /* h */ } /* i */ ) /* j */ ( /* k */ baz /* l */) /* m */ ;",
            output: "( /* a */ function /* b */ foo /* c */ ( /* d */ bar /* e */ ) /* f */ { /* g */ return; /* h */ } /* i */  /* j */ ( /* k */ baz /* l */)) /* m */ ;",
            options: ["outside"],
            errors: [moveInvocationError]
        },
        {
            code: "+function(){return 1;}()",
            output: "+(function(){return 1;}())",
            options: ["outside"],
            errors: [wrapInvocationError]
        },
        {
            code: "+function(){return 1;}()",
            output: "+(function(){return 1;})()",
            options: ["inside"],
            errors: [wrapInvocationError]
        },
        {
            code: "window.bar = function() { return 3; }.call(this, arg1);",
            output: "window.bar = (function() { return 3; }).call(this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapInvocationError]
        },
        {
            code: "window.bar = function() { return 3; }['call'](this, arg1);",
            output: "window.bar = (function() { return 3; })['call'](this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapInvocationError]
        },
        {
            code: "window.bar = function() { return 3; }.call(this, arg1);",
            output: "window.bar = (function() { return 3; }.call(this, arg1));",
            options: ["outside", { functionPrototypeMethods: true }],
            errors: [wrapInvocationError]
        },
        {
            code: "window.bar = (function() { return 3; }.call(this, arg1));",
            output: "window.bar = (function() { return 3; }).call(this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "window.bar = (function() { return 3; }).call(this, arg1);",
            output: "window.bar = (function() { return 3; }.call(this, arg1));",
            options: ["outside", { functionPrototypeMethods: true }],
            errors: [moveInvocationError]
        },
        {
            code: "new (function (){}.call())",
            output: "new ((function (){}).call())", // wrap function expression, but don't remove necessary grouping parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "new (function (){}.call())()",
            output: "new ((function (){}).call())()", // wrap function expression, but don't remove necessary grouping parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "if (function (){}.call()) {}",
            output: "if ((function (){}).call()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "if ((function (){}.call())) {}",
            output: "if ((function (){}).call()) {}", // wrap function expression and remove unnecessary grouping parens around the call expression
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "while (function (){}.call()) {}",
            output: "while ((function (){}).call()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "do {} while (function (){}.call())",
            output: "do {} while ((function (){}).call())", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "switch (function (){}.call()) {}",
            output: "switch ((function (){}).call()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "with (function (){}.call()) {}",
            output: "with ((function (){}).call()) {}", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "foo(function (){}.call())",
            output: "foo((function (){}).call())", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "new foo(function (){}.call())",
            output: "new foo((function (){}).call())", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            errors: [wrapExpressionError]
        },
        {
            code: "import(function (){}.call())",
            output: "import((function (){}).call())", // wrap function expression, but don't remove mandatory parens
            options: ["inside", { functionPrototypeMethods: true }],
            parserOptions: { ecmaVersion: 2020 },
            errors: [wrapExpressionError]
        },

        // Optional chaining
        {
            code: "window.bar = function() { return 3; }.call?.(this, arg1);",
            output: "window.bar = (function() { return 3; }).call?.(this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }],
            parserOptions: { ecmaVersion: 2020 },
            errors: [wrapInvocationError]
        },
        {
            code: "window.bar = function() { return 3; }?.call(this, arg1);",
            output: "window.bar = (function() { return 3; })?.call(this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }],
            parserOptions: { ecmaVersion: 2020 },
            errors: [wrapInvocationError]
        },
        {
            code: "window.bar = (function() { return 3; }?.call)(this, arg1);",
            output: "window.bar = ((function() { return 3; })?.call)(this, arg1);",
            options: ["inside", { functionPrototypeMethods: true }],
            parserOptions: { ecmaVersion: 2020 },
            errors: [wrapInvocationError]
        },
        {
            code: "new (function () {} ?.());",
            output: "new ((function () {}) ?.());",
            options: ["inside"],
            parserOptions: { ecmaVersion: 2020 },
            errors: [wrapExpressionError]
        }
    ]
});


text:
package com.backendless.ucrspoon.login;

import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.backendless.Backendless;
import com.backendless.BackendlessCollection;
import com.backendless.BackendlessUser;
import com.backendless.async.callback.AsyncCallback;
import com.backendless.exceptions.BackendlessFault;
import com.backendless.persistence.BackendlessDataQuery;
import com.backendless.ucrspoon.data.UsersName;
import com.backendless.ucrspoon.data.UsersPopulation;
import com.backendless.ucrspoon.data.crud.common.DefaultCallback;
import com.backendless.ucrspoon.data.crud.common.Defaults;

public class RegisterActivity extends Activity
{
  private final static java.text.SimpleDateFormat SIMPLE_DATE_FORMAT = new java.text.SimpleDateFormat( "yyyy/MM/dd" );

  private EditText emailField;
  private EditText nameField;
  private EditText passwordField;

  private Button registerButton;

  private String email;
  private String name;
  private String password;
  private Integer max_id = -1;
  private UCRSpoonUser user;
  private UsersPopulation usersNumber;
  public void onCreate( Bundle savedInstanceState )
  {
    super.onCreate( savedInstanceState );
    setContentView( R.layout.register );
    //
    Backendless.setUrl( Defaults.SERVER_URL );
    Backendless.initApp( getBaseContext(), Defaults.APPLICATION_ID, Defaults.SECRET_KEY, Defaults.VERSION );
	 BackendlessDataQuery query = new BackendlessDataQuery();
	 UsersPopulation.findAsync( query, new DefaultCallback<BackendlessCollection<UsersPopulation>>( RegisterActivity.this )
	 {
	   @Override
	   public void handleResponse( BackendlessCollection<UsersPopulation> response )
	   {
	     super.handleResponse( response );
	     List<UsersPopulation>lr = response.getCurrentPage();
	     System.out.println(lr.size());
	     if(lr.size()<=0)
	     {
	    	return;
	     }
	     usersNumber = response.getCurrentPage().get( 0 );
	     System.out.println("####################################################");
		 max_id = usersNumber.getPopulation();
	     System.out.println("*****************************************"+max_id);
	     /*
	     usersNumber.setPopulation(max_id+1);
	     usersNumber.saveAsync(new DefaultCallback<UsersPopulation>(RegisterActivity.this)
		{
				@Override
			    public void handleResponse( UsersPopulation response )
				 {
					 showToast("rating updated");
					 //startActivity(i);
					 finish();
				 }
		 } );*/

	     initUI();
	   }
	 } );
    //
  }

  private void initUI()
  {

	emailField = (EditText) findViewById( R.id.emailField );nameField = (EditText) findViewById( R.id.nameField );passwordField = (EditText) findViewById( R.id.passwordField );

    registerButton = (Button) findViewById( R.id.registerButton );

    registerButton.setOnClickListener( new View.OnClickListener()
    {
      @Override
      public void onClick( View view )
      {
        onRegisterButtonClicked();
      }
    } );
  }

  private void onRegisterButtonClicked()
  {
    String emailText = emailField.getText().toString().trim();
    String nameText = nameField.getText().toString().trim();
    String passwordText = passwordField.getText().toString().trim();

    if ( emailText.isEmpty() )
    {
      showToast( "Field 'email' cannot be empty." );
      return;
    }

    if ( passwordText.isEmpty() )
    {
      showToast( "Field 'password' cannot be empty." );
      return;
    }

    if( !emailText.isEmpty() )
    {
      email = emailText;
    }

    if( !nameText.isEmpty() )
    {
      name = nameText;
    }

    if( !passwordText.isEmpty() )
    {
      password = passwordText;
    }

    user = new UCRSpoonUser();

    if( email != null )
    {
      user.setEmail( email );
    }

    if( name != null )
    {
      user.setName( name );
    }

    if( password != null )
    {
      user.setPassword( password );
    }
    if(max_id != -1)
    {
    	user.setUserID(max_id);
    }
    Backendless.Persistence.save( usersNumber, new AsyncCallback<UsersPopulation>() {
	    public void handleResponse( UsersPopulation response )
	    {
	      response.setPopulation(max_id+1);

	      Backendless.Persistence.save( response, new AsyncCallback<UsersPopulation>() {
	        @Override
	        public void handleResponse( UsersPopulation response )
	        {
	          // Contact instance has been updated
	        }
	        @Override
	        public void handleFault( BackendlessFault fault )
	        {
	          // an error has occurred, the error code can be retrieved with fault.getCode()
	        }
	      } );
	    }
	    @Override
	    public void handleFault( BackendlessFault fault )
	    {
	      // an error has occurred, the error code can be retrieved with fault.getCode()
	    }
	  });
    UsersName newUser = new UsersName();
    newUser.setEmail(email);
    newUser.setID(max_id);
    newUser.setName(name);
    Backendless.Persistence.save( newUser, new AsyncCallback<UsersName>() {
        public void handleResponse( UsersName response )
        {
        	// new Contact instance has been saved
        }

        public void handleFault( BackendlessFault fault )
        {
          // an error has occurred, the error code can be retrieved with fault.getCode()
        }
      });
    Backendless.UserService.register( user, new DefaultCallback<BackendlessUser>( RegisterActivity.this )
    {
      @Override
      public void handleResponse( BackendlessUser response )
      {
        super.handleResponse( response );
        Intent intent = new Intent(RegisterActivity.this, RegistrationSuccessActivity.class);
		intent.putExtra("max_id",(Integer)max_id);
        startActivity( intent);
        finish();
      }
    } );
  }

  private void showToast( String msg )
  {
    Toast.makeText( this, msg, Toast.LENGTH_SHORT ).show();
  }
}


text:
ARG TAG
ARG ORG=opencb

FROM $ORG/opencga-init:$TAG

ARG SOLR_VERSION="8.4.0"

# install mongodb, Solr
RUN apk update && \
    apk upgrade && \
    apk add --no-cache bash && \
    apk add --no-cache mongodb && \
    cd /opt/ && \
    wget http://archive.apache.org/dist/lucene/solr/${SOLR_VERSION}/solr-${SOLR_VERSION}.tgz && \
    tar -zxf solr-${SOLR_VERSION}.tgz && \
    rm -r solr-${SOLR_VERSION}.tgz && \
    ln -s solr-* solr

VOLUME ["/data/opencga/mongodb", "/data/opencga/solr", "/opt/opencga/variants", "/opt/opencga/sessions"]
EXPOSE 27017 28017

WORKDIR /opt/scripts
# Copy init.sh which perform initialization setps.
COPY ${BUILD_PATH}/cloud/docker/opencga-demo/init.sh init.sh
COPY ${BUILD_PATH}/cloud/docker/opencga-demo/mongo-cluster-init.js mongo-cluster-init.js

WORKDIR /opt/opencga/bin
ENTRYPOINT ["/bin/bash", "-c", "/opt/scripts/init.sh"]


text:
import PropTypes from 'prop-types';
import React from 'react';
import Relay from 'react-relay/classic';
import classNames from 'classnames';
import DocumentTitle from 'react-document-title';

import Panel from '../shared/Panel';
import Button from '../shared/Button';
import FormRadioGroup from '../shared/FormRadioGroup';
import FormInputLabel from '../shared/FormInputLabel';

import { formatNumber } from '../../lib/number';
import { createCardToken } from '../../lib/credit-card';

import BillingCreditCardForm from './BillingCreditCardForm';

class BillingUpgrade extends React.Component {
  static propTypes = {
    organization: PropTypes.shape({
      name: PropTypes.string.isRequired,
      slug: PropTypes.string.isRequired
    }).isRequired
  };

  state = {
    saving: false,
    creditCardErrors: null,
    plan: "standard",
    interval: "monthly"
  }

  constructor(initialProps) {
    super(initialProps);

    // We'll store credit card details here as they change
    this.creditCard = {};

    // Set default form state from data boostrapped on the page
    this.state = { form: window._billing["form"], summary: window._billing["summary"] };
  }

  render() {
    return (
      <DocumentTitle title={`Upgrade · ${this.props.organization.name}`}>
        <form
          action={`/organizations/${this.props.organization.slug}/billing/upgrade`}
          acceptCharset=""
          method="POST"
          ref={(form) => this.form = form}
          onSubmit={this.handleFormSubmit}
        >
          <input type="hidden" name="utf8" value="✓" />
          <input type="hidden" name="_method" value="put" />
          <input type="hidden" name={window._csrf.param} value={window._csrf.token} />

Upgrade your Subscription

You can learn more about the different plans on the pricing page.

              <Panel>
                <Panel.Section>
                  <FormInputLabel label="Which plan do you want?" required={true} />

                      {this.renderPlan("standard", window._billing["plans"]["standard"])}

                      {this.renderPlan("enterprise", window._billing["plans"]["enterprise"])}

                </Panel.Section>

                <Panel.Section>
                  <FormRadioGroup
                    name="upgrade[interval]"
                    label="How often do you want to be billed?"
                    value={this.state.form.interval}
                    onChange={this.handleIntervalChange}
                    required={true}
                    options={[
                      { label: "Monthly", value: "monthly", help: "Pay month-to-month" },
                      { label: "Yearly", value: "yearly", help: "Pay for a year up front and get a discount", badge: `Save ${window._billing["intervals"]["yearly"]["discount"]}%` }
                    ]}
                  />
                </Panel.Section>

                <Panel.Section>
                  Subscription Summary

                  {this.renderSummary()}

                </Panel.Section>

                <BillingCreditCardForm disabled={this.state.saving} onChange={this.handleCreditCardFormChange} errors={this.state.creditCardErrors} />

                <Panel.Footer>
                  <Button loading={this.state.saving && "Upgrading…"} theme="success">Upgrade</Button>
                </Panel.Footer>
              </Panel>

          {this.renderCreditCardHiddenInputs()}
        </form>
      </DocumentTitle>
    );
  }

  renderCreditCardHiddenInputs() {
    const inputs = [];

    if (this.state.creditCardResponse) {
      for (const key in this.state.creditCardResponse) {
        inputs.push(
          <input type="hidden" name={`upgrade[credit_card][${key}]`} value={this.state.creditCardResponse[key]} key={key} />
        );
      }
    }

    return inputs;
  }

  renderSummary() {
    const interval = this.state.summary.interval === "monthly" ? "per month" : "per year";

    return (

        {this.state.summary.items.map((item, index) => {
          return (

{item["label"]}

{item["description"]}

${formatNumber(item["price"] / 100)}

          );
        })}

${formatNumber(this.state.summary.price / 100)} {interval}

    );
  }

  renderPlan(id, plan) {
    const price = plan["price"] / 100;
    const limits = [];
    const features = [];

    limits.push(
      {formatNumber(plan.limits["agents"])} connected agents,
      {formatNumber(plan.limits["users"])} included users,
      {plan.limits["builds_per_month"] ? formatNumber(plan.limits["builds_per_month"]) : "Unlimited"} builds per month
    );

    if (plan.features["custom_retention"]) {
      limits.push(
        Customizable retention
      );
    } else {
      limits.push(
        {formatNumber(plan.limits["data_retention_days"])} days retention
      );
    }

    if (plan.features["chat_support"] && plan.features["priority_support"]) {
      features.push(
        {this.renderTick()}Priority email + chat support
      );
    } else {
      features.push(
        {this.renderTick()}Priority email support
      );
    }

    features.push(
      this.renderFeature(plan, "account_manager", "Account manager"),
      this.renderFeature(plan, "audit_logging", "Audit logging"),
      this.renderFeature(plan, "uptime_sla", "99.95% uptime SLA"),
      this.renderFeature(plan, "bank_transfer", "Invoice payment")
    );

    const selected = (this.state.form.plan === id);
    const classes = classNames("p3", { "bg-silver": selected });

    return (

            <input type="radio" name="upgrade[plan]" value={id} onChange={this.handlePlanChange} checked={selected} className="radio" />

{plan["label"]}

${price} per month

              {limits.map((el, idx) =>
{el}
)}

              {features.map((el, idx) =>
{el}
)}

    );
  }

  renderFeature(plan, feature, label) {
    if (plan.features[feature]) {
      return (
        {this.renderTick()}{label}
      );
    }
    return (
      ✖{label}
    );

  }

  renderTick() {
    return (
      ✔
    );
  }

  refetchSummaryData() {
    fetch(`/organizations/${this.props.organization.slug}/billing/upgrade/summary`, {
      credentials: 'same-origin',
      method: 'post',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'X-CSRF-Token': window._csrf.token
      },
      body: JSON.stringify(this.state.form)
    }).then((response) => {
      response.json().then((json) => {
        this.setState({ refreshing: false, summary: json });
      });
    });
  }

  handleFormSubmit = (event) => {
    event.preventDefault();

    // Switch the form to "saving" and clear and errors
    this.setState({ saving: true, creditCardErrors: [] });

    createCardToken(this.creditCard)
      .then((response) => {
        // Setting `creditCardResponse` render in a bunch of hidden fields that
        // contain all the credit card information we're allowed to save. Once
        // the render has finished, we can finally submit the form.
        this.setState({ creditCardResponse: response }, () => {
          this.form.submit();
        });
      }).catch((exception) => {
        this.setState({ creditCardErrors: exception.errors, saving: false });
      });
  };

  handlePlanChange = (event) => {
    const form = this.state.form;
    form.plan = event.target.value;

    this.setState({ refreshing: true, form: form });
    this.refetchSummaryData();
  };

  handleIntervalChange = (event) => {
    const form = this.state.form;
    form.interval = event.target.value;

    this.setState({ refreshing: true, form: form });
    this.refetchSummaryData();
  };

  handleCreditCardFormChange = (field, value) => {
    this.creditCard[field] = value;
  };
}

export default Relay.createContainer(BillingUpgrade, {
  fragments: {
    organization: () => Relay.QL`
      fragment on Organization {
        name
        slug
      }
    `
  }
});


text:
package org.jusecase.properties.ui;
import javax.swing.*;

public class NativeJFileChooser extends JFileChooser {
    // TODO find a way with java 11
}


text:
namespace hmLib {
	namespace iterators {
		namespace detail {
			template<typename iterator_, bool is_random_access_iterator_ = std::is_same<typename std::iterator_traits<iterator_>::iterator_category, std::random_access_iterator_tag>::value>
			struct range_impl {
				using iterator = iterator_;
				using range_category = typename std::iterator_traits<iterator>::iterator_category;
				using value_type = typename std::iterator_traits<iterator>::value_type;
				using reference = typename std::iterator_traits<iterator>::reference;
				using pointer = typename std::iterator_traits<iterator>::pointer;
				using difference_type = typename std::iterator_traits<iterator>::difference_type;
			public:
				range_impl() = default;
				range_impl(const iterator& Beg_, const iterator& End_):Beg(Beg_), End(End_) {}
				range_impl(iterator&& Beg_, iterator&& End_):Beg(std::move(Beg_)), End(std::move(End_)) {}
				iterator begin() { return Beg; }
				iterator end() { return End; }
			private:
				iterator Beg;
				iterator End;
			};
			template<typename iterator_>
			struct range_impl<iterator_, true> {
				using iterator = iterator_;
				using range_category = typename std::iterator_traits<iterator>::iterator_category;
				using value_type = typename std::iterator_traits<iterator>::value_type;
				using reference = typename std::iterator_traits<iterator>::reference;
				using pointer = typename std::iterator_traits<iterator>::pointer;
				using difference_type = typename std::iterator_traits<iterator>::difference_type;
			public:
				range_impl() = default;
				range_impl(const iterator& Beg_, const iterator& End_):Beg(Beg_), End(End_) {}
				range_impl(iterator&& Beg_, iterator&& End_):Beg(std::move(Beg_)), End(std::move(End_)) {}
				iterator begin() { return Beg; }
				iterator end() { return End; }
				reference operator[](difference_type n) { return Beg[n]; }
				reference at(difference_type n) {
					hmLib_assert(n < size() && 0 <= n, hmLib::access_exceptions::out_of_range_access, "out of range.");
					return Beg[n];
				}
				difference_type size() { return std::distance(Beg, End); }
			private:
				iterator Beg;
				iterator End;
			};
		}
	}
	template<typename iterator_, typename iterator_category_ = typename std::iterator_traits<iterator_>::iterator_category>
	using range = iterators::detail::range_impl<iterator_>;

	template<typename iterator_>
	auto make_range(iterator_&& Beg, iterator_&& End) {
		return range<typename std::decay<iterator_>::type>(std::forward<iterator_>(Beg), std::forward<iterator_>(End));
	}
}
#
#endif


text:
package org.apache.cordova.test;

import android.view.KeyEvent;
import android.view.inputmethod.BaseInputConnection;

public class BackButtonMultiPageTest extends BaseCordovaIntegrationTest {
  private static final String START_URL = "file:///android_asset/www/backbuttonmultipage/index.html";

  @Override
  public void setUp() throws Exception {
      super.setUp();
      setUpWithStartUrl(START_URL);
  }

  public void testViaHref() throws Throwable {
      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              cordovaWebView.sendJavascript("window.location = 'sample2.html';");
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              cordovaWebView.sendJavascript("window.location = 'sample3.html';");          }
      });

      assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              assertTrue(cordovaWebView.backHistory());
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              assertTrue(cordovaWebView.backHistory());
          }
      });
      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              assertFalse(cordovaWebView.backHistory());
          }
      });
  }

  public void testViaLoadUrl() throws Throwable {
      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              assertTrue(cordovaWebView.backHistory());
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              assertTrue(cordovaWebView.backHistory());
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/index.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              assertFalse(cordovaWebView.backHistory());
          }
      });
  }

  public void testViaBackButtonOnView() throws Throwable {
      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run() {
              cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run() {
              cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              String url = cordovaWebView.getUrl();
              assertTrue(url.endsWith("sample3.html"));
              BaseInputConnection viewConnection = new BaseInputConnection(cordovaWebView.getView(), true);
              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK);
              viewConnection.sendKeyEvent(backDown);
              viewConnection.sendKeyEvent(backUp);
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run()
          {
              String url = cordovaWebView.getUrl();
              assertTrue(url.endsWith("sample2.html"));
              BaseInputConnection viewConnection = new BaseInputConnection(cordovaWebView.getView(), true);
              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK);
              viewConnection.sendKeyEvent(backDown);
              viewConnection.sendKeyEvent(backUp);
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/index.html", testActivity.onPageFinishedUrl.take());
  }

  public void testViaBackButtonOnLayout() throws Throwable {
      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run() {
              cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run() {
              cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run() {
              String url = cordovaWebView.getUrl();
              assertTrue(url.endsWith("sample3.html"));
              BaseInputConnection viewConnection = new BaseInputConnection(containerView, true);
              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK);
              viewConnection.sendKeyEvent(backDown);
              viewConnection.sendKeyEvent(backUp);
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", testActivity.onPageFinishedUrl.take());
      runTestOnUiThread(new Runnable() {
          public void run() {
              String url = cordovaWebView.getUrl();
              assertTrue(url.endsWith("sample2.html"));
              BaseInputConnection viewConnection = new BaseInputConnection(containerView, true);
              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK);
              viewConnection.sendKeyEvent(backDown);
              viewConnection.sendKeyEvent(backUp);
          }
      });
      assertEquals("file:///android_asset/www/backbuttonmultipage/index.html", testActivity.onPageFinishedUrl.take());
  }
}


text:
import{a as e}from"./chunk-WA4H3QPQ.js";function a(n){return e({cmd:"onlineplayers",page:n})}export{a};
//# sourceMappingURL=chunk-LPMVISKG.js.map


text:
'use strict';

describe('Instances Controller :: Listings', function() {

  beforeEach(module('roboconf.utils'));
  beforeEach(module('roboconf.instances'));

  // Create the controller with a new scope
  var ctrl, scope, httpBackend;
  beforeEach(inject(function($controller, $rootScope, $httpBackend) {

    // Restangular use the HTTP service.
    // We use Angular's mock and make sure any GET response returns an empty array.
    // This empty arrays will be used as the initial value for the instances list.
    httpBackend = $httpBackend;
    httpBackend.whenGET(/.*/g).respond([]);
    this.routeParams = {appName: 'test'};

    // Create a scope and instantiate our controller.
    // Do not forget to invoke $httpBackend.flush() to "speed up" asynchronous calls.
    scope = $rootScope.$new();
    ctrl = $controller('InstancesListingController', {$scope: scope, $routeParams: this.routeParams});
    httpBackend.flush();

    // Since there are asynchronous calls (and promises),
    // all the test methods will need to invoke done() at the end.
  }));

  it('should be initialized correctly', function(done) {
    expect(ctrl).to.exist;
    expect(scope.searchVisible).to.be.true;
    expect(scope.searchFilter).to.equal('');
    expect(scope.app.name).to.equal('test');
    expect(scope.rootNodes).to.be.empty;
    done();
  });

  it('should find a description for all the states', function(done) {
    expect(scope.formatStatus('NOT_DEPLOYED')).to.be.not.empty;
    expect(scope.formatStatus('STARTING')).to.be.not.empty;
    expect(scope.formatStatus('STOPPING')).to.be.not.empty;
    expect(scope.formatStatus('DEPLOYING')).to.be.not.empty;
    expect(scope.formatStatus('UNDEPLOYING')).to.be.not.empty;
    expect(scope.formatStatus('DEPLOYED_STOPPED')).to.be.not.empty;
    expect(scope.formatStatus('DEPLOYED_STARTED')).to.be.not.empty;
    expect(scope.formatStatus('UNRESOLVED')).to.be.not.empty;
    expect(scope.formatStatus('PROBLEM')).to.be.not.empty;
    expect(scope.formatStatus('CUSTOM')).to.be.not.empty;
    expect(scope.formatStatus('not a valid state')).to.be.empty;
    done();
  });

  it('should recognize a node to hide', function(done) {

    // No selected instance
    expect(scope.isNodeToHide('/vm')).to.be.false;

    // Selected instance has no 'path' property
    scope.selectedInstance = '';
    scope.$digest();
    expect(scope.isNodeToHide('/vm')).to.be.false;

    // Selected instance has a 'path' property
    scope.selectedInstance = {path: '/vm-aws'};
    scope.$digest();
    expect(scope.isNodeToHide('/vm-aws')).to.be.false;
    expect(scope.isNodeToHide('/vm')).to.be.true;
    expect(scope.isNodeToHide('/vm/server2')).to.be.true;
    expect(scope.isNodeToHide('/vm-aws/test')).to.be.true;
    expect(scope.isNodeToHide('/vm-aws-test')).to.be.true;

    // Selected instance is a child one
    scope.selectedInstance = {path: '/vm-aws/server'};
    scope.$digest();
    expect(scope.isNodeToHide('/vm-aws')).to.be.false;
    expect(scope.isNodeToHide('/vm-aws/server')).to.be.false;
    expect(scope.isNodeToHide('/vm-aws/server2')).to.be.true;
    expect(scope.isNodeToHide('/vm-aws/server/does/not/make/sense/for/this/fct')).to.be.true;
    expect(scope.isNodeToHide('/vm/server2')).to.be.true;

    done();
  });
});


text:
require_relative '../lib/docusign_rest'

DocusignRest.configure do |config|
  config.username       = 'jonkinney@gmail.com'
  config.password       = 'MnUWneAH3xqL2G'
  config.integrator_key = 'NAXX-93c39e8c-36c4-4cb5-8099-c4fcedddd7ad'
  config.account_id     = '327367'
  config.endpoint       = 'https://demo.docusign.net/restapi'
  config.api_version    = 'v2'
end


text:
package com.arondor.common.reflection.parser.spring;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.config.TypedStringValue;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.support.ManagedMap;
import org.springframework.context.expression.BeanExpressionContextAccessor;
import org.springframework.context.expression.BeanFactoryAccessor;
import org.springframework.context.expression.EnvironmentAccessor;
import org.springframework.context.expression.MapAccessor;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;

import com.arondor.common.reflection.api.hash.HashHelper;
import com.arondor.common.reflection.model.config.ElementConfiguration;
import com.arondor.common.reflection.model.config.ListConfiguration;
import com.arondor.common.reflection.model.config.MapConfiguration;
import com.arondor.common.reflection.model.config.ObjectConfiguration;
import com.arondor.common.reflection.model.config.ObjectConfigurationFactory;
import com.arondor.common.reflection.model.config.PrimitiveConfiguration;
import com.arondor.common.reflection.model.config.ReferenceConfiguration;

abstract class BeanPropertyParser
{
    private static final Logger LOGGER = Logger.getLogger(BeanPropertyParser.class);

    private final HashHelper hashHelper;

    private final ObjectConfigurationFactory objectConfigurationFactory;

    private boolean enableSPEL = true;

    public BeanPropertyParser(HashHelper hashHelper, ObjectConfigurationFactory objectConfigurationFactory)
    {
        this.hashHelper = hashHelper;
        this.objectConfigurationFactory = objectConfigurationFactory;
    }

    public ElementConfiguration parseProperty(Object value)
    {
        LOGGER.debug("value : " + value);
        if (value instanceof TypedStringValue)
        {
            TypedStringValue stringValue = (TypedStringValue) value;
            if (stringValue.getTargetTypeName() != null)
            {
                return getEnumObjectConfiguration(stringValue);
            }
            else
            {
                PrimitiveConfiguration primitiveConfiguration = objectConfigurationFactory
                        .createPrimitiveConfiguration();
                if (useSPEL(stringValue))
                {
                    ExpressionParser parser = new SpelExpressionParser();
                    String expAsStringWithToken = stringValue.getValue().trim();
                    String expAsString = expAsStringWithToken.substring(2, expAsStringWithToken.length() - 1).trim();
                    LOGGER.trace("This property is a SPEL expression: " + expAsString);

                    Expression exp = parser.parseExpression(expAsString);
                    StandardEvaluationContext sec = null;
                    if (sec == null)
                    {
                        sec = new StandardEvaluationContext();
                        sec.addPropertyAccessor(new EnvironmentAccessor());
                        sec.addPropertyAccessor(new BeanExpressionContextAccessor());
                        sec.addPropertyAccessor(new BeanFactoryAccessor());
                        sec.addPropertyAccessor(new MapAccessor());
                    }
                    primitiveConfiguration.setValue(String.valueOf(exp.getValue()));
                }
                else
                {
                    LOGGER.trace("This property is NOT a SPEL expression: " + stringValue.getValue());
                    primitiveConfiguration.setValue(stringValue.getValue());
                }
                return primitiveConfiguration;
            }
        }
        else if (value instanceof RuntimeBeanReference)
        {
            RuntimeBeanReference beanReference = (RuntimeBeanReference) value;
            ReferenceConfiguration referenceConfiguration = objectConfigurationFactory.createReferenceConfiguration();
            referenceConfiguration.setReferenceName(beanReference.getBeanName());
            return referenceConfiguration;
        }
        else if (value instanceof ManagedList<?>)
        {
            return parseValueList((ManagedList<?>) value);
        }
        else if (value instanceof ManagedMap<?, ?>)
        {
            return parseValueMap((ManagedMap<?, ?>) value);
        }
        else if (value instanceof BeanDefinitionHolder)
        {
            BeanDefinitionHolder beanDefinitionHolder = (BeanDefinitionHolder) value;
            return parseBeanDefinition(beanDefinitionHolder.getBeanDefinition());
        }
        else
        {
            throw new UnsupportedOperationException("The type of property value is not suppported : " + value
                    + " (class : " + value.getClass().getName() + ")");
        }
    }

    private boolean useSPEL(TypedStringValue stringValue)
    {
        if (!enableSPEL || stringValue == null || stringValue.getValue() == null)
        {
            return false;
        }
        String trimmedValue = stringValue.getValue().trim();
        return trimmedValue.startsWith("#{") && trimmedValue.endsWith("}");
    }

    private ObjectConfiguration getEnumObjectConfiguration(TypedStringValue stringValue)
    {
        ObjectConfiguration enumObjectConfiguration = objectConfigurationFactory.createObjectConfiguration();
        enumObjectConfiguration.setClassName(hashHelper.hashClassName(stringValue.getTargetTypeName()));
        enumObjectConfiguration.setConstructorArguments(new ArrayList<ElementConfiguration>());

        PrimitiveConfiguration enumFieldConfiguration = objectConfigurationFactory
                .createPrimitiveConfiguration(stringValue.getValue());
        enumObjectConfiguration.getConstructorArguments().add(enumFieldConfiguration);
        return enumObjectConfiguration;
    }

    private ElementConfiguration parseValueList(ManagedList<?> value)
    {
        return parseBeanList(value);
    }

    private ElementConfiguration parseValueMap(ManagedMap<?, ?> value)
    {
        MapConfiguration mapConfiguration = objectConfigurationFactory.createMapConfiguration();
        mapConfiguration.setMapConfiguration(new HashMap<ElementConfiguration, ElementConfiguration>());

        for (Entry<?, ?> entry : value.entrySet())
        {
            LOGGER.debug("entry key=" + entry.getKey() + ", value=" + entry.getValue());
            ElementConfiguration keyConfiguration = parseBeanObject(entry.getKey());
            ElementConfiguration valueConfiguration = parseBeanObject(entry.getValue());
            mapConfiguration.getMapConfiguration().put(keyConfiguration, valueConfiguration);
        }

        return mapConfiguration;
    }

    private ElementConfiguration parseBeanObject(Object item)
    {
        if (item instanceof TypedStringValue)
        {
            TypedStringValue stringValue = (TypedStringValue) item;
            ElementConfiguration primitiveConfiguration = objectConfigurationFactory
                    .createPrimitiveConfiguration(stringValue.getValue());
            return primitiveConfiguration;
        }
        else if (item instanceof RuntimeBeanReference)
        {
            RuntimeBeanReference runtimeBeanReference = (RuntimeBeanReference) item;
            ReferenceConfiguration reference = objectConfigurationFactory.createReferenceConfiguration();
            reference.setReferenceName(runtimeBeanReference.getBeanName());
            return reference;
        }
        else if (item instanceof BeanDefinitionHolder)
        {
            BeanDefinitionHolder beanDefinitionHolder = (BeanDefinitionHolder) item;
            return parseBeanDefinition(beanDefinitionHolder.getBeanDefinition());
        }
        else
        {
            throw new IllegalArgumentException("Not supported : item class " + item.getClass().getName());
        }

    }

    private ElementConfiguration parseBeanList(ManagedList<?> managedList)
    {
        ListConfiguration listConfiguration = objectConfigurationFactory.createListConfiguration();
        listConfiguration.setListConfiguration(new ArrayList<ElementConfiguration>());

        for (Object item : managedList)
        {
            ElementConfiguration elementConfiguration = parseBeanObject(item);
            listConfiguration.getListConfiguration().add(elementConfiguration);
        }
        return listConfiguration;
    }

    public abstract ObjectConfiguration parseBeanDefinition(String beanDefinitionName);

    public abstract ObjectConfiguration parseBeanDefinition(BeanDefinition beanDefinition);

    public boolean isEnableSPEL()
    {
        return enableSPEL;
    }

    public void setEnableSPEL(boolean enableSPEL)
    {
        this.enableSPEL = enableSPEL;
    }
}


text:
package com.ipvans.flickrgallery.domain;

public class UpdateEvent {
    private final String tags;
    private final boolean force;

    public UpdateEvent(String tags, boolean force) {
        this.tags = tags;
        this.force = force;
    }

    public String getTags() {
        return tags;
    }

    public boolean isForced() {
        return force;
    }
}


text:
"""
Authentication is implemented using flask_login and different environments can
implement their own login mechanisms by providing an `airflow_login` module
in their PYTHONPATH. airflow_login should be based off the
`airflow.www.login`
"""
from builtins import object
__version__ = "1.5.1"

import logging
import os
import sys
from airflow.configuration import conf
from airflow.models import DAG
from flask.ext.admin import BaseView

DAGS_FOLDER = os.path.expanduser(conf.get('core', 'DAGS_FOLDER'))
if DAGS_FOLDER not in sys.path:
    sys.path.append(DAGS_FOLDER)

from airflow import default_login as login
if conf.getboolean('webserver', 'AUTHENTICATE'):
    try:
        # Environment specific login
        import airflow_login as login
    except ImportError:
        logging.error(
            "authenticate is set to True in airflow.cfg, "
            "but airflow_login failed to import")

class AirflowViewPlugin(BaseView):
    pass

class AirflowMacroPlugin(object):
    def __init__(self, namespace):
        self.namespace = namespace

from airflow import operators
from airflow import hooks
from airflow import executors
from airflow import macros

operators.integrate_plugins()
hooks.integrate_plugins()
macros.integrate_plugins()


text:
<?php

/*
 * This file is part of Sulu.
 *
 * (c) Sulu GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sulu\Bundle\ArticleBundle\DependencyInjection;

/**
 * Will be raised when the default template for article wont be found.
 */
class DefaultArticleTypeNotFoundException extends \Exception
{
    /**
     * @var string
     */
    private $type;

    /**
     * @var string
     */
    private $structureType;

    public function __construct(string $type, string $structureType, \Exception $previous)
    {
        parent::__construct(sprintf('Default "%s" template "%s" was not found.', $type, $structureType), 0, $previous);

        $this->structureType = $structureType;
        $this->type = $type;
    }

    /**
     * Returns type.
     */
    public function getType(): string
    {
        return $this->type;
    }

    /**
     * Returns structure-type.
     */
    public function getStructureType(): string
    {
        return $this->structureType;
    }
}


text:
package org.apache.qpid.proton.engine.jni;

import org.apache.qpid.proton.ProtonCEquivalent;
import org.apache.qpid.proton.engine.Connection;
import org.apache.qpid.proton.engine.EngineFactory;
import org.apache.qpid.proton.engine.SslDomain;
import org.apache.qpid.proton.engine.SslPeerDetails;
import org.apache.qpid.proton.engine.Transport;
import org.apache.qpid.proton.jni.JNIFactory;

public class JNIEngineFactory extends JNIFactory implements EngineFactory
{
    @Override
    @ProtonCEquivalent("pn_connection")
    public Connection createConnection()
    {
        return new JNIConnection();
    }

    @Override
    public Transport createTransport()
    {
        return new JNITransport();
    }

    @Override
    public SslDomain createSslDomain()
    {
        return new JNISslDomain();
    }

    @Override
    public SslPeerDetails createSslPeerDetails(final String hostname, final int port)
    {
        return new SslPeerDetails()
        {

            @Override
            public int getPort()
            {
                return port;
            }

            @Override
            public String getHostname()
            {
                return hostname;
            }
        };
    }
}