text:
package com.xqbase.java;

import com.xqbase.java.annotation.GuardedBy;
import com.xqbase.java.annotation.ThreadSafe;

import java.util.concurrent.TimeUnit;

/**
 * Pool entry containing a pool connection object along with its route.
 *

 * The connection contained by the pool entry may have an expiration time which
 * can be either set upon construction time or updated with
 * the {@link #updateExpiry(long, java.util.concurrent.TimeUnit)}.
 *

 * Pool entry may also have an object associated with it that represents
 * a connection state (usually a security principal or a unique token identifying
 * the user whose credentials have been used while establishing the connection).
 *
 * @param <T> the route type that represents the opposite endpoint of a pooled
 *   connection.
 * @param <C> the connection type.
 * @since 4.2
 */
@ThreadSafe
public abstract class PoolEntry<T, C> {

    private final String id;
    private final T route;
    private final C conn;
    private final long created;
    private final long validUnit;

    @GuardedBy("this")
    private long updated;

    @GuardedBy("this")
    private long expiry;

    private volatile Object state;

    /**
     * Creates new <tt>PoolEntry</tt> instance.
     *
     * @param id unique identifier of the pool entry. May be null.
     * @param route route to the opposite endpoint.
     * @param conn the connection.
     * @param timeToLive maximum time to live. May be zero if the connection
     *   does not have an expiry deadline.
     * @param tunit time unit.
     */
    public PoolEntry(final String id, final T route, final C conn,
                     final long timeToLive, final TimeUnit tunit) {
        super();
        this.id = id;
        this.route = route;
        this.conn = conn;
        this.created = System.currentTimeMillis();
        if (timeToLive > 0) {
            this.validUnit = this.created + tunit.toMillis(timeToLive);
        } else {
            this.validUnit = Long.MAX_VALUE;
        }
        this.expiry = this.validUnit;
    }

    /**
     * Creates new <tt>PoolEntry</tt> instance without an expiry deadline.
     *
     * @param id unique identifier of the pool entry. May be null.
     * @param route route to the opposite endpoint.
     * @param conn the connection.
     */
    public PoolEntry(final String id, final T route, final C conn) {
        this(id, route, conn, 0, TimeUnit.MILLISECONDS);
    }

    public String getId() {
        return this.id;
    }

    public T getRoute() {
        return this.route;
    }

    public C getConnection() {
        return this.conn;
    }

    public long getCreated() {
        return this.created;
    }

    public long getValidUnit() {
        return this.validUnit;
    }

    public Object getState() {
        return this.state;
    }

    public void setState(final Object state) {
        this.state = state;
    }

    public synchronized long getUpdated() {
        return this.updated;
    }

    public synchronized long getExpiry() {
        return this.expiry;
    }

    public synchronized void updateExpiry(final long time, final TimeUnit tunit) {
        this.updated = System.currentTimeMillis();
        final long newExpiry;
        if (time > 0) {
            newExpiry = this.updated + tunit.toMillis(time);
        } else {
            newExpiry = Long.MAX_VALUE;
        }
        this.expiry = Math.min(newExpiry, this.validUnit);
    }

    public synchronized boolean isExpired(final long now) {
        return now >= this.expiry;
    }

    /**
     * Invalidates the pool entry and closes the pooled connection associated
     * with it.
     */
    public abstract void close();

    /**
     * Returns true if the pool entry has been invalidated.
     */
    public abstract boolean isClosed();

    @Override
    public String toString() {
        final StringBuilder buffer = new StringBuilder();
        buffer.append("[id:");
        buffer.append(this.id);
        buffer.append("][route:");
        buffer.append(this.route);
        buffer.append("][state:");
        buffer.append(this.state);
        buffer.append("]");
        return buffer.toString();
    }

}


text:
"use strict";

// our setup function adds behind-the-scenes bits to the config that all of our
// examples need
const { setup } = require("../../util");

module.exports = new Promise((resolve) => {
  resolve(
    setup({
      context: __dirname,
      entry: "./app.js",
      devServer: {},
    })
  );
});

redpajama_set_name: RedPajamaGithub


text:
package jfdi.parser.exceptions;

@SuppressWarnings("serial")
public class NoTaskIdFoundException extends Exception {
    private String input = null;

    public NoTaskIdFoundException(String input) {
        this.input = input;
    }

    public String getInput() {
        return this.input;
    }
}


text:
package org.apache.hadoop.hbase.ipc;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.phoenix.query.QueryServices;
import org.apache.phoenix.query.QueryServicesOptions;

import com.google.common.annotations.VisibleForTesting;

/**
 * {@link RpcScheduler} that first checks to see if this is an index or metedata update before passing off the
 * call to the delegate {@link RpcScheduler}.
 */
public class PhoenixRpcScheduler extends RpcScheduler {

    // copied from org.apache.hadoop.hbase.ipc.SimpleRpcScheduler in HBase 0.98.4
    private static final String CALL_QUEUE_HANDLER_FACTOR_CONF_KEY = "ipc.server.callqueue.handler.factor";
    private static final String CALLQUEUE_LENGTH_CONF_KEY = "ipc.server.max.callqueue.length";
    private static final int DEFAULT_MAX_CALLQUEUE_LENGTH_PER_HANDLER = 10;

    private RpcScheduler delegate;
    private int indexPriority;
    private int metadataPriority;
    private RpcExecutor indexCallExecutor;
    private RpcExecutor metadataCallExecutor;
    private int port;

    public PhoenixRpcScheduler(Configuration conf, RpcScheduler delegate, int indexPriority, int metadataPriority) {
        // copied from org.apache.hadoop.hbase.ipc.SimpleRpcScheduler in HBase 0.98.4
    	int indexHandlerCount = conf.getInt(QueryServices.INDEX_HANDLER_COUNT_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_HANDLER_COUNT);
    	int metadataHandlerCount = conf.getInt(QueryServices.METADATA_HANDLER_COUNT_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_HANDLER_COUNT);
        int maxIndexQueueLength =  conf.getInt(CALLQUEUE_LENGTH_CONF_KEY, indexHandlerCount*DEFAULT_MAX_CALLQUEUE_LENGTH_PER_HANDLER);
        int maxMetadataQueueLength =  conf.getInt(CALLQUEUE_LENGTH_CONF_KEY, metadataHandlerCount*DEFAULT_MAX_CALLQUEUE_LENGTH_PER_HANDLER);
        float callQueuesHandlersFactor = conf.getFloat(CALL_QUEUE_HANDLER_FACTOR_CONF_KEY, 0);
        int numIndexQueues = Math.max(1, Math.round(indexHandlerCount * callQueuesHandlersFactor));
        int numMetadataQueues = Math.max(1, Math.round(metadataHandlerCount * callQueuesHandlersFactor));

        this.indexPriority = indexPriority;
        this.metadataPriority = metadataPriority;
        this.delegate = delegate;
        this.indexCallExecutor = new BalancedQueueRpcExecutor("Index", indexHandlerCount, numIndexQueues, maxIndexQueueLength);
        this.metadataCallExecutor = new BalancedQueueRpcExecutor("Metadata", metadataHandlerCount, numMetadataQueues, maxMetadataQueueLength);
    }

    @Override
    public void init(Context context) {
        delegate.init(context);
        this.port = context.getListenerAddress().getPort();
    }

    @Override
    public void start() {
        delegate.start();
        indexCallExecutor.start(port);
        metadataCallExecutor.start(port);
    }

    @Override
    public void stop() {
        delegate.stop();
        indexCallExecutor.stop();
        metadataCallExecutor.stop();
    }

    @Override
    public boolean dispatch(CallRunner callTask) throws InterruptedException, IOException {
        RpcServer.Call call = callTask.getCall();
        int priority = call.header.getPriority();
        if (indexPriority == priority) {
            return indexCallExecutor.dispatch(callTask);
        } else if (metadataPriority == priority) {
            return metadataCallExecutor.dispatch(callTask);
        } else {
            return delegate.dispatch(callTask);
        }
    }

    @Override
    public int getGeneralQueueLength() {
        // not the best way to calculate, but don't have a better way to hook
        // into metrics at the moment
        return this.delegate.getGeneralQueueLength() + this.indexCallExecutor.getQueueLength() + this.metadataCallExecutor.getQueueLength();
    }

    @Override
    public int getPriorityQueueLength() {
        return this.delegate.getPriorityQueueLength();
    }

    @Override
    public int getReplicationQueueLength() {
        return this.delegate.getReplicationQueueLength();
    }

    @Override
    public int getActiveRpcHandlerCount() {
        return this.delegate.getActiveRpcHandlerCount() + this.indexCallExecutor.getActiveHandlerCount() + this.metadataCallExecutor.getActiveHandlerCount();
    }

    @Override
    public long getNumGeneralCallsDropped() {
        return delegate.getNumGeneralCallsDropped();
    }

    @Override
    public long getNumLifoModeSwitches() {
        return delegate.getNumLifoModeSwitches();
    }

    @VisibleForTesting
    public void setIndexExecutorForTesting(RpcExecutor executor) {
        this.indexCallExecutor = executor;
    }

    @VisibleForTesting
    public void setMetadataExecutorForTesting(RpcExecutor executor) {
        this.metadataCallExecutor = executor;
    }

    @Override
    public int getReadQueueLength() {
        return delegate.getReadQueueLength();
    }

    @Override
    public int getWriteQueueLength() {
        return delegate.getWriteQueueLength();
    }

    @Override
    public int getScanQueueLength() {
        return delegate.getScanQueueLength();
    }

    @Override
    public int getActiveReadRpcHandlerCount() {
        return delegate.getActiveReadRpcHandlerCount();
    }

    @Override
    public int getActiveWriteRpcHandlerCount() {
        return delegate.getActiveWriteRpcHandlerCount();
    }

    @Override
    public int getActiveScanRpcHandlerCount() {
        return delegate.getActiveScanRpcHandlerCount();
    }

}


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

