text:
<!--
  #  Licensed to the Apache Software Foundation (ASF) under one
  #  or more contributor license agreements.  See the NOTICE file
  #  distributed with this work for additional information
  #  regarding copyright ownership.  The ASF licenses this file
  #  to you 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.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.apache.stratos</groupId>
        <artifactId>stratos-components-parent</artifactId>
        <version>4.0.0-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.apache.stratos.tenant.activity</artifactId>
    <packaging>bundle</packaging>
    <name>Apache Stratos - TenantActivity</name>

    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-code/src</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.4.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Private-Package>
                            org.apache.stratos.tenant.activity.internal.*,
                            org.apache.stratos.tenant.activity.services.*,
                        </Private-Package>
                        <Export-Package>
                            org.apache.stratos.tenant.activity.api.*,
                            org.apache.stratos.tenant.activity.util.*,
                            org.apache.stratos.tenant.activity.beans.*,
                            org.apache.stratos.tenant.activity.commands.*,
                        </Export-Package>
                        <Import-Package>
                            !org.apache.stratos.tenanat.activity.stub.*,
                            org.apache.stratos.common.*,
                            org.wso2.carbon.cluster.mgt.core.*,
                            !javax.xml.namespace,
                            javax.xml.namespace; version=0.0.0,
                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
                            org.apache.axiom.*; version="${axiom.wso2.version}",
                            *;resolution:=optional
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <dependencies>

        <dependency>
            <groupId>org.apache.axis2.wso2</groupId>
            <artifactId>axis2</artifactId>
            <version>${axis2.wso2.version}</version>
        </dependency>
        <!--dependency>
            <groupId>org.apache.axis2.wso2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>${orbit.version.axis2}</version>
        </dependency-->

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.registry.core</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.user.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.user.mgt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.stratos</groupId>
            <artifactId>org.apache.stratos.common</artifactId>
	    <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.cluster.mgt.core</artifactId>
            <version>4.1.0</version>
        </dependency>
    </dependencies>
</project>


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

using Lucene.Net.Index;

namespace Lucene.Net.Util.Cache
{
    /// <summary>
    /// Root custom cache to allow a factory to retain references to the custom
    /// caches without having to be aware of the type.
    /// </summary>
    public abstract class AbstractSegmentCache
    {
        /// <summary>
        /// Used to warm up the cache.
        /// </summary>
        /// <param name="reader">The reader to warm the cache for.</param>
        /// <param name="key">The inner key.</param>
        public abstract void Warm(IndexReader reader, string key);
    }

    /// <summary>
    /// Custom cache with two levels of keys, outer key is the IndexReader
    /// with the inner key being a string, commonly a field name but can be anything.
    /// Refer to the unit tests for an example implementation.
    /// <typeparam name="T">The type that is being cached.</typeparam>
    /// </summary>
    public abstract class SegmentCache<T> : AbstractSegmentCache
    {
        /// <summary>
        /// The cache - outer key is the reader, inner key is the field name. Value is the item desired.
        /// </summary>
        private Dictionary<WeakKey, Dictionary<string, T>> readerCache = new Dictionary<WeakKey, Dictionary<string, T>>();

        /// <summary>
        /// Lock to use when accessing the cache.
        /// </summary>
        private ReaderWriterLockSlim cacheLock = new ReaderWriterLockSlim();

        /// <summary>
        /// Value creation.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="key">The key to the item under the reader.</param>
        /// <returns>The value.</returns>
        protected abstract T CreateValue(IndexReader reader, string key);

        /// <summary>
        /// The number of outermost keys in the collection.
        /// </summary>
        public int KeyCount
        {
            get { return this.readerCache.Count; }
        }

        /// <summary>
        /// Warm the cache - simply calls Get and ignores the return value.
        /// </summary>
        /// <param name="reader">The index reader to warm up.</param>
        /// <param name="key">The key of the item under the reader.</param>
        public override void Warm(IndexReader reader, string key)
        {
            this.Get(reader, key);
        }

        /// <summary>
        /// Get the item from the cache.
        /// </summary>
        /// <param name="reader">The IndexReader the cache is from.</param>
        /// <param name="key">The key of the item under the reader.</param>
        /// <returns>The item from cache.</returns>
        public virtual T Get(IndexReader reader, string key)
        {
            WeakKey readerRef = new SegmentCache<T>.WeakKey(reader);

            Dictionary<string, T> innerCache;
            T retVal = default(T);
            this.cacheLock.EnterReadLock();
            try
            {
                if (readerCache.TryGetValue(readerRef, out innerCache))
                {
                    innerCache.TryGetValue(key, out retVal);
                }
            }
            finally
            {
                this.cacheLock.ExitReadLock();
            }

            if (retVal == null)
            {
                retVal = this.CreateValue(reader, key);
                this.cacheLock.EnterWriteLock();
                try
                {
                    if (!readerCache.TryGetValue(readerRef, out innerCache))
                    {
                        innerCache = new Dictionary<string, T>();
                        readerCache.Add(readerRef, innerCache);
                    }
                    if (!innerCache.ContainsKey(key))
                    {
                        innerCache[key] = retVal;
                    }
                    else
                    {
                        // another thread must have put it in while waiting for the write lock
                        // assumption is that the previous thread already flushed the old items
                        return retVal;
                    }

                    // release the old items and yank the gc'd weak references
                    var keys = from wr in this.readerCache.Keys where !wr.IsAlive select wr;
                    List<WeakKey> keysToRemove = keys.ToList();
                    foreach (WeakKey wk in keysToRemove)
                    {
                        this.readerCache.Remove(wk);
                    }
                }
                finally
                {
                    this.cacheLock.ExitWriteLock();
                }
            }

            return retVal;
        }

