text:
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.test.util.browser.suggestions.mostvisited;

import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.suggestions.SiteSuggestion;
import org.chromium.chrome.browser.suggestions.mostvisited.MostVisitedSites;
import org.chromium.chrome.browser.suggestions.tile.Tile;
import org.chromium.chrome.browser.suggestions.tile.TileSectionType;
import org.chromium.chrome.browser.suggestions.tile.TileSource;
import org.chromium.chrome.browser.suggestions.tile.TileTitleSource;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * A fake implementation of MostVisitedSites that returns a fixed list of most visited sites.
 *
 * Once the observer is set (through {@link #setObserver(Observer, int)}), updates to the data must
 * be made on the UI thread, as they can result in UI manipulations.
 */
public class FakeMostVisitedSites implements MostVisitedSites {
    private final List<String> mBlacklistedUrls = new ArrayList<>();

    private List<SiteSuggestion> mSites = new ArrayList<>();
    private Observer mObserver;

    @Override
    public void destroy() {}

    @Override
    public void setObserver(Observer observer, int numResults) {
        mObserver = observer;
        notifyTileSuggestionsAvailable();
    }

    @Override
    public void addBlacklistedUrl(String url) {
        mBlacklistedUrls.add(url);
    }

    @Override
    public void removeBlacklistedUrl(String url) {
        mBlacklistedUrls.remove(url);
    }

    @Override
    public void recordPageImpression(int tilesCount) {
        // Metrics are stubbed out.
    }

    @Override
    public void recordTileImpression(Tile tile) {
        // Metrics are stubbed out.
    }

    @Override
    public void recordOpenedMostVisitedItem(Tile tile) {
        //  Metrics are stubbed out.
    }

    /** @return Whether {@link #addBlacklistedUrl} has been called on the given URL. */
    public boolean isUrlBlacklisted(String url) {
        return mBlacklistedUrls.contains(url);
    }

    /**
     * Sets new tile suggestion data.
     *
     * If there is an observer it will be notified and the call has to be made on the UI thread.
     */
    public void setTileSuggestions(List<SiteSuggestion> suggestions) {
        mSites = new ArrayList<>(suggestions);
        notifyTileSuggestionsAvailable();
    }

    /**
     * Sets new tile suggestion data.
     *
     * If there is an observer it will be notified and the call has to be made on the UI thread.
     */
    public void setTileSuggestions(SiteSuggestion... suggestions) {
        setTileSuggestions(Arrays.asList(suggestions));
    }

    /**
     * Sets new tile suggestion data, generating dummy data for the missing properties.
     *
     * If there is an observer it will be notified and the call has to be made on the UI thread.
     *
     * @param urls The URLs of the site suggestions.
     * @see #setTileSuggestions(SiteSuggestion[])
     */
    public void setTileSuggestions(String... urls) {
        setTileSuggestions(createSiteSuggestions(urls));
    }

    /** @return An unmodifiable view of the current list of sites. */
    public List<SiteSuggestion> getCurrentSites() {
        return Collections.unmodifiableList(mSites);
    }

    public static List<SiteSuggestion> createSiteSuggestions(String... urls) {
        List<SiteSuggestion> suggestions = new ArrayList<>(urls.length);
        for (String url : urls) suggestions.add(createSiteSuggestion(url));
        return suggestions;
    }

    public static SiteSuggestion createSiteSuggestion(String url) {
        return createSiteSuggestion(url, url);
    }

    public static SiteSuggestion createSiteSuggestion(String title, String url) {
        return new SiteSuggestion(title, url, "", TileTitleSource.TITLE_TAG, TileSource.TOP_SITES,
                TileSectionType.PERSONALIZED, new Date());
    }

    private void notifyTileSuggestionsAvailable() {
        if (mObserver == null) return;

        // Notifying the observer usually results in view modifications, so this call should always
        // happen on the UI thread. We assert we do it here to make detecting related mistakes in
        // tests more easily.
        // To make initialisation easier, we only enforce that once the observer is set, using it as
        // a signal that the test started and this is not the setup anymore.
        ThreadUtils.assertOnUiThread();

        mObserver.onSiteSuggestionsAvailable(mSites);
    }
}


text:
List of Supported Set Commands
==============================

The following `:set` commands can appear in `~/.ideavimrc` or be set manually in the command mode:

    'clipboard'      'cb'       clipboard options
                                Standard clipboard options plus

                                `ideaput`  (default on)   - IdeaVim ONLY
                                enable native idea paste action for put operations

    'digraph'        'dg'       enable the entering of digraphs in Insert mode
    'gdefault'       'gd'       the ":substitute" flag 'g' is by default
    'history'        'hi'       number of command-lines that are remembered
    'hlsearch'       'hls'      highlight matches with the last search pattern
    'ignorecase'     'ic'       ignore case in search patterns
    'iskeyword'      'isk'      defines keywords for commands like 'w', '*', etc.
    'incsearch'      'is'       show where search pattern typed so far matches

    `keymodel`       `km`       String (default "continueselect,stopselect")

                 List of comma separated words, which enable special things that keys
                 can do. These values can be used:
                   startsel           Using a shifted special[1] key starts selection (either
                                      Select mode or Visual mode, depending on "key" being
                                      present in 'selectmode').
                   stopsel            Using a NOT-shifted special[1] key stops selection.
                                      Automatically enables `stopselect` and `stopvisual`
                   stopselect         Using a NOT-shifted special[1] key stops     - IdeaVim ONLY
                                      select mode and removes selection.
                   stopvisual         Using a NOT-shifted special[1] key stops     - IdeaVim ONLY
                                      visual mode and removes selection.
                   continueselect     Using a shifted arrow key doesn't       - IdeaVim ONLY
                                      start selection, but in select mode
                                      acts like startsel is enabled
                   continuevisual     Using a shifted arrow key doesn't       - IdeaVim ONLY
                                      start selection, but in visual mode
                                      acts like startsel is enabled

    'matchpairs'     'mps'   pairs of characters that "%" can match
    'maxmapdepth'    'mmd'   Maximum depth of mappings
    'more'           'more'  When on, listings pause when the whole screen is filled.
    'nrformats'      'nf'    number formats recognized for CTRL-A command
    'number'         'nu'    print the line number in front of each line
    'relativenumber' 'rnu'   show the line number relative to the line with
                             the cursor
    'scroll'         'scr'   lines to scroll with CTRL-U and CTRL-D
    'scrolljump'     'sj'    minimum number of lines to scroll
    'scrolloff'      'so'    minimum number of lines above and below the cursor
    'selection'      'sel'   what type of selection to use

    `selectmode`     `slm`   String (default "")

                 This is a comma-separated list of words, which specify when to start
                 Select mode instead of Visual mode, when a selection is started.
                 Possible values:
                   mouse           when using the mouse
                   key             when using shifted special[1] keys
                   cmd             when using "v", "V", or <C-V>
                   ideaselection   when IDE sets a selection      - IdeaVim ONLY
                                   (examples: extend selection, wrap with while, etc.)

    `startofline`    `sol`       When "on" some commands move the cursor to the first non-blank of the line.
                                    When off the cursor is kept in the same column (if possible).

    'showmode'       'smd'       message on the status line to show current mode
    'showcmd'        'sc'        show (partial) command in the status bar
    'sidescroll'     'ss'        minimum number of columns to scroll horizontally
    'sidescrolloff'  'siso'      min. number of columns to left and right of cursor
    'smartcase'      'scs'       no ignore case when pattern is uppercase
    'timeout'        'to'        use timeout for mapped key sequences
    'timeoutlen'     'tm'        timeout duration for a mapped key sequence
    'undolevels'     'ul'        maximum number of changes that can be undone
    'viminfo'        'vi'        information to remember after restart
    'visualbell'     'vb'        use visual bell instead of beeping
    'wrapscan'       'ws'        searches wrap around the end of file

    IdeaVim only commands:

    `ideamarks`      `ideamarks` Boolean (default true)

                     If true, creation of global mark will trigger creation of IDE's bookmark
                     and vice versa.

    `idearefactormode` `idearefactormode` String(default "select")

                 Define the mode that would be enabled during
                 the refactoring (renaming, live template, introduce variable, etc)

                 Use one of the following values:
                 - keep  - keep the mode that was enabled before starting a refactoring
                 - select - start refactoring in select mode
                 - visual - start refactoring in visual mode

                 This option has effect if you are in normal, insert or replace mode before refactoring start.
                 Visual or select mode are not changed.

    `ideajoin`      `ideajoin` Boolean (default false)

                  If true, join command will be performed via IDE
                  See wiki/`ideajoin` examples

    `ideastatusicon`  `ideastatusicon` String(default "enabled")

                 Define the behavior of IdeaVim icon in the status bar.

                 Use one of the following values:
                 - enabled - icon is shown in the status bar
                 - gray - use the gray version of the icon
                 - disabled - hide the icon

    `ideawrite`     `ideawrite` String (default "all")
                  "file" or "all". Defines the behaviour of ":w" command.
                  Value "all" enables execution of ":wa" (save all) command on ":w" (save).
                  This feature exists because some IJ options like "Prettier on save" or "ESlint on save"
                       work only with "save all" action. If this option is set to "all", these actions work
                       also with ":w" command.

    `lookupkeys`    `lookupkeys`   List of strings

                  List of keys that should be processed by the IDE during the active lookup (autocompletion).
                  For example, <Tab> and <Enter> are used by the IDE to finish the lookup,
                        but <C-W> should be passed to IdeaVim.
                  Default value:
                        "<Tab>", "<Down>", "<Up>", "<Enter>", "<Left>", "<Right>",
                        "<C-Down>", "<C-Up>", "<PageUp>", "<PageDown>",
                        "<C-J>", "<C-Q>"

    `ideavimsupport`  `ideavimsupport`  List of strings (default "dialog")

                  Define the list of additional buffers where IdeaVim is enabled.

                  - dialog - enable IdeaVim in dialogs
                  - singleline - enable IdeaVim in single line editors (not suggested)

    ----------
    [1] - cursor keys, <End>, <Home>, <PageUp> and <PageDown>

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Composer\Satis\Console\Command;

use Composer\Command\BaseCommand;
use Composer\Config;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Json\JsonFile;
use Composer\Repository\VcsRepository;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * @author Sergey Kolodyazhnyy <sergey.kolodyazhnyy@gmail.com>
 */
class AddCommand extends BaseCommand
{
    protected function configure()
    {
        $this
            ->setName('add')
            ->setDescription('Add repository URL to satis JSON file')
            ->setDefinition([
                new InputArgument('url', InputArgument::REQUIRED, 'VCS repository URL'),
                new InputArgument('file', InputArgument::OPTIONAL, 'JSON file to use', './satis.json'),
            ])
            ->setHelp(<<<'EOT'
The <info>add</info> command adds given repository URL to the json file
(satis.json is used by default). You will need to run <comment>build</comment> command to
fetch updates from repository.
EOT
            )
        ;
    }

    /**
     * @param InputInterface  $input  The input instance
     * @param OutputInterface $output The output instance
     *
     * @return int
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var FormatterHelper $formatter */
        $formatter = $this->getHelper('formatter');

        $configFile = $input->getArgument('file');
        $repositoryUrl = $input->getArgument('url');

        if (preg_match('{^https?://}i', $configFile)) {
            $output->writeln('<error>Unable to write to remote file ' . $configFile . '</error>');

            return 2;
        }

        $file = new JsonFile($configFile);
        if (!$file->exists()) {
            $output->writeln('<error>File not found: ' . $configFile . '</error>');

            return 1;
        }

        if (!$this->isRepositoryValid($repositoryUrl)) {
            $output->writeln('<error>Invalid Repository URL: ' . $repositoryUrl . '</error>');

            return 3;
        }

        $config = $file->read();
        if (!isset($config['repositories']) || !is_array($config['repositories'])) {
            $config['repositories'] = [];
        }

        foreach ($config['repositories'] as $repository) {
            if (isset($repository['url']) && $repository['url'] == $repositoryUrl) {
                $output->writeln('<error>Repository already added to the file</error>');

                return 4;
            }
        }

        $config['repositories'][] = ['type' => 'vcs', 'url' => $repositoryUrl];

        $file->write($config);

        $output->writeln([
            '',
            $formatter->formatBlock('Your configuration file successfully updated! It\'s time to rebuild your repository', 'bg=blue;fg=white', true),
            '',
        ]);

        return 0;
    }

    /**
     * Validate repository URL
     *
     * @param $repositoryUrl
     *
     * @return bool
     */
    protected function isRepositoryValid($repositoryUrl)
    {
        $io = new NullIO();
        $config = Factory::createConfig();
        $io->loadConfiguration($config);
        $repository = new VcsRepository(['url' => $repositoryUrl], $io, $config);

        if (!($driver = $repository->getDriver())) {
            return false;
        }

        $information = $driver->getComposerInformation($driver->getRootIdentifier());

        return !empty($information['name']);
    }
}


text:
using System;
using System.ComponentModel;

namespace nMqtt.SampleApp
{
	public abstract class ViewModel
	{
	}

	public abstract class ViewModel<TModel> : ViewModel, INotifyPropertyChanged
		where TModel : IModel
	{
		private TModel model;

		public TModel Model
		{
			get
			{
				return model;
			}
			set
			{
				model = value;

				model.PropertyChanged += (sender, e) => OnPropertyChanged(e.PropertyName);
			}
		}

		public event PropertyChangedEventHandler PropertyChanged;

		protected void OnPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Sphaerella curva P. Karst.

### Remarks
null


text:
// ***********************************************************************
// Assembly         : BI.Interface
// Author           : Anugoon Leelaphattarakij
// Created          : 04-19-2015
//
// Last Modified By : Anugoon Leelaphattarakij
// Last Modified On : 04-19-2015
// ***********************************************************************
// <copyright file="_ViewModelEntity.cs" company="Beyond Inspira">
//     Copyright © Anugoon L. 2015
// </copyright>
// <summary>Base view model for every entity</summary>
// ***********************************************************************

namespace BI.Interface.ViewModels
{
    /// <summary>
    /// Base class for all view model.
    /// This class use with action filer "ViewModelUserFilter", which automatically add set "IsUserAuthenticated" and "UserName".
    /// </summary>
    public class EntityViewModel
    {
        /// <summary>
        /// Gets or sets the identifier.
        /// </summary>
        /// <value>The identifier.</value>
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is user authenticated.
        /// </summary>
        /// <value><c>true</c> if this instance is user authenticated; otherwise, <c>false</c>.</value>
        public bool IsUserAuthenticated { get; set; }

        /// <summary>
        /// Gets or sets the name of the user.
        /// </summary>
        /// <value>The name of the user.</value>
        public string UserName { get; set; }
    }
}


text:
/* jshint maxlen: 130 */

/**
 * Cordova intent pattern
 *
 * eg.:
 * "intentname://path?arguments"
 *
 * @type {RegExp}
 */
intentPattern = /([a-zA-Z0-9]+):(?:\/\/)?([a-zA-Z0-9\/]+)?(?:\?(?:data:ejson;(base64),)?(.*))?/;

/**
 * Browser intent pattern
 *
 * eg.:
 * "http://foo.com/intentname://path?arguments"
 *
 * @type {RegExp}
 */
browserIntentPattern = /(?:.*):\/\/(?:[a-zA-Z0-9:\.])+\/((?:[a-zA-Z0-9]+):(?:\/\/)?(?:.*))/;

/**
 * Url pattern
 *
 * eg.:
 * "http://foo.com/path?arguments"
 *
 * @type {RegExp}
 */
urlPattern =  /^(https?):\/\/?[\da-z\.-]+\.[a-z\.]{2,6}(.*)\/?$/;

/**
 * Converts an object into a querystring
 * @param  {Object} obj) Source
 * @return {String}      Query string
 */
objectToQueryString = (obj) => _.map(obj, (val, key) => `${key}=${val}`).join('&');

/**
 * Converts object into an EJSON base64 string
 * @param  {Object} obj Source
 * @return {String}     EJSON bae64 string
 */
objectToBase64 = (obj) => 'data:ejson;base64,' + btoa(EJSON.stringify(obj));

/**
 * Converts EJSON base64 string into object
 * @param  {String} str String to parse
 * @return {Object}     Parsed object
 */
objectFromBase64 = (str) => EJSON.parse(atob(str.replace(/^data:ejson;base64,/, '')));

/**
 * Check if object as nested objects
 * @param  {Object} obj) Source
 * @return {Boolean}     true=nested objects, false=flat object
 */
isNested = (obj) => _.some(obj, (val) => _.isObject(val));

/**
 * Creates the appropiate querystring depending on the data type
 * if its a nested object it will be a base64 version if it's a
 * "flat" object it will convert 1:1 with a querystring
 * @param  {String|Object} data Source
 * @return {String}        Formatted data
 */
createQueryString = (data='') => {
  if (data !== ''+data) {
    data = (isNested(data)) ? objectToBase64(data) : objectToQueryString(data);
  }

  return encodeURI(data);
};

/**
 * Parse a query string into a key/value object
 * @param  {String} queryString String to parse
 * @return {Object}             Key/value object
 */
parseQueryString = function(queryString) {
  return _.object(_.map(queryString
            .split('&'), function(val) {
              return _.map(val.split('='), (val) => decodeURIComponent(val));
          }));
};

var eventState = new EventState();

/**
 * The DeepLink class
 * @param {String} name Url scheme
 * @param {Object} options Options
 * @param {String} options.appId The app id
 * @param {String} options.url Browser url for browser intents eg. "http://foo.com/"
 * @param {String} options.fallbackUrl Fallback url in case intent fails
 */
DeepLink = class DeepLink {
  constructor(name, { appId, fallbackUrl, url } = {}) {
    this.name = name;
    this.appId = appId;
    this.url = (url) ? url.replace(/\/$/,'') + '/' : ''; // Add traling slash
    this.fallbackUrl = (fallbackUrl) ? encodeURI(fallbackUrl):'';
    // Helpers
    if (Meteor.isClient) {
      this.isIOS = /iPhone|iPod|iPad/i.test(navigator.userAgent);
      this.isAndroid = !this.isIOS && /android/i.test(navigator.userAgent);
    }
  }

  createLink(path='', data='') {
    data = createQueryString(data);
    return (data === '')? path: `${path}?${data}`;
  }

  intentLink() {
    var uri = this.createLink(...arguments);
    return `${this.name}://${uri}`;
  }

  /**
   * Create browser link for a browser intent
   * @param  {String} path Path
   * @param  {Object} data Data
   * @return {String}      Link
   */
  browserLink(path='', data='') {
    return this.url + this.intentLink(path, data);
  }

  androidLink(path='', data='') {
    var uri = this.createLink(path, data);
    if (this.appId) {
      if (this.fallbackUrl) {
        return `intent://${uri}#Intent;scheme=${this.name};package=${this.appId};S.browser_fallback_url=${this.fallbackUrl};end`;
      } else {
        return `intent://${uri}#Intent;scheme=${this.name};package=${this.appId};end`;
      }
    }
    return this.intentLink(...arguments);
  }

  iosLink() {
    return this.intentLink(...arguments);
  }

  /**
   * Create a link depending on settings and OS
   * @param  {String} path   Optional path
   * @param  {String|Object} data Optional data
   * @return {String}        Link to app
   */
  link(path='', data='') {
    if (this.isIOS) {
      return this.iosLink(path, data);
    } else if (this.isAndroid) {
      return this.androidLink(path, data);
    }
    return this.intentLink(...arguments);
  }

  /**
   * Set the ios banner in the header
   * This is the meta tag that ios supports, this helper
   * makes it easier to pass on data.
   * (It will create the meta tag if not found)
   *
   * @param  {String} path Optional path
   * @param  {String} data Optional data
   *
   * @where  client
   */
  iosBanner(path='', data='') {
    if (this.appId && Meteor.isClient) {

      var link = this.intentLink(path, data);
      var content = `app-id=${this.appId}, app-argument=${link}`;

      var el = $('meta[name=apple-itunes-app]')[0];

      if (el) {
        el.setAttribute('content', content);
      } else {
        $('head').append(`<meta name="apple-itunes-app" content="${content}"/>`);
      }

    }

  }

  /**
   * Open the app
   * @param  {String} path  Optional path
   * @param  {String} data  Optional data
   * @param  {String} where Optional destination (_system)
   *
   * @where  client
   */
  open(path='', data='', where='_system') {
    if (Meteor.isClient) {
      window.open(this.link(path, data), where);
    } else {
      throw new Error('DeepLink.open is not implemented on the server');
    }
  }

  static emit() { return eventState.emit(...arguments); }
  static emitState() { return eventState.emitState(...arguments); }
  static on() { return eventState.on(...arguments); }
  static once() { return eventState.once(...arguments); }
  static off() { return eventState.off(...arguments); }
};


text:
| Problem Statement  |        Solution        |
|:-------------------|:----------------------:|
| [Lonely Integer][] | [lonely_integer.cpp][] |
| [Maximizing XOR][] | [maximizing_xor.cpp][] |
| [Flipping bits][]  | [flipping_bits.cpp][]  |

[Lonely Integer]: https://www.hackerrank.com/challenges/lonely-integer
[Maximizing XOR]: https://www.hackerrank.com/challenges/utopian-tree
[Flipping bits]:  https://www.hackerrank.com/challenges/flipping-bits

[lonely_integer.cpp]: lonely_integer.cpp
[maximizing_xor.cpp]: maximizing_xor.cpp
[flipping_bits.cpp]:  flipping_bits.cpp


text:
package org.apache.maven.model;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

/**
 * Tests {@code Repository}.
 *
 * @author Benjamin Bentmann
 */
public class RepositoryTest {

    @Test
    public void testHashCodeNullSafe() {
        new Repository().hashCode();
    }

    @Test
    public void testEqualsNullSafe() {
        assertFalse(new Repository().equals(null));

        new Repository().equals(new Repository());
    }

    @Test
    public void testEqualsIdentity() {
        Repository thing = new Repository();
        assertTrue(thing.equals(thing));
    }

    @Test
    public void testToStringNullSafe() {
        assertNotNull(new Repository().toString());
    }
}


text:
from cirque.capabilities.basecapability import BaseCapability
from cirque.connectivity.threadsimpipe import ThreadSimPipe
from cirque.common.cirquelog import CirqueLog

class ThreadCapability(BaseCapability):

  def __init__(self,
               node_id,
               petition_id,
               daemons=['wpantund', 'otbr-agent'],
               rcp=False):
    self.thread_endpoint = ThreadSimPipe(node_id, petition_id, rcp)
    self.thread_endpoint.open()
    self.logger = CirqueLog.get_cirque_logger(self.__class__.__name__)
    self.daemons = daemons
    for daemon in daemons:
      if daemon not in {'wpantund', 'otbr-agent'}:
        self.logger.warning(
            'using unkown thread daemon mode: {}'.format(daemon))

  @property
  def name(self):
    return 'Thread'

  def get_docker_run_args(self, dockernode):
    return {
        'devices': [
            '{}:/dev/ttyUSB0'.format(self.thread_endpoint.pipe_path_for_user)
        ],
        'volumes': [
            '{}:/dev/ttyUSB0'.format(self.thread_endpoint.pipe_path_for_user)
        ],
        'sysctls': {
            'net.ipv6.conf.all.disable_ipv6': 0,
            'net.ipv4.conf.all.forwarding': 1,
            'net.ipv6.conf.all.forwarding': 1,
        },
        'privileged': True,
        'tty': True,
    }

  def disable_capability(self, docker_node):
    for daemon in self.daemons:
      docker_node.container.exec_run('killall {}'.format(daemon))
    self.thread_endpoint.close()
    self.thread_endpoint = None


text:
using UnityEditor;
using UnityEditorInternal;
using BowieCode;

[CustomEditor( typeof( ReorderableListExample ) )]
public class ReorderableListExampleEditor : Editor {

	private ReorderableList list;

	private void OnEnable () {
		list = ReorderableListUtil.Create( serializedObject, "My List", "dataList", new string[] { "name", "toggle" } );
	}

	public override void OnInspectorGUI () {
		ReorderableListExample reorderableListExample = (ReorderableListExample)target;

		serializedObject.Update();

		DrawDefaultInspector();

		if ( reorderableListExample.showList ) {
			ReorderableListUtil.Draw( list );
		}

		serializedObject.ApplyModifiedProperties();
	}
}


text:
@protocol WMFAnalyticsContextProviding;
@protocol WMFAnalyticsContentTypeProviding;
@protocol WMFAnalyticsViewNameProviding;
@protocol WMFAnalyticsValueProviding;

NS_ASSUME_NONNULL_BEGIN

@interface PiwikTracker (WMFExtensions)

+ (void)wmf_start;

- (void)wmf_logView:(id<WMFAnalyticsViewNameProviding>)view;

- (void)wmf_logAction:(NSString *)action inContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionImpressionInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionPreviewInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;
- (void)wmf_logActionPreviewInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType date:(nullable NSDate *)date;

- (void)wmf_logActionTapThroughInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;
- (void)wmf_logActionTapThroughInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType value:(nullable)value;
- (void)wmf_logActionTapThroughMoreInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;
- (void)wmf_logActionTapThroughMoreInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType value:(nullable)value;

- (void)wmf_logActionDismissInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType value:(nullable)value;

- (void)wmf_logActionShareInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionSaveInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;
- (void)wmf_logActionUnsaveInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionImpressionInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType value:(nullable)value;

- (void)wmf_logActionSwitchLanguageInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionEnableInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;
- (void)wmf_logActionDisableInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionPushInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType date:(nullable NSDate *)date;

- (void)wmf_logActionSwitchThemeInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionEnableImageDimmingInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionDisableImageDimmingInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

- (void)wmf_logActionAdjustBrightnessInContext:(id<WMFAnalyticsContextProviding>)context contentType:(id<WMFAnalyticsContentTypeProviding>)contentType;

@end

NS_ASSUME_NONNULL_END


text:
package com.hackfmi.thejack.hackatron;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import android.app.Activity;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.GamesActivityResultCodes;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.games.multiplayer.Participant;
import com.google.android.gms.games.multiplayer.realtime.Room;
import com.google.example.games.basegameutils.BaseGameUtils;
import com.hackfmi.thejack.hackatron.Game.BodyPart;

public class AndroidLauncher extends Activity implements View.OnClickListener,
    ConnectionHandler.ChangeListener {
  final static String TAG = "ButtonClicker2000";

  // Request codes for the UIs that we show with startActivityForResult:
  final static int RC_SELECT_PLAYERS = 10000;
  final static int RC_INVITATION_INBOX = 10001;
  final static int RC_WAITING_ROOM = 10002;

  // Request code used to invoke sign in user interactions.
  private static final int RC_SIGN_IN = 9001;

  // Are we playing in multiplayer mode?
  boolean mMultiplayer = false;

  // The participants in the currently active game
  ArrayList<Participant> mParticipants = null;

  // My participant ID in the currently active game
  String mMyId = null;

  // If non-null, this is the id of the invitation we received via the
  // invitation listener
  String mIncomingInvitationId = null;

  // Game
  private Game currentGame;

  // Connection
  private ConnectionHandler connectionHandler;

  // Sensors
  private SensorManager mSensorManager;
  private Sensor mSensor;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.android_launcher);

    connectionHandler = ConnectionHandler.registerContext(this);
    connectionHandler.registerListener(this);
    // set up a click listener for everything we care about
    for (int id : CLICKABLES) {
      findViewById(id).setOnClickListener(this);
    }

    mParticipants = new ArrayList<Participant>();
  }

  private void useBodyPart(BodyPart bodyPart) {
    currentGame.use(bodyPart);
  }

  @Override
  public void onClick(View v) {
    Intent intent;

    switch (v.getId()) {
    case R.id.button_single_player:
    case R.id.button_single_player_2:
      // play a single-player game
      Intent i = new Intent(this, VoltronActivity.class);
      startActivity(i);
      resetGameVars();
      startGame(false);

      break;
    case R.id.button_sign_in:
      // start the sign-in flow
      if (!BaseGameUtils.verifySampleSetup(this, R.string.app_id)) {
        Log.w(TAG, "*** Warning: setup problems detected. Sign in may not work!");
      }
      Log.d(TAG, "Sign-in button clicked");
      connectionHandler.mSignInClicked = true;
      connectionHandler.connect();
      break;
    case R.id.button_sign_out:
      // user wants to sign out
      // sign out.
      Log.d(TAG, "Sign-out button clicked");
      connectionHandler.mSignInClicked = false;
      connectionHandler.disconnect();
      switchToScreen(R.id.screen_sign_in);
      break;
    case R.id.button_invite_players:
      // show list of invitable players
      intent = connectionHandler.getSelectOpponentsIntent();
      switchToScreen(R.id.screen_wait);
      startActivityForResult(intent, RC_SELECT_PLAYERS);
      break;
    case R.id.button_see_invitations:
      // show list of pending invitations
      intent = connectionHandler.getInvitationInboxIntent();
      switchToScreen(R.id.screen_wait);
      startActivityForResult(intent, RC_INVITATION_INBOX);
      break;
    case R.id.button_accept_popup_invitation:
      // user wants to accept the invitation shown on the invitation popup
      // (the one we got through the OnInvitationReceivedListener).
      acceptInviteToRoom(mIncomingInvitationId);
      mIncomingInvitationId = null;
      break;
    case R.id.button_quick_game:
      // user wants to play against a random opponent right now
      switchToScreen(R.id.screen_wait);
      keepScreenOn();
      resetGameVars();
      connectionHandler.startQuickGame();
      break;
    case R.id.button_head:
      useBodyPart(Game.BodyPart.HEAD);
      break;
    case R.id.button_left_hand:
      useBodyPart(Game.BodyPart.LEFT_HAND);
      break;
    case R.id.button_right_hand:
      useBodyPart(Game.BodyPart.RIGHT_HAND);
      break;
    case R.id.button_left_foot:
      useBodyPart(Game.BodyPart.LEFT_FOOT);
      break;
    case R.id.button_right_foot:
      useBodyPart(Game.BodyPart.RIGHT_FOOT);
      break;
    }
  }

  @Override
  public void onActivityResult(int requestCode, int responseCode, Intent intent) {
    super.onActivityResult(requestCode, responseCode, intent);

    switch (requestCode) {
    case RC_SELECT_PLAYERS:
      // we got the result from the "select players" UI -- ready to create
      // the room
      handleSelectPlayersResult(responseCode, intent);
      break;
    case RC_INVITATION_INBOX:
      // we got the result from the "select invitation" UI (invitation
      // inbox). We're
      // ready to accept the selected invitation:
      handleInvitationInboxResult(responseCode, intent);
      break;
    case RC_WAITING_ROOM:
      // we got the result from the "waiting room" UI.
      if (responseCode == Activity.RESULT_OK) {
        // ready to start playing
        Log.d(TAG, "Starting game (waiting room returned OK).");
        startGame(true);
      } else if (responseCode == GamesActivityResultCodes.RESULT_LEFT_ROOM) {
        // player indicated that they want to leave the room
        leaveRoom();
      } else if (responseCode == Activity.RESULT_CANCELED) {
        // Dialog was cancelled (user pressed back key, for instance).
        // In our game,
        // this means leaving the room too. In more elaborate games,
        // this could mean
        // something else (like minimizing the waiting room UI).
        leaveRoom();
      }
      break;
    case RC_SIGN_IN:
      Log.d(TAG, "onActivityResult with requestCode == RC_SIGN_IN, responseCode=" + responseCode
          + ", intent=" + intent);
      connectionHandler.mSignInClicked = false;
      connectionHandler.mResolvingConnectionFailure = false;
      if (responseCode == RESULT_OK) {
        connectionHandler.connect();
      } else {
        BaseGameUtils.showActivityResultError(this, requestCode, responseCode,
            R.string.signin_failure, R.string.signin_other_error);
      }
      break;
    }
    super.onActivityResult(requestCode, responseCode, intent);
  }

  // Handle the result of the "Select players UI" we launched when the user
  // clicked the
  // "Invite friends" button. We react by creating a room with those players.
  private void handleSelectPlayersResult(int response, Intent data) {
    if (response != Activity.RESULT_OK) {
      Log.w(TAG, "*** select players UI cancelled, " + response);
      switchToMainScreen();
      return;
    }

    Log.d(TAG, "Select players UI succeeded.");

    // get the invitee list
    final ArrayList<String> invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS);
    Log.d(TAG, "Invitee count: " + invitees.size());

    // get the automatch criteria
    int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0);
    int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0);

    // create the room
    Log.d(TAG, "Creating room...");
    connectionHandler.createRoom(invitees, minAutoMatchPlayers, maxAutoMatchPlayers);
    switchToScreen(R.id.screen_wait);
    keepScreenOn();
    resetGameVars();

    Log.d(TAG, "Room created, waiting for it to be ready...");
  }

  // Handle the result of the invitation inbox UI, where the player can pick
  // an invitation
  // to accept. We react by accepting the selected invitation, if any.
  private void handleInvitationInboxResult(int response, Intent data) {
    if (response != Activity.RESULT_OK) {
      Log.w(TAG, "*** invitation inbox UI cancelled, " + response);
      switchToMainScreen();
      return;
    }

    Log.d(TAG, "Invitation inbox UI succeeded.");
    Invitation inv = data.getExtras().getParcelable(Multiplayer.EXTRA_INVITATION);

    // accept invitation
    acceptInviteToRoom(inv.getInvitationId());
  }

  // Accept the given invitation.
  void acceptInviteToRoom(String invId) {
    // accept the invitation
    keepScreenOn();
    resetGameVars();
    connectionHandler.acceptInviteToRoom(invId);
  }

  // Activity is going to the background. We have to leave the current room.
  @Override
  public void onStop() {
    Log.d(TAG, "**** got onStop");

    // if we're in a room, leave it.
    leaveRoom();

    // stop trying to keep the screen on
    stopKeepingScreenOn();

    if (connectionHandler.isConnected()) {
      switchToScreen(R.id.screen_sign_in);
    } else {
      switchToScreen(R.id.screen_wait);
    }
    super.onStop();
  }

  // Activity just got to the foreground. We switch to the wait screen because
  // we will now
  // go through the sign-in flow (remember that, yes, every time the Activity
  // comes back to the
  // foreground we go through the sign-in flow -- but if the user is already
  // authenticated,
  // this flow simply succeeds and is imperceptible).
  @Override
  public void onStart() {
    switchToScreen(R.id.screen_wait);
    if (connectionHandler.isConnected()) {
      Log.w(TAG, "GameHelper: client was already connected on onStart()");
    } else {
      Log.d(TAG, "Connecting client.");
      connectionHandler.connect();
    }
    super.onStart();
  }

  // Handle back key to make sure we cleanly leave a game if we are in the
  // middle of one
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent e) {
    if (keyCode == KeyEvent.KEYCODE_BACK && mCurScreen == R.id.screen_game) {
      leaveRoom();
      return true;
    }
    return super.onKeyDown(keyCode, e);
  }

  // Leave the room.
  void leaveRoom() {
    Log.d(TAG, "Leaving room.");
    mSecondsLeft = 0;
    stopKeepingScreenOn();
    if (connectionHandler.leaveRoom()) {
      switchToScreen(R.id.screen_wait);
    } else {
      switchToMainScreen();
    }
  }

  // Show the waiting room UI to track the progress of other players as they
  // enter the room and get connected.
  void showWaitingRoom(Room room) {
    // show waiting room UI
    startActivityForResult(connectionHandler.getWaitingRoomIntent(room), RC_WAITING_ROOM);
  }

  @Override
  public void onInvitationRemoved(String invitationId) {
    switchToScreen(mCurScreen); // This will hide the invitation popup
  }

  /*
   * CALLBACKS SECTION. This section shows how we implement the several games
   * API callbacks.
   */

  // Show error message about game being cancelled and return to main screen.
  @Override
  public void showGameError() {
    BaseGameUtils.makeSimpleDialog(this, getString(R.string.game_problem));
    switchToMainScreen();
  }

  @Override
  public void updateRoom(Room room) {
    if (room != null) {
      mParticipants = room.getParticipants();
    }
    if (mParticipants != null) {
      updatePeerScoresDisplay();
    }
  }

  /*
   * GAME LOGIC SECTION. Methods that implement the game's rules.
   */

  // Current state of the game:
  int mSecondsLeft = -1; // how long until the game ends (seconds)
  final static int GAME_DURATION = 20; // game duration, seconds.
  int mScore = 0; // user's current score

  private float currentX;

  private float currentY;

  private float currentZ;

  // Reset game variables in preparation for a new game.
  void resetGameVars() {
    mSecondsLeft = GAME_DURATION;
    mScore = 0;
    mParticipantScore.clear();
    mFinishedParticipants.clear();
    currentGame = new Game(participantsToIds(mParticipants), mMyId);
  }

  private List<String> participantsToIds(List<Participant> participants) {
    List<String> result = new ArrayList<String>();
    for (Participant participant : mParticipants) {
      result.add(participant.getParticipantId());
    }
    return result;
  }

  // Start the gameplay phase of the game.
  void startGame(boolean multiplayer) {
    mMultiplayer = multiplayer;
    updateScoreDisplay();
    connectionHandler.broadcastScore(false);
    // switchToScreen(R.id.screen_game);
    connectionHandler.inGame = true;
    Intent i = new Intent(this, VoltronActivity.class);
    startActivity(i);
    findViewById(R.id.button_head).setVisibility(View.VISIBLE);
    findViewById(R.id.button_left_hand).setVisibility(View.VISIBLE);
    findViewById(R.id.button_right_hand).setVisibility(View.VISIBLE);
    findViewById(R.id.button_left_foot).setVisibility(View.VISIBLE);
    findViewById(R.id.button_right_foot).setVisibility(View.VISIBLE);

    // run the gameTick() method every second to update the game.
    final Handler h = new Handler();
    h.postDelayed(new Runnable() {
      @Override
      public void run() {
        if (mSecondsLeft <= 0) {
          return;
        }
        gameTick();
        h.postDelayed(this, 1000);
      }
    }, 1000);
  }

  // Game tick -- update countdown, check if game ended.
  void gameTick() {
    if (mSecondsLeft > 0) {
      --mSecondsLeft;
    }

    // update countdown
    ((TextView) findViewById(R.id.countdown)).setText("0:" + (mSecondsLeft < 10 ? "0" : "")
        + String.valueOf(mSecondsLeft));

    if (mSecondsLeft <= 0) {
      // finish game
      findViewById(R.id.button_head).setEnabled(false);
      findViewById(R.id.button_left_hand).setEnabled(false);
      findViewById(R.id.button_right_hand).setEnabled(false);
      findViewById(R.id.button_left_foot).setEnabled(false);
      findViewById(R.id.button_right_foot).setEnabled(false);

      connectionHandler.broadcastScore(true);
    }
  }

  // indicates the player scored one point
  void scoreOnePoint() {
    if (mSecondsLeft <= 0) {
      return; // too late!
    }
    ++mScore;
    updateScoreDisplay();
    updatePeerScoresDisplay();

    // broadcast our new score to our peers
    connectionHandler.broadcastScore(false);
  }

  void moveInDirection(float x, float y, float z) {
    if (mSecondsLeft <= 0) {
      return; // too late!
    }
    currentX = x;
    currentY = y;
    currentZ = z;
    updateScoreDisplay();
    updatePeerScoresDisplay();

    // broadcast our new score to our peers
    connectionHandler.broadcastScore(false);
  }

  /*
   * COMMUNICATIONS SECTION. Methods that implement the game's network protocol.
   */

  // Score of other participants. We update this as we receive their scores
  // from the network.
  Map<String, Integer> mParticipantScore = new HashMap<String, Integer>();

  // Participants who sent us their final score.
  Set<String> mFinishedParticipants = new HashSet<String>();

  // Called when we receive a real-time message from the network.
  // Messages in our game are made up of 2 bytes: the first one is 'F' or 'U'
  // indicating
  // whether it's a final or interim score. The second byte is the score.
  // There is also the
  // 'S' message, which indicates that the game should start.
  /*
   * UI SECTION. Methods that implement the game's UI.
   */

  // This array lists everything that's clickable, so we can install click
  // event handlers.
  final static int[] CLICKABLES = { R.id.button_accept_popup_invitation,
      R.id.button_invite_players, R.id.button_quick_game, R.id.button_see_invitations,
      R.id.button_sign_in, R.id.button_sign_out, R.id.button_head, R.id.button_left_hand,
      R.id.button_right_hand, R.id.button_left_foot, R.id.button_right_foot,
      R.id.button_single_player, R.id.button_single_player_2 };

  // This array lists all the individual screens our game has.
  final static int[] SCREENS = { R.id.screen_game, R.id.screen_main, R.id.screen_sign_in,
      R.id.screen_wait };
  int mCurScreen = -1;

  void switchToScreen(int screenId) {
    // make the requested screen visible; hide all others.
    for (int id : SCREENS) {
      findViewById(id).setVisibility(screenId == id ? View.VISIBLE : View.GONE);
    }
    mCurScreen = screenId;

    // should we show the invitation popup?
    boolean showInvPopup;
    if (mIncomingInvitationId == null) {
      // no invitation, so no popup
      showInvPopup = false;
    } else if (mMultiplayer) {
      // if in multiplayer, only show invitation on main screen
      showInvPopup = (mCurScreen == R.id.screen_main);
    } else {
      // single-player: show on main screen and gameplay screen
      showInvPopup = (mCurScreen == R.id.screen_main || mCurScreen == R.id.screen_game);
    }
    findViewById(R.id.invitation_popup).setVisibility(showInvPopup ? View.VISIBLE : View.GONE);
  }

  @Override
  public void switchToMainScreen() {
    if (connectionHandler.isConnected()) {
      switchToScreen(R.id.screen_main);
    } else {
      switchToScreen(R.id.screen_sign_in);
    }
  }

  // updates the label that shows my score
  void updateScoreDisplay() {
    ((TextView) findViewById(R.id.my_score)).setText(formatScore(currentX, currentY, currentZ));
  }

  // formats a score as a three-digit number
  String formatScore(float x, float y, float z) {
    return String.format("X:%f Y:%f Z:%f", x * 180 / Math.PI, y * 180 / Math.PI, z * 180 / Math.PI);
  }

  // formats a score as a three-digit number
  String formatScore(int i) {
    if (i < 0) {
      i = 0;
    }
    String s = String.valueOf(i);
    return s.length() == 1 ? "00" + s : s.length() == 2 ? "0" + s : s;
  }

  // updates the screen with the scores from our peers
  void updatePeerScoresDisplay() {
    ((TextView) findViewById(R.id.score0)).setText(formatScore(mScore) + " - Me");
    int[] arr = { R.id.score1, R.id.score2, R.id.score3 };
    int i = 0;

    if (connectionHandler.getRoomId() != null) {
      for (Participant p : mParticipants) {
        String pid = p.getParticipantId();
        if (pid.equals(mMyId)) {
          continue;
        }
        if (p.getStatus() != Participant.STATUS_JOINED) {
          continue;
        }
        int score = mParticipantScore.containsKey(pid) ? mParticipantScore.get(pid) : 0;
        ((TextView) findViewById(arr[i])).setText(formatScore(score) + " - " + p.getDisplayName());
        ++i;
      }
    }

    for (; i < arr.length; ++i) {
      ((TextView) findViewById(arr[i])).setText("");
    }
  }

  /*
   * MISC SECTION. Miscellaneous methods.
   */

  // Sets the flag to keep this screen on. It's recommended to do that during
  // the
  // handshake when setting up a game, because if the screen turns off, the
  // game will be
  // cancelled.
  void keepScreenOn() {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }

  // Clears the flag that keeps the screen on.
  void stopKeepingScreenOn() {
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }

  @Override
  public void onInvitation(Invitation invitation) {
    ((TextView) findViewById(R.id.incoming_invitation_text)).setText(invitation.getInviter()
        .getDisplayName() + " " + getString(R.string.is_inviting_you));

    switchToScreen(mCurScreen); // This will show the invitation popup
  }

  @Override
  public void onInvitationRemoved() {
    switchToScreen(mCurScreen);
  }

  @Override
  public boolean onConnectionFailed(GoogleApiClient googleApiClient,
      ConnectionResult connectionResult) {
    return BaseGameUtils.resolveConnectionFailure(this, googleApiClient, connectionResult,
        RC_SIGN_IN, getString(R.string.signin_other_error));
  }

  @Override
  public void onSwitchToWaitScreen() {
    // TODO Auto-generated method stub
  }

  @Override
  public void onShowWaitingRoom(Room room) {
    Intent i = connectionHandler.getWaitingRoomIntent(room);
    // show waiting room UI
    startActivityForResult(i, RC_WAITING_ROOM);
  }

  @Override
  public void onPeerScoresDislay() {
    // TODO Auto-generated method stub

  }

  @Override
  public void switchToSignInScreen() {
    switchToScreen(R.id.screen_sign_in);
  }

  @Override
  public void connected() {
    // TODO Auto-generated method stub

  }
}