using System;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
    internal sealed class SourceUserDefinedOperatorSymbol : SourceUserDefinedOperatorSymbolBase
    {
        public static SourceUserDefinedOperatorSymbol CreateUserDefinedOperatorSymbol(
            SourceMemberContainerTypeSymbol containingType,
            OperatorDeclarationSyntax syntax,
            DiagnosticBag diagnostics)
        {
            var location = syntax.OperatorToken.GetLocation();

            string name = OperatorFacts.OperatorNameFromDeclaration(syntax);

            return new SourceUserDefinedOperatorSymbol(
                containingType, name, location, syntax, diagnostics,
                syntax.Body == null && syntax.ExpressionBody != null);
        }

        // NOTE: no need to call WithUnsafeRegionIfNecessary, since the signature
        // is bound lazily using binders from a BinderFactory (which will already include an
        // UnsafeBinder, if necessary).
        private SourceUserDefinedOperatorSymbol(
            SourceMemberContainerTypeSymbol containingType,
            string name,
            Location location,
            OperatorDeclarationSyntax syntax,
            DiagnosticBag diagnostics,
            bool isExpressionBodied) :
            base(
                MethodKind.UserDefinedOperator,
                name,
                containingType,
                location,
                syntax,
                diagnostics)
        {
            CheckForBlockAndExpressionBody(
                syntax.Body, syntax.ExpressionBody, syntax, diagnostics);

            if (name != WellKnownMemberNames.EqualityOperatorName && name != WellKnownMemberNames.InequalityOperatorName)
            {
                CheckFeatureAvailabilityAndRuntimeSupport(syntax, location, hasBody: syntax.Body != null || syntax.ExpressionBody != null, diagnostics: diagnostics);
            }
        }

        internal new OperatorDeclarationSyntax GetSyntax()
        {
            Debug.Assert(syntaxReferenceOpt != null);
            return (OperatorDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
        }

        protected override ParameterListSyntax ParameterListSyntax
        {
            get
            {
                return GetSyntax().ParameterList;
            }
        }

        protected override TypeSyntax ReturnTypeSyntax
        {
            get
            {
                return GetSyntax().ReturnType;
            }
        }

        internal override bool GenerateDebugInfo
        {
            get { return true; }
        }
    }
}


text:
int main() {
#if defined(VIEWPORTER_CLIENT_PROTOCOL_H) &&                                   \
    defined(VIEWPORTER_SERVER_PROTOCOL_H)
  return 0;
#else
  return 1;
#endif
}


text:
var
	_io = null,
	doc = document;

export class Lobby {
	constructor(io) {
		_io = io;
		this._socketReady = false;

		this.handleEvents();
		this.setupSocket();
	}

	hide() {
		doc.querySelector('.lobby').classList.add('hidden');
	}

	handleEvents() {
		doc.querySelector('.choice-screen .btn.join').addEventListener(
				'click',this.onJoinChoice.bind(this));
		doc.querySelector('.choice-screen .btn.create').addEventListener(
				'click', this.onCreateChoice.bind(this));
		doc.querySelector('.join-screen .btn').addEventListener(
				'click',this.onTokenSend.bind(this));
	}

	setupSocket() {
		_io.on('game:player-connected', this.onPlayerConnected.bind(this));
		_io.on('game:token-created', this.onTokenCreated.bind(this));
		_io.on('game:error', this.onGameError.bind(this));
		_io.on('game:error', this.onGameError.bind(this));
	}

	onPlayerConnected(/*data*/) {
		this._socketReady = true;
	}

	onJoinChoice() {
		if (this._socketReady) {
			doc.querySelector('.join-screen').classList.add('onscreen');
			sessionStorage.setItem('player', 'right');
		}
	}

	onCreateChoice() {
		if (this._socketReady) {
			sessionStorage.setItem('player', 'left');
			var sendCanvas = {
				height : window.innerHeight,
				width : window.innerWidth
			};
			_io.emit('player:create-session', sendCanvas);
		}
	}

	onTokenCreated(data) {
		doc.querySelector('.create-screen .token').textContent = data.token;
		doc.querySelector('.create-screen').classList.add('onscreen');
	}

	onTokenSend() {
		var sendCanvas = {
			height : window.innerHeight,
			width : window.innerWidth
		};
		_io.emit('player:joining', {
			token: doc.querySelector('.join-screen input').value.toUpperCase(),
			canvasOpponent : sendCanvas
		});
	}

	onGameError(data) {
		var notifier = doc.querySelector('.notifier');
		if (notifier.classList.contains('visible')) {
			return;
		}
		notifier.textContent = data.message;
		notifier.classList.add('visible');
		setTimeout(() => {
			notifier.classList.remove('visible');
		}, 2500);
	}
}


text:
import 'core-js/client/shim';
import 'zone.js/dist/zone';

import '@angular/common';
import 'rxjs';

import './index.scss';

import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';

if (process.env.NODE_ENV === 'production') {
  enableProdMode();
} else {
  Error['stackTraceLimit'] = Infinity; // eslint-disable-line dot-notation
  require('zone.js/dist/long-stack-trace-zone');
}

platformBrowserDynamic().bootstrapModule(AppModule);


text:
<?php

require_once 'core/loader.php';

class CurryClass
{
	/**
	 * Throw exception that was going to set value to field which cannot be accessed or not difined
	 *
	 * @param string $name
	 * @throws MemberInaccessibleException
	 * @throws MemberUndefinedException
	 * @return void
	 */
	public function __get($name)
	{
		$vars = get_object_vars($this);
		if (array_key_exists($name, $vars)) {
			throw new MemberInaccessibleException(get_class($this), $name);
		} else {
			throw new MemberUndefinedException(get_class($this), $name);
		}
	}

	/**
	 * Throw exception that was going to get value by field which cannot be accessed or not difined
	 *
	 * @param string $name
	 * @param mixed $value
	 * @throws MemberInaccessibleException
	 * @throws MemberUndefinedException
	 */
	public function __set($name, $value)
	{
		$vars = get_object_vars($this);

		if (array_key_exists($name, $vars)) {
			throw new MemberInaccessibleException(get_class($this), $name);
		} else {
			throw new MemberUndefinedException(get_class($this), $name);
		}
	}

	/**
	 * Throw exception that was going to call method which cannot be accessed or not difined
	 *
	 * @param string $name
	 * @param array $args
	 * @throws MemberInaccessibleException
	 * @throws MemberUndefinedException
	 */
	public function __call($name, $args)
	{
		$methods = get_class_methods($this);

		if (in_array($name, $methods)) {
			throw new MemberInaccessibleException(get_class($this), $name);
		} else {
			throw new MemberUndefinedException(get_class($this), $name);
		}
	}

	/**
	 * Check whether argument type is array or ArrayObject instance
	 *
	 * @param string $methodName
	 * @param int $argumentNo
	 * @param mixed $argument
	 * @return boolean
	 * @throws ArgumentInvalidException
	 */
	protected function _checkArgumentIsArray($methodName, $argumentNo, $argument)
	{
		if (!is_array($argument) && !($argument instanceof ArrayObject)) {
			throw new ArgumentInvalidException($methodName, $argument, $argumentNo, 'array or ArrayObject');
		}
		return true;
	}

}


text:
module.exports = function(resolvedPath, from) {
    return resolvedPath;
};


text:
package com.intellij.codeInspection.dataFlow;

import com.intellij.codeInspection.dataFlow.rangeSet.LongRangeSet;
import com.intellij.codeInspection.dataFlow.value.*;
import com.intellij.codeInspection.dataFlow.value.DfaRelationValue.RelationType;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import one.util.streamex.LongStreamEx;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.*;

import static com.intellij.codeInspection.dataFlow.DfaFactType.RANGE;

/**
 * @author peter
 */
class StateMerger {
  private static final int COMPLEXITY_LIMIT = 250000;
  private final Map<DfaMemoryStateImpl, Set<Fact>> myFacts = ContainerUtil.newIdentityHashMap();
  private final Map<DfaMemoryState, Map<DfaVariableValue, DfaMemoryStateImpl>> myCopyCache = ContainerUtil.newIdentityHashMap();

  @Nullable
  List<DfaMemoryStateImpl> mergeByFacts(@NotNull List<DfaMemoryStateImpl> states) {
    MultiMap<Fact, DfaMemoryStateImpl> statesByFact = createFactToStateMap(states);
    Set<Fact> facts = statesByFact.keySet();

    int complexity = 0;

    for (final Fact fact : facts) {
      if (fact.myPositive) continue;
      Collection<DfaMemoryStateImpl> negativeStates = statesByFact.get(fact);
      if (negativeStates.size() == states.size()) continue;
      Collection<DfaMemoryStateImpl> positiveStates = statesByFact.get(fact.getPositiveCounterpart());
      if (positiveStates.isEmpty()) continue;

      ProgressManager.checkCanceled();

      MultiMap<CompactFactSet, DfaMemoryStateImpl> statesByUnrelatedFacts1 = mapByUnrelatedFacts(fact, negativeStates, facts);
      MultiMap<CompactFactSet, DfaMemoryStateImpl> statesByUnrelatedFacts2 = mapByUnrelatedFacts(fact, positiveStates, facts);

      complexity += StreamEx.of(statesByUnrelatedFacts1, statesByUnrelatedFacts2).flatCollection(MultiMap::keySet)
        .mapToInt(CompactFactSet::size).sum();
      if (complexity > COMPLEXITY_LIMIT) return null;

      Replacements replacements = new Replacements(states);
      for (Map.Entry<CompactFactSet, Collection<DfaMemoryStateImpl>> entry : statesByUnrelatedFacts1.entrySet()) {
        final Collection<DfaMemoryStateImpl> group1 = entry.getValue();
        final Collection<DfaMemoryStateImpl> group2 = statesByUnrelatedFacts2.get(entry.getKey());
        if (group1.isEmpty() || group2.isEmpty()) continue;

        final Collection<DfaMemoryStateImpl> group = ContainerUtil.newArrayList(ContainerUtil.concat(group1, group2));

        replacements.stripAndMerge(group, original -> {
          DfaMemoryStateImpl copy = original.createCopy();
          fact.removeFromState(copy);
          if (fact instanceof EqualityFact) {
            restoreOtherInequalities((EqualityFact)fact, group, copy);
          }
          return copy;
        });
      }

      if (replacements.hasMerges()) return replacements.getMergeResult();
    }
    return null;
  }

  @NotNull
  private MultiMap<Fact, DfaMemoryStateImpl> createFactToStateMap(@NotNull List<DfaMemoryStateImpl> states) {
    MultiMap<Fact, DfaMemoryStateImpl> statesByFact = MultiMap.createLinked();
    Map<DfaConstValue, Map<DfaVariableValue, Set<DfaMemoryStateImpl>>> constantVars = new HashMap<>();
    for (DfaMemoryStateImpl state : states) {
      ProgressManager.checkCanceled();
      for (Fact fact : getFacts(state)) {
        statesByFact.putValue(fact, state);
        DfaConstValue value = fact.comparedToConstant();
        if (value != null) {
          constantVars.computeIfAbsent(value, k -> new HashMap<>())
            .computeIfAbsent(fact.myVar, k -> ContainerUtil.newIdentityTroveSet()).add(state);
        }
      }
    }

    for (final Fact fact : new ArrayList<>(statesByFact.keySet())) {
      if (fact.myPositive) continue;
      Collection<DfaMemoryStateImpl> negativeStates = statesByFact.get(fact);
      Collection<DfaMemoryStateImpl> positiveStates = statesByFact.get(fact.getPositiveCounterpart());
      if (isComparisonOfVariablesComparedWithConstant(fact, constantVars, positiveStates, negativeStates)) {
        statesByFact.remove(fact);
        statesByFact.remove(fact.getPositiveCounterpart());
      }
    }
    return statesByFact;
  }

