text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;

namespace DebuggerTesting
{
    [DebuggerStepThrough]
    public static class Parameter
    {
        #region NotOfType

        /// <summary>
        /// Throws ArgumentException if the value is not of the specified type.
        /// </summary>
        public static void ThrowIfNotOfType<T>(object value, string paramName, bool allowNull = false)
        {
            AssertIfNotOfType<T>(value, paramName, allowNull);
            if (IsNotOfType<T>(value, allowNull))
                throw new ArgumentException(string.Empty, paramName);
        }

        /// <summary>
        /// Assert if the value is not of the specified type.
        /// </summary>
        [DebuggerHidden]
        [Conditional("DEBUG")]
        public static void AssertIfNotOfType<T>(object value, string paramName, bool allowNull = false)
        {
            if (IsNotOfType<T>(value, allowNull))
                ParameterAssert("Parameter {0} not of type {1}", paramName, typeof(T).Name);
        }

        public static void AssertIfNotOfType<T>(Type type, string paramName)
        {
            Parameter.AssertIfNull(type, paramName);
            if (!typeof(T).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
                ParameterAssert("Parameter {0} does not implement {1}", paramName, typeof(T).Name);
        }

        private static bool IsNotOfType<T>(object value, bool allowNull)
        {
            return (null == value && !allowNull) || (null != value && !(value is T));
        }

        #endregion

        #region NullOrWhiteSpace

        /// <summary>
        /// Throws ArgumentNullException if the value is null or is white space.
        /// </summary>
        public static void ThrowIfNullOrWhiteSpace(string value, string paramName)
        {
            AssertIfNullOrWhiteSpace(value, paramName);
            if (IsNullOrWhiteSpace(value))
                throw new ArgumentNullException(paramName);
        }

        /// <summary>
        /// Assert if the value is null or is white space.
        /// </summary>
        [DebuggerHidden]
        [Conditional("DEBUG")]
        public static void AssertIfNullOrWhiteSpace(string value, string paramName)
        {
            if (IsNullOrWhiteSpace(value))
                ParameterAssert("Parameter {0} is null or white space.", paramName);
        }

        private static bool IsNullOrWhiteSpace(string value)
        {
            return String.IsNullOrWhiteSpace(value);
        }

        #endregion

        #region Null

        /// <summary>
        /// Throws ArgumentNullException if the value is null.
        /// </summary>
        public static void ThrowIfNull<T>(T value, string paramName)
            where T : class
        {
            AssertIfNull(value, paramName);
            if (IsNull(value))
                throw new ArgumentNullException(paramName);
        }

        /// <summary>
        /// Assert if the value is null.
        /// </summary>
        [DebuggerHidden]
        [Conditional("DEBUG")]
        public static void AssertIfNull<T>(T value, string paramName)
            where T : class
        {
            if (IsNull(value))
                ParameterAssert("Parameter {0} is null.", paramName);
        }

        private static bool IsNull<T>(T value)
            where T : class
        {
            return null == value;
        }

        #endregion

        #region IsInvalid

        /// <summary>
        /// Throws ArgumentNullException if the value matches an invalid value.
        /// </summary>
        public static void ThrowIfIsInvalid<T>(T value, T invalidValue, string paramName)
            where T : struct
        {
            AssertIfIsInvalid(value, invalidValue, paramName);
            if (IsInvalid(value, invalidValue))
                throw new ArgumentNullException(paramName);
        }

        /// <summary>
        /// Assert if the value matches an invalid value.
        /// </summary>
        [DebuggerHidden]
        [Conditional("DEBUG")]
        public static void AssertIfIsInvalid<T>(T value, T invalidValue, string paramName)
            where T : struct
        {
            if (IsInvalid(value, invalidValue))
                ParameterAssert("Parameter {0} is invalid value.", paramName);
        }

        private static bool IsInvalid<T>(T value, T invalidValue)
        {
            return object.Equals(value, invalidValue);
        }

        #endregion

        #region OutOfRange

        /// <summary>
        /// Throw ArgumentOutOfRangeException if value is not between minValue and maxValue inclusively.
        /// </summary>
        public static void ThrowIfOutOfRange(int value, int minValue, int maxValue, string paramName)
        {
            AssertIfOutOfRange(value, minValue, maxValue, paramName);
            if (IsOutOfRange(value, minValue, maxValue))
                throw new ArgumentOutOfRangeException(paramName);
        }

        /// <summary>
        /// Assert if value is not between minValue and maxValue inclusively.
        /// </summary>
        [DebuggerHidden]
        [Conditional("DEBUG")]
        public static void AssertIfOutOfRange(int value, int minValue, int maxValue, string paramName)
        {
            if (IsOutOfRange(value, minValue, maxValue))
                ParameterAssert("Parameter {0} is out of range. Should be between {1} and {2}.", paramName, minValue, maxValue);
        }

        private static bool IsOutOfRange(int value, int minValue, int maxValue)
        {
            return value < minValue || value > maxValue;
        }

        #endregion

        #region NotPositive

        /// <summary>
        /// Throws ArgumentOutOfRangeException if the value is not a negative or zero.
        /// </summary>
        public static void ThrowIfNegativeOrZero(int value, string paramName)
        {
            AssertIfNegativeOrZero(value, paramName);
            if (IsNegativeOrZero(value))
                throw new ArgumentOutOfRangeException(paramName);
        }

        /// <summary>
        /// Assert if the value is not a negative or zero.
        /// </summary>
        [DebuggerHidden]
        [Conditional("DEBUG")]
        public static void AssertIfNegativeOrZero(int value, string paramName)
        {
            if (IsNegativeOrZero(value))
                ParameterAssert("Parameter Error: Parameter {0} is not positive.", paramName);
        }

        private static bool IsNegativeOrZero(int value)
        {
            return value <= 0;
        }

        #endregion

        #region ParameterAssert

        [DebuggerHidden]
        [Conditional("DEBUG")]
        private static void ParameterAssert(string format, params object[] parameters)
        {
            string message = "Parameter Error: ";
            if (!string.IsNullOrEmpty(format))
                message += string.Format(CultureInfo.InvariantCulture, format, parameters);

            Debug.WriteLine(message);
            Debug.Fail(message);
        }

        #endregion
    }
}


text:
<?php

namespace Deployer\Console;

use Deployer\Deployer;
use Deployer\Executor\ExecutorInterface;
use Deployer\Executor\ParallelExecutor;
use Deployer\Executor\SeriesExecutor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface as Input;
use Symfony\Component\Console\Input\InputOption as Option;
use Symfony\Component\Console\Output\OutputInterface as Output;

class TaskCommand extends Command
{

    /**
     * @var Deployer
     */
    private $deployer;

    /**
     * @var ExecutorInterface
     */
    public $executor;

    /**
     * @param string $name
     * @param string $description
     * @param Deployer $deployer
     */
    public function __construct($name, $description, Deployer $deployer)
    {
        parent::__construct($name);
        $this->setDescription($description);
        $this->deployer = $deployer;
    }