text:
<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Welcome extends Controller_Template {

    public $template = 'index';

    public function action_index()
    {
      $this->template->message = 'Hello there world!!';
    }

} // End Welcome


text:
<?xml version="1.0" ?>
<enemy>
    <behaviour>
        <root x="110" y="40">
            <normal>
                <condition id="once">
                    <normal>
                        <action id="log">
                            <string id="text">Movement Toolkit loaded!</string>
                            <string id="counter"></string>
                            <string id="bool"></string>
                        </action>
                    </normal>
                </condition>
                <action id="executeBehaviourTree">
                    <string id="fileName">Mod_AwesomeAIMain_Toolkit_Movement_Event</string>
                    <string id="Comment">Events</string>
                    <string id="Minimized">yes</string>
                </action>
                <action id="executeBehaviourTree">
                    <string id="fileName">Mod_AwesomeAIMain_Toolkit_Movement_Trigger</string>
                    <string id="Comment">Triggers</string>
                    <string id="Minimized">yes</string>
                </action>
            </normal>
        </root>
    </behaviour>
</enemy>


text:
layout: post
title:  "HOW A BOOK WRITTEN IN THE SUMMER OF 45 BC SAVED DESIGNERS TIME"
date:   2015-04-30
categories: Welcome
tags: featured
image: /assets/article_images/2014-11-30-mediator_features/night-track.JPG
---

