text:
package org.apache.commons.beanutils2.converters;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.Objects;

import org.apache.commons.beanutils2.ConversionException;
import org.apache.commons.beanutils2.Converter;

import junit.framework.TestCase;

/**
 * Abstract base for <Date>Converter classes.
 *
 * @param <T> type to test
 */
public abstract class DateConverterTestBase<T> extends TestCase {

    /**
     * Constructs a new test case.
     * @param name Name of the test
     */
    public DateConverterTestBase(final String name) {
        super(name);
    }

    /**
     * Gets the expected type
     * @return The expected type
     */
    protected abstract Class<T> getExpectedType();

    /**
     * Converts a Date or Calendar objects to the time in milliseconds
     * @param date The date or calendar object
     * @return The time in milliseconds
     */
    long getTimeInMillis(final Object date) {
        if (date instanceof java.sql.Date) {
            return ((java.sql.Date) date).getTime();
        }

        if (date instanceof java.sql.Timestamp) {
            return ((java.sql.Timestamp) date).getTime();
        }

        if (date instanceof LocalDate) {
            return ((LocalDate) date).atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli();
        }

        if (date instanceof LocalDateTime) {
            return ((LocalDateTime) date).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
        }

        if (date instanceof ZonedDateTime) {
            return ((ZonedDateTime) date).toInstant().toEpochMilli();
        }

        if (date instanceof OffsetDateTime) {
            return ((OffsetDateTime) date).toInstant().toEpochMilli();
        }

        if (date instanceof Calendar) {
            return ((Calendar) date).getTime().getTime();
        }

        if (date instanceof Date) {
            return ((Date) date).getTime();
        }
        throw new IllegalArgumentException(Objects.toString(date));
    }

    /**
     * Test Conversion Error
     * @param converter The converter to use
     * @param value The value to convert
     */
    void invalidConversion(final Converter converter, final Object value) {
        final String valueType = value == null ? "null" : value.getClass().getName();
        final String msg = "Converting '" + valueType + "' value '" + value + "'";
        try {
            final Object result = converter.convert(getExpectedType(), value);
            fail(msg + ", expected ConversionException, but result = '" + result + "'");
        } catch (final ConversionException ex) {
            // Expected Result
        }
    }

    /**
     * Create the Converter with no default value.
     * @return A new Converter
     */
    protected abstract DateTimeConverter<T> makeConverter();

    /**
     * Create the Converter with a default value.
     * @param defaultValue The default value
     * @return A new Converter
     */
    protected abstract DateTimeConverter<T> makeConverter(T defaultValue);

    /**
     * Test Conversion to String
     * @param converter The converter to use
     * @param expected The expected result
     * @param value The value to convert
     */
    void stringConversion(final Converter converter, final String expected, final Object value) {
        final String valueType = value == null ? "null" : value.getClass().getName();
        final String msg = "Converting '" + valueType + "' value '" + value + "' to String";
        try {
            final Object result = converter.convert(String.class, value);
            final Class<?> resultType = result   == null ? null : result.getClass();
            final Class<?> expectType = expected == null ? null : expected.getClass();
            assertEquals("TYPE "  + msg, expectType, resultType);
            assertEquals("VALUE " + msg, expected, result);
        } catch (final Exception ex) {
            throw new IllegalStateException(msg + " threw " + ex.toString(), ex);
        }
    }

    /**
     * Assumes convert() returns some non-null
     * instance of getExpectedType().
     */
    public void testConvertDate() {
        final String[] message= {
            "from Date",
            "from Calendar",
            "from SQL Date",
            "from SQL Time",
            "from SQL Timestamp",
            "from LocalDate",
            "from LocalDateTime",
            "from ZonedDateTime",
            "from OffsetDateTime"
        };

        final long nowMillis = System.currentTimeMillis();

        final Object[] date = {
            new Date(nowMillis),
            new java.util.GregorianCalendar(),
            new java.sql.Date(nowMillis),
            new java.sql.Time(nowMillis),
            new java.sql.Timestamp(nowMillis),
            Instant.ofEpochMilli(nowMillis).atZone(ZoneId.systemDefault()).toLocalDate()
                .atStartOfDay(ZoneId.systemDefault()).toLocalDate(),
            Instant.ofEpochMilli(nowMillis).atZone(ZoneId.systemDefault()).toLocalDateTime(),
            ZonedDateTime.ofInstant(Instant.ofEpochMilli(nowMillis), ZoneId.systemDefault()),
            OffsetDateTime.ofInstant(Instant.ofEpochMilli(nowMillis), ZoneId.systemDefault())
        };

        // Initialize calendar also with same ms to avoid a failing test in a new time slice
        ((GregorianCalendar)date[1]).setTime(new Date(nowMillis));

        for (int i = 0; i < date.length; i++) {
            final Object val = makeConverter().convert(getExpectedType(), date[i]);
            assertNotNull("Convert " + message[i] + " should not be null", val);
            assertTrue("Convert " + message[i] + " should return a " + getExpectedType().getName(),
                       getExpectedType().isInstance(val));

            long test = nowMillis;
            if (date[i] instanceof LocalDate || val instanceof LocalDate) {
                test = Instant.ofEpochMilli(nowMillis).atZone(ZoneId.systemDefault()).toLocalDate()
                    .atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli();
            }

            assertEquals("Convert " + message[i] + " should return a " + date[0],
                    test, getTimeInMillis(val));
        }
    }

    /**
     * Assumes ConversionException in response to covert(getExpectedType(), null).
     */
    public void testConvertNull() {
        try {
            makeConverter().convert(getExpectedType(), null);
            fail("Expected ConversionException");
        } catch(final ConversionException e) {
            // expected
        }
    }

    /**
     * Test default String to type conversion
     *
     * N.B. This method is overridden by test case
     * implementations for java.sql.Date/Time/Timestamp
     */
    public void testDefaultStringToTypeConvert() {

        // Create & Configure the Converter
        final DateTimeConverter converter = makeConverter();
        converter.setUseLocaleFormat(false);
        try {
            converter.convert(getExpectedType(), "2006-10-23");
            fail("Expected Conversion exception");
        } catch (final ConversionException e) {
            // expected result
        }

    }

    /**
     * Test Default Type conversion (i.e. don't specify target type)
     */
    public void testDefaultType() {
        final String pattern = "yyyy-MM-dd";

        // Create & Configure the Converter
        final DateTimeConverter converter = makeConverter();
        converter.setPattern(pattern);

        // Valid String --> Type Conversion
        final String testString = "2006-10-29";
        final Calendar calendar = toCalendar(testString, pattern, null);
        final Object expected   = toType(calendar);

        final Object result = converter.convert(null, testString);
        if (getExpectedType().equals(Calendar.class)) {
            assertTrue("TYPE ", getExpectedType().isAssignableFrom(result.getClass()));
        } else {
            assertEquals("TYPE ", getExpectedType(), result.getClass());
        }
        assertEquals("VALUE ", expected, result);
    }

    /**
     * Test Converter with types it can't handle
     */
    public void testInvalidType() {

        // Create & Configure the Converter
        final DateTimeConverter converter = makeConverter();

        // Invalid Class Type
        try {
            converter.convert(Character.class, new Date());
            fail("Requested Character.class conversion, expected ConversionException");
        } catch (final ConversionException e) {
            // Expected result
        }
    }

    /**
     * Test Date Converter with no default value
     */
    public void testLocale() {

        // Re-set the default Locale to Locale.US
        final Locale defaultLocale = Locale.getDefault();
        Locale.setDefault(Locale.US);

        final String pattern = "M/d/yy"; // SHORT style date format for US Locale

        // Create & Configure the Converter
        final DateTimeConverter converter = makeConverter();
        converter.setUseLocaleFormat(true);

        // Valid String --> Type Conversion
        final String testString = "10/28/06";
        final Object expected = toType(testString, pattern, null);
        validConversion(converter, expected, testString);

        // Invalid Conversions
        invalidConversion(converter, null);
        invalidConversion(converter, "");
        invalidConversion(converter, "2006-10-2X");
        invalidConversion(converter, "10.28.06");
        invalidConversion(converter, "10-28-06");
        invalidConversion(converter, Integer.valueOf(2));

        // Restore the default Locale
        Locale.setDefault(defaultLocale);

    }

    /**
     * Test Converter with multiple patterns
     */
    public void testMultiplePatterns() {
        String testString;
        Object expected;

        // Create & Configure the Converter
        final String[] patterns = {"yyyy-MM-dd", "yyyy/MM/dd"};
        final DateTimeConverter converter = makeConverter();
        converter.setPatterns(patterns);

        // First Pattern
        testString = "2006-10-28";
        expected = toType(testString, patterns[0], null);
        validConversion(converter, expected, testString);

        // Second pattern
        testString = "2006/10/18";
        expected = toType(testString, patterns[1], null);
        validConversion(converter, expected, testString);

        // Invalid Conversion
        invalidConversion(converter, "17/03/2006");
        invalidConversion(converter, "17.03.2006");

    }