  /**
   * Returns true if fact is {@link EqualityFact} which compares two variables, which both are known to be compared with
   * the same constant for all states. In this case the fact looks implied (like "a == null && b == null" implies "a == b")
   * and it's unnecessary to process it separately (processing "a == null" and "b == null" would be enough).
   *
   * @param fact fact to check
   * @param constantVars constant vars map
   * @param positiveStates states for which fact is positive
   * @param negativeStates states for which fact is negative
   * @return true if fact is {@link EqualityFact} which compares two variables which were compared with some constant
   */
  private static boolean isComparisonOfVariablesComparedWithConstant(Fact fact,
                                                                     Map<DfaConstValue, Map<DfaVariableValue, Set<DfaMemoryStateImpl>>> constantVars,
                                                                     Collection<DfaMemoryStateImpl> positiveStates,
                                                                     Collection<DfaMemoryStateImpl> negativeStates) {
    if (!(fact instanceof EqualityFact) || !(((EqualityFact)fact).myArg instanceof DfaVariableValue)) return false;
    DfaVariableValue var1 = fact.myVar;
    DfaVariableValue var2 = (DfaVariableValue)((EqualityFact)fact).myArg;
    for (Map<DfaVariableValue, Set<DfaMemoryStateImpl>> map : constantVars.values()) {
      Set<DfaMemoryStateImpl> states1 = map.get(var1);
      Set<DfaMemoryStateImpl> states2 = map.get(var2);
      if (states1 != null && states2 != null &&
          states1.containsAll(negativeStates) && states1.containsAll(positiveStates) &&
          states2.containsAll(negativeStates) && states2.containsAll(positiveStates)) {
        return true;
      }
    }
    return false;
  }

  @NotNull
  private MultiMap<CompactFactSet, DfaMemoryStateImpl> mapByUnrelatedFacts(@NotNull Fact fact,
                                                                      @NotNull Collection<DfaMemoryStateImpl> states,
                                                                      @NotNull Set<Fact> interestingFacts) {
    MultiMap<CompactFactSet, DfaMemoryStateImpl> statesByUnrelatedFacts = MultiMap.createLinked();
    for (DfaMemoryStateImpl state : states) {
      statesByUnrelatedFacts.putValue(getUnrelatedFacts(fact, state, interestingFacts), state);
    }
    return statesByUnrelatedFacts;
  }

  @NotNull
  private CompactFactSet getUnrelatedFacts(@NotNull final Fact fact,
                                           @NotNull DfaMemoryStateImpl state,
                                           @NotNull Set<Fact> interestingFacts) {
    final ArrayList<Fact> result = new ArrayList<>();
    for (Fact other : getFacts(state)) {
      if (!fact.invalidatesFact(other) && interestingFacts.contains(other)) {
        result.add(other);
      }
    }
    return new CompactFactSet(state.getFactory(), result);
  }

  private void restoreOtherInequalities(@NotNull EqualityFact removedFact,
                                        @NotNull Collection<DfaMemoryStateImpl> mergedGroup,
                                        @NotNull DfaMemoryStateImpl state) {
    Set<DfaConstValue> inequalitiesToRestore = null;
    for (DfaMemoryStateImpl member : mergedGroup) {
      Set<Fact> memberFacts = getFacts(member);
      if (memberFacts.contains(removedFact)) {
        Set<DfaConstValue> otherInequalities = getOtherInequalities(removedFact, memberFacts, member);
        if (inequalitiesToRestore == null) {
          inequalitiesToRestore = otherInequalities;
        } else {
          inequalitiesToRestore.retainAll(otherInequalities);
        }
      }
    }
    if (inequalitiesToRestore != null) {
      DfaRelationValue.Factory relationFactory = state.getFactory().getRelationFactory();
      for (DfaConstValue toRestore : inequalitiesToRestore) {
        state.applyCondition(relationFactory.createRelation(removedFact.myVar, RelationType.NE, toRestore));
      }
    }
  }

  @NotNull
  private static Set<DfaConstValue> getOtherInequalities(@NotNull EqualityFact removedFact,
                                                         @NotNull Set<Fact> memberFacts,
                                                         @NotNull DfaMemoryStateImpl state) {
    Set<DfaConstValue> otherInequalities = ContainerUtil.newLinkedHashSet();
    Set<DfaValue> eqValues = new HashSet<>(state.getEquivalentValues(removedFact.myArg));
    for (Fact candidate : memberFacts) {
      if (!(candidate instanceof EqualityFact)) continue;
      EqualityFact equality = (EqualityFact)candidate;
      if (!equality.myPositive &&
          equality.myVar == removedFact.myVar &&
          equality.myArg instanceof DfaConstValue &&
          !eqValues.contains(equality.myArg)) {
        otherInequalities.add((DfaConstValue)equality.myArg);
      }
    }
    return otherInequalities;
  }

  @Nullable
  List<DfaMemoryStateImpl> mergeByRanges(List<DfaMemoryStateImpl> states) {
    Map<DfaVariableValue, Set<LongRangeSet>> ranges = createRangeMap(states);
    boolean changed = false;
    // For every variable with more than one range, try to unite range info and see if some states could be merged after that
    for (Map.Entry<DfaVariableValue, Set<LongRangeSet>> entry : ranges.entrySet()) {
      if (entry.getValue().size() > 1) {
        List<DfaMemoryStateImpl> updated = mergeIndependentRanges(states, entry.getKey());
        if (updated != null) {
          states = updated;
          changed = true;
        }
      }
    }
    return changed ? states : null;
  }

  @NotNull
  private static Map<DfaVariableValue, Set<LongRangeSet>> createRangeMap(List<DfaMemoryStateImpl> states) {
    Map<DfaVariableValue, Set<LongRangeSet>> ranges = new LinkedHashMap<>();
    for (DfaMemoryStateImpl state : states) {
      ProgressManager.checkCanceled();
      state.forVariableStates((varValue, varState) -> {
        LongRangeSet range = varState.getFact(RANGE);
        if (range != null) {
          ranges.computeIfAbsent(varValue, k -> new HashSet<>()).add(range);
        }
      });
    }
    return ranges;
  }

  @Nullable
  private List<DfaMemoryStateImpl> mergeIndependentRanges(List<DfaMemoryStateImpl> states, DfaVariableValue var) {
    class Record {
      final DfaMemoryStateImpl myState;
      final LongRangeSet myRange;
      final Set<EqualityFact> myCommonEqualities;

      Record(DfaMemoryStateImpl state, LongRangeSet range, Set<EqualityFact> commonEqualities) {
        myState = state;
        myRange = range;
        myCommonEqualities = commonEqualities;
      }

      Set<EqualityFact> getEqualityFacts() {
        return StreamEx.of(getFacts(myState)).select(EqualityFact.class)
          .filter(fact -> fact.myVar == var || fact.myArg == var).toSet();
      }

      Record unite(Record other) {
        Set<EqualityFact> equalities = myCommonEqualities == null ? getEqualityFacts() : myCommonEqualities;
        equalities.retainAll(other.getEqualityFacts());
        return new Record(myState, myRange.unite(other.myRange), equalities);
      }

      DfaMemoryStateImpl getState() {
        if(myCommonEqualities != null) {
          myFacts.remove(myState);
          myState.removeEquivalenceForVariableAndWrappers(var);
          myState.setVariableState(var, myState.getVariableState(var).withFact(RANGE, myRange));
          for (EqualityFact equality : myCommonEqualities) {
            equality.applyTo(myState);
          }
        }
        return myState;
      }
    }

    ProgressManager.checkCanceled();
    Map<DfaMemoryStateImpl, Record> merged = new LinkedHashMap<>();
    for (DfaMemoryStateImpl state : states) {
      DfaVariableState variableState = state.getVariableState(var);
      LongRangeSet range = variableState.getFact(RANGE);
      if (range == null) {
        range = LongRangeSet.fromType(var.getType());
        if (range == null) return null;
      }
      merged.merge(copyWithoutVar(state, var), new Record(state, range, null), Record::unite);
    }
    return merged.size() == states.size() ? null : StreamEx.ofValues(merged).map(Record::getState).toList();
  }

  @NotNull
  private DfaMemoryStateImpl copyWithoutVar(@NotNull DfaMemoryStateImpl state, @NotNull DfaVariableValue var) {
    Map<DfaVariableValue, DfaMemoryStateImpl> map = myCopyCache.computeIfAbsent(state, k -> ContainerUtil.newIdentityHashMap());
    DfaMemoryStateImpl copy = map.get(var);
    if (copy == null) {
      copy = state.createCopy();
      copy.flushVariable(var);
      map.put(var, copy);
    }
    return copy;
  }

  @NotNull
  private Set<Fact> getFacts(@NotNull DfaMemoryStateImpl state) {
    return myFacts.computeIfAbsent(state, StateMerger::doGetFacts);
  }

