text:
<?php

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

class Intermediario extends CI_Controller {

    private $limite = 10;

    function __construct() {

        parent::__construct();
        $this->load->library('session');
        $this->load->library('encrypt');
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('pagination');
        $datoiniciar = $this->session->userdata('Nombre');
        if (strlen($datoiniciar) == 0) {

            redirect('', 'refresh');
        }
       /*  $idpuesto = $this->session->userdata('idcat_puesto');
         if ($idpuesto != 1&&$idpuesto != 6) {

           redirect('registro', 'refresh');
        }*/

        $this->load->model('models_intermediario');
    }

    public function index() {

        $data['msn'] = -1;
        $nombrez = $this->session->userdata('Nombre') . ' ' . $this->session->userdata('apellidos');
        $datax['nombre'] = $nombrez;
        $datax['puesto'] = $this->session->userdata('puesto');
        $data['nombre'] = $nombrez;
        $data['idcapturista'] = $this->session->userdata('idempleado');
        $data['menu'] = $this->load->view('plantilla/menu', $datax, true);
        $data['head'] = $this->load->view('plantilla/head', true);
        $this->load->view('intermediario/registro', $data);
    }

    public function registro() {

        $vju = $this->input->post('tipo');
        if (!empty($vju)) {

            $data = array(
                'nombre' => $this->input->post('tipo'));

            $valor = $this->models_intermediario->insertar($data);

            $data['msn'] = $valor;
        } else {
            $data['msn'] = -1;
        }

        $nombrez = $this->session->userdata('Nombre') . ' ' . $this->session->userdata('apellidos');
        $datax['nombre'] = $nombrez;
        $datax['puesto'] = $this->session->userdata('puesto');
        $data['nombre'] = $nombrez;
        $data['idcapturista'] = $this->session->userdata('idempleado');
        $data['menu'] = $this->load->view('plantilla/menu', $datax, true);
        $data['head'] = $this->load->view('plantilla/head', true);
        $this->load->view('intermediario/registro', $data);
    }

    public function mostrar() {

        $offset = $this->input->get('per_page');
        $uri_segment = 0;
        if ($offset == "") {
            $offset = 0;
        }

        $nombre = trim($this->input->get('nombre'));
        $data['registros'] = $this->models_intermediario->mostrar($nombre, $offset, $this->limite);

        $config['base_url'] = base_url() . 'intermediario/mostrar?nombre=' . $nombre;
        $config['total_rows'] = $this->models_intermediario->mostrarcount($nombre);
        $config['per_page'] = $this->limite; //Número de registros mostrados por páginas
        $config['num_links'] = 5; //Número de links mostrados en la paginación
        $config['page_query_string'] = true;
        $config['full_tag_open'] = '
';
        $config['first_tag_open'] = '
';
        $config['first_link'] = 'Primera'; //primer link
        $config['first_tag_close'] = '
';
        $config['last_tag_open'] = '
';
        $config['last_link'] = 'Última'; //último link
        $config['last_tag_close'] = '
';
        $config["uri_segment"] = $uri_segment; //el segmento de la paginación
        $config['next_tag_open'] = '
';
        $config['next_link'] = 'Siguiente'; //siguiente link
        $config['next_tag_close'] = '
';
        $config['prev_tag_open'] = '
';
        $config['prev_link'] = 'Anterior'; //anterior link
        $config['prev_tag_close'] = '
';
        $config['num_tag_open'] = '
';
        $config['num_tag_close'] = '
';
        $config['cur_tag_open'] = '
';
        $config['cur_tag_close'] = '
';
        $config['full_tag_close'] = '
';

        $this->pagination->initialize($config); //inicializamos la paginación
        $data["pagination"] = $this->pagination->create_links();
        $nombrez = $this->session->userdata('Nombre') . ' ' . $this->session->userdata('apellidos');
        $datax['nombre'] = $nombrez;
        $datax['puesto'] = $this->session->userdata('puesto');
        $data['nombre'] = $nombrez;
        $data['idcapturista'] = $this->session->userdata('idempleado');
        $data['menu'] = $this->load->view('plantilla/menu', $datax, true);
        $data['head'] = $this->load->view('plantilla/head', true);
        $this->load->view('intermediario/listar', $data);
    }

    public function actualizar() {

        $idregistro = $this->input->get('idtipo');

        $data = array(
            'nombre' => $this->input->get('tipo'));

        $valor = $this->models_intermediario->update($idregistro, $data);

        echo '

 Se actualizo correctamente!

                                        <button type="button" class="close" data-dismiss="alert">×</button>

';
    }

    public function editar() {

        $idregistro = $this->input->get('idregistro');
        $nombrez = $this->session->userdata('Nombre') . ' ' . $this->session->userdata('apellidos');
        $datax['nombre'] = $nombrez;
        $datax['puesto'] = $this->session->userdata('puesto');
        $data['nombre'] = $nombrez;
        $data['idcapturista'] = $this->session->userdata('idempleado');
        $data['menu'] = $this->load->view('plantilla/menu', $datax, true);
        $data['head'] = $this->load->view('plantilla/head', true);
        $data['query'] = $this->models_intermediario->Buscar($idregistro);

        $this->load->view('intermediario/editar', $data);
    }

}


text:
// @copyright @polymer\iron-checked-element-behavior\iron-checked-element-behavior.js
// @copyright 2017-2018 adalberto.lacruz@gmail.com

import { TYPE_BOOL, TYPE_STRING } from '../util/constants.js';

// TODO: validate, form. Review active/check relation
/**
 * [checked ⛳]
 * [required ⛳aria-required]
 * [toggles ⛳]
 * [value 💰on]
 *
 * Requires:
 *   AlgIronButtonStateMixin
 *   AlgIronValidatableMixin
 *
 * @param {*} base
 */
export const AlgIronCheckedElementMixin = (base) => class extends base {
  /** @override */
  deferredConstructor() {
    super.deferredConstructor();

    this.attributeManager
      .define('aria-required', TYPE_BOOL)
      .reflect({ type: 'true-remove'})

      .define('checked', TYPE_BOOL)
      .onChangeModify('active')
      .reflect()
      .on((value) => {
        if (!value && this.hasAttribute('frozen')) this.removeAttribute('frozen');
      })
      .store((entry$) => { this.checked$ = entry$; })

      .define('required', TYPE_BOOL)
      .onChangeModify('aria-required')
      .store((entry$) => { this.required$ = entry$; })

      .define('toggles', TYPE_BOOL, { value: true}) // yet defined else
      .reflect()
      .autoDispatch()

      .define('value', TYPE_STRING)
      .setTransformer((value) => value == null ? 'on' : value); // onNullSet('on');

    // Duplicate from active definition?
    this.messageManager
      .define('change', { toAttribute: 'active' }); // message: true/false
  }

  /**
   * Attributes managed by the component
   * @override
   * @type {Array<String>}
   */
  static get observedAttributes() {
    return super.observedAttributes.concat(['checked', 'on-change', 'required']);
  }

  /** @type {String} */
  get value() { return this.attributeManager.getValue('value'); }

  /**
   * Returns false if the element is required and not checked, and true otherwise.
   * @override
   * @param {*} _value Ignored.
   * @return {boolean} true if `required` is false or if `checked` is true.
   */
  _getValidity(_value = null) {
    return this.disabled$.value || !this.required$.value || this.checked$.value;
  }
};

redpajama_set_name: RedPajamaGithub


text:
package org.keycloak.authentication.otp;

import org.keycloak.provider.Provider;
import org.keycloak.provider.ProviderFactory;
import org.keycloak.provider.Spi;

public class OTPApplicationSpi implements Spi {

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

    @Override
    public String getName() {
        return "otp-application";
    }

    @Override
    public Class<? extends Provider> getProviderClass() {
        return OTPApplicationProvider.class;
    }

    @Override
    public Class<? extends ProviderFactory> getProviderFactoryClass() {
        return OTPApplicationProviderFactory.class;
    }

}


text:
module Spree
  module Admin
    class StoreCreditError < StandardError; end

    class StoreCreditsController < Spree::Admin::BaseController
      before_action :load_user
      before_action :load_categories, only: [:new, :edit]
      before_action :load_store_credit, only: [:new, :edit, :update]
      before_action :ensure_unused_store_credit, only: [:update]

      def index
        @store_credits = @user.store_credits.reverse_order
      end

      def create
        @store_credit = @user.store_credits.build(
          permitted_store_credit_params.merge(
            created_by: try_spree_current_user,
            action_originator: try_spree_current_user
          )
        )

        if @store_credit.save
          flash[:success] = flash_message_for(@store_credit, :successfully_created)
          redirect_to admin_user_store_credits_path(@user)
        else
          load_categories
          flash[:error] = Spree.t('store_credit.errors.unable_to_create')
          render :new
        end
      end

      def update
        @store_credit.assign_attributes(permitted_store_credit_params)
        @store_credit.created_by = try_spree_current_user

        if @store_credit.save
          flash[:success] = flash_message_for(@store_credit, :successfully_updated)
          redirect_to admin_user_store_credits_path(@user)
        else
          load_categories
          flash[:error] = Spree.t('store_credit.errors.unable_to_update')
          render :edit
        end
      end

      def destroy
        @store_credit = @user.store_credits.find(params[:id])
        ensure_unused_store_credit

        if @store_credit.destroy
          respond_with(@store_credit) do |format|
            format.html { redirect_to admin_user_store_credits_path(@user) }
            format.js { render_js_for_destroy }
          end
        else
          render text: Spree.t('store_credit.errors.unable_to_delete'), status: :unprocessable_entity
        end
      end

      protected

      def permitted_store_credit_params
        params.require(:store_credit).permit(permitted_store_credit_attributes).
          merge(currency: Spree::Config[:currency])
      end

      private

      def load_user
        @user = Spree.user_class.find_by(id: params[:user_id])

        unless @user
          flash[:error] = Spree.t(:user_not_found)
          redirect_to admin_path
        end
      end

      def load_categories
        @credit_categories = Spree::StoreCreditCategory.order(:name)
      end

      def load_store_credit
        @store_credit = Spree::StoreCredit.find_by_id(params[:id]) || Spree::StoreCredit.new
      end

      def ensure_unused_store_credit
        unless @store_credit.amount_used.zero?
          raise StoreCreditError.new(Spree.t('store_credit.errors.cannot_change_used_store_credit'))
        end
      end
    end
  end
