text:
'use strict';

const path = require('path');

const RE_ILLEGAL_ID = /[\- .*]/g;

/**
 * Set BUDDY env 'key'
 * @param {String} key
 * @param {String|Array} value
 * @param {String} [id]
 */
module.exports = function env(key, value, id) {
  id = id != null ? id.replace(RE_ILLEGAL_ID, '').toUpperCase() + '_' : '';
  if (!Array.isArray(value)) value = [value];

  value = value.reduce(
    (value, item) => {
      const isFile = 'object' == typeof item && 'extension' in item;

      switch (key) {
        case 'INPUT':
          value += isFile ? path.relative(process.cwd(), item.filepath) : item;
          break;
        case 'INPUT_HASH':
          value += isFile ? item.hash : item;
          break;
        case 'INPUT_DATE':
          value += isFile ? item.date : item;
          break;
        case 'OUTPUT':
          value += isFile ? path.relative(process.cwd(), item.writepath) : item;
          break;
        case 'OUTPUT_HASH':
          value += isFile ? item.writeHash : item;
          break;
        case 'OUTPUT_DATE':
          value += isFile ? item.writeDate : item;
          break;
        case 'OUTPUT_URL':
          value += isFile ? item.writeUrl : item;
          break;
      }

      return value;
    },
    ''
  );
  // console.log(`BUDDY_${id}${key}`, value);
  process.env[`BUDDY_${id}${key}`] = value;
};


text:
package org.cagrid.data.sdkquery41.style.wizard;

import gov.nih.nci.cagrid.common.portal.DocumentChangeAdapter;
import gov.nih.nci.cagrid.common.portal.validation.IconFeedbackPanel;
import gov.nih.nci.cagrid.data.ui.wizard.AbstractWizardPanel;
import gov.nih.nci.cagrid.data.ui.wizard.OneTimeInfoDialogUtil;
import gov.nih.nci.cagrid.introduce.beans.extension.ServiceExtensionDescriptionType;
import gov.nih.nci.cagrid.introduce.common.ResourceManager;
import gov.nih.nci.cagrid.introduce.common.ServiceInformation;

import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.Properties;
import java.util.SortedSet;
import java.util.TreeSet;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.table.DefaultTableModel;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cagrid.data.sdkquery41.style.wizard.config.GeneralConfigurationStep;
import org.cagrid.grape.utils.CompositeErrorDialog;

import com.jgoodies.validation.Severity;
import com.jgoodies.validation.ValidationResult;
import com.jgoodies.validation.ValidationResultModel;
import com.jgoodies.validation.message.SimpleValidationMessage;
import com.jgoodies.validation.util.DefaultValidationResultModel;
import com.jgoodies.validation.util.ValidationUtils;
import com.jgoodies.validation.view.ValidationComponentUtils;

/**
 * GeneralConfigurationPanel
 * Prompts the service developer to supply some configuration information
 * which will be used to set up the query processor
 *
 * @author David
 */
public class GeneralConfigurationPanel extends AbstractWizardPanel {

    private static Log LOG = LogFactory.getLog(GeneralConfigurationPanel.class);

    private static final String KEY_SDK_DIRECTORY = "caCORE SDK Directory";

    private IconFeedbackPanel validationOverlayPanel = null;
    private ValidationResultModel validationModel = null;
    private GeneralConfigurationStep configuration = null;

    private JPanel mainPanel = null;
    private JLabel sdkDirLabel = null;
    private JTextField sdkDirTextField = null;
    private JButton sdkDirBrowseButton = null;
    private JLabel propertiesFileLabel = null;
    private JTextField propertiesFileTextField = null;
    private JTable propertiesTable = null;
    private JScrollPane propertiesTableScrollPane = null;

    public GeneralConfigurationPanel(ServiceExtensionDescriptionType extensionDescription, ServiceInformation info) {
        super(extensionDescription, info);
        this.validationModel = new DefaultValidationResultModel();
        this.configuration = new GeneralConfigurationStep(info);
        initialize();
    }

    public String getPanelShortName() {
        return "SDK Directory";
    }

    public String getPanelTitle() {
        return "caCORE SDK Directory Selection";
    }

    public void update() {
        // This method is (mostly) blank, since it's the first panel to run,
        // and no other panel changes the values used by this panel
        validateInput();
        populateDeployProperties();
    }

    public void movingNext() {
        // called when the 'next' button is clicked
        // causes the configuration to be applied, which involves copying around jars,
        // creating new ones for the config files, etc.
        try {
            configuration.applyConfiguration();
        } catch (Exception ex) {
            ex.printStackTrace();
            CompositeErrorDialog.showErrorDialog("Error applying general configuration", ex.getMessage(), ex);
        }
    }

    private void initialize() {
        configureValidation();
        this.setLayout(new GridLayout());
        this.add(getValidationOverlayPanel());
    }

    private IconFeedbackPanel getValidationOverlayPanel() {
        if (validationOverlayPanel == null) {
            validationOverlayPanel = new IconFeedbackPanel(validationModel, getMainPanel());
        }
        return validationOverlayPanel;
    }

    private JPanel getMainPanel() {
        if (mainPanel == null) {
            mainPanel = new JPanel();
            GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
            gridBagConstraints5.fill = GridBagConstraints.BOTH;
            gridBagConstraints5.gridy = 2;
            gridBagConstraints5.weightx = 1.0;
            gridBagConstraints5.weighty = 1.0;
            gridBagConstraints5.gridwidth = 3;
            gridBagConstraints5.insets = new Insets(2, 2, 2, 2);
            gridBagConstraints5.gridx = 0;
            GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
            gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
            gridBagConstraints4.gridy = 1;
            gridBagConstraints4.weightx = 1.0;
            gridBagConstraints4.insets = new Insets(2, 2, 2, 2);
            gridBagConstraints4.gridwidth = 2;
            gridBagConstraints4.gridx = 1;
            GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
            gridBagConstraints3.gridx = 0;
            gridBagConstraints3.anchor = GridBagConstraints.WEST;
            gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
            gridBagConstraints3.gridy = 1;
            GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
            gridBagConstraints2.gridx = 2;
            gridBagConstraints2.insets = new Insets(2, 2, 2, 2);
            gridBagConstraints2.gridy = 0;
            GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
            gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
            gridBagConstraints1.gridy = 0;
            gridBagConstraints1.weightx = 1.0;
            gridBagConstraints1.insets = new Insets(2, 2, 2, 2);
            gridBagConstraints1.gridx = 1;
            GridBagConstraints gridBagConstraints = new GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.insets = new Insets(2, 2, 2, 2);
            gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
            gridBagConstraints.anchor = GridBagConstraints.WEST;
            gridBagConstraints.gridy = 0;
            mainPanel.setLayout(new GridBagLayout());
            mainPanel.add(getSdkDirLabel(), gridBagConstraints);
            mainPanel.add(getSdkDirTextField(), gridBagConstraints1);
            mainPanel.add(getSdkDirBrowseButton(), gridBagConstraints2);
            mainPanel.add(getPropertiesFileLabel(), gridBagConstraints3);
            mainPanel.add(getPropertiesFileTextField(), gridBagConstraints4);
            mainPanel.add(getPropertiesTableScrollPane(), gridBagConstraints5);
        }
        return mainPanel;
    }

    /**
     * This method initializes sdkDirLabel
     *
     * @return javax.swing.JLabel
     */
    private JLabel getSdkDirLabel() {
        if (sdkDirLabel == null) {
            sdkDirLabel = new JLabel();
            sdkDirLabel.setText("caCORE SDK Directory:");
        }
        return sdkDirLabel;
    }

    /**
     * This method initializes sdkDirTextField
     *
     * @return javax.swing.JTextField
     */
    private JTextField getSdkDirTextField() {
        if (sdkDirTextField == null) {
            sdkDirTextField = new JTextField();
            sdkDirTextField.setToolTipText("The directory in which the caCORE SDK 4.1 resides");
            sdkDirTextField.setEditable(false);
            sdkDirTextField.getDocument().addDocumentListener(new DocumentChangeAdapter() {
                public void documentEdited(DocumentEvent e) {
                    configuration.setSdkDirectory(new File(getSdkDirTextField().getText()));
                    validateInput();
                    populateDeployProperties();
                }
            });
        }
        return sdkDirTextField;
    }

