text:
#ifdef __EMSCRIPTEN__

EM_JS(int, em_get_memory_size, (),
{
	return HEAP8.length;
});

EM_JS(void, em_disable_context_menu, (),
{
	document.addEventListener("contextmenu", function(event) {event.preventDefault();}, false);
});

EM_JS(void, em_mmb_capture, (),
{
	document.body.onmousedown = function(e)
	{
		if (e.button === 1)
		{
			canvas.requestPointerLock();
			return false;
		}
	}
});

EM_JS(void, em_capture_cursor, (),
{
	canvas.requestPointerLock();
});

EM_JS(void, em_release_cursor, (),
{
	document.exitPointerLock();
});

void em_sync_by_mutex(int lock)
{
	static int init=1;
	static rl_mutex_t my_mutex;

	if (init)
	{
		init = 0;
		rl_mutex_init(&my_mutex);
	}
fprintf_rl(stdout, "em_sync_by_mutex(%d) %d\n", lock, rand()&63);

	if (lock)
		rl_mutex_lock(&my_mutex);
	else
		rl_mutex_unlock(&my_mutex);
}

/*EM_JS(void, em_browser_toggle_fullscreen, (int state),
{
Asyncify.handleAsync(async () => {
	if (state)
		await canvas.requestFullscreen();
	else
		await em_exit_fullscreen_ret_promise();
});
});*/

EM_JS(void, em_browser_toggle_fullscreen, (int state),
{
	if (state)
		canvas.requestFullscreen();
	else
		em_exit_fullscreen_ret_promise();
});

/*void em_browser_toggle_fullscreen(int state)
{
	if (state)
	{
		EmscriptenFullscreenStrategy strat={0};
		strat.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT;
		strat.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
		strat.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_NEAREST;
		emscripten_request_fullscreen_strategy(NULL, 1, &strat);
	}
	else
	{
		emscripten_exit_fullscreen();
	}
}*/

void em_fit_canvas_to_innerwindow()
{
	if (fb->fullscreen_on)
		return ;

	SDL_SetWindowSize(fb->window, MINN(fb->maxdim.x, EM_ASM_INT((return window.innerWidth;))), MINN(fb->maxdim.y, EM_ASM_INT((return window.innerHeight;))));
	sdl_handle_window_resize(&zc);
}

EM_JS(void, em_enumerate_av_devices, (),
{
	em_enumerate_av_devices();
});

typedef struct
{
	int id, order;
	char *string;
} em_string_reg_entry_t;

/* IDs:
   1327 (avd): list of audio devices
*/

char *em_string_registry(int id, char *str)
{
	int i, min_order=INT_MAX;
	static em_string_reg_entry_t *entry=NULL;
	static size_t entry_count=0, entry_as=0;
	static int order=0;

	// If we're adding a string
	if (str)
	{
		order++;

		// Look for free entry
		for (i=0; i < entry_count; i++)
			if (entry[i].id == 0)
				goto skip_add1;

		// otherwise add new entry
		i = entry_count;
		alloc_enough(&entry, entry_count+=1, &entry_as, sizeof(em_string_reg_entry_t), 1.5);
skip_add1:
		entry[i].id = id;
		entry[i].string = str;
		entry[i].order = order;
		return str;
	}

	// If we're retrieving a string
	// Find entry with correct ID and lowest order, delete it and return the string
	for (i=0; i < entry_count; i++)
		if (entry[i].id == id && entry[i].order < min_order)
		{
			min_order = entry[i].order;
			str = entry[i].string;
			memset(&entry[i], 0, sizeof(em_string_reg_entry_t));
		}

	return str;
}

#endif


text:
<?php

namespace Symfony\Component\Translation\Util;

use Symfony\Component\Translation\Exception\InvalidArgumentException;
use Symfony\Component\Translation\Exception\InvalidResourceException;

/**
 * Provides some utility methods for XLIFF translation files, such as validating
 * their contents according to the XSD schema.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class XliffUtils
{
    /**
     * Gets xliff file version based on the root "version" attribute.
     *
     * Defaults to 1.2 for backwards compatibility.
     *
     * @throws InvalidArgumentException
     */
    public static function getVersionNumber(\DOMDocument $dom): string
    {
        /** @var \DOMNode $xliff */
        foreach ($dom->getElementsByTagName('xliff') as $xliff) {
            $version = $xliff->attributes->getNamedItem('version');
            if ($version) {
                return $version->nodeValue;
            }

            $namespace = $xliff->attributes->getNamedItem('xmlns');
            if ($namespace) {
                if (0 !== substr_compare('urn:oasis:names:tc:xliff:document:', $namespace->nodeValue, 0, 34)) {
                    throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s".', $namespace));
                }

                return substr($namespace, 34);
            }
        }

        // Falls back to v1.2
        return '1.2';
    }

    /**
     * Validates and parses the given file into a DOMDocument.
     *
     * @throws InvalidResourceException
     */
    public static function validateSchema(\DOMDocument $dom): array
    {
        $xliffVersion = static::getVersionNumber($dom);
        $internalErrors = libxml_use_internal_errors(true);
        if ($shouldEnable = self::shouldEnableEntityLoader()) {
            $disableEntities = libxml_disable_entity_loader(false);
        }
        try {
            $isValid = @$dom->schemaValidateSource(self::getSchema($xliffVersion));
            if (!$isValid) {
                return self::getXmlErrors($internalErrors);
            }
        } finally {
            if ($shouldEnable) {
                libxml_disable_entity_loader($disableEntities);
            }
        }

        $dom->normalizeDocument();

        libxml_clear_errors();
        libxml_use_internal_errors($internalErrors);

        return [];
    }

    private static function shouldEnableEntityLoader(): bool
    {
        // Version prior to 8.0 can be enabled without deprecation
        if (\PHP_VERSION_ID < 80000) {
            return true;
        }

        static $dom, $schema;
        if (null === $dom) {
            $dom = new \DOMDocument();
            $dom->loadXML('<?xml version="1.0"?><test/>');

            $tmpfile = tempnam(sys_get_temp_dir(), 'symfony');
            register_shutdown_function(static function () use ($tmpfile) {
                @unlink($tmpfile);
            });
            $schema = '<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:include schemaLocation="file:///'.str_replace('\\', '/', $tmpfile).'" />
</xsd:schema>';
            file_put_contents($tmpfile, '<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="test" type="testType" />
  <xsd:complexType name="testType"/>
</xsd:schema>');
        }

        return !@$dom->schemaValidateSource($schema);
    }

    public static function getErrorsAsString(array $xmlErrors): string
    {
        $errorsAsString = '';

        foreach ($xmlErrors as $error) {
            $errorsAsString .= sprintf("[%s %s] %s (in %s - line %d, column %d)\n",
                \LIBXML_ERR_WARNING === $error['level'] ? 'WARNING' : 'ERROR',
                $error['code'],
                $error['message'],
                $error['file'],
                $error['line'],
                $error['column']
            );
        }

        return $errorsAsString;
    }

    private static function getSchema(string $xliffVersion): string
    {
        if ('1.2' === $xliffVersion) {
            $schemaSource = file_get_contents(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd');
            $xmlUri = 'http://www.w3.org/2001/xml.xsd';
        } elseif ('2.0' === $xliffVersion) {
            $schemaSource = file_get_contents(__DIR__.'/../Resources/schemas/xliff-core-2.0.xsd');
            $xmlUri = 'informativeCopiesOf3rdPartySchemas/w3c/xml.xsd';
        } else {
            throw new InvalidArgumentException(sprintf('No support implemented for loading XLIFF version "%s".', $xliffVersion));
        }

        return self::fixXmlLocation($schemaSource, $xmlUri);
    }

    /**
     * Internally changes the URI of a dependent xsd to be loaded locally.
     */
    private static function fixXmlLocation(string $schemaSource, string $xmlUri): string
    {
        $newPath = str_replace('\\', '/', __DIR__).'/../Resources/schemas/xml.xsd';
        $parts = explode('/', $newPath);
        $locationstart = 'file:///';
        if (0 === stripos($newPath, 'phar://')) {
            $tmpfile = tempnam(sys_get_temp_dir(), 'symfony');
            if ($tmpfile) {
                copy($newPath, $tmpfile);
                $parts = explode('/', str_replace('\\', '/', $tmpfile));
            } else {
                array_shift($parts);
                $locationstart = 'phar:///';
            }
        }

        $drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
        $newPath = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));

        return str_replace($xmlUri, $newPath, $schemaSource);
    }

    /**
     * Returns the XML errors of the internal XML parser.
     */
    private static function getXmlErrors(bool $internalErrors): array
    {
        $errors = [];
        foreach (libxml_get_errors() as $error) {
            $errors[] = [
                'level' => \LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
                'code' => $error->code,
                'message' => trim($error->message),
                'file' => $error->file ?: 'n/a',
                'line' => $error->line,
                'column' => $error->column,
            ];
        }

        libxml_clear_errors();
        libxml_use_internal_errors($internalErrors);

        return $errors;
    }
}