    /**
     * Test Converter with no default value
     */
    public void testPatternDefault() {

        final String pattern = "yyyy-MM-dd";

        // Create & Configure the Converter
        final T defaultValue = toType("2000-01-01", pattern, null);
        assertNotNull("Check default date", defaultValue);
        final DateTimeConverter<T> converter = makeConverter(defaultValue);
        converter.setPattern(pattern);

        // Valid String --> Type Conversion
        final String testString = "2006-10-29";
        final Object expected = toType(testString, pattern, null);
        validConversion(converter, expected, testString);

        // Invalid Values, expect default value
        validConversion(converter, defaultValue, null);
        validConversion(converter, defaultValue, "");
        validConversion(converter, defaultValue, "2006-10-2X");
        validConversion(converter, defaultValue, "2006/10/01");
        validConversion(converter, defaultValue, "02/10/06");
        validConversion(converter, defaultValue, Integer.valueOf(2));

    }

    /**
     * Test Converter with no default value
     */
    public void testPatternNoDefault() {

        final String pattern = "yyyy-MM-dd";

        // Create & Configure the Converter
        final DateTimeConverter converter = makeConverter();
        converter.setPattern(pattern);

        // Valid String --> Type Conversion
        final String testString = "2006-10-29";
        final Calendar calendar = toCalendar(testString, pattern, null);
        final Object expected   = toType(calendar);
        validConversion(converter, expected, testString);

        // Valid java.util.Date --> Type Conversion
        validConversion(converter, expected, calendar);

        // Valid Calendar --> Type Conversion
        validConversion(converter, expected, toDate(calendar));

        // Test java.sql.Date --> Type Conversion
        validConversion(converter, expected, toSqlDate(calendar));

        // java.sql.Timestamp --> String Conversion
        validConversion(converter, expected, toSqlTimestamp(calendar));

        // java.sql.Time --> String Conversion
        validConversion(converter, expected, toSqlTime(calendar));

        // Invalid Conversions
        invalidConversion(converter, null);
        invalidConversion(converter, "");
        invalidConversion(converter, "2006-10-2X");
        invalidConversion(converter, "2006/10/01");
        invalidConversion(converter, "02/10/2006");
        invalidConversion(converter, "02/10/06");
        invalidConversion(converter, Integer.valueOf(2));

    }

    /**
     * Test Converter with no default value
     */
    public void testPatternNullDefault() {

        final String pattern = "yyyy-MM-dd";

        // Create & Configure the Converter
        final T defaultValue = null;
        final DateTimeConverter<T> converter = makeConverter(defaultValue);
        converter.setPattern(pattern);

        // Valid String --> Type Conversion
        final String testString = "2006-10-29";
        final Object expected = toType(testString, pattern, null);
        validConversion(converter, expected, testString);

        // Invalid Values, expect default --> null
        validConversion(converter, defaultValue, null);
        validConversion(converter, defaultValue, "");
        validConversion(converter, defaultValue, "2006-10-2X");
        validConversion(converter, defaultValue, "2006/10/01");
        validConversion(converter, defaultValue, "02/10/06");
        validConversion(converter, defaultValue, Integer.valueOf(2));

    }

    /**
     * Test Conversion to String
     */
    public void testStringConversion() {

        final String pattern = "yyyy-MM-dd";

        // Create & Configure the Converter
        final DateTimeConverter converter = makeConverter();
        converter.setPattern(pattern);

        // Create Values
        final String expected = "2006-10-29";
        final Calendar calendar = toCalendar(expected, pattern, null);

        // Type --> String Conversion
        stringConversion(converter, expected, toType(calendar));

        // Calendar --> String Conversion
        stringConversion(converter, expected, calendar);

        // java.util.Date --> String Conversion
        stringConversion(converter, expected, toDate(calendar));

        // java.sql.Date --> String Conversion
        stringConversion(converter, expected, toSqlDate(calendar));

        // java.sql.Timestamp --> String Conversion
        stringConversion(converter, expected, toSqlTimestamp(calendar));

        // java.sql.Time --> String Conversion
        stringConversion(converter, expected, toSqlTime(calendar));

        // java.time.LocalDateTime --> String Conversion
        stringConversion(converter, expected, toLocalDateTime(calendar));

        stringConversion(converter, null, null);
        stringConversion(converter, "", "");

    }

    /**
     * Parse a String value to a Calendar
     * @param value The String value to parse
     * @param pattern The date pattern
     * @param locale The locale to use (or null)
     * @return parsed Calendar value
     */
    Calendar toCalendar(final String value, final String pattern, final Locale locale) {
        Calendar calendar = null;
        try {
            final DateFormat format = locale == null
                           ? new SimpleDateFormat(pattern)
                           : new SimpleDateFormat(pattern, locale);
            format.setLenient(false);
            format.parse(value);
            calendar = format.getCalendar();
        } catch (final Exception e) {
            fail("Error creating Calendar value ='"
                    + value + ", pattern='" + pattern + "' " + e.toString());
        }
        return calendar;
    }

    /**
     * Convert a Calendar to a java.util.Date
     * @param calendar The calendar object to convert
     * @return The converted java.util.Date
     */
    Date toDate(final Calendar calendar) {
        return calendar.getTime();
    }

    /**
     * Convert a Calendar to a java.time.LocalDateTime
     * @param calendar The calendar object to convert
     * @return The converted java.time.LocalDate
     */
    LocalDateTime toLocalDateTime(final Calendar calendar) {
        return Instant.ofEpochMilli(calendar.getTimeInMillis()).atZone(ZoneId.systemDefault()).toLocalDateTime();
    }

    /**
     * Convert a Calendar to a java.sql.Date
     * @param calendar The calendar object to convert
     * @return The converted java.sql.Date
     */
    java.sql.Date toSqlDate(final Calendar calendar) {
        return new java.sql.Date(getTimeInMillis(calendar));
    }

    /**
     * Convert a Calendar to a java.sql.Time
     * @param calendar The calendar object to convert
     * @return The converted java.sql.Time
     */
    java.sql.Time toSqlTime(final Calendar calendar) {
        return new java.sql.Time(getTimeInMillis(calendar));
    }

    /**
     * Convert a Calendar to a java.sql.Timestamp
     * @param calendar The calendar object to convert
     * @return The converted java.sql.Timestamp
     */
    java.sql.Timestamp toSqlTimestamp(final Calendar calendar) {
        return new java.sql.Timestamp(getTimeInMillis(calendar));
    }

    /**
     * Convert from a Calendar to the appropriate Date type
     *
     * @param value The Calendar value to convert
     * @return The converted value
     */
    protected abstract T toType(Calendar value);

    /**
     * Parse a String value to the required type
     * @param value The String value to parse
     * @param pattern The date pattern
     * @param locale The locale to use (or null)
     * @return parsed Calendar value
     */
    T toType(final String value, final String pattern, final Locale locale) {
        return toType(toCalendar(value, pattern, locale));
    }