    /**
     * Configures the command
     */
    protected function configure()
    {
        $this->addOption(
            'parallel',
            'p',
            Option::VALUE_NONE,
            'Run tests in parallel.'
        );
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(Input $input, Output $output)
    {
        $tasks = [];
        foreach ($this->deployer->scenarios->get($this->getName())->getTasks() as $taskName) {
            $tasks[$taskName] = $this->deployer->tasks->get($taskName);
        }

        $stage = $input->hasArgument('stage') ? $input->getArgument('stage') : null;

        if (!empty($stage)) {

            $servers = [];

            // Look for servers which has in env `stages` current stage name.
            foreach($this->deployer->environments as $name => $env) {
                // If server does not have any stage category, skip them
                if (in_array($stage, $env->get('stages', []), true)) {
                    $servers[$name] = $this->deployer->servers->get($name);
                }
            }

            // If still is empty, try to find server by name.
            if (empty($servers)) {
                if ($this->deployer->servers->has($stage)) {
                    $servers = [$stage => $this->deployer->servers->get($stage)];
                } else {
                    // Nothing found.
                    throw new \RuntimeException("Stage or server `$stage` does not found.");
                }
            }

        } else {
            // Otherwise run on all servers.
            $servers = iterator_to_array($this->deployer->servers->getIterator());
        }

        if (empty($servers)) {
            throw new \RuntimeException('You need specify at least one server.');
        }

        $environments = iterator_to_array($this->deployer->environments);

        if (isset($this->executor)) {
            $executor = $this->executor;
        } else {
            if ($input->getOption('parallel')) {
                $executor = new ParallelExecutor($this->deployer->getConsole()->getUserDefinition());
            } else {
                $executor = new SeriesExecutor();
            }
        }

        $executor->run($tasks, $servers, $environments,  $input, $output);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Elcodi\Component\Currency\Services;

use NumberFormatter;

use Elcodi\Component\Currency\Entity\Interfaces\CurrencyInterface;
use Elcodi\Component\Currency\Entity\Interfaces\MoneyInterface;
use Elcodi\Component\Currency\Entity\Money;
use Elcodi\Component\Currency\Exception\CurrencyNotAvailableException;
use Elcodi\Component\Currency\Exception\CurrencyNotConvertibleException;
use Elcodi\Component\Currency\Wrapper\CurrencyWrapper;
use Elcodi\Component\Language\Entity\Interfaces\LocaleInterface;

/**
 * Class MoneyPrinter.
 *
 * This service provides a different ways for Money print
 */
class MoneyPrinter
{
    /**
     * @var CurrencyConverter
     *
     * Currency converter
     */
    private $currencyConverter;

    /**
     * @var CurrencyWrapper
     *
     * Currency Wrapper
     */
    private $currencyWrapper;

    /**
     * @var LocaleInterface
     *
     * Locale
     */
    private $locale;

    /**
     * Construct method.
     *
     * @param CurrencyConverter $currencyConverter Currency converter
     * @param CurrencyWrapper   $currencyWrapper   Currency wrapper
     * @param LocaleInterface   $locale            Locale iso
     */
    public function __construct(
        CurrencyConverter $currencyConverter,
        CurrencyWrapper $currencyWrapper,
        LocaleInterface $locale
    ) {
        $this->currencyConverter = $currencyConverter;
        $this->currencyWrapper = $currencyWrapper;
        $this->locale = $locale;
    }

    /**
     * Return a formatted price given an Money object and the target currency.
     *
     * If money is null, print empty string
     *
     * @param MoneyInterface    $money          the Money object to print
     * @param CurrencyInterface $targetCurrency Iso code of the target currency (optional)
     *
     * @throws CurrencyNotAvailableException   Any currency available
     * @throws CurrencyNotConvertibleException Currencies cannot be converted
     *
     * @return string The formatted price
     */
    public function printConvertMoney(
        MoneyInterface $money = null,
        CurrencyInterface $targetCurrency = null
    ) {
        if (!($money instanceof MoneyInterface)) {
            return '';
        }

        if (!($targetCurrency instanceof CurrencyInterface)) {
            $targetCurrency = $this
                ->currencyWrapper
                ->get();
        }

        /**
         * @var CurrencyInterface $targetCurrency
         */
        $moneyConverted = $this
            ->currencyConverter
            ->convertMoney(
                $money,
                $targetCurrency
            );
        return $this->printMoney($moneyConverted);
    }

	/**
	 * print money after calculated with membership strategy
	 * @param MoneyInterface|null $money
	 * @param int $strategy
	 * @param CurrencyInterface|null $targetCurrency
	 * @return string
	 */
	public function printConvertMoneyWithStrategy(
		MoneyInterface $money = null,
		$strategy = 100,
		CurrencyInterface $targetCurrency = null

	) {
		if (!($money instanceof MoneyInterface)) {
			return '';
		}

		if (!($targetCurrency instanceof CurrencyInterface)) {
			$targetCurrency = $this
				->currencyWrapper
				->get();
		}
		$money_with_strategy = $money->multiply($strategy / 100);

		/**
		 * @var CurrencyInterface $targetCurrency
		 */
		$moneyConverted = $this
			->currencyConverter
			->convertMoney(
				$money_with_strategy,
				$targetCurrency
			);
		return $this->printMoney($moneyConverted);
	}

    /**
     * Return a formatted price given an Money object.
     *
     * If money is null, print empty string
     *
     * @param MoneyInterface $money the Money object to print
     *
     * @return string The formatted price
     */
    public function printMoney(MoneyInterface $money = null)
    {
        if (!($money instanceof MoneyInterface)) {
            return '';
        }

        if (!($money->getCurrency() instanceof CurrencyInterface)) {
            return $money->getAmount();
        }

        $moneyFormatter = new NumberFormatter(
            $this->locale->getIso(),
            NumberFormatter::CURRENCY
        );

        /**
         * The precision of the integer amount for a given Money
         * (cents, thousandths, 10-thousandths, etc) should be
         * stored in the Currency object. We assume amounts are
         * represented in cents.
         *
         * Loss of precision due to conversion is possible, but only when
         * displaying prices. This operation does not affect amounts
         */

        return $moneyFormatter
            ->formatCurrency(
                $money->getAmount() / 100,
                $money->getCurrency()->getIso()
            );
    }

    /**
     * Return a formatted price given the price in an integer format.
     *
     * Takes the currency from CurrencyWrapper
     *
     * @param int $value Value
     *
     * @return string The formatted price
     */
    public function printMoneyFromValue($value)
    {
        $targetCurrency = $this
            ->currencyWrapper
            ->get();

        $money = Money::create(
            $value,
            $targetCurrency
        );

        return $this->printMoney($money);
    }
}


text:
export * from './isString';
export * from './toNumber';


text:
namespace Nz
{
	namespace
	{
		const UInt8 s_defaultThemeButtonImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/Button.png.h>
		};

		const UInt8 s_defaultThemeButtonHoveredImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/ButtonHovered.png.h>
		};

		const UInt8 s_defaultThemeButtonPressedImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/ButtonPressed.png.h>
		};

		const UInt8 s_defaultThemeButtonPressedHoveredImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/ButtonPressedHovered.png.h>
		};

		const UInt8 s_defaultThemeCheckboxBackgroundImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/CheckboxBackground.png.h>
		};