redpajama_set_name: RedPajamaGithub


text:
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/matrix_transform.hpp>

class Camera
{
private:
	float fov;
	float znear, zfar;

	void updateViewMatrix()
	{
		glm::mat4 rotM = glm::mat4(1.0f);
		glm::mat4 transM;

		rotM = glm::rotate(rotM, glm::radians(rotation.x * (flipY ? -1.0f : 1.0f)), glm::vec3(1.0f, 0.0f, 0.0f));
		rotM = glm::rotate(rotM, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
		rotM = glm::rotate(rotM, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));

		glm::vec3 translation = position;
		if (flipY) {
			translation.y *= -1.0f;
		}
		transM = glm::translate(glm::mat4(1.0f), translation);

		if (type == CameraType::firstperson)
		{
			matrices.view = rotM * transM;
		}
		else
		{
			matrices.view = transM * rotM;
		}

		viewPos = glm::vec4(position, 0.0f) * glm::vec4(-1.0f, 1.0f, -1.0f, 1.0f);

		updated = true;
	};
public:
	enum CameraType { lookat, firstperson };
	CameraType type = CameraType::lookat;

	glm::vec3 rotation = glm::vec3();
	glm::vec3 position = glm::vec3();
	glm::vec4 viewPos = glm::vec4();

	float rotationSpeed = 1.0f;
	float movementSpeed = 1.0f;

	bool updated = false;
	bool flipY = false;

	struct
	{
		glm::mat4 perspective;
		glm::mat4 view;
	} matrices;

	struct
	{
		bool left = false;
		bool right = false;
		bool up = false;
		bool down = false;
	} keys;

	bool moving()
	{
		return keys.left || keys.right || keys.up || keys.down;
	}

	float getNearClip() {
		return znear;
	}

	float getFarClip() {
		return zfar;
	}

	void setPerspective(float fov, float aspect, float znear, float zfar)
	{
		this->fov = fov;
		this->znear = znear;
		this->zfar = zfar;
		matrices.perspective = glm::perspective(glm::radians(fov), aspect, znear, zfar);
		if (flipY) {
			matrices.perspective[1][1] *= -1.0f;
		}
	};

	void updateAspectRatio(float aspect)
	{
		matrices.perspective = glm::perspective(glm::radians(fov), aspect, znear, zfar);
		if (flipY) {
			matrices.perspective[1][1] *= -1.0f;
		}
	}

	void setPosition(glm::vec3 position)
	{
		this->position = position;
		updateViewMatrix();
	}

	void setRotation(glm::vec3 rotation)
	{
		this->rotation = rotation;
		updateViewMatrix();
	}

	void rotate(glm::vec3 delta)
	{
		this->rotation += delta;
		updateViewMatrix();
	}

	void setTranslation(glm::vec3 translation)
	{
		this->position = translation;
		updateViewMatrix();
	};

	void translate(glm::vec3 delta)
	{
		this->position += delta;
		updateViewMatrix();
	}

	void setRotationSpeed(float rotationSpeed)
	{
		this->rotationSpeed = rotationSpeed;
	}

	void setMovementSpeed(float movementSpeed)
	{
		this->movementSpeed = movementSpeed;
	}