        /// <summary>
        /// A weak referene wrapper for the hashtable keys. Whenever a key\value pair
        /// is added to the hashtable, the key is wrapped using a WeakKey. WeakKey saves the
        /// value of the original object hashcode for fast comparison.
        /// </summary>
        internal class WeakKey : WeakReference
        {
            /// <summary>
            /// The hashcode for the target.
            /// </summary>
            private int hashCode;

            /// <summary>
            /// Create a new WeakKey
            /// </summary>
            /// <param name="target">The object to use as the target.</param>
            internal WeakKey(object target)
                : base(target)
            {
                this.hashCode = target.GetHashCode();
            }

            /// <summary>
            /// The hash code accessor.
            /// </summary>
            /// <returns></returns>
            public override int GetHashCode()
            {
                return this.hashCode;
            }

            /// <summary>
            /// Equality between keys.
            /// </summary>
            /// <param name="obj">The object to compare to.</param>
            /// <returns>True if they are equivalent.</returns>
            public override bool Equals(object obj)
            {
                WeakKey other = obj as WeakKey;
                if (other == null)
                {
                    return false;
                }

                object a = this.Target;
                object b = other.Target;

                if (a == null && b == null)
                {
                    return true;
                }
                else if (a == null || b == null)
                {
                    return false;
                }
                else
                {
                    return a.Equals(b);
                }
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using UnityEngine;

namespace MultiPacMan.Player.Turbo {
    public class LocalTurboController : TurboController {

        [SerializeField]
        private float turboCapacity = 100.0f;
        [SerializeField]
        private float currentTurboCapacity = 100.0f;
        [SerializeField]
        private float turboPerSecond = 30.0f;
        [SerializeField]
        private float turboRecoveryPerSecond = 10.0f;

        public delegate bool IsTurboInUse ();
        public IsTurboInUse turboDelegate;

        void Update () {
            if (turboDelegate == null) {
                return;
            }

            if (IsTurboOn ()) {
                trail.enabled = true;
            } else {
                trail.enabled = false;
            }

            if (turboDelegate ()) {
                float turboUsed = (turboPerSecond * Time.deltaTime);
                currentTurboCapacity = Mathf.Max (currentTurboCapacity - turboUsed, 0);
            } else {
                float turboRecovered = (turboRecoveryPerSecond * Time.deltaTime);
                currentTurboCapacity = Mathf.Min (currentTurboCapacity + turboRecovered, turboCapacity);
            }
        }

        public override bool IsTurboOn () {
            if (turboDelegate == null) {
                return false;
            }

            return turboDelegate () && (currentTurboCapacity > 0);
        }

        public override float GetTurboFuelPercentage () {
            return currentTurboCapacity / turboCapacity;
        }
    }
}


text:
/* ** GENEREATED FILE - DO NOT MODIFY ** */
package com.wilutions.mslib.uccollaborationlib;
import com.wilutions.com.*;

/**
 * ModalityState.
 * Enumerates the modality states.
 */
@SuppressWarnings("all")
@CoInterface(guid="{00000000-0000-0000-0000-000000000000}")
public class ModalityState {
  static boolean __typelib__loaded = __TypeLib.load();

  // Typed constants
  public final static ModalityState ucModalityDisconnected = new ModalityState(0);
  public final static ModalityState ucModalityConnecting = new ModalityState(1);
  public final static ModalityState ucModalityNotified = new ModalityState(2);
  public final static ModalityState ucModalityJoining = new ModalityState(3);
  public final static ModalityState ucModalityConnectingToCaller = new ModalityState(4);
  public final static ModalityState ucModalityConnected = new ModalityState(5);
  public final static ModalityState ucModalitySuspended = new ModalityState(6);
  public final static ModalityState ucModalityOnHold = new ModalityState(7);
  public final static ModalityState ucModalityForwarding = new ModalityState(8);
  public final static ModalityState ucModalityTransferring = new ModalityState(9);
  public final static ModalityState ucModalityDisconnecting = new ModalityState(10);

  // Integer constants for bitsets and switch statements
  public final static int _ucModalityDisconnected = 0;
  public final static int _ucModalityConnecting = 1;
  public final static int _ucModalityNotified = 2;
  public final static int _ucModalityJoining = 3;
  public final static int _ucModalityConnectingToCaller = 4;
  public final static int _ucModalityConnected = 5;
  public final static int _ucModalitySuspended = 6;
  public final static int _ucModalityOnHold = 7;
  public final static int _ucModalityForwarding = 8;
  public final static int _ucModalityTransferring = 9;
  public final static int _ucModalityDisconnecting = 10;

  // Value, readonly field.
  public final int value;

  // Private constructor, use valueOf to create an instance.
  private ModalityState(int value) { this.value = value; }

  // Return one of the predefined typed constants for the given value or create a new object.
  public static  ModalityState valueOf(int value) {
    switch(value) {
    case 0: return ucModalityDisconnected;
    case 1: return ucModalityConnecting;
    case 2: return ucModalityNotified;
    case 3: return ucModalityJoining;
    case 4: return ucModalityConnectingToCaller;
    case 5: return ucModalityConnected;
    case 6: return ucModalitySuspended;
    case 7: return ucModalityOnHold;
    case 8: return ucModalityForwarding;
    case 9: return ucModalityTransferring;
    case 10: return ucModalityDisconnecting;
    default: return new ModalityState(value);
    }
  }
}


text:
<?php

namespace APP\UsuarioBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use \Symfony\Component\Form\Extension\Core\Type\EmailType;
use \Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use \Symfony\Bridge\Doctrine\Form\Type\EntityType;
use \Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use \Symfony\Component\Form\Extension\Core\Type\CheckboxType;

class UsuarioType extends AbstractType {

    private $usuario;

    public function buildForm(FormBuilderInterface $builder, array $options) {

        $this->usuario = $options['usuario'];

            $builder
                    ->add('username', TextType::class, array(
                        'attr' => array(
                            'class' => 'form-control col-md-7 col-xs-12',
                            'placeholder' => 'Nombre de Usuario'
                        )
                    ))
                    ->add('password', RepeatedType::class, array(
                        'type' => \Symfony\Component\Form\Extension\Core\Type\PasswordType::class,
                        'invalid_message' => 'Las dos contraseñas deben coincidir',
                        'first_options' => array('label' => 'Contraseña', 'attr' => array(
                                'class' => 'form-control col-md-7 col-xs-12',
                            )),
                        'second_options' => array('label' => 'Repetir Contraseña', 'attr' => array(
                                'class' => 'form-control col-md-7 col-xs-12',
                            )),
                    ))
                    ->add('enviar_mail', CheckboxType::class, array(
                        'label' => 'Enviar al mail la contraseña ingresada?',
                        'required' => false,
                        'mapped' => false,
                        'label_attr' => array('colsm' => 'col-sm-4')
                    ))
            ;

        $builder
                ->add('nombre', TextType::class, array(
                    'attr' => array(
                        'class' => 'form-control col-md-7 col-xs-12',
                        'placeholder' => 'Nombre'
                    )
                ))
                ->add('apellido', TextType::class, array(
                    'attr' => array(
                        'class' => 'form-control col-md-7 col-xs-12',
                        'placeholder' => 'Apellido'
                    )
                ))
                ->add('tipo_documento', ChoiceType::class, array(
                    'choices' => array(
                        'DNI' => 'DNI',
                        'CI' => 'CI',
                        'PA' => 'PASAPORTE',
                        'LE' => 'LIBRETA DE ENROLAMIENTO',
                        'LC' => 'LIBRETA CIVICA',
                    ),
                    'attr' => array(
                        'class' => 'form-control col-md-7 col-xs-12',
                    )
                ))
                ->add('numero_documento', TextType::class, array(
                    'required' => false,
                    'attr' => array(
                        'class' => 'form-control col-md-7 col-xs-12',
                        'placeholder' => 'Número de Documento'
                    )
                ))
                ->add('email', EmailType::class, array(
                    'attr' => array(
                        'class' => 'form-control col-md-7 col-xs-12',
                        'placeholder' => 'E-mail'
                    )
                ))
                ->add('telefono', TextType::class, array(
                    'required' => false,
                    'attr' => array(
                        'class' => 'form-control col-md-7 col-xs-12',
                        'placeholder' => 'Télefono'
                    )
                ))
                ->add('telefonoAlternativo', TextType::class, array(
                    'attr' => array(
                        'class' => 'form-control col-md-7 col-xs-12',
                        'placeholder' => 'Télefono Alternativo'
                    ),
                    'required' => false
        ));
        $perfil_id = $this->usuario->getPerfil()->getId();
        $builder->add('perfil', EntityType::class, array(
            'attr' => array(
                'class' => 'form-control col-md-7 col-xs-12',
            ),
            'class' => 'UsuarioBundle:Perfil',
            'query_builder' => function(EntityRepository $er) {
        return $er->createQueryBuilder('u')
                        ->orderBy('u.nombre', 'ASC')
        ;
    },
        ));
    }

    public function getName() {
        return 'pac_usuariobundle_usuariotype';
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'APP\UsuarioBundle\Entity\usuario',
            'usuario' => null,
        ));
    }

}


text:
import Papa from "papaparse";

JobAlarms = new Mongo.Collection("jobAlarms");

Meteor.startup(function () {
  if (!Meteor.isServer) return;
  JobAlarms._ensureIndex({ status: 1 });
  JobAlarms._ensureIndex({ jobId: 1, runId: 1 });
});

Meteor.methods({
  acknowledgeAlarm: function (alarmId) {
    if (!Meteor.isServer) return;

    var alarm = JobAlarms.findOne(alarmId);
    var job = Jobs.findOne(alarm.jobId);
    requireOwnership(this.userId, job);

    JobAlarms.update(alarmId, { $set: { status: "ack" } });
  },

  commentAlarm: function (alarmId, content) {
    if (!Meteor.isServer) return;

    var alarm = JobAlarms.findOne(alarmId);
    var job = Jobs.findOne(alarm.jobId);
    requireAccess(this.userId, job);

    var comment = {
      authorId: this.userId,
      author: Meteor.users.findOne(this.userId).displayName,
      insertedAt: new Date(),
      content: content,
    };

    JobAlarms.update(alarmId, {
      $push: { comments: comment },
    });
  },

  deleteAlarmComment: function (alarmId, ts) {
    JobAlarms.update(alarmId, {
      $pull: { comments: { authorId: this.userId, insertedAt: ts } },
    });
  },
});

checkJobForAlarms = function (job, result, runId) {
  var matches = [];
  if (result.status !== "ok") return matches;

  _.each(job.rules || [], (rule) => {
    _.each(result.data, (row) => {
      var isMatch = _.every(rule.conditions, (condition) => {
        var field = row[condition.field];
        var value = condition.value;
        var op = condition.op;

        if (!op) return;

        if (value.indexOf("@") === 0) {
          var key = value.substring(1, value.length);
          value = row[key];
        }

        if (OPERATORS.hasOwnProperty(op)) return OPERATORS[op].fn(field, value);
        else
          throw new Meteor.Error(
            "rule-error",
            `Unrecognized rule operator "${op}"`
          );
      });

      if (isMatch) {
        var alarm = {
          jobId: job._id,
          runId: runId,
          insertedAt: new Date(),
          status: "open",
          row: row,
          rule: rule,
        };

        JobAlarms.insert(alarm);
        matches.push(alarm);
      }
    });
  });

  if (job.alarm && matches.length > 0) {
    var worstStatus = _.chain(matches)
      .map((alarm) => alarm.rule.severity)
      .sortBy((level) => SEVERITIES[level].rank)
      .first()
      .value();
    var worstStatusRank = SEVERITIES[worstStatus].rank;
    var jobUrl = Meteor.absoluteUrl(`jobs/${job._id}/edit`);
    var alarmsUrl = Meteor.absoluteUrl(`alarms/${job._id}/${runId}`);

    Jobs.update(job._id, { $set: { alarmStatus: worstStatus } });

    if (job.alarm.email) {
      var alarmLevel = job.alarm.emailSeverity || "info";
      var alarmLevelRank = SEVERITIES[alarmLevel].rank;

      if (alarmLevelRank >= worstStatusRank) {
        Email.send({
          from: "noreply@heimdall",
          to: job.alarm.email,
          subject: `[heimdall] [${worstStatus}] ${job.name}`,
          html: `Job <a href="${jobUrl}">${job.name}</a> triggered <b>${worstStatus}</b>, <a href="${alarmsUrl}">check it out</a>.`,
          attachments: [
            {
              fileName: "results.csv",
              contentType: "text/csv",
              contents: Papa.unparse(
                { fields: result.fields, data: result.data },
                { delimiter: "," }
              ),
            },
          ],
        });
      }
    }

    if (job.alarm.slack) {
      var alarmLevel = job.alarm.slackSeverity || "info";
      var alarmLevelRank = SEVERITIES[alarmLevel].rank;

      if (alarmLevelRank >= worstStatusRank) {
        _.each(job.alarm.slack, (channel) => {
          sendSlack({
            username: "heimdall",
            channel: channel,
            text: `Job <${jobUrl}|${job.name}> triggered *${worstStatus}*, <${alarmsUrl}|check it out>`,
            attachments: _.chain(matches)
              .groupBy((alarm) => alarm.rule.name)
              .map((group, ruleName) => {
                var ruleName = ruleName;
                var ruleSeverity = group[0].rule.severity;

                return {
                  color: SEVERITIES[ruleSeverity].hexColor,
                  text: `${ruleName} (${group.length}x)`,
                };
              })
              .value(),
          });
        });
      }
    }
  }

  return matches;
};


text:
<?php

class SimpleCal_View_Helper_RenderEvent extends Zend_View_Helper_Abstract
{