		const UInt8 s_defaultThemeCheckboxBackgroundHoveredImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/CheckboxBackgroundHovered.png.h>
		};

		const UInt8 s_defaultThemeCheckboxCheckImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/CheckboxCheck.png.h>
		};

		const UInt8 s_defaultThemeCheckboxTristateImage[] = {
			#include <Nazara/Widgets/Resources/DefaultTheme/CheckboxTristate.png.h>
		};
	}

	DefaultWidgetTheme::DefaultWidgetTheme()
	{
		TextureParams texParams;
		texParams.renderDevice = Graphics::Instance()->GetRenderDevice();
		texParams.loadFormat = PixelFormat::RGBA8_SRGB;

		auto CreateMaterialFromTexture = [](std::shared_ptr<Texture> texture)
		{
			std::shared_ptr<MaterialPass> buttonMaterialPass = std::make_shared<MaterialPass>(BasicMaterial::GetSettings());
			buttonMaterialPass->EnableDepthBuffer(true);
			buttonMaterialPass->EnableDepthWrite(false);
			buttonMaterialPass->EnableBlending(true);
			buttonMaterialPass->SetBlendEquation(BlendEquation::Add, BlendEquation::Add);
			buttonMaterialPass->SetBlendFunc(BlendFunc::SrcAlpha, BlendFunc::InvSrcAlpha, BlendFunc::One, BlendFunc::One);

			std::shared_ptr<Material> material = std::make_shared<Material>();
			material->AddPass("ForwardPass", buttonMaterialPass);

			BasicMaterial buttonBasicMat(*buttonMaterialPass);
			buttonBasicMat.SetDiffuseMap(texture);

			return material;
		};

		// Button material
		m_buttonMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeButtonImage, sizeof(s_defaultThemeButtonImage), texParams));
		m_buttonHoveredMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeButtonHoveredImage, sizeof(s_defaultThemeButtonHoveredImage), texParams));
		m_buttonPressedMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeButtonPressedImage, sizeof(s_defaultThemeButtonPressedImage), texParams));
		m_buttonPressedHoveredMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeButtonPressedHoveredImage, sizeof(s_defaultThemeButtonPressedHoveredImage), texParams));

		// Checkbox material
		m_checkboxBackgroundMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeCheckboxBackgroundImage, sizeof(s_defaultThemeCheckboxBackgroundImage), texParams));
		m_checkboxBackgroundHoveredMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeCheckboxBackgroundHoveredImage, sizeof(s_defaultThemeCheckboxBackgroundHoveredImage), texParams));
		m_checkboxCheckMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeCheckboxCheckImage, sizeof(s_defaultThemeCheckboxCheckImage), texParams));
		m_checkboxTristateMaterial = CreateMaterialFromTexture(Texture::LoadFromMemory(s_defaultThemeCheckboxTristateImage, sizeof(s_defaultThemeCheckboxTristateImage), texParams));
	}

	std::unique_ptr<ButtonWidgetStyle> DefaultWidgetTheme::CreateStyle(ButtonWidget* buttonWidget) const
	{
		SimpleButtonWidgetStyle::StyleConfig styleConfig;
		styleConfig.cornerSize = 20.f;
		styleConfig.cornerTexCoords = 20.f / 128.f;
		styleConfig.hoveredMaterial = m_buttonHoveredMaterial;
		styleConfig.material = m_buttonMaterial;
		styleConfig.pressedHoveredMaterial = m_buttonPressedHoveredMaterial;
		styleConfig.pressedMaterial = m_buttonPressedMaterial;

		return std::make_unique<SimpleButtonWidgetStyle>(buttonWidget, styleConfig);
	}

	std::unique_ptr<CheckboxWidgetStyle> DefaultWidgetTheme::CreateStyle(CheckboxWidget* checkboxWidget) const
	{
		SimpleCheckboxWidgetStyle::StyleConfig styleConfig;
		styleConfig.backgroundCornerSize = 10.f;
		styleConfig.backgroundCornerTexCoords = 10.f / 64.f;
		styleConfig.backgroundHoveredMaterial = m_checkboxBackgroundHoveredMaterial;
		styleConfig.backgroundMaterial = m_checkboxBackgroundMaterial;
		styleConfig.checkMaterial = m_checkboxCheckMaterial;
		styleConfig.tristateMaterial = m_checkboxTristateMaterial;

		return std::make_unique<SimpleCheckboxWidgetStyle>(checkboxWidget, styleConfig);
	}

	std::unique_ptr<LabelWidgetStyle> DefaultWidgetTheme::CreateStyle(LabelWidget* labelWidget) const
	{
		return std::make_unique<SimpleLabelWidgetStyle>(labelWidget, Widgets::Instance()->GetTransparentMaterial());
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Batatas</string>
    <string name="app_id">1585677015053711</string>
    <string name="new_list">Nova lista</string>
    <string name="add">Adicionar</string>
    <string name="cancel">Cancelar</string>
    <string name="add_item">Adicionar</string>
    <string name="item_name_hint">Nome do produto</string>
    <string name="scan_barcode">Código de barras</string>
    <string name="item_amount_hint">Qtd</string>
    <string name="lists_add_from_qr_code">Criar a partir de Nota fiscal</string>
    <string name="intro_welcome">Bem-vindo ao Batatas! Primeiro, você deve se autenticar com o seu Facebook para acessar o aplicativo.</string>
    <string name="title_activity_main">Batatas</string>
    <string name="reload">Atualizar</string>
    <string name="share">Compartilhar</string>
    <string name="list_check_bill">Marcar usando Nota fiscal</string>
    <string name="list_check_product">Marcar usando Código de barras</string>
    <string name="delete_selected">Apagar selecionados</string>
    <string name="list_name">Nome da lista</string>
    <string name="new_item">Novo</string>

    <string name="err_no_matching_items">Nenhum produto dessa lista encontrado na nota fiscal.</string>
    <string name="err_find_product">Produto não encontrado.</string>

    <string name="err_deleted">Falha ao apagar.</string>
    <string name="err_fetch_lists">Falha ao obter suas listas de compras.</string>
    <string name="err_fetch_list">Falha ao obter a lista de compras selecionada.</string>
    <string name="err_fetch_shared_list">Falha ao identificar compartilhamentos dessa lista.</string>
    <string name="err_add_item">Falha ao adicionar item!</string>
    <string name="err_create_list">Falhar ao criar lista de compras.</string>
    <string name="err_share_friend">Falha ao compartilhar lista.</string>
    <string name="err_unshare_friend">Falha ao remover o compartilhamento.</string>

    <string name="exc_get_bill_products">Falha ao obter produtos da nota fiscal.</string>

    <string name="info_login_canceled">Login cancelado.</string>
    <string name="info_no_product_found">Nenhum produto encontrado.</string>

    <string name="suc_deleted_item">Item apagado com sucesso!</string>
    <string name="suc_deleted_list">Lista(s) apagada com sucesso!</string>

    <string name="_selected"> selecionado</string>
</resources>


text:
<?php

/**
 * Tests the ezcPersistentObjectProperty class.
 *
 * @package PersistentObject
 * @subpackage Tests
 */
class ezcPersistentObjectPropertyTest extends ezcTestCase
{
    protected function setUp()
    {
    }

    protected function tearDown()
    {
    }

    public static function suite()
    {
        return new PHPUnit_Framework_TestSuite( 'ezcPersistentObjectPropertyTest' );
    }

    public function testConstructureSuccess()
    {
        $property = new ezcPersistentObjectProperty();
        $this->assertAttributeEquals(
            array(
                'columnName'       => null,
                'resultColumnName' => null,
                'propertyName'     => null,
                'propertyType'     => ezcPersistentObjectProperty::PHP_TYPE_STRING,
                'converter'        => null,
                'databaseType'     => PDO::PARAM_STR,
            ),
            'properties',
            $property
        );

        $property = new ezcPersistentObjectProperty(
            'column',
            'property',
            ezcPersistentObjectProperty::PHP_TYPE_INT,
            new ezcPersistentPropertyDateTimeConverter(),
            PDO::PARAM_LOB
        );
        $this->assertAttributeEquals(
            array(
                'columnName'       => 'column',
                'resultColumnName' => 'column',
                'propertyName'     => 'property',
                'propertyType'     => ezcPersistentObjectProperty::PHP_TYPE_INT,
                'converter'        => new ezcPersistentPropertyDateTimeConverter(),
                'databaseType'     => PDO::PARAM_LOB,
            ),
            'properties',
            $property
        );
    }

    public function testConstructureFailure()
    {
        try
        {
            $property = new ezcPersistentObjectProperty(
                23,
                'foo',
                ezcPersistentObjectProperty::PHP_TYPE_INT,
                new ezcPersistentPropertyDateTimeConverter(),
                PDO::PARAM_LOB
            );
            $this->fail( 'ezcBaseValueException not thrown on invalid value for parameter $columnName.' );
        }
        catch ( ezcBaseValueException $e ) {}
        try
        {
            $property = new ezcPersistentObjectProperty(
                'foo',
                23,
                ezcPersistentObjectProperty::PHP_TYPE_INT,
                new ezcPersistentPropertyDateTimeConverter(),
                PDO::PARAM_LOB
            );
            $this->fail( 'ezcBaseValueException not thrown on invalid value for parameter $propertyName.' );
        }
        catch ( ezcBaseValueException $e ) {}
        try
        {
            $property = new ezcPersistentObjectProperty(
                'foo',
                'foo',
                'baz',
                new ezcPersistentPropertyDateTimeConverter(),
                PDO::PARAM_LOB
            );
            $this->fail( 'ezcBaseValueException not thrown on invalid value for parameter $propertyType.' );
        }
        catch ( ezcBaseValueException $e ) {}
        try
        {
            $property = new ezcPersistentObjectProperty(
                'foo',
                'foo',
                ezcPersistentObjectProperty::PHP_TYPE_INT,
                'bam',
                PDO::PARAM_LOB
            );
            $this->fail( 'ezcBaseValueException not thrown on invalid value parameter $converter.' );
        }
        catch ( ezcBaseValueException $e ) {}
        try
        {
            $property = new ezcPersistentObjectProperty(
                'foo',
                'foo',
                ezcPersistentObjectProperty::PHP_TYPE_INT,
                new ezcPersistentPropertyDateTimeConverter(),
                23
            );
            $this->fail( 'ezcBaseValueException not thrown on invalid value for parameter $databaseType.' );
        }
        catch ( ezcBaseValueException $e ) {}
    }

    public function testGetAccessSuccess()
    {
        $property = new ezcPersistentObjectProperty(
            'column',
            'property',
            ezcPersistentObjectProperty::PHP_TYPE_INT,
            new ezcPersistentPropertyDateTimeConverter(),
            PDO::PARAM_LOB
        );

        $this->assertEquals(
            'column',
            $property->columnName
        );
        $this->assertEquals(
            'property',
            $property->propertyName
        );
        $this->assertEquals(
            ezcPersistentObjectProperty::PHP_TYPE_INT,
            $property->propertyType
        );
        $this->assertEquals(
            new ezcPersistentPropertyDateTimeConverter(),
            $property->converter
        );
        $this->assertEquals(
            PDO::PARAM_LOB,
            $property->databaseType
        );
    }

    public function testGetAccessFailure()
    {
        $property = new ezcPersistentObjectProperty(
            'column',
            'property',
            ezcPersistentObjectProperty::PHP_TYPE_INT,
            new ezcPersistentPropertyDateTimeConverter(),
            PDO::PARAM_LOB
        );
        try
        {
            echo $property->foo;
        }
        catch ( ezcBasePropertyNotFoundException $e )
        {
            return;
        }
        $this->fail( 'Exception not thrown on get access to invalid property $foo.' );
    }

    public function testSetAccessSuccess()
    {
        $property = new ezcPersistentObjectProperty();
        $property->columnName   = 'column';
        $property->propertyName ='property';
        $property->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
        $property->converter    = new ezcPersistentPropertyDateTimeConverter();
        $property->databaseType = PDO::PARAM_LOB;

        $this->assertEquals(
            'column',
            $property->columnName
        );
        $this->assertEquals(
            'property',
            $property->propertyName
        );
        $this->assertEquals(
            ezcPersistentObjectProperty::PHP_TYPE_INT,
            $property->propertyType
        );
        $this->assertEquals(
            new ezcPersistentPropertyDateTimeConverter(),
            $property->converter
        );
        $this->assertEquals(
            PDO::PARAM_LOB,
            $property->databaseType
        );

        $property->converter   = null;
        $this->assertNull(
            $property->converter
        );

        $property->columnName = 'CamelCase';
        $this->assertEquals(
            'CamelCase',
            $property->columnName
        );
        $this->assertEquals(
            'camelcase',
            $property->resultColumnName
        );
    }

    public function testSetAccessFailure()
    {
        $property = new ezcPersistentObjectProperty();
        $this->assertSetPropertyFails(
            $property,
            'columnName',
            array( true, false, 23, 23.42, array(), new stdClass() )
        );
        $this->assertSetPropertyFails(
            $property,
            'propertyName',
            array( true, false, 23, 23.42, array(), new stdClass() )
        );
        $this->assertSetPropertyFails(
            $property,
            'propertyType',
            array( true, false, 'foo', 23.42, array(), new stdClass() )
        );
        $this->assertSetPropertyFails(
            $property,
            'converter',
            array( true, false, 'foo', 23.42, array(), new stdClass() )
        );
        $this->assertSetPropertyFails(
            $property,
            'databaseType',
            array( true, false, 'foo', 23, 23.42, array(), new stdClass() )
        );
    }

    public function testIssetAccessSuccess()
    {
        $property = new ezcPersistentObjectProperty();
        $this->assertTrue(
            isset( $property->columnName ),
            'Property $columnName seems not to be set.'
        );
        $this->assertTrue(
            isset( $property->propertyName ),
            'Property $propertyName seems not to be set.'
        );
        $this->assertTrue(
            isset( $property->propertyType ),
            'Property $propertyType seems not to be set.'
        );
        $this->assertTrue(
            isset( $property->converter ),
            'Property $converter seems not to be set.'
        );
        $this->assertTrue(
            isset( $property->databaseType ),
            'Property $databaseType seems not to be set.'
        );
        $this->assertTrue(
            isset( $property->resultColumnName ),
            'Property $resultColumnName seems not to be set.'
        );
    }

    public function testIssetAccessFailure()
    {
        $property = new ezcPersistentObjectProperty();
        $this->assertFalse(
            isset( $property->foo ),
            'Property $foo seems to be set.'
        );
    }
}

?>


text:
    <title>Mocha</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="style.css" />


text:
import React from 'react';
import Loading from 'client/components/common/loading';
import moment from 'moment';

export default (props) => {
  return (

          {
            props.event ?

{props.event.title}

                    作者:Admin
                    日期:{moment(props.event.createdAt).format('YYYY-MM-DD')}

时间:{moment(props.event.time).format('YYYY-MM-DD')}

地点:{props.event.location}

费用:{props.event.unit === 'dollar' ? '$' : '¥'} {props.event.fee}

人数限制:{props.event.limit}

                {/*
*/}
                {/**/}
                    {/* 22 comments*/}
                {/**/}
                  {/* 142 views*/}
                {/*
*/}

 :
              <Loading />
          }

  );
}


text:
package io.github.droidkaigi.confsched2017.viewmodel;

import android.content.Context;
import android.databinding.BaseObservable;
import android.databinding.Bindable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.view.View;

import java.util.Date;

import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.util.DateUtil;

public class SessionViewModel extends BaseObservable implements ViewModel {

    private Session session;

    private String shortStime = "";

    private String formattedDate = "";

    private String title = "";

    private String speakerName = "";

    private String roomName = "";

    private String languageId = "";

    private String minutes = "";

    private int rowSpan = 1;

    private int colSpan = 1;

    private int titleMaxLines = 3;

    private int speakerNameMaxLines = 1;

    @DrawableRes
    private int backgroundResId;

    @ColorRes
    private int topicColorResId;

    private boolean isClickable;

    private int checkVisibility;

    private int normalSessionItemVisibility;

    private int languageVisibility;

    private Callback callback;

    SessionViewModel(@NonNull Session session, Context context, int roomCount, boolean isMySession) {
        this.session = session;
        this.shortStime = DateUtil.getHourMinute(session.stime);
        this.formattedDate = DateUtil.getMonthDate(session.stime, context);
        this.title = session.title;

        if (session.speaker != null) {
            this.speakerName = session.speaker.name;
        }
        if (session.room != null) {
            this.roomName = session.room.name;
        }
        if (session.lang != null) {
            this.languageId = session.lang.toUpperCase();
        }
        this.languageVisibility = session.lang != null ? View.VISIBLE : View.GONE;

        this.minutes = context.getString(R.string.session_minutes, session.durationMin);

        decideRowSpan(session);
        this.colSpan = decideColSpan(session, roomCount);

        this.checkVisibility = isMySession ? View.VISIBLE : View.GONE;

        if (session.isBreak()) {
            this.isClickable = false;
            this.backgroundResId = R.drawable.bg_empty_session;
            this.topicColorResId = android.R.color.transparent;
            this.normalSessionItemVisibility = View.GONE;
        } else {
            this.isClickable = true;
            this.backgroundResId = R.drawable.clickable_white;
            this.topicColorResId = TopicColor.from(session.topic).middleColorResId;
            this.normalSessionItemVisibility = View.VISIBLE;
        }

    }

    private SessionViewModel(int rowSpan, int colSpan) {
        this.rowSpan = rowSpan;
        this.colSpan = colSpan;
        this.isClickable = false;
        this.backgroundResId = R.drawable.bg_empty_session;
        this.topicColorResId = android.R.color.transparent;
        this.checkVisibility = View.GONE;
        this.normalSessionItemVisibility = View.GONE;
    }

    static SessionViewModel createEmpty(int rowSpan) {
        return createEmpty(rowSpan, 1);
    }

    static SessionViewModel createEmpty(int rowSpan, int colSpan) {
        return new SessionViewModel(rowSpan, colSpan);
    }

    private int decideColSpan(@NonNull Session session, int roomCount) {
        if (session.isCeremony()) {
            return 3;
        } else if (session.isBreak()) {
            return roomCount;
        } else {
            return 1;
        }
    }

    private void decideRowSpan(@NonNull Session session) {
        // Break time is over 30 min, but one row is good
        if (session.durationMin > 30 && !session.isBreak()) {
            this.rowSpan = this.rowSpan * 2;
            this.titleMaxLines = this.titleMaxLines * 2;
            this.speakerNameMaxLines = this.speakerNameMaxLines * 3;
        }
    }

    Date getStime() {
        return session.stime;
    }

    public void showSessionDetail(@SuppressWarnings("unused") View view) {
        if (callback != null && session != null) {
            callback.showSessionDetail(session);
        }
    }

    @Override
    public void destroy() {
        callback = null;
    }

    public String getShortStime() {
        return shortStime;
    }

    public String getFormattedDate() {
        return formattedDate;
    }

    public String getTitle() {
        return title;
    }

    public String getSpeakerName() {
        return speakerName;
    }

    String getRoomName() {
        return roomName;
    }

    public String getLanguageId() {
        return languageId;
    }

    public String getMinutes() {
        return minutes;
    }

    public int getRowSpan() {
        return rowSpan;
    }

    public int getColSpan() {
        return colSpan;
    }

    public int getBackgroundResId() {
        return backgroundResId;
    }

    public boolean isClickable() {
        return isClickable;
    }

    public int getTitleMaxLines() {
        return titleMaxLines;
    }

    public int getSpeakerNameMaxLines() {
        return speakerNameMaxLines;
    }

    public int getTopicColorResId() {
        return topicColorResId;
    }

    public int getNormalSessionItemVisibility() {
        return normalSessionItemVisibility;
    }

    public int getLanguageVisibility() {
        return languageVisibility;
    }

    @Bindable
    public int getCheckVisibility() {
        return checkVisibility;
    }

    public void setCallback(Callback callback) {
        this.callback = callback;
    }

    public interface Callback {

        void showSessionDetail(@NonNull Session session);
    }
}


text:
using System;

namespace FireSharp.EventStreaming
{
    public class ValueChangedEventArgs : EventArgs
    {
        public ValueChangedEventArgs(string path, string data, string oldData)
        {
            Path = path;
            Data = data;
            OldData = oldData;
        }

        public string Path { get; private set; }
        public string Data { get; private set; }
        public string OldData { get; private set; }
    }
}


text:
var distance = require('hamming-distance');
var spawn = require('child_process').spawn;
var dblite = require('dblite');
var colorHash = require('./lib/color-hash');
var dhash = require('./lib/dhash');
var mysql = require('mysql');
var path = require('path');
var fs = require('fs');
var config = require('./config');

var argv = require('yargs')
    .boolean(['alternative', 'first', 'simple', 'partial', 'mysql'])
    .alias('f', 'first')
    .alias('a', 'alternative')
    .alias('histogram', 'alternative')
    .alias('h', 'alternative')
    .alias('s', 'simple')
    .alias('m', 'mysql')
    .default('partial', true)
    .argv;

var db, dbPath;
var found = false;

if (argv.mysql) {
  db = mysql.createConnection(
    argv.alternative ?
    config.mysqlConfig.normal :
    config.mysqlConfig.legacy
  );
} else {
  if (argv.db) {
    dbPath = argv.db;
  } else if (argv.alternative) {
    dbPath = config.sqliteConfig.normal;
  } else {
    dbPath = config.sqliteConfig.legacy;
  }
  db = dblite(dbPath);
}

// Clear screen:
// process.stdout.write('\u001b[2J\u001b[0;0H');
console.log('>> WITA? > What is this anime?');
console.log('> Image hash finder');

var image = argv._[0];
var limit = argv._[1] || (argv.mysql ? 12 : 4);
var loopLength = 1000;

if (!image) {
  console.log('Input an image');
  process.exit();
}

if (!argv.mysql) {
  // Build filenames cache:
  db.query('SELECT * FROM videos', function(err, data) {
    printNamesCache = {
      list: data,
      ids: data.map(function (e) {
        return e[0];
      })
    };
  });
}

var ffmpegProcess = spawn('ffmpeg', argv.alternative ?
    [
    '-i', image,
    '-vf', 'format=gray,scale=9x8',
    '-vsync', '0',
    '-f', 'image2pipe',
    '-vcodec', 'png',
    'pipe:1',
    '-i', image,
    '-vf', 'scale=2x2',
    '-vsync', '0',
    '-f', 'image2pipe',
    '-vcodec', 'png',
    'pipe:3'] :
    [ '-i', image,
    '-vf', 'scale=9x8,format=gray',
    '-vsync', '0',
    '-f', 'image2pipe',
    '-vcodec', 'png',
    'pipe:1'], {
      stdio: argv.alternative ? ['pipe', 'pipe', 'pipe', 'pipe'] : null
    }),
    errorLog = '';

ffmpegProcess.stderr.setEncoding('utf-8');
ffmpegProcess.stderr.on('data', function (err) {
  errorLog += err;
});

var alternatePromise;
if (argv.alternative) {
  alternatePromise = new Promise(function(resolve) {
    ffmpegProcess.stdio[3].on('data', function(image) {
      colorHash(image, function (err, result) {
        if (err) {
          throw err;
        }
        resolve(result);
      });
    });
  });
}

ffmpegProcess.stdout.on('data', function (image) {
  dhash.stream(image, function (err, hash) {
    if (err) throw err;

    if (argv.alternative) {
      alternatePromise.then(function(colorHash){
        handleImageHash(hash + colorHash);
      });
    } else {
      handleImageHash(hash);
    }
  }, argv.alternative);
});

ffmpegProcess.on('close', function (exitCode) {
  if (exitCode !== 0) {
    console.log('Error', exitCode);
    console.log(errorLog);
  }
});

function handleImageHash(hash) {
  console.log(hash.replace(/(.{8})(.{8})(.{8})?/, '$1 $2 $3'), '<- target hash');

  if (argv.mysql) {
    findUsingMySQL(hash);
    return;
  }

  var mid = argv.alternative ? 8 : 6;
  if (!argv.partial) {
    queryLoop(hash, 0);
    return;
  }

  db.query(
    'SELECT * FROM hashes WHERE hash1=? OR hash2=?' + (argv.alternative ? ' OR hash3=?' : ''),
    [ parseInt(hash.substr(0, mid), 16), parseInt(hash.substr(mid, mid), 16) ]
    .concat(argv.alternative ? parseInt(hash.substr(2 * mid, mid), 16) : []),
    function (err, data) {
    if (err) {throw err;}

    if (data.length) {
      console.log('\n> Partial matches:');
      processData(hash, data);
    }

    if (argv.simple) {
      db.close();
      process.exit(+!found);
      return;
    }

    console.log('\n> Threshold based search (using', limit, 'as threshold):');
    queryLoop(hash, 0);
  });
}

function findUsingMySQL(hash) {
  var initTime = Date.now();
  var query = db.query('SELECT ' + (argv.alternative ? 'hex(hash3),' : '') + ' distance, file FROM `videos`\n' +
    'JOIN (\n' +
      'SELECT video, distance' + (argv.alternative ? ', hash3' : '') + '\n' +
      'FROM (\n' +
        'SELECT video' + (argv.alternative ? ', hash3' : '') + ', (BIT_COUNT(hash1 ^ ?) + BIT_COUNT(hash2 ^ ?)) as distance\n' +
        'FROM `hashes`\n' +
        // 'LIMIT 100\n' + // for testing
      ') as sub\n' +
      'WHERE distance < ?\n' +
    ') as result\n' +
    'WHERE videoid = result.video\n' +
    'ORDER BY distance ASC\n' + // even if it gets disabled it will not stream
    'LIMIT 100;',
    [parseInt(hash.substr(0, 8), 16), parseInt(hash.substr(8, 8), 16), limit]);

  query.on('result', processRowResult);
  query.on('end', function () {
    console.log('Query finished in %s seconds', ((Date.now() - initTime) / 1000).toFixed(1))
    db.end(function () {
      process.exit(+!found);
    });
  });
}

function processRowResult(result) {
  found = true;
  console.log(
    argv.alternative ? (('00000000' + result['hex(hash3)']).substr(-8)) : '',
    ('  ' + result['distance']).substr(-2),
    result['file']
  );
}

function queryLoop (hash, offset) {
  if (offset !== 0 && offset % 1e6 === 0) {
    console.log('Processed', offset, 'hashes');
  }
  db.query('SELECT * FROM hashes LIMIT ? OFFSET ?', [loopLength, offset], function (err, data) {
    setImmediate(processData, hash, data);
    if (data.length === loopLength) {
      setImmediate(queryLoop, hash, offset + loopLength);
    } else {
      db.close(function () {
        console.log('Done');
        process.exit(+!found);
      });
    }
  });
}

function processData (hash, data) {
  var filtered = data.map(compareRow(hash)).filter(function (e) {
    return e[0] < limit;
  });

  printNames(filtered);
}

function compareRow(hash) {
  if (argv.alternative) {
    return function (row) {
      var rowHash = ('000000' + parseInt(row[0], 10).toString(16)).substr(-6) +
                    ('000000' + parseInt(row[1], 10).toString(16)).substr(-6) +
                    ('000000' + parseInt(row[2], 10).toString(16)).substr(-6);
      return [distance(hash, rowHash), rowHash, row[3]];
    };
  }
  return function (row) {
    var rowHash = ('00000000' + parseInt(row[0], 10).toString(16)).substr(-8) +
                  ('00000000' + parseInt(row[1], 10).toString(16)).substr(-8);
    return [distance(hash, rowHash), rowHash, row[2]];
  };
}

var printNamesCache = null;
function printNames(rows) { // distance, hash, id
  var output = rows.map(function (e){
    var id = printNamesCache.ids.indexOf(e[2]);
    return e[1] + ('   ' + e[0]).substr(-3) + ('     ' + id).substr(-5) + ' ' + printNamesCache.list[id][1];
  });

  if (output.length) {
    found = true;
    console.log(output.join('\n'));
    if (argv.first) {
      process.exit(0);
    }
  }
}


text:
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB.  All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#

"""Internal support module for sre"""

# update when constants are added or removed

MAGIC = 20010701

# max code word in this release

MAXREPEAT = 65535

# SRE standard exception (access as sre.error)
# should this really be here?

class error(Exception):
    pass

# operators

FAILURE = "failure"
SUCCESS = "success"

ANY = "any"
ANY_ALL = "any_all"
ASSERT = "assert"
ASSERT_NOT = "assert_not"
AT = "at"
BIGCHARSET = "bigcharset"
BRANCH = "branch"
CALL = "call"
CATEGORY = "category"
CHARSET = "charset"
GROUPREF = "groupref"
GROUPREF_IGNORE = "groupref_ignore"
IN = "in"
IN_IGNORE = "in_ignore"
INFO = "info"
JUMP = "jump"
LITERAL = "literal"
LITERAL_IGNORE = "literal_ignore"
MARK = "mark"
MAX_REPEAT = "max_repeat"
MAX_UNTIL = "max_until"
MIN_REPEAT = "min_repeat"
MIN_UNTIL = "min_until"
NEGATE = "negate"
NOT_LITERAL = "not_literal"
NOT_LITERAL_IGNORE = "not_literal_ignore"
RANGE = "range"
REPEAT = "repeat"
REPEAT_ONE = "repeat_one"
SUBPATTERN = "subpattern"

# positions
AT_BEGINNING = "at_beginning"
AT_BEGINNING_LINE = "at_beginning_line"
AT_BEGINNING_STRING = "at_beginning_string"
AT_BOUNDARY = "at_boundary"
AT_NON_BOUNDARY = "at_non_boundary"
AT_END = "at_end"
AT_END_LINE = "at_end_line"
AT_END_STRING = "at_end_string"
AT_LOC_BOUNDARY = "at_loc_boundary"
AT_LOC_NON_BOUNDARY = "at_loc_non_boundary"
AT_UNI_BOUNDARY = "at_uni_boundary"
AT_UNI_NON_BOUNDARY = "at_uni_non_boundary"

# categories
CATEGORY_DIGIT = "category_digit"
CATEGORY_NOT_DIGIT = "category_not_digit"
CATEGORY_SPACE = "category_space"
CATEGORY_NOT_SPACE = "category_not_space"
CATEGORY_WORD = "category_word"
CATEGORY_NOT_WORD = "category_not_word"
CATEGORY_LINEBREAK = "category_linebreak"
CATEGORY_NOT_LINEBREAK = "category_not_linebreak"
CATEGORY_LOC_WORD = "category_loc_word"
CATEGORY_LOC_NOT_WORD = "category_loc_not_word"
CATEGORY_UNI_DIGIT = "category_uni_digit"
CATEGORY_UNI_NOT_DIGIT = "category_uni_not_digit"
CATEGORY_UNI_SPACE = "category_uni_space"
CATEGORY_UNI_NOT_SPACE = "category_uni_not_space"
CATEGORY_UNI_WORD = "category_uni_word"
CATEGORY_UNI_NOT_WORD = "category_uni_not_word"
CATEGORY_UNI_LINEBREAK = "category_uni_linebreak"
CATEGORY_UNI_NOT_LINEBREAK = "category_uni_not_linebreak"

OPCODES = [

    # failure=0 success=1 (just because it looks better that way :-)
    FAILURE, SUCCESS,

    ANY, ANY_ALL,
    ASSERT, ASSERT_NOT,
    AT,
    BRANCH,
    CALL,
    CATEGORY,
    CHARSET, BIGCHARSET,
    GROUPREF, GROUPREF_IGNORE,
    IN, IN_IGNORE,
    INFO,
    JUMP,
    LITERAL, LITERAL_IGNORE,
    MARK,
    MAX_UNTIL,
    MIN_UNTIL,
    NOT_LITERAL, NOT_LITERAL_IGNORE,
    NEGATE,
    RANGE,
    REPEAT,
    REPEAT_ONE,
    SUBPATTERN

]

ATCODES = [
    AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,
    AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,
    AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY,
    AT_UNI_NON_BOUNDARY
]

CHCODES = [
    CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE,
    CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD,
    CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD,
    CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT,
    CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD,
    CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK,
    CATEGORY_UNI_NOT_LINEBREAK
]

def makedict(list):
    d = {}
    i = 0
    for item in list:
        d[item] = i
        i = i + 1
    return d

OPCODES = makedict(OPCODES)
ATCODES = makedict(ATCODES)
CHCODES = makedict(CHCODES)

# replacement operations for "ignore case" mode
OP_IGNORE = {
    GROUPREF: GROUPREF_IGNORE,
    IN: IN_IGNORE,
    LITERAL: LITERAL_IGNORE,
    NOT_LITERAL: NOT_LITERAL_IGNORE
}

AT_MULTILINE = {
    AT_BEGINNING: AT_BEGINNING_LINE,
    AT_END: AT_END_LINE
}

AT_LOCALE = {
    AT_BOUNDARY: AT_LOC_BOUNDARY,
    AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY
}

AT_UNICODE = {
    AT_BOUNDARY: AT_UNI_BOUNDARY,
    AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY
}

CH_LOCALE = {
    CATEGORY_DIGIT: CATEGORY_DIGIT,
    CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT,
    CATEGORY_SPACE: CATEGORY_SPACE,
    CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE,
    CATEGORY_WORD: CATEGORY_LOC_WORD,
    CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD,
    CATEGORY_LINEBREAK: CATEGORY_LINEBREAK,
    CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK
}

CH_UNICODE = {
    CATEGORY_DIGIT: CATEGORY_UNI_DIGIT,
    CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT,
    CATEGORY_SPACE: CATEGORY_UNI_SPACE,
    CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE,
    CATEGORY_WORD: CATEGORY_UNI_WORD,
    CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD,
    CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK,
    CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK
}

# flags
SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)
SRE_FLAG_IGNORECASE = 2 # case insensitive
SRE_FLAG_LOCALE = 4 # honour system locale
SRE_FLAG_MULTILINE = 8 # treat target as multiline string
SRE_FLAG_DOTALL = 16 # treat target as a single string
SRE_FLAG_UNICODE = 32 # use unicode locale
SRE_FLAG_VERBOSE = 64 # ignore whitespace and comments
SRE_FLAG_DEBUG = 128 # debugging

