text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace Borodar.LD34
{
    public class Background : MonoBehaviour
    {
        public List<Color> Colors;
        private Image _background;

        //---------------------------------------------------------------------
        // Messages
        //---------------------------------------------------------------------

        public void Awake()
        {
            _background = GetComponent<Image>();
        }

        //---------------------------------------------------------------------
        // Public
        //---------------------------------------------------------------------

        public void CrossFadeColor()
        {
            Color color;
            do
            {
                color = GetRandomColor();
            } while (_background.color == color);

            StartCoroutine(CrossFadeColor(color, 1f));
        }

        //---------------------------------------------------------------------
        // Helpers
        //---------------------------------------------------------------------

        private Color GetRandomColor()
        {
            return Colors[Random.Range(0, Colors.Count)];
        }

        IEnumerator CrossFadeColor(Color endColor, float duration)
        {
            var startColor = _background.color;

            float elapsed = 0;
            var start = Time.time;

            while (elapsed < duration)
            {
                elapsed = Time.time - start;
                var normalisedTime = Mathf.Clamp(elapsed / duration, 0, 1);

                _background.color = Color.Lerp(startColor, endColor, normalisedTime);
                yield return null;
            }

            _background.color = endColor;
            yield return null;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.dangdang.ddframe.job.internal.util;

public final class BlockUtils {

    private BlockUtils() {
    }

    public static void waitingShortTime() {
        sleep(100L);
    }

    public static void sleep(final long millis) {
        try {
            Thread.sleep(millis);
        } catch (final InterruptedException ex) {
            Thread.currentThread().interrupt();
        }
    }
}


text:
package ru.job4j;

import org.junit.Test;

import java.util.Iterator;

/**
 * Created by Anton on 09.05.2017.
 */
public class UsualSetTest {
    /**
     * Test.
     */
    @Test
    public void whenThen() {
        UsualSet<Integer> usualSet = new UsualSet<>();
        usualSet.add(1);
        usualSet.add(2);
        usualSet.add(3);
        usualSet.add(4);
        usualSet.add(5);
        usualSet.add(6);
        usualSet.add(7);
        usualSet.add(8);
        usualSet.add(9);
        usualSet.add(10);
        usualSet.add(11);
        Iterator<Integer> iterator = usualSet.iterator();

        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}


text:
package org.ethereum.listener;

import org.ethereum.core.*;
import org.ethereum.net.eth.message.StatusMessage;
import org.ethereum.net.message.Message;
import org.ethereum.net.p2p.HelloMessage;
import org.ethereum.net.rlpx.Node;
import org.ethereum.net.server.Channel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @author Roman Mandeleil
 * @since 12.11.2014
 */
@Component(value = "EthereumListener")
public class CompositeEthereumListener implements EthereumListener {

    @Autowired
    EventDispatchThread eventDispatchThread = EventDispatchThread.getDefault();

    List<EthereumListener> listeners = new CopyOnWriteArrayList<>();

    public void addListener(EthereumListener listener) {
        listeners.add(listener);
    }
    public void removeListener(EthereumListener listener) {
        listeners.remove(listener);
    }

    @Override
    public void trace(final String output) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.trace(output);
                }
            });
        }
    }

    @Override
    public void onBlock(final BlockSummary blockSummary) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onBlock(blockSummary);
                }
            });
        }
    }

    @Override
    public void onRecvMessage(final Channel channel, final Message message) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onRecvMessage(channel, message);
                }
            });
        }
    }

    @Override
    public void onSendMessage(final Channel channel, final Message message) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onSendMessage(channel, message);
                }
            });
        }
    }

    @Override
    public void onPeerDisconnect(final String host, final long port) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onPeerDisconnect(host, port);
                }
            });
        }
    }

    @Override
    public void onPendingTransactionsReceived(final List<Transaction> transactions) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onPendingTransactionsReceived(transactions);
                }
            });
        }
    }

    @Override
    public void onPendingStateChanged(final PendingState pendingState) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onPendingStateChanged(pendingState);
                }
            });
        }
    }

    @Override
    public void onSyncDone() {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onSyncDone();
                }
            });
        }
    }

    @Override
    public void onNoConnections() {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onNoConnections();
                }
            });
        }
    }

    @Override
    public void onHandShakePeer(final Channel channel, final HelloMessage helloMessage) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onHandShakePeer(channel, helloMessage);
                }
            });
        }
    }

    @Override
    public void onVMTraceCreated(final String transactionHash, final String trace) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onVMTraceCreated(transactionHash, trace);
                }
            });
        }
    }

    @Override
    public void onNodeDiscovered(final Node node) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onNodeDiscovered(node);
                }
            });
        }
    }

    @Override
    public void onEthStatusUpdated(final Channel channel, final StatusMessage status) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onEthStatusUpdated(channel, status);
                }
            });
        }
    }

    @Override
    public void onTransactionExecuted(final TransactionExecutionSummary summary) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onTransactionExecuted(summary);
                }
            });
        }
    }

    @Override
    public void onPeerAddedToSyncPool(final Channel peer) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onPeerAddedToSyncPool(peer);
                }
            });
        }
    }

    @Override
    public void onPendingTransactionUpdate(final TransactionReceipt txReceipt, final PendingTransactionState state,
                                           final Block block) {
        for (final EthereumListener listener : listeners) {
            eventDispatchThread.invokeLater(new Runnable() {
                @Override
                public void run() {
                    listener.onPendingTransactionUpdate(txReceipt, state, block);
                }
            });
        }
    }
}


text:
#import "EDAMLimits.h"
#import "EDAMNoteStore.h"
#import "EDAMTypes.h"
#import "EDAMUserStore.h"
#import "EDAMErrors.h"


text:
define(['router'], function(Router) {
    'use strict';
    var initialize = function() {
        Router.initialize();
    };
    return {
        initialize: initialize
    };
});


text:
namespace MassTransit.Context
{
    using System;
    using System.Collections.Generic;
    using Util;

    /// <summary>
    /// The context headers are sourced from the IContextHeaderProvider, with the use of a Json deserializer
    /// to convert data types to objects as required. If the original headers are Json objects, those headers
    /// are deserialized as well
    /// </summary>
    public class JsonHeaders :
        Headers
    {
        readonly IObjectTypeDeserializer _deserializer;
        readonly IHeaderProvider _provider;

        public JsonHeaders(IObjectTypeDeserializer deserializer, IHeaderProvider provider)
        {
            _deserializer = deserializer ?? throw new ArgumentNullException(nameof(deserializer));
            _provider = provider ?? throw new ArgumentNullException(nameof(provider));
        }

        public IEnumerable<KeyValuePair<string, object>> GetAll()
        {
            return _provider.GetAll();
        }

        bool Headers.TryGetHeader(string key, out object value)
        {
            if (key == null)
                throw new ArgumentNullException(nameof(key));

            return _provider.TryGetHeader(key, out value);
        }

        T Headers.Get<T>(string key, T defaultValue)
        {
            return _deserializer.Deserialize(_provider, key, defaultValue);
        }

        T? Headers.Get<T>(string key, T? defaultValue)
        {
            return _deserializer.Deserialize(_provider, key, defaultValue);
        }
    }
}


text:
//
// DO NOT MODIFY! THIS IS AUTOGENERATED FILE!
//
namespace Xilium.CefGlue.Interop
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using System.Runtime.InteropServices;
    using System.Security;

    [StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)]
    [SuppressMessage("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable")]
    internal unsafe struct cef_stream_writer_t
    {
        internal cef_base_ref_counted_t _base;
        internal IntPtr _write;
        internal IntPtr _seek;
        internal IntPtr _tell;
        internal IntPtr _flush;
        internal IntPtr _may_block;

        // CreateForFile
        [DllImport(libcef.DllName, EntryPoint = "cef_stream_writer_create_for_file", CallingConvention = libcef.CEF_CALL)]
        public static extern cef_stream_writer_t* create_for_file(cef_string_t* fileName);

        // CreateForHandler
        [DllImport(libcef.DllName, EntryPoint = "cef_stream_writer_create_for_handler", CallingConvention = libcef.CEF_CALL)]
        public static extern cef_stream_writer_t* create_for_handler(cef_write_handler_t* handler);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate void add_ref_delegate(cef_stream_writer_t* self);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate int release_delegate(cef_stream_writer_t* self);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate int has_one_ref_delegate(cef_stream_writer_t* self);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate int has_at_least_one_ref_delegate(cef_stream_writer_t* self);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate UIntPtr write_delegate(cef_stream_writer_t* self, void* ptr, UIntPtr size, UIntPtr n);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate int seek_delegate(cef_stream_writer_t* self, long offset, int whence);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate long tell_delegate(cef_stream_writer_t* self);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate int flush_delegate(cef_stream_writer_t* self);

        [UnmanagedFunctionPointer(libcef.CEF_CALLBACK)]
        #if !DEBUG
        [SuppressUnmanagedCodeSecurity]
        #endif
        private delegate int may_block_delegate(cef_stream_writer_t* self);

        // AddRef
        private static IntPtr _p0;
        private static add_ref_delegate _d0;

        public static void add_ref(cef_stream_writer_t* self)
        {
            add_ref_delegate d;
            var p = self->_base._add_ref;
            if (p == _p0) { d = _d0; }
            else
            {
                d = (add_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(add_ref_delegate));
                if (_p0 == IntPtr.Zero) { _d0 = d; _p0 = p; }
            }
            d(self);
        }

        // Release
        private static IntPtr _p1;
        private static release_delegate _d1;

        public static int release(cef_stream_writer_t* self)
        {
            release_delegate d;
            var p = self->_base._release;
            if (p == _p1) { d = _d1; }
            else
            {
                d = (release_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(release_delegate));
                if (_p1 == IntPtr.Zero) { _d1 = d; _p1 = p; }
            }
            return d(self);
        }

        // HasOneRef
        private static IntPtr _p2;
        private static has_one_ref_delegate _d2;

        public static int has_one_ref(cef_stream_writer_t* self)
        {
            has_one_ref_delegate d;
            var p = self->_base._has_one_ref;
            if (p == _p2) { d = _d2; }
            else
            {
                d = (has_one_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(has_one_ref_delegate));
                if (_p2 == IntPtr.Zero) { _d2 = d; _p2 = p; }
            }
            return d(self);
        }

        // HasAtLeastOneRef
        private static IntPtr _p3;
        private static has_at_least_one_ref_delegate _d3;

        public static int has_at_least_one_ref(cef_stream_writer_t* self)
        {
            has_at_least_one_ref_delegate d;
            var p = self->_base._has_at_least_one_ref;
            if (p == _p3) { d = _d3; }
            else
            {
                d = (has_at_least_one_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(has_at_least_one_ref_delegate));
                if (_p3 == IntPtr.Zero) { _d3 = d; _p3 = p; }
            }
            return d(self);
        }

        // Write
        private static IntPtr _p4;
        private static write_delegate _d4;

        public static UIntPtr write(cef_stream_writer_t* self, void* ptr, UIntPtr size, UIntPtr n)
        {
            write_delegate d;
            var p = self->_write;
            if (p == _p4) { d = _d4; }
            else
            {
                d = (write_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(write_delegate));
                if (_p4 == IntPtr.Zero) { _d4 = d; _p4 = p; }
            }
            return d(self, ptr, size, n);
        }

        // Seek
        private static IntPtr _p5;
        private static seek_delegate _d5;

        public static int seek(cef_stream_writer_t* self, long offset, int whence)
        {
            seek_delegate d;
            var p = self->_seek;
            if (p == _p5) { d = _d5; }
            else
            {
                d = (seek_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(seek_delegate));
                if (_p5 == IntPtr.Zero) { _d5 = d; _p5 = p; }
            }
            return d(self, offset, whence);
        }

        // Tell
        private static IntPtr _p6;
        private static tell_delegate _d6;

        public static long tell(cef_stream_writer_t* self)
        {
            tell_delegate d;
            var p = self->_tell;
            if (p == _p6) { d = _d6; }
            else
            {
                d = (tell_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(tell_delegate));
                if (_p6 == IntPtr.Zero) { _d6 = d; _p6 = p; }
            }
            return d(self);
        }

        // Flush
        private static IntPtr _p7;
        private static flush_delegate _d7;

        public static int flush(cef_stream_writer_t* self)
        {
            flush_delegate d;
            var p = self->_flush;
            if (p == _p7) { d = _d7; }
            else
            {
                d = (flush_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(flush_delegate));
                if (_p7 == IntPtr.Zero) { _d7 = d; _p7 = p; }
            }
            return d(self);
        }

        // MayBlock
        private static IntPtr _p8;
        private static may_block_delegate _d8;

        public static int may_block(cef_stream_writer_t* self)
        {
            may_block_delegate d;
            var p = self->_may_block;
            if (p == _p8) { d = _d8; }
            else
            {
                d = (may_block_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(may_block_delegate));
                if (_p8 == IntPtr.Zero) { _d8 = d; _p8 = p; }
            }
            return d(self);
        }

    }
}