What is lorem ipsum?

It's nothing but random,jumbled,unpronounceable words arranged in paragraphs to fake an actual article.The main purpose of
using lorem ipsum is to focus more on the graphic element rather than the text. It also saves a lot of time for designers
as they need not write up text for their designs and can easily generate lorem ipsum from various generators available online.

But how do computers generate these words?

Well there are various easy methods for a programmer to create an algorithm that can generate random words, but
they didnt look natural enough for the eye to look like an article. The Solution was easy, take an article from a book,
jumble them and there you go, you get natural looking senseless paragraph that can be used and yes! thats what they did.
The book they used was written in 45BC by a roman philosopher named Marcus Tullius Cicero. He wrote a book called
De finibus bonorum et malorum ("On the ends of good and evil"). Lorem ipsum is derived from parts of his books discourse
on hedonism. But why specifically this book? Well,there is no answer to that, there had be some book from which words could
be taken and jumbled.So this one was it!


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

public static partial class Extensions
{
    /// <summary>
    /// Produces the set intersection of two sequences by using the specified key selector for the equality comparison.
    /// </summary>
    /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
    /// <typeparam name="TKey">The type of the key member of the input sequences.</typeparam>
    /// <param name="first">
    /// An <see cref="IEnumerable{T}"/> whose distinct elements that also appear in <paramref name="second"/> will be returned.
    /// </param>
    /// <param name="second">
    /// An <see cref="IEnumerable{T}"/> whose distinct elements that also appear in the first sequence will be returned.
    /// </param>
    /// <param name="selector">The key selector function to select the comparison key.</param>
    /// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns>
    /// <exception cref="ArgumentNullException">
    /// <paramref name="first"/>, <paramref name="second"/> or <paramref name="selector"/> is <see langword="null"/>.
    /// </exception>
    [DebuggerStepThrough]
    public static IEnumerable<TSource> Intersect<TSource, TKey>(this IEnumerable<TSource> first, IEnumerable<TSource> second, Func<TSource, TKey> selector)
    {
        if (first == null)
        {
            throw new ArgumentNullException(nameof(first));
        }
        if (second == null)
        {
            throw new ArgumentNullException(nameof(second));
        }
        if (selector == null)
        {
            throw new ArgumentNullException(nameof(selector));
        }
        return first.Intersect(second, new SelectorEqualityComparer<TSource, TKey>(selector));
    }

