text:
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';

import './sass/style.scss';
import './sass/_fonts.scss';

import createReduxStore from './configureStore';
import Router from './Router';
import rootReducer from './reducers';
import Auth from './utils/authentication';

// Create Redux store
const store = createReduxStore(rootReducer);

// Authentication JWT middleware
Auth.ensureAuthenticated(store);

ReactDOM.render(
    <Provider store={store}>
        <Router />
    </Provider>, document.getElementById('app'),
);

redpajama_set_name: RedPajamaGithub


text:
module.exports = {
  QueryBuilder: require('./query-builder.js').default
};


text:
@interface STMTableViewController : UIViewController

@end


text:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
from subprocess import Popen, PIPE
class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
	pass
class WHandler(BaseHTTPRequestHandler):
	def do_POST(self):
		length = self.headers['content-length']
		data = self.rfile.read(int(length))
		p = Popen(['/usr/local/bin/createtemp.sh'], stdout=PIPE)
		p.wait()
		tmp_file = p.stdout.read()
		with open(tmp_file, 'w') as fh:
			fh.write(data.decode())
		p = Popen(['/usr/local/bin/runcsharp.sh', tmp_file], stdout=PIPE)
		p.wait()
		self.send_response(200)
		self.send_header('Content-type', 'text/json')
		self.end_headers()
		self.wfile.write(p.stdout.read().encode())
server = ThreadedHTTPServer(('', 7777), WHandler)
server.serve_forever()


text:
<?php

namespace OAuth2;

/**
 * Class to handle OAuth2 Responses in a graceful way.  Use this interface
 * to output the proper OAuth2 responses.
 *
 * @see OAuth2\ResponseInterface
 *
 * This class borrows heavily from the Symfony2 Framework and is part of the symfony package
 * @see Symfony\Component\HttpFoundation\Request (https://github.com/symfony/symfony)
 */
class Response implements ResponseInterface
{
    public $version;
    protected $statusCode = 200;
    protected $statusText;
    protected $parameters = array();
    protected $httpHeaders = array();

    public static $statusTexts = array(
        100 => 'Continue',
        101 => 'Switching Protocols',
        200 => 'OK',
        201 => 'Created',
        202 => 'Accepted',
        203 => 'Non-Authoritative Information',
        204 => 'No Content',
        205 => 'Reset Content',
        206 => 'Partial Content',
        300 => 'Multiple Choices',
        301 => 'Moved Permanently',
        302 => 'Found',
        303 => 'See Other',
        304 => 'Not Modified',
        305 => 'Use Proxy',
        307 => 'Temporary Redirect',
        400 => 'Bad Request',
        401 => 'Unauthorized',
        402 => 'Payment Required',
        403 => 'Forbidden',
        404 => 'Not Found',
        405 => 'Method Not Allowed',
        406 => 'Not Acceptable',
        407 => 'Proxy Authentication Required',
        408 => 'Request Timeout',
        409 => 'Conflict',
        410 => 'Gone',
        411 => 'Length Required',
        412 => 'Precondition Failed',
        413 => 'Request Entity Too Large',
        414 => 'Request-URI Too Long',
        415 => 'Unsupported Media Type',
        416 => 'Requested Range Not Satisfiable',
        417 => 'Expectation Failed',
        418 => 'I\'m a teapot',
        500 => 'Internal Server Error',
        501 => 'Not Implemented',
        502 => 'Bad Gateway',
        503 => 'Service Unavailable',
        504 => 'Gateway Timeout',
        505 => 'HTTP Version Not Supported',
    );

    public function __construct($parameters = array(), $statusCode = 200, $headers = array())
    {
        $this->setParameters($parameters);
        $this->setStatusCode($statusCode);
        $this->setHttpHeaders($headers);
        $this->version = '1.1';
    }

    /**
     * Converts the response object to string containing all headers and the response content.
     *
     * @return string The response with headers and content
     */
    public function __toString()
    {
        $headers = array();
        foreach ($this->httpHeaders as $name => $value) {
            $headers[$name] = (array) $value;
        }

        return
            sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
            $this->getHttpHeadersAsString($headers)."\r\n".
            $this->getResponseBody();
    }

    /**
     * Returns the build header line.
     *
     * @param string $name  The header name
     * @param string $value The header value
     *
     * @return string The built header line
     */
    protected function buildHeader($name, $value)
    {
        return sprintf("%s: %s\n", $name, $value);
    }

    public function getStatusCode()
    {
        return $this->statusCode;
    }

    public function setStatusCode($statusCode, $text = null)
    {
        $this->statusCode = (int) $statusCode;
        if ($this->isInvalid()) {
            throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $statusCode));
        }

        $this->statusText = false === $text ? '' : (null === $text ? self::$statusTexts[$this->statusCode] : $text);
    }

    public function getStatusText()
    {
        return $this->statusText;
    }

    public function getParameters()
    {
        return $this->parameters;
    }

    public function setParameters(array $parameters)
    {
        $this->parameters = $parameters;
    }

    public function addParameters(array $parameters)
    {
        $this->parameters = array_merge($this->parameters, $parameters);
    }

    public function getParameter($name, $default = null)
    {
        return isset($this->parameters[$name]) ? $this->parameters[$name] : $default;
    }

    public function setParameter($name, $value)
    {
        $this->parameters[$name] = $value;
    }

    public function setHttpHeaders(array $httpHeaders)
    {
        $this->httpHeaders = $httpHeaders;
    }

    public function setHttpHeader($name, $value)
    {
        $this->httpHeaders[$name] = $value;
    }

    public function addHttpHeaders(array $httpHeaders)
    {
        $this->httpHeaders = array_merge($this->httpHeaders, $httpHeaders);
    }

    public function getHttpHeaders()
    {
        return $this->httpHeaders;
    }

    public function getHttpHeader($name, $default = null)
    {
        return isset($this->httpHeaders[$name]) ? $this->httpHeaders[$name] : $default;
    }

    public function getResponseBody($format = 'json')
    {
        switch ($format) {
            case 'json':
                return json_encode($this->parameters);
            case 'xml':
                // this only works for single-level arrays
                $xml = new \SimpleXMLElement('<response/>');
                foreach ($this->parameters as $key => $param) {
                    $xml->addChild($key, $param);
                }

                return $xml->asXML();
        }

        throw new \InvalidArgumentException(sprintf('The format %s is not supported', $format));

    }

    public function send($format = 'json')
    {
        // headers have already been sent by the developer
        if (headers_sent()) {
            return;
        }

        switch ($format) {
            case 'json':
                $this->setHttpHeader('Content-Type', 'application/json');
                break;
            case 'xml':
                $this->setHttpHeader('Content-Type', 'text/xml');
                break;
        }
        // status
        header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText));

        foreach ($this->getHttpHeaders() as $name => $header) {
            header(sprintf('%s: %s', $name, $header));
        }
        echo $this->getResponseBody($format);
    }

    public function setError($statusCode, $error, $errorDescription = null, $errorUri = null)
    {
        $parameters = array(
            'error' => $error,
            'error_description' => $errorDescription,
        );

        if (!is_null($errorUri)) {
            if (strlen($errorUri) > 0 && $errorUri[0] == '#') {
                // we are referencing an oauth bookmark (for brevity)
                $errorUri = 'http://tools.ietf.org/html/rfc6749' . $errorUri;
            }
            $parameters['error_uri'] = $errorUri;
        }

        $httpHeaders = array(
            'Cache-Control' => 'no-store'
        );

        $this->setStatusCode($statusCode);
        $this->addParameters($parameters);
        $this->addHttpHeaders($httpHeaders);

        if (!$this->isClientError() && !$this->isServerError()) {
            throw new \InvalidArgumentException(sprintf('The HTTP status code is not an error ("%s" given).', $statusCode));
        }
    }

    public function setRedirect($statusCode, $url, $state = null, $error = null, $errorDescription = null, $errorUri = null)
    {
        if (empty($url)) {
            throw new \InvalidArgumentException('Cannot redirect to an empty URL.');
        }

        $parameters = array();

        if (!is_null($state)) {
            $parameters['state'] = $state;
        }

        if (!is_null($error)) {
            $this->setError(400, $error, $errorDescription, $errorUri);
        }
        $this->setStatusCode($statusCode);
        $this->addParameters($parameters);

        if (count($this->parameters) > 0) {
            // add parameters to URL redirection
            $parts = parse_url($url);
            $sep = isset($parts['query']) && count($parts['query']) > 0 ? '&' : '?';
            $url .= $sep . http_build_query($this->parameters);
        }

        $this->addHttpHeaders(array('Location' =>  $url));

        if (!$this->isRedirection()) {
            throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $statusCode));
        }
    }

    // http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
    /**
     * @return Boolean
     *
     * @api
     */
    public function isInvalid()
    {
        return $this->statusCode < 100 || $this->statusCode >= 600;
    }

    /**
     * @return Boolean
     *
     * @api
     */
    public function isInformational()
    {
        return $this->statusCode >= 100 && $this->statusCode < 200;
    }

    /**
     * @return Boolean
     *
     * @api
     */
    public function isSuccessful()
    {
        return $this->statusCode >= 200 && $this->statusCode < 300;
    }

    /**
     * @return Boolean
     *
     * @api
     */
    public function isRedirection()
    {
        return $this->statusCode >= 300 && $this->statusCode < 400;
    }

    /**
     * @return Boolean
     *
     * @api
     */
    public function isClientError()
    {
        return $this->statusCode >= 400 && $this->statusCode < 500;
    }

    /**
     * @return Boolean
     *
     * @api
     */
    public function isServerError()
    {
        return $this->statusCode >= 500 && $this->statusCode < 600;
    }

    /*
     * Functions from Symfony2 HttpFoundation - output pretty header
     */
    private function getHttpHeadersAsString($headers)
    {
        if (count($headers) == 0) {
            return '';
        }

        $max = max(array_map('strlen', array_keys($headers))) + 1;
        $content = '';
        ksort($headers);
        foreach ($headers as $name => $values) {
            foreach ($values as $value) {
                $content .= sprintf("%-{$max}s %s\r\n", $this->beautifyHeaderName($name).':', $value);
            }
        }

        return $content;
    }

    private function beautifyHeaderName($name)
    {
        return preg_replace_callback('/\-(.)/', array($this, 'beautifyCallback'), ucfirst($name));
    }

    private function beautifyCallback($match)
    {
        return '-'.strtoupper($match[1]);
    }
}