text:
<?php
	//fleetPage.php
	//this page shows the user what fleets they currently have in space now
	session_start();
	require_once('global.php');
	Controller::assert_login();

	$email = $_SESSION['email'];

	$gameID = (isset($_GET['g'])) ? $_GET['g'] : '';
	if($gameID == ''){
		Controller::error(701, "I'm sorry, I can't tell which game you're looking for.");
	} else {
		$game = Model::get_game($gameID);
		if($game == null){
			Controller::error(702, "I'm sorry, I can't find game $gameID.");
		} if (!in_array($email, array_keys($game->commanders))){
			Controller::error(708, "I'm sorry, it doesn't look like you are playing in game $gameID. " .
								   "[home]");
		}
	}

	if($game->status == 'setup'){
		header("Location: setupPage.php?g=$gameID");
	}

	//send to reports page if they haven't seen this day yet
	if($game->commanders[$email]['last'] < $game->day){
		header("Location: reportPage.php?g=$gameID");
	}

	$title = $game->commanders[$email]['title'];
	$name  = $game->commanders[$email]['name'];

	$data['email'] = "$title $name";
	$furyspace = (date("F j") == "April 1") ? "furryspace" : "furyspace";
	$data['title'] = "$furyspace } $title $name's Fleets";
	$data['styles'] = array('space.css', "style.php?color={$game->commanders[$email]['color']}");
	View::header($data);
	View::messages();
	View::galaxy_header($game->galaxy, "$title $name", $game->day, $game->get_stats($email), $game->get_commit($email), $gameID);
	View::navigation($gameID, "map");
	print "
\n";

	$fleets = $game->commanders[$email]['fleets'];
	$count = count($fleets);
	if($count > 0){
		$s = ($count == 1) ? '' : 's';
		print "
Your $count fleet$s
";

		print "
\n";
		for($i = 0; $i < count($fleets); $i++){
			$fleet = $fleets[$i];
			if($fleet['etd'] == $game->day){
				$cancelbutton = "[recall]";
			} else {
				$cancelbutton = '';
			}
			$s = ($fleet['size'] == 1) ? '' : 's';
			$days_out = $fleet['eta'] - $game->day;
			$when = ($days_out == 1) ? 'tomorrow' : "in $days_out days";
			$sourceplanet = View::planetlink($gameID, $fleet['source']);
			$destplanet = View::planetlink($gameID, $fleet['destination']);
			if($game->is_color_visible($email, $fleet['destination'])){
                $destowner  = View::commanderspan($game, $game->planets[$fleet['destination']]['owner']);
                $destowners = "{$destowner}'s";
			} else {
                $destowners = '';
            }
			print "
{$fleet['size']} ship$s from $sourceplanet headed to $destowners $destplanet arriving on day {$fleet['eta']} ($when) $cancelbutton
\n";
		}
		print "
\n";
	} else {
		print "
I'm sorry, it doesn't look like you have any ships in flight right now.
";
	}

	print "
";
	View::footer($renderstart);
?>


text:
@interface RNFileShare : NSObject <RCTBridgeModule>

@end


text:
import * as utils from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import {config} from '../src/config.js';

const BIDDER_CODE = 'districtmDMX';

const DMXURI = 'https://dmx.districtm.io/b/v1';

export const spec = {
  code: BIDDER_CODE,
  supportedFormat: ['banner'],
  isBidRequestValid(bid) {
    return !!(bid.params.dmxid && bid.params.memberid);
  },
  interpretResponse(response, bidRequest) {
    response = response.body || {};
    if (response.seatbid) {
      if (utils.isArray(response.seatbid)) {
        const {seatbid} = response;
        let winners = seatbid.reduce((bid, ads) => {
          let ad = ads.bid.reduce(function(oBid, nBid) {
            if (oBid.price < nBid.price) {
              const bid = matchRequest(nBid.impid, bidRequest);
              const {width, height} = defaultSize(bid);
              nBid.cpm = parseFloat(nBid.price).toFixed(2);
              nBid.bidId = nBid.impid;
              nBid.requestId = nBid.impid;
              nBid.width = nBid.w || width;
              nBid.height = nBid.h || height;
              if (nBid.dealid) {
                nBid.dealId = nBid.dealid;
              }
              nBid.ad = nBid.adm;
              nBid.netRevenue = true;
              nBid.creativeId = nBid.crid;
              nBid.currency = 'USD';
              nBid.ttl = 60;
              return nBid;
            } else {
              oBid.cpm = oBid.price;
              return oBid;
            }
          }, {price: 0});
          if (ad.adm) {
            bid.push(ad)
          }
          return bid;
        }, [])
        let winnersClean = winners.filter(w => {
          if (w.bidId) {
            return true;
          }
          return false;
        });
        return winnersClean;
      } else {
        return [];
      }
    } else {
      return [];
    }
  },
  buildRequests(bidRequest, bidderRequest) {
    let timeout = config.getConfig('bidderTimeout');
    let schain = null;
    let dmxRequest = {
      id: utils.generateUUID(),
      cur: ['USD'],
      tmax: (timeout - 300),
      test: this.test() || 0,
      site: {
        publisher: { id: String(bidRequest[0].params.memberid) || null }
      }
    }
    try {
      let params = config.getConfig('dmx');
      dmxRequest.user = params.user || {};
      let site = params.site || {};
      dmxRequest.site = {...dmxRequest.site, ...site}
    } catch (e) {

    }
    if (!dmxRequest.test) {
      delete dmxRequest.test;
    }
    if (bidderRequest.gdprConsent) {
      dmxRequest.regs = {};
      dmxRequest.regs.ext = {};
      dmxRequest.regs.ext.gdpr = bidderRequest.gdprConsent.gdprApplies === true ? 1 : 0;
      dmxRequest.user = {};
      dmxRequest.user.ext = {};
      dmxRequest.user.ext.consent = bidderRequest.gdprConsent.consentString;
    }
    if (bidderRequest && bidderRequest.uspConsent) {
      dmxRequest.regs = dmxRequest.regs || {};
      dmxRequest.regs.ext = dmxRequest.regs.ext || {};
      dmxRequest.regs.ext.us_privacy = bidderRequest.uspConsent;
    }
    try {
      schain = bidRequest[0].schain;
      dmxRequest.source = {};
      dmxRequest.source.ext = {};
      dmxRequest.source.ext.schain = schain || {}
    } catch (e) {}
    let tosendtags = bidRequest.map(dmx => {
      var obj = {};
      obj.id = dmx.bidId;
      obj.tagid = String(dmx.params.dmxid);
      obj.secure = 1;
      obj.banner = {
        topframe: 1,
        w: cleanSizes(dmx.sizes, 'w'),
        h: cleanSizes(dmx.sizes, 'h'),
        format: cleanSizes(dmx.sizes).map(s => {
          return {w: s[0], h: s[1]};
        }).filter(obj => typeof obj.w === 'number' && typeof obj.h === 'number')
      };
      return obj;
    });

    if (tosendtags.length <= 5) {
      dmxRequest.imp = tosendtags;
      return {
        method: 'POST',
        url: DMXURI,
        data: JSON.stringify(dmxRequest),
        bidderRequest
      }
    } else {
      return upto5(tosendtags, dmxRequest, bidderRequest, DMXURI);
    }
  },
  test() {
    return window.location.href.indexOf('dmTest=true') !== -1 ? 1 : 0;
  },
  getUserSyncs(optionsType, serverResponses, gdprConsent, uspConsent) {
    let query = [];
    let url = 'https://cdn.districtm.io/ids/index.html'
    if (gdprConsent && gdprConsent.gdprApplies && typeof gdprConsent.consentString === 'string') {
      query.push(['gdpr', gdprConsent.consentString])
    }
    if (uspConsent) {
      query.push(['ccpa', uspConsent])
    }
    if (query.length > 0) {
      url += '?' + query.map(q => q.join('=')).join('&')
    }
    if (optionsType.iframeEnabled) {
      return [{
        type: 'iframe',
        url: url
      }];
    }
  }
}

export function cleanSizes(sizes, value) {
  const supportedSize = [
    {
      size: [300, 250],
      s: 100
    },
    {
      size: [728, 90],
      s: 95
    },
    {
      size: [320, 50],
      s: 90
    },
    {
      size: [160, 600],
      s: 88
    },
    {
      size: [300, 600],
      s: 85
    },
    {
      size: [300, 50],
      s: 80
    },
    {
      size: [970, 250],
      s: 75
    },
    {
      size: [970, 90],
      s: 60
    },
  ];
  let newArray = shuffle(sizes, supportedSize);
  switch (value) {
    case 'w':
      return newArray[0][0] || 0;
    case 'h':
      return newArray[0][1] || 0;
    case 'size':
      return newArray;
    default:
      return newArray;
  }
}