    public function renderEvent(SimpleCal_Model_Event $event)
    {
        $startTime = $this->view->dateFormatter($event->getStartTime())->hour();
        $title = htmlspecialchars($event->getTitle());
        $html = <<<EOT

              $startTime

getId()}" title="More information">

                Description:
                {$event->getDescription()}

                Invitations:
                {$event->getInvite()}

                    getId()}">

                          Edit

                    getId()}" onclick="return confirm('Do you really want to delete this event?')">

                          Delete

                    getId()}" onclick="return confirm('Do you really want to reinvent the users?')">

                          Reinvent

$title
EOT;

        return $html;
    }

    /**
     * Check if the timestamp provided is for today at 00:00
     *
     * @param  integer $day
     * @return boolean
     */
    private function _isToday($day)
    {
        $now = $_SERVER['REQUEST_TIME'];
        return ($now >= $day && $now <= ($day + 24 * 3600 - 1));
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using DbShell.Driver.Common.AbstractDb;
using DbShell.Driver.Common.Structure;
using DbShell.Driver.Common.Utility;

namespace DbShell.Driver.Common.DmlFramework
{
    public class DmlfFromItem : DmlfBase
    {
        public DmlfFromItem()
        {
            Relations = new DmlfRelationCollection();
        }

        /// <summary>
        /// can be null (implicit source), than Handler.GetStructure(null) must be implemented
        /// </summary>
        [XmlSubElem]
        public DmlfSource Source { get; set; }

        [XmlCollection(typeof (DmlfRelation), "Relations")]
        public DmlfRelationCollection Relations { get; set; }

        /// <summary>
        /// finds column in joined tables
        /// </summary>
        /// <param name="expr">column expression</param>
        /// <returns>column reference or null, if not found</returns>
        public DmlfColumnRef FindColumn(string expr)
        {
            return null;
        }

        public override void ForEachChild(Action<IDmlfNode> action)
        {
            base.ForEachChild(action);
            if (Source != null) Source.ForEachChild(action);
            if (Relations != null) Relations.ForEachChild(action);
        }

        public override void GenSql(ISqlDumper dmp)
        {
            Source.GenSqlDef(dmp);
            dmp.Put(" ");
            Relations.GenSql(dmp);
        }

        public DmlfSource FindSourceWithAlias(string alias)
        {
            if (Source != null && Source.Alias == alias) return Source;
            return Relations.FindSourceWithAlias(alias);
        }

        public IEnumerable<DmlfSource> GetAllSources()
        {
            if (Source != null) yield return Source;
            else yield return DmlfSource.BaseTable;
            foreach (var rel in Relations)
            {
                if (rel.Reference != null)
                {
                    yield return rel.Reference;
                }
            }
        }

        private DmlfSource DoAddOrFindRelation(DmlfSource baseSource, NameWithSchema baseTable, StructuredIdentifier relationJoined, StructuredIdentifier relationToJoin, DatabaseInfo db, DmlfJoinType joinType)
        {
            if (relationToJoin.IsEmpty) return baseSource;
            string relName = relationToJoin.First;
            string alias = String.Format("_REF{0}_{1}", relationJoined.NameItems.Select(x => "_" + x).CreateDelimitedText(""), relName);
            var source = FindSourceByAlias(alias);
            if (source == null)
            {
                var baseTableInfo = db.FindTable(baseTable);
                var fk = baseTableInfo.ForeignKeys.FirstOrDefault(x => System.String.Compare(x.ConstraintName, relName, StringComparison.OrdinalIgnoreCase) == 0);
                if (fk == null)
                {
                    var column = baseTableInfo.FindColumn(relName);
                    if (column != null) fk = column.GetForeignKeys().FirstOrDefault(x => x.Columns.Count == 1);
                }
                if (fk == null) return null;

                source = new DmlfSource
                    {
                        TableOrView = fk.RefTableFullName,
                        Alias = alias,
                    };
                var relation = new DmlfRelation
                    {
                        Reference = source,
                        JoinType = joinType,
                    };
                for (int i = 0; i < fk.Columns.Count; i++)
                {
                    relation.Conditions.Add(new DmlfEqualCondition
                        {
                            LeftExpr = new DmlfColumnRefExpression
                                {
                                    Column = new DmlfColumnRef
                                        {
                                            ColumnName = fk.Columns[0].RefColumnName,
                                            Source = baseSource,
                                        }
                                },
                            RightExpr = new DmlfColumnRefExpression
                                {
                                    Column = new DmlfColumnRef
                                        {
                                            ColumnName = fk.RefColumns[0].RefColumnName,
                                            Source = source,
                                        }
                                },
                        });
                    Relations.Add(relation);
                }
            }
            if (relationToJoin.IsEmpty) return source;
            return DoAddOrFindRelation(source, source.TableOrView, relationJoined/relationToJoin.First, relationToJoin.WithoutFirst, db, joinType);
        }

        private DmlfSource FindSourceByAlias(string alias)
        {
            foreach (var rel in Relations)
            {
                if (rel.Reference != null && rel.Reference.Alias == alias) return rel.Reference;
            }
            return null;
        }

        public DmlfSource AddOrFindRelation(DmlfSource baseSource, NameWithSchema baseTable, StructuredIdentifier relationId, DatabaseInfo db, DmlfJoinType joinType)
        {
            return DoAddOrFindRelation(baseSource, baseTable, new StructuredIdentifier(), relationId, db, joinType);
        }

        public DmlfColumnRef GetColumnRef(DmlfSource baseSource, NameWithSchema baseTable, StructuredIdentifier columnId, DatabaseInfo db, DmlfJoinType joinType)
        {
            var relationId = columnId.WithoutLast;
            string column = columnId.Last;
            var source = AddOrFindRelation(baseSource, baseTable, relationId, db, joinType);
            if (source == null) return null;
            return new DmlfColumnRef
                {
                    ColumnName = column,
                    Source = source,
                };
        }

        public void GetSimpleSources(HashSet<DmlfSource> sources)
        {
            if (Source != null && Source.IsSimpleSource) sources.Add(Source);
            foreach (var item in Relations)
            {
                if (item.Reference != null && item.Reference.IsSimpleSource)
                {
                    sources.Add(item.Reference);
                }
            }
        }
    }
}


text:
namespace syncer {
namespace {

using ::testing::InSequence;
using ::testing::StrictMock;

class JsMutationEventObserverTest : public testing::Test {
 protected:
  JsMutationEventObserverTest() {
    js_mutation_event_observer_.SetJsEventHandler(
        mock_js_event_handler_.AsWeakHandle());
  }

 private:
  // This must be destroyed after the member variables below in order
  // for WeakHandles to be destroyed properly.
  base::MessageLoop message_loop_;

 protected:
  StrictMock<MockJsEventHandler> mock_js_event_handler_;
  JsMutationEventObserver js_mutation_event_observer_;

  void PumpLoop() {
    message_loop_.RunUntilIdle();
  }
};

TEST_F(JsMutationEventObserverTest, OnChangesApplied) {
  InSequence dummy;

  // We don't test with passwords as that requires additional setup.

  // Build a list of example ChangeRecords.
  ChangeRecord changes[MODEL_TYPE_COUNT];
  for (int i = AUTOFILL_PROFILE; i < MODEL_TYPE_COUNT; ++i) {
    changes[i].id = i;
    switch (i % 3) {
      case 0:
        changes[i].action = ChangeRecord::ACTION_ADD;
        break;
      case 1:
        changes[i].action = ChangeRecord::ACTION_UPDATE;
        break;
      default:
        changes[i].action = ChangeRecord::ACTION_DELETE;
        break;
    }
  }

  // For each i, we call OnChangesApplied() with the first arg equal
  // to i cast to ModelType and the second argument with the changes
  // starting from changes[i].

  // Set expectations for each data type.
  for (int i = AUTOFILL_PROFILE; i < MODEL_TYPE_COUNT; ++i) {
    const std::string& model_type_str =
        ModelTypeToString(ModelTypeFromInt(i));
    base::DictionaryValue expected_details;
    expected_details.SetString("modelType", model_type_str);
    expected_details.SetString("writeTransactionId", "0");
    base::ListValue* expected_changes = new base::ListValue();
    expected_details.Set("changes", expected_changes);
    for (int j = i; j < MODEL_TYPE_COUNT; ++j) {
      expected_changes->Append(changes[j].ToValue());
    }
    EXPECT_CALL(mock_js_event_handler_,
                HandleJsEvent("onChangesApplied",
                             HasDetailsAsDictionary(expected_details)));
  }

  // Fire OnChangesApplied() for each data type.
  for (int i = AUTOFILL_PROFILE; i < MODEL_TYPE_COUNT; ++i) {
    ChangeRecordList local_changes(changes + i, changes + arraysize(changes));
    js_mutation_event_observer_.OnChangesApplied(
        ModelTypeFromInt(i),
        0, ImmutableChangeRecordList(&local_changes));
  }

  PumpLoop();
}

TEST_F(JsMutationEventObserverTest, OnChangesComplete) {
  InSequence dummy;

  for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
    base::DictionaryValue expected_details;
    expected_details.SetString(
        "modelType",
        ModelTypeToString(ModelTypeFromInt(i)));
    EXPECT_CALL(mock_js_event_handler_,
                HandleJsEvent("onChangesComplete",
                             HasDetailsAsDictionary(expected_details)));
  }

  for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
    js_mutation_event_observer_.OnChangesComplete(
        ModelTypeFromInt(i));
  }
  PumpLoop();
}

}  // namespace
}  // namespace syncer


