text:
package org.jetbrains.plugins.scala.lang.completion

import com.intellij.codeInsight.completion._
import com.intellij.codeInsight.lookup.{LookupElementWeigher, LookupElement}
import com.intellij.patterns.PlatformPatterns
import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.util.ProcessingContext
import org.jetbrains.plugins.scala.lang.completion.lookups.ScalaLookupItem
import org.jetbrains.plugins.scala.lang.psi.api.base.patterns.{ScPattern, ScPatternArgumentList, ScConstructorPattern, ScCaseClause}
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScFunctionDefinition
import org.jetbrains.plugins.scala.lang.psi.api.statements.params.ScParameter
import org.jetbrains.plugins.scala.lang.refactoring.namesSuggester.NameSuggester

/**
  * Created by kate
  * on 1/29/16
  */
class ScalaCaseClassParametersNameContributer extends ScalaCompletionContributor {
  extend(CompletionType.BASIC, PlatformPatterns.psiElement(), new CompletionProvider[CompletionParameters] {

    def addCompletions(parameters: CompletionParameters, context: ProcessingContext, _result: CompletionResultSet) {
      val position = positionFromParameters(parameters)
      val scope = PsiTreeUtil.getContextOfType(position, classOf[ScCaseClause])
      if (scope == null) return

      val constructorPattern = PsiTreeUtil.getContextOfType(position, classOf[ScConstructorPattern])
      if (constructorPattern == null) return

      val classRef = constructorPattern.asInstanceOf[ScConstructorPattern].ref
      val caseClassParams = classRef.resolve() match {
        case funcDef: ScFunctionDefinition if funcDef.syntheticCaseClass.isDefined =>
          funcDef.syntheticCaseClass.get.parameters
        case _ => return
      }

      if (caseClassParams.isEmpty) return

      val (corespondedParameter, myPosition) = getCorrespondedParameterForPosition(position, caseClassParams)
      val result = addByOrderSorter(parameters, _result, myPosition, caseClassParams)

      byClassParamCompletionsItems(caseClassParams, result)
      byTypeCompletionsItems(position, corespondedParameter, result)

      result.stopHere()
    }

    def byTypeCompletionsItems(position: PsiElement, parameter: ScParameter, result: CompletionResultSet) = {
      position.getContext match {
        case pattern: ScPattern if pattern.expectedType.isDefined && parameter != null =>
          val lookups =
            NameSuggester.suggestNamesByType(pattern.expectedType.get).map(name => new ScalaLookupItem(parameter, name))
          lookups.foreach(l => result.addElement(l))
        case _ =>
      }
    }

    def byClassParamCompletionsItems(params: Seq[ScParameter], result: CompletionResultSet): Unit = {
      params.map(p => new ScalaLookupItem(p, p.name)).foreach(l => result.addElement(l))
    }

    def addByOrderSorter(parameters: CompletionParameters, result: CompletionResultSet,
                         currentPosition: Int, classParams: Seq[ScParameter]): CompletionResultSet = {

      class PreferByParamsOrder extends LookupElementWeigher("orderByPosition") {
        override def weigh(item: LookupElement): Comparable[_] = {
          ScalaLookupItem.original(item) match {
            case s: ScalaLookupItem =>
              s.element match {
                case param: ScParameter if param.name == s.name /*not equals when name computed by type*/ =>
                  val positionInClassParameters = classParams.indexOf(param)
                  if (currentPosition == positionInClassParameters) -1
                  else math.abs(currentPosition - positionInClassParameters)
                case _ => 0
              }
            case _ => null
          }
        }
      }

      var sorter = CompletionSorter.defaultSorter(parameters, result.getPrefixMatcher)
      sorter = sorter.weighAfter("prefix", new PreferByParamsOrder())
      result.withRelevanceSorter(sorter)
    }

    def getCorrespondedParameterForPosition(position: PsiElement, classParams: Seq[ScParameter]): (ScParameter, Int) = {
      val me = PsiTreeUtil.getContextOfType(position, classOf[ScPattern])
      if (me == null) return (null, -1)

      val patterns = Option(PsiTreeUtil.getContextOfType(position, classOf[ScPatternArgumentList])).map(_.patterns)

      if (patterns.isEmpty || (patterns.isDefined && patterns.get.length > classParams.length))
        return (null, -1) //try to type more param than can be

      val myPosition = patterns.get.indexOf(me)
      val coresponedParameter =
        if ((myPosition >= 0) && (myPosition != classParams.length)) classParams.apply(myPosition) else null

      (coresponedParameter, myPosition)
    }
  })
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Jonathan Langley - GIS Portfolio -</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/freelancer.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                        Portfolio

                        About

                        Contact

                        Jonathan Langley

                        - GIS and Data Analysis -

Portfolio

This Leaflet interactive map was created using a Stamen, "Terrain", basemap.  This map makes for easy visualization for the amount of park space in each Chicago neighborhood.

Portfolio

This story map was created using ArcGIS Online.  The "Story Map Tour" templet was used to show the Chicago Bears 2015 schedule.

About

I graduated from Kent State University, Ohio, in 2001.  While at KSU I earned a B.A. in Earth Science with a minor in Geology.

I am currently enrolled at Northeastern Illinois University.  I am pursuing a Graduate Certificate in GIS.

                         Download Theme

Contact Me

                    <form name="sentMessage" id="contactForm" novalidate>

                                Name
                                <input type="text" class="form-control" placeholder="Name" id="name" required data-validation-required-message="Please enter your name.">

                                Email Address
                                <input type="email" class="form-control" placeholder="Email Address" id="email" required data-validation-required-message="Please enter your email address.">

                                Phone Number
                                <input type="tel" class="form-control" placeholder="Phone Number" id="phone" required data-validation-required-message="Please enter your phone number.">

                                Message
                                <textarea rows="5" class="form-control" placeholder="Message" id="message" required data-validation-required-message="Please enter a message."></textarea>

                                <button type="submit" class="btn btn-success btn-lg">Send</button>

                    </form>

Contact Me...

j-langley@neiu.edu
330-441-0569

Around the Web

GIS and Data Analysis

Familiar with ArcGIS ,FOSS GIS, and R.

                        Copyright © J.Langley 2015

Project Title

Use this area of the page to describe your project. The icon above is part of a free icon set by Flat Icons. On their website, you can download their free set with 16 icons, or you can purchase the entire set with 146 icons for only $12!

Client:
                                    Start Bootstrap

Date:
                                    April 2014

Service:
                                    Web Development

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

Project Title

Use this area of the page to describe your project. The icon above is part of a free icon set by Flat Icons. On their website, you can download their free set with 16 icons, or you can purchase the entire set with 146 icons for only $12!

Client:
                                    Start Bootstrap

Date:
                                    April 2014

Service:
                                    Web Development

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

Project Title

Use this area of the page to describe your project. The icon above is part of a free icon set by Flat Icons. On their website, you can download their free set with 16 icons, or you can purchase the entire set with 146 icons for only $12!

Client:
                                    Start Bootstrap

Date:
                                    April 2014

Service:
                                    Web Development

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

Project Title

Use this area of the page to describe your project. The icon above is part of a free icon set by Flat Icons. On their website, you can download their free set with 16 icons, or you can purchase the entire set with 146 icons for only $12!

Client:
                                    Start Bootstrap

Date:
                                    April 2014

Service:
                                    Web Development

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

Project Title

Use this area of the page to describe your project. The icon above is part of a free icon set by Flat Icons. On their website, you can download their free set with 16 icons, or you can purchase the entire set with 146 icons for only $12!

Client:
                                    Start Bootstrap

Date:
                                    April 2014

Service:
                                    Web Development

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

Project Title

Use this area of the page to describe your project. The icon above is part of a free icon set by Flat Icons. On their website, you can download their free set with 16 icons, or you can purchase the entire set with 146 icons for only $12!

Client:
                                    Start Bootstrap

Date:
                                    April 2014

Service:
                                    Web Development

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

redpajama_set_name: RedPajamaGithub


text:
__attribute__((used))
#endif // __llvm__
void
DummyReferenceToExportedAPI()
{
    CLRDataCreateInstance(IID_ICLRDataTarget, NULL, NULL);
}

#endif // FEATURE_PAL


text:
package org.hisp.dhis.program;

import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;

import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * @author Abyot Asalefew
 * @version $Id$
 */
public interface ProgramInstanceStore
    extends GenericIdentifiableObjectStore<ProgramInstance>
{
    String ID = ProgramInstanceStore.class.getName();

    /**
     * Count all program instances by PI query params.
     *
     * @param params ProgramInstanceQueryParams to use
     * @return Count of matching PIs
     */
    int countProgramInstances( ProgramInstanceQueryParams params );

    /**
     * Get all program instances by PI query params.
     *
     * @param params ProgramInstanceQueryParams to use
     * @return PIs matching params
     */
    List<ProgramInstance> getProgramInstances( ProgramInstanceQueryParams params );

    /**
     * Retrieve program instances on a program
     *
     * @param program Program
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Program program );

    /**
     * Retrieve program instances on program list
     *
     * @param programs Program list
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Collection<Program> programs );

    /**
     * Retrieve program instances of whom registered in to a orgunit from
     * program list
     *
     * @param programs         Program list
     * @param organisationUnit Organisation Unit
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Collection<Program> programs, OrganisationUnit organisationUnit );

    /**
     * Retrieve program instances of whom registered in to a orgunit from
     * program list with a certain status
     *
     * @param programs         Program list
     * @param organisationUnit Organisation Unit
     * @param status           Status of program-instance, include STATUS_ACTIVE,
     *                         STATUS_COMPLETED and STATUS_CANCELLED
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Collection<Program> programs, OrganisationUnit organisationUnit, ProgramStatus status );

    /**
     * Retrieve program instances on a program by status
     *
     * @param program Program
     * @param status  Status of program-instance, include STATUS_ACTIVE,
     *                STATUS_COMPLETED and STATUS_CANCELLED
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Program program, ProgramStatus status );

    /**
     * Retrieve program instances on a program list by status
     *
     * @param programs Program list
     * @param status   Status of program-instance, include STATUS_ACTIVE,
     *                 STATUS_COMPLETED and STATUS_CANCELLED
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Collection<Program> programs, ProgramStatus status );

    /**
     * Retrieve program instances on a TrackedEntityInstance by a status
     *
     * @param entityInstance TrackedEntityInstance
     * @param status         Status of program-instance, include STATUS_ACTIVE,
     *                       STATUS_COMPLETED and STATUS_CANCELLED
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( TrackedEntityInstance entityInstance, ProgramStatus status );

    /**
     * Retrieve program instances on a TrackedEntityInstance by a program
     *
     * @param entityInstance TrackedEntityInstance
     * @param program        Program
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( TrackedEntityInstance entityInstance, Program program );

    /**
     * Retrieve program instances on a TrackedEntityInstance with a status by a program
     *
     * @param entityInstance TrackedEntityInstance
     * @param program        Program
     * @param status         Status of program-instance, include STATUS_ACTIVE,
     *                       STATUS_COMPLETED and STATUS_CANCELLED
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( TrackedEntityInstance entityInstance, Program program, ProgramStatus status );

    /**
     * Retrieve program instances with active status on an orgunit by a program
     * with result limited
     *
     * @param program          Program
     * @param organisationUnit Organisation Unit
     * @param min              First result
     * @param max              Maximum results
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Program program, OrganisationUnit organisationUnit, Integer min, Integer max );

    /**
     * Retrieve program instances with active status on an orgunit by a program
     * for a certain period with result limited
     *
     * @param program    Program
     * @param orgunitIds Organisation Units
     * @param startDate  The start date for retrieving on enrollment-date
     * @param endDate    The end date for retrieving on enrollment-date
     * @param min        First result
     * @param max        Maximum results
     * @return ProgramInstance list
     */
    List<ProgramInstance> get( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
        Integer min, Integer max );

    /**
     * Get the number of program instances of a program on an organisation unit
     *
     * @param program          Program
     * @param organisationUnit Organisation Unit
     * @return ProgramInstance list
     */
    int count( Program program, OrganisationUnit organisationUnit );

    /**
     * Get the number of program instances which are active status and
     * registered in a certain orgunit by a program for a certain period
     *
     * @param program    Program
     * @param orgunitIds Organisation Units
     * @param startDate  The start date for retrieving on enrollment-date
     * @param endDate    The end date for retrieving on enrollment-date
     * @return ProgramInstance list
     */
    int count( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate );

    /**
     * Get the number of program instances of a program which have a certain
     * status and an orgunit ids list for a period
     *
     * @param status     of program-instance, include STATUS_ACTIVE,
     *                   STATUS_COMPLETED and STATUS_CANCELLED
     * @param program    ProgramInstance
     * @param orgunitIds A list of orgunit ids
     * @param startDate  The start date for retrieving on enrollment-date
     * @param endDate    The end date for retrieving on enrollment-date
     * @return A number
     */
    int countByStatus( ProgramStatus status, Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate );

    /**
     * Retrieve program instances with a certain status on a program and an
     * orgunit ids list for a period
     *
     * @param status     of program-instance, include STATUS_ACTIVE,
     *                   STATUS_COMPLETED and STATUS_CANCELLED
     * @param program    ProgramInstance
     * @param orgunitIds A list of orgunit ids
     * @param startDate  The start date for retrieving on enrollment-date
     * @param endDate    The end date for retrieving on enrollment-date
     * @return ProgramInstance list
     */
    List<ProgramInstance> getByStatus( ProgramStatus status, Program program, Collection<Integer> orgunitIds,
        Date startDate, Date endDate );

    /**
     * Retrieve program instances with a certain status on a program and an
     * orgunit ids list for a period
     *
     * @param status     of program-instance, include STATUS_ACTIVE,
     *                   STATUS_COMPLETED and STATUS_CANCELLED
     * @param program    ProgramInstance
     * @param orgunitIds A list of orgunit ids
     * @param startDate  The start date for retrieving on enrollment-date
     * @param endDate    The end date for retrieving on enrollment-date
     * @return ProgramInstance list
     */
    List<ProgramInstance> getByStatus( ProgramStatus status, Program program, Collection<Integer> orgunitIds,
        Date startDate, Date endDate, Integer min, Integer max );

    /**
     * Rerieve schedule list of patiens registered
     *
     * @return A SchedulingProgramObject list
     */
    Collection<SchedulingProgramObject> getSendMesssageEvents( String dateToCompare );

    /**
     * Checks for the existence of a PI by UID
     *
     * @param uid PSI UID to check for
     * @return true/false depending on result
     */
    boolean exists( String uid );
}


text:
/*DO NOT EDIT THIS FILE - it is machine generated*/

package com.badlogic.gdx.backends.iosrobovm;

import java.io.File;
import com.badlogic.gdx.ApplicationLogger;
import com.badlogic.gdx.backends.iosrobovm.objectal.OALIOSAudio;
import org.robovm.apple.coregraphics.CGRect;
import org.robovm.apple.foundation.Foundation;
import org.robovm.apple.foundation.NSMutableDictionary;
import org.robovm.apple.foundation.NSObject;
import org.robovm.apple.foundation.NSProcessInfo;
import org.robovm.apple.foundation.NSString;
import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.uikit.UIApplicationDelegateAdapter;
import org.robovm.apple.uikit.UIApplicationLaunchOptions;
import org.robovm.apple.uikit.UIDevice;
import org.robovm.apple.uikit.UIUserInterfaceIdiom;
import org.robovm.apple.uikit.UIPasteboard;
import org.robovm.apple.uikit.UIScreen;
import org.robovm.apple.uikit.UIViewController;
import org.robovm.apple.uikit.UIWindow;
import org.robovm.rt.bro.Bro;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Audio;
import com.badlogic.gdx.Files;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.LifecycleListener;
import com.badlogic.gdx.Net;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Clipboard;

/** DO NOT EDIT THIS FILE - it is machine generated */
public class IOSApplication implements Application {

