text:
import WeakMap from 'es6-weak-map';
import Scope from './scope';
import assert from 'assert';

import {
    GlobalScope,
    CatchScope,
    WithScope,
    ModuleScope,
    ClassScope,
    SwitchScope,
    FunctionScope,
    ForScope,
    TDZScope,
    FunctionExpressionNameScope,
    BlockScope
} from './scope';

/**
 * @class ScopeManager
 */
export default class ScopeManager {
    constructor(options) {
        this.scopes = [];
        this.globalScope = null;
        this.__nodeToScope = new WeakMap();
        this.__currentScope = null;
        this.__options = options;
        this.__declaredVariables = new WeakMap();
    }

    __useDirective() {
        return this.__options.directive;
    }

    __isOptimistic() {
        return this.__options.optimistic;
    }

    __ignoreEval() {
        return this.__options.ignoreEval;
    }

    __isNodejsScope() {
        return this.__options.nodejsScope;
    }

    isModule() {
        return this.__options.sourceType === 'module';
    }

    // Returns appropliate scope for this node.
    __get(node) {
        return this.__nodeToScope.get(node);
    }

    /**
     * Get variables that are declared by the node.
     *
     * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`.
     * If the node declares nothing, this method returns an empty array.
     * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details.
     *
     * @param {Esprima.Node} node - a node to get.
     * @returns {Variable[]} variables that declared by the node.
     */
    getDeclaredVariables(node) {
        return this.__declaredVariables.get(node) || [];
    }

    /**
     * acquire scope from node.
     * @method ScopeManager#acquire
     * @param {Esprima.Node} node - node for the acquired scope.
     * @param {boolean=} inner - look up the most inner scope, default value is false.
     * @return {Scope?}
     */
    acquire(node, inner) {
        var scopes, scope, i, iz;

        function predicate(scope) {
            if (scope.type === 'function' && scope.functionExpressionScope) {
                return false;
            }
            if (scope.type === 'TDZ') {
                return false;
            }
            return true;
        }

        scopes = this.__get(node);
        if (!scopes || scopes.length === 0) {
            return null;
        }

        // Heuristic selection from all scopes.
        // If you would like to get all scopes, please use ScopeManager#acquireAll.
        if (scopes.length === 1) {
            return scopes[0];
        }

        if (inner) {
            for (i = scopes.length - 1; i >= 0; --i) {
                scope = scopes[i];
                if (predicate(scope)) {
                    return scope;
                }
            }
        } else {
            for (i = 0, iz = scopes.length; i < iz; ++i) {
                scope = scopes[i];
                if (predicate(scope)) {
                    return scope;
                }
            }
        }

        return null;
    }

    /**
     * acquire all scopes from node.
     * @method ScopeManager#acquireAll
     * @param {Esprima.Node} node - node for the acquired scope.
     * @return {Scope[]?}
     */
    acquireAll(node) {
        return this.__get(node);
    }

    /**
     * release the node.
     * @method ScopeManager#release
     * @param {Esprima.Node} node - releasing node.
     * @param {boolean=} inner - look up the most inner scope, default value is false.
     * @return {Scope?} upper scope for the node.
     */
    release(node, inner) {
        var scopes, scope;
        scopes = this.__get(node);
        if (scopes && scopes.length) {
            scope = scopes[0].upper;
            if (!scope) {
                return null;
            }
            return this.acquire(scope.block, inner);
        }
        return null;
    }

    attach() { }

    detach() { }

    __nestScope(scope) {
        if (scope instanceof GlobalScope) {
            assert(this.__currentScope === null);
            this.globalScope = scope;
        }
        this.__currentScope = scope;
        return scope;
    }

    __nestGlobalScope(node) {
        return this.__nestScope(new GlobalScope(this, node));
    }

    __nestBlockScope(node, isMethodDefinition) {
        return this.__nestScope(new BlockScope(this, this.__currentScope, node));
    }