text:
'''
Test the Forwarded header and related configuration..
'''
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you 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.

import os
import subprocess

Test.Summary = '''
Test FORWARDED header.
'''

Test.SkipUnless(
    Condition.HasATSFeature('TS_USE_TLS_ALPN'),
    Condition.HasCurlFeature('http2'),
    Condition.HasCurlFeature('IPv6'),
    Condition.HasProgram("netstat", "netstat need to be installed on system for this test to work")
)
Test.ContinueOnFail = True

testName = "FORWARDED"

server = Test.MakeOriginServer("server", options={'--load': os.path.join(Test.TestDirectory, 'forwarded-observer.py')})

request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.no-oride.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-none.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-for.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-by-ip.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-by-unknown.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-by-server-name.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-by-uuid.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-proto.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-host.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-connection-compact.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-connection-std.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
request_header = {
    "headers": "GET / HTTP/1.1\r\nHost: www.forwarded-connection-full.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)

# Set up to check the output after the tests have run.
#
forwarded_log_id = Test.Disk.File("forwarded.log")
forwarded_log_id.Content = "forwarded.gold"

def baselineTsSetup(ts, sslPort):

    ts.addSSLfile("../remap/ssl/server.pem")
    ts.addSSLfile("../remap/ssl/server.key")

    ts.Variables.ssl_port = sslPort

    ts.Disk.records_config.update({
        # 'proxy.config.diags.debug.enabled': 1,
        'proxy.config.url_remap.pristine_host_hdr': 1,  # Retain Host header in original incoming client request.
        'proxy.config.http.cache.http': 0,  # Make sure each request is forwarded to the origin server.
        'proxy.config.proxy_name': 'Poxy_Proxy',  # This will be the server name.
        'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
        'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
        'proxy.config.http.server_ports': (
            'ipv4:{0} ipv4:{1}:proto=http2;http:ssl ipv6:{0} ipv6:{1}:proto=http2;http:ssl'
            .format(ts.Variables.port, ts.Variables.ssl_port))
    })

    ts.Disk.ssl_multicert_config.AddLine(
        'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
    )

    ts.Disk.remap_config.AddLine(
        'map http://www.no-oride.com http://127.0.0.1:{0}'.format(server.Variables.Port)
    )

ts = Test.MakeATSProcess("ts", select_ports=False)

baselineTsSetup(ts, 4443)

ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-none.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=none'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-for.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=for'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-by-ip.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=by=ip'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-by-unknown.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=by=unknown'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-by-server-name.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=by=serverName'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-by-uuid.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=by=uuid'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-proto.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=proto'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-host.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=host'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-connection-compact.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=connection=compact'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-connection-std.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=connection=std'
)
ts.Disk.remap_config.AddLine(
    'map http://www.forwarded-connection-full.com http://127.0.0.1:{0}'.format(server.Variables.Port) +
    ' @plugin=conf_remap.so @pparam=proxy.config.http.insert_forwarded=connection=full'
)