	/** DO NOT EDIT THIS FILE - it is machine generated */
	public static abstract class Delegate extends UIApplicationDelegateAdapter {

		private IOSApplication app;

		protected abstract IOSApplication createApplication ();

		@Override
		public boolean didFinishLaunching (UIApplication application, UIApplicationLaunchOptions launchOptions) {
			// Prevent this from being GCed until the ObjC UIApplication is deallocated
			application.addStrongRef(this);
			this.app = createApplication();
			return app.didFinishLaunching(application, launchOptions);
		}

		@Override
		public void didBecomeActive (UIApplication application) {
			app.didBecomeActive(application);
		}

		@Override
		public void willEnterForeground (UIApplication application) {
			app.willEnterForeground(application);
		}

		@Override
		public void willResignActive (UIApplication application) {
			app.willResignActive(application);
		}

		@Override
		public void willTerminate (UIApplication application) {
			app.willTerminate(application);
		}
	}

	static final boolean IS_METALANGLE = true;

	UIApplication uiApp;

	UIWindow uiWindow;

	ApplicationListener listener;

	IOSViewControllerListener viewControllerListener;

	IOSApplicationConfiguration config;

	IOSGraphics graphics;

	IOSAudio audio;

	Files files;

	IOSInput input;

	IOSNet net;

	int logLevel = Application.LOG_DEBUG;

	ApplicationLogger applicationLogger;

	/** The display scale factor (1.0f for normal; 2.0f to use retina coordinates/dimensions). */
	float pixelsPerPoint;

	private IOSScreenBounds lastScreenBounds = null;

	Array<Runnable> runnables = new Array<Runnable>();

	Array<Runnable> executedRunnables = new Array<Runnable>();

	Array<LifecycleListener> lifecycleListeners = new Array<LifecycleListener>();

	public IOSApplication (ApplicationListener listener, IOSApplicationConfiguration config) {
		this.listener = listener;
		this.config = config;
	}

	final boolean didFinishLaunching (UIApplication uiApp, UIApplicationLaunchOptions options) {
		setApplicationLogger(new IOSApplicationLogger());
		Gdx.app = this;
		this.uiApp = uiApp;
		// enable or disable screen dimming
		uiApp.setIdleTimerDisabled(config.preventScreenDimming);
		Gdx.app.debug("IOSApplication", "iOS version: " + UIDevice.getCurrentDevice().getSystemVersion());
		Gdx.app.debug("IOSApplication", "Running in " + (Bro.IS_64BIT ? "64-bit" : "32-bit") + " mode");
		// iOS counts in "points" instead of pixels. Points are logical pixels
		pixelsPerPoint = (float)UIScreen.getMainScreen().getNativeScale();
		Gdx.app.debug("IOSApplication", "Pixels per point: " + pixelsPerPoint);
		this.uiWindow = new UIWindow(UIScreen.getMainScreen().getBounds());
		this.uiWindow.makeKeyAndVisible();
		uiApp.getDelegate().setWindow(uiWindow);
		// setup libgdx
		this.input = createInput();
		this.graphics = createGraphics();
		Gdx.gl = Gdx.gl20 = graphics.gl20;
		Gdx.gl30 = graphics.gl30;
		this.files = createFiles();
		this.audio = createAudio(config);
		this.net = new IOSNet(this, config);
		Gdx.files = this.files;
		Gdx.graphics = this.graphics;
		Gdx.audio = this.audio;
		Gdx.input = this.input;
		Gdx.net = this.net;
		this.input.setupPeripherals();
		this.uiWindow.setRootViewController(this.graphics.viewController);
		this.graphics.updateSafeInsets();
		Gdx.app.debug("IOSApplication", "created");
		listener.create();
		listener.resize(this.graphics.getWidth(), this.graphics.getHeight());
		// make sure the OpenGL view has contents before displaying it
		this.graphics.view.display();
		return true;
	}

	protected Files createFiles () {
		return new IOSFiles();
	}

	protected IOSAudio createAudio (IOSApplicationConfiguration config) {
		return new OALIOSAudio(config);
	}

	protected IOSGraphics createGraphics () {
		return new IOSGraphics(this, config, input, config.useGL30);
	}

	protected IOSUIViewController createUIViewController (IOSGraphics graphics) {
		return new IOSUIViewController(this, graphics);
	}

	protected IOSInput createInput () {
		return new DefaultIOSInput(this);
	}

	/** Returns device ppi using a best guess approach when device is unknown. Overwrite to customize strategy. */
	protected int guessUnknownPpi () {
		int ppi;
		if (UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad)
			ppi = 132 * (int)pixelsPerPoint;
		else
			ppi = 164 * (int)pixelsPerPoint;
		error("IOSApplication", "Device PPI unknown. PPI value has been guessed to " + ppi + " but may be wrong");
		return ppi;
	}

	/** Return the UI view controller of IOSApplication
	 * @return the view controller of IOSApplication */
	public UIViewController getUIViewController () {
		return graphics.viewController;
	}

	/** Return the UI Window of IOSApplication
	 * @return the window */
	public UIWindow getUIWindow () {
		return uiWindow;
	}

	/** @see IOSScreenBounds for detailed explanation
	 * @return logical dimensions of space we draw to, adjusted for device orientation */
	protected IOSScreenBounds computeBounds () {
		CGRect screenBounds = uiWindow.getBounds();
		final CGRect statusBarFrame = uiApp.getStatusBarFrame();
		double statusBarHeight = statusBarFrame.getHeight();
		double screenWidth = screenBounds.getWidth();
		double screenHeight = screenBounds.getHeight();
		if (statusBarHeight != 0.0) {
			debug("IOSApplication", "Status bar is visible (height = " + statusBarHeight + ")");
			screenHeight -= statusBarHeight;
		} else {
			debug("IOSApplication", "Status bar is not visible");
		}
		final int offsetX = 0;
		final int offsetY = (int)Math.round(statusBarHeight);
		final int width = (int)Math.round(screenWidth);
		final int height = (int)Math.round(screenHeight);
		final int backBufferWidth = (int)Math.round(screenWidth * pixelsPerPoint);
		final int backBufferHeight = (int)Math.round(screenHeight * pixelsPerPoint);
		debug("IOSApplication", "Computed bounds are x=" + offsetX + " y=" + offsetY + " w=" + width + " h=" + height + " bbW= "
			+ backBufferWidth + " bbH= " + backBufferHeight);
		return lastScreenBounds = new IOSScreenBounds(offsetX, offsetY, width, height, backBufferWidth, backBufferHeight);
	}