text:
package com.amazonaws.services.route53.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *

 * A complex type that contains information about the request to create a hosted zone.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetHostedZoneLimitRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The limit that you want to get. Valid values include the following:
     *

     *

     *

     *

     * MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     * MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the specified
     * private hosted zone.
     *

     *

     *

     */
    private String type;
    /**
     *

     * The ID of the hosted zone that you want to get a limit for.
     *

     */
    private String hostedZoneId;

    /**
     *

     * The limit that you want to get. Valid values include the following:
     *

     *

     *

     *

     * MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     * MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the specified
     * private hosted zone.
     *

     *

     *

     *
     * @param type
     *        The limit that you want to get. Valid values include the following:

     *

     *

     *

     *        MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     *        MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the
     *        specified private hosted zone.
     *

     *

     * @see HostedZoneLimitType
     */

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

    /**
     *

     * The limit that you want to get. Valid values include the following:
     *

     *

     *

     *

     * MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     * MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the specified
     * private hosted zone.
     *

     *

     *

     *
     * @return The limit that you want to get. Valid values include the following:

     *

     *

     *

     *         MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted
     *         zone.
     *

     *

     *

     *

     *         MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the
     *         specified private hosted zone.
     *

     *

     * @see HostedZoneLimitType
     */

    public String getType() {
        return this.type;
    }

    /**
     *

     * The limit that you want to get. Valid values include the following:
     *

     *

     *

     *

     * MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     * MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the specified
     * private hosted zone.
     *

     *

     *

     *
     * @param type
     *        The limit that you want to get. Valid values include the following:

     *

     *

     *

     *        MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     *        MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the
     *        specified private hosted zone.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     * @see HostedZoneLimitType
     */

    public GetHostedZoneLimitRequest withType(String type) {
        setType(type);
        return this;
    }

    /**
     *

     * The limit that you want to get. Valid values include the following:
     *

     *

     *

     *

     * MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     * MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the specified
     * private hosted zone.
     *

     *

     *

     *
     * @param type
     *        The limit that you want to get. Valid values include the following:

     *

     *

     *

     *        MAX_RRSETS_BY_ZONE: The maximum number of records that you can create in the specified hosted zone.
     *

     *

     *

     *

     *        MAX_VPCS_ASSOCIATED_BY_ZONE: The maximum number of Amazon VPCs that you can associate with the
     *        specified private hosted zone.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     * @see HostedZoneLimitType
     */

    public GetHostedZoneLimitRequest withType(HostedZoneLimitType type) {
        this.type = type.toString();
        return this;
    }

    /**
     *

     * The ID of the hosted zone that you want to get a limit for.
     *

     *
     * @param hostedZoneId
     *        The ID of the hosted zone that you want to get a limit for.
     */

    public void setHostedZoneId(String hostedZoneId) {
        this.hostedZoneId = hostedZoneId;
    }

    /**
     *

     * The ID of the hosted zone that you want to get a limit for.
     *

     *
     * @return The ID of the hosted zone that you want to get a limit for.
     */

    public String getHostedZoneId() {
        return this.hostedZoneId;
    }

    /**
     *

     * The ID of the hosted zone that you want to get a limit for.
     *

     *
     * @param hostedZoneId
     *        The ID of the hosted zone that you want to get a limit for.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetHostedZoneLimitRequest withHostedZoneId(String hostedZoneId) {
        setHostedZoneId(hostedZoneId);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getType() != null)
            sb.append("Type: ").append(getType()).append(",");
        if (getHostedZoneId() != null)
            sb.append("HostedZoneId: ").append(getHostedZoneId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof GetHostedZoneLimitRequest == false)
            return false;
        GetHostedZoneLimitRequest other = (GetHostedZoneLimitRequest) obj;
        if (other.getType() == null ^ this.getType() == null)
            return false;
        if (other.getType() != null && other.getType().equals(this.getType()) == false)
            return false;
        if (other.getHostedZoneId() == null ^ this.getHostedZoneId() == null)
            return false;
        if (other.getHostedZoneId() != null && other.getHostedZoneId().equals(this.getHostedZoneId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode());
        hashCode = prime * hashCode + ((getHostedZoneId() == null) ? 0 : getHostedZoneId().hashCode());
        return hashCode;
    }

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

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/Less-Work-Generators.iml" filepath="$PROJECT_DIR$/.idea/Less-Work-Generators.iml" />
      <module fileurl="file://$PROJECT_DIR$/../rails/.idea/rails.iml" filepath="$PROJECT_DIR$/../rails/.idea/rails.iml" />
      <module fileurl="file://$PROJECT_DIR$/../rails/.idea/rails.iml" filepath="$PROJECT_DIR$/../rails/.idea/rails.iml" />
    </modules>
  </component>
</project>


text:
package org.sakaiproject.tool.podcasts.util;

import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Performs date validation respecting i18n.

 * Note: This class does not support "hi_IN", "ja_JP_JP" and "th_TH" locales.
 */
public final class DateUtil {

	private DateUtil() {
	}

	/**
	 * Performs date validation checking like Feb 30, etc.
	 *
	 * @param date
	 *            The candidate String date.
	 * @param format
	 *            The given date-time format.
	 * @param locale
	 *            The given locale.
	 * @return TRUE - Conforms to a valid input date format string.

	 *         FALSE - Does not conform.
	 */
	public static boolean isValidDate(final String date, final String format, final Locale locale) {
		if (date == null || format == null) {
			return false;
		}

		List<String> replaced = new ArrayList<String>();
		String regex = createRegexFromDateFormat(format.trim(), replaced);

		DateFormatSymbols dateFormatSymbols;
		if (locale == null) {
			dateFormatSymbols = DateFormatSymbols.getInstance();
		} else {
			dateFormatSymbols = DateFormatSymbols.getInstance(locale);
		}

		// Check date
		int year = 0;
		int month = 1;
		int day = 1;
		Matcher matcher = Pattern.compile(regex).matcher(Matcher.quoteReplacement(date.trim()));
		if (!matcher.find()) {
			// Invalid date
			return false;
		}
		for (int group = 1; group <= matcher.groupCount(); group++) {
			boolean isValid;
			String[] strs;

			switch (replaced.get(group - 1).charAt(0)) {
			case 'y':	// Year
			case 'Y':	// Week year
				year = Integer.parseInt(matcher.group(group));
				if (year < 1582) {
					// Allow only 4 digits and Gregorian
					return false;
				}
				break;
			case 'M':	// Month in year
				try {
					month = Integer.parseInt(matcher.group(group));
				} catch (NumberFormatException e) {
					// Maybe Jan, January, ...
					isValid = false;
					for (int i = 0; i < 4 && !isValid; i++) {
						switch (i) {
						case 0:
						default:
							strs = DateFormatSymbols.getInstance(Locale.ENGLISH).getMonths();
							break;
						case 1:
							strs = DateFormatSymbols.getInstance(Locale.ENGLISH).getShortMonths();
							break;
						case 2:
							strs = dateFormatSymbols.getMonths();
							break;
						case 3:
							strs = dateFormatSymbols.getShortMonths();
							break;
						}
						for (int num = Calendar.JANUARY; num <= Calendar.DECEMBER; num++) {
							if (strs[num].equalsIgnoreCase(matcher.group(group))) {
								isValid = true;
								month = num + 1;
								break;
							}
						}
					}
					if (!isValid) {
						return false;
					}
				}
				if (month < 1 || month > 12) {
					return false;
				}
				break;
			case 'w':	// Week in year
				int num = Integer.parseInt(matcher.group(group));
				if (num < 1 || num > 53) {
					return false;
				}
				break;
			case 'W':	// Week in month
				num = Integer.parseInt(matcher.group(group));
				if (num < 0 || num > 6) {
					return false;
				}
				break;
			case 'D':	// Day in year
				num = Integer.parseInt(matcher.group(group));
				if (num < 1 || num > 366) {
					return false;
				}
				break;
			case 'd':	// Day in month
				day = Integer.parseInt(matcher.group(group));
				if (day < 1 || day > 31) {
					return false;
				}
				break;
			case 'F':	// Day of week in month
				num = Integer.parseInt(matcher.group(group));
				if (num < 1 || num > 5) {
					return false;
				}
				break;
			case 'E':	// Day name in week
				isValid = false;
				for (int i = 0; i < 4 && !isValid; i++) {
					switch (i) {
					case 0:
					default:
						strs = DateFormatSymbols.getInstance(Locale.ENGLISH).getWeekdays();
						break;
					case 1:
						strs = DateFormatSymbols.getInstance(Locale.ENGLISH).getShortWeekdays();
						break;
					case 2:
						strs = dateFormatSymbols.getWeekdays();
						break;
					case 3:
						strs = dateFormatSymbols.getShortWeekdays();
						break;
					}
					for (num = Calendar.SUNDAY; num <= Calendar.SATURDAY; num++) {
						if (strs[num].equalsIgnoreCase(matcher.group(group))) {
							isValid = true;
							break;
						}
					}
				}
				if (!isValid) {
					return false;
				}
				break;
			case 'u':	// Day number of week (1 = Monday, ..., 7 = Sunday)
				num = Integer.parseInt(matcher.group(group));
				if (num < 1 || num > 7) {
					return false;
				}
				break;
			case 'a':	// Am/pm marker
				isValid = false;
				for (int i = 0; i < 2 && !isValid; i++) {
					switch (i) {
					case 0:
					default:
						strs = DateFormatSymbols.getInstance(Locale.ENGLISH).getAmPmStrings();
						break;
					case 1:
						strs = dateFormatSymbols.getAmPmStrings();
						break;
					}
					for (num = Calendar.AM; num <= Calendar.PM; num++) {
						if (strs[num].equalsIgnoreCase(matcher.group(group))) {
							isValid = true;
							break;
						}
					}
				}
				if (!isValid) {
					return false;
				}
				break;
			case 'H':	// Hour in day (0-23)
				num = Integer.parseInt(matcher.group(group));
				if (num < 0 || num > 23) {
					return false;
				}
				break;
			case 'k':	// Hour in day (1-24)
				num = Integer.parseInt(matcher.group(group));
				if (num < 1 || num > 24) {
					return false;
				}
				break;
			case 'K':	// Hour in am/pm (0-11)
				num = Integer.parseInt(matcher.group(group));
				if (num < 0 || num > 11) {
					return false;
				}
				break;
			case 'h':	// Hour in am/pm (1-12)
				num = Integer.parseInt(matcher.group(group));
				if (num < 1 || num > 12) {
					return false;
				}
				break;
			case 'm':	// Minute in hour
				num = Integer.parseInt(matcher.group(group));
				if (num < 0 || num > 59) {
					return false;
				}
				break;
			case 's':	// Second in minute
				num = Integer.parseInt(matcher.group(group));
				if (num < 0 || num > 60) {
					// Include leap sec
					return false;
				}
				break;
			case 'S':	// Millisecond
				num = Integer.parseInt(matcher.group(group));
				if (num < 0 || num > 999) {
					return false;
				}
				break;
			default:
				break;
			}
		}

		return checkDate(day, month, year);
	}

	/**
	 * Validate whether the date input is valid.
	 */
	private static boolean checkDate(final int day, final int month, final int year) {
		// Is date valid for month?
		if (month == 2) {
			// Check for leap year
			if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
				// leap year
				if (day > 29) {
					return false;
				}
			} else {
				// normal year
				if (day > 28) {
					return false;
				}
			}
		} else if ((month == 4 || month == 6 || month == 9 || month == 11) && day > 30) {
			return false;
		}