# Ask the OS if the port is ready for connect()
#

def CheckPort(Port):
    return lambda: 0 == subprocess.call('netstat --listen --tcp -n | grep -q :{}'.format(Port), shell=True)

# Basic HTTP 1.1 -- No Forwarded by default
tr = Test.AddTestRun()
# Wait for the micro server
tr.Processes.Default.StartBefore(server, ready=CheckPort(server.Variables.Port))
# Delay on readiness of our ssl ports
tr.Processes.Default.StartBefore(Test.Processes.ts, ready=CheckPort(ts.Variables.ssl_port))
#
tr.Processes.Default.Command = (
    'curl --verbose --ipv4 --http1.1 --proxy localhost:{} http://www.no-oride.com'.format(ts.Variables.port)
)
tr.Processes.Default.ReturnCode = 0

def TestHttp1_1(host):

    tr = Test.AddTestRun()
    tr.Processes.Default.Command = (
        'curl --verbose --ipv4 --http1.1 --proxy localhost:{} http://{}'.format(ts.Variables.port, host)
    )
    tr.Processes.Default.ReturnCode = 0

# Basic HTTP 1.1 -- No Forwarded -- explicit configuration.
#
TestHttp1_1('www.forwarded-none.com')

# Test enabling of each forwarded parameter singly.