  @NotNull
  private static Set<Fact> doGetFacts(DfaMemoryStateImpl state) {
    Set<Fact> result = ContainerUtil.newLinkedHashSet();

    IdentityHashMap<EqClass, EqClassInfo> classInfo = new IdentityHashMap<>();

    for (EqClass eqClass : state.getNonTrivialEqClasses()) {
      EqClassInfo info = classInfo.computeIfAbsent(eqClass, EqClassInfo::new);
      DfaValue constant = info.constant;
      List<DfaVariableValue> vars = info.vars;
      int size = vars.size();
      for (int i = 0; i < size; i++) {
        DfaVariableValue var = vars.get(i);
        if (constant != null) {
          result.add(Fact.createEqualityFact(var, constant));
        }
        for (int j = i + 1; j < size; j++) {
          DfaVariableValue eqVar = vars.get(j);
          result.add(Fact.createEqualityFact(var, eqVar));
        }
      }
    }

    for (DistinctPairSet.DistinctPair classPair : state.getDistinctClassPairs()) {
      EqClassInfo info1 = classInfo.computeIfAbsent(classPair.getFirst(), EqClassInfo::new);
      EqClassInfo info2 = classInfo.computeIfAbsent(classPair.getSecond(), EqClassInfo::new);

      for (DfaVariableValue var1 : info1.vars) {
        for (DfaVariableValue var2 : info2.vars) {
          result.add(new EqualityFact(var1, false, var2));
          result.add(new EqualityFact(var2, false, var1));
        }
      }
      if(info1.constant != null) {
        for (DfaVariableValue var2 : info2.vars) {
          result.add(new EqualityFact(var2, false, info1.constant));
        }
      }
      if(info2.constant != null) {
        for (DfaVariableValue var1 : info1.vars) {
          result.add(new EqualityFact(var1, false, info2.constant));
        }
      }
    }

    state.forVariableStates((var, variableState) -> {
      TypeConstraint typeConstraint = variableState.getTypeConstraint();
      for (DfaPsiType type : typeConstraint.getInstanceofValues()) {
        result.add(new InstanceofFact(var, true, type));
      }
      for (DfaPsiType type : typeConstraint.getNotInstanceofValues()) {
        result.add(new InstanceofFact(var, false, type));
      }
    });
    return result;
  }

  static final class CompactFactSet {
    private final long[] myData;
    private final int myHashCode;
    private final DfaValueFactory myFactory;

    CompactFactSet(DfaValueFactory factory, Collection<Fact> facts) {
      myData = facts.stream().mapToLong(Fact::pack).toArray();
      Arrays.sort(myData);
      myHashCode = Arrays.hashCode(myData);
      myFactory = factory;
    }

    public int size() {
      return myData.length;
    }

    @Override
    public int hashCode() {
      return myHashCode;
    }

    @Override
    public boolean equals(Object obj) {
      if (obj == this) return true;
      if (!(obj instanceof CompactFactSet)) return false;
      CompactFactSet other = (CompactFactSet)obj;
      return this.myHashCode == other.myHashCode && Arrays.equals(this.myData, other.myData);
    }

    @Override
    public String toString() {
      return LongStreamEx.of(myData).mapToObj(f -> Fact.unpack(myFactory, f)).joining(", ", "{", "}");
    }
  }

  static abstract class Fact {
    final boolean myPositive;
    @NotNull final DfaVariableValue myVar;
    private final int myHash;

    protected Fact(boolean positive, @NotNull DfaVariableValue var, int hash) {
      myPositive = positive;
      myVar = var;
      myHash = hash;
    }

    private int packLow() {
      return myPositive ? myVar.getID() : -myVar.getID();
    }

    abstract int packHigh();

    long pack() {
      int lo = packLow();
      int hi = packHigh();
      return ((long)hi << 32) | (lo & 0xFFFF_FFFFL);
    }

    @Override
    public final int hashCode() {
      return myHash;
    }

    @NotNull
    abstract Fact getPositiveCounterpart();

    DfaConstValue comparedToConstant() {
      return null;
    }

    abstract boolean invalidatesFact(@NotNull Fact another);

    abstract void removeFromState(@NotNull DfaMemoryStateImpl state);

    @NotNull
    static EqualityFact createEqualityFact(@NotNull DfaVariableValue var, @NotNull DfaValue val) {
      if (val instanceof DfaVariableValue && val.getID() < var.getID()) {
        return new EqualityFact((DfaVariableValue)val, true, var);
      }
      return new EqualityFact(var, true, val);
    }

    static Fact unpack(DfaValueFactory factory, long packed) {
      int lo = (int)(packed & 0xFFFF_FFFFL);
      int hi = (int)(packed >> 32);
      boolean positive = lo >= 0;
      DfaVariableValue var = (DfaVariableValue)factory.getValue(Math.abs(lo));
      if (hi >= 0) {
        return new EqualityFact(var, positive, factory.getValue(hi));
      } else {
        return new InstanceofFact(var, positive, factory.getType(-hi));
      }
    }
  }

  static final class EqualityFact extends Fact {
    @NotNull private final DfaValue myArg;

    private EqualityFact(@NotNull DfaVariableValue var, boolean positive, @NotNull DfaValue arg) {
      super(positive, var, (var.hashCode() * 31 + arg.hashCode()) * 31 + (positive ? 1 : 0));
      myArg = arg;
    }

    @Override
    int packHigh() {
      return myArg.getID();
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) return true;
      if (!(o instanceof EqualityFact)) return false;

      EqualityFact fact = (EqualityFact)o;
      return myArg == fact.myArg && myVar == fact.myVar && myPositive == fact.myPositive;
    }

    @Override
    public String toString() {
      return myVar + (myPositive ? " EQ " : " NE ") + myArg;
    }

    @Override
    DfaConstValue comparedToConstant() {
      return myArg instanceof DfaConstValue ? (DfaConstValue)myArg : null;
    }

    @Override
    @NotNull
    EqualityFact getPositiveCounterpart() {
      return new EqualityFact(myVar, true, myArg);
    }

    void applyTo(DfaMemoryStateImpl state) {
      state.applyCondition(state.getFactory().createCondition(myVar, myPositive ? RelationType.EQ : RelationType.NE, myArg));
    }

    @Override
    boolean invalidatesFact(@NotNull Fact another) {
      if (!(another instanceof EqualityFact)) return false;
      return myVar == another.myVar || myVar == ((EqualityFact)another).myArg;
    }

    @Override
    void removeFromState(@NotNull DfaMemoryStateImpl state) {
      state.removeEquivalenceForVariableAndWrappers(myVar);
    }
  }

  static final class InstanceofFact extends Fact {
    @NotNull private final DfaPsiType myType;

    private InstanceofFact(@NotNull DfaVariableValue var, boolean positive, @NotNull DfaPsiType type) {
      super(positive, var, (var.hashCode() * 31 + type.hashCode()) * 31 + (positive ? 1 : 0));
      myType = type;
    }

    @Override
    int packHigh() {
      return -myType.getID();
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) return true;
      if (!(o instanceof InstanceofFact)) return false;

      InstanceofFact fact = (InstanceofFact)o;
      return myPositive == fact.myPositive && myType == fact.myType && myVar == fact.myVar;
    }

    @Override
    public String toString() {
      return myVar + (myPositive ? " IS " : " IS NOT ") + myType;
    }

    @Override
    @NotNull
    Fact getPositiveCounterpart() {
      return new InstanceofFact(myVar, true, myType);
    }

    @Override
    boolean invalidatesFact(@NotNull Fact another) {
      return another instanceof InstanceofFact &&
             myType == ((InstanceofFact)another).myType &&
             myVar == another.myVar;
    }

    @Override
    void removeFromState(@NotNull DfaMemoryStateImpl state) {
      DfaVariableState varState = state.getVariableState(myVar);
      state.setVariableState(myVar, varState.withoutType(myType));
    }
  }

  private static class Replacements {
    @NotNull private final List<DfaMemoryStateImpl> myAllStates;
    private final Set<DfaMemoryStateImpl> myRemovedStates = ContainerUtil.newIdentityTroveSet();
    private final List<DfaMemoryStateImpl> myMerged = ContainerUtil.newArrayList();

    private Replacements(@NotNull List<DfaMemoryStateImpl> allStates) {
      myAllStates = allStates;
    }

    private boolean hasMerges() { return !myMerged.isEmpty(); }

    @Nullable
    private List<DfaMemoryStateImpl> getMergeResult() {
      if (hasMerges()) {
        List<DfaMemoryStateImpl> result = ContainerUtil.newArrayList(myMerged);
        for (DfaMemoryStateImpl state : myAllStates) {
          if (!myRemovedStates.contains(state)) {
            result.add(state);
          }
        }
        return result;
      }
      return null;
    }

    private void stripAndMerge(@NotNull Collection<DfaMemoryStateImpl> group,
                               @NotNull Function<DfaMemoryStateImpl, DfaMemoryStateImpl> stripper) {
      if (group.size() <= 1) return;

      MultiMap<DfaMemoryStateImpl, DfaMemoryStateImpl> strippedToOriginals = MultiMap.create();
      for (DfaMemoryStateImpl original : group) {
        strippedToOriginals.putValue(stripper.fun(original), original);
      }
      for (Map.Entry<DfaMemoryStateImpl, Collection<DfaMemoryStateImpl>> entry : strippedToOriginals.entrySet()) {
        Collection<DfaMemoryStateImpl> merged = entry.getValue();
        if (merged.size() > 1) {
          myRemovedStates.addAll(merged);
          myMerged.add(entry.getKey());
        }
      }
    }
  }

  static final class EqClassInfo {
    final List<DfaVariableValue> vars;
    final DfaConstValue constant;

    EqClassInfo(EqClass eqClass) {
      vars = eqClass.getVariables(false);
      constant = eqClass.findConstant();
    }
  }
}


text:
const _ = require('lodash');
const logging = require('../../../shared/logging');
const config = require('../../../shared/config');
const labsService = require('../labs');
const membersService = require('./index');
const urlUtils = require('../../../shared/url-utils');
const ghostVersion = require('../../lib/ghost-version');
const settingsCache = require('../settings/cache');
const {formattedMemberResponse} = require('./utils');

// @TODO: This piece of middleware actually belongs to the frontend, not to the member app
// Need to figure a way to separate these things (e.g. frontend actually talks to members API)
const loadMemberSession = async function (req, res, next) {
    if (!labsService.isSet('members')) {
        req.member = null;
        return next();
    }
    try {
        const member = await membersService.ssr.getMemberDataFromSession(req, res);
        Object.assign(req, {member});
        res.locals.member = req.member;
        next();
    } catch (err) {
        logging.warn(err.message);
        Object.assign(req, {member: null});
        next();
    }
};

const getIdentityToken = async function (req, res) {
    try {
        const token = await membersService.ssr.getIdentityTokenForMemberFromSession(req, res);
        res.writeHead(200);
        res.end(token);
    } catch (err) {
        logging.warn(err.message);
        res.writeHead(err.statusCode);
        res.end(err.message);
    }
};

const deleteSession = async function (req, res) {
    try {
        await membersService.ssr.deleteSession(req, res);
        res.writeHead(204);
        res.end();
    } catch (err) {
        logging.warn(err.message);
        res.writeHead(err.statusCode);
        res.end(err.message);
    }
};

const getMemberData = async function (req, res) {
    try {
        const member = await membersService.ssr.getMemberDataFromSession(req, res);
        if (member) {
            res.json(formattedMemberResponse(member));
        } else {
            res.json(null);
        }
    } catch (err) {
        logging.warn(err.message);
        res.writeHead(err.statusCode);
        res.end(err.message);
    }
};