export function shuffle(sizes, list) {
  let removeSizes = sizes.filter(size => {
    return list.map(l => `${l.size[0]}x${l.size[1]}`).indexOf(`${size[0]}x${size[1]}`) === -1
  })
  let reOrder = sizes.reduce((results, current) => {
    if (results.length === 0) {
      results.push(current);
      return results;
    }
    results.push(current);
    results = list.filter(l => results.map(r => `${r[0]}x${r[1]}`).indexOf(`${l.size[0]}x${l.size[1]}`) !== -1);
    results = results.sort(function(a, b) {
      return b.s - a.s;
    })
    return results.map(r => r.size);
  }, [])
  return removeDuplicate([...reOrder, ...removeSizes]);
}

export function removeDuplicate(arrayValue) {
  return arrayValue.filter((elem, index) => {
    return arrayValue.map(e => `${e[0]}x${e[1]}`).indexOf(`${elem[0]}x${elem[1]}`) === index
  })
}

export function upto5(allimps, dmxRequest, bidderRequest, DMXURI) {
  let start = 0;
  let step = 5;
  let req = [];
  while (allimps.length !== 0) {
    if (allimps.length >= 5) {
      req.push(allimps.splice(start, step))
    } else {
      req.push(allimps.splice(start, allimps.length))
    }
  }
  return req.map(r => {
    dmxRequest.imp = r;
    return {
      method: 'POST',
      url: DMXURI,
      data: JSON.stringify(dmxRequest),
      bidderRequest
    }
  })
}

/**
 * Function matchRequest(id: string, BidRequest: object)
 * @param id
 * @type string
 * @param bidRequest
 * @type Object
 * @returns Object
 *
 */
export function matchRequest(id, bidRequest) {
  const {bids} = bidRequest.bidderRequest;
  const [returnValue] = bids.filter(bid => bid.bidId === id);
  return returnValue;
}
export function checkDeepArray(Arr) {
  if (Array.isArray(Arr)) {
    if (Array.isArray(Arr[0])) {
      return Arr[0];
    } else {
      return Arr;
    }
  } else {
    return Arr;
  }
}
export function defaultSize(thebidObj) {
  const {sizes} = thebidObj;
  const returnObject = {};
  returnObject.width = checkDeepArray(sizes)[0];
  returnObject.height = checkDeepArray(sizes)[1];
  return returnObject;
}
registerBidder(spec);


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CornerHighlightController : MouseUIObject
{
    public GameObject draggableWallPrototype;
    public PlayingFieldController playingFieldController;
    public float animationStep;
    public float animationRange;
    public float validWallSize;

    public Material standard;
    public Material valid;
    public Material invalid;

    private float absoluteValidWallSize;
    private static CornerHighlightController selected = null;
    private bool animate = false;
    private bool dragging = false;
    private bool validWall = false;
    private bool validLongWall = false;
    private float animationDirection = 1;
    private float animationSize = 0;
    private GameObject newWall = null;
    private Renderer[] renderers;
    private ErrorText errorText;
    private Vector3 draggableWallScale;

    void Start()
    {
        renderers = GetComponentsInChildren<Renderer>();
        errorText = Resources.FindObjectsOfTypeAll<ErrorText>()[0];
        absoluteValidWallSize = validWallSize * playingFieldController.GetStepSize();
        draggableWallScale = Vector3.one + Vector3.forward * (playingFieldController.GetStepSize() - 1);
        SetMaterial(standard);
    }

    public override void Update()
    {
        if (mouseOver && mouseEnter)
        {
            //Debug.Log("Mouse Enter");
            selected = this;
            StartAnimation();
        }
        if (mouseExit)
        {
            //Debug.Log("Mouse Exit");
            if (selected)
            {
                selected.SetMaterial(standard);
            }
            selected = null;
            if (!dragging)
                StopAnimation(false);
        }

        if (dragging && Input.GetMouseButtonUp(0))
        {
            //Debug.Log("Stop Dragging");
            if (selected != this && (validWall || validLongWall))
            {

                if (validWall)
                {
                    if (PlayingFieldController.maxWalls - PlayingFieldController.currentWalls > 0)
                    {
                        //Debug.Log("Place New Wall " + selected + "-" + newWall);
                        newWall.transform.LookAt(selected.transform.position);
                        newWall.transform.localScale = draggableWallScale;
                        PlayingFieldController.currentWalls++;

                        // recalculate pathing
                        FindObjectOfType<AstarPath>().Scan();
                        if (!playingFieldController.IsValidLevel())
                        {
                            PlayingFieldController.currentWalls--;
                            Destroy(newWall);

                            FindObjectOfType<AstarPath>().Scan();
                            errorText.DisplayError("Path to the exit cannot be fully obstructed");
                        }
                        newWall = null;
                    }
                    else
                    {
                        errorText.DisplayError("Too Many Walls", 2);
                        // send to many walls errormessage
                    }
                }
                else if (validLongWall)
                {
                    int count = Mathf.RoundToInt((selected.transform.position - transform.position).magnitude / playingFieldController.GetStepSize());
                    if (PlayingFieldController.maxWalls - PlayingFieldController.currentWalls - count >= 0)
                    {
                        List<GameObject> newWalls = new List<GameObject>();
                        Destroy(newWall);
                        newWall = null;
                        //Debug.Log("Place New Walls " + selected + "-" + newWall + " x" + count);

                        for (int i = 0; i < count; i++)
                        {
                            newWall = Instantiate(draggableWallPrototype);
                            newWall.transform.position = transform.position; //+i
                            newWall.transform.LookAt(selected.transform.position);
                            newWall.transform.localPosition += i * playingFieldController.GetStepSize() * newWall.transform.forward;
                            newWall.transform.localScale = draggableWallScale;
                            //newWall.GetComponentInChildren<MeshRenderer>().material.color = new Color(1, 1, 0);
                            newWalls.Add(newWall);
                        }
                        PlayingFieldController.currentWalls += newWalls.Count;

                        // recalculate pathing
                        FindObjectOfType<AstarPath>().Scan();
                        if (!playingFieldController.IsValidLevel())
                        {
                            foreach (GameObject newWall in newWalls)
                                Destroy(newWall);

                            FindObjectOfType<AstarPath>().Scan();
                            errorText.DisplayError("Path to the exit cannot be fully obstructed");
                            PlayingFieldController.currentWalls -= newWalls.Count;
                        }
                        newWall = null;
                    }
                    else
                    {
                        errorText.DisplayError("Too Many Walls", 2);
                        // send to many walls errormessage
                    }
                }
            }
            //Debug.Log("Discard New Wall");
            resetSelections();
        }

        if (dragging && Input.GetMouseButtonDown(1))
        {
            PlayingFieldController.currentWalls++;
            resetSelections();
        }

        if (!dragging && mouseOver && Input.GetMouseButtonDown(0))
        {
            if (PlayingFieldController.currentWalls < PlayingFieldController.maxWalls)
            {
                dragging = true;
                //Debug.Log("Start Dragging");
            }
            else
            {
                errorText.DisplayError("All walls are already used!");
            }
        }

        if (dragging && animate)
            StopAnimation(true);

        if (dragging && newWall == null)
        {
            //Debug.Log("Make New Wall");
            newWall = Instantiate(draggableWallPrototype);
            newWall.transform.position = transform.position;
            newWall.transform.localScale = Vector3.zero;
            //newWall.GetComponentInChildren<MeshRenderer>().material.color = new Color(1, 0, 0);
        }

        if (dragging && newWall)
        {
            //Debug.Log("Updating Wall");
            RaycastHit hitInfo = new RaycastHit();
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hitInfo, 1000, 1 << LayerMask.NameToLayer("Floor")))
            {
                newWall.transform.LookAt(hitInfo.point);
                newWall.transform.localScale = new Vector3(1, 1, (hitInfo.point - transform.position).magnitude);
            }

            if (selected && this != selected)
            {
                validWall = (selected.transform.position - transform.position).magnitude <= absoluteValidWallSize;
                validLongWall = (Mathf.Abs(selected.transform.position.x - transform.position.x) < (playingFieldController.GetStepSize() / 10)
                              || Mathf.Abs(selected.transform.position.z - transform.position.z) < (playingFieldController.GetStepSize() / 10));

                selected.SetMaterial(validWall || validLongWall ? valid : invalid);
            }
            else
            {
                validWall = false;
                validLongWall = false;
            }
        }

        //ANIMATION
        if (animate)
            RunAnimation();

        base.Update();
    }

    private void SetMaterial(Material material)
    {
        foreach (Renderer renderer in renderers)
        {
            renderer.material = material;
        }
    }

    private void resetSelections()
    {
        if (selected)
        {
            selected.SetMaterial(standard);
        }
        selected = null;
        dragging = false;
        transform.localScale = Vector3.one;
        validWall = false;
        if (newWall)
        {
            Destroy(newWall);
            newWall = null;
        }
    }

    private void RunAnimation()
    {
        var change = animationDirection * animationStep * Time.deltaTime;
        animationSize += change;
        transform.localScale = Vector3.one + (Vector3.up * animationSize);
        if (Mathf.Abs(animationSize) > animationRange)
        {
            animationDirection *= -1;
        }
    }

    private void StartAnimation()
    {
        animationDirection = 1;
        animationSize = 0;
        animate = true;
    }

    private void StopAnimation(bool large)
    {
        animate = false;
        if (large)
        {
            transform.localScale = Vector3.one + Vector3.up * (animationRange);
        }
        else
        {
            transform.localScale = Vector3.one;
        }
    }
}


text:
/*

                  EA4TX ARS-USB Pin Definitions

*/

/* azimuth pins --------------------- (use just the azimuth pins for an azimuth-only rotator) */

#define rotate_cw 6              // goes high to activate rotator R (CW) rotation - pin 1 on Yaesu connector
#define rotate_ccw 7             // goes high to activate rotator L (CCW) rotation - pin 2 on Yaesu connector
#define button_cw A2              // normally open button to ground for manual CW rotation (schematic pin: A1)
#define button_ccw A3             // normally open button to ground for manual CCW rotation (schematic pin: A2)
#define serial_led 0             // LED blinks when command is received on serial port (set to 0 to disable)
#define rotator_analog_az A0     // reads analog azimuth voltage from rotator - pin 4 on Yaesu connector
#define brake_az 0               // goes high to disengage azimuth brake (set to 0 to disable)
#define button_stop 0            // connect to momentary switch (ground on button press) for preset stop (set to 0 to disable or for preset automatic start)

/*----------- elevation pins --------------*/
#ifdef FEATURE_ELEVATION_CONTROL
#define rotate_up 8               // goes high to activate rotator elevation up
#define rotate_down 9             // goes high to activate rotator elevation down
#define rotator_analog_el A1      // reads analog elevation voltage from rotator
#define button_up A4               // normally open button to ground for manual up elevation
#define button_down A5             // normally open button to ground for manual down rotation
#define brake_el 0                // goes high to disengage elevation brake (set to 0 to disable)
#endif //FEATURE_ELEVATION_CONTROL