TestHttp1_1('www.forwarded-for.com')

# Note:  forwaded-obsersver.py counts on the "by" tests being done in the order below.

TestHttp1_1('www.forwarded-by-ip.com')
TestHttp1_1('www.forwarded-by-unknown.com')
TestHttp1_1('www.forwarded-by-server-name.com')
TestHttp1_1('www.forwarded-by-uuid.com')

TestHttp1_1('www.forwarded-proto.com')
TestHttp1_1('www.forwarded-host.com')
TestHttp1_1('www.forwarded-connection-compact.com')
TestHttp1_1('www.forwarded-connection-std.com')
TestHttp1_1('www.forwarded-connection-full.com')

ts2 = Test.MakeATSProcess("ts2", command="traffic_manager", select_ports=False)

ts2.Variables.port += 1

baselineTsSetup(ts2, 4444)

ts2.Disk.records_config.update({
    'proxy.config.url_remap.pristine_host_hdr': 1,  # Retain Host header in original incoming client request.
    'proxy.config.http.insert_forwarded': 'by=uuid'})

ts2.Disk.remap_config.AddLine(
    'map https://www.no-oride.com http://127.0.0.1:{0}'.format(server.Variables.Port)
)

# Forwarded header with UUID of 2nd ATS.
tr = Test.AddTestRun()
# Delay on readiness of our ssl ports
tr.Processes.Default.StartBefore(Test.Processes.ts2, ready=CheckPort(ts2.Variables.ssl_port))
#
tr.Processes.Default.Command = (
    'curl --verbose --ipv4 --http1.1 --proxy localhost:{} http://www.no-oride.com'.format(ts2.Variables.port)
)
tr.Processes.Default.ReturnCode = 0