    __nestFunctionScope(node, isMethodDefinition) {
        return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition));
    }

    __nestForScope(node) {
        return this.__nestScope(new ForScope(this, this.__currentScope, node));
    }

    __nestCatchScope(node) {
        return this.__nestScope(new CatchScope(this, this.__currentScope, node));
    }

    __nestWithScope(node) {
        return this.__nestScope(new WithScope(this, this.__currentScope, node));
    }

    __nestClassScope(node) {
        return this.__nestScope(new ClassScope(this, this.__currentScope, node));
    }

    __nestSwitchScope(node) {
        return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
    }

    __nestModuleScope(node) {
        return this.__nestScope(new ModuleScope(this, this.__currentScope, node));
    }

    __nestTDZScope(node) {
        return this.__nestScope(new TDZScope(this, this.__currentScope, node));
    }

    __nestFunctionExpressionNameScope(node) {
        return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node));
    }

    __isES6() {
        return this.__options.ecmaVersion >= 6;
    }
}

/* vim: set sw=4 ts=4 et tw=80 : */


text:
module.exports = function( caminio, policies, middleware ){

  return {

    _before: {
      '*': policies.testAuthenticated,
      '*!(middleware_w_exception)': function( req, res, next ){ req.text += ' middleware_w_exception '; next(); },
      'index,other,resp2': function( req, res, next ){ req.text += 'secondary'; next(); },
      'middleware,middleware_w_exception': [ middleware.special, middleware.special2 ]
    },

    _beforeResponse: {
      'resp2': function resp2BeforeResponse( req, res, next ){ req.text += 'tertiary'; next(); }
    },

    'resp2': function( req, res ){
      req.text += 'quarter';
      res.send( req.text );
    },

    'index': [
      function(req,res,next){ req.text += 'primary'; next(); },
      function( req, res ){
        res.send( req.text );
      }
    ],

    'middleware': [
      middleware.testMiddleware,
      function( req, res ){
        res.send( req.text );
      }
    ],

    'middleware_w_exception': [
      middleware.testMiddleware,
      function( req, res ){
        res.send( req.text );
      }
    ],

    'testSugars': [
      function( req, res ){
        res.send( typeof(policies.testSugars) );
      }
    ],

    'testChocolate': [
      function( req, res ){
        res.send( typeof(policies.testChocolate) );
      }
    ]

  };

};

redpajama_set_name: RedPajamaGithub


text:
<?php

declare(strict_types=1);

namespace Doctrine\Tests\DBAL\Types;

use DateTime;
use DateTimeImmutable;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\DateTimeTzImmutableType;
use Doctrine\DBAL\Types\Type;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use function get_class;

class DateTimeTzImmutableTypeTest extends TestCase
{
    /** @var AbstractPlatform|MockObject */
    private $platform;

    /** @var DateTimeTzImmutableType */
    private $type;

    protected function setUp() : void
    {
        $this->type     = Type::getType('datetimetz_immutable');
        $this->platform = $this->createMock(AbstractPlatform::class);
    }

    public function testFactoryCreatesCorrectType() : void
    {
        self::assertSame(DateTimeTzImmutableType::class, get_class($this->type));
    }

    public function testReturnsName() : void
    {
        self::assertSame('datetimetz_immutable', $this->type->getName());
    }

    public function testReturnsBindingType() : void
    {
        self::assertSame(ParameterType::STRING, $this->type->getBindingType());
    }

    public function testConvertsDateTimeImmutableInstanceToDatabaseValue() : void
    {
        $date = $this->createMock(DateTimeImmutable::class);

        $this->platform->expects($this->once())
            ->method('getDateTimeTzFormatString')
            ->willReturn('Y-m-d H:i:s T');
        $date->expects($this->once())
            ->method('format')
            ->with('Y-m-d H:i:s T')
            ->willReturn('2016-01-01 15:58:59 UTC');

        self::assertSame(
            '2016-01-01 15:58:59 UTC',
            $this->type->convertToDatabaseValue($date, $this->platform)
        );
    }

    public function testConvertsNullToDatabaseValue() : void
    {
        self::assertNull($this->type->convertToDatabaseValue(null, $this->platform));
    }

    public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() : void
    {
        $this->expectException(ConversionException::class);

        $this->type->convertToDatabaseValue(new DateTime(), $this->platform);
    }

