text:
package com.fabahaba.jedipus.pool;

import com.fabahaba.jedipus.cluster.Node;

public interface PooledClientFactory<C> {

  Node getNode();

  PooledClient<C> createClient();

  void destroyClient(PooledClient<C> pooledClient);

  default boolean validateClient(final PooledClient<C> pooledClient) {
    return true;
  }

  default void activateClient(final PooledClient<C> pooledClient) {

  }

  default void passivateClient(final PooledClient<C> pooledClient) {

  }
}


text:
package com.levelup.java.util.stream;

import static java.util.stream.Collectors.toSet;
import static org.junit.Assert.assertTrue;

import java.util.Set;
import java.util.stream.Stream;

import org.junit.Test;

/**
 * This java example will demonstrate how to convert a stream to a set.
 *
 * @author Justin Musgrove
 * @see
 */
public class ConvertStreamToSet {

	@Test
	public void stream_to_set() {

		Set<Integer> numbers = Stream.of(1, 2, 3)
				.collect(toSet());

		assertTrue(numbers.size() == 3);
	}

}

redpajama_set_name: RedPajamaGithub


text:
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { later, cancel } from '@ember/runloop';

export default class extends Controller {
  notifications = [
    { text: 'Edward' },
    { text: 'Jonathan' },
    { text: 'Tom' },
    { text: 'Eric' },
  ];

  // Actions
  prevent(e) {
    return e.stopImmediatePropagation();
  }

  @action
  open(dropdown) {
    if (this.closeTimer) {
      cancel(this.closeTimer);
      this.closeTimer = null;
    } else {
      dropdown.actions.open();
    }
  }

  @action
  closeLater(dropdown) {
    this.closeTimer = later(() => {
      this.closeTimer = null;
      dropdown.actions.close();
    }, 200);
  }
}


text:
/**
 * @fileoverview Generating PHP for variable blocks.
 */
'use strict';

goog.module('Blockly.PHP.variables');

const {NameType} = goog.require('Blockly.Names');
const {phpGenerator: PHP} = goog.require('Blockly.PHP');

PHP['variables_get'] = function(block) {
  // Variable getter.
  const code =
      PHP.nameDB_.getName(block.getFieldValue('VAR'), NameType.VARIABLE);
  return [code, PHP.ORDER_ATOMIC];
};

PHP['variables_set'] = function(block) {
  // Variable setter.
  const argument0 =
      PHP.valueToCode(block, 'VALUE', PHP.ORDER_ASSIGNMENT) || '0';
  const varName =
      PHP.nameDB_.getName(block.getFieldValue('VAR'), NameType.VARIABLE);
  return varName + ' = ' + argument0 + ';\n';
};


text:
/*************************************************************************/
/*  os_unix.cpp                                                          */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/
#include "os_unix.h"

#ifdef UNIX_ENABLED

#include "servers/visual_server.h"

#include "core/os/thread_dummy.h"
#include "mutex_posix.h"
#include "rw_lock_posix.h"
#include "semaphore_posix.h"
#include "thread_posix.h"

//#include "core/io/file_access_buffered_fa.h"
#include "dir_access_unix.h"
#include "file_access_unix.h"
#include "packet_peer_udp_posix.h"
#include "stream_peer_tcp_posix.h"
#include "tcp_server_posix.h"

#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif

#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/param.h>
#endif
#include "project_settings.h"
#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
#include <poll.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <unistd.h>

void OS_Unix::debug_break() {

	assert(false);
};

int OS_Unix::get_audio_driver_count() const {

	return 1;
}
const char *OS_Unix::get_audio_driver_name(int p_driver) const {

	return "dummy";
}

int OS_Unix::unix_initialize_audio(int p_audio_driver) {

	return 0;
}

// Very simple signal handler to reap processes where ::execute was called with
// !p_blocking
void handle_sigchld(int sig) {
	int saved_errno = errno;
	while (waitpid((pid_t)(-1), 0, WNOHANG) > 0) {
	}
	errno = saved_errno;
}

void OS_Unix::initialize_core() {

#ifdef NO_PTHREADS
	ThreadDummy::make_default();
	SemaphoreDummy::make_default();
	MutexDummy::make_default();
#else
	ThreadPosix::make_default();
	SemaphorePosix::make_default();
	MutexPosix::make_default();
	RWLockPosix::make_default();
#endif
	FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
	FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
	FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
	//FileAccessBufferedFA<FileAccessUnix>::make_default();
	DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_RESOURCES);
	DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_USERDATA);
	DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_FILESYSTEM);

#ifndef NO_NETWORK
	TCPServerPosix::make_default();
	StreamPeerTCPPosix::make_default();
	PacketPeerUDPPosix::make_default();
	IP_Unix::make_default();
#endif

	ticks_start = 0;
	ticks_start = get_ticks_usec();

	struct sigaction sa;
	sa.sa_handler = &handle_sigchld;
	sigemptyset(&sa.sa_mask);
	sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
	if (sigaction(SIGCHLD, &sa, 0) == -1) {
		perror("ERROR sigaction() failed:");
	}
}

void OS_Unix::initialize_logger() {
	Vector<Logger *> loggers;
	loggers.push_back(memnew(UnixTerminalLogger));
	// FIXME: Reenable once we figure out how to get this properly in user://
	// instead of littering the user's working dirs (res:// + pwd) with log files (GH-12277)
	//loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt")));
	_set_logger(memnew(CompositeLogger(loggers)));
}

void OS_Unix::finalize_core() {
}

void OS_Unix::alert(const String &p_alert, const String &p_title) {

	fprintf(stderr, "ERROR: %s\n", p_alert.utf8().get_data());
}

static int has_data(FILE *p_fd, int timeout_usec = 0) {

	fd_set readset;
	int fd = fileno(p_fd);
	FD_ZERO(&readset);
	FD_SET(fd, &readset);
	timeval time;
	time.tv_sec = 0;
	time.tv_usec = timeout_usec;
	int res = 0; //select(fd + 1, &readset, NULL, NULL, &time);
	return res > 0;
};

String OS_Unix::get_stdin_string(bool p_block) {

	String ret;
	if (p_block) {
		char buff[1024];
		ret = stdin_buf + fgets(buff, 1024, stdin);
		stdin_buf = "";
		return ret;
	};

	while (has_data(stdin)) {

		char ch;
		read(fileno(stdin), &ch, 1);
		if (ch == '\n') {
			ret = stdin_buf;
			stdin_buf = "";
			return ret;
		} else {
			char str[2] = { ch, 0 };
			stdin_buf += str;
		};
	};

	return "";
}

String OS_Unix::get_name() {

	return "Unix";
}

uint64_t OS_Unix::get_unix_time() const {

	return time(NULL);
};

uint64_t OS_Unix::get_system_time_secs() const {
	struct timeval tv_now;
	gettimeofday(&tv_now, NULL);
	//localtime(&tv_now.tv_usec);
	//localtime((const long *)&tv_now.tv_usec);
	return uint64_t(tv_now.tv_sec);
}

OS::Date OS_Unix::get_date(bool utc) const {

	time_t t = time(NULL);
	struct tm *lt;
	if (utc)
		lt = gmtime(&t);
	else
		lt = localtime(&t);
	Date ret;
	ret.year = 1900 + lt->tm_year;
	// Index starting at 1 to match OS_Unix::get_date
	//   and Windows SYSTEMTIME and tm_mon follows the typical structure
	//   of 0-11, noted here: http://www.cplusplus.com/reference/ctime/tm/
	ret.month = (Month)(lt->tm_mon + 1);
	ret.day = lt->tm_mday;
	ret.weekday = (Weekday)lt->tm_wday;
	ret.dst = lt->tm_isdst;

	return ret;
}

OS::Time OS_Unix::get_time(bool utc) const {
	time_t t = time(NULL);
	struct tm *lt;
	if (utc)
		lt = gmtime(&t);
	else
		lt = localtime(&t);
	Time ret;
	ret.hour = lt->tm_hour;
	ret.min = lt->tm_min;
	ret.sec = lt->tm_sec;
	get_time_zone_info();
	return ret;
}

OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
	time_t t = time(NULL);
	struct tm *lt = localtime(&t);
	char name[16];
	strftime(name, 16, "%Z", lt);
	name[15] = 0;
	TimeZoneInfo ret;
	ret.name = name;

	char bias_buf[16];
	strftime(bias_buf, 16, "%z", lt);
	int bias;
	bias_buf[15] = 0;
	sscanf(bias_buf, "%d", &bias);

	// convert from ISO 8601 (1 minute=1, 1 hour=100) to minutes
	int hour = (int)bias / 100;
	int minutes = bias % 100;
	if (bias < 0)
		ret.bias = hour * 60 - minutes;
	else
		ret.bias = hour * 60 + minutes;

	return ret;
}

void OS_Unix::delay_usec(uint32_t p_usec) const {

	struct timespec rem = { p_usec / 1000000, (p_usec % 1000000) * 1000 };
	while (nanosleep(&rem, &rem) == EINTR) {
	}
}
uint64_t OS_Unix::get_ticks_usec() const {

	struct timeval tv_now;
	gettimeofday(&tv_now, NULL);

	uint64_t longtime = (uint64_t)tv_now.tv_usec + (uint64_t)tv_now.tv_sec * 1000000L;
	longtime -= ticks_start;

	return longtime;
}

Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {

	if (p_blocking && r_pipe) {

		String argss;
		argss = "\"" + p_path + "\"";

		for (int i = 0; i < p_arguments.size(); i++) {

			argss += String(" \"") + p_arguments[i] + "\"";
		}

		if (read_stderr) {
			argss += " 2>&1"; // Read stderr too
		} else {
			argss += " 2>/dev/null"; //silence stderr
		}
		FILE *f = popen(argss.utf8().get_data(), "r");

		ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);

		char buf[65535];
		while (fgets(buf, 65535, f)) {

			(*r_pipe) += buf;
		}

		int rv = pclose(f);
		if (r_exitcode)
			*r_exitcode = rv;

		return OK;
	}

	pid_t pid = fork();
	ERR_FAIL_COND_V(pid < 0, ERR_CANT_FORK);

	if (pid == 0) {
		// is child
		Vector<CharString> cs;
		cs.push_back(p_path.utf8());
		for (int i = 0; i < p_arguments.size(); i++)
			cs.push_back(p_arguments[i].utf8());

		Vector<char *> args;
		for (int i = 0; i < cs.size(); i++)
			args.push_back((char *)cs[i].get_data()); // shitty C cast
		args.push_back(0);

#ifdef __FreeBSD__
		if (p_path.find("/")) {
			// exec name contains path so use it
			execv(p_path.utf8().get_data(), &args[0]);
		} else {
			// use program name and search through PATH to find it
			execvp(getprogname(), &args[0]);
		}
#else
		execvp(p_path.utf8().get_data(), &args[0]);
#endif
		// still alive? something failed..
		fprintf(stderr, "**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n", p_path.utf8().get_data());
		abort();
	}

	if (p_blocking) {

		int status;
		waitpid(pid, &status, 0);
		if (r_exitcode)
			*r_exitcode = WEXITSTATUS(status);
	} else {

		if (r_child_id)
			*r_child_id = pid;
	}

	return OK;
}

Error OS_Unix::kill(const ProcessID &p_pid) {

	int ret = ::kill(p_pid, SIGKILL);
	if (!ret) {
		//avoid zombie process
		int st;
		::waitpid(p_pid, &st, 0);
	}
	return ret ? ERR_INVALID_PARAMETER : OK;
}

int OS_Unix::get_process_id() const {

	return getpid();
};

bool OS_Unix::has_environment(const String &p_var) const {

	return getenv(p_var.utf8().get_data()) != NULL;
}

String OS_Unix::get_locale() const {

	if (!has_environment("LANG"))
		return "en";

	String locale = get_environment("LANG");
	int tp = locale.find(".");
	if (tp != -1)
		locale = locale.substr(0, tp);
	return locale;
}

Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle) {
	p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW);
	if (!p_library_handle) {
		ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror());
		ERR_FAIL_V(ERR_CANT_OPEN);
	}
	return OK;
}