//classic 4 bit LCD pins
#define lcd_4_bit_rs_pin 12
#define lcd_4_bit_enable_pin 11
#define lcd_4_bit_d4_pin 5
#define lcd_4_bit_d5_pin 4
#define lcd_4_bit_d6_pin 3
#define lcd_4_bit_d7_pin 2

// everything below this line is unused

#ifdef FEATURE_PARK
#define button_park 0
#endif

#ifdef FEATURE_PARK
#define park_in_progress_pin 0  // goes high when a park has been initiated and rotation is in progress
#define parked_pin 0            // goes high when in a parked position
#endif //FEATURE_PARK

#define heading_reading_inhibit_pin 0 // input - a high will cause the controller to suspend taking azimuth (and elevation) readings; use when RF interferes with sensors

#ifdef FEATURE_LIMIT_SENSE
#define az_limit_sense_pin 0  // input - low stops azimuthal rotation
#define el_limit_sense_pin 0  // input - low stops elevation rotation
#endif //FEATURE_LIMIT_SENSE

#ifdef FEATURE_POWER_SWITCH
#define power_switch 0             // use with FEATURE_POWER_SWITCH
#endif //FEATURE_POWER_SWITCH

#define rotate_cw_ccw  0         // goes high for both CW and CCW rotation
#define rotate_cw_pwm 0          // optional - PWM CW output - set to 0 to disable (must be PWM capable pin)
#define rotate_ccw_pwm 0         // optional - PWM CCW output - set to 0 to disable (must be PWM capable pin)
#define rotate_cw_ccw_pwm 0      // optional - PWM on CW and CCW output - set to 0 to disable (must be PWM capable pin)
#define rotate_cw_freq 0         // optional - CW variable frequency output
#define rotate_ccw_freq 0        // optional - CCW variable frequency output
#define az_speed_pot 0           // connect to wiper of 1K to 10K potentiometer for speed control (set to 0 to disable)
#define az_preset_pot 0          // connect to wiper of 1K to 10K potentiometer for preset control (set to 0 to disable)
#define rotate_up_or_down 0       // goes high when elevation up or down is activated
#define rotate_up_pwm 0           // optional - PWM UP output - set to 0 to disable (must be PWM capable pin)
#define rotate_down_pwm 0         // optional - PWM DOWN output - set to 0 to disable (must be PWM capable pin)
#define rotate_up_down_pwm 0      // optional - PWM on both UP and DOWN (must be PWM capable pin)
#define rotate_up_freq 0          // optional - UP variable frequency output
#define rotate_down_freq 0        // optional - UP variable frequency output
#define az_stepper_motor_pulse 0
#define az_stepper_motor_direction 0
#define rotation_indication_pin 0
#define blink_led 0
#define elevation_speed_voltage  0 // optional - PWM output for speed control voltage feed into rotator (on continually unlike rotate_up_pwm and rotate_down_pwm)
#define el_stepper_motor_pulse 0
#define el_stepper_motor_direction 0
#define azimuth_speed_voltage 0  // optional - PWM output for speed control voltage feed into rotator (on continually unlike rotate_cw_pwm and rotate_ccw_pwm)
#define overlap_led 0            // line goes high when azimuth rotator is in overlap (> 360 rotators)
#define preset_start_button 0    // connect to momentary switch (ground on button press) for preset start (set to 0 to disable or for preset automatic start)


text:
namespace EasterFarm.Models.FarmObjects.Animals
{
    public abstract class Villain : Animal
    {
        protected Villain(MatrixCoords topLeft)
            : base(topLeft)
        {
        }
    }
}


text:
//
//  UIView+Helpers.h
//
//  Created by Andrew Carter on 11/9/11.

#import <UIKit/UIKit.h>

@interface UIView (Helpers)

typedef NS_ENUM(NSUInteger, UIViewAlignment)
{
    UIViewAlignmentLeft = 1 << 0,
    UIViewAlignmentRight = 1 << 1,
    UIViewAlignmentTop = 1 << 2,
    UIViewAlignmentBottom = 1 << 3,

    UIViewAlignmentLeftEdge = 1 << 5,
    UIViewAlignmentRightEdge = 1 << 6,
    UIViewAlignmentTopEdge = 1 << 7,
    UIViewAlignmentBottomEdge = 1 << 8,

    UIViewAlignmentHorizontalCenter = 1 << 9,
    UIViewAlignmentVerticalCenter = 1 << 10,
};

typedef NS_ENUM(NSInteger, VerticalLayoutType) {
    VerticalLayoutTypeTop,
    VerticalLayoutTypeCenter,
    VerticalLayoutTypeBottom
};

+ (CGRect)alignRect:(CGRect)startingRect
             toRect:(CGRect)referenceRect
      withAlignment:(UIViewAlignment)alignment
             insets:(UIEdgeInsets)insets
andReferenceIsSuperView:(BOOL)isReferenceSuperView;

// Init
- (id)initWithSize:(CGSize)size;

//Alignment
- (void)alignRelativeToView:(UIView*)alignView
              withAlignment:(UIViewAlignment)alignment
                  andInsets:(UIEdgeInsets)insets;

- (void)alignRelativeToSuperView:(UIView*)alignView
                   withAlignment:(UIViewAlignment)alignment
                       andInsets:(UIEdgeInsets)insets;

- (void)centerAlignHorizontalForView:(UIView *)view;
- (void)centerAlignVerticalForView:(UIView *)view;

- (void)centerAlignHorizontalForView:(UIView *)view offset:(CGFloat)offset;
- (void)centerAlignVerticalForView:(UIView *)view offset:(CGFloat)offset;
- (void)centerAlignForView:(UIView *)view;

- (void)centerAlignForSuperview;
- (void)centerAlignHorizontalForSuperView;
- (void)centerAlignVerticalForSuperView;

- (void)leftAlignForView:(UIView *)view;
- (void)rightAlignForView:(UIView *)view;
- (void)topAlignForView:(UIView *)view;
- (void)bottomAlignForView:(UIView *)view;

- (void)leftAlignForView:(UIView *)view offset:(CGFloat)offset;
- (void)rightAlignForView:(UIView *)view offset:(CGFloat)offset;
- (void)topAlignForView:(UIView *)view offset:(CGFloat)offset;
- (void)bottomAlignForView:(UIView *)view offset:(CGFloat)offset;

- (void)topAlignForSuperView;
- (void)bottomAlignForSuperView;
- (void)leftAlignForSuperView;
- (void)rightAlignForSuperView;

- (void)topAlignForSuperViewOffset:(CGFloat)offset;
- (void)bottomAlignForSuperViewOffset:(CGFloat)offset;
- (void)leftAlignForSuperViewOffset:(CGFloat)offset;
- (void)rightAlignForSuperViewOffset:(CGFloat)offset;

//Convenience Getters
- (CGFloat)frameOriginX;
- (CGFloat)frameOriginY;
- (CGFloat)frameSizeWidth;
- (CGFloat)frameSizeHeight;
- (CGSize)frameSize;
- (CGPoint)frameOrigin;

//Frame Adjustments
- (void)setFrameSize:(CGSize)size;
- (void)setFrameOrigin:(CGPoint)origin;
- (void)setFrameOriginY:(CGFloat)y;
- (void)setFrameOriginX:(CGFloat)x;
- (void)setFrameSizeWidth:(CGFloat)width;
- (void)setFrameSizeHeight:(CGFloat)height;

//Positioning Relative to View
- (void)setFrameOriginYBelowView:(UIView *)view;
- (void)setFrameOriginYAboveView:(UIView *)view;
- (void)setFrameOriginXRightOfView:(UIView *)view;
- (void)setFrameOriginXLeftOfView:(UIView *)view;

- (void)setFrameOriginYBelowView:(UIView *)view offset:(CGFloat)offset;
- (void)setFrameOriginYAboveView:(UIView *)view offset:(CGFloat)offset;
- (void)setFrameOriginXRightOfView:(UIView *)view offset:(CGFloat)offset;
- (void)setFrameOriginXLeftOfView:(UIView *)view offset:(CGFloat)offset;

//Resizing
- (void)setFrameSizeToImageSize;

//Making rounded corners
- (void)roundCornersTopLeft:(CGFloat)topLeft topRight:(CGFloat)topRight bottomLeft:(CGFloat)bottomLeft bottomRight:(CGFloat)bottomRight;
static inline UIImage* createRoundedCornerMask(CGRect rect, CGFloat radius_tl, CGFloat radius_tr, CGFloat radius_bl, CGFloat radius_br);

//Fade Edges
- (void)setHorizontalFadeMaskWithLeftOffset:(CGFloat)leftOffset rightOffset:(CGFloat)rightOffset;
- (void)setVerticalFadeMaskWithTopOffset:(CGFloat)topOffset bottomOffset:(CGFloat)bottomOffset;

// Snapshot creation
- (UIImageView *)createSnapshot __deprecated;
- (UIImage *)snapshotImage;

/*
 * iOS 6 and prior: calls -snapshotView and wraps the result in a UIImageView
 * on iOS 7 and up: calls and returns the stock -snapshotView method
 */

- (UIView *)snapshotImageView;

/* Debug
 *
 * The functions below are only performed in DEBUG mode
 * @param "showInRelease" will apply the function in both DEBUG and RELEASE mode
 */
- (void)showDebugFrame;
- (void)hideDebugFrame;
- (void)showDebugFrame:(BOOL)showInRelease;

- (void)logFrameChanges;

// Layout Helpers
+ (CGFloat)alignVertical:(VerticalLayoutType)type
                   views:(NSArray*)views
             withSpacing:(CGFloat)spacing
                  inView:(UIView*)view
      shrinkSpacingToFit:(BOOL)shrinkSpacingToFit;

+ (CGFloat)alignVertical:(VerticalLayoutType)type
                   views:(NSArray*)views
        withSpacingArray:(NSArray*)spacing
                  inView:(UIView*)view
      shrinkSpacingToFit:(BOOL)shrinkSpacingToFit;

// subviews
+ (UIView *)firstResponder;
- (UIView *)firstResponderInSubviews;
- (NSArray *)subviewsOfClass:(Class)aClass recursive:(BOOL)recursive;

@end


text:
package org.pescuma.buildhealth.ant.tasks.add.staticanalysis.console;

import org.pescuma.buildhealth.ant.FileListBuildHealthAntSubTask;
import org.pescuma.buildhealth.core.BuildHealth;
import org.pescuma.buildhealth.extractor.PseudoFiles;
import org.pescuma.buildhealth.extractor.staticanalysis.console.ArmccCompilerConsoleExtractor;

public class ArmccCompilerConsoleExtractorAntTask extends FileListBuildHealthAntSubTask {

	@Override
	protected void execute(BuildHealth buildHealth) {
		buildHealth.extract(new ArmccCompilerConsoleExtractor(new PseudoFiles(getFiles())));
	}

}