		return true;
	}

	/**
	 * Create a regular expression replacing the given date-time format.
	 * The created regular expression does not allow digit number over.

	 * e.g., "dd/MM/yyyy hh:mm:ss a" -> "^(-?\d{1,2})/(-?\d{1,2})/(-?\d{1,4}) (-?\d{1,2}):(-?\d{1,2}):(-?\d{1,2}) (.+)$"
	 *
	 * @param format
	 *            The date-time format to be replaced.
	 * @param replaced
	 *            The list to keep replaced date-time patterns.
	 * @return The regular expression.
	 */
	private static String createRegexFromDateFormat(final String format, final List<String> replaced) {
		if (format == null) {
			return null;
		} else if (replaced != null) {
			replaced.clear();
		}

		// Create regular expression to match date-time patterns
		StringBuffer sb = new StringBuffer("'{1,2}");
		char[] patternChars = "GyMdkHmsSEDFwWahKzZYuX".toCharArray();
		for (char patternChar : patternChars) {
			sb.append('|');
			sb.append(patternChar);
			sb.append('+');
		}

		// Replace date-time pattern with regular expression in format
		Matcher matcher = Pattern.compile(sb.toString()).matcher('^' + Matcher.quoteReplacement(format) + '$');
		boolean quoted = false;
		StringBuffer replacement = new StringBuffer();
		sb = new StringBuffer();
		while (matcher.find()) {
			char patternChar = matcher.group().charAt(0);
			if (patternChar == '\'') {
				if (matcher.group().length() == 1) {
					// Replace ' with empty string
					matcher.appendReplacement(sb, "");
					quoted ^= true;
				} else if (matcher.group().length() == 2) {
					// Replace '' with '
					matcher.appendReplacement(sb, "'");
				}
				continue;
			}
			if (quoted) {
				continue;
			}

			replacement.setLength(0);
			replacement.append('(');
			switch (patternChar) {
			case 'y':	// Year
			case 'Y':	// Week year
				replacement.append("-?\\\\d{1,");
				if (matcher.group().length() <= 4) {
					// Replace y, yy, yyy, yyyy with \d{1,4}
					replacement.append(4);
				} else {
					// Replace yyyyy, yyyyyy, ... with \d{1,x}
					replacement.append(matcher.group().length());
				}
				replacement.append('}');
				break;
			case 'M':	// Month in year
				if (matcher.group().length() <= 2) {
					// Replace M or MM with \d{1,2}
					replacement.append("-?\\\\d{1,2}");
				} else {
					// Replace MMM, MMMM, ... with .+
					replacement.append(".+");
				}
				break;
			case 'D':	// Day in year
			case 'S':	// Millisecond
				replacement.append("-?\\\\d{1,");
				if (matcher.group().length() <= 3) {
					// Replace D or DD or DDD with \d{1,3}
					replacement.append(3);
				} else {
					// Replace DDDD, DDDDD, ... with \d{1,x}
					replacement.append(matcher.group().length());
				}
				replacement.append('}');
				break;
			case 'w':	// Week in year
			case 'd':	// Day in month
			case 'H':	// Hour in day (0-23)
			case 'k':	// Hour in day (1-24)
			case 'K':	// Hour in am/pm (0-11)
			case 'h':	// Hour in am/pm (1-12)
			case 'm':	// Minute in hour
			case 's':	// Second in minute
				replacement.append("-?\\\\d{1,");
				if (matcher.group().length() <= 2) {
					// Replace d or dd with \d{1,2}
					replacement.append(2);
				} else {
					// Replace ddd, dddd, ... with \d{1,x}
					replacement.append(matcher.group().length());
				}
				replacement.append('}');
				break;
			case 'W':	// Week in month
			case 'F':	// Day of week in month
			case 'u':	// Day number of week (1 = Monday, ..., 7 = Sunday)
				replacement.append("-?\\\\d");
				if (matcher.group().length() > 1) {
					replacement.append("{1," + matcher.group().length() + "}");
				}
				break;
			default:
				replacement.append(".+");
				break;
			}
			replacement.append(')');
			matcher.appendReplacement(sb, replacement.toString());

			if (replaced != null) {
				// Keep replaced date-time pattern
				replaced.add(matcher.group());
			}
		}
		return matcher.appendTail(sb).toString();
	}
}


text:
.class public Landroid/media/audiofx/PresetReverb$Settings;
.super Ljava/lang/Object;
.source "PresetReverb.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/media/audiofx/PresetReverb;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "Settings"
.end annotation