    public function testConvertsDateTimeImmutableInstanceToPHPValue() : void
    {
        $date = new DateTimeImmutable();

        self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform));
    }

    public function testConvertsNullToPHPValue() : void
    {
        self::assertNull($this->type->convertToPHPValue(null, $this->platform));
    }

    public function testConvertsDateTimeWithTimezoneStringToPHPValue() : void
    {
        $this->platform->expects($this->once())
            ->method('getDateTimeTzFormatString')
            ->willReturn('Y-m-d H:i:s T');

        $date = $this->type->convertToPHPValue('2016-01-01 15:58:59 UTC', $this->platform);

        self::assertInstanceOf(DateTimeImmutable::class, $date);
        self::assertSame('2016-01-01 15:58:59 UTC', $date->format('Y-m-d H:i:s T'));
    }

    public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTimeWithTimezoneString() : void
    {
        $this->platform->expects($this->atLeastOnce())
            ->method('getDateTimeTzFormatString')
            ->willReturn('Y-m-d H:i:s T');

        $this->expectException(ConversionException::class);

        $this->type->convertToPHPValue('invalid datetime with timezone string', $this->platform);
    }

    public function testRequiresSQLCommentHint() : void
    {
        self::assertTrue($this->type->requiresSQLCommentHint($this->platform));
    }
}


text:
package com.freewaycoffee.client;