	/** @return area of screen in UIKit points on which libGDX draws, with 0,0 being upper left corner */
	public IOSScreenBounds getScreenBounds () {
		if (lastScreenBounds == null)
			return computeBounds();
		else
			return lastScreenBounds;
	}

	final void didBecomeActive (UIApplication uiApp) {
		Gdx.app.debug("IOSApplication", "resumed");
		audio.didBecomeActive();
		graphics.makeCurrent();
		graphics.resume();
	}

	final void willEnterForeground (UIApplication uiApp) {
		audio.willEnterForeground();
	}

	final void willResignActive (UIApplication uiApp) {
		Gdx.app.debug("IOSApplication", "paused");
		audio.willResignActive();
		graphics.makeCurrent();
		graphics.pause();
		Gdx.gl.glFinish();
	}

	final void willTerminate (UIApplication uiApp) {
		Gdx.app.debug("IOSApplication", "disposed");
		audio.willTerminate();
		graphics.makeCurrent();
		Array<LifecycleListener> listeners = lifecycleListeners;
		synchronized (listeners) {
			for (LifecycleListener listener : listeners) {
				listener.pause();
			}
		}
		listener.dispose();
		Gdx.gl.glFinish();
	}

	@Override
	public ApplicationListener getApplicationListener () {
		return listener;
	}

	@Override
	public Graphics getGraphics () {
		return graphics;
	}

	@Override
	public Audio getAudio () {
		return audio;
	}

	@Override
	public Input getInput () {
		return input;
	}

	@Override
	public Files getFiles () {
		return files;
	}

	@Override
	public Net getNet () {
		return net;
	}

	@Override
	public void debug (String tag, String message) {
		if (logLevel >= LOG_DEBUG) getApplicationLogger().debug(tag, message);
	}

	@Override
	public void debug (String tag, String message, Throwable exception) {
		if (logLevel >= LOG_DEBUG) getApplicationLogger().debug(tag, message, exception);
	}

	@Override
	public void log (String tag, String message) {
		if (logLevel >= LOG_INFO) getApplicationLogger().log(tag, message);
	}

	@Override
	public void log (String tag, String message, Throwable exception) {
		if (logLevel >= LOG_INFO) getApplicationLogger().log(tag, message, exception);
	}

	@Override
	public void error (String tag, String message) {
		if (logLevel >= LOG_ERROR) getApplicationLogger().error(tag, message);
	}

	@Override
	public void error (String tag, String message, Throwable exception) {
		if (logLevel >= LOG_ERROR) getApplicationLogger().error(tag, message, exception);
	}

	@Override
	public void setLogLevel (int logLevel) {
		this.logLevel = logLevel;
	}

	@Override
	public int getLogLevel () {
		return logLevel;
	}

	@Override
	public void setApplicationLogger (ApplicationLogger applicationLogger) {
		this.applicationLogger = applicationLogger;
	}

	@Override
	public ApplicationLogger getApplicationLogger () {
		return applicationLogger;
	}

	@Override
	public ApplicationType getType () {
		return ApplicationType.iOS;
	}

	@Override
	public int getVersion () {
		return (int)NSProcessInfo.getSharedProcessInfo().getOperatingSystemVersion().getMajorVersion();
	}

	@Override
	public long getJavaHeap () {
		return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
	}

	@Override
	public long getNativeHeap () {
		return getJavaHeap();
	}

	@Override
	public Preferences getPreferences (String name) {
		File libraryPath = new File(System.getenv("HOME"), "Library");
		File finalPath = new File(libraryPath, name + ".plist");
		@SuppressWarnings("unchecked")
		NSMutableDictionary<NSString, NSObject> nsDictionary = (NSMutableDictionary<NSString, NSObject>)NSMutableDictionary
			.read(finalPath);
		// if it fails to get an existing dictionary, create a new one.
		if (nsDictionary == null) {
			nsDictionary = new NSMutableDictionary<NSString, NSObject>();
			nsDictionary.write(finalPath, false);
		}
		return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath());
	}

	@Override
	public void postRunnable (Runnable runnable) {
		synchronized (runnables) {
			runnables.add(runnable);
			Gdx.graphics.requestRendering();
		}
	}

	public void processRunnables () {
		synchronized (runnables) {
			executedRunnables.clear();
			executedRunnables.addAll(runnables);
			runnables.clear();
		}
		for (int i = 0; i < executedRunnables.size; i++) {
			try {
				executedRunnables.get(i).run();
			} catch (Throwable t) {
				t.printStackTrace();
			}
		}
	}

	@Override
	public void exit () {
		System.exit(0);
	}

	@Override
	public Clipboard getClipboard () {
		return new Clipboard() {

			@Override
			public void setContents (String content) {
				UIPasteboard.getGeneralPasteboard().setString(content);
			}

			@Override
			public boolean hasContents () {
				if (Foundation.getMajorSystemVersion() >= 10) {
					return UIPasteboard.getGeneralPasteboard().hasStrings();
				}
				String contents = getContents();
				return contents != null && !contents.isEmpty();
			}

			@Override
			public String getContents () {
				return UIPasteboard.getGeneralPasteboard().getString();
			}
		};
	}

	@Override
	public void addLifecycleListener (LifecycleListener listener) {
		synchronized (lifecycleListeners) {
			lifecycleListeners.add(listener);
		}
	}

	@Override
	public void removeLifecycleListener (LifecycleListener listener) {
		synchronized (lifecycleListeners) {
			lifecycleListeners.removeValue(listener, true);
		}
	}

	/** Add a listener to handle events from the libGDX root view controller
	 * @param listener The {#link IOSViewControllerListener} to add */
	public void addViewControllerListener (IOSViewControllerListener listener) {
		viewControllerListener = listener;
	}
}


text:
require 'active_support/core_ext/string'

module AlterGitFlow::Scenarios
  class ScenarioRunner

    attr_reader :parser

    def initialize(parser)
      @parser = parser
    end

    def execute(command_runner)
      command_runner.run(instantiate_scenario.commands)
    end

    private

    def instantiate_scenario
      scenario_class.constantize.new(parser.arguments)
    end

    def scenario_class
      "#{parser.scenario.to_s.classify}Scenario"
    end

  end
end


text:
package fabhttp

import (
	"context"
	"crypto/tls"
	"net"
	"net/http"
	"os"
	"time"

	"github.com/hyperledger/fabric/common/flogging"
	"github.com/hyperledger/fabric/common/util"
	"github.com/hyperledger/fabric/core/middleware"
)

//go:generate counterfeiter -o fakes/logger.go -fake-name Logger . Logger

type Logger interface {
	Warn(args ...interface{})
	Warnf(template string, args ...interface{})
}

type Options struct {
	Logger        Logger
	ListenAddress string
	TLS           TLS
}

type Server struct {
	logger     Logger
	options    Options
	httpServer *http.Server
	mux        *http.ServeMux
	addr       string
}

func NewServer(o Options) *Server {
	logger := o.Logger
	if logger == nil {
		logger = flogging.MustGetLogger("fabhttp")
	}

	server := &Server{
		logger:  logger,
		options: o,
	}

	server.initializeServer()

	return server
}

func (s *Server) Run(signals <-chan os.Signal, ready chan<- struct{}) error {
	err := s.Start()
	if err != nil {
		return err
	}

	close(ready)

	<-signals
	return s.Stop()
}

func (s *Server) Start() error {
	listener, err := s.Listen()
	if err != nil {
		return err
	}
	s.addr = listener.Addr().String()

	go s.httpServer.Serve(listener)

	return nil
}

func (s *Server) Stop() error {
	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()

	return s.httpServer.Shutdown(ctx)
}

func (s *Server) initializeServer() {
	s.mux = http.NewServeMux()
	s.httpServer = &http.Server{
		Addr:         s.options.ListenAddress,
		Handler:      s.mux,
		ReadTimeout:  10 * time.Second,
		WriteTimeout: 2 * time.Minute,
	}
}

func (s *Server) HandlerChain(h http.Handler, secure bool) http.Handler {
	if secure {
		return middleware.NewChain(middleware.RequireCert(), middleware.WithRequestID(util.GenerateUUID)).Handler(h)
	}
	return middleware.NewChain(middleware.WithRequestID(util.GenerateUUID)).Handler(h)
}

// RegisterHandler registers into the ServeMux a handler chain that borrows
// its security properties from the fabhttp.Server. This method is thread
// safe because ServeMux.Handle() is thread safe, and options are immutable.
// This method can be called either before or after Server.Start(). If the
// pattern exists the method panics.
func (s *Server) RegisterHandler(pattern string, handler http.Handler, secure bool) {
	s.mux.Handle(
		pattern,
		s.HandlerChain(
			handler,
			secure,
		),
	)
}

func (s *Server) Listen() (net.Listener, error) {
	listener, err := net.Listen("tcp", s.options.ListenAddress)
	if err != nil {
		return nil, err
	}
	tlsConfig, err := s.options.TLS.Config()
	if err != nil {
		return nil, err
	}
	if tlsConfig != nil {
		listener = tls.NewListener(listener, tlsConfig)
	}
	return listener, nil
}

func (s *Server) Addr() string {
	return s.addr
}

func (s *Server) Log(keyvals ...interface{}) error {
	s.logger.Warn(keyvals...)
	return nil
}