    /**
     * Test Conversion to the required type
     * @param converter The converter to use
     * @param expected The expected result
     * @param value The value to convert
     */
    void validConversion(final Converter converter, final Object expected, final Object value) {
        final String valueType = value == null ? "null" : value.getClass().getName();
        final String msg = "Converting '" + valueType + "' value '" + value + "'";
        try {
            final Object result = converter.convert(getExpectedType(), value);
            final Class<?> resultType = result   == null ? null : result.getClass();
            final Class<?> expectType = expected == null ? null : expected.getClass();
            assertEquals("TYPE "  + msg, expectType, resultType);
            assertEquals("VALUE " + msg, expected, result);
        } catch (final Exception ex) {
            fail(msg + " threw " + ex.toString());
        }
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.sql.planner;

import com.facebook.presto.spi.type.Type;
import com.facebook.presto.sql.tree.AtTimeZone;
import com.facebook.presto.sql.tree.Cast;
import com.facebook.presto.sql.tree.Expression;
import com.facebook.presto.sql.tree.ExpressionRewriter;
import com.facebook.presto.sql.tree.ExpressionTreeRewriter;
import com.facebook.presto.sql.tree.FunctionCall;
import com.facebook.presto.sql.tree.NodeRef;
import com.facebook.presto.sql.tree.QualifiedName;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import java.util.Map;

import static com.facebook.presto.spi.type.TimeType.TIME;
import static com.facebook.presto.spi.type.TimeWithTimeZoneType.TIME_WITH_TIME_ZONE;
import static com.facebook.presto.spi.type.TimestampType.TIMESTAMP;
import static com.facebook.presto.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE;
import static java.util.Objects.requireNonNull;

public class DesugaringRewriter
        extends ExpressionRewriter<Void>
{
    private final Map<NodeRef<Expression>, Type> expressionTypes;

    public DesugaringRewriter(Map<NodeRef<Expression>, Type> expressionTypes)
    {
        this.expressionTypes = ImmutableMap.copyOf(requireNonNull(expressionTypes, "expressionTypes is null"));
    }

    @Override
    public Expression rewriteAtTimeZone(AtTimeZone node, Void context, ExpressionTreeRewriter<Void> treeRewriter)
    {
        Expression value = treeRewriter.rewrite(node.getValue(), context);
        Type type = getType(node.getValue());
        if (type.equals(TIME)) {
            value = new Cast(value, TIME_WITH_TIME_ZONE.getDisplayName());
        }
        else if (type.equals(TIMESTAMP)) {
            value = new Cast(value, TIMESTAMP_WITH_TIME_ZONE.getDisplayName());
        }

        return new FunctionCall(QualifiedName.of("at_timezone"), ImmutableList.of(
                value,
                treeRewriter.rewrite(node.getTimeZone(), context)));
    }

    private Type getType(Expression expression)
    {
        return expressionTypes.get(NodeRef.of(expression));
    }
}

redpajama_set_name: RedPajamaGithub


text:
from setuptools import setup, find_packages

setup(
    name = "django-sidebar",
    version = "0.2.0",
    url = 'https://github.com/ekaputra07/django-sidebar',
	download_url = 'https://github.com/ekaputra07/django-sidebar/downloads',
    license = 'BSD',
    description = "Dynamic Sidebar creation for Django. Easily create and manage sidebar from Django Admin.",
    author = 'Eka Putra',
    author_email = 'ekaputra@balitechy.com',
    packages = find_packages(),
    include_package_data = True,
    zip_safe = False,
    classifiers = [
        'Development Status :: 3 - Alpha',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP',
    ]
)


text:
package org.apache.ambari.server.api.predicate.operators;

import org.apache.ambari.server.controller.predicate.LessPredicate;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * LESS operator test.
 */
public class LessOperatorTest {

  @Test
  public void testGetName() {
    assertEquals("LessOperator", new LessOperator().getName());
  }

  @Test
  public void testToPredicate() {
    assertEquals(new LessPredicate<String>("1", "2"),
        new LessOperator().toPredicate("1", "2"));
  }

  @Test
  public void testGetType() {
    assertSame(Operator.TYPE.LESS, new LessOperator().getType());
  }

  @Test
  public void testGetBasePrecedence() {
    assertEquals(-1, new LessOperator().getBasePrecedence());
  }

  @Test
  public void testGetPrecedence() {
    assertEquals(-1, new LessOperator().getPrecedence());
  }
}


text:
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Build Status](https://travis-ci.org/Media24si/ResponseCache.svg?branch=master)](https://travis-ci.org/Media24si/ResponseCache)

Laravel 5 response cache.

## Install

Require this package with Composer (Packagist), using the following command:

``` bash
$ composer require media24si/response-cache
```

Register the ResponseCacheServiceProvider to the providers array in `config/app.php`

``` php
Media24si\ResponseCache\ResponseCacheServiceProvider::class
```

Publish vendor files (config file):
``` bash
$ php artisan vendor:publish
```

To access cache manager register facade in `config/app.php`
``` php
'ResponseCacheManager' => Media24si\ResponseCache\Facades\ResponseCacheManagerFacade::class
```

## Usage

Register middleware as a global in `app/Http/Kernel.php`
``` php
\Media24si\ResponseCache\Http\Middleware\CacheMiddleware::class
```

To cache response, mark response as public and set max-age (TTL):
``` php
return response()->json(['name' => 'John'])
		->setPublic()
		->setMaxAge(600);
```

## Tag usage

Many times you want to assing tags to URI. With assigned tags it's simple to clear more cached URIs.

To assign tag to caching response, set `cache-tags` header. To assign more tags, seperate them with comma (,).

To cache response, mark response as public and set max-age (TTL):
``` php
return response()->json(['name' => 'John'])
		->setPublic()
		->setMaxAge(600)
		->header('cache-tags', 'foo,bar,john,doe');
```

To flush all keys for tag:
``` php
ResponseCacheManager::flushTag('foo')
```

## Config

Check `responseCache.php` for all possible configurations.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[manual]: http://guzzle.readthedocs.org/en/latest/


text:
//Problem 4. Sub-string in text

//Write a program that finds how many times a sub-string is contained in a given text (perform case insensitive search).

using System;

namespace SubStringInText
{
    class SubStringInText
    {
        static void Main(string[] args)
        {
            Console.Write("Please enter text: ");
            string someString = Console.ReadLine();
            Console.Write("Enter target sub-string: ");
            string subString = Console.ReadLine();
            int counter = 0;

            for (int i = 0; i < someString.Length; i++)
            {
                int index = someString.IndexOf(subString,i);
                if (index==i)
                {
                    counter++;
                }
            }

            Console.WriteLine("The result is: {0}",counter);
        }
    }
}


text:
From slahsdot:

CNN is reporting on a (relatively) new website called the Minisode Network that allows users to watch popular television shows that have been strategically condensed down to somewhere between four and six minutes.

"Don't think of the Minisode Network as a brand-new Web site. Think of it as a long-overdue public service. That is, who among us hasn't felt the double-edged sword of our media age: So much video from TV, DVDs, the Internet and even cell phones ... but too little time to watch it all? The Minisode Network has a solution. Launched in June as a broadband channel on the MySpace site, it offers, for our streaming pleasure, episodes of vintage Sony Pictures Television series like 'Silver Spoons,' 'Starsky & Hutch,' 'Diff'rent Strokes' and even Ricki Lake's talk show."

Now this is innovation! :-)


text:
(function () {
    "use strict";

    angular.module("airApp")
        .factory("StringService", StringService);

    StringService.$inject = [];

    function StringService() {
        var stringData = {};

        stringData = {
            isEmptyOrNull: function (item) {
                return (item === undefined || item === null || item === '' || item.length < 1);
            },
            isObjectEmpty: function (obj) {
                for (var key in obj) {
                    if (obj.hasOwnProperty(key))
                        return false;
                }
                return true;
            }
        };

        return stringData;
    }

})();


text:
package mesosphere.marathon.client.model.v2;

import mesosphere.marathon.client.utils.ModelUtils;

import java.util.Collection;

public class GetServerInfoResponse {
    private String frameworkId;
    private String leader;
    private String name;
    private String version;
    private HttpConfig http_config;
    private EventSubscriber event_subscriber;
    private MarathonConfig marathon_config;
    private ZookeeperConfig zookeeper_config;

    public String getFrameworkId() {
        return frameworkId;
    }

    public void setFrameworkId(String frameworkId) {
        this.frameworkId = frameworkId;
    }

    public String getLeader() {
        return leader;
    }