Error OS_Unix::close_dynamic_library(void *p_library_handle) {
	if (dlclose(p_library_handle)) {
		return FAILED;
	}
	return OK;
}

Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
	const char *error;
	dlerror(); // Clear existing errors

	p_symbol_handle = dlsym(p_library_handle, p_name.utf8().get_data());

	error = dlerror();
	if (error != NULL) {
		if (!p_optional) {
			ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + error);
			ERR_FAIL_V(ERR_CANT_RESOLVE);
		} else {
			return ERR_CANT_RESOLVE;
		}
	}
	return OK;
}

Error OS_Unix::set_cwd(const String &p_cwd) {

	if (chdir(p_cwd.utf8().get_data()) != 0)
		return ERR_CANT_OPEN;

	return OK;
}

String OS_Unix::get_environment(const String &p_var) const {

	if (getenv(p_var.utf8().get_data()))
		return getenv(p_var.utf8().get_data());
	return "";
}

int OS_Unix::get_processor_count() const {

	return sysconf(_SC_NPROCESSORS_CONF);
}

String OS_Unix::get_data_dir() const {

	String an = get_safe_application_name();
	if (an != "") {

		if (has_environment("HOME")) {

			bool use_godot = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir");
			if (use_godot)
				return get_environment("HOME") + "/.godot/app_userdata/" + an;
			else
				return get_environment("HOME") + "/." + an;
		}
	}

	return ProjectSettings::get_singleton()->get_resource_path();
}

String OS_Unix::get_installed_templates_path() const {
	String p = get_global_settings_path();
	if (p != "")
		return p + "/templates/";
	else
		return "";
}

String OS_Unix::get_executable_path() const {

#ifdef __linux__
	//fix for running from a symlink
	char buf[256];
	memset(buf, 0, 256);
	readlink("/proc/self/exe", buf, sizeof(buf));
	String b;
	b.parse_utf8(buf);
	if (b == "") {
		WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
		return OS::get_executable_path();
	}
	return b;
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
	char resolved_path[MAXPATHLEN];

	realpath(OS::get_executable_path().utf8().get_data(), resolved_path);

	return String(resolved_path);
#elif defined(__APPLE__)
	char temp_path[1];
	uint32_t buff_size = 1;
	_NSGetExecutablePath(temp_path, &buff_size);

	char *resolved_path = new char[buff_size + 1];

	if (_NSGetExecutablePath(resolved_path, &buff_size) == 1)
		WARN_PRINT("MAXPATHLEN is too small");

	String path(resolved_path);
	delete[] resolved_path;

	return path;
#else
	ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly.");
	return OS::get_executable_path();
#endif
}

void UnixTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
	if (!should_log(true)) {
		return;
	}

	const char *err_details;
	if (p_rationale && p_rationale[0])
		err_details = p_rationale;
	else
		err_details = p_code;

	switch (p_type) {
		case ERR_WARNING:
			logf_error("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function, err_details);
			logf_error("\E[0;33m   At: %s:%i.\E[0m\n", p_file, p_line);
			break;
		case ERR_SCRIPT:
			logf_error("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
			logf_error("\E[0;35m   At: %s:%i.\E[0m\n", p_file, p_line);
			break;
		case ERR_SHADER:
			logf_error("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
			logf_error("\E[0;36m   At: %s:%i.\E[0m\n", p_file, p_line);
			break;
		case ERR_ERROR:
		default:
			logf_error("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
			logf_error("\E[0;31m   At: %s:%i.\E[0m\n", p_file, p_line);
			break;
	}
}

UnixTerminalLogger::~UnixTerminalLogger() {}

#endif


text:
export { Application } from './lib/application';
export { CliApplication } from './lib/cli';

export { EventDispatcher, Event } from './lib/utils/events';
export { createMinimatch } from './lib/utils/paths';
export { resetReflectionID } from './lib/models/reflections/abstract';
export { normalizePath } from './lib/utils/fs';
export * from './lib/models/reflections';
export * from './lib/output/plugins';
export { Renderer } from './lib/output/renderer';
export { DefaultTheme } from './lib/output/themes/DefaultTheme';
export { NavigationItem } from './lib/output/models/NavigationItem';
export { UrlMapping } from './lib/output/models/UrlMapping';


text:
docker build -t aschults/bluebox_squid:bind_latest ../bind9
docker build -t mybind .
docker stop bind1
docker rm bind1
docker run -e RELOAD_TIME=60 -e forwarders="4.4.4.4 8.8.8.8" -v $PWD../bind9/test/test_data:/var/bind/data --name=bind1 -ti -p 9953:53/udp -p 9953:53 --entrypoint=sh mybind


text:
package net.kyori.adventure.permission;

import java.util.function.Predicate;
import net.kyori.adventure.Adventure;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.pointer.Pointer;
import net.kyori.adventure.util.TriState;
import org.jetbrains.annotations.NotNull;

/**
 * Something that has permissions.
 *
 * @since 4.8.0
 */
public interface PermissionChecker extends Predicate<String> {
  /**
   * A pointer to a permission predicate.
   *
   * @since 4.8.0
   */
  Pointer<PermissionChecker> POINTER = Pointer.pointer(PermissionChecker.class, Key.key(Adventure.NAMESPACE, "permission"));

  /**
   * Creates a {@link PermissionChecker} that always returns {@code state}.
   *
   * @param state the state
   * @return a {@link PermissionChecker}
   * @since 4.8.0
   */
  static @NotNull PermissionChecker always(final TriState state) {
    if (state == TriState.TRUE) return PermissionCheckers.TRUE;
    if (state == TriState.FALSE) return PermissionCheckers.FALSE;
    return PermissionCheckers.NOT_SET;
  }

  /**
   * Checks if something has a permission.
   *
   * @param permission the permission
   * @return a tri-state result
   * @since 4.8.0
   */
  @NotNull TriState value(final String permission);

  @Override
  default boolean test(final String permission) {
    return this.value(permission) == TriState.TRUE;
  }
}


text:
<?php

namespace Kaecyra\ChatBot\Bot\Command;
use Kaecyra\AppCommon\Event\EventAwareInterface;
use Kaecyra\AppCommon\Event\EventAwareTrait;
use Kaecyra\AppCommon\Log\LoggerBoilerTrait;
use Kaecyra\AppCommon\Log\Tagged\TaggedLogInterface;
use Kaecyra\AppCommon\Log\Tagged\TaggedLogTrait;
use Kaecyra\ChatBot\Bot\Strategy\AbstractStrategy;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LogLevel;

/**
 * Abstract Command
 *
 * @author Tim Gunter <tim@vanillaforums.com>
 * @package chatbot
 */
abstract class AbstractCommand implements CommandInterface, EventAwareInterface, LoggerAwareInterface, TaggedLogInterface, \ArrayAccess {

    use LoggerBoilerTrait;
    use LoggerAwareTrait;
    use TaggedLogTrait;
    use EventAwareTrait;

    const DEFAULT_COMMAND_EXPIRY = 600;

    /**
     * Container
     * @var ContainerInterface
     */
    protected $container;

    /**
     * Command guid
     * @var string
     */
    protected $guid;

    /**
     * Expiry delta
     * @var int
     */
    protected $expiry;

    /**
     * Command readiness
     * @var bool
     */
    protected $isReady;

    /**
     * Command awaiting confirmation
     * @var bool
     */
    protected $await;

    /**
     * Create time
     * @var int
     */
    protected $createTime;

    /**
     * Update time, when this command was last touched
     * @var int
     */
    protected $updateTime;

    /**
     * Command name
     * @var string
     */
    protected $command;

    /**
     * Command handler
     * @var callable
     */
    protected $handler;

    /**
     * Targets
     * @var array
     */
    protected $targets;

    /**
     * TODO Refactor chatbot code where the strategy property was used dynamically before, we can then switch the visibility to protected
     *
     * @var AbstractStrategy
     */
    public $strategy;

    /**
     * Array access data
     * @var array
     */
    protected $data;

    /**
     * AbstractCommand constructor
     *
     */
    public function __construct(ContainerInterface $container = null) {
        $this->container = $container;
        $this->setCommand('');
        $this->handler = null;
        $this->createTime = time();
        $this->updateTime = time();
        $this->expiry = self::DEFAULT_COMMAND_EXPIRY;
        $this->isReady = false;
        $this->targets = [];
        $this->data = [];

        $this->guid = $this->generateGuidv4();
    }

    /**
     * Get command GUID
     *
     * @return string
     */
    public function getGuid(): string {
        return $this->guid;
    }

    /**
     * Generate v4 GUID value
     *
     * @param null $data
     * @return string
     * @throws \Exception
     */
    protected function generateGuidv4($data = null) {
        $data = $data ?? random_bytes(16);

        $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
        $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10

        return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
    }

    /**
     * Get method
     *
     * @return string
     */
    public function getCommand(): string {
        return $this->command;
    }

    /**
     * Set command
     *
     * @param string $command
     * @return CommandInterface
     */
    public function setCommand(string $command): CommandInterface {
        $this->command = $command;
        return $this;
    }

    /**
     * Test whether we have a command
     *
     * @return bool
     */
    public function haveCommand(): bool {
        return !empty($this->command) && strlen($this->command);
    }

    /**
     * Get command handler
     *
     * @return callable|null
     */
    public function getHandler(): ?callable {
        return $this->handler;
    }

    /**
     * Set command handler
     *
     * @param callable $handler
     * @return CommandInterface
     */
    public function setHandler(callable $handler): CommandInterface {
        if (!is_callable($handler)) {
            $this->tLog(LogLevel::ERROR, "Supplied command handler for '{command}' is not callable.", [
                'command' => $this->getCommand()
            ]);
            $handler = null;
        }
        $this->handler = $handler;
        return $this;
    }

    /**
     * Touch the command
     *
     * Extends updateTime, delaying expiry.
     */
    public function touch() {
        $this->updateTime = time();
    }

    /**
     * Set expiry
     *
     * @param int $delta
     * @return $this
     */
    public function setExpiry(int $delta) {
        $this->expiry = $delta;
        return $this;
    }

    /**
     * Get expiry
     *
     * @return int
     */
    public function getExpiry(): int {
        return $this->expiry;
    }

    /**
     * Check expiry
     *
     * @return bool
     */
    public function isExpired(): bool {
        return $this->expiry ? (($this->expiry + $this->updateTime) < time()) : false;
    }

    /**
     * Check if command is ready to run
     *
     * @return bool
     */
    public function isReady(): bool {
        return $this->isReady;
    }

    /**
     * Set command execution readiness
     *
     * @param bool $ready
     * @return CommandInterface
     */
    public function setReady(bool $ready = true): CommandInterface {
        $this->isReady = $ready;
        return $this;
    }

    /**
     * Set waiting status
     *
     * @param bool $wait
     * @return CommandInterface
     */
    public function setAwaitConfirmation(bool $wait = true): CommandInterface {
        $this->await = $wait;
        return $this;
    }

    /**
     * Get waiting status
     *
     * @return bool
     */
    public function isWaiting(): bool {
        return $this->await === true;
    }

    /**
     * Add a target
     *
     * @param string $name
     * @param mixed $data
     * @param boolean $multi optional. default false.
     */
    public function addTarget($name, $data, $multi = false) {
        // Prepare the target
        if ($multi) {
            if (isset($this->targets[$name])) {
                if (!is_array($this->targets[$name])) {
                    $this->targets[$name] = [$this->targets[$name]];
                }
            } else {
                $this->targets[$name] = [];
            }
            array_push($this->targets[$name], $data);
        } else {
            $this->targets[$name] = $data;
        }
    }

    /**
     * Test if we have a given target
     *
     * @param string $name
     * @return boolean
     */
    public function haveTarget($name): bool {
        return (isset($this->targets[$name]) && !empty($this->targets[$name]));
    }

    /**
     * Get target
     *
     * @param string $name
     * @return mixed
     * @throws \Exception
     */
    public function getTarget(string $name) {
        if ($this->haveTarget($name)) {
            return $this->targets[$name];
        } else {
            throw new \Exception("Target {$name} doesn't exist");
        }
    }

    /**
     * Set a command strategy
     *
     * @param AbstractStrategy $strategy
     */
    public function setStrategy(AbstractStrategy $strategy) {
        $this->strategy = $strategy;
    }

    /**
     * Get a command strategy
     *
     * @return AbstractStrategy
     */
    public function getStrategy(): AbstractStrategy {
        return $this->strategy;
    }

    /**
     * Get "OK" command response
     *
     * @return CommandResponse
     */
    public function getResponseOK(): CommandResponse {
        return new CommandResponse(CommandResponse::RESPONSE_OK);
    }

    /**
     * Get "ERROR" command response
     *
     * @return CommandResponse
     */
    public function getResponseError(): CommandResponse {
        return new CommandResponse(CommandResponse::RESPONSE_ERROR);
    }

    /**
     * Get "REQUEUE" command response
     *
     * @return CommandResponse
     */
    public function getResponseRequeue(int $delay = 0, bool $delta = true): CommandResponse {
        $r = new CommandResponse(CommandResponse::RESPONSE_REQUEUE);
        $r->setDelay($delay);
        $r->setDelta($delta);
        return $r;
    }

    /**
     * Get "EXPIRED" command response
     *
     * @return CommandResponse
     */
    public function getResponseExpired(): CommandResponse {
        return new CommandResponse(CommandResponse::RESPONSE_EXPIRED);
    }

    /**
     * Get "NO_HANDLER" command response
     *
     * @return CommandResponse
     */
    public function getResponseNoHandler(): CommandResponse {
        return new CommandResponse(CommandResponse::RESPONSE_NO_HANDLER);
    }

    /**
     * Get data by key
     *
     * @param string $key
     */
    public function &__get ($key) {
        return $this->data[$key];
    }

    /**
     * Assigns value by key
     *
     * @param string $key
     * @param mixed $value value to set
     */
    public function __set($key, $value) {
        $this->data[$key] = $value;
    }

    /**
     * Whether or not data exists by key
     *
     * @param string $key to check for
     * @return boolean
     */
    public function __isset($key) {
        return isset($this->data[$key]);
    }

    /**
     * Unset data by key
     *
     * @param string $key
     */
    public function __unset($key) {
        unset($this->data[$key]);
    }

    /**
     * Check if offset exists
     *
     * @param mixed $offset
     */
    public function offsetExists($offset) {
        return isset($this->data[$offset]);
    }

    /**
     * Set value on offset
     *
     * @param mixed $offset
     * @param mixed $value
     */
    public function offsetSet($offset, $value) {
        if (is_null($offset)) {
            $this->data[] = $value;
        } else {
            $this->data[$offset] = $value;
        }
    }

    /**
     * Get offset value
     *
     * @param mixed $offset
     */
    public function offsetGet($offset) {
        return isset($this->data[$offset]) ? $this->data[$offset] : null;
    }

    /**
     * Unset offset
     *
     * @param mixed $offset
     */
    public function offsetUnset($offset) {
        unset($this->data[$offset]);
    }
}


text:
import * as validator from 'validator';

/************************************************
*                                               *
*                  IMPORT TESTS                 *
*                                               *
************************************************/
import blacklistFunc = require('validator/lib/blacklist');
import containsFunc = require('validator/lib/contains');
import equalsFunc = require('validator/lib/equals');
import escapeFunc = require('validator/lib/escape');
import isAfterFunc = require('validator/lib/isAfter');
import isAlphaFunc = require('validator/lib/isAlpha');
import isAlphanumericFunc = require('validator/lib/isAlphanumeric');
import isAsciiFunc = require('validator/lib/isAscii');
import isBase64Func = require('validator/lib/isBase64');
import isBeforeFunc = require('validator/lib/isBefore');
import isBooleanFunc = require('validator/lib/isBoolean');
import isByteLengthFunc = require('validator/lib/isByteLength');
import isCreditCardFunc = require('validator/lib/isCreditCard');
import isCurrencyFunc = require('validator/lib/isCurrency');
import isDataURIFunc = require('validator/lib/isDataURI');
import isDecimalFunc = require('validator/lib/isDecimal');
import isDivisibleByFunc = require('validator/lib/isDivisibleBy');
import isEmailFunc = require('validator/lib/isEmail');
import isEmptyFunc = require('validator/lib/isEmpty');
import isFQDNFunc = require('validator/lib/isFQDN');
import isFloatFunc = require('validator/lib/isFloat');
import isFullWidthFunc = require('validator/lib/isFullWidth');
import isHalfWidthFunc = require('validator/lib/isHalfWidth');
import isHashFunc = require('validator/lib/isHash');
import isHexColorFunc = require('validator/lib/isHexColor');
import isHexadecimalFunc = require('validator/lib/isHexadecimal');
import isIPFunc = require('validator/lib/isIP');
import isISBNFunc = require('validator/lib/isISBN');
import isISSNFunc = require('validator/lib/isISSN');
import isISINFunc = require('validator/lib/isISIN');
import isISO8601Func = require('validator/lib/isISO8601');
import isISO31661Alpha2Func = require('validator/lib/isISO31661Alpha2');
import isISRCFunc = require('validator/lib/isISRC');
import isInFunc = require('validator/lib/isIn');
import isIntFunc = require('validator/lib/isInt');
import isJSONFunc = require('validator/lib/isJSON');
import isLatLongFunc = require('validator/lib/isLatLong');
import isLengthFunc = require('validator/lib/isLength');
import isLowercaseFunc = require('validator/lib/isLowercase');
import isMACAddressFunc = require('validator/lib/isMACAddress');
import isMD5Func = require('validator/lib/isMD5');
import isMimeTypeFunc = require('validator/lib/isMimeType');
import isMobilePhoneFunc = require('validator/lib/isMobilePhone');
import isMongoIdFunc = require('validator/lib/isMongoId');
import isMultibyteFunc = require('validator/lib/isMultibyte');
import isNumericFunc = require('validator/lib/isNumeric');
import isPortFunc = require('validator/lib/isPort');
import isPostalCodeFunc = require('validator/lib/isPostalCode');
import isSurrogatePairFunc = require('validator/lib/isSurrogatePair');
import isURLFunc = require('validator/lib/isURL');
import isUUIDFunc = require('validator/lib/isUUID');
import isUppercaseFunc = require('validator/lib/isUppercase');
import isVariableWidthFunc = require('validator/lib/isVariableWidth');
import isWhitelistedFunc = require('validator/lib/isWhitelisted');
import ltrimFunc = require('validator/lib/ltrim');
import matchesFunc = require('validator/lib/matches');
import normalizeEmailFunc = require('validator/lib/normalizeEmail');
import rtrimFunc = require('validator/lib/rtrim');
import stripLowFunc = require('validator/lib/stripLow');
import toBooleanFunc = require('validator/lib/toBoolean');
import toDateFunc = require('validator/lib/toDate');
import toFloatFunc = require('validator/lib/toFloat');
import toIntFunc = require('validator/lib/toInt');
import trimFunc = require('validator/lib/trim');
import unescapeFunc = require('validator/lib/unescape');
import whitelistFunc = require('validator/lib/whitelist');

{
  let _blacklist = validator.blacklist;
  _blacklist = blacklistFunc;

  let _contains = validator.contains;
  _contains = containsFunc;

  let _equals = validator.equals;
  _equals = equalsFunc;

  let _escape = validator.escape;
  _escape = escapeFunc;

  let _isAfter = validator.isAfter;
  _isAfter = isAfterFunc;

  let _isAlpha = validator.isAlpha;
  _isAlpha = isAlphaFunc;

  let _isAlphanumeric = validator.isAlphanumeric;
  _isAlphanumeric = isAlphanumericFunc;

  let _isAscii = validator.isAscii;
  _isAscii = isAsciiFunc;

  let _isBase64 = validator.isBase64;
  _isBase64 = isBase64Func;

  let _isBefore = validator.isBefore;
  _isBefore = isBeforeFunc;

  let _isBoolean = validator.isBoolean;
  _isBoolean = isBooleanFunc;

  let _isByteLength = validator.isByteLength;
  _isByteLength = isByteLengthFunc;

  let _isCreditCard = validator.isCreditCard;
  _isCreditCard = isCreditCardFunc;

  let _isCurrency = validator.isCurrency;
  _isCurrency = isCurrencyFunc;

  let _isDataURI = validator.isDataURI;
  _isDataURI = isDataURIFunc;

  let _isDecimal = validator.isDecimal;
  _isDecimal = isDecimalFunc;

  let _isDivisibleBy = validator.isDivisibleBy;
  _isDivisibleBy = isDivisibleByFunc;

  let _isEmail = validator.isEmail;
  _isEmail = isEmailFunc;

  let _isEmpty = validator.isEmpty;
  _isEmpty = isEmptyFunc;

  let _isFQDN = validator.isFQDN;
  _isFQDN = isFQDNFunc;

  let _isFloat = validator.isFloat;
  _isFloat = isFloatFunc;

  let _isFullWidth = validator.isFullWidth;
  _isFullWidth = isFullWidthFunc;

  let _isHalfWidth = validator.isHalfWidth;
  _isHalfWidth = isHalfWidthFunc;

  let _isHash = validator.isHash;
  _isHash = isHashFunc;

  let _isHexColor = validator.isHexColor;
  _isHexColor = isHexColorFunc;

  let _isHexadecimal = validator.isHexadecimal;
  _isHexadecimal = isHexadecimalFunc;

  let _isIP = validator.isIP;
  _isIP = isIPFunc;

  let _isISBN = validator.isISBN;
  _isISBN = isISBNFunc;

  let _isISSN = validator.isISSN;
  _isISSN = isISSNFunc;

  let _isISIN = validator.isISIN;
  _isISIN = isISINFunc;

  let _isISO8601 = validator.isISO8601;
  _isISO8601 = isISO8601Func;

  let _isISO31661Alpha2 = validator.isISO31661Alpha2;
  _isISO31661Alpha2 = isISO31661Alpha2Func;

  let _isISRC = validator.isISRC;
  _isISRC = isISRCFunc;

  let _isIn = validator.isIn;
  _isIn = isInFunc;

  let _isInt = validator.isInt;
  _isInt = isIntFunc;

  let _isJSON = validator.isJSON;
  _isJSON = isJSONFunc;

  let _isLatLong = validator.isLatLong;
  _isLatLong = isLatLongFunc;

  let _isLength = validator.isLength;
  _isLength = isLengthFunc;

  let _isLowercase = validator.isLowercase;
  _isLowercase = isLowercaseFunc;

  let _isMACAddress = validator.isMACAddress;
  _isMACAddress = isMACAddressFunc;

  let _isMD5 = validator.isMD5;
  _isMD5 = isMD5Func;

  let _isMimeType = validator.isMimeType;
  _isMimeType = isMimeTypeFunc;

  let _isMobilePhone = validator.isMobilePhone;
  _isMobilePhone = isMobilePhoneFunc;

  let _isMongoId = validator.isMongoId;
  _isMongoId = isMongoIdFunc;

  let _isMultibyte = validator.isMultibyte;
  _isMultibyte = isMultibyteFunc;

  let _isNumeric = validator.isNumeric;
  _isNumeric = isNumericFunc;

  let _isPort = validator.isPort;
  _isPort = isPortFunc;

  let _isPostalCode = validator.isPostalCode;
  _isPostalCode = isPostalCodeFunc;

  let _isSurrogatePair = validator.isSurrogatePair;
  _isSurrogatePair = isSurrogatePairFunc;

  let _isURL = validator.isURL;
  _isURL = isURLFunc;

  let _isUUID = validator.isUUID;
  _isUUID = isUUIDFunc;

  let _isUppercase = validator.isUppercase;
  _isUppercase = isUppercaseFunc;

  let _isVariableWidth = validator.isVariableWidth;
  _isVariableWidth = isVariableWidthFunc;

  let _isWhitelisted = validator.isWhitelisted;
  _isWhitelisted = isWhitelistedFunc;

  let _ltrim = validator.ltrim;
  _ltrim = ltrimFunc;

  let _matches = validator.matches;
  _matches = matchesFunc;

  let _normalizeEmail = validator.normalizeEmail;
  _normalizeEmail = normalizeEmailFunc;

  let _rtrim = validator.rtrim;
  _rtrim = rtrimFunc;

  let _stripLow = validator.stripLow;
  _stripLow = stripLowFunc;

  let _toBoolean = validator.toBoolean;
  _toBoolean = toBooleanFunc;

  let _toDate = validator.toDate;
  _toDate = toDateFunc;

  let _toFloat = validator.toFloat;
  _toFloat = toFloatFunc;

  let _toInt = validator.toInt;
  _toInt = toIntFunc;

  let _trim = validator.trim;
  _trim = trimFunc;

  let _unescape = validator.unescape;
  _unescape = unescapeFunc;

  let _whitelist = validator.whitelist;
  _whitelist = whitelistFunc;
}

/************************************************
*                                               *
*                  API TESTS                    *
*                                               *
************************************************/
let any: any;

// **************
// * Validators *
// **************

{
  let result: boolean;

  result = validator.contains('sample', 'sample');

  result = validator.equals('sample', 'sample');

  result = validator.isAfter('sample');
  result = validator.isAfter('sample', new Date().toString());

  result = validator.isAlpha('sample');
  result = validator.isAlpha('sample', 'ar');
  result = validator.isAlpha('sample', 'ar-AE');
  result = validator.isAlpha('sample', 'ar-BH');
  result = validator.isAlpha('sample', 'ar-DZ');
  result = validator.isAlpha('sample', 'ar-EG');
  result = validator.isAlpha('sample', 'ar-IQ');
  result = validator.isAlpha('sample', 'ar-JO');
  result = validator.isAlpha('sample', 'ar-KW');
  result = validator.isAlpha('sample', 'ar-LB');
  result = validator.isAlpha('sample', 'ar-LY');
  result = validator.isAlpha('sample', 'ar-MA');
  result = validator.isAlpha('sample', 'ar-QA');
  result = validator.isAlpha('sample', 'ar-QM');
  result = validator.isAlpha('sample', 'ar-SA');
  result = validator.isAlpha('sample', 'ar-SD');
  result = validator.isAlpha('sample', 'ar-SY');
  result = validator.isAlpha('sample', 'ar-TN');
  result = validator.isAlpha('sample', 'ar-YE');
  result = validator.isAlpha('sample', 'bg-BG');
  result = validator.isAlpha('sample', 'cs-CZ');
  result = validator.isAlpha('sample', 'da-DK');
  result = validator.isAlpha('sample', 'de-DE');
  result = validator.isAlpha('sample', 'el-GR');
  result = validator.isAlpha('sample', 'en-AU');
  result = validator.isAlpha('sample', 'en-GB');
  result = validator.isAlpha('sample', 'en-HK');
  result = validator.isAlpha('sample', 'en-IN');
  result = validator.isAlpha('sample', 'en-NZ');
  result = validator.isAlpha('sample', 'en-US');
  result = validator.isAlpha('sample', 'en-ZA');
  result = validator.isAlpha('sample', 'en-ZM');
  result = validator.isAlpha('sample', 'es-ES');
  result = validator.isAlpha('sample', 'fr-FR');
  result = validator.isAlpha('sample', 'hu-HU');
  result = validator.isAlpha('sample', 'it-IT');
  result = validator.isAlpha('sample', 'nb-NO');
  result = validator.isAlpha('sample', 'nl-NL');
  result = validator.isAlpha('sample', 'nn-NO');
  result = validator.isAlpha('sample', 'pl-PL');
  result = validator.isAlpha('sample', 'pt-BR');
  result = validator.isAlpha('sample', 'pt-PT');
  result = validator.isAlpha('sample', 'ru-RU');
  result = validator.isAlpha('sample', 'sk-SK');
  result = validator.isAlpha('sample', 'sr-RS');
  result = validator.isAlpha('sample', 'sr-RS@latin');
  result = validator.isAlpha('sample', 'sv-SE');
  result = validator.isAlpha('sample', 'tr-TR');
  result = validator.isAlpha('sample', 'uk-UA');

  result = validator.isAlphanumeric('sample');
  result = validator.isAlphanumeric('sample', 'ar');
  result = validator.isAlphanumeric('sample', 'ar-AE');
  result = validator.isAlphanumeric('sample', 'ar-BH');
  result = validator.isAlphanumeric('sample', 'ar-DZ');
  result = validator.isAlphanumeric('sample', 'ar-EG');
  result = validator.isAlphanumeric('sample', 'ar-IQ');
  result = validator.isAlphanumeric('sample', 'ar-JO');
  result = validator.isAlphanumeric('sample', 'ar-KW');
  result = validator.isAlphanumeric('sample', 'ar-LB');
  result = validator.isAlphanumeric('sample', 'ar-LY');
  result = validator.isAlphanumeric('sample', 'ar-MA');
  result = validator.isAlphanumeric('sample', 'ar-QA');
  result = validator.isAlphanumeric('sample', 'ar-QM');
  result = validator.isAlphanumeric('sample', 'ar-SA');
  result = validator.isAlphanumeric('sample', 'ar-SD');
  result = validator.isAlphanumeric('sample', 'ar-SY');
  result = validator.isAlphanumeric('sample', 'ar-TN');
  result = validator.isAlphanumeric('sample', 'ar-YE');
  result = validator.isAlphanumeric('sample', 'bg-BG');
  result = validator.isAlphanumeric('sample', 'cs-CZ');
  result = validator.isAlphanumeric('sample', 'da-DK');
  result = validator.isAlphanumeric('sample', 'de-DE');
  result = validator.isAlphanumeric('sample', 'el-GR');
  result = validator.isAlphanumeric('sample', 'en-AU');
  result = validator.isAlphanumeric('sample', 'en-GB');
  result = validator.isAlphanumeric('sample', 'en-HK');
  result = validator.isAlphanumeric('sample', 'en-IN');
  result = validator.isAlphanumeric('sample', 'en-NZ');
  result = validator.isAlphanumeric('sample', 'en-US');
  result = validator.isAlphanumeric('sample', 'en-ZA');
  result = validator.isAlphanumeric('sample', 'en-ZM');
  result = validator.isAlphanumeric('sample', 'es-ES');
  result = validator.isAlphanumeric('sample', 'fr-FR');
  result = validator.isAlphanumeric('sample', 'hu-HU');
  result = validator.isAlphanumeric('sample', 'it-IT');
  result = validator.isAlphanumeric('sample', 'nb-NO');
  result = validator.isAlphanumeric('sample', 'nl-NL');
  result = validator.isAlphanumeric('sample', 'nn-NO');
  result = validator.isAlphanumeric('sample', 'pl-PL');
  result = validator.isAlphanumeric('sample', 'pt-BR');
  result = validator.isAlphanumeric('sample', 'pt-PT');
  result = validator.isAlphanumeric('sample', 'ru-RU');
  result = validator.isAlphanumeric('sample', 'sk-SK');
  result = validator.isAlphanumeric('sample', 'sr-RS');
  result = validator.isAlphanumeric('sample', 'sr-RS@latin');
  result = validator.isAlphanumeric('sample', 'sv-SE');
  result = validator.isAlphanumeric('sample', 'tr-TR');
  result = validator.isAlphanumeric('sample', 'uk-UA');

  result = validator.isAscii('sample');

  result = validator.isBase64('sample');

  result = validator.isBefore('sample');
  result = validator.isBefore('sample', new Date().toString());

  result = validator.isBoolean('sample');

  let isByteLengthOptions: ValidatorJS.IsByteLengthOptions;
  result = validator.isByteLength('sample', isByteLengthOptions);
  result = validator.isByteLength('sample', 0);
  result = validator.isByteLength('sample', 0, 42);

  result = validator.isCreditCard('sample');

  let isCurrencyOptions: ValidatorJS.IsCurrencyOptions;
  result = validator.isCurrency('sample');
  result = validator.isCurrency('sample', isCurrencyOptions);

  result = validator.isDataURI('sample');

  let isDecimalOptions: ValidatorJS.IsDecimalOptions;
  result = validator.isDecimal('sample');
  result = validator.isDecimal('sample', isDecimalOptions);

  result = validator.isDivisibleBy('sample', 2);

  let isEmailOptions: ValidatorJS.IsEmailOptions;
  result = validator.isEmail('sample');
  result = validator.isEmail('sample', isEmailOptions);

  result = validator.isEmpty('sample');

  let isFQDNOptions: ValidatorJS.IsFQDNOptions;
  result = validator.isFQDN('sample');
  result = validator.isFQDN('sample', isFQDNOptions);

  let isFloatOptions: ValidatorJS.IsFloatOptions;
  result = validator.isFloat('sample');
  result = validator.isFloat('sample', isFloatOptions);

  result = validator.isFullWidth('sample');

  result = validator.isHalfWidth('sample');

  result = validator.isHash('sample', 'md4');
  result = validator.isHash('sample', 'md5');
  result = validator.isHash('sample', 'sha1');
  result = validator.isHash('sample', 'sha256');
  result = validator.isHash('sample', 'sha384');
  result = validator.isHash('sample', 'sha512');
  result = validator.isHash('sample', 'ripemd128');
  result = validator.isHash('sample', 'ripemd160');
  result = validator.isHash('sample', 'tiger128');
  result = validator.isHash('sample', 'tiger160');
  result = validator.isHash('sample', 'tiger192');
  result = validator.isHash('sample', 'crc32');
  result = validator.isHash('sample', 'crc32b');

  result = validator.isHexColor('sample');

  result = validator.isHexadecimal('sample');

  result = validator.isIP('sample');
  result = validator.isIP('sample', 6);

  result = validator.isISBN('sample');
  result = validator.isISBN('sample', 13);

  let isISSNOptions: ValidatorJS.IsISSNOptions;
  result = validator.isISSN('sample');
  result = validator.isISSN('sample', isISSNOptions);

  result = validator.isISIN('sample');

  result = validator.isISO8601('sample');

  result = validator.isISO31661Alpha2('sample');

  result = validator.isISRC('sample');

  result = validator.isIn('sample', []);

  let isIntOptions: ValidatorJS.IsIntOptions;
  result = validator.isInt('sample');
  result = validator.isInt('sample', isIntOptions);

  result = validator.isJSON('sample');

  result = validator.isLatLong('sample');

  let isLengthOptions: ValidatorJS.IsLengthOptions;
  result = validator.isLength('sample', isLengthOptions);
  result = validator.isLength('sample', 3);
  result = validator.isLength('sample', 3, 5);

  result = validator.isLowercase('sample');

  result = validator.isMACAddress('sample');

  result = validator.isMD5('sample');

  result = validator.isMimeType('sample');

  let isMobilePhoneOptions: ValidatorJS.IsMobilePhoneOptions;
  result = validator.isMobilePhone('sample', 'any', isMobilePhoneOptions);
  result = validator.isMobilePhone('sample', 'ar-AE');
  result = validator.isMobilePhone('sample', 'ar-DZ');
  result = validator.isMobilePhone('sample', 'ar-EG');
  result = validator.isMobilePhone('sample', 'ar-JO');
  result = validator.isMobilePhone('sample', 'ar-SA');
  result = validator.isMobilePhone('sample', 'ar-SY');
  result = validator.isMobilePhone('sample', 'be-BY');
  result = validator.isMobilePhone('sample', 'bg-BG');
  result = validator.isMobilePhone('sample', 'cs-CZ');
  result = validator.isMobilePhone('sample', 'de-DE');
  result = validator.isMobilePhone('sample', 'da-DK');
  result = validator.isMobilePhone('sample', 'el-GR');
  result = validator.isMobilePhone('sample', 'en-AU');
  result = validator.isMobilePhone('sample', 'en-GB');
  result = validator.isMobilePhone('sample', 'en-HK');
  result = validator.isMobilePhone('sample', 'en-IN');
  result = validator.isMobilePhone('sample', 'en-KE');
  result = validator.isMobilePhone('sample', 'en-NG');
  result = validator.isMobilePhone('sample', 'en-NZ');
  result = validator.isMobilePhone('sample', 'en-UG');
  result = validator.isMobilePhone('sample', 'en-RW');
  result = validator.isMobilePhone('sample', 'en-SG');
  result = validator.isMobilePhone('sample', 'en-TZ');
  result = validator.isMobilePhone('sample', 'en-PK');
  result = validator.isMobilePhone('sample', 'en-US');
  result = validator.isMobilePhone('sample', 'en-CA');
  result = validator.isMobilePhone('sample', 'en-ZA');
  result = validator.isMobilePhone('sample', 'en-ZM');
  result = validator.isMobilePhone('sample', 'es-ES');
  result = validator.isMobilePhone('sample', 'fa-IR');
  result = validator.isMobilePhone('sample', 'fi-FI');
  result = validator.isMobilePhone('sample', 'fo-FO');
  result = validator.isMobilePhone('sample', 'fr-FR');
  result = validator.isMobilePhone('sample', 'he-IL');
  result = validator.isMobilePhone('sample', 'hu-HU');
  result = validator.isMobilePhone('sample', 'id-ID');
  result = validator.isMobilePhone('sample', 'it-IT');
  result = validator.isMobilePhone('sample', 'ja-JP');
  result = validator.isMobilePhone('sample', 'kk-KZ');
  result = validator.isMobilePhone('sample', 'kl-GL');
  result = validator.isMobilePhone('sample', 'ko-KR');
  result = validator.isMobilePhone('sample', 'lt-LT');
  result = validator.isMobilePhone('sample', 'ms-MY');
  result = validator.isMobilePhone('sample', 'nb-NO');
  result = validator.isMobilePhone('sample', 'nn-NO');
  result = validator.isMobilePhone('sample', 'pl-PL');
  result = validator.isMobilePhone('sample', 'pt-PT');
  result = validator.isMobilePhone('sample', 'ro-RO');
  result = validator.isMobilePhone('sample', 'ru-RU');
  result = validator.isMobilePhone('sample', 'sr-RS');
  result = validator.isMobilePhone('sample', 'sk-SK');
  result = validator.isMobilePhone('sample', 'th-TH');
  result = validator.isMobilePhone('sample', 'tr-TR');
  result = validator.isMobilePhone('sample', 'uk-UA');
  result = validator.isMobilePhone('sample', 'vi-VN');
  result = validator.isMobilePhone('sample', 'zh-CN');
  result = validator.isMobilePhone('sample', 'zh-HK');
  result = validator.isMobilePhone('sample', 'zh-TW');
  result = validator.isMobilePhone('sample', 'any');

  result = validator.isMongoId('sample');

  result = validator.isMultibyte('sample');

  result = validator.isNumeric('sample');

  result = validator.isPort('sample');

  result = validator.isPostalCode('sample', 'AT');
  result = validator.isPostalCode('sample', 'AU');
  result = validator.isPostalCode('sample', 'BE');
  result = validator.isPostalCode('sample', 'BG');
  result = validator.isPostalCode('sample', 'CA');
  result = validator.isPostalCode('sample', 'CH');
  result = validator.isPostalCode('sample', 'CZ');
  result = validator.isPostalCode('sample', 'DE');
  result = validator.isPostalCode('sample', 'DK');
  result = validator.isPostalCode('sample', 'DZ');
  result = validator.isPostalCode('sample', 'ES');
  result = validator.isPostalCode('sample', 'FI');
  result = validator.isPostalCode('sample', 'FR');
  result = validator.isPostalCode('sample', 'GB');
  result = validator.isPostalCode('sample', 'GR');
  result = validator.isPostalCode('sample', 'IL');
  result = validator.isPostalCode('sample', 'IN');
  result = validator.isPostalCode('sample', 'IS');
  result = validator.isPostalCode('sample', 'IT');
  result = validator.isPostalCode('sample', 'JP');
  result = validator.isPostalCode('sample', 'KE');
  result = validator.isPostalCode('sample', 'LI');
  result = validator.isPostalCode('sample', 'MX');
  result = validator.isPostalCode('sample', 'NL');
  result = validator.isPostalCode('sample', 'NO');
  result = validator.isPostalCode('sample', 'PL');
  result = validator.isPostalCode('sample', 'PT');
  result = validator.isPostalCode('sample', 'RO');
  result = validator.isPostalCode('sample', 'RU');
  result = validator.isPostalCode('sample', 'SA');
  result = validator.isPostalCode('sample', 'SE');
  result = validator.isPostalCode('sample', 'TW');
  result = validator.isPostalCode('sample', 'US');
  result = validator.isPostalCode('sample', 'ZA');
  result = validator.isPostalCode('sample', 'ZM');
  result = validator.isPostalCode('sample', 'any');

  result = validator.isSurrogatePair('sample');

  let isURLOptions: ValidatorJS.IsURLOptions;
  result = validator.isURL('sample');
  result = validator.isURL('sample', isURLOptions);

  result = validator.isUUID('sample');
  result = validator.isUUID('sample', 5);
  result = validator.isUUID('sample', 'all');

  result = validator.isUppercase('sample');

  result = validator.isVariableWidth('sample');

  result = validator.isWhitelisted('sample', 'abc');
  result = validator.isWhitelisted('sample', ['a', 'b', 'c']);

  result = validator.matches('foobar', 'foo/i');
  result = validator.matches('foobar', 'foo', 'i');
}

// **************
// * Sanitizers *
// **************

{
  let result: string;

  result = validator.blacklist('sample', 'abc');

  result = validator.escape('sample');

  result = validator.unescape('sample');

  result = validator.ltrim('sample');
  result = validator.ltrim('sample', ' ');

  let normalizeEmailOptions: ValidatorJS.NormalizeEmailOptions;
  let normalizeResult: string | false;
  normalizeResult = validator.normalizeEmail('sample');
  normalizeResult = validator.normalizeEmail('sample', normalizeEmailOptions);

  result = validator.rtrim('sample');
  result = validator.rtrim('sample', ' ');

  result = validator.stripLow('sample');
  result = validator.stripLow('sample', true);
}

{
  let result: boolean;

  result = validator.toBoolean(any);
  result = validator.toBoolean(any, true);
}

{
  let result: Date;

  result = validator.toDate(any);
}

{
  let result: number;

  result = validator.toFloat(any);

  result = validator.toInt(any);
  result = validator.toInt(any, 10);
}

{
  let result: string;

  result = validator.trim('sample');
  result = validator.trim('sample', ' ');

  result = validator.whitelist('sample', 'abc');
}

{
  let str: string;
  str = validator.toString([123, 456, '123', '456', true, false]);
}

{
  let ver: string;
  ver = validator.version;
}

// **************
// * Extensions *
// **************

validator.extend<(str: string, options: {}) => boolean>('isTest', (str: any, options: {}) => !str);


text:
static bool eigen_did_assert = false;
#define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;}

#include <iostream>
#include <Eigen/Eigen>

#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif

using namespace Eigen;
using namespace std;

int main(int, char**)
{
  cout.precision(3);
  ArrayXd v = ArrayXd::LinSpaced(5,0,1);
cout << v.atan() << endl;

  return 0;
}


text:
/*jshint browser: true */
/*jshint unused: false */
/*global Backbone, activeUser, window, ArangoQuery, $, data, _, arangoHelper*/
(function() {
  "use strict";

  window.ArangoQueries = Backbone.Collection.extend({

    initialize: function(models, options) {
      var result;
      $.ajax("whoAmI?_=" + Date.now(), {async:false}).done(
        function(data) {
          result = data.user;
        }
      );

      this.activeUser = result;

      if (this.activeUser === false) {
        this.activeUser = "root";
      }
    },

    url: '/_api/user/',

    model: ArangoQuery,

    activeUser: null,

    parse: function(response) {
      var self = this, toReturn;

      _.each(response.result, function(val) {
        if (val.user === self.activeUser) {
          try {
            if (val.extra.queries) {
              toReturn = val.extra.queries;
            }
          }
          catch (e) {
          }
        }
      });
      return toReturn;
    },

    saveCollectionQueries: function() {
      if (this.activeUser === 0) {
        return false;
      }

      var returnValue = false;
      var queries = [];

      this.each(function(query) {
        queries.push({
          value: query.attributes.value,
          name: query.attributes.name
        });
      });

      // save current collection
      $.ajax({
        cache: false,
        type: "PATCH",
        async: false,
        url: "/_api/user/" + encodeURIComponent(this.activeUser),
        data: JSON.stringify({
          extra: {
           queries: queries
          }
        }),
        contentType: "application/json",
        processData: false,
        success: function() {
          returnValue = true;
        },
        error: function() {
          returnValue = false;
        }
      });

      return returnValue;
    },

    saveImportQueries: function(file, callback) {

      if (this.activeUser === 0) {
        return false;
      }

      window.progressView.show("Fetching documents...");
      $.ajax({
        cache: false,
        type: "POST",
        async: false,
        url: "query/upload/" + encodeURIComponent(this.activeUser),
        data: file,
        contentType: "application/json",
        processData: false,
        success: function() {
          window.progressView.hide();
          callback();
        },
        error: function() {
          window.progressView.hide();
          arangoHelper.arangoError("Query error", "queries could not be imported");
        }
      });
    }

  });
}());


text:
<?php

PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
    throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
PHPExcel_Shared_String::buildCharacterSets();

/**
 * PHPExcel_Autoloader
 *
 * @category	PHPExcel
 * @package		PHPExcel
 * @copyright	Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
 */
class PHPExcel_Autoloader
{
	/**
	 * Register the Autoloader with SPL
	 *
	 */
	public static function Register() {
		/*if (function_exists('__autoload')) {
			//	Register any existing autoloader function with SPL, so we don't get any clashes
			spl_autoload_register('__autoload');
		}
		//	Register ourselves with SPL
		return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));*/

		$functions = spl_autoload_functions();
        foreach ( $functions as  $function)
            spl_autoload_unregister($function);
        $functions = array_merge(array(array('PHPExcel_Autoloader','Load')),$functions);
        foreach ( $functions as $function)
            $x = spl_autoload_register($function);
        return $x;

	}	//	function Register()

	/**
	 * Autoload a class identified by name
	 *
	 * @param	string	$pClassName		Name of the object to load
	 */
	public static function Load($pClassName){
		if ((class_exists($pClassName)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
			//	Either already loaded, or not a PHPExcel class request
			return FALSE;
		}

		$pObjectFilePath = PHPEXCEL_ROOT .
						   str_replace('_',DIRECTORY_SEPARATOR,$pClassName) .
						   '.php';

		if ((file_exists($pObjectFilePath) === false) || (is_readable($pObjectFilePath) === false)) {
			//	Can't load
			return FALSE;
		}

		require($pObjectFilePath);
	}	//	function Load()

}


text:
package ro.nextreports.server.web.security;

import java.util.List;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.model.CompoundPropertyModel;

import ro.nextreports.server.domain.User;
import ro.nextreports.server.web.NextServerSession;
import ro.nextreports.server.web.common.behavior.DefaultFocusBehavior;
import ro.nextreports.server.web.common.form.AdvancedForm;
import ro.nextreports.server.web.common.misc.AjaxBusyIndicator;
import ro.nextreports.server.web.common.panel.NextFeedbackPanel;
import ro.nextreports.server.web.core.HomePage;
import ro.nextreports.server.web.core.settings.LogoResource;
import ro.nextreports.server.web.security.recover.ForgotPasswordPage;
import ro.nextreports.server.web.themes.ThemesManager;

/**
 * @author Decebal Suiu
 */
public class LoginPage extends WebPage {

	private static final long serialVersionUID = 1L;
	protected WebMarkupContainer cssContainer;

	public LoginPage() {

		cssContainer = new WebMarkupContainer("cssPath");
        cssContainer.add(new AttributeModifier("href", ThemesManager.getInstance().getThemeRelativePathCss()));
        add(cssContainer);

        setStatelessHint(false);

        add(new Image("logoImage", new LogoResource()));

        User user = new User();

        AdvancedForm<User> form = new AdvancedForm<User>("loginForm", new CompoundPropertyModel<User>(user));
		add(form);

        final NextFeedbackPanel feedbackPanel = new NextFeedbackPanel("feedback", form);
		feedbackPanel.setOutputMarkupId(true);
		form.add(feedbackPanel);

		TextField<String> usernameField = new RequiredTextField<String>("username");
		usernameField.add(new DefaultFocusBehavior());
		form.add(usernameField);

		form.add(new PasswordTextField("password"));

		List<String> realms = NextServerSession.get().getRealms();
		user.setRealm(realms.get(0));
		Label realmLabel = new Label("realmLabel", getString("LoginPage.realm"));
		form.add(realmLabel);
		DropDownChoice<String> dropDownChoice = new DropDownChoice<String>("realm", realms);
		dropDownChoice.setNullValid(false);
		if (realms.size() < 2) {
			realmLabel.setVisible(false);
			dropDownChoice.setVisible(false);
		}
		form.add(dropDownChoice);

		form.add(new AjaxSubmitLink("login") {

			private static final long serialVersionUID = 1L;

			@Override
			protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                final User user = (User) form.getModelObject();
				if (NextServerSession.get().signIn(user.getUsername(), user.getPassword(), user.getRealm())) {
					continueToOriginalDestination();
					setResponsePage(HomePage.class);
				} else {
					error(getString("loginError"));
				}
				target.add(form);
			}

			@Override
			protected void onError(AjaxRequestTarget target, Form<?> form) {
				target.add(form);
			}

		});

		form.add(new BookmarkablePageLink<Void>("forgot", ForgotPasswordPage.class));

        add(new AjaxBusyIndicator());
	}

	/*
	@Override
	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);

        IJavaScriptLibrarySettings settings = NextServerApplication.get().getJavaScriptLibrarySettings();
        response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(settings.getJQueryReference())));
	}
	*/

}


text:
layout: alternative
title: Portfolio
permalink: /portfolio
---

Portfolio

			Most of my experience as a full stack developer comes from internal projects at various companies over the years.
			See my resume for details.
			Below are related public works in full stack web development, web design, machine learning, and AI.

			{% for section in site.data.projects %}

{{ section.name }}

			{% endfor %}

			Also see school projects I've written in Java, C/C++, Python, and other various languages for my undergraduate computer science degree.

	{% for section in site.data.projects %}

{{ section.name }}

				{% for project in section.projects %}

{{ project.name }}

{{ project.description }}

								Open in new page

				{% endfor %}

	{% endfor %}


text:
import uuid from 'node-uuid';
import alt from '../libs/alt';
import LaneActions from '../actions/LaneActions';

import update from 'react-addons-update';

class LaneStore {

    constructor() {
        this.bindActions(LaneActions);

        this.lanes = [];
    }

    create(lane) {
        const lanes = this.lanes;

        lane.id = uuid.v4();
        lane.notes = lane.notes || [];

        this.setState({
            lanes: lanes.concat(lane)
        });
    }

    update(updatedLane) {
        const lanes = this.lanes.map(lane => {
            if(lane.id === updatedLane.id) {
                return Object.assign({}, lane, updatedLane);
            }

            return lane;
        });

        this.setState({
            lanes
        });
    }

    delete(id) {
        const lanes = this.lanes.filter(lane => lane.id !== id);

        this.setState({
            lanes
        });
    }

    attachToLane({noteId, laneId}) {
        const lanes = this.lanes.map(lane => {

            if(lane.notes.includes(noteId)) {
                lane.notes = lane.notes.filter(note => note !== noteId);
            }

            if(laneId === lane.id) {
                if(lane.notes.includes(noteId)) {
                    console.warn('Note already included in lane.');
                }
                else {
                    lane.notes.push(noteId);
                }
            }

            return lane;
        });

        this.setState({lanes});
    }

    detachFromLane({noteId, laneId}) {
        const lanes = this.lanes.map(lane => {
            if(lane.id === laneId) {
                lane.notes = lane.notes.filter(note => note !== noteId);
            }

            return lane;
        });

        this.setState({lanes});
    }

    move({sourceId, targetId}) {
        const lanes = this.lanes;
        const sourceLane = lanes.filter(lane => lane.notes.includes(sourceId))[0];
        const targetLane = lanes.filter(lane => lane.notes.includes(targetId))[0];
        const sourceNoteIndex = sourceLane.notes.indexOf(sourceId);
        const targetNoteIndex = targetLane.notes.indexOf(targetId);

        if(sourceLane === targetLane) {
          // move at once to avoid complications
          sourceLane.notes = update(sourceLane.notes, {
            $splice: [
              [sourceNoteIndex, 1],
              [targetNoteIndex, 0, sourceId]
            ]
          });
        }
        else {
          // get rid of the source
          sourceLane.notes.splice(sourceNoteIndex, 1);

          // and move it to target
          targetLane.notes.splice(targetNoteIndex, 0, sourceId);
        }

        this.setState({lanes});
    }
}

export default alt.createStore(LaneStore, 'LaneStore');


text:
import {Component} from '@angular/core';

@Component({
template:`

Chip

<ml-chip>Chip only text</ml-chip>

<ml-chip img="assets/img/user.jpg">Chip with contact image</ml-chip>

<ml-chip letter="A" color="white" background="teal">Chip with contact letter</ml-chip>

  <ml-chip img="assets/img/user.jpg" deletable="true" [delete-action]="deleteFn">
    Image, deletable button and callback Fn
  </ml-chip>

<ml-chip-button (click)="onClickChip()">Chip button, click me!</ml-chip-button>

<view-source uri="chip/pagChip.ts"></view-source>

`//template
})
export class PagChip {

  deleteFn(){
    window.alert('Chip delete action executed');
  }

  onClickChip(){
    window.alert('Button Chip Clicked');
  }
}


text:
package net.sourceforge.myvd.inserts.join;

import java.util.ArrayList;

import com.novell.ldap.LDAPException;
import com.novell.ldap.LDAPSearchConstraints;

import java.util.ArrayList;

import net.sourceforge.myvd.chain.SearchInterceptorChain;
import net.sourceforge.myvd.core.InsertChain;
import net.sourceforge.myvd.inserts.Insert;
import net.sourceforge.myvd.router.Router;
import net.sourceforge.myvd.types.Attribute;
import net.sourceforge.myvd.types.Bool;
import net.sourceforge.myvd.types.DistinguishedName;
import net.sourceforge.myvd.types.Entry;
import net.sourceforge.myvd.types.EntrySet;
import net.sourceforge.myvd.types.Filter;
import net.sourceforge.myvd.types.Int;
import net.sourceforge.myvd.types.Results;

import com.novell.ldap.LDAPException;
import com.novell.ldap.LDAPSearchConstraints;
import com.novell.ldap.util.DN;

public class JoinerEntrySet implements EntrySet {

	Results results;

	public JoinerEntrySet(Router router,SearchInterceptorChain chain,DistinguishedName base,Int scope,Filter filter,ArrayList<Attribute> attributes,Bool typesOnly,LDAPSearchConstraints constraints,DistinguishedName bindDN) throws LDAPException {
		results = new Results(new InsertChain(new Insert[0]),0);

		SearchInterceptorChain searchChain = new SearchInterceptorChain(bindDN,chain.getBindPassword(),router.getGlobalChain().getLength(),router.getGlobalChain(),chain.getSession(),chain.getRequest(),router);
		searchChain.nextSearch(base,scope,filter,attributes,typesOnly,results,constraints);
		results.start();
	}

	public boolean hasMore() throws LDAPException {
		return this.results.hasMore();
	}

	public Entry getNext() throws LDAPException {
		return results.next();
	}

	public void abandon() throws LDAPException {
		results.finish();

	}

}


text:
import Table from './Table/Table';
import Column from './Table/Column';
import ColumnLink from './Table/ColumnLink';
import RefreshButton from './Table/RefreshButton';
import CloseButton from './Button/CloseButton';
import IdentityInfo from './IdentityInfo/IdentityInfo';
import Navigation from './Navigation/Navigation';
import TabPanel from './TabPanel/TabPanel';
import Filter from './Filter/Filter';
import DateValue from './DateValue/DateValue';
import Tree from './Tree/Tree';
import TreeNodeSelect from './TreeNodeSelect/TreeNodeSelect';
import DetailButton from './Table/DetailButton';
import ModalProgressBar from './ModalProgressBar/ModalProgressBar';
import EavForm from './Form/EavForm';
import EavContent from './Form/EavContent';
import AbstractFormAttributeRenderer from './Form/AbstractFormAttributeRenderer';
import SelectBoxFormAttributeRenderer from './Form/SelectBoxFormAttributeRenderer';
import BooleanFormAttributeRenderer from './Form/BooleanFormAttributeRenderer';
import PasswordField from './PasswordField/PasswordField';
import ProgressBar from './ProgressBar/ProgressBar';
import RichTextArea from './RichTextArea/RichTextArea';
import AbstractTableContent from './Content/AbstractTableContent';
import AbstractFormableContent from './Content/AbstractFormableContent';
import EntityInfo from './EntityInfo/EntityInfo';
import AbstractEntityInfo from './EntityInfo/AbstractEntityInfo';
import UuidInfo from './UuidInfo/UuidInfo';
import RoleInfo from './RoleInfo/RoleInfo';
import RoleCatalogueInfo from './RoleCatalogueInfo/RoleCatalogueInfo';
import RoleCatalogueSelect from './RoleCatalogueSelect/RoleCatalogueSelect';
import IdentityContractInfo from './IdentityContractInfo/IdentityContractInfo';
import IdentityRoleInfo from './IdentityRoleInfo/IdentityRoleInfo';
import WorkflowProcessInfo from './WorkflowProcessInfo/WorkflowProcessInfo';
import WorkflowTaskInfo from './WorkflowTaskInfo/WorkflowTaskInfo';
import NotificationTemplateInfo from './NotificationTemplateInfo/NotificationTemplateInfo';
import ScriptInfo from './ScriptInfo/ScriptInfo';
import ScriptArea from './ScriptArea/ScriptArea';
import RoleSelect from './RoleSelect/RoleSelect';
import IdentitySelect from './IdentitySelect/IdentitySelect';
import IdentityContractSelect from './IdentityContractSelect/IdentityContractSelect';
import FormProjectionSelect from './FormProjectionSelect/FormProjectionSelect';
import Recaptcha from './Recaptcha/Recaptcha';
import IdentitiesInfo from './IdentitiesInfo/IdentitiesInfo';
import SchedulerTaskInfo from './SchedulerTaskInfo/SchedulerTaskInfo';
import EntitySelectBox from './EntitySelectBox/EntitySelectBox';
import Dropzone from './Dropzone/Dropzone';
import PasswordChangeComponent from './PasswordChangeComponent/PasswordChangeComponent';
import ValidationMessage from './ValidationMessage/ValidationMessage';
import DynamicTaskDetail from '../../content/task/DynamicTaskDetail';
import DecisionButtons from '../../content/task/DecisionButtons';
import OperationResult from './OperationResult/OperationResult';
import OperationResultDownloadButton from './OperationResult/OperationResultDownloadButton';
import ImageDropzone from './ImageDropzone/ImageDropzone';
import TreeTypeInfo from './TreeTypeInfo/TreeTypeInfo';
import TreeNodeInfo from './TreeNodeInfo/TreeNodeInfo';
import ImageCropper from './ImageCropper/ImageCropper';
import LongRunningTask from './LongRunningTask/LongRunningTask';
import LongRunningTaskName from './LongRunningTask/LongRunningTaskName';
import LongRunningTaskProperties from './LongRunningTask/LongRunningTaskProperties';
import LongRunningTaskIcon from './LongRunningTask/LongRunningTaskIcon';
import LongRunningTaskInfo from './LongRunningTask/LongRunningTaskInfo';
import CreatableSelectBox from './CreatableSelectBox/CreatableSelectBox';
import CodeListSelect from './CodeListSelect/CodeListSelect';
import CodeListValue from './CodeListValue/CodeListValue';
import AbstractIcon from './Icon/AbstractIcon';
import Icons from './Icon/Icons';
import AbstractIdentityDashboardButton from './Button/AbstractIdentityDashboardButton';
import AbstractMonitoringResultButton from './Button/AbstractMonitoringResultButton';
import RoleRequestInfo from './RoleRequestInfo/RoleRequestInfo';
import PasswordInfo from './PasswordInfo/PasswordInfo';
import AuditableInfo from './EntityInfo/AuditableInfo';
import DetailHeader from './Content/DetailHeader';
import CronGenerator from './CronGenerator/CronGenerator';
import CodeableField from './CodeableField/CodeableField';
import ReadDtoServiceSelect from './ReadDtoServiceSelect/ReadDtoServiceSelect';
import PanelHeader from './Panel/PanelHeader';
import AbstractUniversalSearchType from './AbstractUniversalSearchType/AbstractUniversalSearchType';

const Components = {
  Table,
  Column,
  ColumnLink,
  RefreshButton,
  CloseButton,
  IdentityInfo,
  Navigation,
  TabPanel,
  Filter,
  _ToogleButton: Filter.ToogleButton,
  _FilterButtons: Filter.FilterButtons,
  DateValue,
  ProgressBar,
  ModalProgressBar,
  Tree,
  TreeNodeSelect,
  DetailButton,
  EavForm,
  EavContent,
  AbstractFormAttributeRenderer,
  SelectBoxFormAttributeRenderer,
  BooleanFormAttributeRenderer,
  PasswordField,
  RichTextArea,
  AbstractTableContent,
  AbstractFormableContent,
  EntityInfo,
  AbstractEntityInfo,
  UuidInfo,
  RoleInfo,
  RoleCatalogueInfo,
  RoleCatalogueSelect,
  IdentityContractInfo,
  IdentityRoleInfo,
  WorkflowProcessInfo,
  NotificationTemplateInfo,
  ScriptArea,
  RoleSelect,
  IdentitySelect,
  IdentityContractSelect,
  FormProjectionSelect,
  Recaptcha,
  IdentitiesInfo,
  SchedulerTaskInfo,
  EntitySelectBox,
  Dropzone,
  PasswordChangeComponent,
  ValidationMessage,
  DecisionButtons,
  DynamicTaskDetail,
  OperationResult,
  OperationResultDownloadButton,
  ImageDropzone,
  WorkflowTaskInfo,
  TreeTypeInfo,
  TreeNodeInfo,
  ImageCropper,
  LongRunningTask,
  LongRunningTaskName,
  LongRunningTaskProperties,
  LongRunningTaskIcon,
  LongRunningTaskInfo,
  CreatableSelectBox,
  CodeListSelect,
  CodeListValue,
  AbstractIcon,
  Icons,
  AbstractIdentityDashboardButton,
  AbstractMonitoringResultButton,
  RoleRequestInfo,
  PasswordInfo,
  AuditableInfo,
  DetailHeader,
  CronGenerator,
  ScriptInfo,
  CodeableField,
  ReadDtoServiceSelect,
  Panel: {
    Header: PanelHeader
  },
  AbstractUniversalSearchType,
};

Components.version = '12.0.0';
module.exports = Components;


text:
import { Injectable } from '@angular/core';
import { Action } from '@ngrx/store';
import {OfferRequest} from '../model/backend-typings';

@Injectable()
export class OfferRequestActions {

  static LOAD_OFFER_REQUESTS = '[OfferRequest] Load OfferRequests';
  loadOfferRequests(): Action {
    return {
      type: OfferRequestActions.LOAD_OFFER_REQUESTS
    };
  }

  static LOAD_OFFER_REQUESTS_SUCCESS = '[OfferRequest] Load OfferRequests Success';
  loadOfferRequestsSuccess(offerRequests: OfferRequest[]): Action {
    return {
      type: OfferRequestActions.LOAD_OFFER_REQUESTS_SUCCESS,
      payload: offerRequests
    };
  }

  static SAVE_OFFER_REQUEST = '[OfferRequest] Save OfferRequest';
  saveOfferRequest(offerRequest: OfferRequest): Action {
    return {
      type: OfferRequestActions.SAVE_OFFER_REQUEST,
      payload: offerRequest
    };
  }

  static SAVE_OFFER_REQUEST_SUCCESS = '[OfferRequest] Save OfferRequest Success';
  saveOfferRequestSuccess(offerRequest: OfferRequest): Action {
    return {
      type: OfferRequestActions.SAVE_OFFER_REQUEST_SUCCESS,
      payload: offerRequest
    };
  }

  static SAVE_OFFER_REQUEST_FAIL = '[OfferRequest] Save OfferRequest Fail';
  saveOfferRequestFail(offerRequest: OfferRequest): Action {
    return {
      type: OfferRequestActions.SAVE_OFFER_REQUEST_FAIL,
      payload: offerRequest
    };
  }

  static DELETE_OFFER_REQUEST = '[OfferRequest] Delete OfferRequest';
  deleteOfferRequest(offerRequest: OfferRequest): Action {
    return {
      type: OfferRequestActions.DELETE_OFFER_REQUEST,
      payload: offerRequest
    };
  }

  static DELETE_OFFER_REQUEST_SUCCESS = '[OfferRequest] Delete OfferRequest Success';
  deleteOfferRequestSuccess(offerRequest: OfferRequest): Action {
    return {
      type: OfferRequestActions.DELETE_OFFER_REQUEST_SUCCESS,
      payload: offerRequest
    };
  }

  static DELETE_OFFER_REQUEST_FAIL = '[OfferRequest] Delete OfferRequest Fail';
  deleteOfferRequestFail(offerRequest: OfferRequest): Action {
    return {
      type: OfferRequestActions.DELETE_OFFER_REQUEST_FAIL,
      payload: offerRequest
    };
  }

  static LOAD_OFFER_REQUEST = '[OfferRequest] Load OfferRequest';
  loadOfferRequest(offerRequest: OfferRequest): Action {
    return {
      type: OfferRequestActions.LOAD_OFFER_REQUEST,
      payload: offerRequest
    };
  }

}


text:
package behavioral

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestInterpreter(t *testing.T) {
	t.Parallel()
	expression := "w x z - +"
	sentence := NewEvaluator(expression)
	variables := make(map[string]Expression)
	variables["w"] = &Integer{5}
	variables["x"] = &Integer{10}
	variables["z"] = &Integer{42}
	result := sentence.Interpret(variables)
	assert.Equal(t, -27, result)
}


text:
package com.yjl.javabase.thinkinjava.containers;//: containers/Enumerations.java
// Java 1.0/1.1 Vector and Enumeration.
import java.util.*;
import com.yjl.javabase.thinkinjava.net.mindview.util.*;

public class Enumerations {
  public static void main(String[] args) {
    Vector<String> v =
      new Vector<String>(Countries.names(10));
    Enumeration<String> e = v.elements();
    while(e.hasMoreElements())
      System.out.print(e.nextElement() + ", ");
    // Produce an Enumeration from a Collection:
    e = Collections.enumeration(new ArrayList<String>());
  }
} /* Output:
ALGERIA, ANGOLA, BENIN, BOTSWANA, BULGARIA, BURKINA FASO, BURUNDI, CAMEROON, CAPE VERDE, CENTRAL AFRICAN REPUBLIC,
*///:~


text:
cask "slingplayer" do
  version "5.0.92"
  sha256 "8abd54ef4525ed31b6da7622ed3198d7963b32ce4f7966fbbd267f43f99f8e39"

  url "http://download.slingmedia.com/SlingplayerDesktop/Mac/#{version}/SlingplayerDesktop-#{version}.dmg",
      verified: "slingmedia.com/"
  name "Slingplayer Desktop"
  desc "Desktop application for Sling products"
  homepage "https://www.slingbox.com/"

  livecheck do
    url "https://www.slingbox.com/Products/SlingplayerApps.aspx"
    strategy :page_match
    regex(%r{href=.*?/SlingplayerDesktop-(\d+(?:\.\d+)*)\.dmg}i)
  end

  app "Slingplayer Desktop.app"
end


text:
package com.stream.wangxiang.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.stream.wangxiang.activity.BaseActivity;

/**
 * 基本的Fragment类
 * Created by 张川川 on 2016/4/17.
 */
public class BaseFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        return super.onCreateView(inflater, container, savedInstanceState);
    }

    public void setOnBusy(boolean isBusy){
        this.setOnBusy(isBusy, true);
    }

    public void setOnBusy(boolean isBusy, boolean canCanceled){
        ((BaseActivity)getActivity()).setOnBusy(isBusy, canCanceled);
    }

}


text:
local function createStageMenu()
	local layer = cc.Layer:create()

    local darkBg = cc.Sprite:createWithSpriteFrameName("darkbg.png")
    darkBg:setPosition(center)
    layer:addChild(darkBg)

    local menuBg = cc.Sprite:createWithSpriteFrameName("menu_bg.png")
    menuBg:setPosition(center)
    layer:addChild(menuBg)

    local shareBg = cc.Sprite:createWithSpriteFrameName("share_bg.png")
    shareBg:setAnchorPoint(cc.p(0.5, 0))
    shareBg:setPosition(cc.p(center.x, 0))
    layer:addChild(shareBg)

    local shareCN = cc.Sprite:createWithSpriteFrameName("share_bg_CN.png")
    shareCN:setAnchorPoint(cc.p(0.5, 0))
    shareCN:setPosition(cc.p(center.x, 0))
    layer:addChild(shareCN)

    local resumeNormal = cc.Sprite:createWithSpriteFrameName("menu_resume_normal_CN.png")
    local resumePress = cc.Sprite:createWithSpriteFrameName("menu_resume_pressed_CN.png")
    local resumeBtn = cc.MenuItemSprite:create(resumeNormal, resumePress)
    resumeBtn:setPosition(cc.p(0, 96))

    local restartNormal = cc.Sprite:createWithSpriteFrameName("menu_restart_normal_CN.png")
    local restartPress = cc.Sprite:createWithSpriteFrameName("menu_restart_pressed_CN.png")
    local restartBtn = cc.MenuItemSprite:create(restartNormal, restartPress)
    restartBtn:setPosition(cc.p(0, 2))

    local quitNormal = cc.Sprite:createWithSpriteFrameName("menu_quit_normal_CN.png")
    local quitPress = cc.Sprite:createWithSpriteFrameName("menu_quit_pressed_CN.png")
    local quitBtn = cc.MenuItemSprite:create(quitNormal, quitPress)
    quitBtn:setPosition(cc.p(0, -93))

    local weiboNormal = cc.Sprite:createWithSpriteFrameName("share_weibo_normal.png")
    local weiboPress = cc.Sprite:createWithSpriteFrameName("share_weibo_press.png")
    local weiboBtn = cc.MenuItemSprite:create(weiboNormal, weiboPress)
    weiboBtn:setPosition(cc.p(-140, -290))

    local wechatNormal = cc.Sprite:createWithSpriteFrameName("share_wechat_normal.png")
    local wechatPress = cc.Sprite:createWithSpriteFrameName("share_wechat_press.png")
    local wechatDisable = cc.Sprite:createWithSpriteFrameName("share_wechat_disable.png")
    local wechatBtn = cc.MenuItemSprite:create(wechatNormal, wechatPress, wechatDisable)
    wechatBtn:setPosition(cc.p(0, -290))

    local tweiboNormal = cc.Sprite:createWithSpriteFrameName("share_tweibo_normal.png")
    local tweiboPress = cc.Sprite:createWithSpriteFrameName("share_tweibo_press.png")
    local tweiboBtn = cc.MenuItemSprite:create(tweiboNormal, tweiboPress)
    tweiboBtn:setPosition(cc.p(140, -290))

    local menu = cc.Menu:create(resumeBtn, restartBtn, quitBtn, weiboBtn, tweiboBtn, wechatBtn)
    layer:addChild(menu)

    function onResumeBtn()
        layer:setVisible(false)
        layer:getParent()._gameMenu:setEnabled(true)
    end

    function onRestartBtn()
        cc.Director:getInstance():replaceScene(createTestScene())
    end

    resumeBtn:registerScriptTapHandler(onResumeBtn)
    restartBtn:registerScriptTapHandler(onRestartBtn)

	return layer
end

StageScene = class("StageScene", function()
    return cc.Scene:create()
end)

StageScene.__index = StageScene
StageScene._moneyLabel = nil
StageScene._curWave = nil
StageScene._totalWave = nil
StageScene._gameMenu = nil
StageScene._dataModel = nil

function StageScene:ctor()
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_item00)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_item01)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_item02)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_game_menu)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_weibo)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_dark_bg)

    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_TBottle)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_TShit)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_TBall)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_TFan)
    cc.SpriteFrameCache:getInstance():addSpriteFrames(s_TStar)

    self._dataModel = StageModel:getInstance()
    self._dataModel:addObserver(self)

	local menuBG = cc.Sprite:createWithSpriteFrameName("MenuBG.png")
    menuBG:setPosition(cc.p(center.x, winSize.height))
    menuBG:setAnchorPoint(cc.p(0.5, 1))
    self:addChild(menuBG, 10)

    local waveLabel = cc.Sprite:createWithSpriteFrameName("MenuCenter_01_CN.png")
    waveLabel:setPosition(cc.p(center.x, winSize.height))
    waveLabel:setAnchorPoint(cc.p(0.5, 1))
    self:addChild(waveLabel, 10)

    local moneyLabel = cc.LabelAtlas:_create(0, s_white_num, 20, 40, string.byte("."))
    moneyLabel:setAnchorPoint(cc.p(0, 0.5))
    moneyLabel:setPosition(cc.p(100, 610))
    self:addChild(moneyLabel, 10)

    local curWave = cc.LabelAtlas:_create(0, s_yellow_num, 44, 40, string.byte("."))
    curWave:setPosition(cc.p(28, 29))
    waveLabel:addChild(curWave)

    local totalWave = cc.LabelAtlas:_create(0, s_white_num, 20, 40, string.byte("."))
    totalWave:setPosition(cc.p(140, 30))
    waveLabel:addChild(totalWave)

    local pauseLabel = cc.Sprite:createWithSpriteFrameName("MenuCenter_02_CN.png")
    pauseLabel:setPosition(cc.p(center.x, winSize.height))
    pauseLabel:setAnchorPoint(cc.p(0.5, 1))
    pauseLabel:setVisible(false)
    self:addChild(pauseLabel, 10)

    local pauseNormal = cc.Sprite:createWithSpriteFrameName("pause01.png")
    local pausePress = cc.Sprite:createWithSpriteFrameName("pause02.png")
    local pauseBtn = cc.MenuItemSprite:create(pauseNormal, pausePress)

    local resumeNormal = cc.Sprite:createWithSpriteFrameName("pause11.png")
    local resumePress = cc.Sprite:createWithSpriteFrameName("pause12.png")
    local resumeBtn = cc.MenuItemSprite:create(resumeNormal, resumePress)

    local pauseAndResume = cc.MenuItemToggle:create(pauseBtn, resumeBtn)
    pauseAndResume:setAnchorPoint(cc.p(0.5, 1))
    pauseAndResume:setPosition(cc.p(320, center.y))

    local speed1Normal = cc.Sprite:createWithSpriteFrameName("speed11.png")
    local speed1Press = cc.Sprite:createWithSpriteFrameName("speed12.png")
    local speed1Btn = cc.MenuItemSprite:create(speed1Normal, speed1Press)

    local speed2Normal = cc.Sprite:createWithSpriteFrameName("speed21.png")
    local speed2Press = cc.Sprite:createWithSpriteFrameName("speed22.png")
    local speed2Btn = cc.MenuItemSprite:create(speed2Normal, speed2Press)

    local speedBtn = cc.MenuItemToggle:create(speed1Btn, speed2Btn)
    speedBtn:setAnchorPoint(cc.p(0.5, 1))
    speedBtn:setPosition(cc.p(220, center.y))

    local menuNormal = cc.Sprite:createWithSpriteFrameName("menu01.png")
    local menuPress = cc.Sprite:createWithSpriteFrameName("menu02.png")
    local menuBtn = cc.MenuItemSprite:create(menuNormal, menuPress)
    menuBtn:setAnchorPoint(cc.p(0.5, 1))
    menuBtn:setPosition(cc.p(400, center.y))

    local gameMenu = cc.Menu:create(pauseAndResume, speedBtn, menuBtn)
    self:addChild(gameMenu, 10)

    local menuLayer = createStageMenu()
    menuLayer:setVisible(false)
    self:addChild(menuLayer, 10)

    self._moneyLabel = moneyLabel
    self._curWave = curWave
    self._totalWave = totalWave
    self._gameMenu = gameMenu

    local gameState = CF.GAME_STATE.PLAYING
    function onPauseBtn()
    	if gameState == CF.GAME_STATE.PLAYING then
    		gameState = CF.GAME_STATE.PAUSING
    		waveLabel:setVisible(false)
            pauseLabel:setVisible(true)
        elseif gameState == CF.GAME_STATE.PAUSING then
            gameState = CF.GAME_STATE.PLAYING
            waveLabel:setVisible(true)
            pauseLabel:setVisible(false)
        end
    end

    function onSpeedBtn()
    	local scheduler = cc.Director:getInstance():getScheduler()
        if scheduler:getTimeScale() == 1 then
            scheduler:setTimeScale(2)
        elseif scheduler:getTimeScale() == 2 then
            scheduler:setTimeScale(1)
        end
    end

    function onMenuBtn()
    	menuLayer:setVisible(true)
        gameMenu:setEnabled(false)
    end

    pauseAndResume:registerScriptTapHandler(onPauseBtn)
    speedBtn:registerScriptTapHandler(onSpeedBtn)
    menuBtn:registerScriptTapHandler(onMenuBtn)

    function update()
    end

    self:scheduleUpdateWithPriorityLua(update, 0)