# Call traffic_ctrl to set insert_forwarded
tr = Test.AddTestRun()
tr.Processes.Default.Command = (
    'traffic_ctl --debug config set proxy.config.http.insert_forwarded' +
    ' "for|by=ip|by=unknown|by=servername|by=uuid|proto|host|connection=compact|connection=std|connection=full"'
)
tr.Processes.Default.ForceUseShell = False
tr.Processes.Default.Env = ts2.Env
tr.Processes.Default.ReturnCode = 0

# HTTP 1.1
tr = Test.AddTestRun()
# Delay to give traffic_ctl config change time to take effect.
tr.DelayStart = 15
tr.Processes.Default.Command = (
    'curl --verbose --ipv4 --http1.1 --proxy localhost:{} http://www.no-oride.com'.format(ts2.Variables.port)
)
tr.Processes.Default.ReturnCode = 0

# HTTP 1.0
tr = Test.AddTestRun()
tr.Processes.Default.Command = (
    'curl --verbose --ipv4 --http1.0 --proxy localhost:{} http://www.no-oride.com'.format(ts2.Variables.port)
)
tr.Processes.Default.ReturnCode = 0

# HTTP 1.0 -- Forwarded headers already present
tr = Test.AddTestRun()
tr.Processes.Default.Command = (
    "curl --verbose -H 'forwarded:for=0.6.6.6' -H 'forwarded:for=_argh' --ipv4 --http1.0" +
    " --proxy localhost:{} http://www.no-oride.com".format(ts2.Variables.port)
)
tr.Processes.Default.ReturnCode = 0

# HTTP 2
tr = Test.AddTestRun()
tr.Processes.Default.Command = (
    'curl --verbose --ipv4 --http2 --insecure --header "Host: www.no-oride.com"' +
    ' https://localhost:{}'.format(ts2.Variables.ssl_port)
)
tr.Processes.Default.ReturnCode = 0

# TLS
tr = Test.AddTestRun()
tr.Processes.Default.Command = (
    'curl --verbose --ipv4 --http1.1 --insecure --header "Host: www.no-oride.com" https://localhost:{}'
    .format(ts2.Variables.ssl_port)
)
tr.Processes.Default.ReturnCode = 0

# IPv6

tr = Test.AddTestRun()
tr.Processes.Default.Command = (
    'curl --verbose --ipv6 --http1.1 --proxy localhost:{} http://www.no-oride.com'.format(ts2.Variables.port)
)
tr.Processes.Default.ReturnCode = 0

tr = Test.AddTestRun()
tr.Processes.Default.Command = (
    'curl --verbose --ipv6 --http1.1 --insecure --header "Host: www.no-oride.com" https://localhost:{}'.format(
        ts2.Variables.ssl_port)
)
tr.Processes.Default.ReturnCode = 0


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="25dp"
    android:gravity="center"
    android:orientation="vertical"
    tools:context="io.innofang.transitiondemo.MainActivity">

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="CircularReveal"
        android:text="@string/circular_reveal"
        android:textAllCaps="false"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="windowTransitions"
        android:text="@string/window_transitions"
        android:textAllCaps="false"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="sharedElement"
        android:text="@string/shared_element"
        android:textAllCaps="false"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="customTransition"
        android:text="@string/custom_transition"
        android:textAllCaps="false"/>

</LinearLayout>