# instance fields
.field public preset:S

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 233
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 234
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 7
    .param p1, "settings"    # Ljava/lang/String;

    .prologue
    .line 241
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 242
    new-instance v2, Ljava/util/StringTokenizer;

    const-string v4, "=;"

    invoke-direct {v2, p1, v4}, Ljava/util/StringTokenizer;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 243
    .local v2, "st":Ljava/util/StringTokenizer;
    invoke-virtual {v2}, Ljava/util/StringTokenizer;->countTokens()I

    move-result v3

    .line 244
    .local v3, "tokens":I
    invoke-virtual {v2}, Ljava/util/StringTokenizer;->countTokens()I

    move-result v4

    const/4 v5, 0x3

    if-eq v4, v5, :cond_0

    .line 245
    new-instance v4, Ljava/lang/IllegalArgumentException;

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "settings: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 247
    :cond_0
    invoke-virtual {v2}, Ljava/util/StringTokenizer;->nextToken()Ljava/lang/String;

    move-result-object v0

    .line 248
    .local v0, "key":Ljava/lang/String;
    const-string v4, "PresetReverb"

    invoke-virtual {v0, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_1

    .line 249
    new-instance v4, Ljava/lang/IllegalArgumentException;

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "invalid settings for PresetReverb: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 253
    :cond_1
    :try_start_0
    invoke-virtual {v2}, Ljava/util/StringTokenizer;->nextToken()Ljava/lang/String;

    move-result-object v0

    .line 254
    const-string v4, "preset"

    invoke-virtual {v0, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_2

    .line 255
    new-instance v4, Ljava/lang/IllegalArgumentException;

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "invalid key name: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v4
    :try_end_0
    .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0

    .line 258
    :catch_0
    move-exception v1

    .line 259
    .local v1, "nfe":Ljava/lang/NumberFormatException;
    new-instance v4, Ljava/lang/IllegalArgumentException;

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "invalid value for key: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 257
    .end local v1    # "nfe":Ljava/lang/NumberFormatException;
    :cond_2
    :try_start_1
    invoke-virtual {v2}, Ljava/util/StringTokenizer;->nextToken()Ljava/lang/String;

    move-result-object v4

    invoke-static {v4}, Ljava/lang/Short;->parseShort(Ljava/lang/String;)S

    move-result v4

    iput-short v4, p0, Landroid/media/audiofx/PresetReverb$Settings;->preset:S
    :try_end_1
    .catch Ljava/lang/NumberFormatException; {:try_start_1 .. :try_end_1} :catch_0

    .line 261
    return-void
.end method

# virtual methods
.method public toString()Ljava/lang/String;
    .locals 3

    .prologue
    .line 265
    new-instance v0, Ljava/lang/String;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "PresetReverb;preset="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-short v2, p0, Landroid/media/audiofx/PresetReverb$Settings;->preset:S

    invoke-static {v2}, Ljava/lang/Short;->toString(S)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/String;-><init>(Ljava/lang/String;)V

    .line 269
    .local v0, "str":Ljava/lang/String;
    return-object v0
.end method


text:
package pl.touk.nussknacker.engine.spel

import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
import pl.touk.nussknacker.engine.api.typed.typing.Typed

import java.util
import scala.language.implicitConversions

class TypedClassDisplaySpec extends AnyFunSuite with Matchers {
  test("parsing array display") {
    Typed.typedClass(classOf[Array[String]]).display should equal("Array[String]")
  }

  test("parsing nested arrays display") {
    Typed.typedClass(classOf[Array[Array[String]]]).display should equal("Array[Array[String]]")
  }

  test("parsing nested class display") {
    Typed.genericTypeClass(classOf[util.AbstractMap.SimpleEntry[String, String]], List(Typed(classOf[String]), Typed(classOf[String]))).display should equal("SimpleEntry[String,String]")
  }

  test("parsing anonymous class display") {
    Typed.typedClass(new java.io.Serializable{}.getClass).display should equal("")
  }
}


text:
<!DOCTYPE html>

  <title>Welcome Page</title>
  <link href="demo.css" media="all" rel="stylesheet" type="text/css">

Welcome Page

Login succeeded. Now you can logout.


text: puts "Test Ruby file 1 in nested directory 1 in directory 2: #{Tescha.ready?}"


text:
#ifndef __ANDROID__

#include "loginStd.hpp"
#include <QtWebKit>
#include <QFile>
#include <QWebFrame>
#include <QDateTime>

LoginSystem::LoginSystem(QWidget *parent)
    :QWebView(parent)
    ,permissions(QStringList())
    ,accessToken(QString())
    ,expirationDate(QDateTime())
{
    connect(this, SIGNAL(urlChanged(QUrl)),
            this, SLOT(onUrlChanged(QUrl)));

}

void LoginSystem::show()
{
    //prepare permissions
    QString scope;
    for(int i = 0; i < permissions.length(); i++)
    {
        scope.append(permissions.at(i));
        if(i < permissions.length()-1)
        {
            scope.append(",");
        }
    }
    qDebug()<<"Permissions:"<<scope;

    //-------
    QWebView::show();
    QString url;
    url.push_back("https://m.facebook.com/dialog/oauth?client_id=");
    url.push_back(clientId);
    if(!scope.isEmpty())
    {
        url.push_back("&scope=");
        url.push_back(scope);
    }
    url.push_back("&redirect_uri=http://www.facebook.com/connect/login_success.html&response_type=token");
    qDebug()<<url;
    load(QUrl(url));
}

void LoginSystem::onUrlChanged(QUrl u)
{
    if(u.toString().contains("http://www.facebook.com/connect/login_success.html#access_token"))
    {
        hide();
        QString puffer = u.fragment().remove("access_token=");
        int expPos = puffer.indexOf("&expires_in=");
        int expLength = puffer.length() - expPos;

        //compute expiration Date
        QDateTime d = QDateTime::currentDateTime();
        expirationDate = d.addSecs(2 * 60 * 60);         // 2h
        qDebug()<<expirationDate.toString();

        accessToken = puffer.remove(expPos, expLength);
        emit accessTokenReceived();
    }
}

void LoginSystem::login(const QString &cid, const QString &ct,
                        const QStringList &rp, const QStringList &pp)
{
    //regular

    if(clientId.isEmpty())
    {
        qDebug()<<"Error: clientId is empty";
        qDebug()<<"Try to set the clientId with TizFacebook::setClientId()";
    }
    clientId = cid;
    permissions = rp + pp;
    show();

    //alternative for debuging
    /*
    accessToken = "<accessToken here>";
    emit accesTokenReceived(accessToken);
    */
}

#endif      //__ANDROID__


text:
<?php
return [
    'App\Application\Controllers\Website\Auth\ForgotPasswordController',
    'App\Application\Controllers\Website\Auth\LoginController',
    'App\Application\Controllers\Website\Auth\RegisterController',
    'App\Application\Controllers\Website\Auth\ResetPasswordController',
    'App\Application\Controllers\Website\ContactController',
    'App\Application\Controllers\Website\HomeController',
];


text:
package org.innovateuk.ifs.application.forms.sections.procurement.milestones.validator;

import org.innovateuk.ifs.application.forms.sections.procurement.milestones.form.ProcurementMilestonesForm;
import org.innovateuk.ifs.commons.error.Error;
import org.innovateuk.ifs.controller.ValidationHandler;
import org.innovateuk.ifs.finance.resource.BaseFinanceResource;
import org.springframework.stereotype.Component;

import java.math.BigInteger;
import java.math.RoundingMode;

@Component
public class ProcurementMilestoneFormValidator {

    public void validate(ProcurementMilestonesForm form, BaseFinanceResource finance, ValidationHandler validationHandler) {
        form.getMilestones().forEach((id, milestone) -> {
            if (milestone.getPayment() == null || milestone.getPayment().compareTo(BigInteger.ZERO) < 0) {
                validationHandler.addError(Error.fieldError(String.format("milestones[%s].payment", id), milestone.getPayment(), "validation.procurement.milestones.payment"));
            }
        });
        if (!validationHandler.hasErrors()) {
            BigInteger funding = finance.getTotalFundingSought().setScale(0, RoundingMode.HALF_UP).toBigInteger();
            if (form.getTotalPayments().compareTo(funding) > 0) {
                validationHandler.addError(Error.fieldError("totalErrorHolder", form.getTotalPayments(), "validation.procurement.milestones.total.higher"));
            }
            if (form.getTotalPayments().compareTo(funding) < 0) {
                validationHandler.addError(Error.fieldError("totalErrorHolder", form.getTotalPayments(), "validation.procurement.milestones.total.lower"));
            }
        }
    }

}


text:
#ifndef _C4_STORAGE_CONTIGUOUS_HPP_
#define _C4_STORAGE_CONTIGUOUS_HPP_

#include "c4/config.hpp"
#include "c4/storage/raw.hpp"
#include "c4/szconv.hpp"
#include "c4/span.hpp"

C4_BEGIN_NAMESPACE(c4)

// forward declarations
template< class T, class I > class span;
template< class T, class I > class spanrs;
template< class T, class I > class etched_span;

template< class T, class I > using cspan = span< const T, I >;
template< class T, class I > using cspanrs = spanrs< const T, I >;
template< class T, class I > using cetched_span = etched_span< const T, I >;

template< class T > class Allocator;

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

C4_BEGIN_NAMESPACE(stg)

// forward declarations

template< class T, class I, class RawStorage >
class contiguous;

template< class T, size_t N, class I=C4_SIZE_TYPE, I Alignment=alignof(T) >
class fixed_size;

template< class T, size_t N, class I=C4_SIZE_TYPE, I Alignment=alignof(T) >
using fixed_capacity=contiguous< T, I, raw_fixed<T, N, I, Alignment> >;

template< class T, size_t N, class I=C4_SIZE_TYPE, I Alignment=alignof(T) >
using small_vector=contiguous< T, I, raw_small<T, I, N, Alignment> >;

template< class T, class I=C4_SIZE_TYPE, I Alignment=alignof(T) >
using vector=contiguous< T, I, raw< T, I, Alignment > >;

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

// utility defines, undefined below
/// @cond dev
#define _c4this  static_cast< Storage      * >(this)
#define _c4cthis static_cast< Storage const* >(this)
/// @endcond

/** CRTP base for non-resizeable contiguous storage */
template< class T, class I, class Storage >
struct _ctg_crtp
{

    _c4_DEFINE_ARRAY_TYPES(T, I);

    C4_ALWAYS_INLINE constexpr I type_size() const { return sizeof(T); }
    C4_ALWAYS_INLINE           I byte_size() const { return _c4this->size() * sizeof(T); }

public:

    // span interoperation

    using   span_type = span< T, I >;
    using  cspan_type = span< const T, I >;

    C4_ALWAYS_INLINE operator  span_type ()       { return  span_type( _c4this->data(),  _c4this->size()); }
    C4_ALWAYS_INLINE operator cspan_type () const { return cspan_type(_c4cthis->data(), _c4cthis->size()); }

     span_type get_span(I first = 0)       {  span_type s = *this; s = s.subspan(first); return s; }
    cspan_type get_span(I first = 0) const { cspan_type s = *this; s = s.subspan(first); return s; }

     span_type get_span(I first, I num)       {  span_type s = *this; s = s.subspan(first, num); return s; }
    cspan_type get_span(I first, I num) const { cspan_type s = *this; s = s.subspan(first, num); return s; }

    // spanrs interoperation

    using  spanrs_type = spanrs<       T, I >;
    using cspanrs_type = spanrs< const T, I >;

    C4_ALWAYS_INLINE operator  spanrs_type ()       { return  spanrs_type( _c4this->data(),  _c4this->size(),  _c4this->capacity()); }
    C4_ALWAYS_INLINE operator cspanrs_type () const { return cspanrs_type(_c4cthis->data(), _c4cthis->size(), _c4cthis->capacity()); }

     spanrs_type get_spanrs(I first = 0)       {  spanrs_type s = *this; s = s.subspan(first); return s; }
    cspanrs_type get_spanrs(I first = 0) const { cspanrs_type s = *this; s = s.subspan(first); return s; }

     spanrs_type get_spanrs(I first, I num)       {  spanrs_type s = *this; s = s.subspan(first, num); return s; }
    cspanrs_type get_spanrs(I first, I num) const { cspanrs_type s = *this; s = s.subspan(first, num); return s; }

    // etched_span interoperation

    using  etched_span_type = etched_span<       T, I >;
    using cetched_span_type = etched_span< const T, I >;

    C4_ALWAYS_INLINE operator  etched_span_type ()       { return  etched_span_type( _c4this->data(),  _c4this->size(),  _c4this->capacity(), 0); }
    C4_ALWAYS_INLINE operator cetched_span_type () const { return cetched_span_type(_c4cthis->data(), _c4cthis->size(), _c4cthis->capacity(), 0); }

     etched_span_type get_etched_span(I first = 0)       {  etched_span_type s = *this; s = s.subspan(first); return s; }
    cetched_span_type get_etched_span(I first = 0) const { cetched_span_type s = *this; s = s.subspan(first); return s; }

     etched_span_type get_etched_span(I first, I num)       {  etched_span_type s = *this; s = s.subspan(first, num); return s; }
    cetched_span_type get_etched_span(I first, I num) const { cetched_span_type s = *this; s = s.subspan(first, num); return s; }

public:

    C4_ALWAYS_INLINE bool is_valid_iterator(const_iterator it) const noexcept
    {
        return it >= _c4cthis->data() && it <= _c4cthis->data() + _c4cthis->size();
    }
    C4_ALWAYS_INLINE bool is_valid_index(I i) const noexcept
    {
        return i >= 0 && i < _c4cthis->size();
    }

};

#undef _c4this
#undef _c4cthis

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

// utility defines, undefined below
/// @cond dev
#define _c4this  static_cast< Storage      * >(this)
#define _c4cthis static_cast< Storage const* >(this)
/// @endcond

/** (WIP) CRTP base for resizeable contiguous storage */
template< class T, class I, class Storage >
struct _ctgrs_crtp : public _ctg_crtp< T, I, Storage >
{
    using _ctg_crtp< T, I, Storage >::is_valid_iterator;
    using _base_crtp = _ctg_crtp< T, I, Storage >;
    _c4_DEFINE_ARRAY_TYPES(T, I);

public:

    // emplace ----------------------------------

    template< class... Args >
    C4_ALWAYS_INLINE T& emplace(const_iterator pos, Args &&... args)
    {
        iterator wpos = _growat(pos);
        construct(wpos, std::forward< Args >(args)...);
        return *wpos;
    }
    template< class... Args >
    C4_ALWAYS_INLINE T& emplace_back(Args && ...args)
    {
        iterator wpos = _growat(_c4this->end());
        construct(wpos, std::forward< Args >(args)...);
        return *wpos;
    }
    template< class... Args >
    C4_ALWAYS_INLINE T& emplace_front(Args && ...args)
    {
        iterator wpos = _growat(_c4this->begin());
        construct(wpos, std::forward< Args >(args)...);
        return *wpos;
    }

    // push -------------------------------------

    C4_ALWAYS_INLINE void push_back(T const& val)
    {
        iterator wpos = _growat(_c4this->end());
        construct(wpos, val);
        return *wpos;
    }
    C4_ALWAYS_INLINE void push_back(T && val)
    {
        iterator wpos = _growat(_c4this->end());
        construct(wpos, std::move(val));
        return *wpos;
    }

    C4_ALWAYS_INLINE void push_front(T const& val)
    {
        iterator wpos = _growat(_c4this->begin());
        construct(wpos, val);
        return *wpos;
    }
    C4_ALWAYS_INLINE void push_front(T && val)
    {
        iterator wpos = _growat(_c4this->begin());
        construct(wpos, std::move(val));
        return *wpos;
    }

    // pop --------------------------------------

    C4_ALWAYS_INLINE void pop_back()
    {
        erase(_c4this->end());
    }
    C4_ALWAYS_INLINE void pop_front()
    {
        erase(_c4this->begin());
    }

    // insert -----------------------------------

    iterator insert(const_iterator pos, T const* first, T const* last)
    {
        C4_XASSERT(last > first);
        I count = szconv<I>(std::distance(first, last));
        iterator wpos = _growat(pos, count);
        copy_construct_n(wpos, first, count);
        return wpos;
    }
    template< class InputIt >
    iterator insert(const_iterator pos, InputIt first, InputIt last)
    {
        C4_ASSERT(last >= first);
        I count = szconv<I>(std::distance(first, last));
        iterator wpos = _growat(pos, count);
        for(I i = 0; first != last; ++first, ++i)
        {
            copy_construct(wpos + i, *first);
        }
        return wpos;
    }

    template< class ...Args >
    iterator insert(const_iterator pos, Args && ...args)
    {
        iterator wpos = _growat(pos);
        construct(wpos, std::forward< Args >(args)...);
        return wpos;
    }
    template< class ...Args >
    iterator insert_n(const_iterator pos, I count, Args && ...args)
    {
        iterator wpos = _growat(pos, count);
        construct_n(wpos, count, std::forward< Args >(args)...);
        return wpos;
    }

    iterator insert(const_iterator pos, aggregate_t, std::initializer_list<T> ilist)
    {
        return insert(pos, ilist.begin(), ilist.end());
    }

    // replace ----------------------------------

    /** unconditionally replace element at pos */
    void replace(iterator pos, T const& val)
    {
        C4_XASSERT(is_valid_iterator(pos));
        copy_assign(pos, val);
    }
    /** unconditionally replace n elements starting at pos */
    void replace_n(iterator pos, I n, T const& val)
    {
        C4_XASSERT(is_valid_iterator(pos));
        C4_XASSERT(is_valid_iterator(pos + n));
        copy_assign_n(pos, val, n);
    }

    /** unconditionally replace element at pos */
    void replace(iterator pos, T && val)
    {
        C4_XASSERT(is_valid_iterator(pos));
        move_assign(pos, val);
    }
    /** unconditionally replace n elements starting at pos */
    void replace_n(iterator pos, I n, T && val)
    {
        C4_XASSERT(is_valid_iterator(pos));
        C4_XASSERT(is_valid_iterator(pos + n));
        move_assign_n(pos, val, n);
    }

    /** unconditionally replace element at pos. Construct the new elements with the given args. */
    template< class ...Args >
    void replace(iterator pos, Args && ...args)
    {
        C4_XASSERT(is_valid_iterator(pos));
        destroy(pos);
        construct(pos, std::forward< Args >(args)...);
    }
    /** unconditionally replace n elements starting at pos. Construct the new elements with the given args. */
    template< class ...Args >
    void replace_n(iterator pos, I n, Args && ...args)
    {
        C4_XASSERT(is_valid_iterator(pos));
        C4_XASSERT(is_valid_iterator(pos + n));
        destroy_n(pos, n);
        construct_n(pos, n, std::forward< Args >(args)...);
    }

    // erase ------------------------------------

    /** removes the element at pos */
    iterator erase(const_iterator pos)
    {
        return _shrinkat(pos);
    }
    /** removes the elements in the range [first; last). */
    iterator erase(const_iterator first, const_iterator last)
    {
        C4_ASSERT(last >= first);
        I less = szconv<I>(std::distance(first, last));
        destroy_n(first, less);
        return _shrinkat(first, less);
    }

    // resize -----------------------------------

    template< class... CtorArgs >
    void resize(I sz, CtorArgs && ...args)
    {
        I csz = _c4this->size();
        if(sz > csz)
        {
            I more = sz - csz;
            auto wpos = _growat(_c4this->end(), more);
            construct_n(wpos, more, std::forward< CtorArgs >(args)...);
        }
        else if(sz < csz)
        {
            I less = csz - sz;
            destroy_n(_c4this->data() + sz, less);
            _shrinkat(_c4this->end(), less);
        }
    }

protected:

    C4_ALWAYS_INLINE iterator _growat(const_iterator pos)
    {
        C4_XASSERT(is_valid_iterator(pos));
        I ipos = szconv<I>(pos - _c4this->data());
        _c4this->_resizeto(_c4this->size() + 1, pos);
        return _c4this->data() + ipos;
    }
    C4_ALWAYS_INLINE iterator _growat(const_iterator pos, I count)
    {
        C4_XASSERT(is_valid_iterator(pos));
        I ipos = szconv<I>(pos - _c4this->data());
        _c4this->_resizeto(_c4this->size() + count, pos);
        return _c4this->data() + ipos;
    }

    C4_ALWAYS_INLINE iterator _shrinkat(const_iterator pos)
    {
        C4_XASSERT(is_valid_iterator(pos));
        I ipos = szconv<I>(pos - _c4this->data());
        _c4this->_resizeto(_c4this->size() - 1, pos);
        return _c4this->data() + ipos;
    }
    C4_ALWAYS_INLINE iterator _shrinkat(const_iterator pos, I count)
    {
        C4_XASSERT(is_valid_iterator(pos));
        C4_XASSERT(is_valid_iterator(pos + count));
        I ipos = szconv<I>(pos - _c4this->data());
        _c4this->_resizeto(_c4this->size() - count, pos);
        return _c4this->data() + ipos;
    }

};

#undef _c4this
#undef _c4cthis

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

/** contiguous storage, fixed size+capacity (cannot resize down). */
template< class T, size_t N_, class I, I Alignment >
class fixed_size : public _ctg_crtp< T, I, fixed_size< T, N_, I, Alignment > >
{
    C4_STATIC_ASSERT(N_ <= std::numeric_limits< I >::max());

public:

    alignas(Alignment) T m_arr[N_];

public:

    _c4_DEFINE_ARRAY_TYPES(T, I);

    enum : I { alignment = Alignment, arr_size = (I)N_ };

    static constexpr const I N = arr_size;

    using base_type = _ctg_crtp< T, I, fixed_size< T, N, I, Alignment > >;
    friend struct _ctg_crtp< T, I, fixed_size< T, N, I, Alignment > >;

public:

    fixed_size() {}

    fixed_size(fixed_size const& that) { c4::copy_assign_n(m_arr, that.m_arr, N); }
    fixed_size(fixed_size     && that) { c4::move_assign_n(m_arr, that.m_arr, N); }

    fixed_size& operator= (fixed_size const& that) { c4::copy_assign_n(m_arr, that.m_arr, N); return *this; }
    fixed_size& operator= (fixed_size     && that) { c4::move_assign_n(m_arr, that.m_arr, N); return *this; }

    fixed_size (cspan< T, I > const& v) { C4_ASSERT(v.size() == N); c4::copy_assign_n(m_arr, v.data(), v.size()); }
    void assign(cspan< T, I > const& v) { C4_ASSERT(v.size() == N); c4::copy_assign_n(m_arr, v.data(), v.size()); }

    fixed_size (aggregate_t, std::initializer_list< T > il) { C4_ASSERT(il.size() == N); c4::copy_assign_n(m_arr, il.begin(), il.size()); }
    void assign(aggregate_t, std::initializer_list< T > il) { C4_ASSERT(il.size() == N); c4::copy_assign_n(m_arr, il.begin(), il.size()); }

    fixed_size (T const (&v)[N]) { c4::copy_assign_n(m_arr, v, N); }
    void assign(T const (&v)[N]) { c4::copy_assign_n(m_arr, v, N); }

    fixed_size (T const* v, I sz) { C4_ASSERT(sz == N); c4::copy_assign_n(m_arr, v, sz); }
    void assign(T const* v, I sz) { C4_ASSERT(sz == N); c4::copy_assign_n(m_arr, v, sz); }

    /** @warning do NOT pass in std::move() arguments. */
    template< class... Args > fixed_size(varargs_t, Args&&... args)
    {
         c4::copy_assign_n(m_arr, std::forward< Args >(args)...);
    }
    /** @warning do NOT pass in std::move() arguments. */
    template< class... Args > void assign(varargs_t, Args&&... args)
    {
        c4::copy_assign_n(m_arr, std::forward< Args >(args)...);
    }

public:

    C4_ALWAYS_INLINE constexpr bool empty()    const noexcept { return false; }
    C4_ALWAYS_INLINE constexpr I    size()     const noexcept { return N; }
    C4_ALWAYS_INLINE constexpr I    max_size() const noexcept { return N; }
    C4_ALWAYS_INLINE constexpr I    capacity() const noexcept { return N; }

    C4_ALWAYS_INLINE                 iterator  begin()       noexcept { return m_arr; }
    C4_ALWAYS_INLINE constexpr const_iterator  begin() const noexcept { return m_arr; }
    C4_ALWAYS_INLINE constexpr const_iterator cbegin() const noexcept { return m_arr; }

    C4_ALWAYS_INLINE                 iterator  end()       noexcept { return m_arr + N; }
    C4_ALWAYS_INLINE constexpr const_iterator  end() const noexcept { return m_arr + N; }
    C4_ALWAYS_INLINE constexpr const_iterator cend() const noexcept { return m_arr + N; }

    C4_ALWAYS_INLINE                 reverse_iterator  rbegin()       noexcept { return reverse_iterator(m_arr + N); }
    C4_ALWAYS_INLINE constexpr const_reverse_iterator  rbegin() const noexcept { return reverse_iterator(m_arr + N); }
    C4_ALWAYS_INLINE constexpr const_reverse_iterator crbegin() const noexcept { return reverse_iterator(m_arr + N); }

    C4_ALWAYS_INLINE                 reverse_iterator  rend()       noexcept { return const_reverse_iterator(m_arr); }
    C4_ALWAYS_INLINE constexpr const_reverse_iterator  rend() const noexcept { return const_reverse_iterator(m_arr); }
    C4_ALWAYS_INLINE constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(m_arr); }

    C4_ALWAYS_INLINE           T      & front()       noexcept { return m_arr[0]; }
    C4_ALWAYS_INLINE constexpr T const& front() const noexcept { return m_arr[0]; }

    C4_ALWAYS_INLINE           T      & back()       noexcept { return m_arr[N - 1]; }
    C4_ALWAYS_INLINE constexpr T const& back() const noexcept { return m_arr[N - 1]; }

    C4_ALWAYS_INLINE           T      * data()       noexcept { return m_arr; }
    C4_ALWAYS_INLINE constexpr T const* data() const noexcept { return m_arr; }

    C4_ALWAYS_INLINE                T      & operator[] (I i)       C4_NOEXCEPT_X { C4_XASSERT(i >= 0 && i < N); return m_arr[i]; }
    C4_ALWAYS_INLINE C4_CONSTEXPR14 T const& operator[] (I i) const C4_NOEXCEPT_X { C4_XASSERT(i >= 0 && i < N); return m_arr[i]; }

    C4_ALWAYS_INLINE void fill(T const& v)
    {
        c4::copy_assign_n(m_arr, v, N);
    }

};

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

/**
 *
 * @todo maybe using multiple inheritance wouldn't be bad here: the layout is safe
 * in C++11, as it results in a standard class layout because only one of
 * the bases is non-empty: see http://stackoverflow.com/questions/11048045
 */
template< class T, class I, class RawStorage >
class contiguous : public _ctgrs_crtp< T, I, contiguous< T, I, RawStorage > >
{
public:

    RawStorage m_storage;
    I m_size;

public:

    using base_crtp = _ctgrs_crtp< T, I, contiguous< T, I, RawStorage > >;
    using raw_storage_type = RawStorage;

    _c4_DEFINE_ARRAY_TYPES(T, I);

public:

    contiguous() : m_storage(), m_size(0) {}
    ~contiguous()
    {
        C4_NOT_IMPLEMENTED();
    }

    contiguous(contiguous const& that)
    {
        C4_NOT_IMPLEMENTED();
        C4_UNUSED(that);
    }
    contiguous(contiguous && that)
    {
        C4_NOT_IMPLEMENTED();
        C4_UNUSED(that);
    }
    contiguous& operator=(contiguous const& that)
    {
        C4_NOT_IMPLEMENTED();
        C4_UNUSED(that);
    }
    contiguous& operator=(contiguous && that)
    {
        C4_NOT_IMPLEMENTED();
        C4_UNUSED(that);
    }

    contiguous (cspan< T, I > const& v) { C4_NOT_IMPLEMENTED(); C4_UNUSED(v); }
    void assign(cspan< T, I > const& v) { C4_NOT_IMPLEMENTED(); C4_UNUSED(v); }

    contiguous (aggregate_t, std::initializer_list< T > il) { C4_NOT_IMPLEMENTED(); C4_UNUSED(il); }
    void assign(aggregate_t, std::initializer_list< T > il) { C4_NOT_IMPLEMENTED(); C4_UNUSED(il); }

    template< I N > contiguous (T const (&v)[N]) { C4_NOT_IMPLEMENTED(); C4_UNUSED(v); }
    template< I N > void assign(T const (&v)[N]) { C4_NOT_IMPLEMENTED(); C4_UNUSED(v); }

    contiguous (T const* v, I sz) { C4_NOT_IMPLEMENTED(); C4_UNUSED(v); C4_UNUSED(sz); }
    void assign(T const* v, I sz) { C4_NOT_IMPLEMENTED(); C4_UNUSED(v); C4_UNUSED(sz); }

public:

    C4_ALWAYS_INLINE bool empty()    const noexcept { return m_size == 0; }
    C4_ALWAYS_INLINE I    size()     const noexcept { return m_size; }
    C4_ALWAYS_INLINE I    max_size() const noexcept { return m_size; }
    C4_ALWAYS_INLINE I    capacity() const noexcept { return m_size; }

    C4_ALWAYS_INLINE       iterator  begin()       noexcept { return m_storage.data(); }
    C4_ALWAYS_INLINE const_iterator  begin() const noexcept { return m_storage.data(); }
    C4_ALWAYS_INLINE const_iterator cbegin() const noexcept { return m_storage.data(); }

    C4_ALWAYS_INLINE       iterator  end()       noexcept { return m_storage.data() + m_size; }
    C4_ALWAYS_INLINE const_iterator  end() const noexcept { return m_storage.data() + m_size; }
    C4_ALWAYS_INLINE const_iterator cend() const noexcept { return m_storage.data() + m_size; }

    C4_ALWAYS_INLINE       reverse_iterator  rbegin()       noexcept { return reverse_iterator(m_storage.data() + m_size); }
    C4_ALWAYS_INLINE const_reverse_iterator  rbegin() const noexcept { return reverse_iterator(m_storage.data() + m_size); }
    C4_ALWAYS_INLINE const_reverse_iterator crbegin() const noexcept { return reverse_iterator(m_storage.data() + m_size); }

    C4_ALWAYS_INLINE       reverse_iterator  rend()       noexcept { return const_reverse_iterator(m_storage.data()); }
    C4_ALWAYS_INLINE const_reverse_iterator  rend() const noexcept { return const_reverse_iterator(m_storage.data()); }
    C4_ALWAYS_INLINE const_reverse_iterator crend() const noexcept { return const_reverse_iterator(m_storage.data()); }

    C4_ALWAYS_INLINE T      & front()       C4_NOEXCEPT_X { C4_XASSERT(!empty()); return m_storage.data()[0]; }
    C4_ALWAYS_INLINE T const& front() const C4_NOEXCEPT_X { C4_XASSERT(!empty()); return m_storage.data()[0]; }

    C4_ALWAYS_INLINE T      & back()       C4_NOEXCEPT_X { C4_XASSERT(!empty()); return m_storage.data()[m_size - 1]; }
    C4_ALWAYS_INLINE T const& back() const C4_NOEXCEPT_X { C4_XASSERT(!empty()); return m_storage.data()[m_size - 1]; }

    C4_ALWAYS_INLINE T      * data()       noexcept { return m_storage.data(); }
    C4_ALWAYS_INLINE T const* data() const noexcept { return m_storage.data(); }

    C4_ALWAYS_INLINE T      & operator[] (I i)       C4_NOEXCEPT_X { C4_XASSERT(i >= 0 && i < m_size); return m_storage.data()[i]; }
    C4_ALWAYS_INLINE T const& operator[] (I i) const C4_NOEXCEPT_X { C4_XASSERT(i >= 0 && i < m_size); return m_storage.data()[i]; }

public:

    void reserve(I cap)
    {
        if(cap <= m_storage.capacity()) return;
        m_storage._raw_grow(m_size, cap);
    }

    C4_ALWAYS_INLINE void _resizeto(I sz)
    {
        _growto(sz);
        m_size = sz;
    }

    C4_ALWAYS_INLINE void _growto(I sz)
    {
        C4_NOT_IMPLEMENTED();
        C4_UNUSED(sz);
    }
};

C4_END_NAMESPACE(stg)
C4_END_NAMESPACE(c4)

#endif // _C4_STORAGE_CONTIGUOUS_HPP_


text:
package com.elnware.spotifystreamer.fragment;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.elnware.spotifystreamer.R;
import com.elnware.spotifystreamer.model.ParcelableImage;
import com.elnware.spotifystreamer.model.ParcelableTrack;
import com.elnware.spotifystreamer.service.MediaPlayerService;
import com.elnware.spotifystreamer.model.PlaylistItem;
import com.elnware.spotifystreamer.util.ImageUtils;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by elnoxvie on 8/1/15.
 */
public class NowPlayingInfoFragment extends Fragment implements SharedPreferences.OnSharedPreferenceChangeListener{

   @Bind(R.id.img_track_thumbnail)
   ImageView mAlbumView;

   @Bind(R.id.tv_track_name)
   TextView  mTrackNameView;

   @Bind(R.id.tv_album_name)
   TextView  mAlbumNameView;

   @Bind(R.id.play_or_pause)
   ImageView mPlayOrPauseView;

   private boolean             mServiceConnected;
   private MediaPlayerService  mService;
   private View                mView;
   private NowPlayingCallbacks mCallback;
   private boolean             mEnableNowPlaying;

   public interface NowPlayingCallbacks {
      void showNowPlaying(boolean isVisible);

      void onNowPlayingContainerSelected(PlaylistItem item);
   }

   @Nullable
   @Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      mView = inflater.inflate(R.layout.fragment_now_playing, container, false);
      ButterKnife.bind(this, mView);
      return mView;
   }

   @Override
   public void onAttach(Activity activity) {
      super.onAttach(activity);

      SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
      mEnableNowPlaying = sharedPreferences.getBoolean(getString(R.string.pref_key_enable_now_playing), true);
      sharedPreferences.registerOnSharedPreferenceChangeListener(this);

      if (activity instanceof NowPlayingCallbacks) {
         mCallback = (NowPlayingCallbacks) activity;
      } else {
         throw new ClassCastException("Activity must implement NowPlayingCallbacks");
      }
   }

   @Override
   public void onDetach() {
      SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
      sharedPreferences.unregisterOnSharedPreferenceChangeListener(this);
      super.onDetach();
   }

   @OnClick(R.id.play_or_pause)
   public void onPlayOrPauseButtonClick() {
      if (mService.getState() == MediaPlayerService.State.PLAYING) {
         mService.pause();
      } else {
         mService.play();
      }
   }

   @OnClick(R.id.now_playing_container)
   public void onControlContainerClicked() {
      if (mServiceConnected) {
         mCallback.onNowPlayingContainerSelected(mService.getCurrentPlayList());
      }
   }

   @Override
   public void onStart() {
      super.onStart();
      Intent intent = new Intent(getActivity(), MediaPlayerService.class);
      getActivity().bindService(intent, mMediaConnection, Context.BIND_AUTO_CREATE);
      getActivity().startService(intent);
   }

   @Override
   public void onStop() {
      mService.removeCallback(mMediaPlayerCallbacks);
      getActivity().unbindService(mMediaConnection);
      super.onStop();
   }

   @Override
   public void onResume() {
      super.onResume();
      if (mServiceConnected && mService.getState() != MediaPlayerService.State.IDLE){
         if (mEnableNowPlaying){
            mCallback.showNowPlaying(true);
         }
      }else{
         mCallback.showNowPlaying(false);
      }
   }

   //Connect to the service
   private ServiceConnection mMediaConnection = new ServiceConnection() {

      @Override
      public void onServiceConnected(ComponentName name, IBinder service) {
         MediaPlayerService.MediaPlayerBinder binder = (MediaPlayerService.MediaPlayerBinder) service;

         mServiceConnected = true;

         //get service
         mService = binder.getService();
         mService.addCallback(mMediaPlayerCallbacks);

         if (mService.getState() == MediaPlayerService.State.IDLE) {
            mCallback.showNowPlaying(false);
         } else {
            if (mEnableNowPlaying) {
               mCallback.showNowPlaying(true);
            }
         }

         updateCurrentTrackView();
         updateCurrentPlayerState(mService.getState());
      }

      @Override
      public void onServiceDisconnected(ComponentName componentName) {
         mServiceConnected = true;
      }
   };

   private MediaPlayerService.MediaPlayerCallbacks mMediaPlayerCallbacks = new MediaPlayerService.MediaPlayerCallbacks() {
      @Override
      public void onError(Throwable throwable) {

      }

      @Override
      public void onStateChanged(MediaPlayerService.State state) {
         updateCurrentPlayerState(state);
      }

      @Override
      public void onMetaDataChanged() {
         updateCurrentTrackView();
      }

      @Override
      public void onBufferingUpdate(int percentage) {

      }
   };

   /**
    * Update Current track view
    */
   private void updateCurrentTrackView() {
      if (mServiceConnected && mService.getCurrentPlayList() != null) {
         PlaylistItem playlistItem = mService.getCurrentPlayList();
         ParcelableTrack track = playlistItem.getCurrentTrack();
         updateUIWithTrackInfo(track);
      }
   }

   /**
    * Update Current track UI View
    * with the track info
    */
   private void updateUIWithTrackInfo(ParcelableTrack track) {
      if (track != null) {
         mTrackNameView.setText(track.name);
         mAlbumNameView.setText(track.album.name);

         ParcelableImage image = ImageUtils.getOptimumParcelableImage(track.album.images, getResources().getInteger(R.integer.default_cover_image_width));
         Glide.with(this).load(image.url).crossFade().into(mAlbumView);
      }
   }

   /**
    * Update current player state
    *
    * @param state Media Player State
    */
   private void updateCurrentPlayerState(MediaPlayerService.State state) {
      switch (state) {
         case IDLE:
            mPlayOrPauseView.setImageResource(R.drawable.ic_play_arrow_48dp);
            break;
         case PAUSE:
            mPlayOrPauseView.setImageResource(R.drawable.ic_play_arrow_48dp);
            break;
         case STOP:
            break;
         case COMPLETED:
            break;
         case PREPARING:
            mPlayOrPauseView.setImageResource(R.drawable.ic_pause_48dp);
            break;
         case PLAYING:
            mPlayOrPauseView.setImageResource(R.drawable.ic_pause_48dp);
            break;
      }
   }

   @Override
   public void onDestroyView() {
      super.onDestroyView();
      ButterKnife.unbind(this);
   }

   @Override
   public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

      if (key.equals(getString(R.string.pref_key_enable_now_playing))) {
         mEnableNowPlaying = sharedPreferences.getBoolean(getString(R.string.pref_key_enable_now_playing), true);
         if (mEnableNowPlaying) {
            if (mServiceConnected && mService.getState() != MediaPlayerService.State.IDLE) {
               mCallback.showNowPlaying(true);
            }
         } else {
            mCallback.showNowPlaying(false);
         }
      }
   }
}