text:
> [Yeoman](http://yeoman.io) generator

## Getting Started

### Yeoman Generators

To install generator-bagle-component from npm, run:

```
$ npm install -g generator-bagle-component
```

Finally, initiate the generator:

```
$ yo bagle-component
```
## License

MIT


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

import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.wsdl.BindingOperation;
import javax.wsdl.Definition;
import javax.wsdl.Operation;
import javax.wsdl.Port;
import javax.wsdl.Service;
import javax.wsdl.Types;
import javax.wsdl.WSDLException;
import javax.wsdl.extensions.schema.Schema;
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.flowable.bpmn.model.Import;
import org.flowable.engine.common.api.FlowableException;
import org.flowable.engine.common.impl.util.ReflectUtil;
import org.flowable.engine.impl.bpmn.data.SimpleStructureDefinition;
import org.flowable.engine.impl.bpmn.data.StructureDefinition;
import org.flowable.engine.impl.bpmn.parser.XMLImporter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JFieldVar;
import com.sun.tools.xjc.ConsoleErrorReporter;
import com.sun.tools.xjc.api.ErrorListener;
import com.sun.tools.xjc.api.Mapping;
import com.sun.tools.xjc.api.S2JJAXBModel;
import com.sun.tools.xjc.api.SchemaCompiler;
import com.sun.tools.xjc.api.XJC;

/**
 * A WSDL importer
 *
 * @author Esteban Robles Luna
 */
public class WSDLImporter implements XMLImporter {

    protected Map<String, WSService> wsServices = new HashMap<>();

    protected Map<String, WSOperation> wsOperations = new HashMap<>();

    protected Map<String, StructureDefinition> structures = new HashMap<>();

    protected String wsdlLocation;

    protected String namespace;

    public WSDLImporter() {
        this.namespace = "";
    }

    public void importFrom(Import theImport, String sourceSystemId) {
        this.namespace = theImport.getNamespace() == null ? "" : theImport.getNamespace() + ":";
        this.importFrom(theImport.getLocation());
    }

    public void importFrom(String url) {
        this.wsServices.clear();
        this.wsOperations.clear();
        this.structures.clear();

        this.wsdlLocation = url;

        try {
            Definition definition = this.parseWSDLDefinition();
            this.importServicesAndOperations(definition);
            this.importTypes(definition.getTypes());
        } catch (WSDLException e) {
            throw new FlowableException(e.getMessage(), e);
        }
    }

    /**
     * Parse the WSDL definition using WSDL4J.
     */
    protected Definition parseWSDLDefinition() throws WSDLException {
        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
        WSDLReader reader = wsdlFactory.newWSDLReader();
        reader.setFeature("javax.wsdl.verbose", false);
        reader.setFeature("javax.wsdl.importDocuments", true);
        Definition definition = reader.readWSDL(this.wsdlLocation);
        return definition;
    }

    /**
     * Imports services and operations from the WSDL definition
     */
    protected void importServicesAndOperations(Definition definition) {
        for (Object serviceObject : definition.getServices().values()) {
            Service service = (Service) serviceObject;
            WSService wsService = this.importService(service);
            this.wsServices.put(this.namespace + wsService.getName(), wsService);

            Port port = (Port) service.getPorts().values().iterator().next();
            for (Object bindOperationObject : port.getBinding().getBindingOperations()) {
                BindingOperation bindOperation = (BindingOperation) bindOperationObject;
                WSOperation operation = this.processOperation(bindOperation.getOperation(), wsService);
                wsService.addOperation(operation);

                this.wsOperations.put(this.namespace + operation.getName(), operation);
            }
        }
    }

    /**
     * Imports the service from the WSDL service definition
     */
    protected WSService importService(Service service) {
        String name = service.getQName().getLocalPart();
        Port port = (Port) service.getPorts().values().iterator().next();
        String location = "";

        List extensionElements = port.getExtensibilityElements();
        for (Object extension : extensionElements) {
            if (extension instanceof SOAPAddress) {
                SOAPAddress address = (SOAPAddress) extension;
                location = address.getLocationURI();
            }
        }

        WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation);
        return wsService;
    }

    protected WSOperation processOperation(Operation wsOperation, WSService service) {
        WSOperation operation = new WSOperation(this.namespace + wsOperation.getName(), wsOperation.getName(), service);
        return operation;
    }

    /**
     * Import the Types from the WSDL definition using the same strategy that Cxf uses taking advantage of JAXB
     */
    protected void importTypes(Types types) {
        SchemaCompiler compiler = XJC.createSchemaCompiler();
        ErrorListener elForRun = new ConsoleErrorReporter();
        compiler.setErrorListener(elForRun);

        Element rootTypes = this.getRootTypes();
        this.createDefaultStructures(rootTypes);

        S2JJAXBModel intermediateModel = this.compileModel(types, compiler, rootTypes);
        Collection<? extends Mapping> mappings = intermediateModel.getMappings();

        for (Mapping mapping : mappings) {
            this.importStructure(mapping);
        }
    }

    protected void importStructure(Mapping mapping) {
        QName qname = mapping.getElement();
        JDefinedClass theClass = (JDefinedClass) mapping.getType().getTypeClass();
        SimpleStructureDefinition structure = (SimpleStructureDefinition) this.structures.get(this.namespace + qname.getLocalPart());

        Map<String, JFieldVar> fields = theClass.fields();
        int index = 0;
        for (Entry<String, JFieldVar> entry : fields.entrySet()) {
            Class<?> fieldClass = ReflectUtil.loadClass(entry.getValue().type().boxify().fullName());
            structure.setFieldName(index, entry.getKey(), fieldClass);
            index++;
        }
    }

    protected S2JJAXBModel compileModel(Types types, SchemaCompiler compiler, Element rootTypes) {
        Schema schema = (Schema) types.getExtensibilityElements().get(0);
        compiler.parseSchema(schema.getDocumentBaseURI() + "#types1", rootTypes);
        S2JJAXBModel intermediateModel = compiler.bind();
        return intermediateModel;
    }

    protected void createDefaultStructures(Element rootTypes) {
        NodeList complexTypes = rootTypes.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "complexType");
        for (int i = 0; i < complexTypes.getLength(); i++) {
            Element element = (Element) complexTypes.item(i);
            String structureName = this.namespace + element.getAttribute("name");
            SimpleStructureDefinition structure = new SimpleStructureDefinition(structureName);
            this.structures.put(structure.getId(), structure);
        }
    }

    protected Element getRootTypes() {
        try {
            DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = docBuilder.parse(this.wsdlLocation);
            Element root = (Element) doc.getFirstChild();
            Element typesElement = (Element) root.getElementsByTagName("wsdl:types").item(0);
            return (Element) typesElement.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "schema").item(0);
        } catch (SAXException e) {
            throw new FlowableException(e.getMessage(), e);
        } catch (IOException e) {
            throw new FlowableException(e.getMessage(), e);
        } catch (ParserConfigurationException e) {
            throw new FlowableException(e.getMessage(), e);
        }
    }

    public Map<String, StructureDefinition> getStructures() {
        return this.structures;
    }

    public Map<String, WSService> getServices() {
        return this.wsServices;
    }

    public Map<String, WSOperation> getOperations() {
        return this.wsOperations;
    }
}


text:
package com.jvt.microservice.service;

import com.jvt.microservice.domain.base.PageRequest;
import com.jvt.microservice.domain.out.ResultBody;
import com.jvt.microservice.domain.User;

public interface UserService {
    ResultBody getInfo(String id);

    User getInfoByAccount(String account);

    ResultBody getList(String keyword, PageRequest pageRequest);

    ResultBody addInfo(User user);

    ResultBody updateInfo(User user);

    ResultBody delInfo(String id);
}


text:
set -e
set -x
shopt -s dotglob

readonly name="enet"
readonly ownership="enet Upstream <robot@adios2>"
readonly subtree="thirdparty/enet/enet"
readonly repo="https://github.com/GTkorvo/enet.git"
readonly tag="master"
readonly shortlog="true"
readonly paths="
"

extract_source () {
    git_archive
}

. "${BASH_SOURCE%/*}/../update-common.sh"


text:
package com.pholser.junit.quickcheck.generator.java.util.function;

import static com.pholser.junit.quickcheck.generator.Lambdas.makeLambda;

import com.pholser.junit.quickcheck.generator.ComponentizedGenerator;
import com.pholser.junit.quickcheck.generator.GenerationStatus;
import com.pholser.junit.quickcheck.generator.Generator;
import com.pholser.junit.quickcheck.generator.Generators;
import com.pholser.junit.quickcheck.random.SourceOfRandomness;
import java.util.function.ToIntFunction;

/**
 * Produces values of type {@link ToIntFunction}.
 *
 * @param <T> type of parameter of produced function
 */
public class ToIntFunctionGenerator<T>
    extends ComponentizedGenerator<ToIntFunction> {

    private Generator<Integer> generator;

    public ToIntFunctionGenerator() {
        super(ToIntFunction.class);
    }

    @Override public void provide(Generators provided) {
        super.provide(provided);

        generator = gen().type(int.class);
    }

    @SuppressWarnings("unchecked")
    @Override public ToIntFunction<T> generate(
        SourceOfRandomness random,
        GenerationStatus status) {

        return makeLambda(ToIntFunction.class, generator, status);
    }

    @Override public int numberOfNeededComponents() {
        return 1;
    }
}


text:
goog.provide('goog.iterTest');
goog.setTestOnly('goog.iterTest');

goog.require('goog.iter');
goog.require('goog.iter.Iterator');
goog.require('goog.iter.StopIteration');
goog.require('goog.testing.jsunit');

function ArrayIterator(array) {
  this.array_ = array;
  this.current_ = 0;
}
goog.inherits(ArrayIterator, goog.iter.Iterator);

ArrayIterator.prototype.next = function() {
  if (this.current_ >= this.array_.length) {
    throw goog.iter.StopIteration;
  }
  return this.array_[this.current_++];
};

function testForEach() {
  var s = '';
  var iter = new ArrayIterator(['a', 'b', 'c', 'd']);
  goog.iter.forEach(iter, function(val, index, iter2) {
    assertEquals(iter, iter2);
    assertEquals('index should be undefined', 'undefined', typeof index);
    s += val;
  });
  assertEquals('abcd', s);
}

function testJoin() {
  var iter = new ArrayIterator(['a', 'b', 'c', 'd']);
  assertEquals('abcd', goog.iter.join(iter, ''));

  iter = new ArrayIterator(['a', 'b', 'c', 'd']);
  assertEquals('a,b,c,d', goog.iter.join(iter, ','));

  // make sure everything is treated as strings
  iter = new ArrayIterator([0, 1, 2, 3]);
  assertEquals('0123', goog.iter.join(iter, ''));

  iter = new ArrayIterator([0, 1, 2, 3]);
  assertEquals('0919293', goog.iter.join(iter, 9));

  // Joining an empty iterator should result in an empty string
  iter = new ArrayIterator([]);
  assertEquals('', goog.iter.join(iter, ','));

}

function testRange() {
  var iter = goog.iter.range(0, 5, 1);
  assertEquals('01234', goog.iter.join(iter, ''));

  iter = goog.iter.range(0, 5, 2);
  assertEquals('024', goog.iter.join(iter, ''));

  iter = goog.iter.range(0, 5, 5);
  assertEquals('0', goog.iter.join(iter, ''));

  iter = goog.iter.range(0, 5, 10);
  assertEquals('0', goog.iter.join(iter, ''));

  // negative step
  var iter = goog.iter.range(5, 0, -1);
  assertEquals('54321', goog.iter.join(iter, ''));

  iter = goog.iter.range(5, 0, -2);
  assertEquals('531', goog.iter.join(iter, ''));

  iter = goog.iter.range(5, 0, -5);
  assertEquals('5', goog.iter.join(iter, ''));

  iter = goog.iter.range(5, 0, -10);
  assertEquals('5', goog.iter.join(iter, ''));

  // wrong direction should result in empty iterator
  iter = goog.iter.range(0, 5, -1);
  assertEquals('', goog.iter.join(iter, ''));

  iter = goog.iter.range(5, 0, 1);
  assertEquals('', goog.iter.join(iter, ''));

  // a step of 0 is not allowed
  goog.iter.range(0, 5, 0);

  // test the opt args
  iter = goog.iter.range(0, 5);
  assertEquals('01234', goog.iter.join(iter, ''));

  iter = goog.iter.range(5);
  assertEquals('01234', goog.iter.join(iter, ''));

}

function testFilter() {
  var iter = goog.iter.range(5);
  var iter2 = goog.iter.filter(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val > 1;
  });

  assertEquals('234', goog.iter.join(iter2, ''));

  // Chaining filters
  iter = goog.iter.range(10);
  var sb = [];
  var evens = goog.iter.filter(iter, function(v) {
    sb.push('a' + v);
    return v % 2 == 0;
  });
  var evens2 = goog.iter.filter(evens, function(v) {
    sb.push('b' + v);
    return v >= 5;
  });

  assertEquals('68', goog.iter.join(evens2, ''));
  // Not the order here. The next calls are done lazily
  assertEquals('a0b0a1a2b2a3a4b4a5a6b6a7a8b8a9', sb.join(''));

}