text:
package com.backendless.examples.endless.matchmaker.views;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.backendless.examples.endless.matchmaker.R;
import com.backendless.examples.endless.matchmaker.models.persistent.PreferencesDefaults;

public class UIFactory
{
  private static LayoutInflater layoutInflater;

  public static View.OnClickListener getToastStubListener( final Context context, final CharSequence text )
  {
    return new View.OnClickListener()
    {
      @Override
      public void onClick( View view )
      {
        Toast.makeText( context, text, Toast.LENGTH_SHORT ).show();
      }
    };
  }

  public static CheckBox getPreferenceCheckbox( Context context, PreferencesDefaults preference )
  {
    layoutInflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
    CheckBox result = (CheckBox) layoutInflater.inflate( R.layout.inflate_checkbox, null );
    result.setText( preference.getName() );

    return result;
  }

  public static View getPingsListElement( Context context, CharSequence userName, double totalMatch,
                                          View.OnClickListener clickListener, String gender )
  {
    layoutInflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
    LinearLayout result = (LinearLayout) layoutInflater.inflate( R.layout.inflate_ping, null );
    ImageView avatar = (ImageView) result.findViewById( R.id.avatarImage );
    avatar.setImageResource( gender.equals( "male" ) ? R.drawable.avatar_default_male : R.drawable.avatar_default_female );
    ((TextView) result.findViewById( R.id.nameField )).setText( userName );
    ((TextView) result.findViewById( R.id.totalMatchValue )).setText( String.valueOf( totalMatch ) );
    ((ProgressBar) result.findViewById( R.id.totalProgressBar )).setProgress( (int) totalMatch );
    result.setOnClickListener( clickListener );

    return result;
  }

  public static ProgressDialog getDefaultProgressDialog( Context context )
  {
    return ProgressDialog.show( context, "", context.getString( R.string.loading_text ), true );
  }

  public static Dialog getLocationSettingsDialog( final Context context )
  {
    final Dialog result = new Dialog( context );
    layoutInflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
    LinearLayout dialogLayout = (LinearLayout) layoutInflater.inflate( R.layout.provider_dialog, null );
    dialogLayout.findViewById( R.id.openSettings ).setOnClickListener( new View.OnClickListener()
    {
      @Override
      public void onClick( View view )
      {
        result.dismiss();
        Intent settingsIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS );
        context.startActivity( settingsIntent );
      }
    } );

    result.addContentView( dialogLayout, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) );

    return result;
  }
}


text:
consumer_key = 'asdf'
consumer_secret = 'asdf'

access_token = 'asdf'
access_token_secret = 'asdf'


text:
import Association from './association';
import Collection from '../collection';
import _assign from 'lodash/object/assign';
import _compact from 'lodash/array/compact';
import { capitalize } from 'ember-cli-mirage/utils/inflector';

class HasMany extends Association {

  /*
    The hasMany association adds a fk to the target of the association
  */
  getForeignKeyArray() {
    return [this.target, `${this.owner}Id`];
  }

  getForeignKey() {
    return `${this.owner}Id`;
  }

  addMethodsToModelClass(ModelClass, key, schema) {
    let modelPrototype = ModelClass.prototype;
    this._model = modelPrototype;
    this._key = key;

    var association = this;
    var foreignKey = this.getForeignKey();
    var relationshipIdsKey = association.target + 'Ids';

    var associationHash = {[key]: this};
    modelPrototype.hasManyAssociations = _assign(modelPrototype.hasManyAssociations, associationHash);
    modelPrototype.associationKeys.push(key);
    modelPrototype.associationIdKeys.push(relationshipIdsKey);

    Object.defineProperty(modelPrototype, relationshipIdsKey, {

      /*
        object.childrenIds
          - returns an array of the associated children's ids
      */
      get: function() {
        var models = association._cachedChildren || [];

        if (!this.isNew()) {
          var query = {[foreignKey]: this.id};
          var savedModels = schema[association.target].where(query);

          models = savedModels.mergeCollection(models);
        }

        return models.map(model => model.id);
      },

      /*
        object.childrenIds = ([childrenIds...])
          - sets the associated parent (via id)
      */
      set: function(ids) {
        ids = ids || [];

        if (this.isNew()) {
          association._cachedChildren = schema[association.target].find(ids);

        } else {
          // Set current children's fk to null
          var query = {[foreignKey]: this.id};
          schema[association.target].where(query).update(foreignKey, null);

          // Associate the new childrens to this model
          schema[association.target].find(ids).update(foreignKey, this.id);

          // Clear out any old cached children
          association._cachedChildren = [];
        }

        return this;
      }
    });

    Object.defineProperty(modelPrototype, key, {

      /*
        object.children
          - returns an array of associated children
      */
      get: function() {
        var tempModels = association._cachedChildren || [];

        if (this.isNew()) {
          return tempModels;

        } else {
          var query = {};
          query[foreignKey] = this.id;
          var savedModels = schema[association.target].where(query);

          return savedModels.mergeCollection(tempModels);
        }
      },

      /*
        object.children = [model1, model2, ...]
          - sets the associated children (via array of models)
          - note: this method will persist unsaved chidren
            + (why? because rails does)
      */
      set: function(models) {
        models = models ? _compact(models) : [];

        if (this.isNew()) {
          association._cachedChildren = models instanceof Collection ? models : new Collection(association.target, models);

        } else {

          // Set current children's fk to null
          var query = {[foreignKey]: this.id};
          schema[association.target].where(query).update(foreignKey, null);

          // Save any children that are new
          models.filter(model => model.isNew())
            .forEach(model => model.save());

          // Associate the new children to this model
          schema[association.target].find(models.map(m => m.id)).update(foreignKey, this.id);

          // Clear out any old cached children
          association._cachedChildren = [];
        }
      }
    });

    /*
      object.newChild
        - creates a new unsaved associated child
    */
    modelPrototype['new' + capitalize(association.target)] = function(attrs) {
      if (!this.isNew()) {
        attrs = _assign(attrs, { [foreignKey]: this.id });
      }

      var child = schema[association.target].new(attrs);

      association._cachedChildren = association._cachedChildren || new Collection(association.target);
      association._cachedChildren.push(child);

      return child;
    };

    /*
      object.createChild
        - creates an associated child, persists directly to db, and
          updates the target's foreign key
        - parent must be saved
    */
    modelPrototype['create' + capitalize(association.target)] = function(attrs) {
      if (this.isNew()) {
        throw 'You cannot call create unless the parent is saved';
      }

      var augmentedAttrs = _assign(attrs, { [foreignKey]: this.id });
      var child = schema[association.target].create(augmentedAttrs);

      return child;
    };
  }
}

export default HasMany;


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.storage.blob.options;

import com.azure.storage.blob.models.BlobHttpHeaders;
import com.azure.storage.blob.models.BlobRequestConditions;

import java.util.Map;

/**
 * Extended options that may be passed when creating a Page Blob.
 */
public class PageBlobCreateOptions {
    private final long size;
    private Long sequenceNumber;
    private BlobHttpHeaders headers;
    private Map<String, String> metadata;
    private Map<String, String> tags;
    private BlobRequestConditions requestConditions;

    /**
     * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a
     * 512-byte boundary.
     */
    public PageBlobCreateOptions(long size) {
        this.size = size;
    }

    /**
     * @return Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a
     * 512-byte boundary.
     */
    public long getSize() {
        return this.size;
    }

    /**
     * @return A user-controlled value that you can use to track requests. The value of the sequence
     * number must be between 0 and 2^63 - 1.The default value is 0.
     */
    public Long getSequenceNumber() {
        return sequenceNumber;
    }

    /**
     * @param sequenceNumber A user-controlled value that you can use to track requests. The value of the sequence
     * number must be between 0 and 2^63 - 1.The default value is 0.
     * @return The updated options.
     */
    public PageBlobCreateOptions setSequenceNumber(Long sequenceNumber) {
        this.sequenceNumber = sequenceNumber;
        return this;
    }

    /**
     * @return {@link BlobHttpHeaders}
     */
    public BlobHttpHeaders getHeaders() {
        return headers;
    }

    /**
     * @param headers {@link BlobHttpHeaders}
     * @return The updated {@code AppendBlobCreateOptions}
     */
    public PageBlobCreateOptions setHeaders(BlobHttpHeaders headers) {
        this.headers = headers;
        return this;
    }

    /**
     * @return The metadata to associate with the blob.
     */
    public Map<String, String> getMetadata() {
        return metadata;
    }

    /**
     * @param metadata The metadata to associate with the blob.
     * @return The updated options.
     */
    public PageBlobCreateOptions setMetadata(Map<String, String> metadata) {
        this.metadata = metadata;
        return this;
    }

    /**
     * @return The tags to associate with the blob.
     */
    public Map<String, String> getTags() {
        return tags;
    }

    /**
     * @param tags The tags to associate with the blob.
     * @return The updated options.
     */
    public PageBlobCreateOptions setTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * @return {@link BlobRequestConditions}
     */
    public BlobRequestConditions getRequestConditions() {
        return requestConditions;
    }

    /**
     * @param requestConditions {@link BlobRequestConditions}
     * @return The updated options.
     */
    public PageBlobCreateOptions setRequestConditions(BlobRequestConditions requestConditions) {
        this.requestConditions = requestConditions;
        return this;
    }
}


text:
s = set()
type(s) # <type 'set'>
print s # set([]) open parenthesis-bracket & close bracket-parenthesis

l = list()
type(l) # <type 'list'>
print l # [] brackets, mutable list

d = dict()
type(d) # <type 'dict'>
print d # {} braces, key-value objects

t = tuple()
type(t) # <type 'tuple'>
print t # () parentheses, immutable list


text:
import requests

class TweetsApi(object):
    """
    API interface for getting tweets.
    """
    def __init__(self, uri):
        self.uri = uri

    def fetch(self):
        """
        Retrieve a payload of tweets from the API.
        """
        res = None
        res = requests.get(self.uri)
        res.raise_for_status()
        return res.json()


text:
<?php

namespace Dudulina\Attributes;

#[\Attribute(\Attribute::TARGET_METHOD)]
class QueryHandler
{

}


text:
#include "a_base.h"
#include "a_collect.h"
#include "csved_cli.h"
#include "csved_pivot.h"
#include "csved_strings.h"

using std::string;
using std::vector;