const updateMemberData = async function (req, res) {
    try {
        const data = _.pick(req.body, 'name', 'subscribed');
        const member = await membersService.ssr.getMemberDataFromSession(req, res);
        if (member) {
            const updatedMember = await membersService.api.members.update(data, {id: member.id});
            res.json(formattedMemberResponse(updatedMember));
        } else {
            res.json(null);
        }
    } catch (err) {
        logging.warn(err.message);
        res.writeHead(err.statusCode);
        res.end(err.message);
    }
};

const getMemberSiteData = async function (req, res) {
    const isStripeConfigured = membersService.config.isStripeConnected();

    const response = {
        title: settingsCache.get('title'),
        description: settingsCache.get('description'),
        logo: settingsCache.get('logo'),
        icon: settingsCache.get('icon'),
        accent_color: settingsCache.get('accent_color'),
        url: urlUtils.urlFor('home', true),
        version: ghostVersion.safe,
        plans: membersService.config.getPublicPlans(),
        allow_self_signup: membersService.config.getAllowSelfSignup(),
        is_stripe_configured: isStripeConfigured,
        portal_button: settingsCache.get('portal_button'),
        portal_name: settingsCache.get('portal_name'),
        portal_plans: settingsCache.get('portal_plans'),
        portal_button_icon: settingsCache.get('portal_button_icon'),
        portal_button_signup_text: settingsCache.get('portal_button_signup_text'),
        portal_button_style: settingsCache.get('portal_button_style')
    };

    // accent_color is currently an experimental feature
    if (!config.get('enableDeveloperExperiments')) {
        delete response.accent_color;
    }

    res.json({site: response});
};

const createSessionFromMagicLink = async function (req, res, next) {
    if (!req.url.includes('token=')) {
        return next();
    }

    // req.query is a plain object, copy it to a URLSearchParams object so we can call toString()
    const searchParams = new URLSearchParams('');
    Object.keys(req.query).forEach((param) => {
        // don't copy the token param
        if (param !== 'token') {
            searchParams.set(param, req.query[param]);
        }
    });

    // We need to include the subdirectory,
    // members is already removed from the path by express because it's a mount path
    let redirectPath = `${urlUtils.getSubdir()}${req.path}`;

    try {
        await membersService.ssr.exchangeTokenForSession(req, res);

        // Do a standard 302 redirect, with success=true
        searchParams.set('success', true);
    } catch (err) {
        logging.warn(err.message);
        searchParams.set('success', false);
    } finally {
        res.redirect(`${redirectPath}?${searchParams.toString()}`);
    }
};

// Set req.member & res.locals.member if a cookie is set
module.exports = {
    loadMemberSession,
    createSessionFromMagicLink,
    getIdentityToken,
    getMemberData,
    updateMemberData,
    getMemberSiteData,
    deleteSession,
    stripeWebhooks: (req, res, next) => membersService.api.middleware.handleStripeWebhook(req, res, next)
};


text:
import atMerc from "./atMerc.json";
import atMill from "./atMill.json";
export { atMerc, atMill };
//# sourceMappingURL=index.js.map


text:
package me.kworden.wlcalendar2.receiver;

import me.kworden.wlcalendar2.async.RequestRemoteDataTask;
import me.kworden.wlcalendar2.struct.MonthYearParcel;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class RequestRemoteDataReceiver extends BroadcastReceiver
{
	@Override
	public void onReceive(Context p_context, Intent p_intent)
	{
		(new RequestRemoteDataTask(p_context)).execute((MonthYearParcel[])p_intent.getParcelableArrayExtra("MONTHS"));
	}
}


text:
package org.elasticsearch.action.get;

import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.AtomicArray;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class TransportMultiGetAction extends HandledTransportAction<MultiGetRequest, MultiGetResponse> {

    private final ClusterService clusterService;

    private final TransportShardMultiGetAction shardAction;

    @Inject
    public TransportMultiGetAction(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, TransportShardMultiGetAction shardAction, ActionFilters actionFilters) {
        super(settings, MultiGetAction.NAME, threadPool, transportService, actionFilters);
        this.clusterService = clusterService;
        this.shardAction = shardAction;
    }

    @Override
    public MultiGetRequest newRequestInstance(){
        return new MultiGetRequest();
    }

    @Override
    protected void doExecute(final MultiGetRequest request, final ActionListener<MultiGetResponse> listener) {
        ClusterState clusterState = clusterService.state();

        clusterState.blocks().globalBlockedRaiseException(ClusterBlockLevel.READ);

        final AtomicArray<MultiGetItemResponse> responses = new AtomicArray<>(request.items.size());

        Map<ShardId, MultiGetShardRequest> shardRequests = new HashMap<>();
        for (int i = 0; i < request.items.size(); i++) {
            MultiGetRequest.Item item = request.items.get(i);
            if (!clusterState.metaData().hasConcreteIndex(item.index())) {
                responses.set(i, new MultiGetItemResponse(null, new MultiGetResponse.Failure(item.index(), item.type(), item.id(), "[" + item.index() + "] missing")));
                continue;
            }

            item.routing(clusterState.metaData().resolveIndexRouting(item.routing(), item.index()));
            item.index(clusterState.metaData().concreteSingleIndex(item.index(), item.indicesOptions()));
            if (item.routing() == null && clusterState.getMetaData().routingRequired(item.index(), item.type())) {
                responses.set(i, new MultiGetItemResponse(null, new MultiGetResponse.Failure(item.index(), item.type(), item.id(),
                        "routing is required for [" + item.index() + "]/[" + item.type() + "]/[" + item.id() + "]")));
                continue;
            }
            ShardId shardId = clusterService.operationRouting()
                    .getShards(clusterState, item.index(), item.type(), item.id(), item.routing(), null).shardId();
            MultiGetShardRequest shardRequest = shardRequests.get(shardId);
            if (shardRequest == null) {
                shardRequest = new MultiGetShardRequest(shardId.index().name(), shardId.id());
                shardRequest.preference(request.preference);
                shardRequest.realtime(request.realtime);
                shardRequest.refresh(request.refresh);
                shardRequest.ignoreErrorsOnGeneratedFields(request.ignoreErrorsOnGeneratedFields);

                shardRequests.put(shardId, shardRequest);
            }
            shardRequest.add(i, item.type(), item.id(), item.fields(), item.version(), item.versionType(), item.fetchSourceContext());
        }

        if (shardRequests.size() == 0) {
            // only failures..
            listener.onResponse(new MultiGetResponse(responses.toArray(new MultiGetItemResponse[responses.length()])));
        }

        final AtomicInteger counter = new AtomicInteger(shardRequests.size());

        for (final MultiGetShardRequest shardRequest : shardRequests.values()) {
            shardAction.execute(shardRequest, new ActionListener<MultiGetShardResponse>() {
                @Override
                public void onResponse(MultiGetShardResponse response) {
                    for (int i = 0; i < response.locations.size(); i++) {
                        responses.set(response.locations.get(i), new MultiGetItemResponse(response.responses.get(i), response.failures.get(i)));
                    }
                    if (counter.decrementAndGet() == 0) {
                        finishHim();
                    }
                }

                @Override
                public void onFailure(Throwable e) {
                    // create failures for all relevant requests
                    String message = ExceptionsHelper.detailedMessage(e);
                    for (int i = 0; i < shardRequest.locations.size(); i++) {
                        responses.set(shardRequest.locations.get(i), new MultiGetItemResponse(null,
                                new MultiGetResponse.Failure(shardRequest.index(), shardRequest.types.get(i), shardRequest.ids.get(i), message)));
                    }
                    if (counter.decrementAndGet() == 0) {
                        finishHim();
                    }
                }

                private void finishHim() {
                    listener.onResponse(new MultiGetResponse(responses.toArray(new MultiGetItemResponse[responses.length()])));
                }
            });
        }
    }
}


text:
package com.davidjohnburrowes.formats.jpeg.marker;

import com.davidjohnburrowes.format.jpeg.marker.RstMMarker;
import com.davidjohnburrowes.formats.jpeg.test.TestUtils;
import java.io.IOException;
import java.io.InputStream;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

public class RstMMarkerTest {

	private TestUtils utils;

	@Before
	public void setUp() {
		utils = new TestUtils();
	}

	@Test
	public void testThatHasTheRightMarkerByDefault() {
		assertEquals(RstMMarker.FIRST_MARKERID, new RstMMarker(RstMMarker.FIRST_MARKERID).getMarkerId());
	}

	@Test
	public void testRstMMarkerReadsNoData() throws IOException {
		InputStream stream = utils.makeInputStream("AA BB");

		RstMMarker marker = new RstMMarker(RstMMarker.FIRST_MARKERID);
		marker.read(stream);

		assertEquals(0xAA, stream.read());
	}

	@Test
	public void rstMMarkersWithSameMarkersIdsEqual() throws IOException {
		assertTrue(new RstMMarker(RstMMarker.FIRST_MARKERID).equals(new RstMMarker(RstMMarker.FIRST_MARKERID)));
	}

	@Test
	public void rstMMarkersWithDifferentMarkerIdsNotEqual() throws IOException {
		assertFalse(new RstMMarker(RstMMarker.FIRST_MARKERID + 2).equals(new RstMMarker(RstMMarker.FIRST_MARKERID)));
	}
	@Test
	public void rstMMarkerNotEqualToOther() throws IOException {
		assertFalse(new RstMMarker(RstMMarker.FIRST_MARKERID).equals(new Object()));
	}

    @Test(expected=IllegalArgumentException.class)
    public void markerWillOnlyAcceptLegalMarkerIds() throws IOException {
		RstMMarker marker = new RstMMarker(0x01);
	}
}


text:
using Microsoft.Win32.SafeHandles;

using System.Diagnostics;
using System.Threading;

namespace System.Net.Sockets
{
    // This class implements a safe socket handle.
    // It uses an inner and outer SafeHandle to do so.  The inner
    // SafeHandle holds the actual socket, but only ever has one
    // reference to it.  The outer SafeHandle guards the inner
    // SafeHandle with real ref counting.  When the outer SafeHandle
    // is cleaned up, it releases the inner SafeHandle - since
    // its ref is the only ref to the inner SafeHandle, it deterministically
    // gets closed at that point - no races with concurrent IO calls.
    // This allows Close() on the outer SafeHandle to deterministically
    // close the inner SafeHandle, in turn allowing the inner SafeHandle
    // to block the user thread in case a graceful close has been
    // requested.  (It's not legal to block any other thread - such closes
    // are always abortive.)
    public sealed partial class SafeSocketHandle : SafeHandleMinusOneIsInvalid
    {
        public SafeSocketHandle(IntPtr preexistingHandle, bool ownsHandle)
            : base(ownsHandle)
        {
            handle = preexistingHandle;
        }