# flags for INFO primitive
SRE_INFO_PREFIX = 1 # has prefix
SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
SRE_INFO_CHARSET = 4 # pattern starts with character from given set

if __name__ == "__main__":
    import string
    def dump(f, d, prefix):
        items = d.items()
        items.sort(lambda a, b: cmp(a[1], b[1]))
        for k, v in items:
            f.write("#define %s_%s %s\n" % (prefix, string.upper(k), v))
    f = open("sre_constants.h", "w")
    f.write("""\

""")

    f.write("#define SRE_MAGIC %d\n" % MAGIC)

    dump(f, OPCODES, "SRE_OP")
    dump(f, ATCODES, "SRE")
    dump(f, CHCODES, "SRE")

    f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE)
    f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE)
    f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE)
    f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE)
    f.write("#define SRE_FLAG_DOTALL %d\n" % SRE_FLAG_DOTALL)
    f.write("#define SRE_FLAG_UNICODE %d\n" % SRE_FLAG_UNICODE)
    f.write("#define SRE_FLAG_VERBOSE %d\n" % SRE_FLAG_VERBOSE)

    f.write("#define SRE_INFO_PREFIX %d\n" % SRE_INFO_PREFIX)
    f.write("#define SRE_INFO_LITERAL %d\n" % SRE_INFO_LITERAL)
    f.write("#define SRE_INFO_CHARSET %d\n" % SRE_INFO_CHARSET)

    f.close()
    print "done"