end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.gkehub.v1beta.model;

/**
 * State of Policy Controller installation.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the GKE Hub API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class ConfigManagementGatekeeperDeploymentState extends com.google.api.client.json.GenericJson {

  /**
   * Status of gatekeeper-audit deployment.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String gatekeeperAudit;

  /**
   * Status of gatekeeper-controller-manager pod.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String gatekeeperControllerManagerState;

  /**
   * Status of the pod serving the mutation webhook.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String gatekeeperMutation;

  /**
   * Status of gatekeeper-audit deployment.
   * @return value or {@code null} for none
   */
  public java.lang.String getGatekeeperAudit() {
    return gatekeeperAudit;
  }

  /**
   * Status of gatekeeper-audit deployment.
   * @param gatekeeperAudit gatekeeperAudit or {@code null} for none
   */
  public ConfigManagementGatekeeperDeploymentState setGatekeeperAudit(java.lang.String gatekeeperAudit) {
    this.gatekeeperAudit = gatekeeperAudit;
    return this;
  }

  /**
   * Status of gatekeeper-controller-manager pod.
   * @return value or {@code null} for none
   */
  public java.lang.String getGatekeeperControllerManagerState() {
    return gatekeeperControllerManagerState;
  }

  /**
   * Status of gatekeeper-controller-manager pod.
   * @param gatekeeperControllerManagerState gatekeeperControllerManagerState or {@code null} for none
   */
  public ConfigManagementGatekeeperDeploymentState setGatekeeperControllerManagerState(java.lang.String gatekeeperControllerManagerState) {
    this.gatekeeperControllerManagerState = gatekeeperControllerManagerState;
    return this;
  }

  /**
   * Status of the pod serving the mutation webhook.
   * @return value or {@code null} for none
   */
  public java.lang.String getGatekeeperMutation() {
    return gatekeeperMutation;
  }

  /**
   * Status of the pod serving the mutation webhook.
   * @param gatekeeperMutation gatekeeperMutation or {@code null} for none
   */
  public ConfigManagementGatekeeperDeploymentState setGatekeeperMutation(java.lang.String gatekeeperMutation) {
    this.gatekeeperMutation = gatekeeperMutation;
    return this;
  }

  @Override
  public ConfigManagementGatekeeperDeploymentState set(String fieldName, Object value) {
    return (ConfigManagementGatekeeperDeploymentState) super.set(fieldName, value);
  }

  @Override
  public ConfigManagementGatekeeperDeploymentState clone() {
    return (ConfigManagementGatekeeperDeploymentState) super.clone();
  }

}


text:
require 'spec_helper'