        private SafeSocketHandle() : base(true) { }

        private InnerSafeCloseSocket _innerSocket;
        private volatile bool _released;
#if DEBUG
        private InnerSafeCloseSocket _innerSocketCopy;
#endif
        private bool _hasShutdownSend;

        internal void TrackShutdown(SocketShutdown how)
        {
            if (how == SocketShutdown.Send ||
                how == SocketShutdown.Both)
            {
                _hasShutdownSend = true;
            }
        }

        public override bool IsInvalid
        {
            get
            {
                return IsClosed || base.IsInvalid;
            }
        }

#if DEBUG
        internal void AddRef()
        {
            try
            {
                // The inner socket can be closed by CloseAsIs and when SafeHandle runs ReleaseHandle.
                InnerSafeCloseSocket innerSocket = Volatile.Read(ref _innerSocket);
                if (innerSocket != null)
                {
                    innerSocket.AddRef();
                }
            }
            catch (Exception e)
            {
                Debug.Fail("SafeSocketHandle.AddRef after inner socket disposed." + e);
            }
        }

        internal void Release()
        {
            try
            {
                // The inner socket can be closed by CloseAsIs and when SafeHandle runs ReleaseHandle.
                InnerSafeCloseSocket innerSocket = Volatile.Read(ref _innerSocket);
                if (innerSocket != null)
                {
                    innerSocket.Release();
                }
            }
            catch (Exception e)
            {
                Debug.Fail("SafeSocketHandle.Release after inner socket disposed." + e);
            }
        }
#endif

        private void SetInnerSocket(InnerSafeCloseSocket socket)
        {
            _innerSocket = socket;
            SetHandle(socket.DangerousGetHandle());
#if DEBUG
            _innerSocketCopy = socket;
#endif
        }

        private static SafeSocketHandle CreateSocket(InnerSafeCloseSocket socket)
        {
            SafeSocketHandle ret = new SafeSocketHandle();
            CreateSocket(socket, ret);

            if (NetEventSource.IsEnabled) NetEventSource.Info(null, ret);

            return ret;
        }

        private static void CreateSocket(InnerSafeCloseSocket socket, SafeSocketHandle target)
        {
            if (socket != null && socket.IsInvalid)
            {
                target.SetHandleAsInvalid();
                return;
            }

            bool b = false;
            try
            {
                socket.DangerousAddRef(ref b);
            }
            catch
            {
                if (b)
                {
                    socket.DangerousRelease();
                    b = false;
                }
            }
            finally
            {
                if (b)
                {
                    target.SetInnerSocket(socket);
                    socket.Dispose();
                }
                else
                {
                    target.SetHandleAsInvalid();
                }
            }
        }

        protected override bool ReleaseHandle()
        {
            if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"_innerSocket={_innerSocket}");

            _released = true;
            InnerSafeCloseSocket innerSocket = _innerSocket == null ? null : Interlocked.Exchange<InnerSafeCloseSocket>(ref _innerSocket, null);
            if (innerSocket != null)
            {
#if DEBUG
                // On AppDomain unload we may still have pending Overlapped operations.
                // ThreadPoolBoundHandle should handle this scenario by canceling them.
                innerSocket.LogRemainingOperations();
#endif

                DoReleaseHandle();
                innerSocket.Close(abortive: true);
            }

            return true;
        }

        internal void CloseAsIs(bool abortive)
        {
            if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"_innerSocket={_innerSocket}");

#if DEBUG
            // If this throws it could be very bad.
            try
            {
#endif
                InnerSafeCloseSocket innerSocket = _innerSocket == null ? null : Interlocked.Exchange<InnerSafeCloseSocket>(ref _innerSocket, null);

                Dispose();
                if (innerSocket != null)
                {
                    bool canceledOperations = false;

                    // Wait until it's safe.
                    SpinWait sw = new SpinWait();
                    while (!_released)
                    {
                        // The socket was not released due to the SafeHandle being used.
                        // Try to make those on-going calls return.
                        // On Linux, TryUnblockSocket will unblock current operations but it doesn't prevent
                        // a new one from starting. So we must call TryUnblockSocket multiple times.
                        canceledOperations |= innerSocket.TryUnblockSocket(abortive, _hasShutdownSend);
                        sw.SpinOnce();
                    }

                    canceledOperations |= DoReleaseHandle();

                    // In case we cancel operations, switch to an abortive close.
                    // Unless the user requested a normal close using Socket.Shutdown.
                    if (canceledOperations && !_hasShutdownSend)
                    {
                        abortive = true;
                    }

                    innerSocket.Close(abortive);
                }
#if DEBUG
            }
            catch (Exception exception) when (!ExceptionCheck.IsFatal(exception))
            {
                NetEventSource.Fail(this, $"handle:{handle}, error:{exception}");
                throw;
            }
#endif
        }

        internal sealed partial class InnerSafeCloseSocket : SafeHandleMinusOneIsInvalid
        {
            private InnerSafeCloseSocket() : base(true) { }

            // Indicates whether a Socket is shutdown cleanly or whether it was
            // closed with on-going operations that should be aborted.
            // For TCP, an abortive close causes the peer to see a RST-close (connection reset by peer)
            // instead of the clean FIN-close.
            private bool _abortive = true;

            public override bool IsInvalid
            {
                get
                {
                    return IsClosed || base.IsInvalid;
                }
            }

            // This method is implicitly reliable and called from a CER.
            protected override bool ReleaseHandle()
            {
                bool ret = false;

#if DEBUG
                try
                {
#endif
                    if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"handle:{handle}");

                    SocketError errorCode = InnerReleaseHandle();
                    return ret = errorCode == SocketError.Success;
#if DEBUG
                }
                catch (Exception exception)
                {
                    if (!ExceptionCheck.IsFatal(exception))
                    {
                        NetEventSource.Fail(this, $"handle:{handle}, error:{exception}");
                    }

                    ret = true;  // Avoid a second assert.
                    throw;
                }
                finally
                {
                    _closeSocketThread = Environment.CurrentManagedThreadId;
                    _closeSocketTick = Environment.TickCount;
                    if (!ret)
                    {
                        NetEventSource.Fail(this, $"ReleaseHandle failed. handle:{handle}");
                    }
                }
#endif
            }

#if DEBUG
            private IntPtr _closeSocketHandle;
            private SocketError _closeSocketResult = unchecked((SocketError)0xdeadbeef);
            private SocketError _closeSocketLinger = unchecked((SocketError)0xdeadbeef);
            private int _closeSocketThread;
            private int _closeSocketTick;

            private int _refCount = 0;

            public void AddRef()
            {
                Interlocked.Increment(ref _refCount);
            }

            public void Release()
            {
                Interlocked.MemoryBarrier();
                Debug.Assert(_refCount > 0, "InnerSafeCloseSocket: Release() called more times than AddRef");
                Interlocked.Decrement(ref _refCount);
            }

            public void LogRemainingOperations()
            {
                Interlocked.MemoryBarrier();
                if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"Releasing with pending operations: {_refCount}");
            }
#endif

            internal void Close(bool abortive)
            {
#if DEBUG
                // Expected to have outstanding operations such as Accept.
                LogRemainingOperations();
#endif

                _abortive = abortive;
                DangerousRelease();
            }
        }
    }
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = {
  absolutify: function absolutify() {},
  ignoreCallsFromThisFile: function ignoreCallsFromThisFile() {},
  reset: function reset() {}
};


text:
namespace VoteSystem.Common.Constants
{
    public class GlobalConstants
    {
        public const string AdministratorRoleName = "Administrator";

        public const string DataServicesAssembly = "VoteSystem.Data.Services";
    }
}


text:
<?php

declare(strict_types = 1);

namespace Unicity\Common {

	use \Unicity\Common;
	use \Unicity\Core;

	/**
	 * This class creates an immutable boxed boolean value.
	 *
	 * @access public
	 * @class
	 * @package Common
	 */
	class BooleanVal extends Core\AbstractObject implements Common\IPrimitiveVal {

		/**
		 * This variable stores the primitive value.
		 *
		 * @access protected
		 * @var boolean
		 */
		protected $value;

		/**
		 * This constructor initializes the class with the specified value.
		 *
		 * @access public
		 * @param boolean $value                                    the primitive value to be boxed
		 */
		public function __construct($value = false) {
			$this->value = static::parse($value);
		}

		/**
		 * This method compares the specified object with the current object for order.
		 *
		 * @access public
		 * @param mixed $object                                     the object to be compared
		 * @return integer                                          a negative integer, zero, or a positive
		 *                                                          integer as this object is less than,
		 *                                                          equal to, or greater than the specified
		 *                                                          object
		 */
		public function compareTo($object) : int {
			$x = $this->value;
			$y = static::parse($object);

			if (!$x && $y) {
				return -1;
			}
			else if ($x == $y) {
				return 0;
			}
			else { // ($x && !$y)
				return 1;
			}
		}

		/**
		 * This destructor ensures that any resources are properly disposed.
		 *
		 * @access public
		 */
		public function __destruct() {
			parent::__destruct();
			unset($this->value);
		}

		/**
		 * This method evaluates whether the specified objects is equal to the current object.
		 *
		 * @access public
		 * @param mixed $object                                     the object to be evaluated
		 * @return boolean                                          whether the specified object is equal
		 *                                                          to the current object
		 */
		public function __equals($object) {
			if ($object !== null) {
				if (is_bool($object)) {
					return ($object == $this->value);
				}
				return (($object instanceof Common\BooleanVal) && ($object->value == $this->value));
			}
			return false;
		}

		/**
		 * This method returns the current object as a string.
		 *
		 * @access public
		 * @return string                                           a string representing the current
		 *                                                          object
		 */
		public function __toString() {
			return ($this->value) ? 'true' : 'false';
		}

		/**
		 * This method returns the un-boxed value.
		 *
		 * @access public
		 * @return boolean                                          the primitive value
		 */
		public function __value() {
			return $this->value;
		}

		/**
		 * This method returns how the two objects should be ordered.
		 *
		 * @access public
		 * @param \Unicity\Common\BooleanVal $x                     the first primitive to compare
		 * @param \Unicity\Common\BooleanVal $y                     the second primitive to compare
		 * @return integer                                          a negative integer, zero, or a positive
		 *                                                          integer as this object is less than,
		 *                                                          equal to, or greater than the first
		 *                                                          object
		 */
		public static function compare($x, $y) {
			return $x->compareTo($y);
		}