namespace CSVED {

//---------------------------------------------------------------------------
// Possible pivoting operations
//---------------------------------------------------------------------------

const char * const OP_SUM = "sum";
const char * const OP_COUNT = "count";
const char * const OP_AVG = "avg";

//---------------------------------------------------------------------------
// Register pivot command
//---------------------------------------------------------------------------

static RegisterCommand <PivotCommand> rc1_(
	CMD_PIVOT,
	"simple pivot tables"
);

//----------------------------------------------------------------------------
// Help text
//----------------------------------------------------------------------------

const char * const PIVOT_HELP = {
	"performs simple pivot table operations on CSV input\n"
	"usage: csvfix pivot [flags] [file ...]\n"
	"where flags are:\n"
	"  -c field\tfield to use for column headers\n"
	"  -r field\tfield to use for row header \n"
	"  -a act\taction to perform (one of sum, avg, count)\n"
	"  -f field\tfield that represents the fact you want to perform action on\n"
	"#ALL"
};

//---------------------------------------------------------------------------
// standard command constructor
//---------------------------------------------------------------------------

PivotCommand :: PivotCommand( const string & name,
								const string & desc )
		: Command( name, desc, PIVOT_HELP ) {

	AddFlag( ALib::CommandLineFlag( FLAG_ACTION, true, 1 ) );
	AddFlag( ALib::CommandLineFlag( FLAG_COL, true, 1 ) );
	AddFlag( ALib::CommandLineFlag( FLAG_ROW, true, 1 ) );
	AddFlag( ALib::CommandLineFlag( FLAG_FACT, true, 1 ) );

}

//---------------------------------------------------------------------------
// Pivot the data. We store/accumulate every fact in a map indexed by
// column and row. We also store the unique column androw values so
// we can iterate over them when actually producing the output.
//---------------------------------------------------------------------------

int PivotCommand :: Execute( ALib::CommandLine & cmd ) {

    ProcessFlags( cmd );
	IOManager io( cmd );
	CSVRow row;

	while( io.ReadCSV( row ) ) {
        ColRow cr = MakeColRow( row );
        AddFact( cr, GetFact( row ));
        mCols.insert( row[mCol] );
        mRows.insert( row[mRow] );
	}

    OutputPivot( io );

	return 0;
}

//---------------------------------------------------------------------------
// Output the pivot data.
//---------------------------------------------------------------------------

void PivotCommand :: OutputPivot( IOManager & io ) {

    CSVRow r;
    r.push_back( "" );    // corresponds to row header
    for ( auto col : mCols ) {
        r.push_back( col );
    }
    io.WriteRow( r );

    for( auto row : mRows ) {
        r.clear();
        r.push_back( row );
        for ( auto col : mCols ) {
            ColRow cr( col, row );
            SumCount sc = mColRowValMap[ cr ];
            if ( mAction == Action::Average ) {
                r.push_back( ALib::Str( sc.mSum / sc.mCount ) );
            }
            else {
                r.push_back( ALib::Str( sc.mSum ) );
            }
        }
        io.WriteRow( r );
    }

}

//---------------------------------------------------------------------------
// Add fact value to total, or simply count it.
//---------------------------------------------------------------------------

void PivotCommand :: AddFact( const ColRow & cr, const string & fact )  {
    if ( (mAction == Action::Average || mAction == Action::Sum) ) {
        if ( ! ALib::IsNumber( fact ) ) {
            CSVTHROW( "Non-numeric fact: " << fact);
        }
        double fd = ALib::ToReal( fact );
        mColRowValMap[cr].Update( fd );
    }
    else {
        mColRowValMap[cr].Update(1);
    }
}

//---------------------------------------------------------------------------
// Get fact field as string.
//---------------------------------------------------------------------------

string PivotCommand :: GetFact( const CSVRow & row ) const {
    if ( mFact >= row.size() ) {
        CSVTHROW( "Invalid fact index: " << mFact );
    }
    return row[mFact];
}

//---------------------------------------------------------------------------
// Create ColRow combination object from two CSV fields.
//---------------------------------------------------------------------------

PivotCommand::ColRow PivotCommand:: MakeColRow( const CSVRow & row ) const {

    if ( mCol >= row.size() || mRow >= row.size() ) {
        CSVTHROW( "Invalid row/column index" );
    }

    return PivotCommand::ColRow( row[mCol], row[mRow] );
}

//---------------------------------------------------------------------------
// Get positive integer value for row ,column ad fact  fields
//---------------------------------------------------------------------------

static unsigned int GetField( const ALib::CommandLine & cmd,
                                const string & option ) {
    string rc = cmd.GetValue( option );
    if ( ! ALib::IsInteger( rc ) ) {
        CSVTHROW( "Value for " << option << " must be integer" );
    }
    int n = ALib::ToInteger( rc );
    if ( n <= 0 ) {
        CSVTHROW( "Value for " << option << " must be greater than zero" );
    }
    return (unsigned int) n - 1;
}

//---------------------------------------------------------------------------
// Get the action to perform when pivotting.
//---------------------------------------------------------------------------

PivotCommand::Action GetAction( const ALib::CommandLine & cmd ) {

    string as = cmd.GetValue( FLAG_ACTION );
    if ( as == OP_SUM ) {
        return PivotCommand::Action::Sum;
    }
    else if ( as == OP_COUNT ) {
        return PivotCommand::Action::Count;
    }
    else if ( as == OP_AVG ) {
        return PivotCommand::Action::Average;
    }
    else {
        CSVTHROW( "Invalid value for " << FLAG_ACTION << ". Need one of sum, count, avg" );
    }

}

//---------------------------------------------------------------------------
// Get options - all are requred.
//---------------------------------------------------------------------------

void PivotCommand :: ProcessFlags( const ALib::CommandLine & cmd ) {
    mRow = GetField( cmd, FLAG_ROW );
    mCol = GetField( cmd, FLAG_COL );
    mFact = GetField( cmd, FLAG_FACT );
    if ( mRow == mCol ) {
        CSVTHROW( "Row and column options cannot have the same value" );
    }
    mAction = GetAction( cmd );
}

//------------------------------------------------------------------------

} // end namespace

// end


text:
package nz.ac.waikato.modeljunit.gui;

import java.lang.reflect.Constructor;
import java.util.Random;

import javax.swing.Box;
import javax.swing.JCheckBox;

import nz.ac.waikato.modeljunit.GreedyTester;
import nz.ac.waikato.modeljunit.RandomTester;
import nz.ac.waikato.modeljunit.Tester;

public class OptionPanelGreedy extends OptionPanelAdapter
    implements
      IAlgorithmParameter
{
  private static final long serialVersionUID = -3666437825873201003L;

  private StringBuffer m_bufCode;

  private JCheckBox m_checkRandomSeed;

  public OptionPanelGreedy(String name, String explain, String imgPath)
  {
    super(name, explain, imgPath);
    m_checkRandomSeed = new JCheckBox("Use random seed");
    add(m_checkRandomSeed);
    add(Box.createHorizontalStrut(6));
    add(Box.createHorizontalGlue());
  }

  @Override
  public String generateCode()
  {
    m_bufCode = new StringBuffer();

    // Initialize test model
    m_bufCode.append(Indentation.indent(Parameter.getClassName()
        + " model = new " + Parameter.getClassName() + "();"));
    m_bufCode.append(Indentation
        .indent("GreedyTester tester = new GreedyTester(model);"));
    // To use random seed or not
    // If user does not want to use random seed, tester will default
    // to using a fixed seed, so it generates same tests every time it runs.
    if (m_checkRandomSeed.isSelected())
      m_bufCode.append(Indentation.indent("tester.setRandom(new Random());"));

    double resetProb = Parameter.getResetProbability();
    if (resetProb != RandomTester.DEFAULT_RESET_PROBABILITY) {
      m_bufCode.append(Indentation.indent("tester.setResetProbability("
          + String.format("%1$.3f", new Object[]{resetProb}) + ");"));
    }
    return m_bufCode.toString();
  }

  /**
   * Initialize tester and model
   * */
  @Override
  public void initialize(int idx)
  {
    try {
      // Initialize model test case by using the loaded model
      // Tester tester = new GreedyTester(new SimpleSet());
      Class<?> testerClass = Class
          .forName("nz.ac.waikato.modeljunit.GreedyTester");
      Constructor<?> con = testerClass.getConstructor(new Class[]{Class
          .forName("nz.ac.waikato.modeljunit.FsmModel")});
      m_tester[idx] = (GreedyTester) con.newInstance(new Object[]{TestExeModel
          .getModelObject()});
    }
    catch (Exception exp) {
      exp.printStackTrace();
    }
  }

  @Override
  public String generateImportLab()
  {
    m_bufCode = new StringBuffer();
    if (m_checkRandomSeed.isSelected())
      m_bufCode.append(Indentation.indent("import java.util.Random;"));

    m_bufCode.append(Indentation
        .indent("import nz.ac.waikato.modeljunit.GreedyTester;"));
    return m_bufCode.toString();
  }

  @Override
  public void runAlgorithm(int idx)
  {
    // Set reset probability
    // caseObj.setResetProbability(Parameter.getResetProbility());
    if (m_checkRandomSeed.isSelected()) {
      Random rand = new Random();
      m_tester[idx].setRandom(rand);
    }
    else {
      m_tester[idx].setRandom(new Random(Tester.FIXEDSEED));
    }
  }
}


text:
package com.itude.mobile.mobbl.core.model;

import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;

import com.itude.mobile.android.util.StringUtil;
import com.itude.mobile.mobbl.core.configuration.mvc.MBAttributeDefinition;
import com.itude.mobile.mobbl.core.configuration.mvc.MBElementDefinition;
import com.itude.mobile.mobbl.core.model.exceptions.MBCannotAssignException;
import com.itude.mobile.mobbl.core.model.exceptions.MBInvalidAttributeNameException;
import com.itude.mobile.mobbl.core.util.MBConstants;
import com.itude.mobile.mobbl.core.util.MBParseUtil;

import org.apache.commons.lang3.StringEscapeUtils;

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

/**
 * A node in an Element tree.
 */
public class MBElement extends MBElementContainer {

    private static final String TEXT_ATTRIBUTE = "text()";

    private final Map<String, String> _values;                  // Dictionaryofstrings
    private MBElementDefinition _definition;

    public MBElement() {
        super();
        _values = new HashMap<String, String>();
    }

    /**
     * Creating and Initializing an Element
     *
     * @param definition {@link MBElementDefinition}
     */
    public MBElement(MBElementDefinition definition) {
        super();
        _definition = definition;
        _values = new HashMap<String, String>();
    }

    @Override
    public MBElement clone() {
        MBElement newElement = new MBElement(_definition);
        newElement._values.putAll(_values);
        copyChildrenInto(newElement);

        return newElement;
    }

    @Override
    public void setValue(String value, String path) {
        if (path.startsWith("@")) {
            setValue(value, path.substring(1));
        } else {
            super.setValue(value, path);
        }
    }

    /**
     * Working with attribute values
     *
     * @param value         value
     * @param attributeName attribute name
     */
    public void setAttributeValue(boolean value, String attributeName) {
        setAttributeValue(value ? MBConstants.C_TRUE : MBConstants.C_FALSE, attributeName, true);
    }

    /**
     * Working with attribute values
     *
     * @param value         value
     * @param attributeName attribute name
     */
    public void setAttributeValue(String value, String attributeName) {
        setAttributeValue(value, attributeName, true);
    }