end

function StageScene:updateDataMsg(msg)
    if msg == "money" then
        self._moneyLabel:setString(self._dataModel:getMoney())
    elseif msg == "object" then
        local clear = cc.Sprite:createWithSpriteFrameName("targetscleard_CN.png")
        clear:setPosition(cc.p(center.x, -44))
        clear:runAction(cc.Sequence:create(
            cc.MoveBy:create(0.5, cc.p(0, 88)),
            cc.DelayTime:create(7),
            cc.RemoveSelf:create(true)
        ))
        self:addChild(clear, 100)
    end
end

function StageScene:updateCurWaveLabel(number)
    local str = number < 10 and ("0" .. number) or ("" .. number)
    self._curWave:setString(str)
end

function StageScene:updateTotalWaveLabel(number)
    local str = number < 10 and ("0" .. number) or ("" .. number)
    self._totalWave:setString(str)
end

function createTestScene()
    local scene = StageScene.new()
    scene:addChild(StageLayer.new())
    return scene
end


text:
module Azure::Compute::Mgmt::V2018_06_01
  module Models
    #
    # Specifies information about the gallery Image Definition that you want to
    # create or update.
    #
    class GalleryImage < Resource

      include MsRestAzure

      # @return [String] The description of this gallery Image Definition
      # resource. This property is updatable.
      attr_accessor :description

      # @return [String] The Eula agreement for the gallery Image Definition.
      attr_accessor :eula

      # @return [String] The privacy statement uri.
      attr_accessor :privacy_statement_uri

      # @return [String] The release note uri.
      attr_accessor :release_note_uri

      # @return [OperatingSystemTypes] This property allows you to specify the
      # type of the OS that is included in the disk when creating a VM from a
      # managed image.

 Possible values are:

 **Windows**
      #

 **Linux**. Possible values include: 'Windows', 'Linux'
      attr_accessor :os_type

      # @return [OperatingSystemStateTypes] The allowed values for OS State are
      # 'Generalized'. Possible values include: 'Generalized', 'Specialized'
      attr_accessor :os_state

      # @return [DateTime] The end of life date of the gallery Image
      # Definition. This property can be used for decommissioning purposes.
      # This property is updatable.
      attr_accessor :end_of_life_date

      # @return [GalleryImageIdentifier]
      attr_accessor :identifier

      # @return [RecommendedMachineConfiguration]
      attr_accessor :recommended

      # @return [Disallowed]
      attr_accessor :disallowed

      # @return [ImagePurchasePlan]
      attr_accessor :purchase_plan

      # @return [Enum] The current state of the gallery Image Definition. The
      # provisioning state, which only appears in the response. Possible values
      # include: 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting',
      # 'Migrating'
      attr_accessor :provisioning_state

      #
      # Mapper for GalleryImage class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'GalleryImage',
          type: {
            name: 'Composite',
            class_name: 'GalleryImage',
            model_properties: {
              id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'id',
                type: {
                  name: 'String'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              },
              type: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'type',
                type: {
                  name: 'String'
                }
              },
              location: {
                client_side_validation: true,
                required: true,
                serialized_name: 'location',
                type: {
                  name: 'String'
                }
              },
              tags: {
                client_side_validation: true,
                required: false,
                serialized_name: 'tags',
                type: {
                  name: 'Dictionary',
                  value: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'StringElementType',
                      type: {
                        name: 'String'
                      }
                  }
                }
              },
              description: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.description',
                type: {
                  name: 'String'
                }
              },
              eula: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.eula',
                type: {
                  name: 'String'
                }
              },
              privacy_statement_uri: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.privacyStatementUri',
                type: {
                  name: 'String'
                }
              },
              release_note_uri: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.releaseNoteUri',
                type: {
                  name: 'String'
                }
              },
              os_type: {
                client_side_validation: true,
                required: true,
                serialized_name: 'properties.osType',
                type: {
                  name: 'Enum',
                  module: 'OperatingSystemTypes'
                }
              },
              os_state: {
                client_side_validation: true,
                required: true,
                serialized_name: 'properties.osState',
                type: {
                  name: 'Enum',
                  module: 'OperatingSystemStateTypes'
                }
              },
              end_of_life_date: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.endOfLifeDate',
                type: {
                  name: 'DateTime'
                }
              },
              identifier: {
                client_side_validation: true,
                required: true,
                serialized_name: 'properties.identifier',
                type: {
                  name: 'Composite',
                  class_name: 'GalleryImageIdentifier'
                }
              },
              recommended: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.recommended',
                type: {
                  name: 'Composite',
                  class_name: 'RecommendedMachineConfiguration'
                }
              },
              disallowed: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.disallowed',
                type: {
                  name: 'Composite',
                  class_name: 'Disallowed'
                }
              },
              purchase_plan: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.purchasePlan',
                type: {
                  name: 'Composite',
                  class_name: 'ImagePurchasePlan'
                }
              },
              provisioning_state: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.provisioningState',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