    /// <summary>
    /// Produces the set intersection of two sequences by using the specified equality predicate function.
    /// </summary>
    /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
    /// <param name="first">
    /// An <see cref="IEnumerable{T}"/> whose distinct elements that also appear in <paramref name="second"/> will be returned.
    /// </param>
    /// <param name="second">
    /// An <see cref="IEnumerable{T}"/> whose distinct elements that also appear in the first sequence will be returned.
    /// </param>
    /// <param name="predicate">The equality predicate function to compare values.</param>
    /// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns>
    /// <exception cref="ArgumentNullException">
    /// <paramref name="first"/>, <paramref name="second"/> or <paramref name="predicate"/> is <see langword="null"/>.
    /// </exception>
    [DebuggerStepThrough]
    public static IEnumerable<TSource> Intersect<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second, Func<TSource, TSource, bool> predicate)
    {
        if (first == null)
        {
            throw new ArgumentNullException(nameof(first));
        }
        if (second == null)
        {
            throw new ArgumentNullException(nameof(second));
        }
        if (predicate == null)
        {
            throw new ArgumentNullException(nameof(predicate));
        }
        return first.Intersect(second, new PredicateEqualityComparer<TSource>(predicate));
    }
}


text:
<?php

class Contact_Us extends CI_Controller {