import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class FreewayCoffeeTimeToLocationActivity extends Activity
{
	private FreewayCoffeeApp appState;
	private SeekBar TimeSeeker;
	private TextView TimeToLocationText;
	private Integer CurrentTimeToLocation;
	private Integer OriginalTimeToLocation;
	private ProgressDialog TimeToLocProgress;
	private FreewayCoffeeTimeToLocationXMLHandler TimeToLocationXMLHandler;
	private FreewayCoffeeTimeToLocationAsyncGet AsyncGet;

	@Override
	 public void onCreate(Bundle savedInstanceState)
	 {
		super.onCreate(savedInstanceState);
	 	appState = ((FreewayCoffeeApp)getApplicationContext());
     	setContentView(R.layout.fc_time_to_location);

     	Object retained = getLastNonConfigurationInstance();

 		if(retained instanceof FreewayCoffeeTimeToLocationAsyncGet)
 		{

 			AsyncGet=(FreewayCoffeeTimeToLocationAsyncGet)retained;
 			CurrentTimeToLocation = AsyncGet.CurrentTimeToLocationSaved;
 	     	OriginalTimeToLocation = AsyncGet.OriginalTimeToLocationSaved;
 	     	showProgressDialog();// This must be before setActivity as that calls ProcessXML which destroys the dialog --- so we dont want to just re-create it again
    		AsyncGet.SetActivity(this);
 		}
 		else
 		{
 			AsyncGet =null;
 			CurrentTimeToLocation = getIntent().getIntExtra(FreewayCoffeeItemListView.INTENT_KEY_TIME_TO_LOCATION,0);
 	     	OriginalTimeToLocation = getIntent().getIntExtra(FreewayCoffeeItemListView.INTENT_KEY_TIME_TO_LOCATION,0);
 		}

     	TextView UserBanner = (TextView)findViewById(R.id.fc_banner_text);
     	UserBanner.setText(appState.GetUserInfoData().get(FreewayCoffeeItemListView.USER_INFO_NAME_KEY) +", " + getString(R.string.fc_set_time_to));

     	String Location = getIntent().getStringExtra(FreewayCoffeeItemListView.INTENT_KEY_USER_LOCATION_STRING);

     	//getString(R.string.
     	TextView LocationNameView = (TextView)findViewById(R.id.fc_time_to_location_location_label);
     	LocationNameView.setText(getString(R.string.fc_location) + " " + Location);

     	TimeToLocationText= (TextView)findViewById(R.id.fc_time_to_location_update_label);
     	UpdateCurrentTimeToLocationDisplay();

     	SetSliderMinMaxLabels();

     	TimeSeeker = (SeekBar)findViewById(R.id.fc_time_to_location_seeker);

     	TimeSeeker.setMax(appState.GetPreferenceMaxTimeToLocation()+1);

     	UpdateTimeToLocationSlider();

     	TimeSeeker.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
     	{

            @Override
            public void onProgressChanged(SeekBar seekBar,
                    int progress, boolean fromUser)
            {
            	CurrentTimeToLocation=progress;
            	UpdateCurrentTimeToLocationDisplay();
            }
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }
     	});

	 }
	   protected void onDestroy ()
		{
			 super.onDestroy();
			 if(AsyncGet!=null)
			 {
				 AsyncGet.UnlinkActivity();
			 }
		}

		 @Override
		 public Object onRetainNonConfigurationInstance()
		 {
			 if(AsyncGet!=null)
			 {
				 AsyncGet.UnlinkActivity();
				 AsyncGet.CurrentTimeToLocationSaved=CurrentTimeToLocation;
				 AsyncGet.OriginalTimeToLocationSaved=OriginalTimeToLocation;
				 return AsyncGet;
			 }
			 return null;
		 }

	public void showProgressDialog()
	{
		 TimeToLocProgress = ProgressDialog.show(this, "",
				 							   getString(R.string.fc_updating_location_arrival),
				 							   true);
	}

	public void UpdateTimeToLocationSlider()
	{
     	TimeSeeker.setProgress(CurrentTimeToLocation);
	}

	public void DoCancel(View V)
	{
		setResult(RESULT_CANCELED);
		finish();

	}
	public void DoReset(View V)
	{
		CurrentTimeToLocation=OriginalTimeToLocation;
		UpdateTimeToLocationSlider();
		UpdateCurrentTimeToLocationDisplay();

	}

	public void DoUpdate(View V)
	{
		try
		{
			AsyncGet = new FreewayCoffeeTimeToLocationAsyncGet(this,appState);
			String CommandStr = appState.MakeUpdateTimeToLocationURL(CurrentTimeToLocation);
			AsyncGet.execute(CommandStr);
		}
		catch (UnsupportedEncodingException e)
		{
			// TODO
			DisplayNetworkError();
			return;
		}
	}

	public void UpdateCurrentTimeToLocationDisplay()
	{
		if(TimeToLocationText==null)
		{
			// TODO Track this
			TimeToLocationText.setText(getString(R.string.fc_oops));
			return;
		}
		// = "Time: x mins"
		TimeToLocationText.setText(getString(R.string.fc_time) + " " +
								   String.valueOf(CurrentTimeToLocation) +  " " +
								   getString(R.string.fc_minutes));

	}

	@Override
   	public void onConfigurationChanged(Configuration newConfig)
   	{
   	    super.onConfigurationChanged(newConfig);
   	    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
   	}

	public void ProcessXMLResult(String XML)
    {
		/* Get a SAXParser from the SAXPArserFactory. */
		SAXParserFactory spf = SAXParserFactory.newInstance();
		AsyncGet=null;
		try
		{
			SAXParser sp = spf.newSAXParser();

            /* Get the XMLReader of the SAXParser we created. */
			XMLReader xr = sp.getXMLReader();
            /* Create a new ContentHandler and apply it to the XML-Reader*/
			TimeToLocationXMLHandler = new FreewayCoffeeTimeToLocationXMLHandler(appState);
			xr.setContentHandler(TimeToLocationXMLHandler);

           // Parse the xml-data from our URL.

			InputSource is = new InputSource(new StringReader(XML));
			//is.setEncoding("UTF-8");
			xr.parse(is);
           /* Parsing has finished. */
          if(TimeToLocProgress!=null)
          {
        	  TimeToLocProgress.dismiss();
        	  TimeToLocProgress=null;
          }

          if(TimeToLocationXMLHandler.NetworkError==true)
  		  {
        	  DisplayNetworkError();
        	  return;
  		  }
          if(TimeToLocationXMLHandler.signonResponse!=null)
          {
        	   // TODO -=- in general, what do we do for these sub-views if we get say a SIGNON_OK.
        	   // Cannot just reload indefinitely. Can I even call reload here ?
        	   // Return to the parent view and try to let that one refresh ? Lets punt it for now.

               // Tell the parent view that some critical login-type thing has happened!
        	  setResult(FreewayCoffeeItemListView.RESULT_CODE_NOT_LOGGED_IN);

        	   this.finish();
           }

          if(TimeToLocationXMLHandler.UpdateTimeToLocationFlag==true)
          {
        	  Toast SuccessToast = Toast.makeText(appState.getApplicationContext(),
        			  							  getString(R.string.fc_time_to_location_updated),
        			  							  Toast.LENGTH_SHORT);
        	  SuccessToast.show();

        		  appState.GetUserInfoData().put(FreewayCoffeeItemListView.USER_TIME_TO_LOCATION,String.valueOf(CurrentTimeToLocation));
        		  EndActivity();

          }
          else
          {
        	  // TODO Obviously could do better here.
        	  Toast ErrorToast = Toast.makeText(appState.getApplicationContext(),"Time to location could not be updated. Please try again",Toast.LENGTH_SHORT);
        	  ErrorToast.show();
        	  return;
          }

		}
		catch(SAXException e)
    	{
    		//Log.w("FCItemListView",e.getMessage());
			 DisplayNetworkError();
       	  	return;
    	}
    	catch (ParserConfigurationException pe)
    	{
    		 DisplayNetworkError();
       	  	return;
    	}
    	catch (IOException io)
    	{
    		 DisplayNetworkError();
    		 return;
    	}

    }

	private void EndActivity()
	{
       	setResult(RESULT_OK);
       	finish();
	}

	 private void DisplayNetworkError()
	 {
		 if(TimeToLocProgress!=null)
         {
			 TimeToLocProgress.dismiss();
			 TimeToLocProgress=null;
         }

		 Toast Err = Toast.makeText(appState.getApplicationContext(),
					getString(R.string.fc_network_error),
					Toast.LENGTH_SHORT);
		 Err.show();
	 }

	public void SetSliderMinMaxLabels()
 	{
		TextView TimeToLocationMaxLabel = (TextView)findViewById(R.id.fc_time_to_location_seeker_text_max);
		if(TimeToLocationMaxLabel==null)
		{
			// TODO this doesn't look good
		}
		else
		{
			TimeToLocationMaxLabel.setText(String.valueOf(appState.GetPreferenceMaxTimeToLocation()));
		}

		TextView TimeToLocationMinLabel = (TextView)findViewById(R.id.fc_time_to_location_seeker_text_min);
		if(TimeToLocationMinLabel==null)
		{
			// TODO this doesn't look good
		}
		else
		{
 			TimeToLocationMinLabel.setText(String.valueOf(0));
		}
 	}
}