	void update(float deltaTime)
	{
		updated = false;
		if (type == CameraType::firstperson)
		{
			if (moving())
			{
				glm::vec3 camFront;
				camFront.x = -cos(glm::radians(rotation.x)) * sin(glm::radians(rotation.y));
				camFront.y = sin(glm::radians(rotation.x));
				camFront.z = cos(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
				camFront = glm::normalize(camFront);

				float moveSpeed = deltaTime * movementSpeed;

				if (keys.up)
					position += camFront * moveSpeed;
				if (keys.down)
					position -= camFront * moveSpeed;
				if (keys.left)
					position -= glm::normalize(glm::cross(camFront, glm::vec3(0.0f, 1.0f, 0.0f))) * moveSpeed;
				if (keys.right)
					position += glm::normalize(glm::cross(camFront, glm::vec3(0.0f, 1.0f, 0.0f))) * moveSpeed;

				updateViewMatrix();
			}
		}
	};

	// Update camera passing separate axis data (gamepad)
	// Returns true if view or position has been changed
	bool updatePad(glm::vec2 axisLeft, glm::vec2 axisRight, float deltaTime)
	{
		bool retVal = false;

		if (type == CameraType::firstperson)
		{
			// Use the common console thumbstick layout
			// Left = view, right = move

			const float deadZone = 0.0015f;
			const float range = 1.0f - deadZone;

			glm::vec3 camFront;
			camFront.x = -cos(glm::radians(rotation.x)) * sin(glm::radians(rotation.y));
			camFront.y = sin(glm::radians(rotation.x));
			camFront.z = cos(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
			camFront = glm::normalize(camFront);

			float moveSpeed = deltaTime * movementSpeed * 2.0f;
			float rotSpeed = deltaTime * rotationSpeed * 50.0f;

			// Move
			if (fabsf(axisLeft.y) > deadZone)
			{
				float pos = (fabsf(axisLeft.y) - deadZone) / range;
				position -= camFront * pos * ((axisLeft.y < 0.0f) ? -1.0f : 1.0f) * moveSpeed;
				retVal = true;
			}
			if (fabsf(axisLeft.x) > deadZone)
			{
				float pos = (fabsf(axisLeft.x) - deadZone) / range;
				position += glm::normalize(glm::cross(camFront, glm::vec3(0.0f, 1.0f, 0.0f))) * pos * ((axisLeft.x < 0.0f) ? -1.0f : 1.0f) * moveSpeed;
				retVal = true;
			}

			// Rotate
			if (fabsf(axisRight.x) > deadZone)
			{
				float pos = (fabsf(axisRight.x) - deadZone) / range;
				rotation.y += pos * ((axisRight.x < 0.0f) ? -1.0f : 1.0f) * rotSpeed;
				retVal = true;
			}
			if (fabsf(axisRight.y) > deadZone)
			{
				float pos = (fabsf(axisRight.y) - deadZone) / range;
				rotation.x -= pos * ((axisRight.y < 0.0f) ? -1.0f : 1.0f) * rotSpeed;
				retVal = true;
			}
		}
		else
		{
			// todo: move code from example base class for look-at
		}

		if (retVal)
		{
			updateViewMatrix();
		}

		return retVal;
	}

};


text:
'use strict';

var path = require('path');
var moment = require('moment');
var semver = require('semver');

module.exports = function(grunt) {

	// Force unix linefeeds (see https://github.com/gruntjs/grunt/issues/1123)
	// (grunt uses grunt.util.normalizelf when processing templates)
	grunt.util.linefeed = '\n';

	// Log time how long tasks take
	require('grunt-timer').init(grunt, {
		deferLogs: true,
		color: 'cyan'
	});

	// Check for valid required Node.js version from package.json
	// npm does not validate this within the project itself; only if this project would be installed as a dependency (which is not the case as of now)
	var pkg = grunt.file.readJSON(__dirname + "/package.json");
	if (pkg.engines && pkg.engines.node && !semver.satisfies(process.version, pkg.engines.node)) {
		grunt.log.error('!!! WARNING !!!');
		grunt.log.error('Unsupported Node.js version: wanted "' + pkg.engines.node + '" (current: "' + process.version + '")');
		grunt.log.error('Please update your Node.js installation!');
	}

	// Load all custom tasks from grunt/tasks dir
	grunt.loadTasks(path.join(process.cwd(), 'grunt/tasks'));

	// set default options
	grunt.option('production', grunt.option('production') || false);
	if (typeof grunt.option('minify-css') === 'undefined') {
		grunt.option('minify-css', grunt.option('production'));
	}
	if (typeof grunt.option('include-test-resources') === 'undefined') {
		grunt.option('include-test-resources', grunt.option('no-production'));
	}

	// set of libraries to use (e.g. --libs=sap.ui.core)
	var libsOption = grunt.option('libs');
	var libs = libsOption ? libsOption.split(',') : null;

	// the gruntdata contains the configuration for the build part
	// we distinguish here between a testsuite which is an application
	// and the libraries which are the re-use modules
	var gruntData = {

		buildtime: moment().utc().format('YYYYMMDDHHmmss'),
		lastchange: '',

		testsuite: {
			name: 'testsuite',
			path: 'src/testsuite'
		},
		allLibraries: [
			{
				name: 'sap.ui.core',
				path: 'src/sap.ui.core',
				preload: {
					src: [

						'**/*.js',

						// configuration copied from sap/ui/core/.library

						// files are already part of sap-ui-core.js
						'!ui5loader*.js',

						// exclude all merged files as well as the top level jQuery copy (not visible in OpenUI5)
						'!jquery-*.js',
						'!sap-*',
						// CorePlugin, shouldn't be installed by default
						'!sap/ui/core/plugin/DeclarativeSupport.js',
						'!sap/ui/core/plugin/LessSupport.js',
						// exclude non-productive code
						'!sap/ui/debug/**',
						'!sap/ui/core/support/**',
						'!sap/ui/qunit/**',
						'!sap/ui/test/**',
						'!testsuite/**',
						// Ignore substitutes for moved third party libs
						'!jquery-ui-core.js',
						'!jquery-ui-datepicker.js',
						'!jquery-ui-position.js',
						'!sap/ui/model/odata/datajs.js',
						// Third party libs which should NOT be part of the all-in-one file
						'!sap/ui/thirdparty/blanket.js',
						// '!sap/ui/thirdparty/crossroads.js'
						// '!sap/ui/thirdparty/caja-html-sanitizer.js'
						'!sap/ui/thirdparty/d3.js',
						'!sap/ui/thirdparty/datajs.js',
						'!sap/ui/thirdparty/handlebars.js',
						// '!sap/ui/thirdparty/hasher.js'
						'!sap/ui/thirdparty/IPv6.js',
						'!sap/ui/thirdparty/iscroll.js',
						'!sap/ui/thirdparty/iscroll-lite.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-widget.js',
						'!sap/ui/thirdparty/jqueryui/jquery-effect*.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-blind.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-bounce.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-clip.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-drop.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-explode.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-fade.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-fold.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-highlight.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-pulsate.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-scale.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-shake.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-slide.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-effect-transfer.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-mouse.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-draggable.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-resizable.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-selectable.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-sortable.js',
						'!sap/ui/thirdparty/jqueryui/jquery-ui-droppable.js',
						'!sap/ui/thirdparty/jszip.js',
						'!sap/ui/thirdparty/klay.js',
						'!sap/ui/thirdparty/less.js',
						'!sap/ui/thirdparty/mobify-carousel.js',
						'!sap/ui/thirdparty/mobiscroll/js/mobiscroll-core.js',
						'!sap/ui/thirdparty/mobiscroll/js/mobiscroll-scroller.js',
						'!sap/ui/thirdparty/mobiscroll/js/mobiscroll-datetime.js',
						'!sap/ui/thirdparty/punycode.js',
						'!sap/ui/thirdparty/qunit-2.js',
						'!sap/ui/thirdparty/qunit-composite.js',
						'!sap/ui/thirdparty/qunit-reporter-junit.js',
						'!sap/ui/thirdparty/qunit.js',
						'!sap/ui/thirdparty/RequestRecorder.js',
						'!sap/ui/thirdparty/require.js',
						'!sap/ui/thirdparty/SecondLevelDomains.js',
						// '!sap/ui/thirdparty/signals.js'
						'!sap/ui/thirdparty/sinon-4.js',
						'!sap/ui/thirdparty/sinon-ie.js',
						'!sap/ui/thirdparty/sinon-qunit.js',
						'!sap/ui/thirdparty/sinon-server.js',
						'!sap/ui/thirdparty/sinon.js',
						'!sap/ui/thirdparty/swipe-view.js',
						// URI is no longer excluded because it's needed in jquery.sap.global and others
						// '!sap/ui/thirdparty/URI.js'
						'!sap/ui/thirdparty/URITemplate.js',
						'!sap/ui/thirdparty/vkbeautify.js',
						'!sap/ui/thirdparty/zyngascroll.js',
						// INCLUDED (because not mentioned in the list above) are the following libs:
						// jquery.sap.global.js
						// sap/ui/thirdparty/jquery-mobile-custom.js
						// sap/ui/thirdparty/jqueryui/jquery-ui-core.js
						// sap/ui/thirdparty/jqueryui/jquery-ui-position.js
						// sap/ui/thirdparty/jqueryui/jquery-ui-datepicker.js

						// exclude CLDR and messagebundles
						'!sap/ui/core/cldr/**',
						'!sap/ui/core/messagebundle*'
					]
				},
				jsdoc: {
					exclude: [ 'sap/ui/qunit', 'sap/ui/thirdparty' ]
				}
			},
			{
				name: 'sap.ui.unified',
				path: 'src/sap.ui.unified'
			},
			{
				name: 'sap.ui.layout',
				path: 'src/sap.ui.layout'
			},
			{
				name: 'sap.m',
				path: 'src/sap.m'
			},
			{
				name: 'sap.tnt',
				path: 'src/sap.tnt'
			},
			{
				name: 'sap.f',
				path: 'src/sap.f'
			},
			{
				name: 'sap.ui.commons',
				path: 'src/sap.ui.commons'
			},
			{
				name: 'sap.ui.table',
				path: 'src/sap.ui.table'
			},
			{
				name: 'sap.ui.ux3',
				path: 'src/sap.ui.ux3'
			},
			{
				name: 'sap.ui.suite',
				path: 'src/sap.ui.suite'
			},
			{
				name: 'sap.ui.documentation',
				path: 'src/sap.ui.documentation',
				jsdoc: {
					exclude: [ 'sap/ui/documentation/sdk/thirdparty' ]
				}
			},
			{
				name: 'sap.ui.dt',
				path: 'src/sap.ui.dt'
			},
			{
				name: 'sap.uxap',
				path: 'src/sap.uxap'
			},
			{
				name: 'sap.ui.fl',
				path: 'src/sap.ui.fl'
			},
			{
				name: 'sap.ui.mdc',
				path: 'src/sap.ui.mdc'
			},
			{
				name: 'sap.ui.codeeditor',
				path: 'src/sap.ui.codeeditor',
				preload: {
					src: [
						'**/*.js',
						'!sap/ui/codeeditor/js/**'
					]
				},
				jsdoc: {
					exclude: [ 'sap/ui/codeeditor/js' ]
				}
			},
			{
				name: 'sap.ui.support',
				path: 'src/sap.ui.support'
			},
			{
				name: 'sap.ui.rta',
				path: 'src/sap.ui.rta'
			},
			{
				name: 'sap.ui.integration',
				path: 'src/sap.ui.integration',
				preload: {
					src: [
						'**/*.js',
						'!sap/ui/integration/thirdparty/**',
						'!sap/ui/integration/designtime/thirdparty/**'
					]
				},
				jsdoc: {
					exclude: [
						'sap/ui/integration/thirdparty',
						'sap/ui/integration/designtime/thirdparty'
					]
				}
			},
			{
				name: 'sap.ui.testrecorder',
				path: 'src/sap.ui.testrecorder'
			},
			{
				name: 'themelib_sap_bluecrystal',
				path: 'src/themelib_sap_bluecrystal',
				type: 'theme'
			},
			{
				name: 'themelib_sap_belize',
				path: 'src/themelib_sap_belize',
				type: 'theme'
			},
			{
				name: 'themelib_sap_fiori_3',
				path: 'src/themelib_sap_fiori_3',
				type: 'theme'
			},
			{
				name: 'themelib_sap_horizon',
				path: 'src/themelib_sap_horizon',
				type: 'theme'
			},
			{
				name: 'sap.ui.webc.common',
				path: 'src/sap.ui.webc.common'
			},
			{
				name: 'sap.ui.webc.main',
				path: 'src/sap.ui.webc.main'
			},
			{
				name: 'sap.ui.webc.fiori',
				path: 'src/sap.ui.webc.fiori'
			},
		]

	};

	// Load config extension script to allow overrides to "grunt" and "gruntData"
	var configExtensionFile = grunt.option("config-extension");
	if (configExtensionFile) {
		configExtensionFile.split(',').forEach(file => require(path.resolve(file))(grunt, gruntData));
	}

	// Normalize all library 'path' to individual 'src' and 'test' paths
	gruntData.allLibraries.forEach(function(library) {
		library.src = library.src || library.path + "/src";
		library.test = library.test || library.path + "/test";
	});

	// determine set of libraries to use (specified by --libs option)
	gruntData.libraries = !libs ? gruntData.allLibraries : gruntData.allLibraries.filter(function(library) {
		return libs.indexOf(library.name) > -1;
	});

	// Load all grunt config files (in grunt subfolder) and all tasks installed via npm
	require('load-grunt-config')(grunt, {

		configPath: path.join(process.cwd(), 'grunt/config'),

		// loads grunt plugins just-in-time (faster than using load-grunt-tasks)
		jitGrunt: {
			staticMappings: {
				'replace': 'grunt-text-replace',
				'openui5_connect': 'grunt-openui5',
				'openui5_theme': 'grunt-openui5',
				'openui5_preload': 'grunt-openui5',
				'gitclone': 'grunt-git',
				'gitadd': 'grunt-git',
				'gitcommit': 'grunt-git',
				'gittag': 'grunt-git',
				'gitpush': 'grunt-git',
				'jsdoc': 'grunt-jsdoc'
			}
		},

		data: gruntData

	});

};


text:
package io.quantumdb.cli.xml;

import static com.google.common.base.Preconditions.checkArgument;

import java.util.Optional;

import io.quantumdb.core.schema.definitions.Column.Hint;
import io.quantumdb.core.schema.definitions.PostgresTypes;
import io.quantumdb.core.schema.operations.AlterColumn;
import io.quantumdb.core.schema.operations.SchemaOperations;
import lombok.Data;

@Data
public class XmlAlterColumn implements XmlOperation<AlterColumn> {

	static final String TAG = "alterColumn";

	static XmlOperation convert(XmlElement element) {
		checkArgument(element.getTag().equals(TAG));

		XmlAlterColumn operation = new XmlAlterColumn();
		operation.setTableName(element.getAttributes().remove("tableName"));
		operation.setColumnName(element.getAttributes().remove("columnName"));

		Optional.ofNullable(element.getAttributes().remove("newColumnName"))
				.ifPresent(operation::setNewColumnName);

		Optional.ofNullable(element.getAttributes().remove("newDataType"))
				.ifPresent(operation::setNewType);

		Optional.ofNullable(element.getAttributes().remove("nullable"))
				.map(Boolean.TRUE.toString()::equals)
				.ifPresent(operation::setNullable);

		if (!element.getAttributes().keySet().isEmpty()) {
			throw new IllegalArgumentException("Attributes: " + element.getAttributes().keySet() + " is/are not valid!");
		}

		return operation;
	}

	private String tableName;
	private String columnName;

	private String newColumnName;
	private String newType;
	private Boolean nullable;

	@Override
	public AlterColumn toOperation() {
		AlterColumn operation = SchemaOperations.alterColumn(tableName, columnName);
		Optional.ofNullable(newColumnName).ifPresent(operation::rename);
		Optional.ofNullable(newType).map(PostgresTypes::from).ifPresent(operation::modifyDataType);

		Optional.ofNullable(nullable).ifPresent(newNullable -> {
			if (newNullable) {
				operation.dropHint(Hint.NOT_NULL);
			}
			else {
				operation.addHint(Hint.NOT_NULL);
			}
		});

		// TODO: Support other hints?

		return operation;
	}

}


text:
using namespace swift;

SILGlobalVariable *SILGlobalVariable::create(SILModule &M, SILLinkage linkage,
                                             bool IsFragile,
                                             StringRef name,
                                             SILType loweredType,
                                             Optional<SILLocation> loc,
                                             VarDecl *Decl) {
  // Get a StringMapEntry for the variable.  As a sop to error cases,
  // allow the name to have an empty string.
  llvm::StringMapEntry<SILGlobalVariable*> *entry = nullptr;
  if (!name.empty()) {
    entry = &*M.GlobalVariableTable.insert(std::make_pair(name, nullptr)).first;
    assert(!entry->getValue() && "global variable already exists");
    name = entry->getKey();
  }

  auto var = new (M) SILGlobalVariable(M, linkage, IsFragile, name,
                                       loweredType, loc, Decl);

  if (entry) entry->setValue(var);
  return var;
}

SILGlobalVariable::SILGlobalVariable(SILModule &Module, SILLinkage Linkage,
                                     bool IsFragile,
                                     StringRef Name, SILType LoweredType,
                                     Optional<SILLocation> Loc, VarDecl *Decl)
  : Module(Module),
    Name(Name),
    LoweredType(LoweredType),
    Location(Loc),
    Linkage(unsigned(Linkage)),
    Fragile(IsFragile),
	VDecl(Decl) {
  IsDeclaration = isAvailableExternally(Linkage);
  setLet(Decl ? Decl->isLet() : false);
  InitializerF = nullptr;
  Module.silGlobals.push_back(this);
}

void SILGlobalVariable::setInitializer(SILFunction *InitF) {
  if (InitializerF)
    InitializerF->decrementRefCount();
  // Increment the ref count to make sure it will not be eliminated.
  InitF->incrementRefCount();
  InitializerF = InitF;
}

SILGlobalVariable::~SILGlobalVariable() {
  getModule().GlobalVariableTable.erase(Name);
}

// FIXME

static bool analyzeStaticInitializer(SILFunction *F, SILInstruction *&Val,
                                     SILGlobalVariable *&GVar) {
  Val = nullptr;
  GVar = nullptr;
  // We only handle a single SILBasicBlock for now.
  if (F->size() != 1)
    return false;

  SILBasicBlock *BB = &F->front();
  GlobalAddrInst *SGA = nullptr;
  bool HasStore = false;
  for (auto &I : *BB) {
    // Make sure we have a single GlobalAddrInst and a single StoreInst.
    // And the StoreInst writes to the GlobalAddrInst.
    if (isa<AllocGlobalInst>(&I)) {
      continue;
    } else if (auto *sga = dyn_cast<GlobalAddrInst>(&I)) {
      if (SGA)
        return false;
      SGA = sga;
      GVar = SGA->getReferencedGlobal();
    } else if (auto *SI = dyn_cast<StoreInst>(&I)) {
      if (HasStore || SI->getDest().getDef() != SGA)
        return false;
      HasStore = true;
      Val = dyn_cast<SILInstruction>(SI->getSrc().getDef());

      // We only handle StructInst and TupleInst being stored to a
      // global variable for now.
      if (!isa<StructInst>(Val) && !isa<TupleInst>(Val))
        return false;
    } else {

      if (auto *bi = dyn_cast<BuiltinInst>(&I)) {
        switch (bi->getBuiltinInfo().ID) {
        case BuiltinValueKind::FPTrunc:
          if (isa<LiteralInst>(bi->getArguments()[0]))
            continue;
          break;
        default:
          return false;
        }
      }

      if (I.getKind() != ValueKind::ReturnInst &&
          I.getKind() != ValueKind::StructInst &&
          I.getKind() != ValueKind::TupleInst &&
          I.getKind() != ValueKind::IntegerLiteralInst &&
          I.getKind() != ValueKind::FloatLiteralInst &&
          I.getKind() != ValueKind::StringLiteralInst)
        return false;
    }
  }
  return true;
}

bool SILGlobalVariable::canBeStaticInitializer(SILFunction *F) {
  SILInstruction *dummySI;
  SILGlobalVariable *dummyGV;
  return analyzeStaticInitializer(F, dummySI, dummyGV);
}

/// Check if a given SILFunction can be a static initializer. If yes, return
/// the SILGlobalVariable that it writes to.
SILGlobalVariable *SILGlobalVariable::getVariableOfStaticInitializer(
                     SILFunction *F) {
  SILInstruction *dummySI;
  SILGlobalVariable *GV;
  if(analyzeStaticInitializer(F, dummySI, GV))
    return GV;
  return nullptr;
}

/// Return the value that is written into the global variable.
SILInstruction *SILGlobalVariable::getValueOfStaticInitializer() {
  if (!InitializerF)
    return nullptr;

  SILInstruction *SI;
  SILGlobalVariable *dummyGV;
  if(analyzeStaticInitializer(InitializerF, SI, dummyGV))
    return SI;
  return nullptr;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/tv_longclick_set_delete"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:background="@drawable/bottom_bar"
        android:text="  点击删除   "
        android:textColor="#ffffff"
        android:textSize="15sp"
        android:gravity="center_vertical"
        />

</LinearLayout>


text:
import valueParser from "postcss-value-parser"

import {
  declarationValueIndexOffset,
  report,
  ruleMessages,
  validateOptions,
} from "../../utils"
import representations from "./representations"

export const ruleName = "color-named"

export const messages = ruleMessages(ruleName, {
  expected: (named, original) => (
    `Expected "${original}" to be "${named}"`
  ),
  rejected: (named) => (
    `Unexpected named color "${named}"`
  ),
})

const FUNC_REPRESENTATION = [ "rgb", "rgba", "hsl", "hsla", "hwb", "gray" ]
const NODE_TYPES = [ "word", "function" ]

export default function (expectation) {
  return (root, result) => {
    const validOptions = validateOptions(result, ruleName, {
      actual: expectation,
      possible: [
        "never",
        "always-where-possible",
      ],
    })
    if (!validOptions) { return }

    const namedColors = Object.keys(representations)

    root.walkDecls(decl => {
      valueParser(decl.value).walk(node => {
        const { value, type, sourceIndex } = node

        // Return early if neither a word nor a function
        if (NODE_TYPES.indexOf(type) === -1) { return }

        // Check for named colors for "never" option
        if (
          expectation === "never" &&
          type === "word" &&
          namedColors.indexOf(value) !== -1
        ) {
          complain(
            messages.rejected(value),
            decl,
            declarationValueIndexOffset(decl) + sourceIndex
          )
        }
        // Check "always-where-possible" option
        if (expectation === "always-where-possible") {
          // First by checking for alternative color function representations
          if (
            type === "function" &&
            FUNC_REPRESENTATION.indexOf(value) !== -1
          ) {
            const cssString = valueParser.stringify(node).replace(/\s+/g, "")
            namedColors.forEach(namedColor => {
              if (representations[namedColor].func.indexOf(cssString) !== -1) {
                complain(
                  messages.expected(namedColor, cssString),
                  decl,
                  declarationValueIndexOffset(decl) + sourceIndex
                )
              }
            })
          // Then by checking for alternative hex representations
          } else {
            namedColors.forEach(namedColor => {
              if (representations[namedColor].hex.indexOf(value) !== -1) {
                complain(
                  messages.expected(namedColor, value),
                  decl,
                  declarationValueIndexOffset(decl) + sourceIndex
                )
              }
            })
          }
        }
      })
    })

    function complain(message, node, index) {
      report({
        result,
        ruleName,
        message,
        node,
        index,
      })
    }
  }
}


text:
import { Component, OnInit } from '@angular/core';
import { RimaAAAService } from '@colabo-rima/f-aaa/rima-aaa.service';
import {KNode} from '@colabo-knalledge/f-core/code/knalledge/kNode';
//import { OrderPipe } from 'ngx-order-pipe';
// import { Pipe, PipeTransform } from '@angular/core';
import { OrderPipe } from 'ngx-order-pipe'; //https://github.com/VadimDez/ngx-order-pipe
// const MAP_ID = "5b8a5260f8b8e40f3f250f9d"; //TEF
const MAP_ID = "5b49e7f736390f03580ac9a7"; //Forum Vlasina

@Component({
  selector: 'registered-users',
  templateUrl: './registered-users.component.html',
  styleUrls: ['./registered-users.component.css']
})
export class RegisteredUsersComponent implements OnInit {

  //users:KNode[];
  users:any[] = []; //[{name:'tes1'},{name:'tes2'},{name:'tes3'}];

  constructor(
    private rimaAAAService: RimaAAAService
  ) {
  }

  ngOnInit() {
    this.rimaAAAService.getRegisteredUsers(MAP_ID).subscribe(this.usersReceived.bind(this));
  }

  private usersReceived(users:any[]):void{
    //console.log('usersReceived', users);
    this.users = users;
  }

}


text:
import time
import threading
import StringIO
import datetime
import pygame
import urllib2
from pygame.locals import *

import pygamehelper
import twitter

pygame.init()

screen = pygame.display.set_mode((640,480),pygame.FULLSCREEN|pygame.HWSURFACE|pygame.DOUBLEBUF)

pygame.mouse.set_visible(False)

clock = pygame.time.Clock()
frame_rate = 30

background = pygame.image.load("background.png")
character = pygame.image.load("character.png")
font = pygame.font.Font("HuiFontP29.ttf", 28)
clock_font = pygame.font.Font("VL-PGothic-Regular.ttf", 24)
fps_font = pygame.font.Font("VL-PGothic-Regular.ttf", 12)
header_bk = pygame.Surface((450,24), pygame.SRCALPHA,32)
for i in range(0,24):
	pygame.draw.line(header_bk, (178,155,172,128-i*5), (0,i),(450,i))

if pygame.joystick.get_count() > 0:
	pygame.joystick.Joystick(0).init()

offset = 0
scrolling_images = []
lock = threading.Lock()

image_cache = {}

turbo_mode = 0

dow = [u"月",u"火",u"水",u"木",u"金",u"土",u"日"]

def process_event(event = None):
	if event == None:
		events = pygame.event.get()
		if events != None:
			for event in events:
				ret = process_event(event)
				if ret == False: return False
		return True

	global turbo_mode

	if event.type == pygame.QUIT: return False

	if event.type == pygame.locals.JOYBUTTONDOWN and event.button == 1:
		return False
	elif event.type == pygame.locals.KEYDOWN and event.key == pygame.locals.K_ESCAPE:
		return False
	elif event.type == pygame.locals.JOYBUTTONDOWN and event.button == 0:
		turbo_mode += 1
	elif event.type == pygame.locals.KEYDOWN and event.key == pygame.locals.K_RETURN:
		turbo_mode += 1
	elif event.type == pygame.locals.JOYBUTTONUP and event.button == 0 and turbo_mode > 0:
		turbo_mode -= 1
	elif event.type == pygame.locals.KEYUP and event.key == pygame.locals.K_RETURN and turbo_mode > 0:
		turbo_mode -= 1

	return True

def get_total_scrolling_images_height(scrolling_images):
	height = 0
	for si in scrolling_images:
		height += si["img"].get_height()
	return height

def draw_clock(surface):
	d = datetime.datetime.today()
	date = clock_font.render(u"%d月%d日(%s)" % (d.month,d.day,dow[d.weekday()]), True, (0,0,0))
	time = clock_font.render("%02d:%02d:%02d" % (d.hour,d.minute,d.second), True, (0,0,0))

	surface.blit(date, (450 + (190 - date.get_width()) / 2, 20))
	surface.blit(time, (450 + (190 - time.get_width()) / 2, 50))

def draw_frame():
	global offset, turbo_mode
	screen.blit(background, (0,0))

	draw_clock(screen)

	lock.acquire()
	try:
		if scrolling_images == None or len(scrolling_images) == 0: return
		top = 480 - offset
		i = 0
		len_si = len(scrolling_images)
		while top < 480 and len_si > i:
			img = scrolling_images[i]["img"]
			screen.blit(img, (10, top))
			top += img.get_height()
			i += 1

		if i - 1 < len_si:
			# スクロール量を計算する
			ts = get_average_time_span(scrolling_images)
			height = get_total_scrolling_images_height(scrolling_images)
			y1 = height / len(scrolling_images)
			if ts > 0 and turbo_mode == 0:
				doffset = max(1, y1 / ts / clock.get_fps())
			else:
				doffset = 10

			offset += doffset
			if offset > height: offset = height
			while offset > 480 + scrolling_images[0]["img"].get_height():
				offset -= scrolling_images[0]["img"].get_height()
				del scrolling_images[0]
	finally:
		lock.release()
		screen.blit(character, (screen.get_width() - character.get_width(), screen.get_height() - character.get_height()))
		screen.blit(fps_font.render("%dfps" % clock.get_fps(), True, (0,0,0)), (600,460))
		pygame.display.update()

def render_entry(entry):
	user_image = None
	image = entry["image"]
	if image in image_cache: user_image = image_cache[image]["image"]
	else:
		try:
			user_image = pygame.image.load(StringIO.StringIO(urllib2.urlopen(image).read())).convert_alpha()
		except:
			user_image =  pygame.Surface((48, 48))
		user_image_size = max(user_image.get_width(), user_image.get_height())
		if user_image_size > 48:
			user_image = pygame.transform.rotozoom(user_image, 0, 48 / user_image_size)
		#image_cache[image] = {"image":user_image}

	name = font.render("%s(%s)" % (entry["userid"],entry["username"]), True, (0,0,0))
	text = pygamehelper.render_font_with_wordwrap(font, 450, entry["title"], (0,0,0))

	img = pygame.Surface((450, user_image.get_height() + text.get_height() + 10),pygame.SRCALPHA, 32)
	img.blit(header_bk, (0,0))
	img.blit(user_image, (0,0))
	img.blit(name, (user_image.get_width() + 3, (user_image.get_height() - name.get_height()) / 2))
	img.blit(text, (0, user_image.get_height()))

	return img

def get_average_time_span(scrolling_images):
	if len(scrolling_images) < 2: return None
	t = scrolling_images[0]["time"]
	sum = 0
	for si in scrolling_images[1:]:
		time = si["time"]
		sum += time - t
		t = time
	return sum / (len(scrolling_images) - 1)

def read_twitter(keyword):
	latest_id = 1
	while scrolling_images != None:
		try:
			entries = twitter.search(keyword, latest_id)
			#entries = twitter.list("shimariso", "subcul", latest_id)
			entries.reverse()
			for entry in entries:
				img = render_entry(entry)
				if img != None:
					lock.acquire()
					scrolling_images.append({"time":entry["time"],"img":img})
					lock.release()
				if latest_id < entry["id"]: latest_id = entry["id"]
		except Exception, e:
			print "Exception(%s)" % (e)

		lock.acquire()
		ts = get_average_time_span(scrolling_images)
		if ts == None: ts = 1
		#print "Number of buffered tweets = %d, avg=%d" % (len(scrolling_images), ts)
		lock.release()

		time.sleep(min(30,max(3,ts)))

if __name__ == "__main__":
	thr = threading.Thread(target=read_twitter, args=(u"#followmejp",))
	thr.start()

	while True:
		clock.tick(frame_rate)
		if not process_event():
			pygame.quit()
			break
		draw_frame()

	scrolling_images = None

	exit(0)


text:
cd ./Tutorials

for f in TutorialMauxArConnector TutorialMauxConnector
do
	echo
	echo Build $f
	cd ${f}
	pwd
	mvn clean:clean
	cd ..
done

for f in TutorialLightController/SharedLightController TutorialLightController/LightController TutorialLightController/RemoteLightController TutorialMauxIotRestServer
do
	echo
	echo Build $f
	cd ${f}
	pwd
	mvn clean:clean
	cd ../..
done

cd ..


text:
from __future__ import unicode_literals

from django.db import migrations

class Migration(migrations.Migration):

    # skip non-exixtent 0003_planschedule
    dependencies = [("plan", "0002_plan_devhub")]

    operations = [migrations.RemoveField(model_name="plan", name="devhub")]


text:
package com.xyz.task.business.util;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.StandardHttpRequestRetryHandler;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;

/**
 * http工具类.
 *
 * @author lee
 * @since 2016年5月20日
 */
public final class HttpUtils {

  private static final Logger logger = org.slf4j.LoggerFactory.getLogger(HttpUtils.class);

  /**
   * POST请求.
   *
   * @param uri
   *          请求地址
   * @param data
   *          请求数据
   * @param timeout
   *          超时时间(默认5秒)
   * @param retryCount
   *          错误时重试次数(默认3次)
   * @return 请求结果
   * @throws IOException
   *           IOException
   * @throws ClientProtocolException
   *           ClientProtocolException
   */
  public static String post(final String uri, Map<String, String> data, int timeout, int retryCount)
      throws ClientProtocolException, IOException {
    CloseableHttpClient client = null;
    HttpPost post = new HttpPost(uri);
    if (data != null) {
      post.setEntity(getFormData(data));
    }

    StandardHttpRequestRetryHandler retryHandler = new StandardHttpRequestRetryHandler(retryCount, false);
    RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectionRequestTimeout(timeout).build();

    client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).setRetryHandler(retryHandler).build();

    HttpResponse response = client.execute(post);
    int statusCode = response.getStatusLine().getStatusCode();
    logger.debug("statusCode:{}", statusCode);
    String result = EntityUtils.toString(response.getEntity());
    logger.debug("result:{}", result);
    return result;
  }

  /**
   * POST请求.
   *
   * @param uri
   *          请求地址
   * @param data
   *          请求数据
   * @throws IOException
   *           IOException
   * @throws ClientProtocolException
   *           ClientProtocolException
   */
  public static String post(final String uri, Map<String, String> data) throws ClientProtocolException, IOException {
    return post(uri, data, 10000, 3);
  }

  /**
   * POST请求.
   *
   * @param uri
   *          请求地址
   * @param data
   *          请求数据
   * @param retryCount
   *          重试次数
   * @throws IOException
   *           IOException
   * @throws ClientProtocolException
   *           ClientProtocolException
   */
  public static String post(final String uri, Map<String, String> data, int retryCount) throws ClientProtocolException, IOException {
    return post(uri, data, 10000, retryCount);
  }

  /**
   * 转换请求参数.
   *
   * @param dataMap
   *          map类型参数
   * @return 表单参数实体
   */
  private static UrlEncodedFormEntity getFormData(Map<String, String> dataMap) {
    try {
      List<BasicNameValuePair> data = new ArrayList<>();
      Iterator<String> keys = dataMap.keySet().iterator();
      while (keys.hasNext()) {
        String key = keys.next();
        data.add(new BasicNameValuePair(key, dataMap.get(key)));
      }
      UrlEncodedFormEntity uefEntity = new UrlEncodedFormEntity(data);
      return uefEntity;
    } catch (Exception err) {
      logger.error("获取参数异常{}", err);
    }
    return null;
  }

}


text:
describe('basic behavior tests', function () {
    it('should not be undefined', function () {
        expect(Abrest).to.not.be.undefined
    })
    it('should use defaults when no info is given', function () {
        var instance = new Abrest()
        expect(instance).to.not.be.undefined
        expect(instance.timeout).to.equal(1000)
        expect(instance.baseURL).to.equal('')
        expect(instance.defaultHeaders).to.be.an.object
        expect(instance.defaultData).to.be.an.object
    })
})


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             tools:context="me.rorschach.schoolcontacts.home.history.HistoryFragment">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv_history"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</FrameLayout>


text:
module UserDistribution
  class ConfigItem < ActiveRecord::Base
    has_paper_trail

    if respond_to?(:attr_accessible)
      attr_accessible :locale, :account_version, :categories
      attr_accessible :program, :program_id
    end

    belongs_to :program

    validates :locale, presence: true
    validates :account_version, presence: true
    validates :program, presence: true

    scope :with_locale, lambda { |locale| where(locale: locale) if locale.present? }

    def self.fetch_archive date, locale:nil
      datetime = date.end_of_day
      result = []

      existing_config_items = all.map { |config_item| config_item.version_at(datetime) }.compact

      existing_config_items_ids = existing_config_items.map(&:id)

      deleted_config_items_versions = PaperTrail::Version.where(item_type: "UserDistribution::ConfigItem").where.not(item_id: existing_config_items_ids).order(created_at: :desc)
      deleted_config_items_versions = deleted_config_items_versions.where_object(locale: locale) if locale.present?

      config_item_arhive_map = deleted_config_items_versions.map { |x| x.reify }.compact
      deleted_config_items = config_item_arhive_map.map { |x| x.version_at(datetime) }.uniq.compact

      deleted_config_items.reject! { |x| x.versions.empty? || x.versions.order(created_at: :desc).last.created_at.end_of_day < datetime }
      result = (existing_config_items + deleted_config_items).uniq.compact
    end

    def self.fetch_archive_v2 date, locale:nil
      datetime = date.end_of_day

      deleted_config_items_versions = PaperTrail::Version.where(item_type: "UserDistribution::ConfigItem").order(created_at: :desc)
      deleted_config_items_versions = deleted_config_items_versions.where_object(locale: locale) if locale.present?

      config_item_arhive_map = deleted_config_items_versions.map { |x| x.reify }.compact
      config_item_arhive_map.map { |x| x.version_at(datetime) }.uniq.compact
    end

  end
end


text:
package guitests;

import static org.junit.Assert.assertTrue;
import static seedu.cmdo.logic.commands.DoneCommand.MESSAGE_DONE_TASK_SUCCESS;

import java.util.ArrayList;

import org.junit.Test;

import edu.emory.mathcs.backport.java.util.Arrays;
import edu.emory.mathcs.backport.java.util.Collections;
import seedu.cmdo.testutil.ArraySorter;
import seedu.cmdo.testutil.TestTask;
import seedu.cmdo.testutil.TestUtil;

/*
 * @@author A0141128R
 */
public class DoneCommandTest extends ToDoListGuiTest {

    @Test
    public void done() {

        TestTask[] currentList = td.getTypicalTasks();
        //sort unsorted list
    	currentList = sortList(currentList);

        //done the first task in the list
        int targetIndex = 1;
        assertdoneSuccess(targetIndex, currentList);
        currentList = updateList(targetIndex, currentList);

        //done a task that is the last in the list
        targetIndex = currentList.length;
        assertdoneSuccess(targetIndex, currentList);
        currentList = updateList(targetIndex, currentList);

        //done task from the middle of the list
        targetIndex = currentList.length/2;
        assertdoneSuccess(targetIndex, currentList);
        currentList = updateList(targetIndex, currentList);

        //invalid index
        runDoneCommand(currentList.length + 1);
        assertResultMessage("The task index provided is invalid");

    }

    //run done command
    private void runDoneCommand(int targetIndex){
    	commandBox.runCommand("done " + targetIndex);
    }

    //update list
    private TestTask[] updateList(int targetIndex, TestTask... currentList){
    	return TestUtil.removeTaskFromList(currentList, targetIndex);
    }

    //confirm the list now contains all previous tasks except the deleted task
    private void compareList(TestTask[] expectedRemainder){
    	  assertTrue(taskListPanel.isListMatching(expectedRemainder));
    }

    //sort list
    private TestTask[] sortList(TestTask... RemainderList){
    	ArrayList<TestTask> list = new ArrayList<TestTask>(Arrays.asList(RemainderList));
    	Collections.sort(list);
    	return list.toArray(new TestTask[RemainderList.length]);
    }

    /**
     * Runs the done command to change the task done status at specified index and confirms the result is correct.
     * @param targetIndexOneIndexed e.g. to done the first task in the list, 1 should be given as the target index.
     * @param currentList A copy of the current list of tasks (before done).
     */
    private void assertdoneSuccess(int targetIndexOneIndexed, final TestTask[] currentList) {
        TestTask taskToDone = currentList[targetIndexOneIndexed-1]; //-1 because array uses zero indexing

        runDoneCommand(targetIndexOneIndexed);

        TestTask[] expectedRemainder = updateList(targetIndexOneIndexed, currentList);

        //sort list
        expectedRemainder = sortList(expectedRemainder);

        //confirm the list now contains all previous tasks except the done task
        compareList(ArraySorter.sortTestTasks(expectedRemainder));

        //confirm the result message is correct
        assertResultMessage(String.format(MESSAGE_DONE_TASK_SUCCESS, taskToDone));
    }

}


text:
package org.apache.tinkerpop.gremlin.process.traversal.util;

import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.DefaultTraverserGeneratorFactory;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class DefaultTraversal<S, E> implements Traversal.Admin<S, E> {

    private E lastEnd = null;
    private long lastEndCount = 0l;
    private Step<?, E> finalEndStep = EmptyStep.instance();
    private final StepPosition stepPosition = new StepPosition();
    protected transient Graph graph;
    protected List<Step> steps = new ArrayList<>();
    // steps will be repeatedly retrieved from this traversal so wrap them once in an immutable list that can be reused
    protected List<Step> unmodifiableSteps = Collections.unmodifiableList(steps);
    protected TraversalParent parent = EmptyStep.instance();
    protected TraversalSideEffects sideEffects = new DefaultTraversalSideEffects();
    protected TraversalStrategies strategies;
    protected transient TraverserGenerator generator;
    protected Set<TraverserRequirement> requirements;
    protected boolean locked = false;

    public DefaultTraversal() {
        this.graph = null;
        // necessary for anonymous traversals without a graph start (rethink how this works in the future)
        this.setStrategies(TraversalStrategies.GlobalCache.getStrategies(EmptyGraph.class));
    }

    public DefaultTraversal(final Graph graph) {
        this.graph = graph;
        this.setStrategies(TraversalStrategies.GlobalCache.getStrategies(this.graph.getClass()));
    }

    @Override
    public Traversal.Admin<S, E> asAdmin() {
        return this;
    }

    @Override
    public TraverserGenerator getTraverserGenerator() {
        if (null == this.generator)
            this.generator = (this.parent instanceof EmptyStep) ?
                    DefaultTraverserGeneratorFactory.instance().getTraverserGenerator(this.getTraverserRequirements()) :
                    TraversalHelper.getRootTraversal(this).getTraverserGenerator();
        return this.generator;
    }

    @Override
    public void applyStrategies() throws IllegalStateException {
        if (this.locked) throw Traversal.Exceptions.traversalIsLocked();
        TraversalHelper.reIdSteps(this.stepPosition, this);
        this.strategies.applyStrategies(this);
        boolean hasGraph = null != this.graph;
        for (final Step<?, ?> step : this.getSteps()) {
            if (step instanceof TraversalParent) {
                for (final Traversal.Admin<?, ?> globalChild : ((TraversalParent) step).getGlobalChildren()) {
                    globalChild.setStrategies(this.strategies);
                    globalChild.setSideEffects(this.sideEffects);
                    if (hasGraph) globalChild.setGraph(this.graph);
                    globalChild.applyStrategies();
                }
                for (final Traversal.Admin<?, ?> localChild : ((TraversalParent) step).getLocalChildren()) {
                    localChild.setStrategies(this.strategies);
                    localChild.setSideEffects(this.sideEffects);
                    if (hasGraph) localChild.setGraph(this.graph);
                    localChild.applyStrategies();
                }
            }
        }
        this.finalEndStep = this.getEndStep();
        this.locked = true;
    }

    @Override
    public Set<TraverserRequirement> getTraverserRequirements() {
        if (null == this.requirements) {
            // if (!this.locked) this.applyStrategies();
            this.requirements = new HashSet<>();
            for (Step<?, ?> step : this.getSteps()) {
                this.requirements.addAll(step.getRequirements());
            }
            if (!this.getSideEffects().keys().isEmpty())
                this.requirements.add(TraverserRequirement.SIDE_EFFECTS);
            if (null != this.getSideEffects().getSackInitialValue())
                this.requirements.add(TraverserRequirement.SACK);
            if (this.requirements.contains(TraverserRequirement.ONE_BULK))
                this.requirements.remove(TraverserRequirement.BULK);
            this.requirements = Collections.unmodifiableSet(this.requirements);
        }
        return this.requirements;
    }

    @Override
    public List<Step> getSteps() {
        return unmodifiableSteps;
    }

    @Override
    public boolean hasNext() {
        if (!this.locked) this.applyStrategies();
        return this.lastEndCount > 0l || this.finalEndStep.hasNext();
    }

    @Override
    public E next() {
        if (!this.locked) this.applyStrategies();
        if (this.lastEndCount > 0l) {
            this.lastEndCount--;
            return this.lastEnd;
        } else {
            final Traverser<E> next = this.finalEndStep.next();
            final long nextBulk = next.bulk();
            if (nextBulk == 1) {
                return next.get();
            } else {
                this.lastEndCount = nextBulk - 1;
                this.lastEnd = next.get();
                return this.lastEnd;
            }
        }
    }

    @Override
    public void reset() {
        this.steps.forEach(Step::reset);
        this.lastEndCount = 0l;
    }

    @Override
    public void addStart(final Traverser<S> start) {
        if (!this.locked) this.applyStrategies();
        if (!this.steps.isEmpty()) this.steps.get(0).addStart(start);
    }

    @Override
    public void addStarts(final Iterator<Traverser<S>> starts) {
        if (!this.locked) this.applyStrategies();
        if (!this.steps.isEmpty()) this.steps.get(0).addStarts(starts);
    }

    @Override
    public String toString() {
        return StringFactory.traversalString(this);
    }

    @Override
    public Step<S, ?> getStartStep() {
        return this.steps.isEmpty() ? EmptyStep.instance() : this.steps.get(0);
    }

    @Override
    public Step<?, E> getEndStep() {
        return this.steps.isEmpty() ? EmptyStep.instance() : this.steps.get(this.steps.size() - 1);
    }

    @Override
    public DefaultTraversal<S, E> clone() {
        try {
            final DefaultTraversal<S, E> clone = (DefaultTraversal<S, E>) super.clone();
            clone.steps = new ArrayList<>();
            clone.unmodifiableSteps = Collections.unmodifiableList(clone.steps);
            clone.sideEffects = this.sideEffects.clone();
            clone.strategies = this.strategies;
            clone.lastEnd = null;
            clone.lastEndCount = 0l;
            for (final Step<?, ?> step : this.steps) {
                final Step<?, ?> clonedStep = step.clone();
                clonedStep.setTraversal(clone);
                final Step previousStep = clone.steps.isEmpty() ? EmptyStep.instance() : clone.steps.get(clone.steps.size() - 1);
                clonedStep.setPreviousStep(previousStep);
                previousStep.setNextStep(clonedStep);
                clone.steps.add(clonedStep);
            }
            clone.finalEndStep = clone.getEndStep();
            return clone;
        } catch (final CloneNotSupportedException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }

    @Override
    public boolean isLocked() {
        return this.locked;
    }

    @Override
    public void setSideEffects(final TraversalSideEffects sideEffects) {
        this.sideEffects = sideEffects;
    }

    @Override
    public TraversalSideEffects getSideEffects() {
        return this.sideEffects;
    }

    @Override
    public void setStrategies(final TraversalStrategies strategies) {
        this.strategies = strategies;
    }

    @Override
    public TraversalStrategies getStrategies() {
        return this.strategies;
    }

    @Override
    public <S2, E2> Traversal.Admin<S2, E2> addStep(final int index, final Step<?, ?> step) throws IllegalStateException {
        if (this.locked) throw Exceptions.traversalIsLocked();
        step.setId(this.stepPosition.nextXId());
        this.steps.add(index, step);
        final Step previousStep = this.steps.size() > 0 && index != 0 ? steps.get(index - 1) : null;
        final Step nextStep = this.steps.size() > index + 1 ? steps.get(index + 1) : null;
        step.setPreviousStep(null != previousStep ? previousStep : EmptyStep.instance());
        step.setNextStep(null != nextStep ? nextStep : EmptyStep.instance());
        if (null != previousStep) previousStep.setNextStep(step);
        if (null != nextStep) nextStep.setPreviousStep(step);
        step.setTraversal(this);
        return (Traversal.Admin<S2, E2>) this;
    }

    @Override
    public <S2, E2> Traversal.Admin<S2, E2> removeStep(final int index) throws IllegalStateException {
        if (this.locked) throw Exceptions.traversalIsLocked();
        final Step previousStep = this.steps.size() > 0 && index != 0 ? steps.get(index - 1) : null;
        final Step nextStep = this.steps.size() > index + 1 ? steps.get(index + 1) : null;
        //this.steps.get(index).setTraversal(EmptyTraversal.instance());
        this.steps.remove(index);
        if (null != previousStep) previousStep.setNextStep(null == nextStep ? EmptyStep.instance() : nextStep);
        if (null != nextStep) nextStep.setPreviousStep(null == previousStep ? EmptyStep.instance() : previousStep);
        return (Traversal.Admin<S2, E2>) this;
    }

    @Override
    public void setParent(final TraversalParent step) {
        this.parent = step;
    }

    @Override
    public TraversalParent getParent() {
        return this.parent;
    }

    @Override
    public Optional<Graph> getGraph() {
        return Optional.ofNullable(this.graph);
    }

    @Override
    public void setGraph(final Graph graph) {
        this.graph = graph;
    }

    @Override
    public boolean equals(final Object other) {
        return other != null && other.getClass().equals(this.getClass()) && this.asAdmin().equals(((Traversal.Admin) other));
    }

    @Override
    public int hashCode() {
        int result = this.getClass().hashCode();
        for (final Step step : this.asAdmin().getSteps()) {
            result ^= step.hashCode();
        }
        return result;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/ic_pause_24dp">

    <target
        android:name="@string/pause"
        android:animation="@animator/pause_to_play" />

</animated-vector>


text:
alg1 package
============

Subpackages
-----------

.. toctree::

    alg1.misc

.. inheritance-diagram::
   :parts: 1

Submodules
----------

alg1\.Alg1\_Core module
-----------------------

.. automodule:: alg1.Alg1_Core
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.Alg1\_Helper module
-------------------------

.. automodule:: alg1.Alg1_Helper
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.AntiAffinityManager module
--------------------------------

.. automodule:: alg1.AntiAffinityManager
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.BacktrackHandler module
-----------------------------

.. automodule:: alg1.BacktrackHandler
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.BacktrackRecords module
-----------------------------

.. automodule:: alg1.BacktrackRecords
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.GraphPreprocessor module
------------------------------

.. automodule:: alg1.GraphPreprocessor
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.MappingAlgorithms module
------------------------------

.. automodule:: alg1.MappingAlgorithms
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.MappingManager module
---------------------------

.. automodule:: alg1.MappingManager
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.MappingState module
-------------------------

.. automodule:: alg1.MappingState
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.ServiceChains module
--------------------------

.. automodule:: alg1.ServiceChains
    :members:
    :undoc-members:
    :show-inheritance:

alg1\.UnifyExceptionTypes module
--------------------------------

.. automodule:: alg1.UnifyExceptionTypes
    :members:
    :undoc-members:
    :show-inheritance:

Module contents
---------------

.. automodule:: alg1
    :members:
    :undoc-members:
    :show-inheritance:


text:
<?php
/**
 * @Author: Dan Marinescu
 * @Date:   2015-03-21 04:05:25
 * @Last Modified by:   Dan Marinescu
 * @Last Modified time: 2015-03-21 14:24:51
 */

namespace Application\Utils\Form;

use Zend\Form\Form;

class FormLayer extends Form
{
    public function getMessages($elementName = null)
    {
        if (null === $elementName) {
            $messages = array();

            foreach ($this->byName as $name => $element) {

                $name = $element->getLabel() !== null ? $element->getLabel() : $name;

                $messageSet = $element->getMessages();
                if (!is_array($messageSet)
                    && !$messageSet instanceof Traversable
                    || empty($messageSet)) {
                    continue;
                }
                $messages[$name] = $messageSet;
            }
            return $messages;
        }

        if (!$this->has($elementName)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid element name "%s" provided to %s',
                $elementName,
                __METHOD__
            ));
        }

        $element = $this->get($elementName);
        return $element->getMessages();
    }

    /**
    * Disables all form elements except submit and the ones in the $elements array
    *
    * params array $elements | elements that will not be disabled
    */
    public function disableAll(array $elements = array())
    {
        if (sizeof($elements) > 0) {
            foreach ($this->byName as $name => $element) {
                if (!in_array($name, $elements)) {
                    $element->setAttribute('disabled', true);
                }
            }
        }
    }
}


text:
<map>
  <entry>
    <string>plugin_status</string>
    <string>ready</string>
  </entry>
  <entry>
    <string>plugin_identifier</string>
    <string>org.lockss.plugin.clockss.futureacademy.ClockssFutureAcademySourcePlugin</string>
  </entry>
  <entry>
    <string>plugin_version</string>
    <string>1</string>
  </entry>
  <entry>
    <string>plugin_feature_version_map</string>
    <map>
      <entry>
        <string>Metadata</string>
        <string>1</string>
      </entry>
      <entry>
        <string>Substance</string>
        <string>1</string>
      </entry>
    </map>
  </entry>
  <entry>
    <string>plugin_parent</string>
    <string>org.lockss.plugin.clockss.ClockssDirSourcePlugin</string>
  </entry>
  <entry>
    <string>plugin_parent_version</string>
    <string>1</string>
  </entry>
  <entry>
    <string>au_name</string>
    <string>"Future Academy Source Plugin (CLOCKSS), Base URL %s, Directory %s", base_url, directory</string>
  </entry>
  <entry>
    <string>plugin_name</string>
    <string>Future Academy Source Plugin (CLOCKSS)</string>
  </entry>
  <!--
  <entry>
    <string>plugin_archive_file_types</string>
    <string>standard</string>
  </entry>
  -->
  <entry>
    <string>au_substance_url_pattern</string>
    <list>
<!-- they switched from zip to unpacked during initial testing; might be temporary -->
<!--      <string>"^%s%s/.+\.zip", base_url, directory</string>-->
      <string>"^%s%s/.+\.pdf", base_url, directory</string>
    </list>
  </entry>
  <entry>

    <string>plugin_article_iterator_factory</string>
<!-- they switched from zip to unpacked during initial testing; might be temporary -->
<!--    <string>org.lockss.plugin.clockss.SourceZipXmlArticleIteratorFactory</string>-->
    <string>org.lockss.plugin.clockss.SourceXmlArticleIteratorFactory</string>
  </entry>
  <entry>
    <string>plugin_article_metadata_extractor_factory</string>
    <string>org.lockss.plugin.clockss.SourceZipXmlArticleIteratorFactory</string>
  </entry>
  <entry>
    <string>text/xml_metadata_extractor_factory_map</string>
    <map>
      <entry>
        <string>*</string>
        <string>org.lockss.plugin.clockss.futureacademy.FutureAcademyXmlMetadataExtractorFactory</string>
      </entry>
    </map>
  </entry>
    <entry>
    <string>application/xml_metadata_extractor_factory_map</string>
    <map>
      <entry>
        <string>*</string>
        <string>org.lockss.plugin.clockss.futureacademy.FutureAcademyXmlMetadataExtractorFactory</string>
      </entry>
    </map>
  </entry>
</map>


text:
<?php

namespace Oneup\UploaderBundle\Uploader\Orphanage;

use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\DependencyInjection\ContainerInterface;

class OrphanageManager
{
    protected $config;
    protected $container;

    public function __construct(ContainerInterface $container, array $config)
    {
        $this->container = $container;
        $this->config = $config;
    }

    public function get($key)
    {
        return $this->container->get(sprintf('oneup_uploader.orphanage.%s', $key));
    }

    public function clear()
    {
        // Really ugly solution to clearing the orphanage on gaufrette
        $class = $this->container->getParameter('oneup_uploader.orphanage.class');
        if ($class === 'Oneup\UploaderBundle\Uploader\Storage\GaufretteOrphanageStorage') {
            $chunkStorage = $this->container->get('oneup_uploader.chunks_storage ');
            $chunkStorage->clear($this->config['maxage'], $this->config['directory']);

            return;
        }
        $system = new Filesystem();
        $finder = new Finder();

        try {
            $finder->in($this->config['directory'])->date('<=' . -1 * (int) $this->config['maxage'] . 'seconds')->files();
        } catch (\InvalidArgumentException $e) {
            // the finder will throw an exception of type InvalidArgumentException
            // if the directory he should search in does not exist
            // in that case we don't have anything to clean
            return;
        }

        foreach ($finder as $file) {
            $system->remove($file);
        }
    }
}