    public function index() {
        $vars['title'] = 'Contact Us | Cyber Catcher';
        $vars['content_view'] = 'contact_us_view';

        $this->load->view('template', $vars);
    }
}


text:
<!DOCTYPE html>

        <title>Markt-o-Scout</title>
        <link rel="stylesheet" href="style/style.css">
        <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">

login, jij inloggen?


text:
function ddg_spice_google_plus (api_result) {
    "use strict";

    if(!api_result || !api_result.items || api_result.items.length === 0) {
        return Spice.failed("googleplus");
    }

    Spice.add({
        id: 'googleplus',
        name: 'Social',
        data: api_result.items,
        meta: {
            sourceName : 'Google+',
            sourceUrl : 'http://plus.google.com',
            itemType: "Google+ Profile" + (api_result.items.length > 1 ? 's' : '')
        },
        templates: {
            group: 'products_simple',
            item_detail: false,
            detail: false,
            options: {
                variant: 'narrow'
            }
        },
        normalize : function(item) {
            var image = item.image.url.replace(/sz=50$/, "sz=100");
            return {
                image : image.replace(/^https/, "http"),
                title: item.displayName
            };
        }
    });
};


text:
@interface MSDeleteResourceDelegate : NSObject <TTURLRequestDelegate> {
	TTViewController *_controller;
	NSString *_text;
}