    public void setLeader(String leader) {
        this.leader = leader;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public HttpConfig getHttp_config() {
        return http_config;
    }

    public void setHttp_config(HttpConfig http_config) {
        this.http_config = http_config;
    }

    public EventSubscriber getEvent_subscriber() {
        return event_subscriber;
    }

    public void setEvent_subscriber(EventSubscriber event_subscriber) {
        this.event_subscriber = event_subscriber;
    }

    public MarathonConfig getMarathon_config() {
        return marathon_config;
    }

    public void setMarathon_config(MarathonConfig marathon_config) {
        this.marathon_config = marathon_config;
    }

    public ZookeeperConfig getZookeeper_config() {
        return zookeeper_config;
    }

    public void setZookeeper_config(ZookeeperConfig zookeeper_config) {
        this.zookeeper_config = zookeeper_config;
    }

    public class ZookeeperConfig {
        private String zk;
        private String zk_hosts;
        private String zk_path;
        private String zk_state;
        private Integer zk_timeout;
        private ZkFutureTimeout zk_future_timeout;

        public class ZkFutureTimeout {
            private Integer duration;

            public Integer getDuration() {
                return duration;
            }

            public void setDuration(Integer duration) {
                this.duration = duration;
            }

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

        public String getZk() {
            return zk;
        }

        public void setZk(String zk) {
            this.zk = zk;
        }

        public String getZk_hosts() {
            return zk_hosts;
        }

        public void setZk_hosts(String zk_hosts) {
            this.zk_hosts = zk_hosts;
        }

        public String getZk_path() {
            return zk_path;
        }

        public void setZk_path(String zk_path) {
            this.zk_path = zk_path;
        }

        public String getZk_state() {
            return zk_state;
        }

        public void setZk_state(String zk_state) {
            this.zk_state = zk_state;
        }

        public Integer getZk_timeout() {
            return zk_timeout;
        }

        public void setZk_timeout(Integer zk_timeout) {
            this.zk_timeout = zk_timeout;
        }

        public ZkFutureTimeout getZk_future_timeout() {
            return zk_future_timeout;
        }

        public void setZk_future_timeout(ZkFutureTimeout zk_future_timeout) {
            this.zk_future_timeout = zk_future_timeout;
        }

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

    public class MarathonConfig {
        private Boolean checkpoint;
        private String executor;
        private Integer failover_timeout;
        private Boolean ha;
        private String hostname;
        private Integer local_port_max;
        private Integer local_port_min;
        private String master;
        private String mesos_role;
        private String mesos_user;
        private Integer reconciliation_initial_delay;
        private Integer reconciliation_interval;
        private Integer task_launch_timeout;

        public String getExecutor() {
            return executor;
        }

        public void setExecutor(String executor) {
            this.executor = executor;
        }

        public Integer getFailover_timeout() {
            return failover_timeout;
        }

        public void setFailover_timeout(Integer failover_timeout) {
            this.failover_timeout = failover_timeout;
        }

        public Boolean getHa() {
            return ha;
        }

        public void setHa(Boolean ha) {
            this.ha = ha;
        }

        public String getHostname() {
            return hostname;
        }

        public void setHostname(String hostname) {
            this.hostname = hostname;
        }

        public Integer getLocal_port_max() {
            return local_port_max;
        }

        public void setLocal_port_max(Integer local_port_max) {
            this.local_port_max = local_port_max;
        }

        public Integer getLocal_port_min() {
            return local_port_min;
        }

        public void setLocal_port_min(Integer local_port_min) {
            this.local_port_min = local_port_min;
        }

        public String getMaster() {
            return master;
        }

        public void setMaster(String master) {
            this.master = master;
        }

        public String getMesos_role() {
            return mesos_role;
        }

        public void setMesos_role(String mesos_role) {
            this.mesos_role = mesos_role;
        }

        public String getMesos_user() {
            return mesos_user;
        }

        public void setMesos_user(String mesos_user) {
            this.mesos_user = mesos_user;
        }

        public Integer getReconciliation_initial_delay() {
            return reconciliation_initial_delay;
        }

        public void setReconciliation_initial_delay(Integer reconciliation_initial_delay) {
            this.reconciliation_initial_delay = reconciliation_initial_delay;
        }

        public Integer getReconciliation_interval() {
            return reconciliation_interval;
        }

        public void setReconciliation_interval(Integer reconciliation_interval) {
            this.reconciliation_interval = reconciliation_interval;
        }

        public Integer getTask_launch_timeout() {
            return task_launch_timeout;
        }

        public void setTask_launch_timeout(Integer task_launch_timeout) {
            this.task_launch_timeout = task_launch_timeout;
        }

        public Boolean getCheckpoint() {
            return checkpoint;
        }

        public void setCheckpoint(Boolean checkpoint) {
            this.checkpoint = checkpoint;
        }

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

    public class EventSubscriber {
        private String type;
        private Collection<String> http_endpoints;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public Collection<String> getHttp_endpoints() {
            return http_endpoints;
        }

        public void setHttp_endpoints(Collection<String> http_endpoints) {
            this.http_endpoints = http_endpoints;
        }

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

    public class HttpConfig {
        private String assets_path;
        private String http_port;
        private String https_port;

        public String getAssets_path() {
            return assets_path;
        }

        public void setAssets_path(String assets_path) {
            this.assets_path = assets_path;
        }

        public String getHttp_port() {
            return http_port;
        }

        public void setHttp_port(String http_port) {
            this.http_port = http_port;
        }

        public String getHttps_port() {
            return https_port;
        }

        public void setHttps_port(String https_port) {
            this.https_port = https_port;
        }

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

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


text:
package merchant

import (
	"go2o/core/infrastructure/domain"
)

var (
	ErrMerchantDisabled *domain.DomainError = domain.NewDomainError(
		"err_merchant_disabled", "商户已被停用")

	ErrEnabledFxSales *domain.DomainError = domain.NewDomainError(
		"err_enabled_fx_sales", "系统当前不允许启用分销")

	ErrMerchantExpires *domain.DomainError = domain.NewDomainError(
		"err_merchant_expires", "商户已过期")

	ErrNoSuchMerchant *domain.DomainError = domain.NewDomainError(
		"no_such_partner", "商户不存在")

	ErrNoSuchShop *domain.DomainError = domain.NewDomainError(
		"no_such_shop", "门店不存在")

	ErrMerchantNotMatch *domain.DomainError = domain.NewDomainError(
		"not_match", "商户不匹配")

	ErrSalesPercent *domain.DomainError = domain.NewDomainError(
		"err_sales_percent", "销售比例错误")

	ErrAmount *domain.DomainError = domain.NewDomainError(
		"err_mch_amount", "金额不正确")

	ErrNoMoreAmount *domain.DomainError = domain.NewDomainError(
		"err_mch_no_more_amount", "余额不足")

	ErrNoSuchSignUpInfo *domain.DomainError = domain.NewDomainError(
		"err_no_such_sign_up_info", "商户申请信息不存在")

	ErrRequireRejectRemark *domain.DomainError = domain.NewDomainError(
		"err_mch_require_remark", "请填写退回的原因")

	ErrMissingCompanyName *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_company_name", "请填写公司名称")

	ErrMissingMerchantName *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_merchant_name", "请填写商户名称")

	ErrMissingCompanyNo *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_company_no", "请填写营业执照编号")

	ErrMissingAddress *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_address", "请填写详细地址")

	ErrMissingPersonName *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_person_name", "请填写法人姓名")

	ErrMissingPersonId *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_person_id", "请填写法人身份证")

	ErrPersonCardId *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_person_card_id", "法人身份证号码不正确")

	ErrMissingCompanyImage *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_company_image", "请上传营业执照复印件")

	ErrMissingPersonImage *domain.DomainError = domain.NewDomainError(
		"err_mch_missing_person_image", "请上传法人身份证复印件")
)


text:
using Microsoft.WindowsAzure.Storage.Core.Auth;
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
namespace Microsoft.WindowsAzure.Storage.Table.Protocol
{
internal static class TableRequest
{
    public static void WriteSharedAccessIdentifiers(SharedAccessTablePolicies sharedAccessPolicies, Stream outputStream)
    {
        throw new System.NotImplementedException();
    }
    internal static string ExtractEntityIndexFromExtendedErrorInformation(RequestResult result)
    {
        throw new System.NotImplementedException();
    }
}

}


text:
package com.codeabovelab.dm.cluman.batch;

import com.codeabovelab.dm.cluman.cluster.filter.Filter;
import com.codeabovelab.dm.cluman.cluster.registry.RegistryRepository;
import com.codeabovelab.dm.cluman.cluster.registry.RegistryService;
import com.codeabovelab.dm.cluman.cluster.registry.data.Tags;
import com.codeabovelab.dm.cluman.job.JobBean;
import com.codeabovelab.dm.cluman.job.JobContext;
import com.codeabovelab.dm.cluman.job.JobParam;
import com.codeabovelab.dm.cluman.model.ContainerSource;
import com.codeabovelab.dm.cluman.model.ImageDescriptor;
import com.codeabovelab.dm.cluman.utils.ContainerUtils;
import com.codeabovelab.dm.common.utils.VersionComparator;
import lombok.Data;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import static com.codeabovelab.dm.cluman.batch.BatchUtils.JP_CLUSTER;
import static com.codeabovelab.dm.cluman.batch.LoadContainersOfImageTasklet.JP_IMAGE;

/**
 * Update matched containers to appropriate image of latest version or start a new one
 */
@JobBean(value = "job.updateToTagOrCreate", repeatable = true)
@Slf4j
@ToString
public class UpdateToTagOrCreateScheduledJob implements Runnable {

    private final ConcurrentMap<String, ImageInfo> versions = new ConcurrentHashMap<>();

    @Autowired
    private StopThenStartEachStrategy strategy;

    @Autowired
    private RegistryRepository registryRepository;

    @JobParam(BatchUtils.FILTER)
    private Filter filter;

    @Autowired
    private LoadContainersOfImageTasklet loader;

    @Autowired
    private CreateContainerTasklet containerCreator;

    @JobParam(value = JP_IMAGE, required = true)
    private String imagePattern;

    @JobParam(value = JP_CLUSTER, required = true)
    private String cluster;

    @JobParam(value = "createIfNotExist", required = true)
    private boolean createIfNotExist;

    @Autowired
    private JobContext context;

    private final VersionComparator comparator = VersionComparator.builder()
            .addLatest("latest")
            .build();

    //TODO: stop after N errors!
    @Override
    public void run() {
        synchronized (versions) {
            log.debug("started job {}", this);
            log.debug("checking image for update {}", imagePattern);
            List<ProcessedContainer> containers = loader.getContainers(this::filterInner);
            if (CollectionUtils.isEmpty(containers)) {
                log.info("Nothing to update, scheduling new container");
                ImageInfo latest = getLatest(imagePattern);
                String image = ContainerUtils.setImageVersion(imagePattern, latest.getTag());
                log.info("About to create container {}", image);
                ProcessedContainer build = ProcessedContainer.builder().image(image).cluster(cluster).src(new ContainerSource()).build();
                containerCreator.execute(build);
                return;
            } else if (createIfNotExist) {
                strategy.run(this::filter, this::update);
            }
        }
    }

    private boolean filter(ProcessedContainer processedContainer) {

        if (!filterInner(processedContainer)) {
            return false;
        }
        String image = processedContainer.getImage();
        String version = ContainerUtils.getImageVersion(image);
        ImageInfo latest = getLatest(image);
        if (latest == null) {
            context.fire("Latest image of \"{0}\" is null, skip.", image);
            return false;
        }
        // we process only containers which have non equal version
        if (version != null && !version.equals(latest.getTag())) {
            return true;
        }
        String imageId = processedContainer.getImageId();
        Assert.notNull(imageId, "processedContainer.imageId is null");
        // TODO compare IDs
        return !imageId.equals(latest.getId());
    }

    private boolean filterInner(ProcessedContainer processedContainer) {

        if (filter == null) {
            return true;
        }
        boolean test = filter.test(processedContainer);
        if (!test) {
            log.info("container rejected by filter: {}, container: {}", filter, processedContainer);
        }
        return test;
    }

    private ProcessedContainer update(ProcessedContainer processedContainer) {
        // we update any container, because non updatable must be skipped by filter
        ImageInfo latest = getLatest(processedContainer.getImage());
        String image = processedContainer.getImage();
        String newImage = ContainerUtils.setImageVersion(image, latest.getTag());
        return processedContainer.makeNew().id(null).image(newImage).build();
    }

    private ImageInfo getLatest(String img) {
        return versions.computeIfAbsent(ContainerUtils.getRegistryAndImageName(img), (i) -> {
            RegistryService registry = registryRepository.getRegistryByImageName(i);
            String imageName = ContainerUtils.getImageNameWithoutPrefix(i);
            log.warn("can't find tags for {}", img);
            Tags tags = registry.getTags(imageName);
            Assert.notNull(tags, "can't find tags for " + img);
            List<String> tagsList = new ArrayList<>(tags.getTags());
            tagsList.sort(comparator);
            String tag = tagsList.get(tagsList.size() - 1);
            ImageDescriptor image = registry.getImage(imageName, tag);
            if (image == null) {
                return null;
            }
            return new ImageInfo(image.getId(), tag);
        });
    }

    @Data
    private static class ImageInfo {
        private final String id;
        private final String tag;
    }
}


text:
// util.js
// much wow utility functions
//

var vec3 = require("gl-matrix").vec3;
var _ = require("lodash");

const Promise = require('bluebird');
const co = Promise.coroutine;

var suc = function(s) {
    return Math.floor(s/100) == 2;
};

var mkqs = function(qs) {
    return _.pairs(qs).map(([k, v]) => {
        return k + "=" + encodeURIComponent(JSON.stringify(v));
    }).join("&");
};

function networkToNative(val) {
    return ((val & 0x00FF) << 24) |
           ((val & 0xFF00) <<  8) |
           ((val >> 8)  & 0xFF00) |
           ((val >> 24) & 0x00FF);
}

var getBinaryInternal = function(url, qs, params) {
    return new Promise((resolve, reject) => {
        var r = new XMLHttpRequest();

        let u = url + "?" + mkqs(qs);

        r.open("GET", u);
        r.withCredentials = (params.creds === true);
        r.responseType = "arraybuffer";

        r.onload = function(e) {
            if (this.readyState === 4) {
                // this request is done
                if (this.status === 200) {
                    let response = this.response;
                    // when fetching just raw files, we don't need to strip out the number of points
                    // indicator, set nostrip = true for such requests
                    //
                    let numPoints = -1;
                    if (!params.nostrip) {
                        let view = new DataView(response, response.byteLength - 4, 4);
                        numPoints = networkToNative(view.getUint32(0));

                        // need a better way of doing this
                        response = response.slice(0, response.byteLength - 4);
                    }

                    resolve({
                        contentType: this.getResponseHeader('content-type'),
                        response: response,
                        numPoints: numPoints
                    });
                }
                else {
                    reject(new Error('getBinary failed with status:' + this.status));
                }
            }
        };

        r.onerror = function(err) {
            reject(err);
        };

        r.onabort = function() {
            reject(new Error('request aborted.'));
        };

        r.send();
    });
};

var getBinary = getBinaryInternal;

var joinFloatBuffers = function(buffers) {
    let totalSize = buffers.reduce((a, b) => a + b.length, 0);
    let res = new Float32Array(totalSize);

    // copy all buffers in
    var offset = 0;
    buffers.forEach(r => {
        res.set(r, offset);
        offset += r.length;
    });

    return res;
};

var mergeStats = function(stats) {
    let mergeObjects = function(a, b) {
        if (!a && !b) return null;
        if (!a && b) return b;
        if (a && !b) return a;

        let pairs = _.map(b, (val, k) => {
            if (_.isObject(val)) {
                return [k, mergeObjects(val, a[k])];
            }
            else if (_.isArray(val)) {
                return [k, val.concat(a[k])];
            }

            return [k, (a[k] || 0) + val]
        });

        let zipped = _.zipObject(pairs);

        return zipped;
    };

    return stats.reduce(mergeObjects, {});
};

function get(url, params) {
    return new Promise((resolve, reject) => {
        const xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (suc(xhr.status))
                    resolve([xhr.getResponseHeader("content-type"), xhr.responseText]);
                else
                    reject(new Error("unsuccessful code: " + xhr.status));
            }
        };

        xhr.open("GET", url, true);
        xhr.setRequestHeader("Accept", "application/json");

        xhr.withCredentials = (params.creds === true);
        xhr.send();
    });
};

async function getJson(url, params) {
    const [contentType, data] = await get(url, params);

    if (!contentType.match(/^application\/json/))
        throw new Error("The recieved data type was not JSON, it was: " + contentType);

    return JSON.parse(data.toString('utf-8'));
};

var getWithTimeout = function(url, to, cb) {
    var xmlhttp;
    if (window.XMLHttpRequest) {
        xmlhttp=new XMLHttpRequest();
    }
    else {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) {
            if (suc(xmlhttp.status))
                cb(null, xmlhttp.responseText);
            else
                cb(new Error("unsuccessful code: " + xmlhttp.status));
        }
    };

    xmlhttp.ontimeout = function() {
        cb(new Error("Timeout"));
    };

    xmlhttp.open("GET",url,true);
    xmlhttp.timeout = to;
    xmlhttp.send();
};

var put = function(url, params, cb) {
    var http = new XMLHttpRequest();
    var p = [];
    for(var k in params) {
        p.push(encodeURIComponent(k) + "=" + encodeURIComponent(params[k]));
    }

    p = p.join("&");

    http.open("PUT", url, true);

    //Send the proper header information along with the request
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

    http.onreadystatechange = function() {//Call a function when the state changes.
        if(http.readyState == 4) {
            if(suc(http.status)) {
                cb(null, http.responseText);
            }
            else {
                cb(new Error("Unsuccessful error code:", http.status));
            }
        }
    };
    http.send(p);
};

var clamp = function(v, n, x) {
    return Math.min(x, Math.max(v, n));
};

var geocenter = function(bbox) {
    // get the center of the box and then transform it into our
    // coordinate space
    //
    var center = [bbox.mins[0] + (bbox.maxs[0] - bbox.mins[0]) / 2,
                  bbox.mins[1] + (bbox.maxs[1] - bbox.mins[1]) / 2,
                  bbox.mins[2] + (bbox.maxs[2] - bbox.mins[2]) / 2];

    // now transform it
    return [-center[0], center[2], center[1]];
};

var geodist = function(a, b) {
    return vec3.distance([a[0], 0, a[2]],
                         [b[0], 0, b[2]]);

};

var ginside = function(bbox, loc) {
    var x1 = bbox.mins[0];
    var x2 = bbox.maxs[0];

    var y1 = bbox.mins[1];
    var y2 = bbox.maxs[1];
    var x = -loc[0], y = loc[2];

    return (x >= x1 && x < x2 && y >= y1 && y < y2);
};

var getxyScreen = function(evt) {
    // taken from: http://www.javascripter.net/faq/mouseclickeventcoordinates.htm
    //
    var clickX=0, clickY=0;

    if ((evt.clientX || evt.clientY) &&
        document.body &&
        document.body.scrollLeft!=null) {
        clickX = evt.clientX + document.body.scrollLeft;
        clickY = evt.clientY + document.body.scrollTop;
    }
    if ((evt.clientX || evt.clientY) &&
        document.compatMode=='CSS1Compat' &&
        document.documentElement &&
        document.documentElement.scrollLeft!=null) {
        clickX = evt.clientX + document.documentElement.scrollLeft;
        clickY = evt.clientY + document.documentElement.scrollTop;
    }
    if (evt.pageX || evt.pageY) {
        clickX = evt.pageX;
        clickY = evt.pageY;
    }

    return [clickX, clickY];
};

var getxy = function(evt) {
    var x = evt.offsetX==undefined?evt.layerX:evt.offsetX;
    var y = evt.offsetY==undefined?evt.layerY:evt.offsetY;

    return [x, y];
};

/**
 * Converts an HSL color value to RGB. Conversion formula
 * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
 * Assumes h, s, and l are contained in the set [0, 1] and
 * returns r, g, and b in the set [0, 255].
 *
 * Credits: http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion
 *
 * @param   h Number Number  h       The hue
 * @param   s Number  The saturation
 * @param   l Number  The lightness
 * @return  Array     The RGB representation
 */

let hue2rgb = function hue2rgb(p, q, t){
    if(t < 0) t += 1;
    if(t > 1) t -= 1;
    if(t < 1/6) return p + (q - p) * 6 * t;
    if(t < 1/2) return q;
    if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
    return p;
};

function hslToRgb(h, s, l, c){
    let r, g, b;

    if(s == 0){
        r = g = b = l; // achromatic
    }
    else {
        let q = l < 0.5 ? l * (1 + s) : l + s - l * s;
        let p = 2 * l - q;
        r = hue2rgb(p, q, h + 1/3);
        g = hue2rgb(p, q, h);
        b = hue2rgb(p, q, h - 1/3);
    }

    let ret = (c == null) ? [0, 0, 0] : c;

    ret[0] = Math.round(r * 255);
    ret[1] = Math.round(g * 255);
    ret[2] = Math.round(b * 255);

    return ret;
}

var perf_ts = function() {
    if (window.performance)
        return window.performance.now();
    return Date.now();
}
var perf_start = function() {
    return perf_ts();
}

var perf_end = function(start) {
    var t = perf_ts();
    return t - start;
}

var TriggeredDispatch = function(to, cb) {
    this.to = to;
    this.cb = cb;
    this.timer = null;
    this.v = undefined;
};

TriggeredDispatch.prototype.val = function(v) {
    this.v = v;

    if (this.timer !== null) {
        // there is an active timer, clear it out
        clearTimeout(this.timer);
        this.timer = null;
    }

    if (this.v !== undefined) {
        var o = this;
        this.timer = setTimeout(function() {
            o.timer = null;
            process.nextTick(o.cb.bind(null, o.v));
        }, this.to);
    }
};

TriggeredDispatch.prototype.simulateVal = function() {
	// similar to val, but doesn't take a new value, just reposts the current value,
	// this is needed so that certain UI controls can avoid using forceTrigger
	//
	if (this.v) {
		this.val(this.v);
	}
};

TriggeredDispatch.prototype.forceTrigger = function() {
	// force trigger the last recieved value
	if (this.v) {
        if (this.timer !== null) {
            // there is an active timer, clear it out
            clearTimeout(this.timer);
            this.timer = null;
        }

		process.nextTick(o.cb.bind(null, o.v));
	}
};

class HeightmapCapture {
    constructor(renderer) {
        this.renderer = renderer;
        this.lastCapture = null;
        this.lastCaptureRes = null;
    }

    captureForBounds(res, mins, maxs) {
        var view = mat4.identity(mat4.create());
        mat4.rotateX(view, view, 1.5705);

        // switch the projection X since it grows westwards
        //
        var projLower = [maxs[0], mins[1], mins[2]],
            projUpper = [mins[0], maxs[1], maxs[2]];

        var lower = vec3.transformMat4(vec3.create(), projLower, view);
        var upper = vec3.transformMat4(vec3.create(), projUpper, view);

        // establish our view matrix
        var topDownProjection = mat4.ortho(mat4.create(),
            lower[0], upper[0],
            upper[1], lower[1],
            -1000000, 1000000);

        var proj = mat4.multiply(mat4.create(), topDownProjection, view);

        // ask renderer to do the projection for us
        //
        this.lastCapture = this.renderer.projectToImage(proj, 1, res);
        this.lastCaptureRes = res;
        this.lastCaptureMins = mins;
        this.lastCaptureMaxs = maxs;
    }

    get rawData() {
        return this.lastCapture;
    }

    captureForRadius(res, center, radius) {
        this.captureForBounds(res,
            vec3.subtract(vec3.create(), center, [radius, radius, radius]),
            vec3.add(vec3.create(), center, [radius, radius, radius]));
    }

    worldCoordinatesToPixel(pos) {
        if (!this.lastCapture)
            throw new Error("Nothing has been captured");

        var mins = this.lastCaptureMins,
            maxs = this.lastCaptureMaxs;

        var fx = 1.0 - (pos[0] - mins[0]) / (maxs[0] - mins[0]),
            fy = 1.0 - (pos[2] - mins[2]) / (maxs[2] - mins[2]);

        return [
            Math.floor((this.lastCaptureRes - 1) * fx),
            Math.floor((this.lastCaptureRes - 1) * fy)
        ];
    }

    pixelToWorldCoordinates(x, y) {
        if (!this.lastCapture)
            throw new Error("Nothing has been captured");

        if (x >= this.lastCaptureRes ||
            y >= this.lastCaptureRes)
            throw new Error("Index out of range");

        var mins = this.lastCaptureMins,
            maxs = this.lastCaptureMaxs;

        return [
            mins[0] + x * (maxs[0] - mins[0]) / this.lastCaptureRes,
            this.readPixel(x, y),
            mins[2] + y * (maxs[2] - mins[2]) / this.lastCaptureRes];
    };

    readPixel(x, y) {
        if (!this.lastCapture)
            throw new Error("Nothing has been captured");

        if (x < 0 || x >= this.lastCaptureRes ||
            y < 0 || y >= this.lastCaptureRes)
            throw new Error("Coordinates out of bounds");

        return this.lastCapture [y * this.lastCaptureRes + x];
    }

    toDataURL(s) {
        if (!this.lastCapture)
            throw new Error("Nothing has been captured");

        let m = Number.MIN_SAFE_INTEGER, n = Number.MAX_SAFE_INTEGER;
        let res = this.lastCapture,
            SIZE = this.lastCaptureRes;

        for (var i = 0; i < res.length; i++) {
            m = Math.max(m, res[i]);
            n = Math.min(n, res[i]);
        }

        let c = document.createElement("canvas");
        c.width = c.height = SIZE;

        let ctx = c.getContext("2d");
        var img = ctx.createImageData(SIZE, SIZE);

        let woff = 0;
        for (let off = 0; off < res.length; off++) {
            let v = res[off];
            let col;

            if (Math.abs(v) < 0.000001) {
                // ignore things which are very close to 0, means nothing was renderered there
                col = 0;
            }
            else {
                let clf = (v - n) / (m - n);
                col = Math.floor(clf * 255);
            }

            img.data[woff] = col;
            img.data[woff+1] = col;
            img.data[woff+2] = col;
            img.data[woff+3] = 255;

            woff += 4;
        }

        ctx.putImageData(img, 0, 0);
        return c.toDataURL(s);
    }
}

let randomId = (prefix) => {
    return (prefix || 'id') + '-' + Math.random().toFixed(20).substring(2);
};

let pickPoint = (renderer, [x, y]) => {
    let p = renderer.pickPoint(x, y);

    if (Math.abs(p[0]) < 0.00001 &&
        Math.abs(p[1]) < 0.00001 &&
        Math.abs(p[2]) < 0.00001)
        return null;

    return p;
};

let pickUIPoint = (renderer, [x, y]) => {
    return renderer.pickUIPoint(x, y);
};

let isWindows = function() {
    return navigator.platform.indexOf("Win") === 0;
};

let isLinux = function() {
    return navigator.platform.indexOf("Linux") === 0;
};

let isChrome = function() {
    var isChromium = window.chrome,
        vendorName = window.navigator.vendor;
    return (isChromium !== null && isChromium !== undefined && vendorName === "Google Inc.");
};

let maprange = function(rs, re, v, ts, te) {
    let f = (v - rs) / (re - rs + 0.00001);
    f = Math.max(0, Math.min(1.0, f));
    return (ts + f * (te - ts));
};

/**
 * Compresses a RGB[A] color to a single floating point representation which can then be
 * decoded in GLSL shader programs.
 * @param {Number[]} color A 3 element array of numbers representing RGB color triplet.
 * @returns {number} A single float representing the encoded color.
 */
let compressColor = function(color) {
    let r = color[0],
        g = color[1],
        b = color[2];

    return r / (256 * 256 * 256) + g / (256 * 256) + b / 256;
};

let parsePlasioParams = function(url) {
    let qIndex = url.indexOf("?");
    if (qIndex === -1) // no query string
        return [url, {}];

    let qs = url.substring(qIndex + 1);
    let parts = qs.split("&");

    let [unknown, known] = parts.reduce(([unknown, known], p) => {
        let [k, v] = p.split("=");

        if (k.indexOf("pl-") === 0) {
            // we recognize this one
            return [unknown,
                    known.concat([k.substring(3), decodeURIComponent(v)])];
        }
        return [unknown.concat([p]),
                known];
    }, [[], []]);

    let paramsMap = {};
    known.forEach(([k, v]) => {
        paramsMap[k] = v
    });

    // reassemble components
    // replace the query string
    return [url.substring(0, qIndex) + "?" + unknown.join("&"),
            paramsMap];
};

let parseURLParams = function(url) {
    let qIndex = url.indexOf("?");
    if (qIndex === -1) // no query string
        return [url, {}];

    let qs = url.substring(qIndex + 1);
    let parts = qs.split("&");

    let params = {};

    parts.forEach((p) => {
        let [k, v] = p.split("=");
        params[k] = decodeURIComponent(v);
    });

    // reassemble components
    // replace the query string
    return [url.substring(0, qIndex),
            params];
};

let interpolateColor = function(out, s, e, f) {
    vec3.lerp(out, s, e, f);
    out[0] = Math.floor(out[0]);
    out[1] = Math.floor(out[1]);
    out[2] = Math.floor(out[2]);

    return out;
};

let parseColor = function(col) {
    if (!col) return null;

    let mm = col.match(/^#([0-9a-f]{6})$/i);
    if (!mm) return null;

    let m = mm[1];

    return [
        parseInt(m.substr(0,2),16) / 255.0,
        parseInt(m.substr(2,2),16) / 255.0,
        parseInt(m.substr(4,2),16) / 255.0
    ];
};

let joinPath = function(...parts) {
    let withPathCheck = (p) => {
        if (p.match(/^https?:\/\//))
            return p;
        return "http://" + p;
    };

    return parts.slice(1).reduce((p, c) => {
        if (p[p.length-1] === "/")
            return p + c;
        return p + "/" + c;
    }, withPathCheck(parts[0]));
};

var eastingFlipForBounds = function(bounds, fullGeoBounds) {
    var n = fullGeoBounds[0],
        x = fullGeoBounds[3];

    // the X coordinate is special, we go from East -> West as X increases, but in our 3D world
    // we go West to East as X increases, this causes our whole rendering stuff to appear reversed.
    // To keep things simple, we just flip the query here
    //
    // we want to flip the Y coordinate around the X = midX line
    //
    // Formula: px' = 2 * midX - px;
    //
    let midX = n + (x - n) / 2;
    var east = bounds[0],
        west = bounds[3];

    east = 2 * midX - east;
    west = 2 * midX - west;

    // we now need to swap eat and west, since east is now greater than west, we flip them
    var t = east; east = west ; west = t;

    // Don't modify original bounds
    var rbounds = bounds.slice(0);
    rbounds[0] = east;
    rbounds[3] = west;

    return rbounds;
};

var eastingFlipForVector = function(vector, fullGeoBounds) {
    var n = fullGeoBounds[0],
        x = fullGeoBounds[3];

    // the X coordinate is special, we go from East -> West as X increases, but in our 3D world
    // we go West to East as X increases, this causes our whole rendering stuff to appear reversed.
    // To keep things simple, we just flip the query here
    //
    // we want to flip the Y coordinate around the X = midX line
    //
    // Formula: px' = 2 * midX - px;
    //
    let midX = n + (x - n) / 2;
    var dx = vector[0];

    dx = 2 * midX - dx;

    var rvector = vector.slice(0);
    rvector[0] = dx;

    return rvector;
};

let checkParam = function(obj, field, def) {
    if (!obj)
        throw new Error('Source object is not specified');

    const val = obj[field];
    if (val == null) {
        if (def !== undefined) return def;
        throw new Error('Missing required field: ' + field +
            ' among: ' + (Object.keys(obj).join(", ")));
    }

    return val;
};

let boundsCenter = function(arg) {
    if (_.isArray(arg) && arg.length === 6) {
        return [
            arg[0] + (arg[3] - arg[0]) * 0.5,
            arg[1] + (arg[4] - arg[1]) * 0.5,
            arg[2] + (arg[5] - arg[2]) * 0.5
        ];
    }

    throw new Error('Invalid argument, need an array with 6 elements');
};

/**
 * @typedef {Object} ParsedSpec
 * A parsed out representation of a brush spec, e.g. <tt>local://elevation</tt>
 * @property {String} scheme The scheme for the spec.  A scheme basically namespaces brushes. e.g. <tt>local</tt>.
 * @property {String} name The name of the spec. e.g. <tt>elevation</tt>.
 * @property {Object.<String, String>} params Parse out parameters similar to a URLs query string.
 */

/**
 * @function
 * Parse a brush's string representation into a usable data structure.
 * @param {String} spec The spec string to parse e.g. <tt>local://color?a=1&b=2</tt>.
 * @return {ParsedSpec} The parse out brush specification.
 */
let parseBrushSpec = function(spec) {
    const parts = spec.split('?');
    if (parts.length > 2)
        throw new Error('Malformed spec, multiple ?, encode your URLs if you\'re specifying them as parameters');

    const firstPart = parts[0];
    const props = parts[1];

    const m = firstPart.match(/^([a-z]+):\/\/(\S+)$/);
    if (!m)
        throw new Error('Malformed spec, should start with a scheme://name, where scheme is all small alphanumeric characters, matched: ' + firstPart);

    const scheme = m[1];
    const name = m[2];
    const params = {};

    if (props) {
        const allParts = props.split('&');
        allParts.forEach(p => {
            const paramParts = p.split('=');
            if (paramParts.length !== 2) {
                throw new Error('Invalid parameter syntax for: ' + p);
            }

            const [key, v] = paramParts;
            const value = decodeURIComponent(v);

            // if this paramter already exists, we need to convert it into an array
            if (params[key] && !Array.isArray(params[key])) {
                params[key] = [params[key]];
            }

            // if the value is an array we only push non null values
            if (Array.isArray(params[key])) {
                if (value)
                    params[key].push(value);
            }
            else {
                params[key] = value ? value : null;
            }
        });
    }

    return {
        scheme: scheme,
        name: name,
        params: params
    };
};

/**
 * Determines the largest and the smallest number in the supplied array.  Returns a 2-element array with `[min, max]` and elements.
 * If there are no elements in `arrayOfNumbers` then `max > min` is returned.
 *
 * @param {Number[]} arrayOfNumbers An array of number.
 * @return {Number[]} A pair of numbers as `[min, max]`.
 */
let minmax = function(arrayOfNumbers) {
    let n = Number.MAX_SAFE_INTEGER;
    let m = Number.MIN_SAFE_INTEGER;

    for (let i = 0, il = arrayOfNumbers.length ; i < il ; i ++) {
        const number = arrayOfNumbers[i];

        if (n > number) n = number;
        if (m < number) m = number;
    }

    return [n, m]
};

/**
 * Determines the largest and the smallest number in the supplied Iterator.  Returns a 2-element array with `[min, max]` and elements.
 * If there are no elements in `arrayOfNumbers` then `max > min` is returned.
 *
 * @param {Iterator} iterator The iterator to traverse through
 * @return {Number[]} A pair of numbers as `[min, max]`.
 */
let minmaxIter = function(iterator) {
    let n = Number.MAX_SAFE_INTEGER;
    let m = Number.MIN_SAFE_INTEGER;

    for (let number of iterator) {
        if (n > number) n = number;
        if (m < number) m = number;
    }

    return [n, m]
};

/**
 * Determines if `boundA` is a region enclosing `boundsB`.
 * @function
 * @param {Number[]} boundsA A 6-element array which forms the containing bounds.
 * @param {Number[]} boundsB A 6-element array which forms the contained bounds.
 * @return {Boolean} true if `boundsA` encloses `boundsB`, false otherwise.  If `boundsA` is the same as `boundsB` then `boundsA` is determined
 * to enclose `boundsA` and returns true.
 */
let enclosesBounds = function(boundsA, boundsB) {
    const ab = boundsA;
    const bb = boundsB;

    return ab[0] <= bb[0] && ab[1] <= bb[1] && ab[2] <= bb[2] &&
        ab[3] >= bb[3] && ab[4] >= bb[4] && ab[5] >= bb[5];
};

/**
 * Determines if `boundA` is the same as `boundsB`
 * @function
 *
 * @param {Number[]} boundsA First bounds to compare.
 * @param {Number[]} boundsB Second bounds to compare.
 * @return {Boolean} true if `boundsA` is the same as `boundsB`, false otherwise.
 */
let equalBounds = function(boundsA, boundsB) {
    return (
        boundsA[0] == boundsB[0] &&
        boundsA[1] == boundsB[1] &&
        boundsA[2] == boundsB[2] &&
        boundsA[3] == boundsB[3] &&
        boundsA[4] == boundsB[4] &&
        boundsA[5] == boundsB[5]
    );
};

/**
 * Return bounds that represent the area which encloses all specified bounds
 * @function
 *
 * @param {Array.<Number[]>} bounds A list of bounds, 6 elements each.
 * @return {Number[]} A single bounds representation which encloses all specified bounds.
 */
let joinBounds = function(bounds) {
    let nx = Number.MAX_SAFE_INTEGER,
        ny = Number.MAX_SAFE_INTEGER,
        nz = Number.MAX_SAFE_INTEGER,
        xx = Number.MIN_SAFE_INTEGER,
        xy = Number.MIN_SAFE_INTEGER,
        xz = Number.MIN_SAFE_INTEGER;

    bounds.forEach(b => {
        if (nx > b[0]) nx = b[0];
        if (ny > b[1]) ny = b[1];
        if (nz > b[2]) nz = b[2];

        if (xx < b[3]) xx = b[3];
        if (xy < b[4]) xy = b[4];
        if (xz < b[5]) xz = b[5];
    });

    return [nx, ny, nz, xx, xy, xz];
};

/**
 * Merge stats into an already existing stats object.
 * @param into {BufferStats} A set of stats histograms to merge the new stats into.
 * @param newStats {BufferStats} A set of stats histograms that need to be merged into `original`.
 * @returns {BufferStats} The updated buffer stats.
 */
let accumulateStats = function(into, newStats) {
    for (let key in newStats) {
        if (newStats.hasOwnProperty(key)) {
            const news = newStats[key];
            let currents = into[key];
            if (!currents) currents = new Map();

            for (let [k, v] of news) {
                let c = currents.get(k) || 0;
                c = c + v;
                currents.set(k, c);
            }

            into[key] = currents;
        }
    }

    return into;
};

/**
 * Given a string with available ranged replacements, this function picks a valid extrapolated string.
 * @param {String} str A string with some ranged replacements.
 * @returns {String} An extrapolated string.
 */
let pickOne = function(str) {
    const re = /\[(\d+)-(\d+)\]/;
    let match = null;

    while((match = re.exec(str)) != null) {
        const start = parseInt(match[1]),
              end = parseInt(match[2]);

        if (start > end)
            throw new Error('Invalid range, start is greater than end:' + str);

        const res = start + Math.floor(Math.random() * (end - start + 1));
        str = str.replace(match[0], res.toString());
    }

    return str;
};

/**
 * @typedef {Object} ParsedResource
 * @property {String} resource The resource name
 * @property {String} The server address, with a protocol prefix.
 */

/**
 * Given a vector of resources and a server, parses the resources into resource and server pairs.  Each resource may
 * specify its own server string as well, but if one is missing then the <pre>server<pre> argument is used as fallback.
 * Each string needs to be formatted as <pre>resource@server</pre>, where the server part is optional and may include
 * protocol as well (http or https).
 *
 * @param resources {String[]} A vector of strings to parse
 * @param server String The default fallback server to use when a resource doesn't specify one.
 * @returns {ParsedResource} The collection of parsed resources
 */
const parseResources = function(resources, server) {
    let ret = [];
    const withPathCheck = (p) => {
        if (p.match(/^https?:\/\//))
            return p;
        return "http://" + p;
    };

    resources.forEach((r) => {
        // check if this is an ept resource
        if (r.match(/^epts?:\/\//)) {
            const eptRootUrl = r.replace(/^ept/, 'http');
            ret.push({
                eptRootUrl
            });
        }
        else {
            // parse regular resource handling
            const sepIndex = r.indexOf('@');
            let parsedResource = null, parsedServer = null;

            // is there a server specified?
            if (sepIndex < 0) {
                // No separator
                if (!server) {
                    throw new Error('A resource without a server was specified, but the fallback server is not defined: ' + r);
                }

                parsedResource = r;
                parsedServer = withPathCheck(server);
            }
            else {
                // There is a separator
                parsedResource = r.substr(0, sepIndex);
                parsedServer = withPathCheck(r.substr(sepIndex + 1))
            }

            ret.push({
                resource: parsedResource,
                server: parsedServer
            });
        }
    });

    return ret;
};

module.exports = {
    makeQueryString: mkqs,
    getBinary: getBinary,
    joinFloatBuffers: joinFloatBuffers,
    mergeStats: mergeStats,
    getJson: getJson,
    get: get,
    getWithTimeout: getWithTimeout,
    put: put,
    clamp: clamp,
    geocenter: geocenter,
    geodist: geodist,
    ginside: ginside,
    getxy: getxy,
    getxyScreen: getxyScreen,
    TriggeredDispatch: TriggeredDispatch,
    HeightmapCapture: HeightmapCapture,
    perf_start: perf_start,
    perf_end: perf_end,
    hslToRgb: hslToRgb,
    randomId: randomId,
    pickPoint: pickPoint,
    pickUIPoint: pickUIPoint,
    isWindows: isWindows,
    isLinux: isLinux,
    isChrome: isChrome,
    maprange: maprange,
    compressColor: compressColor,
    parsePlasioParams: parsePlasioParams,
    parseURLParams: parseURLParams,
    interpolateColor: interpolateColor,
    parseColor: parseColor,
    joinPath: joinPath,
    checkParam: checkParam,
    boundsCenter: boundsCenter,
    joinBounds: joinBounds,
    parseBrushSpec: parseBrushSpec,
    minmax: minmax,
    minmaxIter: minmaxIter,
    enclosesBounds: enclosesBounds,
    equalBounds: equalBounds,
    accumulateStats: accumulateStats,
    pickOne: pickOne,
    parseResources: parseResources
};


text:
<?php

namespace Api\Controller;

use Api\Mvc\Controller\RestfulController,
    Api\Model\ResponseCode;

class MenuController extends RestfulController {

  /**
   * Return list of resources
   *
   * @return Response
   */
  public function getList() {
    $designerModel = $this->getServiceLocator()->get('Designer');
    $designers = $designerModel->allVisible();
    $data['designers'] = array();
    if (count($designers)) {
      foreach ($designers as $designer) {
        $designerModel->setDesingerEntity($designer);
        $data['designers'][] = $designerModel->getRepresentation();
      }
    }

    $designerSeasonModel = $this->getServiceLocator()->get('DesignerSeason');
    $designerSeasons = $designerSeasonModel->allVisible();
    $data['seasons'] = array();
    if (count($designerSeasons)) {
      foreach ($designerSeasons as $designerSeason) {
        $designerSeasonModel->setDesignerSeasonEntity($designerSeason);
        $data['seasons'][] = $designerSeasonModel->getRepresentation();
      }
    }

    $data['brands'] = array(); #TODO: to be implemented

    $categoryModel = $this->getServiceLocator()->get('Category');
    $categories = $categoryModel->allVisible();
    $data['categories'] = array();
    if (count($categories)) {
      foreach ($categories as $category) {
        $categoryModel->setCategoryEntity($category);
        $data['categories'][] = $categoryModel->getRepresentation();
      }
    }

    $data['trunk_show'] = array(); #TODO: to be implemented
    return $this->generateResponse(ResponseCode::STATUS_FOUND, $data);
  }

}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.transcoder.v1beta1.model;

/**
 * Denoise preprocessing configuration.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Transcoder API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Denoise extends com.google.api.client.json.GenericJson {

  /**
   * Set strength of the denoise. Enter a value between 0 and 1. The higher the value, the smoother
   * the image. 0 is no denoising. The default is 0.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Double strength;

  /**
   * Set the denoiser mode. The default is `"standard"`. Supported denoiser modes: - 'standard' -
   * 'grain'
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String tune;

  /**
   * Set strength of the denoise. Enter a value between 0 and 1. The higher the value, the smoother
   * the image. 0 is no denoising. The default is 0.
   * @return value or {@code null} for none
   */
  public java.lang.Double getStrength() {
    return strength;
  }

  /**
   * Set strength of the denoise. Enter a value between 0 and 1. The higher the value, the smoother
   * the image. 0 is no denoising. The default is 0.
   * @param strength strength or {@code null} for none
   */
  public Denoise setStrength(java.lang.Double strength) {
    this.strength = strength;
    return this;
  }

  /**
   * Set the denoiser mode. The default is `"standard"`. Supported denoiser modes: - 'standard' -
   * 'grain'
   * @return value or {@code null} for none
   */
  public java.lang.String getTune() {
    return tune;
  }

  /**
   * Set the denoiser mode. The default is `"standard"`. Supported denoiser modes: - 'standard' -
   * 'grain'
   * @param tune tune or {@code null} for none
   */
  public Denoise setTune(java.lang.String tune) {
    this.tune = tune;
    return this;
  }

  @Override
  public Denoise set(String fieldName, Object value) {
    return (Denoise) super.set(fieldName, value);
  }

  @Override
  public Denoise clone() {
    return (Denoise) super.clone();
  }

}


text:
from django.conf.urls import patterns, url

urlpatterns = patterns('rh.views',
    url('^$', 'lista'),
    url(r'^(?P<funcionario_id>\w{0,50})$', 'individual'),
)


text:
<resources>
    <string name="app_name">Bookreview</string>
    <string name="dialog_username_input_title">Select a username</string>
    <string name="dialog_username_input_username_hint">Username</string>
    <string name="dialog_username_input_description">To start using the app, you need to select a username.</string>
    <string name="dialog_username_input_start_button">START</string>
    <string name="title_home">Available books</string>
    <string name="add_your_review">Add review</string>
    <string name="comments_on_book">Comments on book</string>
    <string name="submit_review">Submit</string>
    <string name="reviews_of_others">Reviews of others</string>
    <string name="book_published_at">Published: %d</string>
    <string name="hint_title">Title</string>
    <string name="hint_author">Author</string>
    <string name="hint_publish_year">Year published</string>
    <string name="hint_image_url">Image URL</string>
    <string name="add_book">Add book</string>
    <string name="add_book_title">Add book</string>
    <string name="search_hint">Search for a book</string>
    <string name="app_label">BookReview</string>
</resources>


text:
var test    = require('tape'),
    pattern = require('..'),
    match   = pattern.match

test('match array', function (t) {
    t.notOk(pattern({test:match.array}).matches({ _: {cid:1} }), 'does not match undefined')
    t.notOk(pattern({test:match.array}).matches({ _: {cid:1}, test: 'does not match' }), 'does not match string')
    t.notOk(pattern({test:match.array}).matches({ _: {cid:1}, test: false }), 'does not match false')
    t.notOk(pattern({test:match.array}).matches({ _: {cid:1}, test: true }), 'does not match true')
    t.notOk(pattern({test:match.array}).matches({ _: {cid:1}, test: 123 }), 'does not match number')
    t.ok(pattern({test:match.array}).matches({ _: {cid:1}, test: [1,2] }), 'does match array')

    t.end()
})


text:
<?php
require_once '../src/dao-user.class.php';
function out($msg, $var) {echo("
$msg

".htmlspecialchars(var_export($var, true))."

");}

echo("
User tests
");

$daoUser = new DAOUser();

$user =
[
    'name' => 'aaa',
    'address' => 'bbb',
    'some_property_not_defined' => 'this won\'t be retrieved',
    'email' => 'x'.time().'@x.com',
    'password' => 'abc123'
];
out("Creating user object", $user);

$user_id = $daoUser->create($user);
out("Creating new user on db", $user_id);

$user_db = $daoUser->get($user_id);
out("Retrieving new user created on db", $user_db);

$user_db['city'] = 'Belo horizonte';
$user_db['institution'] = 'UFMG';
$user_db['note'] = '
New note for the user';
out("Changing new user values", $user_db);

$user_update = $daoUser->update($user_db);
out("Updating new user on db", $user_update);

$user2_db = $daoUser->get($user_id);
out("Retrieving new user updated on db", $user2_db);

$user_delete = $daoUser->del($user_id);
out("Deleting new user", $user_delete);

$user3_db = $daoUser->get($user_id);
out("Trying to retrieve the new user that was deleted on db", $user3_db);