    /**
     * This method initializes sdkDirBrowseButton
     *
     * @return javax.swing.JButton
     */
    private JButton getSdkDirBrowseButton() {
        if (sdkDirBrowseButton == null) {
            sdkDirBrowseButton = new JButton();
            sdkDirBrowseButton.setToolTipText("Browse for the caCORE SDK directory");
            sdkDirBrowseButton.setText("Browse");
            sdkDirBrowseButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent e) {
                    String[] message = {
                        "Select the directory on your file system where",
                        "the caCORE SDK has been unpacked and built.",
                        "This directory will be inspected for the correct",
                        "structure, including location of various",
                        "configuration files and build artifacts."
                    };
                    OneTimeInfoDialogUtil.showInfoDialog(
                        GeneralConfigurationPanel.class, KEY_SDK_DIRECTORY, message);
                    String dir = null;
                    try {
                        dir = ResourceManager.promptDir(GeneralConfigurationPanel.this, null);
                    } catch (IOException ex) {
                        ex.printStackTrace();
                        CompositeErrorDialog.showErrorDialog("Error selecting the caCORE SDK directory", ex);
                    }
                    if (dir != null) {
                        getSdkDirTextField().setText(dir);
                    }
                }
            });
        }
        return sdkDirBrowseButton;
    }

    /**
     * This method initializes propertiesFileLabel
     *
     * @return javax.swing.JLabel
     */
    private JLabel getPropertiesFileLabel() {
        if (propertiesFileLabel == null) {
            propertiesFileLabel = new JLabel();
            propertiesFileLabel.setText("Configuration File:");
        }
        return propertiesFileLabel;
    }

    /**
     * This method initializes propertiesFileTextField
     *
     * @return javax.swing.JTextField
     */
    private JTextField getPropertiesFileTextField() {
        if (propertiesFileTextField == null) {
            propertiesFileTextField = new JTextField();
            propertiesFileTextField.setEditable(false);
        }
        return propertiesFileTextField;
    }

    /**
     * This method initializes propertiesTable
     *
     * @return javax.swing.JTable
     */
    private JTable getPropertiesTable() {
        if (propertiesTable == null) {
            DefaultTableModel propertiesTableModel = new DefaultTableModel() {
                public boolean isCellEditable(int row, int column) {
                    return false;
                }
            };
            propertiesTableModel.addColumn("Property");
            propertiesTableModel.addColumn("Value");
            propertiesTable = new JTable(propertiesTableModel);
        }
        return propertiesTable;
    }

    /**
     * This method initializes propertiesTableScrollPane
     *
     * @return javax.swing.JScrollPane
     */
    private JScrollPane getPropertiesTableScrollPane() {
        if (propertiesTableScrollPane == null) {
            propertiesTableScrollPane = new JScrollPane();
            propertiesTableScrollPane.setViewportView(getPropertiesTable());
            propertiesTableScrollPane.setBorder(BorderFactory.createTitledBorder(
                null, "Deploy Properties", TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        }
        return propertiesTableScrollPane;
    }

    // --------
    // helpers
    // --------

    private synchronized void populateDeployProperties() {
        // clear the properties table
        DefaultTableModel propertiesModel = (DefaultTableModel) getPropertiesTable().getModel();
        while (propertiesModel.getRowCount() != 0) {
            propertiesModel.removeRow(0);
        }
        // see if it's ok to populate values
        if (!validationModel.hasErrors()) {
            try {
                File propertiesFile = configuration.getDeployPropertiesFile();
                getPropertiesFileTextField().setText(propertiesFile.getCanonicalPath());

                Properties props = configuration.getDeployPropertiesFromSdkDir();

                // sort the property keys alphabetically
                SortedSet<String> keys = new TreeSet<String>();
                Iterator<?> keyIter = props.keySet().iterator();
                while (keyIter.hasNext()) {
                    keys.add((String) keyIter.next());
                }

                // put keys and their values in the table
                for (String key : keys) {
                    String value = props.getProperty(key);
                    propertiesModel.addRow(new String[] {key, value});
                }
            } catch (IOException ex) {
                String message = "Error loading deploy properties: " + ex.getMessage();
                LOG.error(message, ex);
                CompositeErrorDialog.showErrorDialog(message, ex);
            }
        }
    }

    // -----------
    // validation
    // -----------

    private void configureValidation() {
        ValidationComponentUtils.setMessageKey(getSdkDirTextField(), KEY_SDK_DIRECTORY);

        validateInput();
        updateComponentTreeSeverity();
    }

    private void validateInput() {
        ValidationResult result = new ValidationResult();

        // verify there's an SDK directory selected
        if (ValidationUtils.isNotBlank(getSdkDirTextField().getText())) {
            try {
                configuration.validateSdkDirectory();
            } catch (Exception ex) {
                LOG.debug("Error validating selected SDK directory", ex);
                result.add(new SimpleValidationMessage(KEY_SDK_DIRECTORY + " is not valid: " + ex.getMessage(),
                    Severity.ERROR, KEY_SDK_DIRECTORY));
            }
        } else {
            result.add(new SimpleValidationMessage(KEY_SDK_DIRECTORY + " cannot be empty",
                Severity.ERROR, KEY_SDK_DIRECTORY));
        }

        validationModel.setResult(result);

        updateComponentTreeSeverity();

        // update next button enabled
        setNextEnabled(!validationModel.hasErrors());
    }

    private void updateComponentTreeSeverity() {
        ValidationComponentUtils.updateComponentTreeMandatoryAndBlankBackground(this);
        ValidationComponentUtils.updateComponentTreeSeverityBackground(this, validationModel.getResult());
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php namespace Exchange\EWSType; use Exchange\EWSType;
/**
 * Contains EWSType_GetMailTipsType.
 */

/**
 * Represents the recipients and types of mail tips to retrieve.
 *
 * @package php-ews\Types
 *
 * @todo Extend EWSType_BaseRequestType.
 */
class EWSType_GetMailTipsType extends EWSType
{
    /**
     * Contains the types of mail tips requested from the service.
     *
     * @since Exchange 2010
     *
     * @var EWSType_MailTipTypes
     */
    public $MailTipsRequested;

    /**
     * Contains a list of recipients to check for mail tips.
     *
     * @since Exchange 2010
     *
     * @var EWSType_ArrayOfRecipientsType
     */
    public $Recipients;

    /**
     * Contains an e-mail address that a user is trying to send as.
     *
     * @since Exchange 2010
     *
     * @var EWSType_EmailAddressType
     */
    public $SendingAs;
}


text:
#include "mscl/MicroStrain/MIP/Packets/MipFieldParser.h"
#include "mscl/MicroStrain/MIP/Packets/MipDataPacket.h"

#include <boost/test/unit_test.hpp>

using namespace mscl;

BOOST_AUTO_TEST_SUITE(InertialFieldParser_Test)

BOOST_AUTO_TEST_CASE(InertialFieldParser_parseField)
{
    ByteStream bytes;

    //add bytes to the ByteStream
    bytes.append_float(1.234f);    //Accel 1 float
    bytes.append_float(0.0f);    //Accel 2 float
    bytes.append_float(0.0f);    //Accel 3 float

    MipDataField field(MipTypes::CH_FIELD_SENSOR_RAW_ACCEL_VEC, bytes.data());

    MipDataPoints data;

    MipFieldParser::parseField(field, data);

    //verify the field was parsed correctly
    BOOST_CHECK_EQUAL(data.size(), 3);
    BOOST_CHECK_CLOSE(data.at(0).as_float(), 1.234, 0.0001);
    BOOST_CHECK_EQUAL(data.at(1).as_float(), 0);
    BOOST_CHECK_EQUAL(data.at(2).as_float(), 0);
}

BOOST_AUTO_TEST_CASE(InertialFieldParser_parseUnknown)
{
    ByteStream bytes;

    //add bytes to the ByteStream
    bytes.append_uint32(0x3F9DF3B6);    //Accel 1 float
    bytes.append_uint32(0x00000000);    //Accel 2 float
    bytes.append_uint32(0x00000000);    //Accel 3 float

    MipDataField field(0, bytes.data());

    MipDataPoints data;

    MipFieldParser::parseField(field, data);

    //verify the field was parsed correctly
    BOOST_CHECK_EQUAL(data.size(), 1);
    BOOST_CHECK_EQUAL(data.at(0).storedAs(), valueType_Bytes);
}

BOOST_AUTO_TEST_SUITE_END()


text:
package com.kotcrab.vis.editor.event;

import com.badlogic.gdx.files.FileHandle;

/** @author Kotcrab */
public class OpenSceneRequest {
	public final FileHandle sceneFile;

	public OpenSceneRequest (FileHandle sceneFile) {
		this.sceneFile = sceneFile;
	}
}


text:
package net.rpl;

@Mod(id = "RetroPixelLoader", name = "RetroPixelLoader", version = RPLVersion.VERSION)
public class RPLDummyMod {

}


text:
package quadrature.core;
import quadrature.fun.Problem;

/**
 * This class contains the interpolation functions that can be used
 *
 * @authors Paolo Cifariello, Giada Fallo
 *
 */
public class Formulas {

	/**
	 * Interpolation function: polynomial of degree 0 (Bisection)
	 *
	 * @param a left bound of the interval
	 * @param b right bound of the interval
	 * @param p the Problem
	 *
	 * @return the approximate value of the integral in  [a,b] interval
	 */
	public static double quad1(double a, double b, Problem p) {
		return  ( (b-a) * ( (p.f(a)+p.f(b)) / 2 ) );
	}

	/**
	 * Interpolating function: polynomial of degree 1 (Trapezoidal)
	 *
	 * @param a left bound of the interval
	 * @param b right bound of the interval
	 * @param p the Problem
	 *
	 * @return the approximate value of the integral in [a,b] interval
	 */
	public static double quad2(double a, double b, Problem p) {
		return ( (b-a) * ( ( p.f(a) + 2 * p.f((a+b) / 2) + p.f(b) ) / 4 ) );
	}

	/**
	 * Interpolation function: polynomial of degree 2 (Cavalieri)
	 *
	 * @param a left bound of the interval
	 * @param b right bound of the interval
	 * @param p the Problem
	 *
	 * @return the approximate value of the integral in [a,b] interval
	 */
	public static double quad3(double a, double b, Problem p){
		return ( (b-a) * ( ( p.f(a) + 4 * p.f((a + b) / 2) + p.f(b) ) / 6 ) );
	}
}


text:
var $ = require('jquery');
//VIBRANT
var Vibrant = require('node-vibrant');

$(document).ready( function(){
console.log('Jquery loaded');

  var appandImage = function(number){
    $('body').append('<img style="display:none;filter: grayscale(100%); -webkit-filter: grayscale(100%);" id="imgnumber'+number+'" src="assets/pics/p' + number +'.jpeg" height="100px">');
  };

  var analyzeImage = function(imageNumber){
    var v = new Vibrant('assets/pics/p'+imageNumber+'.jpeg');
    v.getSwatches(function(e, s) {
      if (e) {
        console.log(e)
      } else {
        currentColor = s;
      }
    })

  }
    $('#begin-button').click(function(){
      $('#landing-screen').fadeOut(250, function(){
        console.log('App started');
        //Create All Image Elements and push them to the DOM
              for (var i = 1; i < 84; i++){
                appandImage(i);
              }
        //Fade In Animation
        $('body img').each(function(index){
          $(this).delay(250+(index*4)).fadeIn(500);
        });
        //Create hover events for all images
        for (var i = 0; i < $('img').length; i++){
          $('#imgnumber'+i).mouseover(function(){
            $( this ).css({'filter:': 'grayscale(0%)', '-webkit-filter': 'grayscale(0%)'});
            $('#colors').animate({
              'bottom': '0'
            }, 500);
            analyzeImage(i);
            console.log(currentColor);
              //var col = color(currentColor.Vibrant.rgb[0], currentColor.Vibrant.rgb[1], currentColor.Vibrant.rgb[2]);
              var vib = currentColor.Vibrant.getHex();
              var lvib = currentColor.LightVibrant.getHex();
              var lmut = currentColor.LightMuted.getHex();
              var dvib = currentColor.DarkVibrant.getHex();
              var dmut = currentColor.DarkMuted.getHex();

                $('#one').css({'background-color': vib});
                $('#two').css({'background-color': lvib});
                $('#three').css({'background-color': lmut});
                $('#four').css({'background-color': dvib});
                $('#five').css({'background-color': dmut});

              $('.swatch').each(function(index){
                $( this ).animate({'opacity': '1'}, (index*100)+300);
              });
          });
          $('#imgnumber'+i).mouseleave(function(){
            $( this ).css({'filter:': 'grayscale(100%)', '-webkit-filter': 'grayscale(100%)'});
          });
        }
      });
    });

});


text:
.//============================================================================
.// $RCSfile: t.class.select_where.h,v $
.//
.// Notice:
.// (C) Copyright 1998-2013 Mentor Graphics Corporation
.//     All rights reserved.
.//
.// This document contains confidential and proprietary information and
.// property of Mentor Graphics Corp.  No part of this document may be
.// reproduced without the express written permission of Mentor Graphics Corp.
.//============================================================================
.//
${te_class.GeneratedName} * ${te_where.select_any_where}( ${param_list} );
.//


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

namespace ModuleInject.Utility
{
    public class MemberPathInformation
    {
        public int Depth { get; set; }
        public Type ReturnType { get; set; }
        public string Path { get; set; }
        public Type RootType { get; set; }
        public bool ContainsPropertyAccess { get; set; }
        public bool ContainsMethodCall { get; set; }
        public IEnumerable<MemberInfo> MemberInfos { get; set; }
    }
}


text:
namespace plc {

std::map<std::string, val<analytic_value>> natural_value::get_constrained_symbols() const
{
	ERROR(NotImplemented, "");
}

natural_value * natural_value::collapse()
{
	return this;
}

std::optional<val<analytic_value>> natural_value::get_type() const
{
	return type;
}

void natural_value::value_deleter::operator()(llvm::Value* ptr) const
{
	ptr->deleteValue();
}

natural_value::natural_value(llvm::Value* llvmValue) : llvm_value(llvmValue, value_deleter()) {}

}


text:
module TelephoneNumber
  class TimeZoneDataImporter
    def self.load_data!
      master_data = {}
      File.open('data/timezones/map_data.txt', 'rb').each do |row|
        number_prefix, timezone = row.split('|').map(&:strip)
        master_data[number_prefix] = timezone
      end

      File.open('data/timezones/map_data.dat', 'wb') { |file| file << Marshal.dump(master_data) }
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <item
        android:title="@string/Star"
        android:id="@+id/menu_star"
        android:icon="@drawable/fav_normal"
        android:showAsAction="always"
        tools:ignore=",AppCompatResource"/>
    <item
        android:id="@+id/menu_setting"
        android:showAsAction="never"
        android:title="@string/Setting"
        android:orderInCategory="100"
        tools:ignore=",AppCompatResource"/>
</menu>


text:
/**
 * Key binding functions.
 */

#include "jwm.h"
#include "key.h"

#include "client.h"
#include "clientlist.h"
#include "command.h"
#include "error.h"
#include "misc.h"
#include "root.h"
#include "tray.h"

#define MASK_NONE    0
#define MASK_SHIFT   (1 << ShiftMapIndex)
#define MASK_LOCK    (1 << LockMapIndex)
#define MASK_CTRL    (1 << ControlMapIndex)
#define MASK_MOD1    (1 << Mod1MapIndex)
#define MASK_MOD2    (1 << Mod2MapIndex)
#define MASK_MOD3    (1 << Mod3MapIndex)
#define MASK_MOD4    (1 << Mod4MapIndex)
#define MASK_MOD5    (1 << Mod5MapIndex)

typedef struct ModifierNode {
   char           name;
   unsigned int   mask;
} ModifierNode;

static ModifierNode modifiers[] = {

   { 'C',   MASK_CTRL      },
   { 'S',   MASK_SHIFT     },
   { 'A',   MASK_MOD1      },
   { '1',   MASK_MOD1      },
   { '2',   MASK_MOD2      },
   { '3',   MASK_MOD3      },
   { '4',   MASK_MOD4      },
   { '5',   MASK_MOD5      },
   { 0,     MASK_NONE      }

};

typedef struct KeyNode {

   /* These are filled in when the configuration file is parsed */
   int key;
   unsigned int state;
   KeySym symbol;
   char *command;
   struct KeyNode *next;

   /* This is filled in by StartupKeys if it isn't already set. */
   KeyCode code;

} KeyNode;

typedef struct LockNode {
   KeySym symbol;
   unsigned int mask;
} LockNode;

static LockNode lockMods[] = {
   { XK_Caps_Lock,   0 },
   { XK_Num_Lock,    0 }
};

static KeyNode *bindings;
unsigned int lockMask;

static unsigned int GetModifierMask(XModifierKeymap *modmap, KeySym key);
static unsigned int ParseModifierString(const char *str);
static KeySym ParseKeyString(const char *str);
static char ShouldGrab(KeyType key);
static void GrabKey(KeyNode *np, Window win);

/** Initialize key data. */
void InitializeKeys(void)
{
   bindings = NULL;
   lockMask = 0;
}

/** Startup key bindings. */
void StartupKeys(void)
{

   XModifierKeymap *modmap;
   KeyNode *np;
   TrayType *tp;
   int x;

   /* Get the keys that we don't care about (num lock, etc). */
   modmap = JXGetModifierMapping(display);
   for(x = 0; x < sizeof(lockMods) / sizeof(lockMods[0]); x++) {
      lockMods[x].mask = GetModifierMask(modmap, lockMods[x].symbol);
      lockMask |= lockMods[x].mask;
   }
   JXFreeModifiermap(modmap);

   /* Look up and grab the keys. */
   for(np = bindings; np; np = np->next) {

      /* Determine the key code. */
      if(!np->code) {
         np->code = JXKeysymToKeycode(display, np->symbol);
      }

      /* Grab the key if needed. */
      if(ShouldGrab(np->key)) {

         /* Grab on the root. */
         GrabKey(np, rootWindow);

         /* Grab on the trays. */
         for(tp = GetTrays(); tp; tp = tp->next) {
            GrabKey(np, tp->window);
         }

      }

   }

}

/** Shutdown key bindings. */
void ShutdownKeys(void)
{

   ClientNode *np;
   TrayType *tp;
   unsigned int layer;

   /* Ungrab keys on client windows. */
   for(layer = 0; layer < LAYER_COUNT; layer++) {
      for(np = nodes[layer]; np; np = np->next) {
         JXUngrabKey(display, AnyKey, AnyModifier, np->window);
      }
   }

   /* Ungrab keys on trays, only really needed if we are restarting. */
   for(tp = GetTrays(); tp; tp = tp->next) {
      JXUngrabKey(display, AnyKey, AnyModifier, tp->window);
   }

   /* Ungrab keys on the root. */
   JXUngrabKey(display, AnyKey, AnyModifier, rootWindow);

}

/** Destroy key data. */
void DestroyKeys(void)
{
   KeyNode *np;
   while(bindings) {
      np = bindings->next;
      if(bindings->command) {
         Release(bindings->command);
      }
      Release(bindings);
      bindings = np;
   }
}

/** Grab a key. */
void GrabKey(KeyNode *np, Window win)
{
   unsigned int x;
   unsigned int index, maxIndex;
   unsigned int mask;

   /* Don't attempt to grab if there is nothing to grab. */
   if(!np->code) {
      return;
   }

   /* Grab for each lock modifier. */
   maxIndex = 1 << (sizeof(lockMods) / sizeof(lockMods[0]));
   for(index = 0; index < maxIndex; index++) {

      /* Compute the modifier mask. */
      mask = 0;
      for(x = 0; x < sizeof(lockMods) / sizeof(lockMods[0]); x++) {
         if(index & (1 << x)) {
            mask |= lockMods[x].mask;
         }
      }
      mask |= np->state;

      /* Grab the key. */
      JXGrabKey(display, np->code, mask, win,
         True, GrabModeAsync, GrabModeAsync);

   }

}

/** Get the key action from an event. */
KeyType GetKey(const XKeyEvent *event)
{

   KeyNode *np;
   unsigned int state;

   /* Remove modifiers we don't care about from the state. */
   state = event->state & ~lockMask;

   /* Loop looking for a matching key binding. */
   for(np = bindings; np; np = np->next) {
      if(np->state == state && np->code == event->keycode) {
         return np->key;
      }
   }

   return KEY_NONE;

}

/** Run a command invoked from a key binding. */
void RunKeyCommand(const XKeyEvent *event)
{

   KeyNode *np;
   unsigned int state;

   /* Remove the lock key modifiers. */
   state = event->state & ~lockMask;

   for(np = bindings; np; np = np->next) {
      if(np->state == state && np->code == event->keycode) {
         RunCommand(np->command);
         return;
      }
   }

}

/** Show a root menu caused by a key binding. */
void ShowKeyMenu(const XKeyEvent *event)
{

   KeyNode *np;
   unsigned int state;

   /* Remove the lock key modifiers. */
   state = event->state & ~lockMask;

   for(np = bindings; np; np = np->next) {
      if(np->state == state && np->code == event->keycode) {
         const int button = GetRootMenuIndexFromString(np->command);
         if(JLIKELY(button >= 0)) {
            ShowRootMenu(button, -1, -1, 1);
         }
         return;
      }
   }

}

/** Determine if a key should be grabbed on client windows. */
char ShouldGrab(KeyType key)
{
   switch(key & 0xFF) {
   case KEY_NEXT:
   case KEY_NEXTSTACK:
   case KEY_PREV:
   case KEY_PREVSTACK:
   case KEY_CLOSE:
   case KEY_MIN:
   case KEY_MAX:
   case KEY_SHADE:
   case KEY_STICK:
   case KEY_MOVE:
   case KEY_RESIZE:
   case KEY_ROOT:
   case KEY_WIN:
   case KEY_DESKTOP:
   case KEY_RDESKTOP:
   case KEY_LDESKTOP:
   case KEY_DDESKTOP:
   case KEY_UDESKTOP:
   case KEY_SHOWDESK:
   case KEY_SHOWTRAY:
   case KEY_EXEC:
   case KEY_RESTART:
   case KEY_EXIT:
   case KEY_FULLSCREEN:
   case KEY_SENDR:
   case KEY_SENDL:
   case KEY_SENDU:
   case KEY_SENDD:
   case KEY_MAXTOP:
   case KEY_MAXBOTTOM:
   case KEY_MAXLEFT:
   case KEY_MAXRIGHT:
   case KEY_MAXV:
   case KEY_MAXH:
   case KEY_NORMALLAYER:
   case KEY_ABOVELAYER:
      return 1;
   default:
      return 0;
   }
}

/** Get the modifier mask for a key. */
unsigned int GetModifierMask(XModifierKeymap *modmap, KeySym key) {

   KeyCode temp;
   int x;

   temp = JXKeysymToKeycode(display, key);
   if(JUNLIKELY(temp == 0)) {
      Warning(_("Specified KeySym is not defined for any KeyCode"));
   }
   for(x = 0; x < 8 * modmap->max_keypermod; x++) {
      if(modmap->modifiermap[x] == temp) {
         return 1 << (x / modmap->max_keypermod);
      }
   }

   Warning(_("modifier not found for keysym 0x%0x"), key);

   return 0;

}

/** Parse a modifier mask string. */
unsigned int ParseModifierString(const char *str)
{
   unsigned int mask;
   unsigned int x, y;
   char found;

   if(!str) {
      return MASK_NONE;
   }

   mask = MASK_NONE;
   for(x = 0; str[x]; x++) {

      found = 0;
      for(y = 0; modifiers[y].name; y++) {
         if(modifiers[y].name == str[x]) {
            mask |= modifiers[y].mask;
            found = 1;
            break;
         }
      }

      if(JUNLIKELY(!found)) {
         Warning(_("invalid modifier: \"%c\""), str[x]);
      }

   }

   return mask;

}

/** Parse a key string. */
KeySym ParseKeyString(const char *str)
{
   KeySym symbol;
   symbol = JXStringToKeysym(str);
   if(JUNLIKELY(symbol == NoSymbol)) {
      Warning(_("invalid key symbol: \"%s\""), str);
   }
   return symbol;
}

/** Insert a key binding. */
void InsertBinding(KeyType key, const char *modifiers,
                   const char *stroke, const char *code,
                   const char *command)
{

   KeyNode *np;
   unsigned int mask;
   char *temp;
   KeySym sym;

   mask = ParseModifierString(modifiers);

   if(stroke && strlen(stroke) > 0) {
      int offset;

      for(offset = 0; stroke[offset]; offset++) {
         if(stroke[offset] == '#') {

            temp = CopyString(stroke);

            for(temp[offset] = '1'; temp[offset] <= '9'; temp[offset]++) {

               sym = ParseKeyString(temp);
               if(sym == NoSymbol) {
                  Release(temp);
                  return;
               }

               np = Allocate(sizeof(KeyNode));
               np->next = bindings;
               bindings = np;

               np->key = key | ((temp[offset] - '1' + 1) << 8);
               np->state = mask;
               np->symbol = sym;
               np->command = NULL;
               np->code = 0;

            }

            Release(temp);

            return;
         }
      }

      sym = ParseKeyString(stroke);
      if(sym == NoSymbol) {
         return;
      }

      np = Allocate(sizeof(KeyNode));
      np->next = bindings;
      bindings = np;

      np->key = key;
      np->state = mask;
      np->symbol = sym;
      np->command = CopyString(command);
      np->code = 0;

   } else if(code && strlen(code) > 0) {

      np = Allocate(sizeof(KeyNode));
      np->next = bindings;
      bindings = np;

      np->key = key;
      np->state = mask;
      np->symbol = NoSymbol;
      np->command = CopyString(command);
      np->code = atoi(code);

   } else {

      Warning(_("neither key nor keycode specified for Key"));
      np = NULL;

   }

}

/** Validate key bindings. */
void ValidateKeys(void)
{
   KeyNode *kp;
   for(kp = bindings; kp; kp = kp->next) {
      if((kp->key & 0xFF) == KEY_ROOT && kp->command) {
         const int bindex = GetRootMenuIndexFromString(kp->command);
         if(JUNLIKELY(!IsRootMenuDefined(bindex))) {
            Warning(_("key binding: root menu \"%s\" not defined"),
                    kp->command);
         }
      }
   }
}


text:
using RimWorld;
using System.Collections.Generic;
using Verse;
using System;
using System.Linq;

namespace ChangeDresser
{
    public enum OutfitType { Battle, Civilian };

    public interface IDresserOutfit : IExposable
    {
        void Dress(Pawn pawn);
        void Undress(Pawn pawn, IEnumerable<Apparel> customApparel);
        bool IsValid();
        OutfitType OutfitType { get; set; }
        string UniqueId { get; set; }
        string Label { get; }
        ThingDef Icon { get; }
        bool IsBeingWorn { get; }
    }

    public class CustomOutfit : IDresserOutfit
    {
        private OutfitType outfitType = OutfitType.Civilian;
        private bool isBeingWorn = false;
        private string uniqueId;
        private HashSet<Apparel> apparel = new HashSet<Apparel>();
        public IEnumerable<Apparel> Apparel => apparel;
        public string Name = "";
        public Outfit Outfit = null;

        public CustomOutfit() { }

		public void Clean()
		{
            this.apparel.RemoveWhere(a => a == null || a.Destroyed || a.HitPoints <= 0);
		}

		public void Dress(Pawn pawn)
        {
#if DRESSER_OUTFIT
            Log.Warning("Begin CustomOutfit.Dress(Pawn: " + pawn.Name.ToStringShort + ")");
#endif

            List<Apparel> removed = ApparelUtil.RemoveApparel(pawn);

#if DRESSER_OUTFIT
            Log.Message("    Add Custom Apparel:");
#endif
            // Dress the pawn with this outfit's apparel
            foreach (Apparel a in this.Apparel)
            {
#if DRESSER_OUTFIT
                Log.Message("        " + a.Label);
#endif
                removed.Remove(a);
                pawn.apparel.Wear(a);
                // Force all apparel
                pawn.outfits.forcedHandler.ForcedApparel.Add(a);
                //tracker.RemoveCustomApparel(a);
            }

            if (this.Outfit != null)
            {
                pawn.outfits.CurrentOutfit = this.Outfit;
                ApparelUtil.OptimizeApparel(pawn);
            }

            /*/ Add any previously worn apparel that still can be worn
            for (int i = 0; i < removed.Count; ++i)
            {
                Apparel a = wasWearing[i];
                if (pawn.apparel.CanWearWithoutDroppingAnything(a.def))
                {
                    pawn.apparel.Wear(a);
                    removed[i] = null;
                }
            }*/

            ApparelUtil.StoreApparelInWorldDresser(removed, pawn);

            this.isBeingWorn = true;
#if DRESSER_OUTFIT
            Log.Warning("End CustomOutfit.Dress");
#endif
        }

        public void Undress(Pawn pawn, IEnumerable<Apparel> customApparel)
        {
#if DRESSER_OUTFIT
            Log.Warning("Begin CustomOutfit.Undress(Pawn: " + pawn.Name.ToStringShort + ")");
#endif
            List<Apparel> wornApparel = new List<Apparel>(pawn.apparel.WornApparel);
            pawn.outfits.forcedHandler.ForcedApparel.Clear();
#if DRESSER_OUTFIT
            Log.Warning("    Remove Apparel:");
#endif
            foreach (Apparel a in wornApparel)
            {
#if DRESSER_OUTFIT
                Log.Warning("        " + a.Label);
#endif
                pawn.apparel.Remove(a);
                if (!customApparel.Contains(a))
                {
#if DRESSER_OUTFIT
                    Log.Warning("            -- Not a custom piece of apparel. Storing in Dresser.");
#endif
                    if (!WorldComp.AddApparel(a))
                    {
                        BuildingUtil.DropThing(a, pawn.Position, pawn.Map, false);
                    }
                }
            }
            this.isBeingWorn = false;
            /*#if DRESSER_OUTFIT
                        Log.Warning("Begin CustomOutfit.Undress(Pawn: " + pawn.Name.ToStringShort + ")");
            #endif
            #if DRESSER_OUTFIT
                        Log.Warning("    Find any changes in Custom Outfit:");
            #endif
                        LinkedList<Apparel> noLongerWearing = new LinkedList<Apparel>(this.Apparel);
                        foreach (Apparel a in pawn.apparel.WornApparel)
                        {
                            if (!noLongerWearing.Remove(a))
                            {
            #if DRESSER_OUTFIT
                                Log.Warning("        No longer wearing: " + a.Label);
            #endif
                            }
            #if DRESSER_OUTFIT
                            else
                                Log.Message("        Is still wearing: " + a.Label);
            #endif
                        }

            #if DRESSER_OUTFIT
                        if (noLongerWearing.Count > 0)
                            Log.Message("    Remove Apparel from Custom Outfit:");
            #endif

            #if DRESSER_OUTFIT
                        System.Text.StringBuilder sb = new System.Text.StringBuilder("    Tracker-CustomApparel: ");
                        foreach(Apparel a in customApparel)
                        {
                            sb.Append("[" + a.Label + "]  ");
                        }
            #endif

                        // Remove any apparel that's no longer being worn
                        foreach (Apparel a in noLongerWearing)
                        {
            #if DRESSER_OUTFIT
                            Log.Message("        " + a.Label);
            #endif
                            this.Apparel.Remove(a);
                            if (!customApparel.Contains(a))
                            {
            #if DRESSER_OUTFIT
                                Log.Message("        " + a.Label + " NOT custom apparel, going back to dresser");
            #endif
                                WorldComp.AddApparel(a);
                            }
                        }
                        pawn.outfits.forcedHandler.ForcedApparel.Clear();*/

            /*foreach (Apparel a in this.Apparel)
            {
                tracker.AddCustomApparel(a);
            }*/

#if DRESSER_OUTFIT
            Log.Warning("End CustomOutfit.Undress");
#endif
        }

		public void ExposeData()
        {
            Scribe_Values.Look(ref this.Name, "name");
            Scribe_Values.Look(ref this.outfitType, "type");
            Scribe_Values.Look(ref this.isBeingWorn, "isBeingWorn", false, false);
            Scribe_Values.Look(ref this.uniqueId, "uniqueId");
            Scribe_References.Look(ref this.Outfit, "outfit");

            Scribe_Collections.Look(ref this.apparel, "apparel", LookMode.Reference);

            if (this.apparel == null)
                this.apparel = new HashSet<Apparel>();
        }

        public bool IsValid()
        {
            return true;
        }

        public string GetUniqueLoadID()
        {
            return this.uniqueId;
        }

        public OutfitType OutfitType { get { return this.outfitType; } set { this.outfitType = value; } }
        public string UniqueId { get { return this.uniqueId; } set { this.uniqueId = value; } }
        public string Label { get { return this.Name; } }
        public ThingDef Icon
        {
            get
            {
                if (this.apparel != null && this.apparel.Count > 0)
                {
                    return this.apparel.First().def;
                }
                return null;
            }
        }
        public bool IsBeingWorn { get { return this.isBeingWorn; } }

        internal bool Add(Apparel apparel)
        {
            if (this.apparel.Add(apparel))
                return true;
            return this.Contains(apparel);
        }

        internal bool Contains(Apparel apparel)
        {
            return this.apparel.Contains(apparel);
        }

        internal bool Remove(Apparel apparel)
        {
            return this.apparel.Remove(apparel);
        }
    }

    public class DefinedOutfit : IDresserOutfit
    {
        private bool isBeingWorn = false;
        private string uniqueId;
        private OutfitType outfitType = OutfitType.Civilian;
        public Outfit Outfit;

        public DefinedOutfit() { }

        public DefinedOutfit(Outfit outfit, OutfitType outfitType)
        {
#if DRESSER_OUTFIT
            Log.Warning("Begin DefinedOutfit(Outfit: " + outfit.label + ", OutfitType: " + outfitType + ")");
#endif
            this.Outfit = outfit;
            this.outfitType = outfitType;
#if DRESSER_OUTFIT
            Log.Warning("End DefinedOutfit");
#endif
        }

        public void Dress(Pawn pawn)
        {
#if DRESSER_OUTFIT
            Log.Warning("Begin DefinedOutfit.Dress(Pawn: " + pawn.Name.ToStringShort + ")");
#endif
            List<Apparel> removed = ApparelUtil.RemoveApparel(pawn);
            ApparelUtil.StoreApparelInWorldDresser(removed, pawn);
            pawn.outfits.CurrentOutfit = this.Outfit;
#if DRESSER_OUTFIT
            Log.Message("     Pawn's outfit is now: " + pawn.outfits.CurrentOutfit.label);
#endif
            /*
            bool done = false;
            for(int i = 0; i < 10 && !done; ++i)
            {
                Apparel a;
                Building_Dresser d;
                if (!(done = WorldComp.TryFindBestApparel(pawn, out a, out d)))
                {
                    if (d != null)
                        d.RemoveNoDrop(a);
                    pawn.apparel.Wear(a);
                    if (customApparel.Contains(a))
                        pawn.outfits.forcedHandler.ForcedApparel.Add(a);
                }
            }
            */
            ApparelUtil.OptimizeApparel(pawn);
            this.isBeingWorn = true;
#if DRESSER_OUTFIT
            Log.Warning("End DefinedOutfit.Dress");
#endif
        }

        public void Undress(Pawn pawn, IEnumerable<Apparel> customApparel)
        {
#if DRESSER_OUTFIT
Log.Warning("Begin DefinedOutfit.Undress(Pawn: " + pawn.Name.ToStringShort + ")");
#endif
            List<Apparel> wornApparel = new List<Apparel>(pawn.apparel.WornApparel);
            pawn.outfits.forcedHandler.ForcedApparel.Clear();
#if DRESSER_OUTFIT
Log.Warning("    Remove Apparel:");
#endif
            foreach (Apparel a in wornApparel)
            {
#if DRESSER_OUTFIT
    Log.Warning("        " + a.Label);
#endif
                pawn.apparel.Remove(a);
                if (!customApparel.Contains(a))
                {
#if DRESSER_OUTFIT
        Log.Warning("            -- Not a custom piece of apparel. Storing in Dresser.");
#endif
                    if (!WorldComp.AddApparel(a))
                    {
                        BuildingUtil.DropThing(a, pawn.Position, pawn.Map, false);
                    }
                }
            }
            this.isBeingWorn = false;
#if DRESSER_OUTFIT
Log.Warning("End DefinedOutfit.Undress");
#endif
        }

        public void ExposeData()
        {
            Scribe_Values.Look<bool>(ref this.isBeingWorn, "isBeingWorn", false, false);
            Scribe_Values.Look<OutfitType>(ref this.outfitType, "type");
            Scribe_References.Look<Outfit>(ref this.Outfit, "outfit");
            Scribe_Values.Look<string>(ref this.uniqueId, "uniqueId");
        }

        public bool IsValid()
        {
            return this.Outfit != null;
        }

        public string GetUniqueLoadID()
        {
            return this.uniqueId;
        }

        public OutfitType OutfitType { get { return this.outfitType; } set { this.outfitType = value; } }
        public string UniqueId { get { return this.uniqueId; } set { this.uniqueId = value; } }
        public string Label
        {
            get
            {
                if (this.Outfit != null)
                {
                    return this.Outfit.label;
                }
                else
                {
                    return "[Deleted Outfit]";
                }
            }
        }
        public ThingDef Icon
        {
            get
            {
                if (this.Outfit != null)
                {
                    List<ThingDef> d = new List<ThingDef>(this.Outfit.filter.AllowedThingDefs);
                    if (d.Count > 0)
                    {
                        return d[0];
                    }
                }
                return null;
            }
        }
        public bool IsBeingWorn { get { return this.isBeingWorn; } }
    }
}


text:
#include "postgres.h"

#include "nodes/parsenodes.h"

/*
 *	makeInteger
 */
Value *
makeInteger(long i)
{
	Value	   *v = makeNode(Value);

	v->type = T_Integer;
	v->val.ival = i;
	return v;
}

/*
 *	makeFloat
 *
 * Caller is responsible for passing a palloc'd string.
 */
Value *
makeFloat(char *numericStr)
{
	Value	   *v = makeNode(Value);

	v->type = T_Float;
	v->val.str = numericStr;
	return v;
}

/*
 *	makeString
 *
 * Caller is responsible for passing a palloc'd string.
 */
Value *
makeString(char *str)
{
	Value	   *v = makeNode(Value);

	v->type = T_String;
	v->val.str = str;
	return v;
}

/*
 *	makeBitString
 *
 * Caller is responsible for passing a palloc'd string.
 */
Value *
makeBitString(char *str)
{
	Value	   *v = makeNode(Value);

	v->type = T_BitString;
	v->val.str = str;
	return v;
}


text:
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;

namespace Servya
{
	[AttributeUsage(AttributeTargets.Method)]
	public class RouteAttribute : Attribute
	{
		public HttpVerb Verb { get; set; }
		public string Path { get; set; }
		public bool EnableChunking { get; set; }
		public Type QueryValidatorType { get; set; }

		public RouteAttribute(HttpVerb verb = HttpVerb.Get)
		{
			Verb = verb;
		}

		public virtual IEnumerable<RouteAttribute> Create()
		{
			yield return this;
		}

		public virtual void ModifyHttpContext(IHttpContext context)
		{
		}

		public virtual string ModifyPath(string path)
		{
			return path;
		}

		public virtual object Transform(object response)
		{
			return response;
		}

		public virtual object HandleError(RouteError error)
		{
			return error;
		}

		public virtual T CloneAs<T>()
			where T : RouteAttribute, new()
		{
			return new T
			{
				Verb = Verb,
				Path = Path,
				EnableChunking = EnableChunking,
				QueryValidatorType = QueryValidatorType
			};
		}
	}
}


text:
// META: script=/resources/test-only-api.js
// META: script=resources/pressure-helpers.js

'use strict';

pressure_test(async (t, mockPressureService) => {
  const pressureChanges = await new Promise(async resolve => {
    const observer_changes = [];
    let n = 0;
    const observer = new PressureObserver(changes => {
      observer_changes.push(changes);
      if (++n === 2)
        resolve(observer_changes);
    }, {sampleRate: 1.0});
    observer.observe('cpu');
    const updatesDelivered = mockPressureService.updatesDelivered();
    mockPressureService.setPressureUpdate('critical');
    mockPressureService.startPlatformCollector(/*sampleRate*/ 1.0);
    // Deliver 2 updates.
    await t.step_wait(
        () => mockPressureService.updatesDelivered() >= (updatesDelivered + 2),
        'Wait for more than one update to be delivered to the observer');
    mockPressureService.setPressureUpdate('nominal');
    // Deliver more updates, |resolve()| will be called when the new pressure
    // state reaches PressureObserver and its callback is invoked
    // for the second time.
  });
  assert_equals(pressureChanges.length, 2);
  assert_equals(pressureChanges[0][0].state, 'critical');
  assert_equals(pressureChanges[1][0].state, 'nominal');
}, 'Changes that fail the "has change in data" test are discarded.');

pressure_test(async (t, mockPressureService) => {
  const pressureChanges = await new Promise(async resolve => {
    const observer_changes = [];
    let n = 0;
    const observer = new PressureObserver(changes => {
      observer_changes.push(changes);
      if (++n === 2)
        resolve(observer_changes);
    }, {sampleRate: 1.0});
    observer.observe('cpu');
    const updatesDelivered = mockPressureService.updatesDelivered();
    mockPressureService.setPressureUpdate('critical', ['thermal']);
    mockPressureService.startPlatformCollector(/*sampleRate*/ 1.0);

    // Deliver 2 updates.
    await t.step_wait(
        () => mockPressureService.updatesDelivered() >= (updatesDelivered + 2),
        'Wait for more than one update to be delivered to the observer');
    mockPressureService.setPressureUpdate('critical', ['power-supply']);
    // Deliver more updates, |resolve()| will be called when the new pressure
    // state reaches PressureObserver and its callback is invoked
    // for the second time.
  });
  assert_equals(pressureChanges.length, 2);
  assert_equals(pressureChanges[0][0].state, 'critical');
  assert_equals(pressureChanges[0][0].factors[0], 'thermal');
  assert_equals(pressureChanges[1][0].state, 'critical');
  assert_equals(pressureChanges[1][0].factors[0], 'power-supply');
}, 'Factors that fail the "has change in data" test are discarded.');


text:
Imports System.Data

Partial Class fDevoluciones_Proveedores_Ingles

    Inherits vis2formularios.frmReporte

    Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Try

            Dim loComandoSeleccionar As New StringBuilder()

            loComandoSeleccionar.AppendLine(" SELECT	Devoluciones_Proveedores.Cod_Pro, ")
            loComandoSeleccionar.AppendLine("           Proveedores.Nom_Pro, ")
            loComandoSeleccionar.AppendLine("           Proveedores.Rif, ")
            loComandoSeleccionar.AppendLine("           Proveedores.Nit, ")
            loComandoSeleccionar.AppendLine("           Proveedores.Dir_Fis, ")
            loComandoSeleccionar.AppendLine("           Proveedores.Telefonos, ")
            loComandoSeleccionar.AppendLine("           Proveedores.Fax, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Nom_Pro        As  Nom_Gen, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Rif            As  Rif_Gen, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Nit            As  Nit_Gen, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Dir_Fis        As  Dir_Gen, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Telefonos      As  Tel_Gen, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Documento, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Fec_Ini, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Fec_Fin, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Mon_Bru, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Mon_Imp1, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Dis_Imp, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Mon_Net, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Por_Rec1, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Por_Des1, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Mon_Rec1, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Mon_Des1, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Cod_For, ")
            loComandoSeleccionar.AppendLine("           Formas_Pagos.Nom_For, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Cod_Ven, ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Comentario, ")
            loComandoSeleccionar.AppendLine("           Vendedores.Nom_Ven, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Cod_Art, ")
            loComandoSeleccionar.AppendLine("           Articulos.Nom_Art, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Renglon, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Can_Art1, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Cod_Uni, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Precio1, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Mon_Net  As  Neto, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Por_Imp1 As  Por_Imp, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Cod_Imp, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores.Mon_Imp1 As  Impuesto ")
            loComandoSeleccionar.AppendLine(" FROM      Devoluciones_Proveedores, ")
            loComandoSeleccionar.AppendLine("           Renglones_DProveedores, ")
            loComandoSeleccionar.AppendLine("           Proveedores, ")
            loComandoSeleccionar.AppendLine("           Formas_Pagos, ")
            loComandoSeleccionar.AppendLine("           Vendedores, ")
            loComandoSeleccionar.AppendLine("           Articulos ")
            loComandoSeleccionar.AppendLine(" WHERE     Devoluciones_Proveedores.Documento      =   Renglones_DProveedores.Documento AND ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Cod_Pro        =   Proveedores.Cod_Pro AND ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Cod_For        =   Formas_Pagos.Cod_For AND ")
            loComandoSeleccionar.AppendLine("           Devoluciones_Proveedores.Cod_Ven        =   Vendedores.Cod_Ven AND ")
            loComandoSeleccionar.AppendLine("           Articulos.Cod_Art                       =   Renglones_DProveedores.Cod_Art AND " & cusAplicacion.goFormatos.pcCondicionPrincipal)

            Dim loServicios As New cusDatos.goDatos

            Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString, "curReportes")

            '--------------------------------------------------'
            ' Carga la imagen del logo en cusReportes            '
            '--------------------------------------------------'
            Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")

            Dim lcXml As String = "<impuesto></impuesto>"
            Dim lcPorcentajesImpuestos As String
            Dim loImpuestos As New System.Xml.XmlDocument()

            lcPorcentajesImpuestos = "("

            'Recorre cada renglon de la tabla
            For lnNumeroFila As Integer = 0 To laDatosReporte.Tables(0).Rows.Count - 1
                lcXml = laDatosReporte.Tables(0).Rows(lnNumeroFila).Item("dis_imp")

                If String.IsNullOrEmpty(lcXml.Trim()) Then
                    Continue For
                End If

                loImpuestos.LoadXml(lcXml)

                'En cada renglón lee el contenido de la distribució de impuestos
                For Each loImpuesto As System.Xml.XmlNode In loImpuestos.SelectNodes("impuestos/impuesto")
                    If lnNumeroFila = laDatosReporte.Tables(0).Rows.Count - 1 Then
                        lcPorcentajesImpuestos = lcPorcentajesImpuestos & ", " & goServicios.mObtenerFormatoCadena(CDec(loImpuesto.SelectSingleNode("porcentaje").InnerText)) & "%"
                    End If
                Next loImpuesto
            Next lnNumeroFila

            lcPorcentajesImpuestos = lcPorcentajesImpuestos & ")"
            lcPorcentajesImpuestos = lcPorcentajesImpuestos.Replace("(,", "(")

            If (laDatosReporte.Tables(0).Rows.Count <= 0) Then
                Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _
                                          "No se Encontraron Registros para los Parámetros Especificados. ", _
                                           vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _
                                           "350px", _
                                           "200px")
            End If

            loObjetoReporte = cusAplicacion.goFormatos.mCargarInforme("fDevoluciones_Proveedores_Ingles", laDatosReporte)

            CType(loObjetoReporte.ReportDefinition.ReportObjects("Text29"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = lcPorcentajesImpuestos.ToString

            Me.mTraducirReporte(loObjetoReporte)
            Me.mFormatearCamposReporte(loObjetoReporte)
            Me.crvfDevoluciones_Proveedores_Ingles.ReportSource = loObjetoReporte

        Catch loExcepcion As Exception

            Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
                          "No se pudo Completar el Proceso: " & loExcepcion.Message, _
                           vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
                           "auto", _
                           "auto")

        End Try

    End Sub

    Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload

        Try

            loObjetoReporte.Close()

        Catch loExcepcion As Exception

        End Try

    End Sub

End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' Douglas Cortez: 10/05/2010: Codigo inicial
'-------------------------------------------------------------------------------------------'
' MAT: 15/09/11: Ajuste de la vista de Diseño
'-------------------------------------------------------------------------------------------'
' MAT: 15/09/11: Eliminación del Pie de Página de eFactory según Requerimientos
'-------------------------------------------------------------------------------------------'


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Keyphrase_model extends MY_Model
{
    public $table = 'keyphrases';
    public $primary_key = 'id';
    public $timestamps = FALSE;

    public function __construct()
    {
        $this->pagination_delimiters = array('
','
');
        $this->pagination_arrows = array('«','»');
        parent::__construct();
    }
/*
    public $rules = array(
        'insert' => array(
            'parent_id' => array('field'=>'parent_id','label'=>'Parent ID','rules'=>'trim|is_natural|required'),
            'title' => array('field'=>'title','label'=>'Title','rules'=>'trim|required'),
            'menu_title' => array('field'=>'menu_title','label'=>'Menu title','rules'=>'trim'),
            'slug' => array('field'=>'slug', 'label'=>'Slug', 'rules'=>'trim'),
            'order' => array('field'=>'order','label'=>'Order','rules'=>'trim|is_natural|required'),
            'page_title' => array('field'=>'page_title','label'=>'Page title','rules'=>'trim'),
            'page_description' => array('field'=>'page_description','label'=>'Page description','rules'=>'trim'),
            'page_keywords' => array('field'=>'page_keywords','label'=>'Page keywords','rules'=>'trim'),
            'category_id' => array('field'=>'category_id', 'label'=>'Category ID', 'rules'=>'trim|is_natural|required'),
            'language_slug' => array('field'=>'language_slug','label'=>'language_slug','rules'=>'trim|required')
        ),
        'update' => array(
            'word' => array('field'=>'word','label'=>'Parent ID','rules'=>'trim|required'),
            'root_word' => array('field'=>'root_word','label'=>'Title','rules'=>'trim'),
            'noise_word' => array('field'=>'noise_word','label'=>'Noise word','rules'=>'trim'),
            'word_id' => array('field'=>'word_id', 'label'=>'Word ID', 'rules'=>'trim|is_natural_no_zero|required'),
            'language_slug' => array('field'=>'language_slug','label'=>'language_slug','rules'=>'trim|required')
        )
    );
*/
}


text:
var test = require('tap').test;
var sentiment = require('../../lib/index');

var dataset = 'This is so cool';
sentiment(dataset, function (err, result) {
    console.dir(err);
    console.dir(result);

    test('asynchronous positive', function (t) {
        t.type(result, 'object');
        t.equal(result.score, 1);
        t.equal(result.comparative, 0.25);
        t.equal(result.tokens.length, 4);
        t.equal(result.words.length, 1);
        t.end();
    });
});


text:
import { combineReducers } from 'redux';

import attributes from './attributes';
import scores, * as fromScores from './scores/';
import getPillowSizeByScore from './pillowSizeByScore';
import config from './config';

const reducer = combineReducers({ attributes, scores, config });

export default reducer;

const getPillows = (state) => state.config.pillows;
const getPillowBySize = (pillows, size) => pillows[size];

export const getPillow = (state) =>
  getPillowBySize(
    getPillows(state),
    getPillowSizeByScore(fromScores.totalScore(state))
);


text:
<?php

namespace Garden\Html;

use pQuery\TextNode;

/**
 *
 */
class MentionsFilter extends Filter {

    /**
     * @var array An array of tag names that should not have mentions formatted within them.
     */
    protected $ignoreParents = ['pre', 'cod', 'a'];

    /**
     * @var string The regular expression used to search for @mentions.
     * @copyright 2012 GitHub Inc. and Jerry Cheung
     * @link https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/%40mention_filter.rb
     */
    protected $mentionPattern = <<<PATTERN
`
(?:^|\W)                   # beginning of string or non-word char
@((?>[a-z0-9][a-z0-9-]*))  # @username
(?!/)                      # without a trailing slash
(?=
  \.+[ \t\W]|              # dots followed by space or non-word character
  \.+$|                    # dots at end of line
  [^0-9a-zA-Z_.]|          # non-word character except dot
  $                        # end of line
)
`iux
PATTERN;

    /**
     * @var array The usernames that were mentioned during a filter.
     */
    protected $mentionedUsernames;

    /**
     * {@inheritdoc}
     */
    public function call($content) {
        $content = Content::box($content);
        $this->mentionedUsernames = [];
        $doc = $content->getDoc();

        /* @var TextNode $node */
        foreach ($doc->query('text()') as $node) {
            $text = $node->text();
            if (strpos($text, '@') === false) {
                continue;
            }

            // Don't format mentions in ignored tags.
            if (Content::hasAncestor($node, $this->ignoreParents)) {
                continue;
            }

            $text = $this->replaceMentions($text, $node);
            $node->text($text);
        }
        $content->setData('mentions', array_reverse(array_keys($this->mentionedUsernames)));
        return $content;
    }

    /**
     * Find the usernames that begin with a string.
     *
     * When formatting mentions, usernames with spaces cause a problem because a simple regex cannot determine
     * when a mention has a space or not.
     *
     * @param string $beginsWith The string to search for.
     * @return array[string] Returns the full usernames.
     */
    public function findUsernames($beginsWith) {
        return [$beginsWith];
    }

    /**
     * Replace mentions with an html link and capture the mentioned users.
     *
     * @param string $text The text to replace.
     * @param DomNode $node The node that the text belongs to.
     * @return string Returns the text with mentions replaced.
     */
    public function replaceMentions($text, $node) {
        if (!preg_match_all($this->mentionPattern, $text, $matches, PREG_OFFSET_CAPTURE)) {
            return;
        }

        $mentions = $matches[1];
        // Walk through the mentions backwards so that changing the string won't affect future mentions.
        for ($i = count($mentions) - 1; $i >= 0; $i--) {
            list($username, $pos) = $mentions[$i];

            // Look up the user based on the start of the name.
            $usernames = $this->findUsernames($username);
            $this->replaceMentionInternal($usernames, $pos, $node, $text);
        }
        return $text;
    }

    /**
     * Replace a mention with the appropriate html.
     *
     * @param array $usernames All of the usernames to check.
     * @param int $pos The position to look at.
     * @param DomNode $node The node that the text is contained in.
     * @param string $text The full text to do the replacement on.
     */
    protected function replaceMentionInternal($usernames, $pos, $node, &$text) {
        foreach ($usernames as $username) {
            // Check to see if the username actually matches in the text.
            if (substr_compare($text, $username, $pos, strlen($username)) === 0) {
                $hname = htmlspecialchars($username);
                $text = substr($text, 0, $pos - 1)."@$hname".substr($text, $pos + strlen($username));
                $this->mentionedUsernames[$username] = true;
                break;
            }
        }
    }
}


text:
//
//  TRACustomUIWindow.m
//  TRACustomWindow
//
//  Created by Toshikazu Fukuoka on 2014/05/27.
//  Copyright (c) 2014年 Toshikazu Fukuoka. All rights reserved.
//

#import "TRACustomUIWindow.h"

#define CATransform3DMakeScale_SHOW_INIT CATransform3DMakeScale(1.3f, 1.3f, 1.0f);
#define CATransform3DMakeScale_SHOW_ANIM CATransform3DMakeScale(1.0f, 1.0f, 1.0f);
#define CATransform3DMakeScale_HIDE_ANIM CATransform3DMakeScale(0.5f, 0.5f, 0.5f);
#define OPACITY_SUBVIEW_SHOW_INIT 0.5f
#define OPACITY_SUBVIEW_SHOW_ANIM 1.0f
#define OPACITY_SUBVIEW_HIDE_ANIM 0.0f

#define BASEVIEW_TAG 1

/***************************************
  Please add subViews tag as necessary.
 ***************************************/
#define SUBVIEW1_TAG 2
#define SUBVIEW2_TAG 3

@implementation TRACustomUIWindow

static UIWindow *_mainWindow;

+ (TRACustomUIWindow *)sharedInstance
{
    static TRACustomUIWindow *theTRACustomUIWindow;
    @synchronized(self) {
        if (!theTRACustomUIWindow)
            theTRACustomUIWindow = [[self alloc] init];
    }
    return theTRACustomUIWindow;
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        _enableBaseViewTouch = YES;
    }
    return self;
}

- (void)showWindow
{

    if (_mainWindow == nil) {

        // Make UIWindow
        _mainWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        _mainWindow.windowLevel = UIWindowLevelNormal + 1.0f;
        _mainWindow.backgroundColor = [UIColor colorWithWhite:0.5f alpha:0.0f];
        [_mainWindow makeKeyAndVisible];

        // Make TRACustomBaseView
        TRACustomBaseView *baseView = [[TRACustomBaseView alloc] initWithFrame:_mainWindow.frame];
        baseView.center = _mainWindow.center;
        baseView.backgroundColor = [UIColor clearColor];
        baseView.delegate = self;
        baseView.tag = BASEVIEW_TAG;
        [_mainWindow addSubview:baseView];

        /***********************************************
         Please add subViews on baseView as necessary.
        ************************************************/
        // For example

        // Use UIView
        UIView *backSubView = [[UIView alloc] init];
        backSubView.frame = CGRectMake(0, 0, 280.0f, 400.0f);
        backSubView.center = _mainWindow.center;
        backSubView.backgroundColor = [UIColor whiteColor];
        backSubView.layer.opacity = OPACITY_SUBVIEW_SHOW_INIT;
        backSubView.layer.transform = CATransform3DMakeScale_SHOW_INIT
        backSubView.tag = SUBVIEW1_TAG;
        [baseView addSubview:backSubView];

        // Use UIImageView
        /*
        UIImageView *imageView = [[UIImageView alloc] init];
        UIImage *image = [UIImage imageNamed:@"your_image_name"];
        imageView.image = image;
        imageView.frame = CGRectMake(0, 0, image.size.width, image.size.height);
        imageView.center = _mainWindow.center;
        imageView.tag = SUBVIEW1_TAG;
        imageView.layer.opacity = 0.5f;
        imageView.layer.transform = CATransform3DMakeScale(1.3f, 1.3f, 1.0f);
        [baseView addSubview:imageView];
        */

        // Use UIButton
        UIButton *btSubView = [UIButton buttonWithType:UIButtonTypeSystem];
        btSubView.frame = CGRectMake(0, 0, 200.0f, 80.0f);
        btSubView.center = CGPointMake(_mainWindow.center.x, _mainWindow.center.y + 100.0f);
        btSubView.backgroundColor = [UIColor lightGrayColor];
        [btSubView setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [btSubView setTitle:NSLocalizedString(@"Button", @"") forState:UIControlStateNormal];
        [btSubView addTarget:self action:@selector(buttonTap:) forControlEvents:UIControlEventTouchUpInside];
        btSubView.layer.opacity = OPACITY_SUBVIEW_SHOW_INIT;
        btSubView.layer.transform = CATransform3DMakeScale_SHOW_INIT
        btSubView.tag = SUBVIEW2_TAG;
        [baseView addSubview:btSubView];

        [UIView animateWithDuration:0.2f
                              delay:0.0f
                            options:UIViewAnimationOptionCurveEaseInOut
                         animations:^{

                             _mainWindow.backgroundColor = [UIColor colorWithWhite:0.5f alpha:0.5f];

                             backSubView.layer.transform = CATransform3DMakeScale_SHOW_ANIM
                             backSubView.layer.opacity   = OPACITY_SUBVIEW_SHOW_ANIM;

                             btSubView.layer.transform   = CATransform3DMakeScale_SHOW_ANIM
                             btSubView.layer.opacity     = OPACITY_SUBVIEW_SHOW_ANIM;

                         }
                         completion:NULL
         ];

    }

}

- (void)hideWindow
{
    if (_mainWindow) {

        UIView *aView = [_mainWindow viewWithTag:BASEVIEW_TAG];
        UIView *backSubView  = (UIView*)[aView viewWithTag:SUBVIEW1_TAG];
        UIButton *btSubView  = (UIButton*)[aView viewWithTag:SUBVIEW2_TAG];

        [UIView animateWithDuration:0.2f
                              delay:0.0f
                            options:UIViewAnimationOptionTransitionNone
                         animations:^{

                             _mainWindow.backgroundColor = [UIColor clearColor];

                             backSubView.layer.transform = CATransform3DMakeScale_HIDE_ANIM
                             backSubView.layer.opacity   = OPACITY_SUBVIEW_HIDE_ANIM;

                             btSubView.layer.transform   = CATransform3DMakeScale_HIDE_ANIM
                             btSubView.layer.opacity     = OPACITY_SUBVIEW_HIDE_ANIM;

                         }
                         completion:^(BOOL finished) {

                             for (UIView *subview in [_mainWindow subviews]) {
                                 [subview removeFromSuperview];
                             }

                             _mainWindow = nil;

                         }
         ];

    }
}

#pragma mark -
#pragma mark CLSCustomBaseViewDelegate
- (void)touchesEventHandle
{
    if (_enableBaseViewTouch) {
        [self hideWindow];
    }
}

#pragma mark -
#pragma mark Button Action
- (void)buttonTap:(id)sender
{
    if ([_delegate respondsToSelector:@selector(buttonTapEventHandle)]) {
        [_delegate buttonTapEventHandle];
    };
}

@end


text:
package org.apache.deltaspike.test.core.impl.future;

import org.apache.deltaspike.core.api.future.Futureable;

import javax.enterprise.context.ApplicationScoped;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

@ApplicationScoped
public class Service
{
    @Futureable // or CompletableFuture<String>
    public Future<String> thatSLong(final long sleep)
    {
        try
        {
            Thread.sleep(sleep);
            // return CompletableFuture.completedFuture("done");
            return new Future<String>()  // EE will have AsyncFuture but more designed for j8 ^^
            {
                @Override
                public boolean cancel(final boolean mayInterruptIfRunning)
                {
                    return false;
                }

                @Override
                public boolean isCancelled()
                {
                    return false;
                }

                @Override
                public boolean isDone()
                {
                    return true;
                }

                @Override
                public String get() throws InterruptedException, ExecutionException
                {
                    return "done";
                }

                @Override
                public String get(final long timeout, final TimeUnit unit)
                        throws InterruptedException, ExecutionException, TimeoutException
                {
                    return "done";
                }
            };
        }
        catch (final InterruptedException e)
        {
            Thread.interrupted();
            throw new IllegalStateException(e);
        }
    }
}


text:
layout: page
title: Cantu Trade Conference
date: 2016-05-24
author: Kimberly Meadows
tags: weekly links, java
status: published
summary: Pellentesque consectetur convallis ante, sit amet.
banner: images/banner/wedding.jpg
booking:
  startDate: 09/02/2018
  endDate: 09/04/2018
  ctyhocn: MGCHXHX
  groupCode: CTC
published: true
---
Duis suscipit mauris id augue lacinia feugiat. Nam quis pretium felis. Ut sed ornare mi, at porta turpis. Nullam id mi ornare, congue enim a, sodales odio. Proin tempus dapibus arcu, eget varius nisl bibendum non. Nunc laoreet euismod leo vel egestas. Aliquam diam tellus, feugiat quis nibh non, dignissim vehicula justo. Cras nec efficitur augue. Aenean finibus libero nisl, sit amet laoreet justo fringilla ac. Ut interdum tempus auctor.

1 Ut quis mi non lacus luctus iaculis
1 Etiam in sem sit amet nulla volutpat lobortis
1 Vivamus quis lacus at est viverra rutrum
1 Sed tempus ante ac magna congue tempor
1 Sed quis lorem quis velit egestas mattis eget in metus.

Fusce laoreet blandit enim sit amet pharetra. Vestibulum ante mauris, porttitor ultrices enim ac, rhoncus condimentum diam. Ut ac sollicitudin magna, et dictum erat. Nunc interdum, diam vitae lacinia tempus, elit dolor semper est, sed consectetur nisl augue at nibh. Integer consequat magna et ante bibendum, id vehicula neque luctus. Proin porttitor vestibulum mauris ut viverra. Nullam ultrices ligula blandit eros maximus consectetur in id lorem. Etiam quis iaculis odio. Suspendisse porttitor viverra velit, at venenatis massa auctor non. Sed vel ligula a metus ultrices semper. Vestibulum ultrices tristique ultrices. Fusce pretium lorem sit amet lorem mattis, ac efficitur tortor cursus. Quisque aliquet lorem turpis, in dictum ex placerat ut.


text:
import { createFragmentContainer, graphql } from "react-relay"
import { SystemQueryRenderer } from "System/Relay/SystemQueryRenderer"
import { AboutArtworksRailQuery } from "__generated__/AboutArtworksRailQuery.graphql"
import { AboutArtworksRail_viewer$data } from "__generated__/AboutArtworksRail_viewer.graphql"
import { Rail } from "Components/Rail"
import { extractNodes } from "Utils/extractNodes"
import {
  ShelfArtworkFragmentContainer,
  ShelfArtworkPlaceholder,
} from "Components/Artwork/ShelfArtwork"
import { Skeleton } from "@artsy/palette"

interface AboutArtworksRailProps {
  viewer: AboutArtworksRail_viewer$data
}

export const AboutArtworksRail: React.FC<AboutArtworksRailProps> = props => {
  const artworks = extractNodes(props.viewer.artworksConnection)
  return (
    <Rail
      title="Trending Now"
      viewAllLabel="View All"
      viewAllHref="/gene/trending-this-week"
      getItems={() => {
        return artworks.map(artwork => (
          <ShelfArtworkFragmentContainer
            artwork={artwork}
            key={artwork.internalID}
          />
        ))
      }}
    />
  )
}

export const AboutArtworksRailFragmentContainer = createFragmentContainer(
  AboutArtworksRail,
  {
    viewer: graphql`
      fragment AboutArtworksRail_viewer on Viewer {
        artworksConnection(first: 50, geneIDs: "trending-this-week") {
          edges {
            node {
              ...ShelfArtwork_artwork
              internalID
              slug
              href
            }
          }
        }
      }
    `,
  }
)

export const AboutArtworksRailQueryRenderer: React.FC = () => {
  return (
    <SystemQueryRenderer<AboutArtworksRailQuery>
      placeholder={PLACEHOLDER}
      query={graphql`
        query AboutArtworksRailQuery {
          viewer {
            ...AboutArtworksRail_viewer
          }
        }
      `}
      render={({ props, error }) => {
        if (error) {
          console.error(error)
          return null
        }

        if (!props?.viewer) {
          return PLACEHOLDER
        }

        return <AboutArtworksRailFragmentContainer viewer={props.viewer} />
      }}
    />
  )
}

const PLACEHOLDER = (
  <Skeleton>
    <Rail
      title="Trending Now"
      viewAllLabel="View All"
      viewAllHref="/gene/trending-this-week"
      getItems={() => {
        return [...new Array(8)].map((_, i) => {
          return <ShelfArtworkPlaceholder key={i} index={i} />
        })
      }}
    />
  </Skeleton>
)


text:
namespace content {

namespace {

void SaveRegistrationCallback(
    ServiceWorkerStatusCode expected_status,
    bool* called,
    scoped_refptr<ServiceWorkerRegistration>* registration,
    ServiceWorkerStatusCode status,
    const scoped_refptr<ServiceWorkerRegistration>& result) {
  EXPECT_EQ(expected_status, status);
  *called = true;
  *registration = result;
}

void SaveFoundRegistrationCallback(
    bool expected_found,
    ServiceWorkerStatusCode expected_status,
    bool* called,
    scoped_refptr<ServiceWorkerRegistration>* registration,
    bool found,
    ServiceWorkerStatusCode status,
    const scoped_refptr<ServiceWorkerRegistration>& result) {
  EXPECT_EQ(expected_found, found);
  EXPECT_EQ(expected_status, status);
  *called = true;
  *registration = result;
}

// Creates a callback which both keeps track of if it's been called,
// as well as the resulting registration. Whent the callback is fired,
// it ensures that the resulting status matches the expectation.
// 'called' is useful for making sure a sychronous callback is or
// isn't called.
ServiceWorkerRegisterJob::RegistrationCallback SaveRegistration(
    ServiceWorkerStatusCode expected_status,
    bool* called,
    scoped_refptr<ServiceWorkerRegistration>* registration) {
  *called = false;
  return base::Bind(
      &SaveRegistrationCallback, expected_status, called, registration);
}

ServiceWorkerStorage::FindRegistrationCallback SaveFoundRegistration(
    bool expected_found,
    ServiceWorkerStatusCode expected_status,
    bool* called,
    scoped_refptr<ServiceWorkerRegistration>* registration) {
  *called = false;
  return base::Bind(&SaveFoundRegistrationCallback,
                    expected_found,
                    expected_status,
                    called,
                    registration);
}

void SaveUnregistrationCallback(ServiceWorkerStatusCode expected_status,
                                bool* called,
                                ServiceWorkerStatusCode status) {
  EXPECT_EQ(expected_status, status);
  *called = true;
}

ServiceWorkerRegisterJob::UnregistrationCallback SaveUnregistration(
    ServiceWorkerStatusCode expected_status,
    bool* called) {
  *called = false;
  return base::Bind(&SaveUnregistrationCallback, expected_status, called);
}

}  // namespace

class ServiceWorkerJobTest : public testing::Test {
 public:
  ServiceWorkerJobTest()
      : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
        render_process_id_(88) {}

  virtual void SetUp() OVERRIDE {
    context_.reset(new ServiceWorkerContextCore(base::FilePath(), NULL));
    helper_.reset(new EmbeddedWorkerTestHelper(context_.get(),
                                               render_process_id_));
  }

  virtual void TearDown() OVERRIDE {
    helper_.reset();
    context_.reset();
  }

  ServiceWorkerJobCoordinator* job_coordinator() const {
    return context_->job_coordinator();
  }
  ServiceWorkerStorage* storage() const { return context_->storage(); }

 protected:
  TestBrowserThreadBundle browser_thread_bundle_;
  scoped_ptr<ServiceWorkerContextCore> context_;
  scoped_ptr<EmbeddedWorkerTestHelper> helper_;

  int render_process_id_;
};

TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) {
  scoped_refptr<ServiceWorkerRegistration> original_registration;
  bool called;
  job_coordinator()->Register(
      GURL("http://www.example.com/*"),
      GURL("http://www.example.com/service_worker.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &original_registration));
  EXPECT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(called);

  scoped_refptr<ServiceWorkerRegistration> registration1;
  storage()->FindRegistrationForDocument(
      GURL("http://www.example.com/"),
      SaveFoundRegistration(true, SERVICE_WORKER_OK, &called, &registration1));
  scoped_refptr<ServiceWorkerRegistration> registration2;
  storage()->FindRegistrationForDocument(
      GURL("http://www.example.com/"),
      SaveFoundRegistration(true, SERVICE_WORKER_OK, &called, &registration2));

  ServiceWorkerRegistration* null_registration(NULL);
  ASSERT_EQ(null_registration, registration1);
  ASSERT_EQ(null_registration, registration2);
  EXPECT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(called);
  ASSERT_NE(null_registration, registration1);
  ASSERT_NE(null_registration, registration2);

  ASSERT_EQ(registration1, registration2);
}

TEST_F(ServiceWorkerJobTest, SameMatchSameRegistration) {
  bool called;
  scoped_refptr<ServiceWorkerRegistration> original_registration;
  job_coordinator()->Register(
      GURL("http://www.example.com/*"),
      GURL("http://www.example.com/service_worker.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &original_registration));
  EXPECT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(called);
  ASSERT_NE(static_cast<ServiceWorkerRegistration*>(NULL),
            original_registration.get());

  scoped_refptr<ServiceWorkerRegistration> registration1;
  storage()->FindRegistrationForDocument(
      GURL("http://www.example.com/one"),
      SaveFoundRegistration(true, SERVICE_WORKER_OK, &called, &registration1));

  EXPECT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(called);

  scoped_refptr<ServiceWorkerRegistration> registration2;
  storage()->FindRegistrationForDocument(
      GURL("http://www.example.com/two"),
      SaveFoundRegistration(true, SERVICE_WORKER_OK, &called, &registration2));
  EXPECT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(called);

  ASSERT_EQ(registration1, registration2);
}

TEST_F(ServiceWorkerJobTest, DifferentMatchDifferentRegistration) {
  bool called1;
  scoped_refptr<ServiceWorkerRegistration> original_registration1;
  job_coordinator()->Register(
      GURL("http://www.example.com/one/*"),
      GURL("http://www.example.com/service_worker.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called1, &original_registration1));

  bool called2;
  scoped_refptr<ServiceWorkerRegistration> original_registration2;
  job_coordinator()->Register(
      GURL("http://www.example.com/two/*"),
      GURL("http://www.example.com/service_worker.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called2, &original_registration2));

  EXPECT_FALSE(called1);
  EXPECT_FALSE(called2);
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(called2);
  EXPECT_TRUE(called1);

  scoped_refptr<ServiceWorkerRegistration> registration1;
  storage()->FindRegistrationForDocument(
      GURL("http://www.example.com/one/"),
      SaveFoundRegistration(true, SERVICE_WORKER_OK, &called1, &registration1));
  scoped_refptr<ServiceWorkerRegistration> registration2;
  storage()->FindRegistrationForDocument(
      GURL("http://www.example.com/two/"),
      SaveFoundRegistration(true, SERVICE_WORKER_OK, &called2, &registration2));

  EXPECT_FALSE(called1);
  EXPECT_FALSE(called2);
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(called2);
  EXPECT_TRUE(called1);

  ASSERT_NE(registration1, registration2);
}

// Make sure basic registration is working.
TEST_F(ServiceWorkerJobTest, Register) {
  bool called = false;
  scoped_refptr<ServiceWorkerRegistration> registration;
  job_coordinator()->Register(
      GURL("http://www.example.com/*"),
      GURL("http://www.example.com/service_worker.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_NE(scoped_refptr<ServiceWorkerRegistration>(NULL), registration);
}

// Make sure registrations are cleaned up when they are unregistered.
TEST_F(ServiceWorkerJobTest, Unregister) {
  GURL pattern("http://www.example.com/*");

  bool called;
  scoped_refptr<ServiceWorkerRegistration> registration;
  job_coordinator()->Register(
      pattern,
      GURL("http://www.example.com/service_worker.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  job_coordinator()->Unregister(pattern,
                                render_process_id_,
                                SaveUnregistration(SERVICE_WORKER_OK, &called));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_TRUE(registration->HasOneRef());

  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(false, SERVICE_WORKER_OK, &called, &registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_EQ(scoped_refptr<ServiceWorkerRegistration>(NULL), registration);
}

// Make sure that when a new registration replaces an existing
// registration, that the old one is cleaned up.
TEST_F(ServiceWorkerJobTest, RegisterNewScript) {
  GURL pattern("http://www.example.com/*");

  bool called;
  scoped_refptr<ServiceWorkerRegistration> old_registration;
  job_coordinator()->Register(
      pattern,
      GURL("http://www.example.com/service_worker.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &old_registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  scoped_refptr<ServiceWorkerRegistration> old_registration_by_pattern;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          true, SERVICE_WORKER_OK, &called, &old_registration_by_pattern));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_EQ(old_registration, old_registration_by_pattern);
  old_registration_by_pattern = NULL;

  scoped_refptr<ServiceWorkerRegistration> new_registration;
  job_coordinator()->Register(
      pattern,
      GURL("http://www.example.com/service_worker_new.js"),
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &new_registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_TRUE(old_registration->HasOneRef());

  ASSERT_NE(old_registration, new_registration);

  scoped_refptr<ServiceWorkerRegistration> new_registration_by_pattern;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          true, SERVICE_WORKER_OK, &called, &new_registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_NE(new_registration_by_pattern, old_registration);
}

// Make sure that when registering a duplicate pattern+script_url
// combination, that the same registration is used.
TEST_F(ServiceWorkerJobTest, RegisterDuplicateScript) {
  GURL pattern("http://www.example.com/*");
  GURL script_url("http://www.example.com/service_worker.js");

  bool called;
  scoped_refptr<ServiceWorkerRegistration> old_registration;
  job_coordinator()->Register(
      pattern,
      script_url,
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &old_registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  scoped_refptr<ServiceWorkerRegistration> old_registration_by_pattern;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          true, SERVICE_WORKER_OK, &called, &old_registration_by_pattern));
  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_TRUE(old_registration_by_pattern);

  scoped_refptr<ServiceWorkerRegistration> new_registration;
  job_coordinator()->Register(
      pattern,
      script_url,
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &called, &new_registration));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_EQ(old_registration, new_registration);

  ASSERT_FALSE(old_registration->HasOneRef());

  scoped_refptr<ServiceWorkerRegistration> new_registration_by_pattern;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          true, SERVICE_WORKER_OK, &called, &new_registration_by_pattern));

  ASSERT_FALSE(called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(called);

  ASSERT_EQ(new_registration, old_registration);
}

// Register and then unregister the pattern, in parallel. Job coordinator should
// process jobs until the last job.
TEST_F(ServiceWorkerJobTest, ParallelRegUnreg) {
  GURL pattern("http://www.example.com/*");
  GURL script_url("http://www.example.com/service_worker.js");

  bool registration_called = false;
  scoped_refptr<ServiceWorkerRegistration> registration;
  job_coordinator()->Register(
      pattern,
      script_url,
      render_process_id_,
      SaveRegistration(SERVICE_WORKER_OK, &registration_called, &registration));

  bool unregistration_called = false;
  job_coordinator()->Unregister(
      pattern,
      render_process_id_,
      SaveUnregistration(SERVICE_WORKER_OK, &unregistration_called));

  ASSERT_FALSE(registration_called);
  ASSERT_FALSE(unregistration_called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(registration_called);
  ASSERT_TRUE(unregistration_called);

  ASSERT_TRUE(registration->is_shutdown());

  bool find_called = false;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          false, SERVICE_WORKER_OK, &find_called, &registration));

  base::RunLoop().RunUntilIdle();

  ASSERT_EQ(scoped_refptr<ServiceWorkerRegistration>(), registration);
}

// Register conflicting scripts for the same pattern. The most recent
// registration should win, and the old registration should have been
// shutdown.
TEST_F(ServiceWorkerJobTest, ParallelRegNewScript) {
  GURL pattern("http://www.example.com/*");

  GURL script_url1("http://www.example.com/service_worker1.js");
  bool registration1_called = false;
  scoped_refptr<ServiceWorkerRegistration> registration1;
  job_coordinator()->Register(
      pattern,
      script_url1,
      render_process_id_,
      SaveRegistration(
          SERVICE_WORKER_OK, &registration1_called, &registration1));

  GURL script_url2("http://www.example.com/service_worker2.js");
  bool registration2_called = false;
  scoped_refptr<ServiceWorkerRegistration> registration2;
  job_coordinator()->Register(
      pattern,
      script_url2,
      render_process_id_,
      SaveRegistration(
          SERVICE_WORKER_OK, &registration2_called, &registration2));

  ASSERT_FALSE(registration1_called);
  ASSERT_FALSE(registration2_called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(registration1_called);
  ASSERT_TRUE(registration2_called);

  scoped_refptr<ServiceWorkerRegistration> registration;
  bool find_called = false;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          true, SERVICE_WORKER_OK, &find_called, &registration));

  base::RunLoop().RunUntilIdle();

  EXPECT_TRUE(registration1->is_shutdown());
  EXPECT_FALSE(registration2->is_shutdown());
  ASSERT_EQ(registration2, registration);
}

// Register the exact same pattern + script. Requests should be
// coalesced such that both callers get the exact same registration
// object.
TEST_F(ServiceWorkerJobTest, ParallelRegSameScript) {
  GURL pattern("http://www.example.com/*");

  GURL script_url("http://www.example.com/service_worker1.js");
  bool registration1_called = false;
  scoped_refptr<ServiceWorkerRegistration> registration1;
  job_coordinator()->Register(
      pattern,
      script_url,
      render_process_id_,
      SaveRegistration(
          SERVICE_WORKER_OK, &registration1_called, &registration1));

  bool registration2_called = false;
  scoped_refptr<ServiceWorkerRegistration> registration2;
  job_coordinator()->Register(
      pattern,
      script_url,
      render_process_id_,
      SaveRegistration(
          SERVICE_WORKER_OK, &registration2_called, &registration2));

  ASSERT_FALSE(registration1_called);
  ASSERT_FALSE(registration2_called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(registration1_called);
  ASSERT_TRUE(registration2_called);

  ASSERT_EQ(registration1, registration2);

  scoped_refptr<ServiceWorkerRegistration> registration;
  bool find_called = false;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          true, SERVICE_WORKER_OK, &find_called, &registration));

  base::RunLoop().RunUntilIdle();
  ASSERT_EQ(registration, registration1);
}

// Call simulataneous unregister calls.
TEST_F(ServiceWorkerJobTest, ParallelUnreg) {
  GURL pattern("http://www.example.com/*");

  GURL script_url("http://www.example.com/service_worker.js");
  bool unregistration1_called = false;
  job_coordinator()->Unregister(
      pattern,
      render_process_id_,
      SaveUnregistration(SERVICE_WORKER_OK, &unregistration1_called));

  bool unregistration2_called = false;
  job_coordinator()->Unregister(
      pattern,
      render_process_id_,
      SaveUnregistration(SERVICE_WORKER_OK, &unregistration2_called));

  ASSERT_FALSE(unregistration1_called);
  ASSERT_FALSE(unregistration2_called);
  base::RunLoop().RunUntilIdle();
  ASSERT_TRUE(unregistration1_called);
  ASSERT_TRUE(unregistration2_called);

  // There isn't really a way to test that they are being coalesced,
  // but we can make sure they can exist simultaneously without
  // crashing.
  scoped_refptr<ServiceWorkerRegistration> registration;
  bool find_called = false;
  storage()->FindRegistrationForPattern(
      pattern,
      SaveFoundRegistration(
          false, SERVICE_WORKER_OK, &find_called, &registration));

  base::RunLoop().RunUntilIdle();
  ASSERT_EQ(scoped_refptr<ServiceWorkerRegistration>(), registration);
}

}  // namespace content