- (id)initWithController:(TTViewController *)controller text:(NSString *)text;

@end


text:
<?php

namespace Ptf\App\Config;

class ViewSmartyTest extends \PHPUnit\Framework\TestCase
{
    public function testGetCompileDir()
    {
        $config = new ViewSmarty();

        $this->expectException('\\Ptf\\Core\\Exception\\Config');
        $this->expectExceptionMessage(
            'Ptf\App\Config\ViewSmarty::__get: Option "compile_dir" not configured');
        $config->getCompileDir();
    }

    public function testGetCacheDir()
    {
        $config = new ViewSmarty();

        $this->assertSame('', $config->getCacheDir());
    }

    public function testGetCaching()
    {
        $config = new ViewSmarty();

        $this->assertSame('0', $config->getCaching());
    }

    public function testGetCacheLifetime()
    {
        $config = new ViewSmarty();

        $this->assertSame('0', $config->getCacheLifetime());
    }

    public function testGetPluginsDir()
    {
        $config = new ViewSmarty();

        $this->assertSame('', $config->getPluginsDir());
    }

    public function testGetCompressHtml()
    {
        $config = new ViewSmarty();

        $this->assertSame('1', $config->getCompressHtml());
    }

    public function testGetCompileCheck()
    {
        $config = new ViewSmarty();

        $this->assertSame('0', $config->getCompileCheck());
    }

    public function testGetForceCompile()
    {
        $config = new ViewSmarty();

        $this->assertSame('0', $config->getForceCompile());
    }
}


text:
using namespace gpdxl;