text:
YUI.add('event-custom-benchmark', function (Y) {

   var suite = Y.BenchmarkSuite = new Benchmark.Suite(),
       I = 0,
       ETPUBLISH,
       ET_FAST_PUBLISH,
       FN = function() {},
       ET10,
       ET2,
       ET;

   ET10 = new Y.EventTarget({
      emitFacade:true
   });

   ET10.publish("fooChange", {
      defaultTargetOnly: true,
      defaultFn:function() {}
   });

   for (var i = 0; i < 5; i++) {
      ET10.on("fooChange", function() {});
      ET10.after("fooChange", function() {});
   }

   ET2 = new Y.EventTarget({
      emitFacade:true
   });

   ET2.publish("fooChange", {
      defaultTargetOnly: true,
      defaultFn:function() {}
   });

   ET2.on("fooChange", function() {});
   ET2.after("fooChange", function() {});

   ET0 = new Y.EventTarget({
      emitFacade:true
   });

   var ET_CFG = {
      defaultTargetOnly: true,
      defaultFn:FN
   };

   // Ideally, would like to create a new ET for each run, but
   // benchmark doesn't give me a trivial way to do that. Live with
   // publishing a new event each time.

   suite.add('Fire - 0 listeners', function () {
      ET0.fire("fooChange");
   });

   suite.add('Fire With Payload - 0 listeners', function () {
      ET0.fire("fooChange", {
         a: 1,
         b: 2,
         c: 3
      });
   });

   suite.add('Fire - 2 listeners', function () {
      ET2.fire("fooChange");
   });

   suite.add('Fire With Payload - 2 listeners', function () {
      ET2.fire("fooChange", {
         a: 1,
         b: 2,
         c: 3
      });
   });

   suite.add('Fire - 10 listeners', function () {
      ET10.fire("fooChange");
   });

   suite.add('Fire With Payload - 10 listeners', function () {
      ET10.fire("fooChange", {
         a: 1,
         b: 2,
         c: 3
      });
   });

   suite.add('EventTarget Construction + Publish(foo) + Fire(foo) - no listeners', function () {

      var et = new Y.EventTarget({
         emitFacade:true
      });

      et.publish("fooChange", {
         defaultTargetOnly: true,
         defaultFn:function() {}
      });

      et.fire("fooChange");

   });

   suite.add('EventTarget Construction + Publish(foo) + Subscribe(foo) + Fire(foo) - 2 listeners', function () {

      var et = new Y.EventTarget({
         emitFacade:true
      });

      et.publish("fooChange", {
         defaultTargetOnly: true,
         defaultFn:function() {}
      });

      et.on("fooChange", function() {});
      et.after("fooChange", function() {});

      et.fire("fooChange");
   });

   suite.add('EventTarget Construction + Publish(foo) + Subscribe(foo) + Fire(foo) - 10 listeners', function () {

      var et = new Y.EventTarget({
         emitFacade:true
      });

      et.publish("fooChange", {
         defaultTargetOnly: true,
         defaultFn:function() {}
      });

      for (var i = 0; i < 5; i++) {
         et.on("fooChange", function() {});
         et.after("fooChange", function() {});
      }

      et.fire("fooChange");
   });

   suite.add('new Base()', function () {
      var b = new Y.Base();
   });

   suite.add('new BaseCore()', function () {
      var b = new Y.BaseCore();
   });

   suite.add('Publish', function () {
      // Unfortunate, but best way to reduce variance.
      ETPUBLISH = new Y.EventTarget({emitFacade:true});

      ETPUBLISH.publish("fooChange", ET_CFG);
   });

   suite.add('Low-level Publish', function () {

      var type, e;

      // Unfortunate, but best way to reduce variance.
      ET_FAST_PUBLISH = new Y.EventTarget({emitFacade:true});

      type = ET_FAST_PUBLISH._getFullType("fooChange");

      e = ET_FAST_PUBLISH._publish(type);
      e.emitFacade = true;
      e.defaultFn = FN;
      e.defaultTargetOnly = true;
   });

}, '@VERSION@', {requires: ['event-custom', 'widget']});


text:
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import {
  JupyterLabPlugin
} from '@jupyterlab/application';

import {
  DocumentRegistry, IDocumentRegistry, TextModelFactory, Base64ModelFactory
} from '@jupyterlab/docregistry';

/**
 * The default document registry provider.
 */
const plugin: JupyterLabPlugin<IDocumentRegistry> = {
  id: 'jupyter.services.document-registry',
  provides: IDocumentRegistry,
  activate: (): IDocumentRegistry => {
    let registry = new DocumentRegistry();
    registry.addModelFactory(new TextModelFactory());
    registry.addModelFactory(new Base64ModelFactory());
    registry.addFileType({
      name: 'Text',
      extension: '.txt',
      contentType: 'file',
      fileFormat: 'text'
    });
    registry.addCreator({ name: 'Text File', fileType: 'Text', });
    return registry;
  }
};

/**
 * Export the plugin as default.
 */
export default plugin;


text:
@interface RSMessageVideoCell : UITableViewCell

@property (weak, nonatomic) IBOutlet UIImageView *bkIMageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

+ (CGFloat)rowHeight;
+ (NSString *)cellID;

@end


text:
package combinations

import (
	"fmt"
	"math/rand"
	"testing"
	"time"

	"github.com/gadumitrachioaiei/algorithms/hackerrank/nondivisiblesubset"
)

func TestNonDivisibleSubsetSlow(t *testing.T) {
	s := make([]int, 30)
	d := 47
	rand.Seed(time.Now().UnixNano())
	for i := 0; i < len(s); i++ {
		s[i] = rand.Intn(100)
	}
	fmt.Println(s)
	calculated := NonDivisibleSubsetSlow(s, d)
	expected := nondivisiblesubset.Find(s, d)
	if calculated != expected {
		t.Fatalf("got: %d, expected: %d, s:\n%v\n", calculated, expected, s)
	}
	fmt.Println(calculated)
}