// WONT USE BUT LIKE IT FOR SOMETHING ELSE ?
/*
seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

@Override
public void onStopTrackingTouch(SeekBar seekBar) {

    newProgressValue = seekBar.getProgress();
    currentProgress = newProgressValue ;
    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putInt(Key_PROGRESS, newProgressValue);
    editor.commit();

}
*/


text:
=================
How to contribute
=================

If you are thinking about making Testacular better, or you just want to hack on it, that's great here
are some tips to get you started.

Getting Started
###############

* Make sure you have a `GitHub account`_
* `Submit`_ a ticket for your issue, assuming one does not
  already exist.

  * Clearly describe the issue including steps to reproduce when it is a bug.
  * Make sure you fill in the earliest version that you know has the issue.
* Fork the repository on GitHub

Making Changes
##################

* Clone your fork
* Install dependencies via

  .. code-block:: bash

    $ npm install

* Install global dependencies via

  .. code-block:: bash

    $ npm install testacular jasmine-node -g

* Checkout a new branch (usually based on ``master``) and name it accordingly to what
  you intend to do
  * Features get the prefix ``feature-``
  * Bug fixes get the prefix ``fix-``
  * Improvements to the documentation get the prefix ``docs-``

Testing and Building
####################

Run the tests via

.. code-block:: bash

  # All tests
  $ grunt test

  $ grunt test:unit
  $ grunt test:e2e
  $ grunt test:client

Lint the files via

.. code-block:: bash

  $ grunt lint

Build the project via

.. code-block:: bash

  $ grunt build

The default task, just calling ``grunt`` will run ``build lint test``.

Submitting Changes
###################

* One branch per feature/fix
* Follow  http://nodeguide.com/style.html (with exception of 100 characters per line)
* Send a pull request to the ``master`` branch

.. warning::

  Don't send the pull request to the default branch ``stable``.

Additional Resources
####################

* `Issue tracker`_
* `Mailing List`_
* `General GitHub documentation`_
* `GitHub pull request documentation`_
* `@TestacularJS`_