		/**
		 * This method returns whether the data type of the specified value is related to the data type
		 * of this class.
		 *
		 * @access public
		 * @param mixed $value                                      the value to be evaluated
		 * @return boolean                                          whether the data type of the specified
		 *                                                          value is related to the data type of
		 *                                                          this class
		 */
		public static function isTypeOf($value) {
			if ($value !== null) {
				return (is_bool($value) || (is_object($value) && ($value instanceof Common\BooleanVal)));
			}
			return false;
		}

		/**
		 * This method returns the value as a boxed primitive value.
		 *
		 * @access public
		 * @param mixed $value                                      the value to be parsed
		 * @return \Unicity\Common\IPrimitiveVal                    the primitive value
		 */
		public static function parse($value) {
			return ($value instanceof Common\IPrimitiveVal) ? (bool) $value->__value() : (bool) $value;
		}

		/**
		 * This method returns the value as a boxed primitive value.
		 *
		 * @access public
		 * @param mixed $value                                      the value to be boxed
		 * @return \Unicity\Common\IPrimitiveVal                    the boxed primitive value
		 */
		public static function valueOf($value) {
			return new static($value);
		}

	}

}


text:
var ui = require('ui'),
	Status = require('Status'),
	User = require('User'),
	Cloud = require('ti.cloud'),
	currentBlob = null;

$.loading = Alloy.createController('loading');

//Bubble focus event
$.post.on('focus', function(e) {
	$.trigger('focus', e);
});

$.post.on('blur', function(e) {
	$.trigger('blur', e);
});

//Expose TextArea focus
$.focus = function() {
	$.post.focus();
};

$.blur = function() {
	$.post.blur();
};

//Handle image attachment
$.camera.on('click', function() {
	//for now, need to disable "choose from gallery" for android
	var options = [L('camera')];
	if (OS_IOS) {
		options.push(L('photoGallery'));
	}
	options.push(L('cancel'));

	var od = Ti.UI.createOptionDialog({
		options:options,
		cancel:options.length > 2 ? 2 : 1,
		title:L('attachPhoto')
	});

	od.addEventListener('click', function(e) {
		var callbacks = {
			success: function(e) {
				currentBlob = e.media;
				$.preview.image = currentBlob;
				$.camera.animate({
					opacity:0,
					duration:250
				}, function() {
					$.imagePreview.visible = true;
					$.imagePreview.animate({
						opacity:1,
						duration:250
					});
					updateCount();
				});
			},
			error: function(e) {
				ui.alert('mediaErrorTitle', 'mediaErrorText');
			}
		};

		//decide which media API to call
		if (e.index === 0) {
			Ti.Media.showCamera(callbacks);
		}
		else if (e.index === 1 && options.length > 2) {
			Ti.Media.openPhotoGallery(callbacks);
		}
	});

	if (OS_IOS) {
		od.show({
			view:$.camera
		});
	}
	else {
		od.show();
	}

});

$.deleteButton.on('click', function() {
	$.imagePreview.animate({
		opacity:0,
		duration:250
	}, function() {
		$.camera.animate({
			opacity:1,
			duration:250
		}, function() {
			$.imagePreview.visible = false;
			$.preview.image = '';
			currentBlob = null;
			updateCount();
		});
	});
});

//Manage social connection state
var fbOn = false;
$.facebook.on('click', function() {
	if (!fbOn) {
		function setOn() {
			fbOn = true;
			$.facebook.backgroundImage = '/img/post/btn-facebook-on.png';
		}

		if (User.confirmLogin.toFacebook()) {
			setOn();
		}
		else {
			User.linkToFacebook(function(e) {
				setOn();
			});
		}
	}
	else {
		fbOn = false;
		$.facebook.backgroundImage = '/img/post/btn-facebook-off.png';
	}
});

var twitterOn = false;
$.twitter.on('click', function() {
	if (!twitterOn) {
		function setOn() {
			twitterOn = true;
			$.twitter.backgroundImage = '/img/post/btn-twitter-on.png';
			updateCount();
			$.characters.visible = true;
		}

		if (User.confirmLogin.toTwitter()) {
			setOn();
		}
		else {
			User.linkToTwitter(function(e) {
				setOn();
			});
		}
	}
	else {
		twitterOn = false;
		$.characters.visible = true;
		$.twitter.backgroundImage = '/img/post/btn-twitter-off.png';
		updateCount();
		$.characters.visible = false;
	}
});

//Track character count
var count = 140;
function updateCount() {
	var startNumber = (currentBlob) ? 118 : 140
	count = startNumber - $.post.value.length;
	$.characters.color = (count >= 0) ? '#000' : '#ff0000';
	$.characters.text = count;
}
$.post.on('change', updateCount);

//track social post status, don't be done til these come back
$.submit.on('click', function() {
	if ($.post.value || currentBlob) {

		//exit if content is not valid - TODO: put in better validation and feedback
		if ((twitterOn && currentBlob && $.post.value.length > 118) ||
			(twitterOn && !currentBlob && $.post.value.length > 140)) {
			ui.alert('tooLong', 'tooLongMessage');
			return;
		}

		var currentPost = $.post.value;
		$.postContainer.add($.loading.getView());
		$.loading.start();
		Status.create({
			message:(currentPost === '') ? 'Just uploaded from @codestrong 2012!' : currentPost, //empty string - status update tangram requires a message
			photo:currentBlob
		}, function(e) {
			if (e.success) {
				//Cool, it's in ACS, now ship it to any social channels
				if (twitterOn || fbOn) {
					var args = {
						success: function(ev) {
							$.loading.stop();
							$.postContainer.remove($.loading.getView());
							ui.alert('updateSuccessTitle', 'updateSuccessText');
							$.trigger('success');
							Ti.App.fireEvent('app:status.update', {
								withPhoto:(currentBlob) ? true : false //don't want to pass a reference to the blob
							});
						},
						error: function(ev) {
							$.loading.stop();
							$.postContainer.remove($.loading.getView());
							Ti.API.error('Error on social post: '+ev);
							ui.alert('updateErrorTitle', 'updateErrorText');
						}
					};

					//Handle twitter posting
					if (twitterOn) {
						if (currentBlob) {
							//For twitter, we need to grab the URL of the original image on ACS
							//Need to delay in order for ACS to process the images and return us URLs
							//TODO: Brittle as F - maybe do an interval?
							setTimeout(function() {
								Cloud.Statuses.query({
									limit:1,
									where:{
										user_id:e.status.user.id
									},
									order:'-created_at'
								}, function(pe) {
									if (pe.success) {
										args.message = currentPost+': '+pe.statuses[0].photo.urls.original
										User.tweet(args);
									}
									else {
										args.error(pe);
									}
								});
							},5000);
						}
						else {
							args.message = currentPost;
							User.tweet(args);
						}
					}

					//Handle FB posting
					if (fbOn) {
						args.message = currentPost;
						args.image = currentBlob;
						User.facebookPost(args);
					}
				}
				else {
					$.loading.stop();
					$.postContainer.remove($.loading.getView());
					ui.alert('updateSuccessTitle', 'updateSuccessText');
					$.trigger('success');
					Ti.App.fireEvent('app:status.update', {
						withPhoto:(currentBlob) ? true : false //don't want to pass a reference to the blob
					});
				}
			}
			else {
				$.loading.stop();
				$.postContainer.remove($.loading.getView());
				Ti.API.error('Error on ACS post: '+e);
				ui.alert('updateErrorTitle', 'updateErrorText');
			}
		});
	}
});

//Reset UI for next post
$.reset = function() {
	//reset social
	fbOn = false;
	$.facebook.backgroundImage = '/img/post/btn-facebook-off.png';
	twitterOn = false;
	$.twitter.backgroundImage = '/img/post/btn-twitter-off.png';

	//reset post
	$.post.value = '';
	count = 140;
	$.characters.text = count;
	$.characters.visible = false;

	//reset image
	currentBlob = null;
	$.imagePreview.visible = false;
	$.imagePreview.opacity = 0;
	$.preview.image = '';
	$.camera.opacity = 1;
};


text:
(function(window, document, undefined){
	'use strict';
	if(!document.addEventListener){return;}
	var config, checkElements, expand;

	var unloadElements = [];
	var requestAnimationFrame = window.requestAnimationFrame || setTimeout;
	var unloader = {
		checkElements: function(){
			var i, len, box;

			var vTop = expand * -1;
			var vLeft = vTop;
			var vBottom = innerHeight + expand;
			var vRight = innerWidth + expand;

			for(i = 0, len = checkElements.length; i < len; i++){
				box = checkElements[i].getBoundingClientRect();

				if((box.top > vBottom || box.bottom < vTop || box.left > vRight || box.right < vLeft) ||
					(config.unloadHidden && !box.top && !box.bottom && !box.left && !box.right)){
					unloadElements.push(checkElements[i]);
				}
			}
			requestAnimationFrame(unloader.unloadElements);
		},
		unload: function(element){
			var sources, isResponsive, i, len;
			var picture = element.parentNode;
			lazySizes.rC(element, config.loadedClass);

			if(element.getAttribute(config.srcsetAttr)){
				element.setAttribute('srcset', config.emptySrc);
				isResponsive = true;
			}

			if(picture && picture.nodeName.toUpperCase() == 'PICTURE'){
				sources = picture.getElementsByTagName('source');

				for(i = 0, len = sources.length; i < len; i++){
					sources[i].setAttribute('srcset', config.emptySrc);
				}

				isResponsive = true;
			}

			if(lazySizes.hC(element, config.autosizesClass)){
				lazySizes.rC(element, config.autosizesClass);
				element.setAttribute(config.sizesAttr, 'auto');
			}

			if(isResponsive || element.getAttribute(config.srcAttr)){
				element.src = config.emptySrc;
			}

			lazySizes.aC(element, config.unloadedClass);
			lazySizes.aC(element, config.lazyClass);
			lazySizes.fire(element, 'lazyafterunload');
		},
		unloadElements: function(elements){
			elements = Array.isArray(elements) ? elements : unloadElements;

			while(elements.length){
				unloader.unload(elements.shift());
			}
		},
		_reload: function(e) {
			if(lazySizes.hC(e.target, config.unloadedClass) && e.detail){
				e.detail.reloaded = true;
				lazySizes.rC(e.target, config.unloadedClass);
			}
		}
	};

	function init(){
		if(!window.lazySizes || checkElements){return;}
		var docElem = document.documentElement;
		var throttleRun = (function(){
			var running;
			var run = function(){
				unloader.checkElements();
				running = false;
			};
			return function(){
				if(!running){
					running = true;
					setTimeout(run, 999);
				}
			};
		})();

		config = lazySizes.cfg;
		removeEventListener('lazybeforeunveil', init);

		if(!('unloadClass' in config)){
			config.unloadClass = 'lazyunload';
		}

		if(!('unloadedClass' in config)){
			config.unloadedClass = 'lazyunloaded';
		}

		if(!('unloadHidden' in config)){
			config.unloadHidden = true;
		}

		if(!('emptySrc' in config)){
			config.emptySrc = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
		}

		if(!('autoUnload' in config)){
			config.autoUnload = true;
		}

		if(!('unloadPixelThreshold' in config)){
			config.unloadPixelThreshold = 60000;
		}

		if(config.autoUnload){
			docElem.addEventListener('load',  function(e){
				if(e.target.naturalWidth * e.target.naturalHeight > config.unloadPixelThreshold && e.target.className &&
					e.target.className.indexOf && e.target.className.indexOf(lazySizesConfig.loadingClass) != -1 &&
					e.target.className.indexOf(lazySizesConfig.preloadClass) == -1){
					lazySizes.aC(e.target, lazySizesConfig.unloadClass);
				}
			}, true);
		}

		lazySizes.unloader = unloader;

		expand = ((config.expand * config.expFactor) + 99) * 1.1;
		checkElements = document.getElementsByClassName([config.unloadClass, config.loadedClass].join(' '));

		setInterval(throttleRun, 9999);
		addEventListener('lazybeforeunveil', throttleRun);
		addEventListener('lazybeforeunveil', unloader._reload, true);
	}

	addEventListener('lazybeforeunveil', init);
})(window, document);