text:
<!doctype html>

	<title>Foresight.js Demo: imageN Element</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link href="demo.css" type="text/css" rel="stylesheet" />

			imageN Element

			As in, an image has N number of sources/variants.

			Test to see if child elements within the <imagen> element appear in the DOM.

		<imagen>
			<source src="http://foresightjs.appspot.com/static-images/castle-small.jpg">
			<source src="http://foresightjs.appspot.com/static-images/castle-medium.jpg" media="(min-width: 320px)">
			<source src="http://foresightjs.appspot.com/static-images/castle-large.jpg" media="(min-width: 480px)">

		</imagen>

Demo Homepage

Foresight.js Homepage


text:
window.onload = function() {

    var ul = document.getElementById('lista');
    var boton = document.getElementById('add');
    //var lis = ul.querySelectorAll('li');

    var log= function () {

        console.log("New Date ");
    };

    var add = function(e) {

        e.stopPropagation();
        if (ul) {
            var nuevoli = document.createElement('li');

            nuevoli.innerText = 'Elemento ' + (ul.children.length + 1);
            ul.appendChild(nuevoli);

        }
    };

    var remove = function(e) {
        if (confirm("Estas seguro de que quieres eliminar esto?")) {
            this.removeChild(e.target);
        }

    };

    if (boton) {
        boton.addEventListener('click', add, false);
    }

  /*  if (lis.length) {

        for (var i = lis.length - 1; i >= 0; i--) {

            lis[i] = addEventListener('click', remove, false);
        }
    }*/

    if(ul)
    {
         ul.addEventListener('click', remove, false);
    }

    document.addEventListener('click', log, false);
};