describe Mongo::URI::SRVProtocol do
  clean_slate_for_all

  let(:scheme) { 'mongodb+srv://' }
  let(:uri) { described_class.new(string) }

  let(:client) do
    new_local_client_nmio(string)
  end

  describe 'invalid uris' do

    context 'when there is more than one hostname' do

      let(:string) { "#{scheme}#{hosts}" }
      let(:hosts) { 'test5.test.build.10gen.cc,test6.test.build.10gen.cc' }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the the hostname has a port' do

      let(:string) { "#{scheme}#{hosts}" }
      let(:hosts) { 'test5.test.build.10gen.cc:8123' }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the host in URI does not have {hostname}, {domainname} and {tld}' do

      let(:string) { "#{scheme}#{hosts}" }
      let(:hosts) { '10gen.cc/' }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the {tld} is empty' do

      let(:string) { "#{scheme}#{hosts}" }
      let(:hosts) { '10gen.cc./' }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'string is not uri' do

      let(:string) { 'tyler' }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'empty string' do

      let(:string) { '' }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://' do

      let(:string) { "#{scheme}" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://localhost::27017/' do

      let(:string) { "#{scheme}localhost::27017/" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://::' do

      let(:string) { "#{scheme}::" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://localhost,localhost::' do

      let(:string) { "#{scheme}localhost,localhost::" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://localhost::27017,abc' do

      let(:string) { "#{scheme}localhost::27017,abc" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://localhost:-1' do

      let(:string) { "#{scheme}localhost:-1" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://localhost:0/' do

      let(:string) { "#{scheme}localhost:0/" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://localhost:65536' do

      let(:string) { "#{scheme}localhost:65536" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://localhost:foo' do

      let(:string) { "#{scheme}localhost:foo" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://mongodb://[::1]:-1' do

      let(:string) { "#{scheme}mongodb://[::1]:-1" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://[::1]:0/' do

      let(:string) { "#{scheme}[::1]:0/" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://[::1]:65536' do

      let(:string) { "#{scheme}[::1]:65536" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://[::1]:65536/' do

      let(:string) { "#{scheme}[::1]:65536/" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://[::1]:foo' do

      let(:string) { "#{scheme}[::1]:foo" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://example.com?w=1' do

      let(:string) { "#{scheme}example.com?w=1" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'mongodb+srv://example.com/?w' do

      let(:string) { "#{scheme}example.com/?w" }

      it 'raises an error' do
        expect { uri }.to raise_error(Mongo::Error::InvalidURI)
      end
    end
  end

  describe 'valid uris' do
    require_external_connectivity

    describe 'invalid query results' do

      context 'when there are too many TXT records' do

        let(:string) { "#{scheme}test6.test.build.10gen.cc/" }

        it 'raises an error' do
          expect { uri }.to raise_exception(Mongo::Error::InvalidTXTRecord)
        end
      end

      context 'when the TXT has an invalid option' do

        let(:string) { "#{scheme}test10.test.build.10gen.cc" }

        it 'raises an error' do
          expect { uri }.to raise_exception(Mongo::Error::InvalidTXTRecord)
        end
      end

      context 'when the SRV records domain does not match hostname used for the query' do

        let(:string) { "#{scheme}test12.test.build.10gen.cc" }

        it 'raises an error' do
          expect { uri }.to raise_exception(Mongo::Error::MismatchedDomain)
        end
      end

      context 'when the query returns no SRV records' do

        let(:string) { "#{scheme}test4.test.build.10gen.cc" }

        it 'raises an error' do
          expect { uri }.to raise_exception(Mongo::Error::NoSRVRecords)
        end
      end
    end

    describe '#servers' do
      let(:string) { "#{scheme}#{servers}" }

      context 'single server' do
        let(:servers) { 'test5.test.build.10gen.cc' }

        it 'returns an array with the parsed server' do
          expect(uri.servers).to eq(['localhost.test.build.10gen.cc:27017'])
        end
      end
    end

    describe '#client_options' do

      let(:db)          { SpecConfig.instance.test_db }
      let(:servers)     { 'test5.test.build.10gen.cc' }
      let(:string)      { "#{scheme}#{credentials}@#{servers}/#{db}" }
      let(:user)        { 'tyler' }
      let(:password)    { 's3kr4t' }
      let(:credentials) { "#{user}:#{password}" }

      let(:options) do
        uri.client_options
      end

      it 'includes the database in the options' do
        expect(options[:database]).to eq(SpecConfig.instance.test_db)
      end

      it 'includes the user in the options' do
        expect(options[:user]).to eq(user)
      end

      it 'includes the password in the options' do
        expect(options[:password]).to eq(password)
      end

      it 'sets ssl to true' do
        expect(options[:ssl]).to eq(true)
      end
    end

    describe '#credentials' do
      let(:servers)    { 'test5.test.build.10gen.cc' }
      let(:string)   { "#{scheme}#{credentials}@#{servers}" }
      let(:user)     { 'tyler' }

      context 'username provided' do
        let(:credentials) { "#{user}:" }

        it 'returns the username' do
          expect(uri.credentials[:user]).to eq(user)
        end
      end

      context 'username and password provided' do
        let(:password)    { 's3kr4t' }
        let(:credentials) { "#{user}:#{password}" }

        it 'returns the username' do
          expect(uri.credentials[:user]).to eq(user)
        end

        it 'returns the password' do
          expect(uri.credentials[:password]).to eq(password)
        end
      end
    end

    describe '#database' do
      let(:servers)  { 'test5.test.build.10gen.cc' }
      let(:string) { "#{scheme}#{servers}/#{db}" }
      let(:db)     { 'auth-db' }

      context 'database provided' do
        it 'returns the database name' do
          expect(uri.database).to eq(db)
        end
      end
    end

    describe '#uri_options' do
      let(:servers)  { 'test5.test.build.10gen.cc' }
      let(:string) { "#{scheme}#{servers}/?#{options}" }

      context 'when no options were provided' do
        let(:string) { "#{scheme}#{servers}" }

        it 'returns an empty hash' do
          expect(uri.uri_options).to be_empty
        end
      end

      context 'write concern options provided' do

        context 'numerical w value' do
          let(:options) { 'w=1' }
          let(:concern) { Mongo::Options::Redacted.new(:w => 1)}

          it 'sets the write concern options' do
            expect(uri.uri_options[:write_concern]).to eq(concern)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:write_concern]).to eq(concern)
          end
        end

        context 'w=majority' do
          let(:options) { 'w=majority' }
          let(:concern) { Mongo::Options::Redacted.new(:w => :majority) }

          it 'sets the write concern options' do
            expect(uri.uri_options[:write_concern]).to eq(concern)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:write_concern]).to eq(concern)
          end
        end

        context 'journal' do
          let(:options) { 'journal=true' }
          let(:concern) { Mongo::Options::Redacted.new(:j => true) }

          it 'sets the write concern options' do
            expect(uri.uri_options[:write_concern]).to eq(concern)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:write_concern]).to eq(concern)
          end
        end

        context 'fsync' do
          let(:options) { 'fsync=true' }
          let(:concern) { Mongo::Options::Redacted.new(:fsync => true) }

          it 'sets the write concern options' do
            expect(uri.uri_options[:write_concern]).to eq(concern)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:write_concern]).to eq(concern)
          end
        end

        context 'wtimeoutMS' do
          let(:timeout) { 1234 }
          let(:options) { "w=2&wtimeoutMS=#{timeout}" }
          let(:concern) { Mongo::Options::Redacted.new(:w => 2, :wtimeout => timeout) }

          it 'sets the write concern options' do
            expect(uri.uri_options[:write_concern]).to eq(concern)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:write_concern]).to eq(concern)
          end
        end
      end

      context 'read preference option provided' do
        let(:options) { "readPreference=#{mode}" }

        context 'primary' do
          let(:mode) { 'primary' }
          let(:read) { Mongo::Options::Redacted.new(:mode => :primary) }

          it 'sets the read preference' do
            expect(uri.uri_options[:read]).to eq(read)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:read]).to eq(read)
          end
        end

        context 'primaryPreferred' do
          let(:mode) { 'primaryPreferred' }
          let(:read) { Mongo::Options::Redacted.new(:mode => :primary_preferred) }

          it 'sets the read preference' do
            expect(uri.uri_options[:read]).to eq(read)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:read]).to eq(read)
          end
        end

        context 'secondary' do
          let(:mode) { 'secondary' }
          let(:read) { Mongo::Options::Redacted.new(:mode => :secondary) }

          it 'sets the read preference' do
            expect(uri.uri_options[:read]).to eq(read)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:read]).to eq(read)
          end
        end

        context 'secondaryPreferred' do
          let(:mode) { 'secondaryPreferred' }
          let(:read) { Mongo::Options::Redacted.new(:mode => :secondary_preferred) }

          it 'sets the read preference' do
            expect(uri.uri_options[:read]).to eq(read)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:read]).to eq(read)
          end
        end

        context 'nearest' do
          let(:mode) { 'nearest' }
          let(:read) { Mongo::Options::Redacted.new(:mode => :nearest) }

          it 'sets the read preference' do
            expect(uri.uri_options[:read]).to eq(read)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:read]).to eq(read)
          end
        end
      end

      context 'read preference tags provided' do

        context 'single read preference tag set' do
          let(:options) do
            'readPreferenceTags=dc:ny,rack:1'
          end

          let(:read) do
            Mongo::Options::Redacted.new(:tag_sets => [{ 'dc' => 'ny', 'rack' => '1' }])
          end

          it 'sets the read preference tag set' do
            expect(uri.uri_options[:read]).to eq(read)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:read]).to eq(read)
          end
        end

        context 'multiple read preference tag sets' do
          let(:options) do
            'readPreferenceTags=dc:ny&readPreferenceTags=dc:bos'
          end

          let(:read) do
            Mongo::Options::Redacted.new(:tag_sets => [{ 'dc' => 'ny' }, { 'dc' => 'bos' }])
          end

          it 'sets the read preference tag sets' do
            expect(uri.uri_options[:read]).to eq(read)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:read]).to eq(read)
          end
        end
      end

      context 'read preference max staleness option provided' do

        let(:options) do
          'readPreference=Secondary&maxStalenessSeconds=120'
        end

        let(:read) do
          Mongo::Options::Redacted.new(mode: :secondary, :max_staleness => 120)
        end

        it 'sets the read preference max staleness in seconds' do
          expect(uri.uri_options[:read]).to eq(read)
        end

        it 'sets the options on a client created with the uri' do
          expect(client.options[:read]).to eq(read)
        end

        context 'when the read preference and max staleness combination is invalid' do

          context 'when max staleness is combined with read preference mode primary' do

            let(:options) do
              'readPreference=primary&maxStalenessSeconds=120'
            end

            it 'raises an exception when read preference is accessed on the client' do
              expect {
                client.server_selector
              }.to raise_exception(Mongo::Error::InvalidServerPreference)
            end
          end

          context 'when the max staleness value is too small' do

            let(:options) do
              'readPreference=secondary&maxStalenessSeconds=89'
            end

            it 'does not raise an exception until the read preference is used' do
              expect(client.read_preference).to eq(BSON::Document.new(mode: :secondary, max_staleness: 89))
            end
          end
        end
      end

      context 'replica set option provided' do
        let(:rs_name) { 'test-rs-name' }
        let(:options) { "replicaSet=#{rs_name}" }

        it 'sets the replica set option' do
          expect(uri.uri_options[:replica_set]).to eq(rs_name)
        end

        it 'sets the options on a client created with the uri' do
          expect(client.options[:replica_set]).to eq(rs_name)
        end
      end

      context 'auth mechanism provided' do
        let(:options)     { "authMechanism=#{mechanism}" }
        let(:string)      { "#{scheme}#{credentials}@#{servers}/?#{options}" }
        let(:user)        { 'tyler' }
        let(:password)    { 's3kr4t' }
        let(:credentials) { "#{user}:#{password}" }

        context 'plain' do
          let(:mechanism) { 'PLAIN' }
          let(:expected) { :plain }

          it 'sets the auth mechanism to :plain' do
            expect(uri.uri_options[:auth_mech]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech]).to eq(expected)
          end

          it 'is case-insensitive' do
            client = new_local_client_nmio(string.downcase)
            expect(client.options[:auth_mech]).to eq(expected)
          end
        end

        context 'mongodb-cr' do
          let(:mechanism) { 'MONGODB-CR' }
          let(:expected) { :mongodb_cr }

          it 'sets the auth mechanism to :mongodb_cr' do
            expect(uri.uri_options[:auth_mech]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech]).to eq(expected)
          end

          it 'is case-insensitive' do
            client = new_local_client_nmio(string.downcase)
            expect(client.options[:auth_mech]).to eq(expected)
          end
        end

        context 'gssapi' do
          require_mongo_kerberos

          let(:mechanism) { 'GSSAPI' }
          let(:expected)  { :gssapi }
          let(:options)   { "authMechanism=#{mechanism}&authSource=$external" }

          it 'sets the auth mechanism to :gssapi' do
            expect(uri.uri_options[:auth_mech]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech]).to eq(expected)
          end

          it 'is case-insensitive' do
            client = new_local_client_nmio(string.downcase)
            expect(client.options[:auth_mech]).to eq(expected)
          end
        end

        context 'scram-sha-1' do
          let(:mechanism) { 'SCRAM-SHA-1' }
          let(:expected) { :scram }

          it 'sets the auth mechanism to :scram' do
            expect(uri.uri_options[:auth_mech]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech]).to eq(expected)
          end

          it 'is case-insensitive' do
            client = new_local_client_nmio(string.downcase)
            expect(client.options[:auth_mech]).to eq(expected)
          end
        end

        context 'mongodb-x509' do
          let(:options)     { "authMechanism=#{mechanism}&authSource=$external" }
          let(:mechanism)   { 'MONGODB-X509' }
          let(:expected)    { :mongodb_x509 }
          let(:credentials) { user }

          it 'sets the auth mechanism to :mongodb_x509' do
            expect(uri.uri_options[:auth_mech]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech]).to eq(expected)
          end

          it 'is case-insensitive' do
              client = new_local_client_nmio(string.downcase)
            expect(client.options[:auth_mech]).to eq(expected)
          end

          context 'when a username is not provided' do
            let(:string) { "#{scheme}#{servers}/?#{options}" }
            it 'recognizes the mechanism with no username' do
              client = new_local_client_nmio(string.downcase)
              expect(client.options[:auth_mech]).to eq(expected)
              expect(client.options[:user]).to be_nil
            end
          end
        end
      end

      context 'auth source provided' do
        let(:options) { "authSource=#{source}" }

        context 'regular db' do
          let(:source) { 'foo' }

          it 'sets the auth source to the database' do
            expect(uri.uri_options[:auth_source]).to eq(source)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_source]).to eq(source)
          end
        end
      end

      context 'auth mechanism properties provided' do

        context 'service_name' do
          let(:options) do
            "authMechanismProperties=SERVICE_NAME:#{service_name}"
          end

          let(:service_name) { 'foo' }
          let(:expected) { Mongo::Options::Redacted.new({ service_name: service_name }) }

          it 'sets the auth mechanism properties' do
            expect(uri.uri_options[:auth_mech_properties]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech_properties]).to eq(expected)
          end
        end

        context 'canonicalize_host_name' do
          let(:options) do
            "authMechanismProperties=CANONICALIZE_HOST_NAME:#{canonicalize_host_name}"
          end
          let(:canonicalize_host_name) { 'true' }
          let(:expected) { Mongo::Options::Redacted.new({ canonicalize_host_name: true }) }

          it 'sets the auth mechanism properties' do
            expect(uri.uri_options[:auth_mech_properties]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech_properties]).to eq(expected)
          end
        end

        context 'service_realm' do
          let(:options) do
            "authMechanismProperties=SERVICE_REALM:#{service_realm}"
          end

          let(:service_realm) { 'dumdum' }
          let(:expected) { Mongo::Options::Redacted.new({ service_realm: service_realm }) }

          it 'sets the auth mechanism properties' do
            expect(uri.uri_options[:auth_mech_properties]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech_properties]).to eq(expected)
          end
        end

        context 'multiple properties' do
          let(:options) do
            "authMechanismProperties=SERVICE_REALM:#{service_realm}," +
                "CANONICALIZE_HOST_NAME:#{canonicalize_host_name}," +
                "SERVICE_NAME:#{service_name}"
          end

          let(:service_name) { 'foo' }
          let(:canonicalize_host_name) { 'true' }
          let(:service_realm) { 'dumdum' }

          let(:expected) do
            Mongo::Options::Redacted.new({ service_name: service_name,
                                           canonicalize_host_name: true,
                                           service_realm: service_realm })
          end

          it 'sets the auth mechanism properties' do
            expect(uri.uri_options[:auth_mech_properties]).to eq(expected)
          end

          it 'sets the options on a client created with the uri' do
            expect(client.options[:auth_mech_properties]).to eq(expected)
          end
        end
      end

      context 'connectTimeoutMS' do
        let(:options) { "connectTimeoutMS=4567" }

        it 'sets the the connect timeout' do
          expect(uri.uri_options[:connect_timeout]).to eq(4.567)
        end
      end

      context 'socketTimeoutMS' do
        let(:options) { "socketTimeoutMS=8910" }

        it 'sets the socket timeout' do
          expect(uri.uri_options[:socket_timeout]).to eq(8.910)
        end
      end

      context 'when providing serverSelectionTimeoutMS' do

        let(:options) { "serverSelectionTimeoutMS=3561" }

        it 'sets the the connect timeout' do
          expect(uri.uri_options[:server_selection_timeout]).to eq(3.561)
        end
      end

      context 'when providing localThresholdMS' do

        let(:options) { "localThresholdMS=3561" }

        it 'sets the the connect timeout' do
          expect(uri.uri_options[:local_threshold]).to eq(3.561)
        end
      end

      context 'when providing maxPoolSize' do

        let(:max_pool_size) { 10 }
        let(:options) { "maxPoolSize=#{max_pool_size}" }

        it 'sets the max pool size option' do
          expect(uri.uri_options[:max_pool_size]).to eq(max_pool_size)
        end
      end

      context 'when providing minPoolSize' do

        let(:min_pool_size) { 5 }
        let(:options) { "minPoolSize=#{min_pool_size}" }

        it 'sets the min pool size option' do
          expect(uri.uri_options[:min_pool_size]).to eq(min_pool_size)
        end
      end

      context 'when providing waitQueueTimeoutMS' do

        let(:wait_queue_timeout) { 500 }
        let(:options) { "waitQueueTimeoutMS=#{wait_queue_timeout}" }

        it 'sets the wait queue timeout option' do
          expect(uri.uri_options[:wait_queue_timeout]).to eq(0.5)
        end
      end

      context 'ssl' do
        let(:options) { "ssl=#{ssl}" }

        context 'true' do
          let(:ssl) { true }

          it 'sets the ssl option to true' do
            expect(uri.uri_options[:ssl]).to be true
          end
        end

        context 'false' do
          let(:ssl) { false }

          it 'sets the ssl option to false' do
            expect(uri.uri_options[:ssl]).to be false
          end
        end
      end

      context 'grouped and non-grouped options provided' do
        let(:options) { 'w=1&ssl=true' }

        it 'do not overshadow top level options' do
          expect(uri.uri_options).not_to be_empty
        end
      end

      context 'when an invalid option is provided' do

        let(:options) { 'invalidOption=10' }

        let(:uri_options) do
          uri.uri_options
        end

        it 'does not raise an exception' do
          expect(uri_options).to be_empty
        end

        context 'when an invalid option is combined with valid options' do

          let(:options) { 'invalidOption=10&waitQueueTimeoutMS=500&ssl=true' }

          it 'does not raise an exception' do
            expect(uri_options).not_to be_empty
          end

          it 'sets the valid options' do
            expect(uri_options[:wait_queue_timeout]).to eq(0.5)
            expect(uri_options[:ssl]).to be true
          end
        end
      end

      context 'when an app name option is provided' do
        let(:options) { "appname=srv_test" }

        it 'sets the app name on the client' do
          expect(client.options[:app_name]).to eq('srv_test')
        end
      end

      context 'when a supported compressors option is provided' do
        let(:options) { "compressors=zlib" }

        it 'sets the compressors as an array on the client' do
          expect(client.options[:compressors]).to eq(['zlib'])
        end
      end

      context 'when a non-supported compressors option is provided' do
        let(:options) { "compressors=snoopy" }

        it 'sets no compressors on the client and warns' do
          expect(Mongo::Logger.logger).to receive(:warn)
          expect(client.options[:compressors]).to be_nil
        end
      end

      context 'when a zlibCompressionLevel option is provided' do
        let(:options) { "zlibCompressionLevel=6" }

        it 'sets the zlib compression level on the client' do
          expect(client.options[:zlib_compression_level]).to eq(6)
        end
      end
    end
  end

  describe '#validate_srv_hostname' do
    let(:valid_hostname) do
    end

    let(:dummy_uri) do
      Mongo::URI::SRVProtocol.new("mongodb+srv://test1.test.build.10gen.cc/")
    end

    let(:validate) do
      dummy_uri.send(:validate_srv_hostname, hostname)
    end

    context 'when the hostname is valid' do
      let(:hostname) do
        'a.b.c'
      end

      it 'does not raise an error' do
        expect { validate }.not_to raise_error
      end
    end

    context 'when the hostname has a trailing dot' do
      let(:hostname) do
        "a.b.c."
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI, /Hostname cannot end with a dot: a\.b\.c\./)
      end
    end

    context 'when the hostname is empty' do
      let(:hostname) do
        ''
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the hostname has only one part' do
      let(:hostname) do
        'a'
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the hostname has only two parts' do
      let(:hostname) do
        'a.b'
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the hostname has an empty last part' do
      let(:hostname) do
        'a.b.'
      end

      it 'it raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when multiple hostnames are specified' do
      it 'raises an error' do
        expect do
          Mongo::URI::SRVProtocol.new("mongodb+srv://a.b.c,d.e.f/")
        end.to raise_error(Mongo::Error::InvalidURI, /One and only one host is required/)
      end
    end

    context 'when the hostname contains a colon' do
      let(:hostname) do
        'a.b.c:27017'
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the hostname starts with a dot' do
      let(:hostname) do
        '.a.b.c'
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the hostname ends with consecutive dots' do
      let(:hostname) do
        'a.b.c..'
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end

    context 'when the hostname contains consecutive dots in the middle' do
      let(:hostname) do
        'a..b.c'
      end

      it 'raises an error' do
        expect { validate }.to raise_error(Mongo::Error::InvalidURI)
      end
    end
  end