    /**
     * Working with attribute values
     *
     * @param value          value
     * @param attributeName  attribute name
     * @param throwIfInvalid true if an exeption needs to be thrown if attribute is invalid
     */
    public void setAttributeValue(String value, String attributeName, boolean throwIfInvalid) {
        if (throwIfInvalid) {
            validateAttribute(attributeName);
            _values.put(attributeName, value);
        } else {
            if (isValidAttribute(attributeName)) {
                _values.put(attributeName, value);
            }
        }

    }

    public String getValueForAttribute(String attributeName) {
        String rtrn = _values.get(attributeName);
        if (rtrn == null) {
            // above we assumed the attributeName is valid (should be true 100% of the time in production)
            // so we only validate the attrib if we do not have a value for it.
            validateAttribute(attributeName);
        }
        return rtrn;
    }

    public boolean getBooleanForAttribute(String attributeName) {
        return MBParseUtil.booleanValue(getValueForAttribute(attributeName));
    }

    public String getValueForKey(String key) {
        return getValueForAttribute(key);
    }

    public StringBuffer asXmlWithLevel(StringBuffer appendToMe, int level) {
        return asXmlWithLevel(appendToMe, level, false);
        // TODO: it should always be true (like in iOS), but to be a 100% sure, every project needs to be tested in order to do that as it changes the behaviour of the toString
    }

    public StringBuffer asXmlWithLevel(StringBuffer appendToMe, int level, boolean escapeContent) {
        String bodyText = getBodyText();
        boolean hasBodyText = (bodyText != null && bodyText.length() > 0);

        StringUtil.appendIndentString(appendToMe, level).append("<").append(_definition.getName());
        for (MBAttributeDefinition def : _definition.getAttributes()) {
            String attrName = def.getName();
            String attrValue = _values.get(attrName);
            if (!attrName.equals(TEXT_ATTRIBUTE)) {
                appendToMe.append(attributeAsXml(attrName, attrValue));
            }
        }

        if (_definition.getChildren().isEmpty() && !hasBodyText) {
            appendToMe.append("/>\n");
        } else {
            appendToMe.append(">");
            if (hasBodyText) {
                appendToMe.append(StringEscapeUtils.escapeXml10(getBodyText().trim()));
            } else {
                appendToMe.append("\n");
            }

            for (MBElementDefinition elemDef : _definition.getChildren()) {
                List<MBElement> lst = getElements().get(elemDef.getName());
                if (lst != null) {
                    for (MBElement elem : lst) {
                        elem.asXmlWithLevel(appendToMe, level + 2, escapeContent);
                    }
                }
            }

            int closingLevel = 0;
            if (!hasBodyText) {
                closingLevel = level;
            }
            StringUtil.appendIndentString(appendToMe, closingLevel).append("</").append(_definition.getName()).append(">\n");
        }

        return appendToMe;
    }

    @Override
    public MBElementDefinition getDefinition() {
        return _definition;
    }

    public void setDefinition(MBElementDefinition definition) {
        _definition = definition;
    }

    /**
     * Checking existence of attributes
     *
     * @param attributeName attribute name
     * @return true if attribute is valid
     */
    public boolean isValidAttribute(String attributeName) {
        return (getDefinition()).isValidAttribute(attributeName);
    }

    private void validateAttribute(String attributeName) {
        if (!isValidAttribute(attributeName)) {
            String message = "Attribute \"" + attributeName + "\" not defined for element with name \"" + getDefinition().getName()
                    + "\". Use one of \"" + getDefinition().getAttributeNames() + "\"";

            throw new MBInvalidAttributeNameException(message);
        }
    }

    /**
     * Working with the 'text()' attribute
     *
     * @return get 'text()' value
     */
    public String getBodyText() {
        if (isValidAttribute(TEXT_ATTRIBUTE)) {
            return getValueForAttribute(TEXT_ATTRIBUTE);
        }
        return null;
    }

    public void setBodyText(String text) {
        setAttributeValue(text, TEXT_ATTRIBUTE);
    }

    /**
     * Copying element state
     *
     * @param target {@link MBElement}
     */
    public void assignToElement(MBElement target) {
        if (!target.getDefinition().getName().equals(_definition.getName())) {
            String message = "Cannot assign element since types differ: " + target.getDefinition().getName() + " != " + _definition.getName()
                    + " (use assignByName:)";
            throw new MBCannotAssignException(message);
        }

        target._values.clear();
        target._values.putAll(_values);
        target.getElements().clear();
        copyChildrenInto(target);
    }

    @Override
    public String getUniqueId() {
        StringBuilder uid = new StringBuilder();
        uid.append(getDefinition().getName());
        for (MBAttributeDefinition def : _definition.getAttributes()) {
            String attrName = def.getName();
            if (!attrName.equals("xmlns")) {
                String attrValue = _values.get(attrName);
                uid.append('_');
                if (attrValue != null) {
                    uid.append(cookValue(attrValue));
                }
            }
        }
        uid.append(super.getUniqueId());

        return uid.toString();
    }

    @Override
    public void addAllPathsTo(Set<String> set, String currentPath) {
        String pathPrefix = currentPath + "/@";
        for (String attribute : _values.keySet()) {
            set.add(pathPrefix + attribute);
        }
        super.addAllPathsTo(set, currentPath);
    }

    @SuppressWarnings("unchecked")
    @Override
    public <T> T getValueForPathComponents(List<String> pathComponents, String originalPath, boolean nillIfMissing,
                                           List<String> translatedPathComponents) {
        if (pathComponents.size() > 0 && pathComponents.get(0).startsWith("@")) {
            String attrName = pathComponents.get(0);
            if (translatedPathComponents != null) translatedPathComponents.add(attrName);

            return (T) getValueForAttribute(attrName.substring(1));
        } else {
            return (T) super.getValueForPathComponents(pathComponents, originalPath, nillIfMissing, translatedPathComponents);
        }
    }

    public String cookValue(String uncooked) {
        // TODO Double check if this method was implemented properly

        if (uncooked == null) {
            return null;
        }

        StringBuilder cooked = new StringBuilder();
        for (int i = 0; i < uncooked.length(); i++) {
            char c = uncooked.charAt(i);
            if (c < 32 || c == '&' || c == '\'' || c > 126) {
                cooked.append("&#").append((int) c).append(';');
            } else {
                cooked.append(c);
            }
        }

        return cooked.toString();
    }

    public String attributeAsXml(String name, Object attrValue) {
        attrValue = StringEscapeUtils.escapeXml10((String) attrValue);

        if (attrValue == null) {
            return "";
        }

        return " " + name + "='" + attrValue + "'";
    }

    public void assignByName(MBElementContainer other) {
        other.deleteAllChildElements();

        MBElementDefinition def = getDefinition();
        for (MBAttributeDefinition attrDef : def.getAttributes()) {
            if (((MBElementDefinition) other.getDefinition()).isValidAttribute(attrDef.getName())) {
                ((MBElement) other).setAttributeValue(getValueForAttribute(attrDef.getName()), attrDef.getName());
            }
        }

        for (String elementName : getElements().keySet()) {
            for (MBElement src : getElements().get(elementName)) {
                MBElement newElem = other.createElementWithName(src.getDefinition().getName());
                src.assignByName(newElem);
            }
        }

    }

    @Override
    public String getName() {
        return getDefinition().getName();
    }

    @Override
    public String toString() {
        StringBuffer rt = new StringBuffer();
        return asXmlWithLevel(rt, 0).toString();
    }

    // Parcelable stuff

    private MBElement(Parcel in) {
        _values = new HashMap<String, String>();

        Bundle valueBundle = in.readBundle();

        for (String key : valueBundle.keySet()) {
            _values.put(key, valueBundle.getString(key));
        }

        _definition = in.readParcelable(MBElementDefinition.class.getClassLoader());
    }

    @Override
    public int describeContents() {
        return MBConstants.C_PARCELABLE_TYPE_ELEMENT;
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        Bundle valueBundle = new Bundle();

        for (String key : _values.keySet()) {
            valueBundle.putString(key, _values.get(key));
        }

        out.writeBundle(valueBundle);
        out.writeParcelable(_definition, flags);
    }

    public static final Parcelable.Creator<MBElement> CREATOR = new Creator<MBElement>() {
        @Override
        public MBElement[] newArray(int size) {
            return new MBElement[size];
        }

        @Override
        public MBElement createFromParcel(Parcel in) {
            return new MBElement(in);
        }
    };

    // End of parcelable stuff

}


text:
package com.mscharhag.errorhandling;

public class ErrorResponse {
    private final String code;
    private final String message;

    public ErrorResponse(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getMessage() {
        return message;
    }

    public String getCode() {
        return code;
    }
}


text:
.. ChoiceModels documentation master file, created by
   sphinx-quickstart on Thu Nov 30 14:23:50 2017.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

ChoiceModels
============

ChoiceModels is a Python library for discrete choice modeling, with utilities for sampling, simulation, and other ancillary tasks. It's part of the `Urban Data Science Toolkit <https://docs.udst.org>`__ (UDST).

v0.2.2, released April 17, 2020

Contents
--------

.. toctree::
   :maxdepth: 2

   getting-started
   choice-table-utilities
   multinomial-logit
   simulation-utilities
   distance-utilities


text:
photon.defineType(
    photon.binding.data.Property = function () {
    },
    /**
     * @lends photon.binding.data.PropertyBase.prototype
     */
    {
        beginInitialize : function(binding) {
        },
        endInitialize : function(binding) {

        },
        getDefaultBindingMode:function () {
            return photon.binding.data.DataBindingMode.OneWay;
        },
        getValue:function (binding) {
            return binding.getTarget()[binding.getExpression().getPropertyName()];
        },
        setValue:function (binding) {
            binding.getTarget()[binding.getExpression().getPropertyName()] = binding.getSourceValue();
        }
    });


text:
<?php

namespace JeroenNoten\LaravelAdminLte\Console;

use Illuminate\Console\Command;
use JeroenNoten\LaravelAdminLte\Console\PackageResources\AssetsResource;
use JeroenNoten\LaravelAdminLte\Console\PackageResources\AuthViewsResource;
use JeroenNoten\LaravelAdminLte\Console\PackageResources\BasicRoutesResource;
use JeroenNoten\LaravelAdminLte\Console\PackageResources\BasicViewsResource;
use JeroenNoten\LaravelAdminLte\Console\PackageResources\ConfigResource;
use JeroenNoten\LaravelAdminLte\Console\PackageResources\MainViewsResource;
use JeroenNoten\LaravelAdminLte\Console\PackageResources\TranslationsResource;

class AdminLteStatusCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'adminlte:status ';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Checks the installation status of the AdminLTE resources';

    /**
     * Array with all the available package resources.
     *
     * @var array
     */
    protected $pkgResources;

    /**
     * Array with the possible resources statuses.
     *
     * @var array
     */
    protected $status = [
        'installed' => [
            'label' => 'Installed',
            'legend' => 'The resource is installed and matches with the default package resource',
            'color' => 'green',
        ],
        'mismatch' => [
            'label' => 'Mismatch',
            'legend' => 'The installed resource mismatch the package resource (update available or resource modified)',
            'color' => 'yellow',
        ],
        'uninstalled' => [
            'label' => 'Not Installed',
            'legend' => 'The package resource is not installed',
            'color' => 'red',
        ],
    ];

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();