text:
namespace base {
namespace debug {

// Scans |proc_maps| starting from |pos| returning true if the gate VMA was
// found, otherwise returns false.
static bool ContainsGateVMA(std::string* proc_maps, size_t pos) {
#if defined(ARCH_CPU_ARM_FAMILY)
  // The gate VMA on ARM kernels is the interrupt vectors page.
  return proc_maps->find(" [vectors]\n", pos) != std::string::npos;
#elif defined(ARCH_CPU_X86_64)
  // The gate VMA on x86 64-bit kernels is the virtual system call page.
  return proc_maps->find(" [vsyscall]\n", pos) != std::string::npos;
#else
  // Otherwise assume there is no gate VMA in which case we shouldn't
  // get duplicate entires.
  return false;
#endif
}

bool ReadProcMaps(std::string* proc_maps) {
  // seq_file only writes out a page-sized amount on each call. Refer to header
  // file for details.
  const long kReadSize = sysconf(_SC_PAGESIZE);

  int fd = HANDLE_EINTR(open("/proc/self/maps", O_RDONLY));
  if (fd == -1) {
    DPLOG(ERROR) << "Couldn't open /proc/self/maps";
    return false;
  }
  file_util::ScopedFD fd_closer(&fd);
  proc_maps->clear();

  while (true) {
    // To avoid a copy, resize |proc_maps| so read() can write directly into it.
    // Compute |buffer| afterwards since resize() may reallocate.
    size_t pos = proc_maps->size();
    proc_maps->resize(pos + kReadSize);
    void* buffer = &(*proc_maps)[pos];

    ssize_t bytes_read = HANDLE_EINTR(read(fd, buffer, kReadSize));
    if (bytes_read < 0) {
      DPLOG(ERROR) << "Couldn't read /proc/self/maps";
      proc_maps->clear();
      return false;
    }

    // ... and don't forget to trim off excess bytes.
    proc_maps->resize(pos + bytes_read);

    if (bytes_read == 0)
      break;

    // The gate VMA is handled as a special case after seq_file has finished
    // iterating through all entries in the virtual memory table.
    //
    // Unfortunately, if additional entries are added at this point in time
    // seq_file gets confused and the next call to read() will return duplicate
    // entries including the gate VMA again.
    //
    // Avoid this by searching for the gate VMA and breaking early.
    if (ContainsGateVMA(proc_maps, pos))
      break;
  }

  return true;
}

bool ParseProcMaps(const std::string& input,
                   std::vector<MappedMemoryRegion>* regions_out) {
  std::vector<MappedMemoryRegion> regions;

  // This isn't async safe nor terribly efficient, but it doesn't need to be at
  // this point in time.
  std::vector<std::string> lines;
  SplitString(input, '\n', &lines);

  for (size_t i = 0; i < lines.size(); ++i) {
    // Due to splitting on '\n' the last line should be empty.
    if (i == lines.size() - 1) {
      if (!lines[i].empty())
        return false;
      break;
    }

    MappedMemoryRegion region;
    const char* line = lines[i].c_str();
    char permissions[5] = {'\0'};  // Ensure NUL-terminated string.
    uint8 dev_major = 0;
    uint8 dev_minor = 0;
    long inode = 0;
    int path_index = 0;

    // Sample format from man 5 proc:
    //
    // address           perms offset  dev   inode   pathname
    // 08048000-08056000 r-xp 00000000 03:0c 64593   /usr/sbin/gpm
    //
    // The final %n term captures the offset in the input string, which is used
    // to determine the path name. It *does not* increment the return value.
    // Refer to man 3 sscanf for details.
    if (sscanf(line, "%" SCNxPTR "-%" SCNxPTR " %4c %llx %hhx:%hhx %ld %n",
               &region.start, &region.end, permissions, &region.offset,
               &dev_major, &dev_minor, &inode, &path_index) < 7) {
      return false;
    }

    region.permissions = 0;

    if (permissions[0] == 'r')
      region.permissions |= MappedMemoryRegion::READ;
    else if (permissions[0] != '-')
      return false;

    if (permissions[1] == 'w')
      region.permissions |= MappedMemoryRegion::WRITE;
    else if (permissions[1] != '-')
      return false;

    if (permissions[2] == 'x')
      region.permissions |= MappedMemoryRegion::EXECUTE;
    else if (permissions[2] != '-')
      return false;

    if (permissions[3] == 'p')
      region.permissions |= MappedMemoryRegion::PRIVATE;
    else if (permissions[3] != 's' && permissions[3] != 'S')  // Shared memory.
      return false;

    // Pushing then assigning saves us a string copy.
    regions.push_back(region);
    regions.back().path.assign(line + path_index);
  }

  regions_out->swap(regions);
  return true;
}

}  // namespace debug
}  // namespace base