XERCES_CPP_NAMESPACE_USE

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::CParseHandlerOptimizerConfig
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CParseHandlerOptimizerConfig::CParseHandlerOptimizerConfig(
	CMemoryPool *mp, CParseHandlerManager *parse_handler_mgr,
	CParseHandlerBase *parse_handler_root)
	: CParseHandlerBase(mp, parse_handler_mgr, parse_handler_root),
	  m_pbs(nullptr),
	  m_optimizer_config(nullptr)
{
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::~CParseHandlerOptimizerConfig
//
//	@doc:
//		Dtor
//
//---------------------------------------------------------------------------
CParseHandlerOptimizerConfig::~CParseHandlerOptimizerConfig()
{
	CRefCount::SafeRelease(m_pbs);
	CRefCount::SafeRelease(m_optimizer_config);
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerOptimizerConfig::StartElement(
	const XMLCh *const element_uri, const XMLCh *const element_local_name,
	const XMLCh *const element_qname, const Attributes &attrs)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenHint),
									  element_local_name))
	{
		// install a parse handler for the hint config
		CParseHandlerBase *pphHint = CParseHandlerFactory::GetParseHandler(
			m_mp, CDXLTokens::XmlstrToken(EdxltokenHint), m_parse_handler_mgr,
			this);
		m_parse_handler_mgr->ActivateParseHandler(pphHint);
		pphHint->startElement(element_uri, element_local_name, element_qname,
							  attrs);
		this->Append(pphHint);
		return;
	}
	else if (0 == XMLString::compareString(
					  CDXLTokens::XmlstrToken(EdxltokenCostModelConfig),
					  element_local_name))
	{
		// install a parse handler for the cost model config
		CParseHandlerBase *pphCostModel = CParseHandlerFactory::GetParseHandler(
			m_mp, CDXLTokens::XmlstrToken(EdxltokenCostModelConfig),
			m_parse_handler_mgr, this);
		m_parse_handler_mgr->ActivateParseHandler(pphCostModel);
		pphCostModel->startElement(element_uri, element_local_name,
								   element_qname, attrs);
		this->Append(pphCostModel);
		return;
	}
	else if (0 == XMLString::compareString(
					  CDXLTokens::XmlstrToken(EdxltokenTraceFlags),
					  element_local_name))
	{
		// install a parse handler for the trace flags
		CParseHandlerBase *pphTraceFlags =
			CParseHandlerFactory::GetParseHandler(
				m_mp, CDXLTokens::XmlstrToken(EdxltokenTraceFlags),
				m_parse_handler_mgr, this);
		m_parse_handler_mgr->ActivateParseHandler(pphTraceFlags);
		pphTraceFlags->startElement(element_uri, element_local_name,
									element_qname, attrs);
		this->Append(pphTraceFlags);
		return;
	}
	else if (0 != XMLString::compareString(
					  CDXLTokens::XmlstrToken(EdxltokenOptimizerConfig),
					  element_local_name))
	{
		CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(
			m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag,
				   str->GetBuffer());
	}

	CParseHandlerBase *pphWindowOids = CParseHandlerFactory::GetParseHandler(
		m_mp, CDXLTokens::XmlstrToken(EdxltokenWindowOids), m_parse_handler_mgr,
		this);
	m_parse_handler_mgr->ActivateParseHandler(pphWindowOids);

	// install a parse handler for the CTE configuration
	CParseHandlerBase *pphCTEConfig = CParseHandlerFactory::GetParseHandler(
		m_mp, CDXLTokens::XmlstrToken(EdxltokenCTEConfig), m_parse_handler_mgr,
		this);
	m_parse_handler_mgr->ActivateParseHandler(pphCTEConfig);

	// install a parse handler for the statistics configuration
	CParseHandlerBase *pphStatisticsConfig =
		CParseHandlerFactory::GetParseHandler(
			m_mp, CDXLTokens::XmlstrToken(EdxltokenStatisticsConfig),
			m_parse_handler_mgr, this);
	m_parse_handler_mgr->ActivateParseHandler(pphStatisticsConfig);

	// install a parse handler for the enumerator configuration
	CParseHandlerBase *pphEnumeratorConfig =
		CParseHandlerFactory::GetParseHandler(
			m_mp, CDXLTokens::XmlstrToken(EdxltokenEnumeratorConfig),
			m_parse_handler_mgr, this);
	m_parse_handler_mgr->ActivateParseHandler(pphEnumeratorConfig);

	// store parse handlers
	this->Append(pphEnumeratorConfig);
	this->Append(pphStatisticsConfig);
	this->Append(pphCTEConfig);
	this->Append(pphWindowOids);
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::EndElement
//
//	@doc:
//		Invoked by Xerces to process a closing tag
//
//---------------------------------------------------------------------------
void
CParseHandlerOptimizerConfig::EndElement(const XMLCh *const,  // element_uri,
										 const XMLCh *const element_local_name,
										 const XMLCh *const	 // element_qname
)
{
	if (0 != XMLString::compareString(
				 CDXLTokens::XmlstrToken(EdxltokenOptimizerConfig),
				 element_local_name))
	{
		CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(
			m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag,
				   str->GetBuffer());
	}

	GPOS_ASSERT(nullptr == m_optimizer_config);
	GPOS_ASSERT(7 >= this->Length());

	CParseHandlerEnumeratorConfig *pphEnumeratorConfig =
		dynamic_cast<CParseHandlerEnumeratorConfig *>((*this)[0]);
	CEnumeratorConfig *pec = pphEnumeratorConfig->GetEnumeratorCfg();
	pec->AddRef();

	CParseHandlerStatisticsConfig *pphStatisticsConfig =
		dynamic_cast<CParseHandlerStatisticsConfig *>((*this)[1]);
	CStatisticsConfig *stats_config = pphStatisticsConfig->GetStatsConf();
	stats_config->AddRef();

	CParseHandlerCTEConfig *pphCTEConfig =
		dynamic_cast<CParseHandlerCTEConfig *>((*this)[2]);
	CCTEConfig *pcteconfig = pphCTEConfig->GetCteConf();
	pcteconfig->AddRef();

	CParseHandlerWindowOids *pphDefoidsGPDB =
		dynamic_cast<CParseHandlerWindowOids *>((*this)[3]);
	CWindowOids *pwindowoidsGPDB = pphDefoidsGPDB->GetWindowOids();
	GPOS_ASSERT(nullptr != pwindowoidsGPDB);
	pwindowoidsGPDB->AddRef();

	ICostModel *pcm = nullptr;
	CHint *phint = nullptr;
	if (5 == this->Length())
	{
		// no cost model: use default one
		pcm = ICostModel::PcmDefault(m_mp);
		phint = CHint::PhintDefault(m_mp);
	}
	else
	{
		CParseHandlerCostModel *pphCostModelConfig =
			dynamic_cast<CParseHandlerCostModel *>((*this)[4]);
		pcm = pphCostModelConfig->GetCostModel();
		GPOS_ASSERT(nullptr != pcm);
		pcm->AddRef();

		if (6 == this->Length())
		{
			phint = CHint::PhintDefault(m_mp);
		}
		else
		{
			CParseHandlerHint *pphHint =
				dynamic_cast<CParseHandlerHint *>((*this)[5]);
			phint = pphHint->GetHint();
			GPOS_ASSERT(nullptr != phint);
			phint->AddRef();
		}
	}

	m_optimizer_config = GPOS_NEW(m_mp) COptimizerConfig(
		pec, stats_config, pcteconfig, pcm, phint, pwindowoidsGPDB);

	CParseHandlerTraceFlags *pphTraceFlags =
		dynamic_cast<CParseHandlerTraceFlags *>((*this)[this->Length() - 1]);
	pphTraceFlags->GetTraceFlagBitSet()->AddRef();
	m_pbs = pphTraceFlags->GetTraceFlagBitSet();

	// deactivate handler
	m_parse_handler_mgr->DeactivateHandler();
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::GetParseHandlerType
//
//	@doc:
//		Return the type of the parse handler.
//
//---------------------------------------------------------------------------
EDxlParseHandlerType
CParseHandlerOptimizerConfig::GetParseHandlerType() const
{
	return EdxlphOptConfig;
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::Pbs
//
//	@doc:
//		Returns the bitset for the trace flags
//
//---------------------------------------------------------------------------
CBitSet *
CParseHandlerOptimizerConfig::Pbs() const
{
	return m_pbs;
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::Poc
//
//	@doc:
//		Returns the optimizer config
//
//---------------------------------------------------------------------------
COptimizerConfig *
CParseHandlerOptimizerConfig::GetOptimizerConfig() const
{
	return m_optimizer_config;
}

// EOF


text:
DOT-file generator for Erlang supervision trees

## Basic Usage
**Note**: This example only works if you start erl with the sname or name flag at present (because net_sup is not started without it). This will be corrected in the future.
```erlang
Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.3  (abort with ^G)
(juno@diogenes)1> Graph = superdot:graph(kernel_sup).
{graph,kernel_sup,
       normal,
       [{graph,kernel_safe_sup,simple,[{node,"unknown"}]},
        {node,kernel_config},
        {graph,user,simple,[{node,{"unknown",2}}]},
        {graph,standard_error,simple,[{node,{"unknown",3}}]},
        {node,code_server},
        {node,file_server_2},
        {node,global_group},
        {graph,net_sup,normal,
               [{node,net_kernel},{node,auth},{node,erl_epmd}]},
        {node,inet_db},
        {node,global_name_server},
        {node,rex}]}
(juno@diogenes)2> String = superdot:to_dot(Graph).
<<"digraph kernel_sup{\nkernel_sup [shape=box,style=filled,fillcolor=\"#ffcccc\"];\nsubgrap"...>>
(juno@diogenes)3> file:write_file("/tmp/test.dot", String).
ok
```

My intent is to allow you to eventually write directly to an image file (or even a dot file for that matter).


text:
ALTER TABLE v5_0_ballot_measure_contests
 ADD COLUMN abbreviation TEXT,
 ADD COLUMN ballot_selection_ids TEXT,
 ADD COLUMN ballot_sub_title TEXT,
 ADD COLUMN ballot_title TEXT,
 ADD COLUMN electoral_district_id TEXT,
 ADD COLUMN electorate_specification TEXT,
 ADD COLUMN external_identifier_type TEXT,
 ADD COLUMN external_identifier_othertype TEXT,
 ADD COLUMN external_identifier_value TEXT,
 ADD COLUMN has_rotation TEXT,
 ADD COLUMN name TEXT,
 ADD COLUMN sequence_order TEXT,
 ADD COLUMN vote_variation TEXT,
 ADD COLUMN other_vote_variation TEXT;


text:
<?php

namespace Tale\Pug;

/**
 * Creates a new Tale Pug Renderer instance to render Pug files.
 *
 * Use the ->render() method on the resulting object to render
 * your jade files
 *
 * @param array|null    $options  the options to pass to the renderer
 * @param Compiler|null $compiler the compiler to use inside the renderer
 * @param Parser|null   $parser   the parser to use inside the compiler
 * @param Lexer|null    $lexer    the lexer to use inside the parser
 *
 * @return Renderer the newly created renderer
 */
function create_renderer(array $options = null, Compiler $compiler = null, Parser $parser = null, Lexer $lexer = null)
{

    return new Renderer($options, $compiler, $parser, $lexer);
}

/**
 * Renders a file through a renderer that is created on-the-fly.
 *
 * To specify a directory to render from, use the 'paths'-option
 * of the compiler like this:
 *
 * <code>
 *
 *      render('some-file', [<args>], [
 *          'paths' => [__DIR__.'/path/to/views']
 *      ]);
 *
 * @param string     $file    the relative file path to compile
 * @param array|null $args    the variables to pass to the template
 * @param array|null $options the options to pass to the renderer
 *
 * @return string the rendered markup
 */
function render($file, array $args = null, array $options = null)
{

    $renderer = create_renderer($options);

    return $renderer->render($file, $args);
}


text:
default[:chef][:server][:version] = "15.1.7"

# Set the default client version
default[:chef][:client][:version] = "18.0.169"


text:
package org.camunda.bpm.engine.test.bpmn.usertask;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.List;

import org.camunda.bpm.engine.identity.Group;
import org.camunda.bpm.engine.identity.User;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.task.Task;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.util.PluggableProcessEngineTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Joram Barrez
 */
public class TaskCandidateTest extends PluggableProcessEngineTest {

  private static final String MANAGEMENT = "management";

  private static final String KERMIT = "kermit";

  private static final String GONZO = "gonzo";

  @Before
  public void setUp() throws Exception {

    Group accountants = identityService.newGroup("accountancy");
    identityService.saveGroup(accountants);
    Group managers = identityService.newGroup(MANAGEMENT);
    identityService.saveGroup(managers);
    Group sales = identityService.newGroup("sales");
    identityService.saveGroup(sales);

    User kermit = identityService.newUser(KERMIT);
    identityService.saveUser(kermit);
    identityService.createMembership(KERMIT, "accountancy");

    User gonzo = identityService.newUser(GONZO);
    identityService.saveUser(gonzo);
    identityService.createMembership(GONZO, MANAGEMENT);
    identityService.createMembership(GONZO, "accountancy");
    identityService.createMembership(GONZO, "sales");
  }

  @After
  public void tearDown() throws Exception {
    identityService.deleteUser(KERMIT);
    identityService.deleteUser(GONZO);
    identityService.deleteGroup("sales");
    identityService.deleteGroup("accountancy");
    identityService.deleteGroup(MANAGEMENT);

  }

  @Deployment
  @Test
  public void testSingleCandidateGroup() {

    // Deploy and start process
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("singleCandidateGroup");

    // Task should not yet be assigned to kermit
    List<Task> tasks = taskService
      .createTaskQuery()
      .taskAssignee(KERMIT)
      .list();
    assertTrue(tasks.isEmpty());

    // The task should be visible in the candidate task list
    tasks = taskService.createTaskQuery().taskCandidateUser(KERMIT).list();
    assertEquals(1, tasks.size());
    Task task = tasks.get(0);
    assertEquals("Pay out expenses", task.getName());

    // The above query again, now between 'or' and 'endOr'
    tasks = taskService.createTaskQuery().or().taskCandidateUser(KERMIT).endOr().list();
    assertEquals(1, tasks.size());
    task = tasks.get(0);
    assertEquals("Pay out expenses", task.getName());

    // Claim the task
    taskService.claim(task.getId(), KERMIT);

    // The task must now be gone from the candidate task list
    tasks = taskService.createTaskQuery().taskCandidateUser(KERMIT).list();
    assertTrue(tasks.isEmpty());

    // The task will be visible on the personal task list
    tasks = taskService
      .createTaskQuery()
      .taskAssignee(KERMIT)
      .list();
    assertEquals(1, tasks.size());
    task = tasks.get(0);
    assertEquals("Pay out expenses", task.getName());

    // Completing the task ends the process
    taskService.complete(task.getId());

    testRule.assertProcessEnded(processInstance.getId());
  }

  @Deployment
  @Test
  public void testMultipleCandidateGroups() {

    // Deploy and start process
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("multipleCandidatesGroup");

    // Task should not yet be assigned to anyone
    List<Task> tasks = taskService
      .createTaskQuery()
      .taskAssignee(KERMIT)
      .list();

    assertTrue(tasks.isEmpty());
    tasks = taskService
      .createTaskQuery()
      .taskAssignee(GONZO)
      .list();

    assertTrue(tasks.isEmpty());

    // The task should be visible in the candidate task list of Gonzo and Kermit
    // and anyone in the management/accountancy group
    assertEquals(1, taskService.createTaskQuery().taskCandidateUser(KERMIT).list().size());
    assertEquals(1, taskService.createTaskQuery().taskCandidateUser(GONZO).list().size());
    assertEquals(1, taskService.createTaskQuery().taskCandidateGroup(MANAGEMENT).count());
    assertEquals(1, taskService.createTaskQuery().taskCandidateGroup("accountancy").count());
    assertEquals(0, taskService.createTaskQuery().taskCandidateGroup("sales").count());

    // Gonzo claims the task
    tasks = taskService.createTaskQuery().taskCandidateUser(GONZO).list();
    Task task = tasks.get(0);
    assertEquals("Approve expenses", task.getName());
    taskService.claim(task.getId(), GONZO);

    // The task must now be gone from the candidate task lists
    assertTrue(taskService.createTaskQuery().taskCandidateUser(KERMIT).list().isEmpty());
    assertTrue(taskService.createTaskQuery().taskCandidateUser(GONZO).list().isEmpty());
    assertEquals(0, taskService.createTaskQuery().taskCandidateGroup(MANAGEMENT).count());

    // The task will be visible on the personal task list of Gonzo
    assertEquals(1, taskService
      .createTaskQuery()
      .taskAssignee(GONZO)
      .count());

    // But not on the personal task list of (for example) Kermit
    assertEquals(0, taskService.createTaskQuery().taskAssignee(KERMIT).count());

    // Completing the task ends the process
    taskService.complete(task.getId());

    testRule.assertProcessEnded(processInstance.getId());
  }

  @Deployment
  @Test
  public void testMultipleCandidateUsers() {
    runtimeService.startProcessInstanceByKey("multipleCandidateUsersExample");

    assertEquals(1, taskService.createTaskQuery().taskCandidateUser(GONZO).list().size());
    assertEquals(1, taskService.createTaskQuery().taskCandidateUser(KERMIT).list().size());
  }

  @Deployment
  @Test
  public void testMixedCandidateUserAndGroup() {
    runtimeService.startProcessInstanceByKey("mixedCandidateUserAndGroupExample");

    assertEquals(1, taskService.createTaskQuery().taskCandidateUser(GONZO).list().size());
    assertEquals(1, taskService.createTaskQuery().taskCandidateUser(KERMIT).list().size());
  }

  @Deployment(resources = "org/camunda/bpm/engine/test/bpmn/usertask/groupTest.bpmn")
  @Test
  public void testInvolvedUserQuery() {

    // given
    identityService.createMembership(KERMIT, MANAGEMENT);

    runtimeService.startProcessInstanceByKey("Process_13pqtqg");

    // when
    List<Task> tasks = taskService.createTaskQuery()
        .taskInvolvedUser(KERMIT)
        .list();

    assertThat(tasks).hasSize(1);
  }

  @Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
  @Test
  public void testInvolvedUserQueryForAssignee() {

    // given
    runtimeService.startProcessInstanceByKey("oneTaskProcess");

    Task task = taskService.createTaskQuery().singleResult();
    taskService.setAssignee(task.getId(), KERMIT);

    // when
    List<Task> tasks = taskService.createTaskQuery()
        .taskInvolvedUser(KERMIT)
        .list();

    // then
    assertThat(tasks).hasSize(1);
  }

  @Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
  @Test
  public void testInvolvedUserQueryForOwner() {

    // given
    runtimeService.startProcessInstanceByKey("oneTaskProcess");

    Task task = taskService.createTaskQuery().singleResult();
    taskService.setOwner(task.getId(), KERMIT);

    // when
    List<Task> tasks = taskService.createTaskQuery()
        .taskInvolvedUser(KERMIT)
        .list();

    // then
    assertThat(tasks).hasSize(1);
  }

  @Deployment(resources = "org/camunda/bpm/engine/test/bpmn/usertask/groupTest.bpmn")
  @Test
  public void testInvolvedUserQueryOr() {

    // given
    identityService.createMembership(KERMIT, MANAGEMENT);

    runtimeService.startProcessInstanceByKey("Process_13pqtqg");

    // when
    List<Task> tasks = taskService.createTaskQuery()
        .or()
          .taskCandidateGroup(MANAGEMENT)
          .taskInvolvedUser(KERMIT)
        .endOr()
        .list();

    assertThat(tasks).hasSize(2);
  }
}


text:
<?php

require __DIR__.'/../autoload.php';
require __DIR__.'/WebTestCase.php';


text:
/**
 * Triggers callback on jquery selection set when scrolling into view
 * Author: msteitle@underarmour.com
 */

;(function($) {
    var callback_queue = [],
        element_queue = [],
        timeout_id,
        timeout_interval = 200,
        initialized = false,

        api = {
            init: function() {
                if (initialized) {
                    return;
                }

                $(window).on('DOMContentLoaded load resize scroll', function (event) {
                    window.clearTimeout(timeout_id);

                    timeout_id = window.setTimeout(function () {
                        $.each(callback_queue, function(i, callback) {
                            callback(event);
                        });
                    }, timeout_interval);
                });

                initialized = true;
            },

            isElementInViewport: function (el) {
                var rect = el.getBoundingClientRect();

                return (
                    rect.top >= 0 &&
                    rect.left >= 0 &&
                    rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
                    rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
                );
            },

            wrapCallback: function (el, fn) {
                return function (event) {
                    if (api.isElementInViewport(el)) {
                        fn(event);
                    }
                };
            },

            on: function (el, callback) {
                api.off(el);

                callback_queue.push(api.wrapCallback(el, callback));
                element_queue.push(el);
            },

            off: function (el) {
                var i = element_queue.indexOf(el);

                i > -1 && element_queue.splice(i, 1) && callback_queue.splice(i, 1);
            }
        },

        action_map = {
            'off': api.off,
            'on': api.on
        };

    $.fn.extend({
        /**
         * @param {String} action [OPTIONAL ]Action to execute other than 'on'. Valid actions: ['off']
         * @param {Function} callback Function to execute when item has scrolled into view
         */
        scrollIntoView: function (action, callback, options) {
            var el = this.get(0),
                args = Array.prototype.slice.call(arguments, typeof action === 'string' ? [1] : [0]);

            if (!el) {
                return;
            }

            // add plain DOM element
            args.unshift(this.get(0));

            action = typeof action === 'string' && action_map.hasOwnProperty(action) ? action : 'on';

            api.init();

            action_map[action].apply(this, args);

            return this;
        }
    });
}).call(this, jQuery);


text:
using System;

namespace SharpCompress.Crypto
{
    public class CryptoException
        : Exception
    {
        public CryptoException()
        {
        }

        public CryptoException(
            string message)
            : base(message)
        {
        }

        public CryptoException(
            string message,
            Exception exception)
            : base(message, exception)
        {
        }
    }
}