text:
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"net"
	"time"

	"github.com/spf13/cobra"

	"github.com/scionproto/scion/go/lib/addr"
	"github.com/scionproto/scion/go/lib/daemon"
	"github.com/scionproto/scion/go/lib/serrors"
	"github.com/scionproto/scion/go/lib/snet/addrutil"
	"github.com/scionproto/scion/go/pkg/app"
	"github.com/scionproto/scion/go/pkg/app/flag"
)

type addrInfo struct {
	IA      addr.IA `json:"isd_as"`
	IP      net.IP  `json:"ip"`
	Address string  `json:"address"`
}

func newAddress(pather CommandPather) *cobra.Command {
	var envFlags flag.SCIONEnvironment
	var flags struct {
		json bool
	}

	var cmd = &cobra.Command{
		Use:     "address [flags]",
		Short:   "Show (one of) this host's SCION address(es)",
		Example: fmt.Sprintf(`  %[1]s address`, pather.CommandPath()),
		Long: `'address' show address information about this SCION host.

This command returns the relevant SCION address information for this host.

Currently, this returns a sensible but arbitrary local address. In the general
case, the host could have multiple SCION addresses.
`,
		RunE: func(cmd *cobra.Command, args []string) error {
			if err := envFlags.LoadExternalVars(); err != nil {
				return err
			}
			daemonAddr := envFlags.Daemon()

			cmd.SilenceUsage = true
			ctx, cancelF := context.WithTimeout(cmd.Context(), time.Second)
			defer cancelF()
			sd, err := daemon.NewService(daemonAddr).Connect(ctx)
			if err != nil {
				return serrors.WrapStr("connecting to SCION Daemon", err)
			}

			info, err := app.QueryASInfo(ctx, sd)
			if err != nil {
				return err
			}

			localIP, err := addrutil.DefaultLocalIP(ctx, sd)
			if err != nil {
				return err
			}
			address := fmt.Sprintf("%s,%s", info.IA, localIP)
			if !flags.json {
				_, err := fmt.Fprintln(cmd.OutOrStdout(), address)
				return err
			}

			enc := json.NewEncoder(cmd.OutOrStdout())
			enc.SetIndent("", "  ")
			return enc.Encode(map[string][]addrInfo{
				"addresses": {{
					IA:      info.IA,
					IP:      localIP,
					Address: address,
				}},
			})
		},
	}
	envFlags.Register(cmd.Flags())
	cmd.Flags().BoolVar(&flags.json, "json", false, "Write the output as machine readable json")

	return cmd
}