function testMap() {
  var iter = goog.iter.range(4);
  var iter2 = goog.iter.map(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val * val;
  });
  assertEquals('0149', goog.iter.join(iter2, ''));
}

function testReduce() {
  var iter = goog.iter.range(1, 5);
  assertEquals(
      10, // 1 + 2 + 3 + 4
      goog.iter.reduce(iter, function(val, el) {
        return val + el;
      }, 0));
}

function testReduce2() {
  var iter = goog.iter.range(1, 5);
  assertEquals(
      24, // 4!
      goog.iter.reduce(iter, function(val, el) {
        return val * el;
      }, 1));
}

function testSome() {
  var iter = goog.iter.range(5);
  var b = goog.iter.some(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val > 1;
  });
  assertTrue(b);
  iter = goog.iter.range(5);
  b = goog.iter.some(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val > 100;
  });
  assertFalse(b);
}

function testEvery() {
  var iter = goog.iter.range(5);
  var b = goog.iter.every(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val >= 0;
  });
  assertTrue(b);
  iter = goog.iter.range(5);
  b = goog.iter.every(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val > 1;
  });
  assertFalse(b);
}

function testChain() {
  var iter = goog.iter.range(0, 2);
  var iter2 = goog.iter.range(2, 4);
  var iter3 = goog.iter.range(4, 6);
  var iter4 = goog.iter.chain(iter, iter2, iter3);

  assertEquals('012345', goog.iter.join(iter4, ''));

  // empty iter
  iter = new goog.iter.Iterator;
  iter2 = goog.iter.chain(iter);
  assertEquals('', goog.iter.join(iter2, ''));

  // no args
  iter2 = goog.iter.chain();
  assertEquals('', goog.iter.join(iter2, ''));

  // arrays
  var arr = [0, 1];
  var arr2 = [2, 3];
  var arr3 = [4, 5];
  iter = goog.iter.chain(arr, arr2, arr3);
  assertEquals('012345', goog.iter.join(iter, ''));
}

function testChainFromIterable() {
  var arg = [0, 1];
  var arg2 = [2, 3];
  var arg3 = goog.iter.range(4, 6);
  var iter = goog.iter.chainFromIterable([arg, arg2, arg3]);
  assertEquals('012345', goog.iter.join(iter, ''));
}

function testDropWhile() {
  var iter = goog.iter.range(10);
  var iter2 = goog.iter.dropWhile(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val < 5;
  });

  assertEquals('56789', goog.iter.join(iter2, ''));
}

function testDropWhile2() {
  var iter = goog.iter.range(10);
  var iter2 = goog.iter.dropWhile(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val != 5;
  });

  assertEquals('56789', goog.iter.join(iter2, ''));
}

function testTakeWhile() {
  var iter = goog.iter.range(10);
  var iter2 = goog.iter.takeWhile(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val < 5;
  });

  assertEquals('01234', goog.iter.join(iter2, ''));

  // next() should not have been called on iter after the first failure and
  // therefore it should contain some elements.  5 failed so we should have
  // the rest
  assertEquals('6789', goog.iter.join(iter, ''));
}

function testTakeWhile2() {
  var iter = goog.iter.range(10);
  var iter2 = goog.iter.takeWhile(iter, function(val, index, iter3) {
    assertEquals(iter, iter3);
    assertEquals('index should be undefined', 'undefined', typeof index);
    return val != 5;
  });

  assertEquals('01234', goog.iter.join(iter2, ''));

  // next() should not have been called on iter after the first failure and
  // therefore it should contain some elements.  5 failed so we should have
  // the rest
  assertEquals('6789', goog.iter.join(iter, ''));
}

function testToArray() {
  var iter = goog.iter.range(5);
  var array = goog.iter.toArray(iter);
  assertEquals('01234', array.join(''));

  // Empty
  iter = new goog.iter.Iterator;
  array = goog.iter.toArray(iter);
  assertEquals('Empty iterator to array', '', array.join(''));
}

function testToArray2() {
  var iterable = [0, 1, 2, 3, 4];
  var array = goog.iter.toArray(iterable);
  assertEquals('01234', array.join(''));

  // Empty
  iterable = [];
  array = goog.iter.toArray(iterable);
  assertEquals('Empty iterator to array', '', array.join(''));
}

function testEquals() {
  var iter = goog.iter.range(5);
  var iter2 = goog.iter.range(5);
  assertTrue('Equal iterators', goog.iter.equals(iter, iter2));

  iter = goog.iter.range(4);
  iter2 = goog.iter.range(5);
  assertFalse('Second one is longer', goog.iter.equals(iter, iter2));

  iter = goog.iter.range(5);
  iter2 = goog.iter.range(4);
  assertFalse('First one is longer', goog.iter.equals(iter, iter2));

  // 2 empty iterators
  iter = new goog.iter.Iterator;
  iter2 = new goog.iter.Iterator;
  assertTrue('Two empty iterators are equal', goog.iter.equals(iter, iter2));

  iter = goog.iter.range(4);
  assertFalse('Same iterator', goog.iter.equals(iter, iter));
}

function testToIterator() {
  var iter = new goog.iter.range(5);
  var iter2 = goog.iter.toIterator(iter);
  assertEquals('toIterator on an iterator should return the same obejct',
               iter, iter2);

  var iterLikeObject = {
    next: function() {
      throw goog.iter.StopIteration;
    }
  };
  var obj = {
    __iterator__: function(opt_keys) {
      assertFalse(
          '__iterator__ should always be called with false in toIterator',
          opt_keys);
      return iterLikeObject;
    }
  };

  assertEquals('Should return the return value of __iterator_(false)',
               iterLikeObject, goog.iter.toIterator(obj));

  // Array
  var array = [0, 1, 2, 3, 4];
  iter = goog.iter.toIterator(array);
  assertEquals('01234', goog.iter.join(iter, ''));

  // Array like
  var arrayLike = {'0': 0, '1': 1, '2': 2, length: 3};
  iter = goog.iter.toIterator(arrayLike);
  assertEquals('012', goog.iter.join(iter, ''));

  // DOM
  var dom = document.getElementById('t1').childNodes;
  iter = goog.iter.toIterator(dom);
  iter2 = goog.iter.map(iter, function(el) {
    return el.innerHTML;
  });
  assertEquals('012', goog.iter.join(iter2, ''));
}

function testNextOrValue() {
  var iter = goog.iter.toIterator([1]);

  assertEquals('Should return value when iterator is non-empty',
      1, goog.iter.nextOrValue(iter, null));
  assertNull('Should return given default when iterator is empty',
      goog.iter.nextOrValue(iter, null));
  assertEquals('Should return given default when iterator is (still) empty',
      -1, goog.iter.nextOrValue(iter, -1));
}

// Return the product of several arrays as an array
function productAsArray(var_args) {
  var iter = goog.iter.product.apply(null, arguments);
  return goog.iter.toArray(iter);
}

function testProduct() {
  assertArrayEquals([[1, 3], [1, 4], [2, 3], [2, 4]],
      productAsArray([1, 2], [3, 4]));

  assertArrayEquals([
    [1, 3, 5], [1, 3, 6], [1, 4, 5], [1, 4, 6],
    [2, 3, 5], [2, 3, 6], [2, 4, 5], [2, 4, 6]
  ], productAsArray([1, 2], [3, 4], [5, 6]));

  assertArrayEquals([[1]], productAsArray([1]));
  assertArrayEquals([], productAsArray([1], []));
  assertArrayEquals([], productAsArray());

  var expectedResult = [];
  var a = [1, 2, 3];
  var b = [4, 5, 6];
  var c = [7, 8, 9];
  for (var i = 0; i < a.length; i++) {
    for (var j = 0; j < b.length; j++) {
      for (var k = 0; k < c.length; k++) {
        expectedResult.push([a[i], b[j], c[k]]);
      }
    }
  }

  assertArrayEquals(expectedResult, productAsArray(a, b, c));
}

function testProductIteration() {
  var iter = goog.iter.product([1, 2], [3, 4]);

  assertArrayEquals([1, 3], iter.next());
  assertArrayEquals([1, 4], iter.next());
  assertArrayEquals([2, 3], iter.next());
  assertArrayEquals([2, 4], iter.next());

  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);

  // Ensure the iterator forever throws StopIteration.
  for (var i = 0; i < 5; i++) {
    var ex = assertThrows(function() { iter.next() });
    assertEquals(goog.iter.StopIteration, ex);
  }

  iter = goog.iter.product();
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);

  iter = goog.iter.product([]);
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testCycle() {

  var regularArray = [1, 2, 3];
  var iter = goog.iter.cycle(regularArray);

  // Test 3 cycles to ensure proper cache behavior
  var values = [];
  for (var i = 0; i < 9; i++) {
    values.push(iter.next());
  }

  assertArrayEquals([1, 2, 3, 1, 2, 3, 1, 2, 3], values);
}

function testCycleSingleItemIterable() {
  var singleItemArray = [1];

  var iter = goog.iter.cycle(singleItemArray);
  var values = [];

  for (var i = 0; i < 5; i++) {
    values.push(iter.next());
  }

  assertArrayEquals([1, 1, 1, 1, 1], values);
}

function testCycleEmptyIterable() {

  var emptyArray = [];

  var iter = goog.iter.cycle(emptyArray);
  var ex = assertThrows(function() { iter.next(); });
  assertEquals(goog.iter.StopIteration, ex);
}

function testCountNoArgs() {
  var iter = goog.iter.count();
  var values = goog.iter.limit(iter, 5);
  assertArrayEquals([0, 1, 2, 3, 4], goog.iter.toArray(values));
}

function testCountStart() {
  var iter = goog.iter.count(10);
  var values = goog.iter.limit(iter, 5);
  assertArrayEquals([10, 11, 12, 13, 14], goog.iter.toArray(values));
}

function testCountStep() {
  var iter = goog.iter.count(10, 2);
  var values = goog.iter.limit(iter, 5);
  assertArrayEquals([10, 12, 14, 16, 18], goog.iter.toArray(values));
}

function testCountNegativeStep() {
  var iter = goog.iter.count(10, -2);
  var values = goog.iter.limit(iter, 5);
  assertArrayEquals([10, 8, 6, 4, 2], goog.iter.toArray(values));
}

function testCountZeroStep() {
  var iter = goog.iter.count(42, 0);
  assertEquals(42, iter.next());
  assertEquals(42, iter.next());
  assertEquals(42, iter.next());
}

function testCountFloat() {
  var iter = goog.iter.count(1.5, 0.5);
  var values = goog.iter.limit(iter, 5);
  assertArrayEquals([1.5, 2.0, 2.5, 3.0, 3.5], goog.iter.toArray(values));
}

function testRepeat() {
  var obj = {foo: 'bar'};
  var iter = goog.iter.repeat(obj);
  assertEquals(obj, iter.next());
  assertEquals(obj, iter.next());
  assertEquals(obj, iter.next());
}