.. _GitHub account: (https://github.com/signup/free)
.. _Submit: (https://github.com/vojtajina/testacular/issues/new)
.. _@TestacularJS: http://twitter.com/TestacularJS
.. _Mailing list: https://groups.google.com/forum/#!forum/testacular
.. _Issue tracker: https://github.com/vojtajina/testacular/issues
.. _GitHub pull request documentation: http://help.github.com/send-pull-requests
.. _General GitHub documentation: http://help.github.com


text:
package faux.mvc;

import java.io.InputStream;
import java.util.Properties;

import faux.mvc.extend.ITemplate;

public class View {

  private ITemplate _template;

  private Object _viewModel;

  private InputStream _templateStream;

  private Context _context;

  public View(InputStream templateStream, Object viewModel, ITemplate template, Context context) {
    _template = template;
    _viewModel = viewModel;
    _templateStream = templateStream;
    _context = context;
  }

  public String render() {
    String rtn = null;
    if (_templateStream != null) {
      Properties props = new Properties();
      if (_viewModel != null)
        props.put("Model", _viewModel);
      else
        props.put("Model", false);
      rtn = _template.render(props, _templateStream, _context);
    }
    return rtn;
  }
}


text:
package com.haxademic.core.net;

public interface IJsonRequestDelegate {
	public void aboutToRequest(JsonHttpRequest request);
	public void postSuccess(String responseText, int responseCode, String requestId, int responseTime);
	public void postFailure(String responseText, int responseCode, String requestId, int responseTime, String errorMessage);
}


text:
'use strict';
var util = require('util');
var path = require('path');
var glob = require('glob');
var chalk = require('chalk');
var format = require('dateformat');
var wiring = require('html-wiring');
var yeoman = require('yeoman-generator');

var Generator = module.exports = function Generator(args, options) {
  yeoman.generators.Base.apply(this, arguments);
  this.argument('appname', {type: String, required: false});
  this.appname = this.appname || path.basename(process.cwd());
  this.initApp = options.init;
  this.skipInstall = options['skip-install'] || false;
  this.banner = options.banner ?
    wiring.readFileAsString(path.join(this.env.cwd, options.banner)) : '';
  this.date = format(new Date(), 'dS mmmm yyyy');
};

util.inherits(Generator, yeoman.generators.Base);

Generator.prototype.askForModules = function askForModules() {
  if (!this.initApp) {
    var done = this.async();

    var prompts = {
      type: 'confirm',
      name: 'createProject',
      message: 'Cannot find package.json. Do you want to scaffold a new app?'
    };

    this.prompt(prompts, function (props) {
      this.initApp = props.createProject;
      done();
    }.bind(this));
  }
};

Generator.prototype.writeAppFiles = function writeAppFiles() {
  if (this.initApp) {

    var files = glob.sync('**', { dot: true, nodir: true, cwd: this.templatePath() });

    for (var i = 0; i < files.length; i++) {
      var dest;
      var f = files[i];
      var src = path.join(this.templatePath(), f);
      if (path.basename(f).indexOf('_') === 0) {
          dest = path.join(this.env.cwd, path.dirname(f), path.basename(f).replace(/^_/, ''));
          this.template(src, dest);
      } else {
          dest = path.join(this.env.cwd, f);
          this.fs.copy(src, dest, {process: false});
      }
    }
  }
};

Generator.prototype.updateConfig = function updateConfig() {
  if (this.initApp) {
    this.config.set('name', this.appname);
    this.config.set('banner', this.banner);
  }
};

Generator.prototype.installDeps = function installDeps() {
  this.installDependencies({
    skipInstall: this.skipInstall,
    callback: function () {
      var message = '\n\nAlthough you have created a new app, it still won\'t do much.\nThe next step is to ';
      message += chalk.bold.yellow('yo ngbp-module <modulename>');
      message += ' to create a usable ngbp module';
      this.log(message);
    }.bind(this)
  });
};


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Other</title>
  <link rel="stylesheet" href="styles.css">

1

2

3

…

13

14

          Visualize global data

Visualize global data on the GFW Interactive Map

          Visualize country data

Visualize country data on the GFW Interactive Map


text:
package actors

import javax.inject._

import actors.StocksActor.{ GetStocks, Stocks }
import akka.actor.typed.scaladsl.{ ActorContext, Behaviors }
import akka.actor.typed.{ ActorRef, ActorSystem, Behavior, PostStop, Scheduler }
import akka.stream._
import akka.stream.scaladsl._
import akka.util.Timeout
import akka.{ Done, NotUsed }
import org.slf4j.Logger
import play.api.libs.json._
import stocks._

import scala.concurrent.duration._
import scala.concurrent.{ ExecutionContext, Future }
import scala.util.Try

/**
 * Creates a user actor that sets up the websocket stream.  Although it's not required,
 * having an actor manage the stream helps with lifecycle and monitoring, and also helps
 * with dependency injection through the AkkaGuiceSupport trait.
 *
 * @param stocksActor the actor responsible for stocks and their streams
 */
class UserActor @Inject()(id: String, stocksActor: ActorRef[GetStocks])(implicit
    context: ActorContext[UserActor.Message],
) {
  import UserActor._

  val log: Logger = context.log

  implicit val timeout: Timeout             = Timeout(50.millis)
  implicit val system: ActorSystem[Nothing] = context.system
  import context.executionContext

  val (hubSink, hubSource) = MergeHub.source[JsValue](perProducerBufferSize = 16)
    .toMat(BroadcastHub.sink(bufferSize = 256))(Keep.both)
    .run()

  private var stocksMap: Map[StockSymbol, UniqueKillSwitch] = Map.empty

  private val jsonSink: Sink[JsValue, Future[Done]] = Sink.foreach { json =>
    // When the user types in a stock in the upper right corner, this is triggered,
    val symbol = (json \ "symbol").as[StockSymbol]
    addStocks(Set(symbol))
  }

  def behavior: Behavior[Message] = {
    Behaviors.receiveMessage[Message] {
      case WatchStocks(symbols, replyTo) =>
        addStocks(symbols)
        replyTo ! websocketFlow
        Behaviors.same

      case UnwatchStocks(symbols) =>
        unwatchStocks(symbols)
        Behaviors.same

      case InternalStop =>
        Behaviors.stopped
    }.receiveSignal {
      case (_, PostStop) =>
        // If this actor is killed directly, stop anything that we started running explicitly.
        log.info("Stopping actor {}", context.self)
        unwatchStocks(stocksMap.keySet)
        Behaviors.same
    }
  }

  /**
   * Generates a flow that can be used by the websocket.
   *
   * @return the flow of JSON
   */
  private lazy val websocketFlow: Flow[JsValue, JsValue, NotUsed] = {
    // Put the source and sink together to make a flow of hub source as output (aggregating all
    // stocks as JSON to the browser) and the actor as the sink (receiving any JSON messages
    // from the browse), using a coupled sink and source.
    Flow.fromSinkAndSourceCoupled(jsonSink, hubSource).watchTermination() { (_, termination) =>
      // When the flow shuts down, make sure this actor also stops.
      context.pipeToSelf(termination)((_: Try[Done]) => InternalStop)
      NotUsed
    }
  }

  /**
   * Adds several stocks to the hub, by asking the stocks actor for stocks.
   */
  private def addStocks(symbols: Set[StockSymbol]): Future[Unit] = {
    import akka.actor.typed.scaladsl.AskPattern._

    // Ask the stocksActor for a stream containing these stocks.
    val future = stocksActor.ask(replyTo => GetStocks(symbols, replyTo))

    // when we get the response back, we want to turn that into a flow by creating a single
    // source and a single sink, so we merge all of the stock sources together into one by
    // pointing them to the hubSink, so we can add them dynamically even after the flow
    // has started.
    future.map { (newStocks: Stocks) =>
      newStocks.stocks.foreach { stock =>
        if (! stocksMap.contains(stock.symbol)) {
          log.info("Adding stock {}", stock)
          addStock(stock)
        }
      }
    }
  }

  /**
   * Adds a single stock to the hub.
   */
  private def addStock(stock: Stock): Unit = {
    // We convert everything to JsValue so we get a single stream for the websocket.
    // Make sure the history gets written out before the updates for this stock...
    val historySource = stock.history(50).map(sh => Json.toJson(sh))
    val updateSource = stock.update.map(su => Json.toJson(su))
    val stockSource = historySource.concat(updateSource)

    // Set up a flow that will let us pull out a killswitch for this specific stock,
    // and automatic cleanup for very slow subscribers (where the browser has crashed, etc).
    val killswitchFlow: Flow[JsValue, JsValue, UniqueKillSwitch] = {
      Flow.apply[JsValue]
        .joinMat(KillSwitches.singleBidi[JsValue, JsValue])(Keep.right)
        .backpressureTimeout(1.seconds)
    }

    // Set up a complete runnable graph from the stock source to the hub's sink
    val graph: RunnableGraph[UniqueKillSwitch] = {
      stockSource
        .viaMat(killswitchFlow)(Keep.right)
        .to(hubSink)
        .named(s"stock-${stock.symbol}-$id")
    }

    // Start it up!
    val killSwitch = graph.run()

    // Pull out the kill switch so we can stop it when we want to unwatch a stock.
    stocksMap += (stock.symbol -> killSwitch)
  }

  def unwatchStocks(symbols: Set[StockSymbol]): Unit = {
    symbols.foreach { symbol =>
      stocksMap.get(symbol).foreach { killSwitch =>
        killSwitch.shutdown()
      }
      stocksMap -= symbol
    }
  }
}

object UserActor {
  sealed trait Message

  case class WatchStocks(symbols: Set[StockSymbol], replyTo: ActorRef[Flow[JsValue, JsValue, NotUsed]]) extends Message {
    require(symbols.nonEmpty, "Must specify at least one symbol!")
  }

  case class UnwatchStocks(symbols: Set[StockSymbol]) extends Message {
    require(symbols.nonEmpty, "Must specify at least one symbol!")
  }

  private case object InternalStop extends Message

  trait Factory {
    def apply(id: String): Behavior[Message]
  }

  def apply(id: String, stocksActor: ActorRef[GetStocks])(implicit
      mat: Materializer,
      ec: ExecutionContext,
  ): Behavior[Message] = {
    Behaviors.setup { implicit context =>
      implicit val scheduler = context.system.scheduler
      new UserActor(id, stocksActor).behavior
    }
  }
}


text:
DnD.Draggable = Ember.Mixin.create({
  attributeBindings: 'draggable',

  draggable: function () {
    if (this.get('canDrag')) {
      return 'true';
    } else {
      return 'false';
    }
  }.property('canDrag'),

  dragStart: function (event) {
    var currentCoordinates = DnD.portableCoordinates(event),
      dataTransfer = event.dataTransfer,
      object;

    if (this.get('canDrag')) {
      object = this.dragObject(currentCoordinates.x, currentCoordinates.y);

      dataTransfer.effectAllowed = 'move';
      dataTransfer.setData('object', object);
      dataTransfer.setData('from', '%@:%@'.fmt(currentCoordinates.x, currentCoordinates.y));
      if (object && DnD.completeDragSupport()) {
        dataTransfer.setDragImage($('img.blank')[0], 0, 0);
      }

      event.stopPropagation();
    } else {
      event.preventDefault();
      return false;
    }
  },

  touchStart: function (event) {
    var currentCoordinates = DnD.portableCoordinates(event);
    if (this.get('canDrag')) {
      // Drag object.
      var object = this.dragObject(currentCoordinates.x, currentCoordinates.y);
      // Set last dragged from in DnD since we won't have dataTransfer for touch events.
      DnD.set('lastDraggedFrom', '%@:%@'.fmt(currentCoordinates.x, currentCoordinates.y));
      event.stopPropagation();
    } else {
      event.preventDefault();
      return false;
    }
  },

  /** To be implemented by draggable */
  canDrag: true,

  /** To be implemented by draggable */
  dragObject: Ember.K
});


text:
class ForgetAboutIt < ActiveRecord::Migration[5.0]
  def change
  end
end


text:
/**
 * Usuarios.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package br.usp.easytripdatabase;

public interface Usuarios extends java.rmi.Remote {
    public boolean insertUsuario(java.lang.String nome, java.lang.String email, java.lang.String senha, java.lang.String cpf) throws java.rmi.RemoteException;
    public int getCPF(java.lang.String email, java.lang.String senha) throws java.rmi.RemoteException;
    public model.Usuario getUsuario(java.lang.String email, java.lang.String senha) throws java.rmi.RemoteException;
    public int getAutenticacaoUsuario(java.lang.String email, java.lang.String senha) throws java.rmi.RemoteException;
}