text:
'use strict'

const helpers = require('./helpers')

module.exports = {
  prepend: '\nBuilds .tag files to .js\n\nOptions:',
  append: `
Build a single .tag file:

  riot foo.tag           To a same named file (foo.js)
  riot foo.tag bar.js    To a different named file (bar.js)
  riot foo.tag bar       To a different dir (bar/foo.js)

Build all .tag files in a directory:

  riot foo/bar           To a same directory (foo/**/*.js)
  riot foo/bar baz       To a different directory (baz/**/*.js)
  riot foo/bar baz.js    To a single concatenated file (baz.js)

Create an empty tag template

  riot --new foo
  riot --new foo/bar
  riot --new foo/bar --ext html

Examples for options:

  riot foo bar
  riot --config riot.config
  riot --w foo bar
  riot --watch foo bar
  riot --compact foo bar
  riot foo bar --compact
  riot foo.tag --type coffeescript --expr
  riot foo.tag --style sass --export css foo.css
  riot foo.tag --exclude css foo.js
  cat foo.tag | riot --stdin --stdout > foo.js

Version ${ helpers.getVersion() }
`,
  options: [
    {
      option: 'help',
      alias: 'h',
      type: 'Boolean',
      description: 'You\'re reading it'
    },
    {
      option: 'version',
      alias: 'v',
      type: 'Boolean',
      description: 'Print Riot\'s version'
    },
    {
      option: 'watch',
      alias: 'w',
      type: 'Boolean',
      description: 'Watch for changes'
    },
    {
      option: 'compact',
      alias: 'c',
      type: 'Boolean',
      description: 'Minify </p> <p> to </p><p>'
    },
    {
      option: 'modular',
      alias: 'm',
      type: 'Boolean',
      description: 'AMD and CommonJS'
    },
    {
      option: 'silent',
      alias: 's',
      type: 'Boolean',
      description: 'Silence build output'
    },
    {
      option: 'whitespace',
      type: 'Boolean',
      description: 'Preserve newlines and whitepace'
    },
    {
      option: 'check',
      type: 'Boolean',
      description: 'Check the syntax errors on a single tag'
    },
    {
      option: 'colors',
      type: 'Boolean',
      description: 'Turn on colorized output'
    },
    {
      option: 'expr',
      type: 'Boolean',
      description: 'Run expressions through parser defined with --type'
    },
    {
      option: 'config',
      type: 'String',
      description: 'Specify the path to a configuration file to compile your tags'
    },
    {
      option: 'export',
      type: 'String',
      alias: 'e',
      description: 'Compile and export only the css or html or js from your tags',
      example: 'riot foo.tag --export css foo.css',
      enum: ['css', 'js', 'html']
    },
    {
      option: 'new',
      type: 'String',
      alias: 'n',
      description: 'Create an empty tag template',
      example: 'riot --new foo'
    },
    {
      option: 'type',
      alias: 't',
      type: 'String',
      description: 'JavaScript pre-processor. Built-in support for: es6, coffeescript, typescript, livescript, none'
    },
    {
      option: 'exclude',
      type: 'String',
      description: 'Compile and excluding entities (css, html or js) from the output',
      enum: ['css', 'js', 'html'],
      example: 'riot foo.tag --exclude css --exclude html foo.js',
      concatRepeatedArrays: true
    },
    {
      option: 'template',
      type: 'String',
      description: 'HTML pre-processor. Built-in support for: pug'
    },
    {
      option: 'style',
      type: 'String',
      description: 'Css pre-processor. Built-in support for: sass, scss, less, stylus',
      example: 'riot foo.tag --style scss'
    },
    {
      option: 'brackets',
      type: 'String',
      description: 'Change brackets used for expressions. Defaults to { }'
    },
    {
      option: 'ext',
      type: 'String',
      default: 'tag',
      description: 'Change tag file extension. Defaults to .tag'
    },
    {
      option: 'stdin',
      alias: 'i',
      type: 'Boolean',
      description: 'Read stdin as tag file'
    },
    {
      option: 'stdout',
      alias: 'o',
      type: 'Boolean',
      description: 'Print output into stdout'
    }
  ]
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.7.1"
         version="2.0"
         xmlns="http://pear.php.net/dtd/package-2.0"
         xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">

    <name>FirePHPCore</name>
    <channel>pear.firephp.org</channel>
    <summary>Log variables from PHP to the browser (Firebug Console)</summary>
    <description>Handles all communication between the PHP code on the server and the client. Also implements all core FirePHP features.</description>

    <lead>
        <name>Christoph Dorn</name>
        <user>cadorn</user>
        <email>christoph@christophdorn.com</email>
        <active>yes</active>
    </lead>

    <date>%%DATE%%</date>
    <version>
        <release>%%VERSION%%</release>
        <api>0.3</api>
    </version>

    <stability>
        <release>%%STABILITY%%</release>
        <api>stable</api>
    </stability>

    <license>MIT</license>

    <notes>No Notes</notes>

    <contents>
        <dir name="/" baseinstalldir="FirePHPCore">

            <file name="fb.php" role="php"/>
            <file name="fb.php4" role="php"/>

            <file name="FirePHP.class.php" role="php"/>
            <file name="FirePHP.class.php4" role="php"/>

        </dir>
    </contents>

    <dependencies>
        <required>
            <php>
                <min>4.0</min>
            </php>
            <pearinstaller>
                <min>1.4.5</min>
            </pearinstaller>
        </required>
    </dependencies>

    <phprelease />

</package>


text:
package cloudca

import (
	"fmt"
	"testing"

	"github.com/cloud-ca/go-cloudca/mocks"
	"github.com/cloud-ca/go-cloudca/mocks/services_mocks"
	"github.com/golang/mock/gomock"
	"github.com/stretchr/testify/assert"
)

const ACL_RULE_TEMPLATE = `{
	"id": "%s",
	"networkAclId": "6145ea41-010c-41f2-a065-2a3a4e98d09d",
	"ruleNumber": "1",
	"cidr": "0.0.0.0/24",
	"action": "Allow",
	"protocol": "TCP",
	"startPort": "80",
	"endPort": "80",
	"trafficType": "Ingress",
	"state": "Active"
}`

func setupMockForNetworkAclRule(t *testing.T) *services_mocks.MockEntityService {
	ctrl := gomock.NewController(t)
	defer ctrl.Finish()

	return services_mocks.NewMockEntityService(ctrl)
}

func createNetworkAclRuleWithId(id string) *NetworkAclRule {
	return &NetworkAclRule{
		Id:           id,
		NetworkAclId: "6145ea41-010c-41f2-a065-2a3a4e98d09d",
		RuleNumber:   "1",
		Cidr:         "0.0.0.0/24",
		Action:       "Allow",
		Protocol:     "TCP",
		StartPort:    "80",
		EndPort:      "80",
		TrafficType:  "Ingress",
		State:        "Active",
	}
}

func buildTestNetworkAclRuleJsonResponse(networkAclRule *NetworkAclRule) []byte {
	return []byte(`{"id":"` + networkAclRule.Id + `",` +
		` "networkAclId":"` + networkAclRule.NetworkAclId + `",` +
		` "ruleNumber":"` + networkAclRule.RuleNumber + `",` +
		` "cidr":"` + networkAclRule.Cidr + `",` +
		` "action":"` + networkAclRule.Action + `",` +
		` "protocol":"` + networkAclRule.Protocol + `",` +
		` "startPort":"` + networkAclRule.StartPort + `",` +
		` "endPort":"` + networkAclRule.EndPort + `",` +
		` "trafficType":"` + networkAclRule.TrafficType + `",` +
		` "state":"` + networkAclRule.State +
		`"}`)
}

func buildListTestNetworkAclRulesJsonResponse(acls []NetworkAclRule) []byte {
	resp := `[`
	for i, t := range acls {
		resp += string(buildTestNetworkAclRuleJsonResponse(&t))
		if i != len(acls)-1 {
			resp += `,`
		}
	}
	resp += `]`
	return []byte(resp)
}

func TestGetNetworkAclRuleByIdReturnAclRule_ifSuccess(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	expectedId := "rule_0"
	expectedNetworkAclRule := *createNetworkAclRuleWithId(expectedId)

	response := fmt.Sprintf(ACL_RULE_TEMPLATE, expectedId)
	mockEntityService.EXPECT().Get(expectedId, gomock.Any()).Return([]byte(response), nil)

	// when
	networkAclRule, _ := networkAclRuleService.Get(expectedId)

	// then
	assert.Equal(t, expectedNetworkAclRule, *networkAclRule)
}

func TestGetNetworkAclRuleByIdReturnError_ifError(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	expectedId := "rule_0"
	mockError := mocks.MockError{Message: "get error"}
	mockEntityService.EXPECT().Get(expectedId, gomock.Any()).Return(nil, mockError)

	// when
	networkAclRule, err := networkAclRuleService.Get(expectedId)

	// then
	assert.Nil(t, networkAclRule)
	assert.Equal(t, mockError, err)
}

func TestListNetworkAclRuleReturnAclsIfSuccess(t *testing.T) {
	//given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	expectedId1 := "rule_1"
	expectedNetworkAclRule1 := *createNetworkAclRuleWithId(expectedId1)
	expectedId2 := "rule_2"
	expectedNetworkAclRule2 := *createNetworkAclRuleWithId(expectedId2)

	expectedAcls := []NetworkAclRule{expectedNetworkAclRule1, expectedNetworkAclRule2}

	mockEntityService.EXPECT().List(gomock.Any()).Return(buildListTestNetworkAclRulesJsonResponse(expectedAcls), nil)

	//when
	acls, _ := networkAclRuleService.List()

	//then
	if assert.NotNil(t, acls) {
		assert.Equal(t, expectedAcls, acls)
	}
}

func TestListNetworkAclRuleReturnNilWithErrorIfError(t *testing.T) {
	//given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	mockError := mocks.MockError{Message: "some_list_error"}
	mockEntityService.EXPECT().List(gomock.Any()).Return(nil, mockError)

	//when
	acls, err := networkAclRuleService.List()

	//then
	assert.Nil(t, acls)
	assert.Equal(t, mockError, err)

}

func TestListNetworkAclRuleByAclIdReturnAcls_ifSuccess(t *testing.T) {
	//given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	expectedId1 := "rule_1"
	expectedNetworkAclRule1 := *createNetworkAclRuleWithId(expectedId1)
	expectedAcls := []NetworkAclRule{expectedNetworkAclRule1}

	mockEntityService.EXPECT().List(gomock.Any()).Return(buildListTestNetworkAclRulesJsonResponse(expectedAcls), nil)

	//when
	acls, _ := networkAclRuleService.ListByNetworkAclId("acl1")

	//then
	if assert.NotNil(t, acls) {
		assert.Equal(t, expectedAcls, acls)
	}
}

func TestListNetworkAclRuleByAclIdReturnNilWithError_ifError(t *testing.T) {
	//given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	mockError := mocks.MockError{Message: "some_list_error"}
	mockEntityService.EXPECT().List(gomock.Any()).Return(nil, mockError)

	//when
	acls, err := networkAclRuleService.ListByNetworkAclId("acl1")

	//then
	assert.Nil(t, acls)
	assert.Equal(t, mockError, err)

}

func TestListNetworkAclRulesWithOptions(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	id1, id2 := "1234", "4321"
	rule1, rule2 := fmt.Sprintf(ACL_RULE_TEMPLATE, id1), fmt.Sprintf(ACL_RULE_TEMPLATE, id2)
	response := fmt.Sprintf("[ %s, %s ]", rule1, rule2)
	mockEntityService.EXPECT().List(gomock.Any()).Return([]byte(response), nil)

	// when
	rules, _ := networkAclRuleService.ListWithOptions(map[string]string{})

	// then
	assert.Equal(t, id1, rules[0].Id)
	assert.Equal(t, id2, rules[1].Id)
}

func TestCreateNetworkAclRuleReturnsError_ifErrorWhileCreating(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	mockError := mocks.MockError{Message: "creation error"}
	mockEntityService.EXPECT().Create(gomock.Any(), gomock.Any()).Return(nil, mockError)

	// when
	rule, err := networkAclRuleService.Create(NetworkAclRule{})

	// then
	assert.Nil(t, rule)
	assert.Equal(t, mockError, err)
}

func TestCreateNetworkAclRuleReturnsSuccess_ifNoErrorsOccur(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	expectedId := "adsf"
	response := fmt.Sprintf(ACL_RULE_TEMPLATE, expectedId)
	expectedNetworkAclRule := *createNetworkAclRuleWithId(expectedId)

	mockEntityService.EXPECT().Create(gomock.Any(), gomock.Any()).Return([]byte(response), nil)

	// when
	rule, _ := networkAclRuleService.Create(expectedNetworkAclRule)

	// then
	assert.Equal(t, expectedNetworkAclRule, *rule)
}

func TestUpdateNetworkAclRuleReturnsError_ifErrorWhileCreating(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	mockError := mocks.MockError{Message: "update error"}
	mockEntityService.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, mockError)

	// when
	rule, err := networkAclRuleService.Update("1234", NetworkAclRule{})

	// then
	assert.Nil(t, rule)
	assert.Equal(t, mockError, err)
}