text:
#ifndef _HEAP_H_
#define _HEAP_H_

/*
 * Heap (priority queue).
 *
 * Functions:
 *     heap_create        - Allocates and returns a new heap object given a
 *                          comparator.
 *                          Returns NULL on error.
 *                          Comparator returns 1 if the left element precedes the
 *                          second element, returns 0 otherwise.
 *     heap_push          - Adds a new element to the heap.
 *     heap_pop           - Removes the next element (with the highest priority)
 *                          from the heap.
 *     heap_top           - Peeks the next element.
 *     heap_isempty       - Returns whether the heap is empty.
 *     heap_getsize       - Returns the number of elements in the heap.
 *     heap_destroy       - Destroys the heap object; frees internal data
 *                          structures.
 *                          DOES NOT free any element contained in the heap.
 *                          To avoid memory leak, please free all elements added
 *                          to the heap.
 *     heap_assertvalid   - Validates the integrity of the heap data structure
 *                          e.g. whether the heap contains the stated number
 *                          of elements, whether the heap property is maintained.
 */

struct heap; /* Opaque. */

struct heap* heap_create(int(*comparator)(const void*, const void*));
int heap_push(struct heap* h, void* newval);
void* heap_pop(struct heap* h);
const void* heap_top(struct heap* h);
int heap_isempty(struct heap* h);
unsigned int heap_getsize(struct heap* h);
void heap_destroy(struct heap* h);
void heap_assertvalid(struct heap* h);

#endif /* _HEAP_H_ */


text:
<component name="libraryTable">
  <library name="Maven: com.caffeineowl:bezier-utils:1.0.0-RELEASE">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/com/caffeineowl/bezier-utils/1.0.0-RELEASE/bezier-utils-1.0.0-RELEASE.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$MAVEN_REPOSITORY$/com/caffeineowl/bezier-utils/1.0.0-RELEASE/bezier-utils-1.0.0-RELEASE-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$MAVEN_REPOSITORY$/com/caffeineowl/bezier-utils/1.0.0-RELEASE/bezier-utils-1.0.0-RELEASE-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
""" Test runner for IDL Generator changes """

import subprocess
import sys

def TestIDL(testname, args):
  print '\nRunning unit tests for %s.' % testname
  try:
    args = [sys.executable, testname] + args
    subprocess.check_call(args)
    return 0
  except subprocess.CalledProcessError as err:
    print 'Failed with %s.' % str(err)
    return 1

def main(args):
  errors = 0
  errors += TestIDL('idl_lexer.py', ['--test'])
  assert errors == 0
  errors += TestIDL('idl_parser.py', ['--test'])
  assert errors == 0
  errors += TestIDL('idl_c_header.py', [])
  assert errors == 0
  errors += TestIDL('idl_c_proto.py', ['--wnone', '--test'])
  assert errors == 0
  errors += TestIDL('idl_gen_pnacl.py', ['--wnone', '--test'])
  assert errors == 0

  if errors:
    print '\nFailed tests.'
  return errors

if __name__ == '__main__':
  sys.exit(main(sys.argv[1:]))


text:
package com.seokceed.mygirl.image;

import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.AsyncTask;
import android.widget.Toast;

import com.seokceed.mygirl.R;
import com.seokceed.mygirl.share.KakaoShare;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Created by gamepari on 2015-03-09.
 */
public class ImageSaveTask extends AsyncTask<Bitmap, Void, String> {

    Activity mActivity;
    ProgressDialog mProgressDialog;
    MediaScannerConnection msc;

    public ImageSaveTask(Activity mActivity) {
        this.mActivity = mActivity;
        mProgressDialog = new ProgressDialog(mActivity);
    }

    @Override
        protected void onPostExecute(String result) {
        mProgressDialog.dismiss();
            if (result != null) {
                Toast.makeText(mActivity, mActivity.getResources().getString(R.string.toast_saved), Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(mActivity, mActivity.getResources().getString(R.string.toast_failed), Toast.LENGTH_SHORT).show();
            }
            super.onPostExecute(result);
        }

        @Override
        protected void onPreExecute() {
            mProgressDialog.setMessage(mActivity.getResources().getString(R.string.dialog_saving));
            mProgressDialog.show();
            super.onPreExecute();
        }

        @Override
        protected String doInBackground(Bitmap... params) {

            File imageFile = MediaFileUtil.getOutputMediaFile(MediaFileUtil.MEDIA_TYPE_IMAGE);
            OutputStream out = null;

            //TODO BUG 3
            if (imageFile == null) return null;

            try {
                imageFile.createNewFile();
                out = new FileOutputStream(imageFile);
                params[0].compress(Bitmap.CompressFormat.PNG, 100, out);
                out.close();
                connectMediaScan(imageFile.toString());

            } catch (IOException e) {
                e.printStackTrace();
            }
            return imageFile.toString();
        }

    private void connectMediaScan(final String filename) {
        msc = new MediaScannerConnection(mActivity, new MediaScannerConnection.MediaScannerConnectionClient() {

            @Override
            public void onScanCompleted(String path, Uri uri) {
                msc.disconnect();
            }

            @Override
            public void onMediaScannerConnected() {
                msc.scanFile(filename, "image/png");
            }
        });
        msc.connect();
    }

}


text:
class Codepostal < ActiveRecord::Base
	has_many :villes
	has_many :point_de_vues
end


text:
<?php
namespace Tms\Bundle\ModelIOBundle\Tests\Import;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use JMS\Serializer as Serializer;
use JMS\Serializer\SerializerInterface;
use Doctrine\ORM\EntityManager;

class ImportTest extends WebTestCase
{
    public function testImportService()
    {
        $kernel = static::createKernel();
        $kernel->boot();
        $container = $kernel->getContainer();

        $importService = $container->get('tms_model_io.importer');

        $object = $importService->createObject(
            'Tms\Bundle\OperationBundle\Entity\Product',
            '{
                "name":"test",
                "shortDescription":"courte description",
                "longDescription":"longue description",
                "ean13":"1",
                "refundable":"1"
            }'
        );
        var_dump(print_r($object));
        $this->assertInstanceOf(
            "Tms\Bundle\OperationBundle\Entity\Product",
            $object,
            "not a Tms\Bundle\OperationBundle\Entity\Product"
        );
        // $name = "test" . sha1(date(""));
        // $importService->import(
        //     $em,
        //     'Tms\Bundle\OperationBundle\Entity\Product',
        //     '{
        //         "customer":"1",
        //         "refundable":"1",
        //         "name": "'.$name.'",
        //         "shortDescription":"courte description",
        //         "longDescription":"longue description",
        //         "ean13":"1"
        //     }',
        //     'json'
        // );
        // $product  = $em->getRepository("Tms\Bundle\OperationBundle\Entity\Repository\ProductRepository")->findOneBy(array('name'=>$name));
        // var_dump($product);
    }

}


text:
'use strict';

/**
 * @Usage
 *
 * Define a value of 'config' at the app level that contains an hashmap of 'color'.
 *
 * angular.module('cm.services', [])
 *   .value('config', {colors:{blue: '#5484ED', red: '#A4BDFC', purple: '#46D6DB'}});
 *
 * The event 'colorPickerUpdated' is broadcasted when the color change.
 * The selected color is passed as the argument.
 *
 * Place the directive wherever you want.
 *  <ng-color-picker></ng-color-picker>
 *
 * Sample CSS (SASS)
 *  .color-picker {
 *    .color {
 *      width: 15px;
 *      height: 15px;
 *      padding: 8px;
 *      border: 1px solid #fff;
 *
 *      &:hover {
 *        cursor: pointer;
 *      }
 *    }
 *  }
 */

angular.module('modules.colorPicker', [])
  .directive('ngColorPicker', [function() {
    return {
      restrict: 'E',
      replace: true,
      scope : '@=',
      template: '
'
      +           '
'
      +           ''
      +             '
'
      +             '
'
      +           ''
      +           '
'
      +         '
',
      compile: function compile(tElement, tAttrs, transclude) {
        return {
          post: function postLink(scope, iElement, iAttrs, controller) {
            scope.colorList = [];
            var i = 0;
            angular.forEach(scope.colors, function(hex, name) {
              scope.colorList.push({
                color : hex,
                name : name,
                select : i === 0 ? 2 : 1
              });
              i++;
            });
          }
        };
      },
      controller: function($scope, config) {
        $scope.colors = config.colors;

        $scope.selectColor = function(color) {
          for (var i = 0; i < $scope.colorList.length; i++) {
            $scope.colorList[i].select = 1;
            if ($scope.colorList[i] === color) {
              $scope.colorList[i].select = 2;
              $scope.$broadcast('colorPickerUpdated', color);
            }
          }
        };
      }
    };
  }]);