        // Fill the array with the package resources.

        $this->pkgResources = [
            'assets'       => new AssetsResource(),
            'config'       => new ConfigResource(),
            'translations' => new TranslationsResource(),
            'main_views'   => new MainViewsResource(),
            'auth_views'   => new AuthViewsResource(),
            'basic_views'  => new BasicViewsResource(),
            'basic_routes' => new BasicRoutesResource(),
        ];
    }

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        // Display the resources installation status.

        $this->showResourcesStatus();

        // Display the legends table.

        $this->line('');
        $this->showStatusLegends();
    }

    /**
     * Display the resources status.
     *
     * @return void
     */
    protected function showResourcesStatus()
    {
        // Define the table headers.

        $tblHeader = [
            $this->styleOutput('Package Resource', 'cyan'),
            $this->styleOutput('Description', 'cyan'),
            $this->styleOutput('Status', 'cyan'),
            $this->styleOutput('Required', 'cyan'),
        ];

        // Get the table rows.

        $tblContent = $this->getResourcesStatusRows();

        // Display the table.

        $this->line('');
        $this->table($tblHeader, $tblContent);
    }

    /**
     * Get the rows for the resources status table.
     *
     * @return array
     */
    protected function getResourcesStatusRows()
    {
        // Define the array that will hold the table rows.

        $tblContent = [];

        // Create a progress bar.

        $steps = count($this->pkgResources);
        $bar = $this->output->createProgressBar($steps);

        // Initialize the status check procedure.

        $this->line('Checking the resources installation ...');
        $bar->start();

        foreach ($this->pkgResources as $name => $resource) {

            // Fill the status row of the current resource.

            $tblContent[] = [
                $name,
                $resource->description,
                $this->getResourceStatus($resource),
                var_export($resource->required, true),
            ];

            // Advance the progress bar one step.

            $bar->advance();
        }

        // Finish the progress bar.

        $bar->finish();
        $this->line('');
        $this->line('All resources checked succesfully!');

        // Return the rows.

        return $tblContent;
    }

    /**
     * Get the installation status of a package resource.
     *
     * @param PackageResource $resource The package resource to check
     * @return string The resource status
     */
    protected function getResourceStatus($resource)
    {
        $status = $this->status['uninstalled'];

        if ($resource->installed()) {
            $status = $this->status['installed'];
        } elseif ($resource->exists()) {
            $status = $this->status['mismatch'];
        }

        return $this->styleOutput($status['label'], $status['color']);
    }

    /**
     * Display the legends of the possible status values.
     *
     * @return void
     */
    protected function showStatusLegends()
    {
        $this->line('Status legends:');

        // Create the table headers for the legends.

        $tblHeader = [
            $this->styleOutput('Status', 'cyan'),
            $this->styleOutput('Description', 'cyan'),
        ];

        // Create the table rows for the legends.

        $tblContent = [];

        foreach ($this->status as $status) {
            $tblContent[] = [
                $this->styleOutput($status['label'], $status['color']),
                $status['legend'],
            ];
        }

        // Display the legends table.

        $this->table($tblHeader, $tblContent);
    }

    /**
     * Give output style to some text.
     *
     * @param string $text The text to be styled
     * @param string $color The output color for the text
     * @return string The styled text
     */
    protected function styleOutput($text, $color)
    {
        return "<fg={$color}>{$text}</>";
    }
}


text:
import fs from 'fs-extra'
import path from 'path'
import Koa from 'koa'
import serve from 'koa-static'
import cookiesMiddleware from 'universal-cookie-koa'

import deepMerge from 'deepmerge'
import debug from 'debug'

import * as webpack from 'react-esc-webpack'
import defaultConfig from 'react-esc-config/default.server'
import { buildPaths } from 'react-esc-config/utils'

import { getMiddleware } from './utils'

const log = debug('react-esc:koa-server')

export default class KoaServer {

  config = defaultConfig

  withFullSSR = true

  setup = (config, cwd = null) => {
    this.config = deepMerge(this.config, config)

    this.config.utils.paths = buildPaths(this.config.utils.dirs, cwd, __dirname)

    // Check if the user want's with SSR
    this.withFullSSR = typeof this.config.server === 'boolean' ? this.config.server : true
  }

  /**
   * Builds a full SSR app
   *
   * @returns {Promise<module.Application|*>}
   */
  buildSsrApp = async() => {
    const app = new Koa()
    let clientInfo

    // Enable the cookies middleware
    app.use(cookiesMiddleware())

    // Load middlewares
    this.config.server.middlewares.forEach(mw => {
      const middleware = getMiddleware(app, this.config, mw)

      // If we get multiple middlewares then use them all
      if (Array.isArray(middleware)) {
        middleware.forEach(mw => app.use(mw))

      } else {
        app.use(middleware)
      }
    })

    if (this.config.env === 'development' && !this.config.server.useCompiled) {
      // Build the compiler config
      const compilerConfig = webpack.buildClientConfig(this.config)
      const compiler = webpack.buildCompiler(compilerConfig)

      // Enable webpack-dev and webpack-hot middleware
      const { output: { publicPath } } = compilerConfig

      // Catch the hash of the build in order to use it in the universal middleware
      compiler.plugin('done', (stats) => {
        // Create client info from the fresh build
        clientInfo = {
          assetsByChunkName: {
            app   : `app.${stats.hash}.js`,
            vendor: `vendor.${stats.hash}.js`,
          },
        }
      })

      const { utils: { paths }, webpack: { quiet, stats } } = this.config

      app.use(await this.getMiddleware(publicPath, quiet, compiler, paths, stats))

      // Serve static assets from ~/src/static since Webpack is unaware of
      // these files. This middleware doesn't need to be enabled outside
      // of development since this directory will be copied into ~/dist
      // when the application is compiled.
      app.use(serve(this.config.utils.paths.src('static')))

    } else {
      log('Read client info.')

      // Get assets from client_info.json
      clientInfo = fs.readJsonSync(this.config.utils.paths.dist(this.config.server.clientInfo), { throw: false })

      if (!clientInfo) {
        clientInfo = {}
      }

      // Serve all the statis files if enabled
      if (this.config.server.serve) {
        const servePublic = this.config.utils.paths.public()
        log(`Enabling serving of the static files in "${servePublic}"`)
        app.use(serve(servePublic))
      }
    }

    const universalMiddleware = await webpack.middlewares.universalMiddleware(this.config)

    app.use(universalMiddleware(() => clientInfo))

    return app
  }

  /**
   * Builds a dev app
   */
  buildDevApp = async() => {
    const app = new Koa()

    // Build the compiler config
    const compilerConfig = webpack.buildClientConfig(this.config)
    const compiler = webpack.buildCompiler(compilerConfig)

    const { output: { publicPath } } = compilerConfig
    const { utils: { paths }, webpack: { quiet, stats } } = this.config

    const middleware = await this.getMiddleware(publicPath, quiet, compiler, paths, stats)

    // Enable webpack-dev and webpack-hot middleware
    app.use(middleware)

    // This serves the created index html for all routes
    app.use(async(ctx) => {
      const filename = path.resolve(compilerConfig.output.path, 'index.html')

      ctx.type = 'html'
      ctx.body = middleware.devMiddleware.fileSystem.createReadStream(filename)
    })

    return app
  }

  start = async(app = null, { port = null, host = null } = {}) => {
    let portAndHostInfoFrom = 'server'

    if (app === null) {
      if (this.withFullSSR) {
        app = await this.buildSsrApp()

      } else {
        app = await this.buildDevApp()

        portAndHostInfoFrom = 'devServer'
      }
    }

    if (port === null) {
      ({ port } = this.config[portAndHostInfoFrom])

    }

    if (host === null) {
      ({ host } = this.config[portAndHostInfoFrom])
    }

    app.listen(port)

    log(`Server is now running at http://${host}:${port}.`)
  }

  /**
   * Get's a configured middleware
   *
   * @param publicPath
   * @param quiet
   * @param compiler
   * @param paths
   * @param stats
   */
  getMiddleware = async(publicPath, quiet, compiler, paths, stats) => webpack.middleware({
    config: {
      devMiddleware: {
        publicPath,
        contentBase: paths.src(),
        hot        : true,
        logLevel   : quiet ? 'silent' : 'info',
        lazy       : false,
        headers    : { 'Access-Control-Allow-Origin': '*' },
        stats,
      },
    },
    compiler,
  })

}


text:
package ru.job4j.list;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * Created for testing SimpleQueue class.
 *
 * @author abondarev.
 * @since 04.09.2017.
 */
public class SimpleQueueTest {

    /**
     * Tests method push().
     */
    @Test
    public void whenCalledPushThenSizeIncrease() {
        SimpleQueue<Integer> ss = new SimpleQueue<>();
        ss.push(3);
        int result = ss.size();
        assertThat(result, is(1));
    }

    /**
     * Test method poll().
     */
    @Test
    public void whenCalledPollShouldBeReturnedElementAndSizeDecrease() {
        SimpleQueue<Integer> ss = new SimpleQueue<>();
        ss.push(3);
        int resultOne = ss.poll();
        assertThat(resultOne, is(3));
        int resultTwo = ss.size();
        assertThat(resultTwo, is(0));
    }
}


text:
/**
 * @requires SuperMap/ServiceEventArgs.js
 * @requires SuperMap/REST/EditFeaturesResult.js
 */

/**
 * Class: SuperMap.REST.TransferSolutionEventArgs
 * 交通换乘方案查询结果类。
 *
 * Inherits from:
 *  - <SuperMap.ServiceEventArgs>
 */
SuperMap.REST.TransferSolutionEventArgs = SuperMap.Class(SuperMap.ServiceEventArgs, {

    /**
     * APIProperty: result
     * {<SuperMap.REST.TransferSolutionResult>} 服务端返回的交通换乘方案查询的结果数据。
     */
    result: null,

    /**
     * Constructor: SuperMap.REST.TransferSolutionEventArgs
     * 交通换乘事件类构造函数。
     *
     * Parameters:
     * result - {<SuperMap.REST.TransferSolutionResult>} 服务端返回的交通换乘结果数据。
     * originResult - {Object} 服务端返回的用 JSON 对象表示的交通换乘结果数据。
     */
    initialize: function(result, originResult) {
        SuperMap.ServiceEventArgs.prototype.initialize.apply(this, [originResult]);
        var me = this;
        me.result = result;
    },

    /**
     * APIMethod: destroy
     * 释放资源,将引用资源的属性置空。
     */
    destroy: function() {
        SuperMap.ServiceEventArgs.prototype.destroy.apply(this);
        SuperMap.Util.reset(this);
    },

    CLASS_NAME: "SuperMap.REST.TransferSolutionEventArgs"
});