func TestUpdateNetworkAclRuleReturnsSuccess_ifNoErrorsOccur(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	expectedId := "adsf"
	response := fmt.Sprintf(ACL_RULE_TEMPLATE, expectedId)
	expectedNetworkAclRule := *createNetworkAclRuleWithId(expectedId)

	mockEntityService.EXPECT().Update(gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte(response), nil)

	// when
	rule, _ := networkAclRuleService.Update(expectedId, expectedNetworkAclRule)

	// then
	assert.Equal(t, expectedNetworkAclRule, *rule)
}

func TestDeleteNetworkAclRuleReturnsError_ifErrorWhileDeleting(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	mockError := mocks.MockError{Message: "deletion error"}
	mockEntityService.EXPECT().Delete(gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte{}, mockError)

	// when
	success, err := networkAclRuleService.Delete("123")

	// then
	assert.False(t, success)
	assert.Equal(t, mockError, err)
}

func TestDeleteNetworkAclRuleReturnsSuccess_ifNoErrorsOccur(t *testing.T) {
	// given
	mockEntityService := setupMockForNetworkAclRule(t)
	networkAclRuleService := NetworkAclRuleApi{
		entityService: mockEntityService,
	}

	expectedId := "id0"
	mockEntityService.EXPECT().Delete(expectedId, gomock.Any(), gomock.Any()).Return([]byte{}, nil)

	// when
	success, _ := networkAclRuleService.Delete(expectedId)

	// then
	assert.True(t, success)
}