function testAccumulateArray() {
  var iter = goog.iter.accumulate([1, 2, 3, 4, 5]);
  assertArrayEquals([1, 3, 6, 10, 15], goog.iter.toArray(iter));
}

function testAccumulateIterator() {
  var iter = goog.iter.accumulate(goog.iter.range(1, 6));
  assertArrayEquals([1, 3, 6, 10, 15], goog.iter.toArray(iter));
}

function testAccumulateFloat() {
  var iter = goog.iter.accumulate([1.0, 2.5, 0.5, 1.5, 0.5]);
  assertArrayEquals([1.0, 3.5, 4.0, 5.5, 6.0], goog.iter.toArray(iter));
}

function testZipArrays() {
  var iter = goog.iter.zip([1, 2, 3], [4, 5, 6], [7, 8, 9]);
  assertArrayEquals([1, 4, 7], iter.next());
  assertArrayEquals([2, 5, 8], iter.next());
  assertArrayEquals([3, 6, 9], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testZipSingleArg() {
  var iter = goog.iter.zip([1, 2, 3]);
  assertArrayEquals([1], iter.next());
  assertArrayEquals([2], iter.next());
  assertArrayEquals([3], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testZipUnevenArgs() {
  var iter = goog.iter.zip([1, 2, 3], [4, 5], [7]);
  assertArrayEquals([1, 4, 7], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testZipNoArgs() {
  var iter = goog.iter.zip();
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testZipIterators() {
  var iter = goog.iter.zip(goog.iter.count(), goog.iter.repeat('foo'));
  assertArrayEquals([0, 'foo'], iter.next());
  assertArrayEquals([1, 'foo'], iter.next());
  assertArrayEquals([2, 'foo'], iter.next());
  assertArrayEquals([3, 'foo'], iter.next());
}

function testZipLongestArrays() {
  var iter = goog.iter.zipLongest('-', 'ABCD'.split(''), 'xy'.split(''));
  assertArrayEquals(['A', 'x'], iter.next());
  assertArrayEquals(['B', 'y'], iter.next());
  assertArrayEquals(['C', '-'], iter.next());
  assertArrayEquals(['D', '-'], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testZipLongestSingleArg() {
  var iter = goog.iter.zipLongest('-', 'ABCD'.split(''));
  assertArrayEquals(['A'], iter.next());
  assertArrayEquals(['B'], iter.next());
  assertArrayEquals(['C'], iter.next());
  assertArrayEquals(['D'], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testZipLongestNoArgs() {
  var iter = goog.iter.zipLongest();
  assertArrayEquals([], goog.iter.toArray(iter));
  var iter = goog.iter.zipLongest('fill');
  assertArrayEquals([], goog.iter.toArray(iter));
}

function testZipLongestIterators() {
  var iter = goog.iter.zipLongest(null, goog.iter.range(3), goog.iter.range(5));
  assertArrayEquals([0, 0], iter.next());
  assertArrayEquals([1, 1], iter.next());
  assertArrayEquals([2, 2], iter.next());
  assertArrayEquals([null, 3], iter.next());
  assertArrayEquals([null, 4], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testCompressArray() {
  var iter = goog.iter.compress('ABCDEF'.split(''), [1, 0, 1, 0, 1, 1]);
  assertEquals('ACEF', goog.iter.join(iter, ''));
}

function testCompressUnevenArgs() {
  var iter = goog.iter.compress('ABCDEF'.split(''), [false, true, true]);
  assertEquals('BC', goog.iter.join(iter, ''));
}

function testCompressIterators() {
  var iter = goog.iter.compress(goog.iter.range(10), goog.iter.cycle([0, 1]));
  assertArrayEquals([1, 3, 5, 7, 9], goog.iter.toArray(iter));
}

function testGroupByNoKeyFunc() {
  var iter = goog.iter.groupBy('AAABBBBCDD'.split(''));
  assertArrayEquals(['A', ['A', 'A', 'A']], iter.next());
  assertArrayEquals(['B', ['B', 'B', 'B', 'B']], iter.next());
  assertArrayEquals(['C', ['C']], iter.next());
  assertArrayEquals(['D', ['D', 'D']], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testGroupByKeyFunc() {
  var keyFunc = function(x) { return x.toLowerCase(); };
  var iter = goog.iter.groupBy('AaAABBbbBCccddDD'.split(''), keyFunc);
  assertArrayEquals(['a', ['A', 'a', 'A', 'A']], iter.next());
  assertArrayEquals(['b', ['B', 'B', 'b', 'b', 'B']], iter.next());
  assertArrayEquals(['c', ['C', 'c', 'c']], iter.next());
  assertArrayEquals(['d', ['d', 'd', 'D', 'D']], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testTeeArray() {
  var iters = goog.iter.tee('ABC'.split(''));
  assertEquals(2, iters.length);
  var it0 = iters[0], it1 = iters[1];
  assertEquals('A', it0.next());
  assertEquals('A', it1.next());
  assertEquals('B', it0.next());
  assertEquals('B', it1.next());
  assertEquals('C', it0.next());
  assertEquals('C', it1.next());
  var ex = assertThrows(function() { it0.next() });
  assertEquals(goog.iter.StopIteration, ex);
  ex = assertThrows(function() { it1.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testTeeIterator() {
  var iters = goog.iter.tee(goog.iter.count(), 3);
  assertEquals(3, iters.length);
  var it0 = iters[0], it1 = iters[1], it2 = iters[2];
  assertEquals(0, it0.next());
  assertEquals(1, it0.next());
  assertEquals(0, it1.next());
  assertEquals(1, it1.next());
  assertEquals(2, it1.next());
  assertEquals(2, it0.next());
  assertEquals(0, it2.next());
  assertEquals(1, it2.next());
  assertEquals(2, it2.next());
  assertEquals(3, it0.next());
  assertEquals(3, it1.next());
  assertEquals(3, it2.next());
}

function testEnumerateNoStart() {
  var iter = goog.iter.enumerate('ABC'.split(''));
  assertArrayEquals([0, 'A'], iter.next());
  assertArrayEquals([1, 'B'], iter.next());
  assertArrayEquals([2, 'C'], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testEnumerateStart() {
  var iter = goog.iter.enumerate('DEF'.split(''), 3);
  assertArrayEquals([3, 'D'], iter.next());
  assertArrayEquals([4, 'E'], iter.next());
  assertArrayEquals([5, 'F'], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testLimitLess() {
  var iter = goog.iter.limit('ABCDEFG'.split(''), 3);
  assertEquals('ABC', goog.iter.join(iter, ''));
}

function testLimitGreater() {
  var iter = goog.iter.limit('ABCDEFG'.split(''), 10);
  assertEquals('ABCDEFG', goog.iter.join(iter, ''));
}

function testConsumeLess() {
  var iter = goog.iter.consume('ABCDEFG'.split(''), 3);
  assertEquals('DEFG', goog.iter.join(iter, ''));
}

function testConsumeGreater() {
  var iter = goog.iter.consume('ABCDEFG'.split(''), 10);
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testSliceStart() {
  var iter = goog.iter.slice('ABCDEFG'.split(''), 2);
  assertEquals('CDEFG', goog.iter.join(iter, ''));
}

function testSliceStop() {
  var iter = goog.iter.slice('ABCDEFG'.split(''), 2, 4);
  assertEquals('CD', goog.iter.join(iter, ''));
}

function testSliceStartStopEqual() {
  var iter = goog.iter.slice('ABCDEFG'.split(''), 1, 1);
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testSliceIterator() {
  var iter = goog.iter.slice(goog.iter.count(20), 0, 5);
  assertArrayEquals([20, 21, 22, 23, 24], goog.iter.toArray(iter));
}

function testSliceStartGreater() {
  var iter = goog.iter.slice('ABCDEFG'.split(''), 10);
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testPermutationsNoLength() {
  var iter = goog.iter.permutations(goog.iter.range(3));
  assertArrayEquals([0, 1, 2], iter.next());
  assertArrayEquals([0, 2, 1], iter.next());
  assertArrayEquals([1, 0, 2], iter.next());
  assertArrayEquals([1, 2, 0], iter.next());
  assertArrayEquals([2, 0, 1], iter.next());
  assertArrayEquals([2, 1, 0], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testPermutationsLength() {
  var iter = goog.iter.permutations('ABC'.split(''), 2);
  assertArrayEquals(['A', 'B'], iter.next());
  assertArrayEquals(['A', 'C'], iter.next());
  assertArrayEquals(['B', 'A'], iter.next());
  assertArrayEquals(['B', 'C'], iter.next());
  assertArrayEquals(['C', 'A'], iter.next());
  assertArrayEquals(['C', 'B'], iter.next());
}

function testCombinations() {
  var iter = goog.iter.combinations(goog.iter.range(4), 3);
  assertArrayEquals([0, 1, 2], iter.next());
  assertArrayEquals([0, 1, 3], iter.next());
  assertArrayEquals([0, 2, 3], iter.next());
  assertArrayEquals([1, 2, 3], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}

function testCombinationsWithReplacement() {
  var iter = goog.iter.combinationsWithReplacement('ABC'.split(''), 2);
  assertArrayEquals(['A', 'A'], iter.next());
  assertArrayEquals(['A', 'B'], iter.next());
  assertArrayEquals(['A', 'C'], iter.next());
  assertArrayEquals(['B', 'B'], iter.next());
  assertArrayEquals(['B', 'C'], iter.next());
  assertArrayEquals(['C', 'C'], iter.next());
  var ex = assertThrows(function() { iter.next() });
  assertEquals(goog.iter.StopIteration, ex);
}


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

'use strict';

function main(
  srcDatasetId = 'my_src_dataset',
  srcTableId = 'my_src_table',
  destDatasetId = 'my_dest_dataset',
  destTableId = 'my_dest_table'
) {
  // [START bigquery_copy_table]
  // Import the Google Cloud client library and create a client
  const {BigQuery} = require('@google-cloud/bigquery');
  const bigquery = new BigQuery();

  async function copyTable() {
    // Copies src_dataset:src_table to dest_dataset:dest_table.

    /**
     * TODO(developer): Uncomment the following lines before running the sample
     */
    // const srcDatasetId = "my_src_dataset";
    // const srcTableId = "my_src_table";
    // const destDatasetId = "my_dest_dataset";
    // const destTableId = "my_dest_table";

    // Copy the table contents into another table
    const [job] = await bigquery
      .dataset(srcDatasetId)
      .table(srcTableId)
      .copy(bigquery.dataset(destDatasetId).table(destTableId));

    console.log(`Job ${job.id} completed.`);

    // Check the job's status for errors
    const errors = job.status.errors;
    if (errors && errors.length > 0) {
      throw errors;
    }
  }
  // [END bigquery_copy_table]
  copyTable();
}
main(...process.argv.slice(2));


text:
'use strict';

//angularModule = angular.module('timehks', ['ngSanitize']);

//angularModule = angular.module('timehks', ['ngSanitize'])
//    .directive('onFinishRender', function ($timeout) {
//        O.a ('sss2');
//        return {
//            restrict: 'A',
//            link: function (scope, element, attr) {
//                if (scope.$last === true) {
//                    $timeout(function () {
//                        O.a ('sss3');
//                        scope.$emit('ngRepeatFinished');
//                        alert ('ngRepeatFinished');
//                    });
//                }
//            }
//        };
//
//    });
//

// Timehks controller
angular.module('timehks').controller('TimehksController', ['$scope', '$stateParams', '$location', 'Authentication', 'Timehks',
	function($scope, $stateParams, $location, Authentication, Timehks) {
		$scope.authentication = Authentication;

		// Create new Timehk
		$scope.create = function() {
			// Create new Timehk object
			var timehk = new Timehks ({
				name: this.name
			});

			// Redirect after save
			timehk.$save(function(response) {
				$location.path('timehks/' + response._id);

				// Clear form fields
				$scope.name = '';
			}, function(errorResponse) {
				$scope.error = errorResponse.data.message;
			});
		};

		// Remove existing Timehk
		$scope.remove = function(timehk) {
			if ( timehk ) {
				timehk.$remove();

				for (var i in $scope.timehks) {
					if ($scope.timehks [i] === timehk) {
						$scope.timehks.splice(i, 1);
					}
				}
			} else {
				$scope.timehk.$remove(function() {
					$location.path('timehks');
				});
			}
		};

		// Update existing Timehk
		$scope.update = function() {
			var timehk = $scope.timehk;

			timehk.$update(function() {
				$location.path('timehks/' + timehk._id);
			}, function(errorResponse) {
				$scope.error = errorResponse.data.message;
			});
		};

		// Find a list of Timehks
		$scope.find = function() {
			$scope.timehks = Timehks.query();
		};

		// Find existing Timehk
		$scope.findOne = function() {
			$scope.timehk = Timehks.get({
				timehkId: $stateParams.timehkId
			});
		};
	}
]);


text:
package jetbrains.exodus.entitystore.iterate;

import jetbrains.exodus.entitystore.EntityId;
import jetbrains.exodus.entitystore.PersistentEntityStoreImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public abstract class EntityLinksIterableBase extends EntityIterableBase {

    @NotNull
    protected final EntityId entityId;

    protected EntityLinksIterableBase(@Nullable final PersistentEntityStoreImpl store,
                                      @NotNull final EntityId entityId) {
        super(store);
        this.entityId = entityId;
    }
}


text:
package validators

import (
	"fmt"

	"github.com/gobuffalo/validate"
)

type IntArrayIsPresent struct {
	Name  string
	Field []int
}

func (v *IntArrayIsPresent) IsValid(errors *validate.Errors) {
	if len(v.Field) == 0 {
		errors.Add(GenerateKey(v.Name), fmt.Sprintf("%s can not be empty.", v.Name))
	}
}


text:
require 'sensu-plugins-kubernetes/cli'

class PodRuntime < Sensu::Plugins::Kubernetes::CLI
  @options = Sensu::Plugins::Kubernetes::CLI.options.dup

  option :pod_list,
         description: 'List of pods to check',
         short: '-p PODS',
         long: '--pods',
         default: 'all'

  option :pod_filter,
         description: 'Selector filter for pods to be checked',
         short: '-f FILTER',
         long: '--filter'

  option :warn_timeout,
         description: 'Threshold for pods to be in the pending state',
         short: '-w TIMEOUT',
         long: '--warn',
         proc: proc(&:to_i)

  option :critical_timeout,
         description: 'Threshold for Pods to be critical',
         short: '-c COUNT',
         long: '--critical',
         proc: proc(&:to_i)

  option :exclude_namespace,
         description: 'Exclude the specified list of namespaces',
         short: '-n NAMESPACES',
         long: '--exclude-namespace',
         proc: proc { |a| a.split(',') },
         default: ''

  option :include_namespace,
         description: 'Include the specified list of namespaces',
         short: '-i NAMESPACES',
         long: '--include-namespace',
         proc: proc { |a| a.split(',') },
         default: ''

  def run
    pods_list = []
    pods = []
    warn = false
    crit = false
    message = ''

    if config[:pod_filter].nil?
      pods_list = parse_list(config[:pod_list])
      pods = client.get_pods
    else
      pods = client.get_pods(label_selector: config[:pod_filter].to_s)
      if pods.empty?
        unknown 'The filter specified resulted in 0 pods'
      end
      pods_list = ['all']
    end

    pods.each do |pod|
      next if pod.nil?
      next if should_exclude_namespace(pod.metadata.namespace)
      next unless pods_list.include?(pod.metadata.name) || pods_list.include?('all')
      # Check for Running state
      next unless pod.status.phase == 'Running'
      pod_stamp = Time.parse(pod.status.startTime)
      runtime = (Time.now.utc - pod_stamp.utc).to_i

      if !config[:critical_timeout].nil? && runtime > config[:critical_timeout]
        message << "#{pod.metadata.namespace}.#{pod.metadata.name}: #{runtime}, "
        crit = true
      elsif !config[:warn_timeout].nil? && runtime > config[:warn_timeout]
        message << "#{pod.metadata.namespace}.#{pod.metadata.name}: #{runtime}, "
        warn = true
      end
    end

    if crit
      critical message
    elsif warn
      warning message
    else
      ok 'All pods within threshold'
    end
  rescue KubeException => e
    critical 'API error: ' << e.message
  end

  def parse_list(list)
    return list.split(',') if list && list.include?(',')
    return [list] if list
    ['']
  end

  def should_exclude_namespace(namespace)
    return !config[:include_namespace].include?(namespace) unless config[:include_namespace].empty?
    config[:exclude_namespace].include?(namespace)
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="de.mchllngr.devsettings">

    <uses-permission
        android:name="android.permission.WRITE_SECURE_SETTINGS"
        tools:ignore="ProtectedPermissions"/>

    <application
        android:name=".App"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning"
        tools:replace="android:allowBackup">

        <activity
            android:name=".module.main.MainActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity
            android:name=".module.starthover.StartHoverActivity"
            android:theme="@style/AppTheme.Transparent">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/>
            </intent-filter>
        </activity>

        <service
            android:name=".service.DevSettingsTileService"
            android:icon="@drawable/ic_developer_mode_white_24dp"
            android:label="@string/app_name"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE"/>
            </intent-filter>
        </service>

        <service android:name=".hover.DevSettingsHoverMenuService"/>

    </application>

</manifest>


text:
package com.golshadi.majid.core.mainWorker;

import com.golshadi.majid.Utils.QueueObserver;
import com.golshadi.majid.core.chunkWorker.Moderator;
import com.golshadi.majid.database.ChunksDataSource;
import com.golshadi.majid.database.TasksDataSource;
import com.golshadi.majid.database.elements.Task;
import com.golshadi.majid.report.listener.DownloadManagerListenerModerator;

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

/**
 * Created by Majid Golshadi on 4/21/2014.
 */
public class QueueModerator
			implements QueueObserver {

    private final TasksDataSource tasksDataSource;
    private final ChunksDataSource chunksDataSource;
    private final Moderator moderator;
    private final DownloadManagerListenerModerator listener;
    private final List<Task> uncompletedTasks;
    private final int downloadTaskPerTime;

    private HashMap<Integer, Thread> downloaderList;
    private boolean pauseFlag = false;

    public QueueModerator(TasksDataSource tasksDataSource, ChunksDataSource chunksDataSource,
                       Moderator localModerator, DownloadManagerListenerModerator downloadManagerListener,
                       List<Task> tasks, int downloadPerTime){

        this.tasksDataSource = tasksDataSource;
        this.chunksDataSource = chunksDataSource;
        this.moderator = localModerator;
        this.moderator.setQueueObserver(this);
        this.listener = downloadManagerListener;
        this.downloadTaskPerTime = downloadPerTime;
        this.uncompletedTasks = tasks;

        downloaderList =
                new HashMap<Integer, Thread>(downloadTaskPerTime);
    }

    public void startQueue() {

    	if (uncompletedTasks != null) {

    		int location = 0;
    		while (uncompletedTasks.size() > 0 &&
    				!pauseFlag &&
    				downloadTaskPerTime >= downloaderList.size()) {
    			Task task = uncompletedTasks.get(location);
    			Thread downloader =
	                    new AsyncStartDownload(tasksDataSource, chunksDataSource, moderator, listener, task);

	            downloaderList.put(task.id, downloader);
	            uncompletedTasks.remove(location);

	            downloader.start();

				location++;
			}

    	}
    }

    public void wakeUp(int taskID){
        downloaderList.remove(taskID);
        startQueue();
    }

    public void pause(){
        pauseFlag = true;

        for (Map.Entry entry : downloaderList.entrySet()) {
            Integer id = (Integer) entry.getKey();
            moderator.pause(id);
        }

        pauseFlag = false;
    }
}


text:
namespace Microsoft.Azure.Management.Logic.Models
{
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using Newtonsoft.Json;
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;
    using Microsoft.Rest.Azure;

    [JsonTransformation]
    public partial class IntegrationAccountAgreement : IntegrationAccountResource
    {
        /// <summary>
        /// Initializes a new instance of the IntegrationAccountAgreement
        /// class.
        /// </summary>
        public IntegrationAccountAgreement() { }

        /// <summary>
        /// Initializes a new instance of the IntegrationAccountAgreement
        /// class.
        /// </summary>
        public IntegrationAccountAgreement(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), DateTime? createdTime = default(DateTime?), DateTime? changedTime = default(DateTime?), object metadata = default(object), AgreementType? agreementType = default(AgreementType?), string hostPartner = default(string), string guestPartner = default(string), BusinessIdentity hostIdentity = default(BusinessIdentity), BusinessIdentity guestIdentity = default(BusinessIdentity), AgreementContent content = default(AgreementContent))
            : base(id, name, type, location, tags)
        {
            CreatedTime = createdTime;
            ChangedTime = changedTime;
            Metadata = metadata;
            AgreementType = agreementType;
            HostPartner = hostPartner;
            GuestPartner = guestPartner;
            HostIdentity = hostIdentity;
            GuestIdentity = guestIdentity;
            Content = content;
        }

        /// <summary>
        /// Gets the created time.
        /// </summary>
        [JsonProperty(PropertyName = "properties.createdTime")]
        public DateTime? CreatedTime { get; private set; }

        /// <summary>
        /// Gets the changed time.
        /// </summary>
        [JsonProperty(PropertyName = "properties.changedTime")]
        public DateTime? ChangedTime { get; private set; }

        /// <summary>
        /// Gets or sets the metadata.
        /// </summary>
        [JsonProperty(PropertyName = "properties.metadata")]
        public object Metadata { get; set; }

        /// <summary>
        /// Gets or sets the agreement type. Possible values include:
        /// 'NotSpecified', 'AS2', 'X12', 'Edifact'
        /// </summary>
        [JsonProperty(PropertyName = "properties.agreementType")]
        public AgreementType? AgreementType { get; set; }

        /// <summary>
        /// Gets or sets the host partner.
        /// </summary>
        [JsonProperty(PropertyName = "properties.hostPartner")]
        public string HostPartner { get; set; }

        /// <summary>
        /// Gets or sets the guest partner.
        /// </summary>
        [JsonProperty(PropertyName = "properties.guestPartner")]
        public string GuestPartner { get; set; }

        /// <summary>
        /// Gets or sets the host identity.
        /// </summary>
        [JsonProperty(PropertyName = "properties.hostIdentity")]
        public BusinessIdentity HostIdentity { get; set; }

        /// <summary>
        /// Gets or sets the guest identity.
        /// </summary>
        [JsonProperty(PropertyName = "properties.guestIdentity")]
        public BusinessIdentity GuestIdentity { get; set; }

        /// <summary>
        /// Gets or sets the agreement content.
        /// </summary>
        [JsonProperty(PropertyName = "properties.content")]
        public AgreementContent Content { get; set; }

    }
}


text:
(function() {
    // Install popup
    var install_popup = $('#lightbox_install_modal');
    var install_form = $('#install_form');
    var new_ep_name = install_form.find('input.new_ep_name');
    var new_mount_point = install_form.find('input.new_mount_point');
    var new_mount_label = install_form.find('input.new_mount_label');
    var install_tool_label = $('#install_tool_label');
    var mount_point_rule_names = $('#install_form .mount-point-rule-names');
    var install_options = $('#install_options');
    install_popup.append(install_form.show());
    $('a.install_trig').click(function () {
        var datatool = $(this).data('tool');
        if (datatool) {
            var tool = defaults[datatool];
            install_options.html('Loading options...');
            $.get(install_options_url, {tool_name: datatool}, function (data) {
                install_options.html(data);
            });
            install_tool_label.html(tool.default_label);
            new_ep_name.val(datatool);
            new_mount_point.val(tool.default_mount);
            new_mount_label.val(tool.default_label);
        } else {
            install_tool_label.html("Subproject");
            new_ep_name.val('');
            new_mount_point.val('');
            new_mount_label.val('');
        }
    });
    // sorting
    $('#sortable').sortable({items: ".fleft:not(.isnt_sorted)"}).bind( "sortupdate", function (e) {
        var sortables = $('#sortable .fleft');
        var tools = 0;
        var subs = 0;
        var params = {'_session_id':$.cookie('_session_id')};
        var action = $('#install_form').attr('action');
        var limit = action.match(/limit=(\d+)/)[1];
        var page = action.match(/page=(\d+)/)[1];
        var first_tool_ordinal = parseInt(limit) * parseInt(page);
        for (var i = 0, len = sortables.length; i < len; i++) {
            var item = $(sortables[i]);
            var mount_point = item.find('input.mount_point');
            var shortname = item.find('input.shortname');
            if (mount_point.length) {
                params['tools-' + tools + '.mount_point'] = mount_point.val();
                params['tools-' + tools + '.ordinal'] = i + first_tool_ordinal;
                tools++;
            }
            if (shortname.length) {
                params['subs-' + subs + '.shortname'] = shortname.val();
                params['subs-' + subs + '.ordinal'] = i + first_tool_ordinal;
                subs++;
            }
        }
        $.ajax({
            type: 'POST',
            url: 'update_mount_order',
            data: params,
            success: function(xhr, textStatus, errorThrown) {
                $('#messages').notify('Tool order updated, refresh this page to see the updated project navigation.',
                                      {status: 'confirm'});
            },
            error: function(xhr, textStatus, errorThrown) {
                $('#messages').notify('Error saving tool order.',
                                      {status: 'error'});
            }
        });
    });
    // fix firefox scroll offset bug
    var userAgent = navigator.userAgent.toLowerCase();
    if(userAgent.match(/firefox/)) {
      $('#sortable').bind( "sortstart", function (event, ui) {
        ui.helper.css('margin-top', $(window).scrollTop() );
      });
      $('#sortable').bind( "sortbeforestop", function (event, ui) {
        ui.helper.css('margin-top', 0 );
      });
    }
})();


text:
package com.challenge.n26.nikitabitcoin.misc.util;

import android.content.Context;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.util.TypedValue;

/**
 * Created by 805640 on 30.08.2016.
 */

public class ResUtils {
    @ColorInt
    public static int getThemeColor
            (
                    @NonNull final Context context,
                    @AttrRes final int attributeColor
            )
    {
        final TypedValue value = new TypedValue();
        context.getTheme().resolveAttribute(attributeColor, value, true);
        return value.data;
    }

}


text:
<?php

require_once '../core/init.php';

assert_logged_in();

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
  try
  {
    $store = OAuthStore::instance();
    $user_id = 1; // this should not be hardcoded, of course
    $key   = $store->updateConsumer($_POST, $user_id, true);

    $c = $store->getConsumer($key, $user_id);
    echo 'Your consumer key is: ' . $c['consumer_key'] . '
';
    echo 'Your consumer secret is: ' . $c['consumer_secret'] . '
';
  }
  catch (OAuthException2 $e)
  {
    echo 'Error: ' . $e->getMessage() . '
';
  }
}

$smarty = session_smarty();
$smarty->display('register.tpl');


text:
.class public Lcom/htc/lockscreen/HtcLSConst;
.super Ljava/lang/Object;
.source "HtcLSConst.java"

# static fields
.field public static final ACTION_LOCKSCREEN_DISPLAY:Ljava/lang/String; = "idleScreenDisplay"

.field public static final ACTION_LOCKSCREEN_DO_KEYGUARD:Ljava/lang/String; = "com.htc.intent.action.LOCKSCREEN_DO_KEYGUARD"

.field public static final ACTION_LOCKSCREEN_DO_KEYGUARD_WITH_MODE:Ljava/lang/String; = "com.htc.intent.action.LOCKSCREEN_DO_KEYGUARD_WITH_MODE"

.field public static final ACTION_LOCKSCREEN_SET_IDLESCREEN:Ljava/lang/String; = "lockscreen_set_idlescreen"

.field public static final ACTION_LOCKSCREEN_UNLOCK:Ljava/lang/String; = "idleScreenUnlock"

.field public static final ACTION_SET_SHORTCUT_INFO:Ljava/lang/String; = "com.htc.lockscreen.set_shortcut_info"

.field public static final COMPONENT_UNLOCK:I = 0x1

.field public static final EXTRA_DISPLAY_PART:Ljava/lang/String; = "extraDisplayPart"

.field public static final EXTRA_DISPLAY_SHOW:Ljava/lang/String; = "extraDisplayShow"

.field public static final EXTRA_ID:Ljava/lang/String; = "id"

.field public static final EXTRA_LOCKSCREEN_UI_MODE:Ljava/lang/String; = "ui_mode"

.field public static final EXTRA_NOTIFICATION:Ljava/lang/String; = "notification"

.field public static final EXTRA_PACKAGENAME:Ljava/lang/String; = "PackageName"

.field public static final EXTRA_REASON:Ljava/lang/String; = "HtcLockScreen_REASON"

.field public static final EXTRA_RESULT:Ljava/lang/String; = "HtcLockScreen_RESULT"

.field public static final EXTRA_SHORTCUT_INFO:Ljava/lang/String; = "EXTRA_SHORTCUT_INFO"

.field public static final EXTRA_STATE:Ljava/lang/String; = "State"

.field public static final EXTRA_UNLOCK_TYPE:Ljava/lang/String; = "extra_unlock_type"

.field public static final EXTRA_VIEW:Ljava/lang/String; = "View"

.field public static final FLAG_SHOW_HINT_NO:I = 0x0

.field public static final FLAG_SHOW_HINT_SHOW:I = 0x1

.field public static final FLAG_SHOW_HINT_SHOW_ALWAYS:I = 0x11

.field public static final HTC_MUSIC_CONTROL_ALBUMART:Ljava/lang/String; = "albumart"

.field public static final HTC_MUSIC_CONTROL_DROP_INTENT:Ljava/lang/String; = "drop_intent"

.field public static final HTC_MUSIC_CONTROL_PREFIX:Ljava/lang/String; = "[htc_lockscreen_music_control]"

.field public static final HTC_RCC_ALBUMART_PREFIX:Ljava/lang/String; = "htc_rcc_albumart_prefix_"

.field public static final KEY_LOCKSCREEN_COMP:Ljava/lang/String; = "key_lockscreen_comp"

.field public static final KEY_LOCKSCREEN_MODE:Ljava/lang/String; = "key_lockscreen_mode"

.field public static final LOCKSCREEN_MODE_DOCK:I = 0x1

.field public static final LOCKSCREEN_MODE_NORMAL:I = 0x0

.field public static final LOCKSCREEN_NTF_REMOVE:Ljava/lang/String; = "HtcLockScreenRemoveNotfiication"

.field public static final LOCKSCREEN_NTF_SET:Ljava/lang/String; = "HtcLockScreenSetNotification"

.field public static final LOCKSCREEN_PUB_SET_VIEW:Ljava/lang/String; = "HtcLockScreenSetView_P"

.field public static final LOCKSCREEN_REMOVE_VIEW:Ljava/lang/String; = "HtcLockScreenRemoveView"

.field public static final LOCKSCREEN_SET_VIEW:Ljava/lang/String; = "HtcLockScreenSetView"

.field public static final LSMSG_ON_ADD_ACTION:Ljava/lang/String; = "HtcLockScreen_ADD"

.field public static final LSMSG_ON_DISMISS_ACTION:Ljava/lang/String; = "HtcLockScreen_DISMISS"

.field public static final LSMSG_ON_GO_TO_UNLOCKSCREEN_STATE:I = 0xd

.field public static final LSMSG_ON_OVERWRITE_ACTION:Ljava/lang/String; = "HtcLockScreen_OVERWRITE"

.field public static final LSMSG_ON_PAUSE_STATE:I = 0xb

.field public static final LSMSG_ON_REMOVE_STATE:I = 0xc

.field public static final LSMSG_ON_RESUME_STATE:I = 0xa

.field public static final LSMSG_ON_STATE_ACTION:Ljava/lang/String; = "HtcLockScreen_State_Change"

.field public static final LSMSG_ON_UPDATE_ACTION:Ljava/lang/String; = "HtcLockScreen_Update"

.field public static final LS_REASON_KEYBOARDCHANGED:I = 0x14

.field public static final LS_REASON_NORMAL:I = 0xa

.field public static final LS_REASON_OVERWRITE:I = 0x28

.field public static final LS_REASON_SCREEN_OFF:I = 0x29

.field public static final LS_RESULT_FAIL:I = 0x2

.field public static final LS_RESULT_SUCCESS:I = 0x1

.field public static final ORDER_ABOVE_ALL:I = 0x3e8

.field public static final ORDER_BELOW_ALL:I = 0x0

.field public static final ORDER_NORMAL:I = 0x1

.field public static final ORDER_SAME_ALARM:I = 0x384

.field public static final ORDER_SAME_CALENDAR:I = 0x2bc

.field public static final ORDER_SAME_TIMER:I = 0x320

.field public static final SETTING_DB_IDLESCREEN_DOCK:Ljava/lang/String; = "com.htc.idlescreen.style.dock"

.field public static final SETTING_DB_IDLESCREEN_NORMAL:Ljava/lang/String; = "com.htc.idlescreen.style.normal"

.field public static final WAKE_LOCK_TIME:I = 0x2ee0

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 5
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method