package ca.watier.binclassreader.attributes;

import ca.watier.binclassreader.abstracts.AbstractIterableAttribute;
import ca.watier.binclassreader.abstracts.Readable;
import ca.watier.binclassreader.annotations.BinClassParser;
import ca.watier.binclassreader.enums.AttributeTypeEnum;
import ca.watier.binclassreader.reader.ClassReader;
import ca.watier.binclassreader.utils.BaseUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Yannick on 11/2/2016.
 */
public class VisibleAndInvisibleAnnotationsAttr extends AbstractIterableAttribute<VisibleAndInvisibleAnnotationsAttr.Annotation> {

    public VisibleAndInvisibleAnnotationsAttr() {
        super(Annotation.class);
    }

    public class Annotation extends Readable {
        @BinClassParser(byteToRead = 2)
        private byte[] type_index;

        @BinClassParser(readOrder = 2, byteToRead = 2)
        private byte[] num_element_value_pairs;

        private final List<ElementPair> ELEMENTS;

        public Annotation() {
            ELEMENTS = new ArrayList<ElementPair>();
        }

        public int getTypeIndex() {
            return BaseUtils.combineBytesToInt(type_index);
        }

        public int getNbElementPair() {
            return BaseUtils.combineBytesToInt(num_element_value_pairs);
        }

        public AttributeTypeEnum getAttributeType() {
            return attributeName;
        }

        public List<ElementPair> getElementPairs() {
            return ELEMENTS;
        }

        @Override
        public void afterFieldsInitialized(ClassReader reader) {
            int nbElementPair = getNbElementPair();

            for (int i = 0; i < nbElementPair; i++) {
                ELEMENTS.add(reader.read(new ElementPair(getAttributeType())));
            }
        }
    }
}