text:
#ifndef UTILS_INTERRUPT_INTERRUPT_H
#define UTILS_INTERRUPT_INTERRUPT_H

#include "../chip.h"

/**
 * \weakgroup interrupt_group
 *
 * @{
 */

/**
 * \name Interrupt Service Routine definition
 *
 * @{
 */

/**
 * \brief Define service routine
 *
 * \note For NVIC devices the interrupt service routines are predefined to
 *       add to vector table in binary generation, so there is no service
 *       register at run time. The routine collections are in exceptions.h.
 *
 * Usage:
 * \code
 * ISR(foo_irq_handler)
 * {
 *      // Function definition
 *      ...
 * }
 * \endcode
 *
 * \param func Name for the function.
 */
#  define ISR(func)    \
	void func (void)

/**
 * \brief Initialize interrupt vectors
 *
 * For NVIC the interrupt vectors are put in vector table. So nothing
 * to do to initialize them, except defined the vector function with
 * right name.
 *
 * This must be called prior to \ref irq_register_handler.
 */
#  define irq_initialize_vectors()                     \
	do {                                           \
	} while(0)

/**
 * \brief Register handler for interrupt
 *
 * For NVIC the interrupt vectors are put in vector table. So nothing
 * to do to register them, except defined the vector function with
 * right name.
 *
 * Usage:
 * \code
 * irq_initialize_vectors();
 * irq_register_handler(foo_irq_handler);
 * \endcode
 *
 * \note The function \a func must be defined with the \ref ISR macro.
 * \note The functions prototypes can be found in the device exception header
 *       files (exceptions.h).
 */
#  define irq_register_handler(...)                    \
	do {                                           \
	} while(0)

//@}

#  define cpu_irq_enable()                             \
	do {                                           \
		g_interrupt_enabled = 1;            \
		__DMB();                               \
		__enable_irq();                        \
	} while (0)
#  define cpu_irq_disable()                            \
	do {                                           \
		__disable_irq();                       \
		__DMB();                               \
		g_interrupt_enabled = 0;           \
	} while (0)

typedef uint32_t irqflags_t;
extern int g_interrupt_enabled;

static inline irqflags_t cpu_irq_save(void)
{
	irqflags_t flags = g_interrupt_enabled;
	cpu_irq_disable();
	return flags;
}

static inline int cpu_irq_is_enabled_flags(irqflags_t flags)
{
	return (flags);
}

static inline void cpu_irq_restore(irqflags_t flags)
{
	if (cpu_irq_is_enabled_flags(flags))
		cpu_irq_enable();
}

#define cpu_irq_is_enabled()    g_interrupt_enabled

/**
 * \weakgroup interrupt_deprecated_group
 * @{
 */

#define Enable_global_interrupt()            cpu_irq_enable()
#define Disable_global_interrupt()           cpu_irq_disable()
#define Is_global_interrupt_enabled()        cpu_irq_is_enabled()

//@}

//@}

#endif /* UTILS_INTERRUPT_INTERRUPT_H */


text:
{% extends 'wexplorer/layout.html' %}
{% import 'macros/render_pagination.html' as macros %}
{% block content %}

{{ super() }}

    {% if results %}

        {{ pagination.total_count }} results found {% if request.args.get('q') %} for "{{ request.args.get('q') }}" {% endif %}
        {% if pagination.pages > 1 %}({{ (results | length) }} shown) {% endif %}

      <form class="form-inline" method="POST" action="{{ url_for('wexplorer.search') }}">

            {{ search_form.company_name }} Company Name

            {{ search_form.contract_description }} Contract Description

            {{ search_form.contract_detail }} Contract Detail

            {{ search_form.line_item }} Line Item

            {{ search_form.financial_id }} Controller Number

            {{ search_form.archived }} Include Inactive

          {{ search_form.contract_type(class_="form-control input-sm") }}

        {{ search_form.q(placeholder="I'm looking for...", class_="hidden", value=search_for) }}

          <button type="submit" class="btn btn-success">Filter results</button>

      </form>

            Status
            Contract Description
            Company
            Expiration Date
            Controller Number
            Subscribe to updates

          {% for result in results %}
          {% set inactive = result.expiration_date and result.expiration_date <= today or result.is_archived %}

                {% if result.expiration_date and result.expiration_date <= today %}

                {% elif days_from_today(result.expiration_date) <= 120 %}

                {% elif result.is_archived %}

                {% else %}

                {% endif %}

              {% if result.contract_id %}

                {{ result.contract_description|title }}

              {% endif %}
              {% if result.found_in %}

              Matched: {{ result.found_in }}
              {% endif %}

              {% if result.company_id %}

                {{ result.company_name|title }}

              {% endif %}

            {{ result.expiration_date }}
            {{ result.financial_id }}

            {% if result.contract_id in user_follows %}

                Stop receiving updates

            {% else %}

                Subscribe for updates

            {% endif %}

          {% endfor %}

      {% if pagination.pages > 1 %}
        {{ macros.render_pagination(pagination) }}
      {% endif %}

    {% else %}

There are no results!

Is this a mistake? Try including expired contracts in your search, or send us feedback.

    {% endif %}

{% endblock %}


text:
FactoryBot.define do
  factory :guide_question, class: Guide::Question do
    name unique_id
    id_name unique_id
    question_type "yes_no"
  end
end


text:
import { describe, it } from 'flow-typed-test';
import sessionStorage from 'sessionstorage';

describe('sessionstorage', () => {
  it('getItem', () => {
    const a = sessionStorage.getItem('test');
    // $FlowExpectedError[incompatible-call] `a` is still a maybe type
    JSON.parse(a);
    if (a) {
      JSON.parse(a);
    }
    // $FlowExpectedError[incompatible-call]
    sessionStorage.getItem();
  });

  it('setItem', () => {
    const a: void = sessionStorage.setItem('test', 'value');
  });

  it('removeItem', () => {
    (sessionStorage.removeItem('test'): void);
    // $FlowExpectedError[incompatible-call]
    sessionStorage.removeItem();
  });

  it('clear', () => {
    sessionStorage.clear();
    // $FlowExpectedError[extra-arg] accepts no args
    sessionStorage.clear('test');
  });
});