end


text:
[![npm version][npm-badge]][npm-url]
[![Build Status][travis-badge]][travis-url]
[![Coverage Status][coveralls-badge]][coveralls-url]
[![Dependency Status][david-badge]][david-url]
[![Gitter chat][gitter-badge]][gitter-url]

#### A work queue that can be gated, stopping to wait for sub-queues to complete.

[Annotated Source](http://senecajs.github.io/gate-executor/doc/gate-executor.html)

A work execution queue that provides gating. Work items submitted to
the queue are called in order, and execute concurrently. However, if
the queue is *gated*, then a sub-queue is created, and work items
added to the sub-queue must complete first.

Gating operates to any depth, allowing you to form a tree-structured
queue that must complete breadth-first.

The queue also handles timeouts, so that failing work items do not
block processing. Timeouts use a shared `setInterval`, so are nice and
efficient.

Used by the [Seneca](http://senecajs.org/) microservice framework to
implement plugin initialisation.

# Usage

```js
var GateExecutor = require('gate-executor')

var ge = GateExecutor()

ge.add({
  fn: function first (done) {
    console.log('first')
    done()
  }
})

// create a gate
var subge = ge.gate()

ge.add({
  fn: function second (done) {
    console.log('second')
    done()
  }
})

// this needs to complete before 'second' can run
subge.add({
  fn: function second (done) {
    console.log('third')
    done()
  }
})

ge.start(function () {
  console.log('done')
  done()
})

// prints:
//   first
//   third
//   second
//   done
```

For detailed information, and API descriptions, see the
[Annotated Source](http://senecajs.github.io/gate-executor/doc/gate-executor.html)

# Support

If you're using this module, feel free to contact me on twitter if you
have any questions! :) [@rjrodger](http://twitter.com/rjrodger)

# Testing

```js
npm test
```

[npm-badge]: https://badge.fury.io/js/gate-executor.svg
[npm-url]: https://badge.fury.io/js/gate-executor
[travis-badge]: https://api.travis-ci.org/rjrodger/gate-executor.svg
[travis-url]: https://travis-ci.org/rjrodger/gate-executor
[coveralls-badge]:https://coveralls.io/repos/rjrodger/gate-executor/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/rjrodger/gate-executor?branch=master
[david-badge]: https://david-dm.org/rjrodger/gate-executor.svg
[david-url]: https://david-dm.org/rjrodger/gate-executor
[gitter-badge]: https://badges.gitter.im/rjrodger/gate-executor.svg
[gitter-url]: https://gitter.im/rjrodger/gate-executor


text:
(function(){

module("can/util/event")

test("basics", 4,function(){

	var obj = {
		addEvent: can.addEvent,
		removeEvent: can.removeEvent,
		dispatch: can.dispatch
	};
	var handler = function(ev, arg1, arg2){
		ok(true, "foo called");
		equal(ev.type, "foo");
		equal(arg1, 1, "one");
		equal(arg2, 2, "two")
	}
	obj.addEvent("foo", handler)

	obj.dispatch({type: "foo"}, [1, 2])

	obj.removeEvent("foo", handler);

	obj.dispatch({
		type: "foo",
		data: [1, 2]
	})
});

test("listenTo and stopListening", 9, function(){

	var parent = {
		bind: can.bind,
		unbind: can.unbind,
		listenTo: can.listenTo,
		stopListening: can.stopListening
	};

	var child1 = {
		bind: can.bind,
		unbind: can.unbind
	};

	var child2 = {
		bind: can.bind,
		unbind: can.unbind
	};

	var change1WithId = 0;

	parent.listenTo(child1, "change", function(){
		change1WithId++;
		if(change1WithId == 1){
			ok(true, "child 1 handler with id called")
		} else {
			ok(false, "child 1 handler with id should only be called once")
		}

	});

	child1.bind("change", function(){
		ok(true, "child 1 handler without id called")
	});

	var foo1WidthId = 0;

	parent.listenTo(child1, "foo", function(){
		foo1WidthId++;
		if( foo1WidthId == 1 ){
			ok(true, "child 1 foo handler with id called")
		} else {
			ok(false, "child 1 foo handler should not be called twice")
		}

	});

	// child2 stuff
	(function(){
		var okToCall = true;
		parent.listenTo(child2,"change", function(){
			ok(okToCall, "child 2 handler with id called");
			okToCall = false;
		});
	})()

	child2.bind("change", function(){
		ok(true, "child 2 handler without id called")
	});

	parent.listenTo( child2,"foo", function(){
		ok(true, "child 2 foo handler with id called")
	});

	can.trigger(child1,"change");
	can.trigger(child1,"foo");

	can.trigger(child2,"change");
	can.trigger(child2,"foo");

	parent.stopListening(child1)
	parent.stopListening(child2,"change")

	can.trigger(child1,"change");
	can.trigger(child1,"foo");

	can.trigger(child2,"change");
	can.trigger(child2,"foo");

});

test("stopListening on something you've never listened to ", function(){

	var parent = {
		bind: can.bind,
		unbind: can.unbind,
		listenTo: can.listenTo,
		stopListening: can.stopListening
	};

	var child = {
		bind: can.bind,
		unbind: can.unbind
	};
	parent.listenTo({},"foo")
	parent.stopListening(child,"change");
	ok(true, "did not error")

})

})()


text:
function productosCategoria(id){
	var prodsCat = [];
	$.ajax({
		type: 'GET',
		url: obtenerHostname() + '/catalogo/cat?idCat=' + id ,
		async: false,
		beforeSend: function(xhr){
			if(xhr && xhr.overrideMimeType){
				xhr.overrideMimeType('application/json;charset=utf-8');
			}
		},
		dataType: 'json',
		success: function(data){
			if(data){
				if(typeof (data) == 'string'){
					//alert("Registro inválido! " + data);
					agregarMsj("msjValidacion", data, false);
				}else{
					//alert("Registro válido!");
					console.log(data);
					prodsCat=data;
					crearCardsProductos(prodsCat);
				}
			}else{
				agregarMsj("msjValidacion", "Ocurrió un error al momento de traer los productos de la Categoría.", false);
			}
		}
	});
}

function crearCardsProductos(prods){
	if(prods){
		var $divProdsCatalogo = $("#divProdsCatalogo");
		limpiarCatalogo($divProdsCatalogo);
		for(var i=0; i<prods.length; i++){
			agregarProdCatalogo($divProdsCatalogo, crearCardProducto(prods[i]));
		}
	}
}

function limpiarCatalogo(oProdsCatalogo){
	oProdsCatalogo.empty();
}

function agregarProdCatalogo(oProdsCatalogo, prodHtml){
	oProdsCatalogo.append(prodHtml);
}

function crearCardProducto(oProd){
	var html = 	'
'+
					'
'+
						''+
						'
'+
							'
'+ oProd.idProducto +'
'+
							'
'+ oProd.desProducto +'
'+
							'
'+
								'S/. '+ oProd.precioUnitario +''+
								'<input type="text" aria-label="Cantidad" value="1" class="form-control">'+
								''+
									'<button type="button" onclick="agregarACarrito(this,'+ String.fromCharCode(39) +
										oProd._id + String.fromCharCode(39) + ', '+ String.fromCharCode(39) +
										oProd.idProducto + String.fromCharCode(39) + ', '+ String.fromCharCode(39) +
										oProd.desProducto + String.fromCharCode(39) + ', ' + String.fromCharCode(39) +
										oProd.precioUnitario + String.fromCharCode(39) + ', '+ String.fromCharCode(39) +
										oProd.urlImagen + String.fromCharCode(39) + ')" class="btn btn-primary">Agregar</button>'+
								''+
							'
'+
						'
'+
					'
'+
				'
';
	return html;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ic_equalizer_normal" android:state_focused="true" android:state_pressed="true"/>
    <item android:drawable="@drawable/ic_equalizer_pressed" android:state_focused="true"/>
    <item android:drawable="@drawable/ic_equalizer_pressed" android:state_pressed="true"/>
    <item android:drawable="@drawable/ic_equalizer_normal"/>
</selector>


text:
package org.apache.commons.fileupload.portlet;

import java.io.InputStream;
import java.io.IOException;
import javax.portlet.ActionRequest;
import org.apache.commons.fileupload.RequestContext;

/**
 *
Provides access to the request information needed for a request made to
 * a portlet.

 *
 * @author Martin Cooper
 *
 * @since FileUpload 1.1
 *
 * @version $Id: PortletRequestContext.java 479262 2006-11-26 03:09:24Z niallp $
 */
public class PortletRequestContext implements RequestContext {

    // ----------------------------------------------------- Instance Variables

    /**
     * The request for which the context is being provided.
     */
    private ActionRequest request;

    // ----------------------------------------------------------- Constructors

    /**
     * Construct a context for this request.
     *
     * @param request The request to which this context applies.
     */
    public PortletRequestContext(ActionRequest request) {
        this.request = request;
    }

    // --------------------------------------------------------- Public Methods

    /**
     * Retrieve the character encoding for the request.
     *
     * @return The character encoding for the request.
     */
    public String getCharacterEncoding() {
        return request.getCharacterEncoding();
    }

    /**
     * Retrieve the content type of the request.
     *
     * @return The content type of the request.
     */
    public String getContentType() {
        return request.getContentType();
    }

    /**
     * Retrieve the content length of the request.
     *
     * @return The content length of the request.
     */
    public int getContentLength() {
        return request.getContentLength();
    }

    /**
     * Retrieve the input stream for the request.
     *
     * @return The input stream for the request.
     *
     * @throws IOException if a problem occurs.
     */
    public InputStream getInputStream() throws IOException {
        return request.getPortletInputStream();
    }

    /**
     * Returns a string representation of this object.
     *
     * @return a string representation of this object.
     */
    public String toString() {
        return "ContentLength="
            + this.getContentLength()
            + ", ContentType="
            + this.getContentType();
    }

}


text:
from setuptools import setup, find_packages
import os

def read_file(filename):
    """Read a file into a string"""
    path = os.path.abspath(os.path.dirname(__file__))
    filepath = os.path.join(path, filename)
    try:
        return open(filepath).read()
    except IOError:
        return ''

setup(
    name='SwampDragon-live',
    version=__import__('swampdragon_live').__version__,
    author='Marc Hoersken',
    author_email='info@marc-hoersken.de',
    packages=find_packages(),
    include_package_data=True,
    url='https://github.com/mback2k/swampdragon-live',
    license='MIT',
    description=u' '.join(__import__('swampdragon_live').__doc__.splitlines()).strip(),
    install_requires=['SwampDragon', 'SwampDragon-auth'],
    classifiers=[
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'Development Status :: 3 - Alpha',
        'Operating System :: OS Independent',
    ],
    long_description=read_file('README.md'),
)


text:
import test from 'ava';
import toElectronBackgroundColor from '../../app/utils/to-electron-background-color';
import {isHexColor} from '../testUtils/is-hex-color';

test('toElectronBackgroundColor', t => {
  t.false(false);
});

test(`returns a color that's in hex`, t => {
  const hexColor = '#BADA55';
  const rgbColor = 'rgb(0,0,0)';
  const rgbaColor = 'rgb(0,0,0, 55)';
  const hslColor = 'hsl(15, 100%, 50%)';
  const hslaColor = 'hsl(15, 100%, 50%, 1)';
  const colorKeyword = 'pink';

  t.true(
    isHexColor(
      toElectronBackgroundColor(hexColor)
    )
  );

  t.true(
    isHexColor(
      toElectronBackgroundColor(rgbColor)
    )
  );

  t.true(
    isHexColor(
      toElectronBackgroundColor(rgbaColor)
    )
  );

  t.true(
    isHexColor(
      toElectronBackgroundColor(hslColor)
    )
  );

  t.true(
    isHexColor(
      toElectronBackgroundColor(hslaColor)
    )
  );

  t.true(
    isHexColor(
      toElectronBackgroundColor(colorKeyword)
    )
  );
});


text:
package org.gradle.cache.internal;

import org.gradle.api.GradleException;
import org.gradle.internal.Factory;
import org.gradle.cache.PersistentStateCache;
import org.gradle.internal.serialize.InputStreamBackedDecoder;
import org.gradle.internal.serialize.OutputStreamBackedEncoder;
import org.gradle.internal.serialize.Serializer;

import java.io.*;

public class SimpleStateCache<T> implements PersistentStateCache<T> {
    private final FileAccess fileAccess;
    private final Serializer<T> serializer;
    private final File cacheFile;

    public SimpleStateCache(File cacheFile, FileAccess fileAccess, Serializer<T> serializer) {
        this.cacheFile = cacheFile;
        this.fileAccess = fileAccess;
        this.serializer = serializer;
    }

    public T get() {
        return fileAccess.readFile(new Factory<T>() {
            public T create() {
                return deserialize();
            }
        });
    }

    public void set(final T newValue) {
        fileAccess.writeFile(new Runnable() {
            public void run() {
                serialize(newValue);
            }
        });
    }

    public void update(final UpdateAction<T> updateAction) {
        fileAccess.updateFile(new Runnable() {
            public void run() {
                T oldValue = deserialize();
                T newValue = updateAction.update(oldValue);
                serialize(newValue);
            }
        });
    }

    private void serialize(T newValue) {
        try {
            OutputStreamBackedEncoder encoder = new OutputStreamBackedEncoder(new BufferedOutputStream(new FileOutputStream(cacheFile)));
            try {
                serializer.write(encoder, newValue);
            } finally {
                encoder.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not write cache value to '%s'.", cacheFile), e);
        }
    }

    private T deserialize() {
        if (!cacheFile.isFile()) {
            return null;
        }
        try {
            InputStreamBackedDecoder decoder = new InputStreamBackedDecoder(new BufferedInputStream(new FileInputStream(cacheFile)));
            try {
                return serializer.read(decoder);
            } finally {
                decoder.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not read cache value from '%s'.", cacheFile), e);
        }
    }
}


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

<title>DpDataFindNextIterator (CONF API Version 5.4)</title>
<meta name="date" content="2015-03-18">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.tailf.dp

Interface DpDataFindNextIterator

All Superinterfaces:

Iterator<Object>

public interface DpDataFindNextIterator
extends Iterator<Object>

Extended Iterator interface used to get findNext functionality.

 This class is expected to be the return value of the
 DP Data Provider method
 DpDataCallback.iterator(DpTrans, ConfObject[], ConfFindNextType,
 ConfKey)
 If this overlaid iterator method is implemented this implies that the
 data provider is capable of both getNext as the basic iterator as well
 as findNext which is the extended method in this interface.

 Iterators of this type are expected to be first called by a findNext to
 position at some element in a list. The iterator will then accept subsequent
 getNext calls from that initial position.

Method Summary

Methods

Modifier and Type
Method and Description

Object
findNext(DpTrans trans,
        ConfObject[] kp,
        ConfFindNextType type,
        ConfKey key)

This method is called by Dp when a FIND_NEXT or a FIND_NEXT_OBJECT call
 is issued.

Methods inherited from interface Iterator

hasNext, next, remove

Method Detail

findNext

Object findNext(DpTrans trans,
              ConfObject[] kp,
              ConfFindNextType type,
              ConfKey key)

This method is called by Dp when a FIND_NEXT or a FIND_NEXT_OBJECT call
 is issued. This iterator method is called to retrieve the element and
 the object is then rendered with the normal
 DpDataCallback.getIteratorKey(DpTrans, ConfObject[], Object)
 or DpDataCallback.getIteratorObject(DpTrans, ConfObject[],
 Object)
 methods before the element returned.

Parameters:

trans - current DpTrans object

kp - keypath for the iterator

type - ConfFindNextType enum indicating this or next element

key - value for the searched element

Returns:

retrieved element

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
/**
 * userHasLeft.js
 *
 * get current color of user in a room
 *
 * @param string id of user
 * @author nirgendswo
 *
 */

(function() {

    'use strict';

    angular
        .module('JustText')
        .filter('userHasLeft', UserHasLeftFilter);

    UserHasLeftFilter.$inject = ['RoomService'];

    function UserHasLeftFilter(RoomService) {
        return filter;

        function filter(id) {
            var roomData = RoomService.get(),
                found = true;

            angular.forEach(roomData.room.users, function(user) {
                if (user.id === id) {
                    found = false;
                }
            });

            return found;
        }
    }

})();


text:
@interface ViewController : UITableViewController <DZNMapViewControllerDelegate>

@end


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Package org.apache.log4j.lf5 (Apache Log4j 1.2.17-1 API)
</TITLE>

<META NAME="date" CONTENT="2012-07-10">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Package
org.apache.log4j.lf5

Packages that use org.apache.log4j.lf5

org.apache.log4j.lf5

org.apache.log4j.lf5.util

org.apache.log4j.lf5.viewer

org.apache.log4j.lf5.viewer.categoryexplorer

Classes in org.apache.log4j.lf5 used by org.apache.log4j.lf5

AppenderFinalizer

          AppenderFinalizer has a single method that will finalize
 resources associated with a LogBrokerMonitor in the event
 that the LF5Appender class is destroyed, and the class loader
 is garbage collected.

LF5Appender

          LF5Appender logs events to a swing based logging
 console.

LogLevel

          The LogLevel class defines a set of standard logging levels.

LogLevelFormatException

          Thrown to indicate that the client has attempted to convert a string
 to one the LogLevel types, but the string does not have the appropriate
 format.

LogRecord

          LogRecord.

LogRecordFilter

          An interface for classes which filters LogRecords.

Classes in org.apache.log4j.lf5 used by org.apache.log4j.lf5.util

LogLevel

          The LogLevel class defines a set of standard logging levels.

LogRecord

          LogRecord.

Classes in org.apache.log4j.lf5 used by org.apache.log4j.lf5.viewer

LogLevel

          The LogLevel class defines a set of standard logging levels.

LogRecord

          LogRecord.

LogRecordFilter

          An interface for classes which filters LogRecords.

Classes in org.apache.log4j.lf5 used by org.apache.log4j.lf5.viewer.categoryexplorer

LogRecord

          LogRecord.

LogRecordFilter

          An interface for classes which filters LogRecords.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 1999-2012 Apache Software Foundation. All Rights Reserved.


text:
/**
 * List Orders
 *
 * https://docs.gdax.com/#list-orders
 */

var authedClient = require('../../../client').authedClient;

authedClient.getOrders(function(err, response, data) {
  if (err) {
    console.log(err);
    return;
  }

  console.log(data);
});

// For pagination, you can include extra page arguments
// authedClient.getOrders({after: 3000}, function(err, response, data) {
//   if (err) {
//     console.log(err);
//     return;
//   }
//
//   console.log(data);
// });


text:
import { Component, OnInit} from '@angular/core';
import {ElderDialogService, ElderShellService} from '@elderbyte/ngx-starter';
import {Router} from '@angular/router';

@Component({
  selector: 'starter-demo-panel-side',
  templateUrl: './demo-panel-side.component.html',
  styleUrls: ['./demo-panel-side.component.scss']
})
export class DemoPanelSideComponent implements OnInit {

  public expanded: boolean;

  constructor(
      private router: Router,
      private shellService: ElderShellService,
      private dialogService: ElderDialogService
  ) { }

  ngOnInit() {
  }

  public close(event: Event): void {
    this.shellService.closeSideContent();
  }

  public navigate(): void {
    this.shellService.closeSideContent().then(
      () => this.router.navigate(['/app/mixed-demo'])
    );

  }

  public openQuestion(event: any): void {
    this.dialogService.showQuestion({
      title: 'Simple question',
      question: 'Are you sure?',
    }).subscribe();
  }

}


text:
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE application SYSTEM "application.dtd">

<application xmlns:xi="http://www.w3.org/2001/XInclude">

    <copyright>
      <year>2001</year><year>2009</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.

      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.

    </legalnotice>

    <title>WebTool Reference Manual</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>

  <description>

WebTool provides an easy way to use web based tools with
      Erlang/OTP. It configures and starts a webserver as well as all
      available tools.

  </description>
  <xi:include href="webtool.xml"/>
  <xi:include href="start_webtool.xml"/>
</application>


text:
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.sun.facelets.compiler;

import java.io.IOException;
import java.util.List;

import javax.el.ELContext;
import javax.el.ELException;
import javax.el.ExpressionFactory;

import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

import com.sun.facelets.el.ELAdaptor;
import com.sun.facelets.el.ELText;

final class AttributeInstruction implements Instruction {
    private final String alias;

    private final String attr;

    private final ELText txt;

    public AttributeInstruction(String alias, String attr, ELText txt) {
        this.alias = alias;
        this.attr  = attr;
        this.txt   = txt;
    }

    public void write(FacesContext context) throws IOException {
        ResponseWriter out = context.getResponseWriter();
        try {
            ELContext elContext = ELAdaptor.getELContext(context);
            String val = txt.toString(elContext);

            out.writeAttribute(attr, val, null);
        } catch (ELException e) {
            throw new ELException(this.alias + ": " + e.getMessage(), e.getCause());
        } catch (Exception e) {
            throw new ELException(this.alias + ": " + e.getMessage(), e);
        }
    }

    public Instruction apply(ExpressionFactory factory, ELContext ctx) {
        ELText nt = this.txt.apply(factory, ctx);
        if (nt == this.txt) {
            return this;
        }

        return new AttributeInstruction(alias, attr, nt);
    }

    public boolean isLiteral() {
        return txt.isLiteral();
    }
}


text:
<?php
/*
 * ProvisioningAPILib
 *
 * This file was automatically generated by APIMATIC BETA v2.0 on 01/06/2015
 */

class RegulationController {

    /* private fields for configuration */

    /**
     * The username to use with basic authentication
     * @var string
     */
    private $basicAuthUserName;

    /**
     * The password to use with basic authentication
     * @var string
     */
    private $basicAuthPassword;

    /**
     * Constructor with authentication and configuration parameters
     */
    function __construct($basicAuthUserName = NULL, $basicAuthPassword = NULL)
    {
        $this->basicAuthUserName = $basicAuthUserName ? $basicAuthUserName : Configuration::$BasicAuthUserName;
        $this->basicAuthPassword = $basicAuthPassword ? $basicAuthPassword : Configuration::$BasicAuthPassword;
    }

    /**
     * listRegulationAddress is a method that allows you to list or your existing regulation addresses.
     * @param   string $pageNumber    Required parameter: The page number, starting at 0.
     * @param   string $pageSize    Required parameter: The page size (max number of entities that are displayed in the response).
     * @param   string|null $regulationAddressId    Optional parameter: Identifier of the regulation address id.
     * @param   string|null $companyName    Optional parameter: Name of the company.
     * @param   string|null $firstName    Optional parameter: First name of the customer.
     * @param   string|null $lastName    Optional parameter: Last name of the customer.
     * @param   string|null $countryCodeA3    Optional parameter: The three letter identifier for the address's country.
     * @param   string|null $city    Optional parameter: The city for the address.
     * @param   string|null $zipCode    Optional parameter: The zip code for the address.
     * @param   string|null $streetName    Optional parameter: The street for the address.
     * @param   string|null $buildingNumber    Optional parameter: The building number for the address.
     * @param   string|null $customerReference    Optional parameter: The reference for the customer.
     * @param   string|null $status    Optional parameter: The status of the regulation address.
     * @param   bool|null $linked    Optional parameter: Flag that specifies if the addresses should be linked to a DID.
     * @return mixed response from the API call*/
    public function listRegulationAddress (
                $pageNumber,
                $pageSize,
                $regulationAddressId = NULL,
                $companyName = NULL,
                $firstName = NULL,
                $lastName = NULL,
                $countryCodeA3 = NULL,
                $city = NULL,
                $zipCode = NULL,
                $streetName = NULL,
                $buildingNumber = NULL,
                $customerReference = NULL,
                $status = NULL,
                $linked = NULL)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/address';

        //process optional query parameters
        APIHelper::appendUrlWithQueryParameters($queryBuilder, array (
            'pageNumber' => $pageNumber,
            'pageSize' => $pageSize,
            'regulationAddressId' => $regulationAddressId,
            'companyName' => $companyName,
            'firstName' => $firstName,
            'lastName' => $lastName,
            'countryCodeA3' => $countryCodeA3,
            'city' => $city,
            'zipCode' => $zipCode,
            'streetName' => $streetName,
            'buildingNumber' => $buildingNumber,
            'customerReference' => $customerReference,
            'status' => $status,
            'linked' => $linked,
        ));

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json'
        );

        //prepare API request
        $request = Unirest::get($queryUrl, $headers, NULL, $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

    /**
     * listZipCodes is a method that allows you to get the matching cities and zip codes for a certain country or DID's area code. This is an absolute requirement for certain countries where the city and zip code will have to match the DID's area code for instance in Germany (DEU), Croatia (HRV), South Korea (KOR), etc…
     * @param   string $countryCodeA3    Required parameter: The A3 code of the country to look for zip codes.
     * @param   string $pageNumber    Required parameter: The page number, starting at 0.
     * @param   string $pageSize    Required parameter: The page size (max number of entities that are displayed in the response).
     * @param   string|null $areaCode    Optional parameter: The area code to look for zip codes.
     * @return mixed response from the API call*/
    public function listZipCodes (
                $countryCodeA3,
                $pageNumber,
                $pageSize,
                $areaCode = NULL)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/zipcode';

        //process optional query parameters
        APIHelper::appendUrlWithQueryParameters($queryBuilder, array (
            'countryCodeA3' => $countryCodeA3,
            'pageNumber' => $pageNumber,
            'pageSize' => $pageSize,
            'areaCode' => $areaCode,
        ));

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json'
        );

        //prepare API request
        $request = Unirest::get($queryUrl, $headers, NULL, $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

    /**
     * Unlinking regulation address is a different request in REST than linking regulation addresses but the same request in SOAP. The difference is only to set the regulationAddressId field empty.
     * @param   array $didIds    Required parameter: Array of DID IDs you wish to unlink to a regulation address.
     * @return mixed response from the API call*/
    public function createUnlinkRegulationAddress (
                $didIds)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/address/unlink';

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json',
            'Content-type' => 'application/json; charset=utf-8'
        );

        //prepare API request
        $request = Unirest::post($queryUrl, $headers, json_encode($didIds), $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

    /**
     * deleteRegulationAddress is a method that allows you to delete a regulation address.
     * @param   string $regulationAddressId    Required parameter: The regulation address identifier.
     * @return mixed response from the API call*/
    public function deleteRegulationAddress (
                $regulationAddressId)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/address/{regulationAddressId}';

        //process optional query parameters
        APIHelper::appendUrlWithTemplateParameters($queryBuilder, array (
            'regulationAddressId' => $regulationAddressId,
            ));

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json'
        );

        //prepare API request
        $request = Unirest::delete($queryUrl, $headers, NULL, $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

    /**
     * linkRegulationAddress is a method that allows you to link one or multiple DIDs to a regulation address.
     * @param   string $regulationAddressId    Required parameter: The identifier of the regulation address.
     * @param   string $didIds    Required parameter: This is the ID of the regulation address to which you want to link the DID.
     * @return mixed response from the API call*/
    public function linkRegulationAddress (
                $addressId, $didIds)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/address/{addressId}/link';

        //process optional query parameters
        APIHelper::appendUrlWithTemplateParameters($queryBuilder, array (
            'addressId' => $addressId,
            ));

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json',
            'Content-Type' => 'application/json'
        );

        $body = json_encode(array(
            'didIds' => $didIds,
            'addressId' => $addressId
        ));

        //prepare API request
        $request = Unirest::post($queryUrl, $headers, $body, $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

    /**
     * uploadProofOfAddress is a method that allows you to separately upload a proof of address after the address is created (the upload is done automatically during the address creation if the document is specified).
     * @param   string|null $regulationAddressId    Optional parameter: The identifier of the regulation address.
     * @return mixed response from the API call*/
    public function uploadProofOfAddress (
                $regulationAddressId = NULL)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/address/{regulationAddressId}/proof';

        //process optional query parameters
        APIHelper::appendUrlWithTemplateParameters($queryBuilder, array (
            'regulationAddressId' => $regulationAddressId,
            ));

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json',
            'Content-Type:' => 'multipart/form-data;boundary=XXX'
        );

        //prepare API request
        $request = Unirest::put($queryUrl, $headers, NULL, $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

    /**
     * isAddressValid is a method that allows to check the validity of an address against a certain DID's type and country. This can be useful if you have originally created an address for a given DID and you wish to reuse that same address for another DID.
     * @param   string $didType    Required parameter: The did type for the destination did.
     * @param   string $destinationCountryCodeA3    Required parameter: The three letter identifier for country the destination did.
     * @param   string $regulationAddressId    Required parameter: The identifier of the regulation address.
     * @return mixed response from the API call*/
    public function getIsAddressValid (
                $didType,
                $destinationCountryCodeA3,
                $regulationAddressId)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/address/{regulationAddressId}/validation';

        //process optional query parameters
        APIHelper::appendUrlWithTemplateParameters($queryBuilder, array (
            'regulationAddressId' => $regulationAddressId,
            ));

        //process optional query parameters
        APIHelper::appendUrlWithQueryParameters($queryBuilder, array (
            'didType' => $didType,
            'destinationCountryCodeA3' => $destinationCountryCodeA3,
        ));

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json'
        );

        //prepare API request
        $request = Unirest::get($queryUrl, $headers, NULL, $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

    /**
     * requestAddressVerification is a method that allows you to request a separate address verification.
     * @param   string $regulationAddressId    Required parameter: The identifier of the regulation address.
     * @return mixed response from the API call*/
    public function requestAddressVerification (
                $regulationAddressId)
    {
        //the base uri for api requests
        $queryBuilder = Configuration::BASEURI;

        //prepare query string for API call
        $queryBuilder = $queryBuilder.'/services/rest/regulation/address/{regulationAddressId}/verification';

        //process optional query parameters
        APIHelper::appendUrlWithTemplateParameters($queryBuilder, array (
            'regulationAddressId' => $regulationAddressId,
            ));

        //validate and preprocess url
        $queryUrl = APIHelper::cleanUrl($queryBuilder);

        //prepare headers
        $headers = array (
            'User-Agent' => 'APIMATIC 2.0',
            'Accept' => 'application/json'
        );

        //prepare API request
        $request = Unirest::put($queryUrl, $headers, NULL, $this->basicAuthUserName, $this->basicAuthPassword);

        //and invoke the API call request to fetch the response
        $response = $request->getResponse();

        //Error handling using HTTP status codes
        if (($response->code < 200) || ($response->code > 206)) { //[200,206] = HTTP OK
            throw new APIException("HTTP Response Not OK", $response->code);
        }

        return $response->body;
    }

}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.Text;
using Xunit;

namespace Microsoft.CodeAnalysis.UnitTests
{
    public partial class FindAllDeclarationsTests
    {
        private static void Verify(string searchTerm, bool respectCase, WorkspaceKind workspaceKind, IEnumerable<ISymbol> declarations, params string[] expectedResults)
        {
            var actualResultCount = declarations.Count();
            var expectedResultCount = expectedResults.Length;
            Assert.True(expectedResultCount == actualResultCount,
                string.Format("Search term '{0}' expected '{1}' results, found '{2}.  Ignore case was set to '{3}', Workspace {4} was used",
                    searchTerm,
                    expectedResultCount,
                    actualResultCount,
                    respectCase,
                    Enum.GetName(typeof(WorkspaceKind), workspaceKind)));
            if (actualResultCount > 0)
            {
                VerifyResults(declarations, expectedResults);
            }
        }

        private static void Verify(WorkspaceKind workspaceKind, IEnumerable<ISymbol> declarations, params string[] expectedResults)
        {
            var actualResultCount = declarations.Count();
            var expectedResultCount = expectedResults.Length;
            Assert.True(expectedResultCount == actualResultCount,
                string.Format("Expected '{0}' results, found '{1}. Workspace {2} was used",
                    expectedResultCount,
                    actualResultCount,
                    Enum.GetName(typeof(WorkspaceKind), workspaceKind)));
            if (actualResultCount > 0)
            {
                VerifyResults(declarations, expectedResults);
            }
        }

        private static void VerifyResults(IEnumerable<ISymbol> declarations, string[] expectedResults)
        {
            declarations = declarations.OrderBy(d => d.ToString());
            expectedResults = expectedResults.OrderBy(r => r).ToArray();

            for (var i = 0; i < expectedResults.Length; i++)
            {
                var actualResult = declarations.ElementAt(i).ToString();
                var expectedResult = expectedResults[i];
                Assert.True(
                    string.Equals(actualResult, expectedResult, StringComparison.Ordinal),
                    string.Format("Expected result to be {0} was {1}", expectedResult, actualResult));
            }
        }

        private static void VerifyInnerExceptionArgumentNull(AggregateException ex, string argName)
        {
            var exception = ex.InnerException as ArgumentNullException;
            Assert.True(exception != null, string.Format("Expected InnerException to be 'System.ArgumentNullException' was '{0}'", ex.InnerException.ToString()));
            Assert.True(exception.ParamName.Contains(argName), string.Format("Expected InnerException ParamName to contain '{0}', actual ParamName is: '{1}'", argName, exception.ParamName));
        }

        private static void VerifyInnerExceptionIsType<T>(Exception ex) where T : Exception
        {
            Assert.True(ex.InnerException is T, string.Format("Expected InnerException to be '{0}' was '{1}'", typeof(T).Name, ex.InnerException.ToString()));
        }

        private static Solution CreateSolution()
        {
            return new AdhocWorkspace().CurrentSolution;
        }

        private static Solution GetSingleProjectSolution(params string[] sourceTexts)
        {
            var pid = ProjectId.CreateNewId();
            var solution = CreateSolution()
                    .AddProject(pid, "TestCases", "TestCases", LanguageNames.CSharp)
                    .AddMetadataReference(pid, MscorlibRef);
            for (var i = 0; i < sourceTexts.Length; i++)
            {
                var did = DocumentId.CreateNewId(pid);
                solution = solution.AddDocument(did, "goo" + i + ".cs", SourceText.From(sourceTexts[i]));
            }

            return solution;
        }

        private static Solution GetMultipleProjectSolution(params string[] sourceTexts)
        {
            var solution = CreateSolution();
            for (var i = 0; i < sourceTexts.Length; i++)
            {
                var pid = ProjectId.CreateNewId();
                var did = DocumentId.CreateNewId(pid);
                solution = solution
                    .AddProject(pid, "TestCases" + i, "TestCases" + i, LanguageNames.CSharp)
                    .AddMetadataReference(pid, MscorlibRef);
                solution = solution.AddDocument(did, "goo" + i + ".cs", SourceText.From(sourceTexts[i]));
            }

            return solution;
        }

        private static Solution GetSolution(WorkspaceKind workspaceKind)
            => workspaceKind switch
            {
                WorkspaceKind.SingleClass => GetSingleProjectSolution(SingleClass),
                WorkspaceKind.SingleClassWithSingleMethod => GetSingleProjectSolution(SingleClassWithSingleMethod),
                WorkspaceKind.SingleClassWithSingleProperty => GetSingleProjectSolution(SingleClassWithSingleProperty),
                WorkspaceKind.SingleClassWithSingleField => GetSingleProjectSolution(SingleClassWithSingleField),
                WorkspaceKind.TwoProjectsEachWithASingleClassWithSingleMethod => GetMultipleProjectSolution(SingleClassWithSingleMethod, SingleClassWithSingleMethod),
                WorkspaceKind.TwoProjectsEachWithASingleClassWithSingleProperty => GetMultipleProjectSolution(SingleClassWithSingleProperty, SingleClassWithSingleProperty),
                WorkspaceKind.TwoProjectsEachWithASingleClassWithSingleField => GetMultipleProjectSolution(SingleClassWithSingleField, SingleClassWithSingleField),
                WorkspaceKind.NestedClass => GetSingleProjectSolution(NestedClass),
                WorkspaceKind.TwoNamespacesWithIdenticalClasses => GetSingleProjectSolution(Namespace1, Namespace2),
                _ => null,
            };

        private static Project GetProject(WorkspaceKind workspaceKind)
        {
            return GetSolution(workspaceKind).Projects.First();
        }

        public enum WorkspaceKind
        {
            SingleClass,
            SingleClassWithSingleMethod,
            SingleClassWithSingleProperty,
            SingleClassWithSingleField,
            TwoProjectsEachWithASingleClassWithSingleMethod,
            TwoProjectsEachWithASingleClassWithSingleProperty,
            TwoProjectsEachWithASingleClassWithSingleField,
            NestedClass,
            TwoNamespacesWithIdenticalClasses
        }

        private const string SingleClass =
    @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestCases
{
    class TestCase
    {

    }
}
            ";
        private const string SingleClassWithSingleMethod =
    @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestCases
{
    class TestCase
    {
        static void Test(string[] args)
        {

        }
    }
}
            ";
        private const string SingleClassWithSingleProperty =
    @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestCases
{
    class TestCase
    {
        public int TestProperty{ get; set; }
    }
}
            ";
        private const string SingleClassWithSingleField =
    @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestCases
{
    class TestCase
    {
        private int TestField = 0;
    }
}
            ";
        private const string NestedClass =
    @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestCases
{
    class TestCase
    {
        class InnerTestCase
        {

        }
    }
}
            ";

        private const string Namespace1 =
@"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestCase1
{
    class TestCase
    {
    }
}
            ";

        private const string Namespace2 =
@"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestCase2
{
    class TestCase
    {
    }
}
            ";
    }
}


text:
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'acts_as_followable'


text:
{-# LANGUAGE TypeFamilies #-}

-- Test type families

module ShouldCompile where

import Data.Kind (Type)

data family T a :: Type

data instance T Bool = TBool !Bool

class C a where
  foo :: (a -> a) -> T a -> T a

instance C Bool where
  foo f (TBool x) = TBool $ f (not x)


text:
<?php

namespace LaravelDoctrine\Extensions\IpTraceable;

use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\EventManager;
use Doctrine\ORM\EntityManagerInterface;
use Gedmo\IpTraceable\IpTraceableListener;
use Illuminate\Http\Request;
use LaravelDoctrine\ORM\Extensions\Extension;

class IpTraceableExtension implements Extension
{
    /**
     * @var Request
     */
    protected $request;

    /**
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        $this->request = $request;
    }

    /**
     * @param EventManager           $manager
     * @param EntityManagerInterface $em
     * @param Reader                 $reader
     */
    public function addSubscribers(EventManager $manager, EntityManagerInterface $em, Reader $reader = null)
    {
        $subscriber = new IpTraceableListener();
        $subscriber->setAnnotationReader($reader);
        $subscriber->setIpValue($this->request->getClientIp());
        $manager->addEventSubscriber($subscriber);
    }

    /**
     * @return array
     */
    public function getFilters()
    {
        return [];
    }
}