text:
import greenfoot.Actor;
import greenfoot.Greenfoot;
import greenfoot.GreenfootImage;

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

// @TODO add a description of what this class does
/**
 * This project honors the Google Java style-guide. A summary of the style-guide
 * followed can be found at: https://google.github.io/styleguide/javaguide.html
 *
 * All methods used in this project are either from the greenfoot book
 * "Programeren in Java met Greenfoot" first edition, found at the site
 * https://www.tutorialspoint.com/design_pattern/ or are self made.
 *
 * @author Sem van Nieuwenhuizen
 * @issues https://github.com/Essoplerck/Chain-Factor/issues
 * @license MIT
 * @repository https://github.com/Essoplerck/Chain-Factor.git
 * @version v1.0.0
 */
public abstract class Button extends Actor {
  // This will hold a list of all instances
  protected static List<Button> instances;

  // This will hold an image
  protected GreenfootImage image;
  protected GreenfootImage imageHover;
  protected GreenfootImage imagePress;

  // This will store a reference to the Board class
  protected Board board;

  // This will store a reference to the Score class
  protected Score score;

  // This will store the state of this instance
  protected String state;

  /**
   *
   */
  public Button(Board board, String name, Score score) {
    // Set a reference to the Board class
    this.board = board;

    // Set a reference to the Score class
    this.score = score;

    // Set the images
    image      = new GreenfootImage(name + ".png");
    imageHover = new GreenfootImage(name + "_hover.png");
    imagePress = new GreenfootImage(name + "_press.png");

    // Set the state
    setState("initial");

    // Check if an list is present
    if (instances == null) {
      // Make an list
      instances = new ArrayList<Button>();
    }

    // Add this instance to the list of instances
    instances.add(this);
  }

  /**
   * Define the getInstance() method, this method will return the instances of
   * the Button class. When there are no instances present this method will
   * create an list.
   *
   * @return The instances of the Button class.
   */
  public synchronized static List<Button> getInstances() {
    // Check if an list is present
    if (instances == null) {
      // Create an new list
      instances = new ArrayList<Button>();
    }

    // Return the instances of the Button class
    return instances;
  }

  /**
   * Define the getState() method, this method will retrun the state of this
   * instance.
   *
   * @return The state of this instance
   */
  public String getState() {
    // Return the state
    return state;
  }

  /**
   * Define the getState() method, this method willset the state of this
   * instance.
   *
   * @param state The new state for this instance
   */
  public void setState(String state) {
    // Check if this instance already has this tate
    if (state == getState()) {
      // Return
      return;
    }

    // Set the state
    this.state = state;

    // Check what state is active
    if (state == "clicked") {
      // Call the eventClick() method
      eventClick();

      // Set the state to hovered
      setState("hovered");
    } else if (state == "hovered") {
      // Call the eventHover() method
      eventHover();

      // Set the image
      setImage(imageHover);
    } else if (state == "pressed") {
      // Call the eventPress() method
      eventPress();

      // Set the image
      setImage(imagePress);
    } else {
      // Set the image
      setImage(image);
    }
  }

  /**
   * Define the eventClick() method.
   */
  abstract void eventClick();

  /**
   * Define the eventHover() method.
   */
  abstract void eventHover();

  /**
   * Define the eventPress() method.
   */
  abstract void eventPress();

  /**
   * Define the act() method, this method is called by the greenfoot framework
   * at each action step in the environment.
   *
   * Inherited from the Greenfoot.Actor class.
   */
  public void act() {
    // Check what state this instance should be
    if (Greenfoot.mouseClicked(this)) {
      // Set the state to clicked
      setState("clicked");
    } else if (Greenfoot.mouseMoved(this)) {
      // Set the state to hovered
      setState("hovered");
    }  else if (Greenfoot.mousePressed(this) || Greenfoot.mouseDragged(this)) {
      // Set the state to pressed
      setState("pressed");
    } else if (Greenfoot.mouseMoved(null) || Greenfoot.mouseDragEnded(this)) {
      // Set the state to initial
      setState("initial");
    }
  }
}


text:
Cloud Auxiliary has support for Google Cloud Platform.

## Documenation

 - [CloudAux](../../README.md "CloudAux Readme")
 - [AWS](../aws/README.md "Amazon Web Services Docs")
 - [GCP](README.md "Google Cloud Platform Docs") [THIS FILE]

## Features

 - choosing the best client based on service
 - client caching
 - general caching and stats decorators available
 - basic support for non-specified discovery-API services
 - control which attributes are returned with flags.

## Orchestration Supported Technologies

 - IAM Service Accounts
 - Network/Subnetworks
 - Storage Buckets

## Install

    pip install cloudaux

For GCP support run:

    pip install cloudaux\[gcp\]

## Authentication/Authorization

 - Default Credentials (if running on GCE)
 - JSON key format

## Example

    # directly asking for a client:
    from cloudaux.aws.gcp.auth import get_client
    client = get_client('gce', **conn_details)

    # Over your entire environment:
    from cloudaux.gcp.decorators import iter_project

    projects = ['my-project-one', 'my-project-two']

    # To specify per-project key_files, you can do thie following:
    # projects = [
    #  {'project': 'my-project-one', key_file='/path/to/project-one.json'},
    #  {'project': 'my-project-two', key_file='/path/to/project-two.json'}
    # ]
    #
    # To specify a single key_file for all projects, use the key_file argument
    # to the decorator
    # @iter_project(projects=projects, key_file='/path/to/key.json')
    #
    # To use default credentials, omit the key_file argument
    # @iter_project(projects=projects)

    @iter_project(projects=projects, key_file='/path/to/key.json')
    def test_iter(**kwargs):
       accounts = list_serviceaccounts(**kwargs)
       ret = []
       for account in accounts:
         ret.append(get_serviceaccount_complete(service_account=account['name']))
       return ret

## Orchestration Example

### IAM Service Account

    from cloudaux.orchestration.gcp.iam.serviceaccount import get_serviceaccount_complete, FLAGS
    sa_name = 'projects/my-project-one/serviceAccounts/service-account-key@my-project-one.iam.gserviceaccount.com'
    sa = get_serviceaccount_complete(sa_name, flags=FLAGS.ALL, **conn_details)
    print(json.dumps(sa, indent=4, sort_keys=True))

    # Flag options for Service Accounts are BASE, KEYS, POLICY, ALL (default).

    {
      "DisplayName": "service-account",
      "Email": "service-account@my-project-one.iam.gserviceaccount.com",
      "Etag": "BwUzTDvWgHw=",
      "Keys": [
          {
              "KeyAlgorithm": "KEY_ALG_RSA_2048",
              "Name": "projects/my-project-one/serviceAccounts/service-account@my-project-one.iam.gserviceaccount.com/keys/8be0096886f6ed5cf51abb463d3448c8aee6c6b6",
              "ValidAfterTime": "2016-06-30T18:26:45Z",
              "ValidBeforeTime": "2026-06-28T18:26:45Z"
          },
 	  ...
      ],
      "Name": "projects/my-project-one/serviceAccounts/service-account@my-project-one.iam.gserviceaccount.com",
      "Oauth2ClientId": "115386704809902483492",
      "Policy": [
          {
              "Members": [
                  "user:test-user@gmail.com"
              ],
              "Role": "roles/iam.serviceAccountActor"
          }
      ],
      "ProjectId": "my-project-one",
      "UniqueId": "115386704809902483492"
    }

### Network
    from cloudaux.orchestration.gcp.gce.network import get_network_and_subnetworks
    net_subnet = get_network_and_subnetworks(network=NETWORK, **conn_details)
    print(json.dumps(net_subnet, indent=4, sort_keys=True))

    # Flag options for Service Accounts are BASE, ALL (default).
    # BASE and ALL are equivelant for this service.

    {
      "AutoCreateSubnetworks": true,
      "CreationTimestamp": "2016-05-09T11:15:47.434-07:00",
      "Description": "Default network for the project",
      "Id": "5748627682906434876",
      "Kind": "compute#network",
      "Name": "default",
      "SelfLink": "https://www.googleapis.com/compute/v1/projects/my-project-one/global/networks/default",
      "Subnetworks": [
          {
              "CreationTimestamp": "2016-10-25T09:53:00.777-07:00",
              "GatewayAddress": "10.146.0.1",
              "Id": "1852214226435846915",
              "IpCidrRange": "10.146.0.0/20",
              "Kind": "compute#subnetwork",
              "Name": "default",
              "Network": "https://www.googleapis.com/compute/v1/projects/my-project-one/global/networks/default",
              "Region": "https://www.googleapis.com/compute/v1/projects/my-project-one/regions/asia-northeast1",
              "SelfLink": "https://www.googleapis.com/compute/v1/projects/my-project-one/regions/asia-northeast1/subnetworks/default"
          },
          ...
      ]
    }

### GCS Bucket
    from cloudaux.orchestration.gcp.gcs.bucket import get_bucket
    b = get_bucket(bucket_name=BUCKET, **conn_details)
    print(json.dumps(b, indent=4, sort_keys=True))

    # Flag options for Service Accounts are BASE, ALL (default).
    # BASE and ALL are equivelant for this service.

    {
	"Acl": [
          {
              "entity": "project-editors-2094195755361",
              "role": "OWNER"
          },
          {
              "entity": "project-viewers-2094195755361",
              "role": "READER"
          },
          {
              "entity": "project-owners-2094195755361",
              "role": "OWNER"
          }
        ],
        "Cors": [],
        "DefaultObjectAcl": [
          {
              "entity": "project-editors-1094195755360",
              "role": "OWNER"
          },
          {
              "entity": "project-viewers-1094195755360",
              "role": "READER"
          }
        ],
        "Etag": "CAE=",
        "Id": "my-bucket",
        "Location": "US",
        "Metageneration": 1,
        "Owner": null,
        "Path": "/b/my-bucket",
        "ProjectNumber": 2094195755361,
        "SelfLink": "https://www.googleapis.com/storage/v1/my-bucket",
        "StorageClass": "MULTI_REGIONAL",
        "VersioningEnabled": false
    }
## Firewall Rules
### List Rules
    from cloudaux.gcp.gce.firewall import list_firewall_rules
    rules = list_firewall_rules(**conn_details)
    for rule in rules:
      print(json.dumps(rule, indent=4, sort_keys=True))

### Get Single Rule
    # get single rule
    from cloudaux.gcp.gce.firewall import get_firewall_rule
    rule = get_firewall_rule(Firewall='default-allow-http', **conn_details)
    print(json.dumps(rule, indent=4, sort_keys=True))

    {
        "allowed": [
            {
                "IPProtocol": "tcp",
                "ports": [
                    "80"
                ]
            }
        ],
        "creationTimestamp": "2016-10-03T11:10:37.412-07:00",
        "description": "",
        "id": "6048401367777616399",
        "kind": "compute#firewall",
        "name": "default-allow-http",
        "network": "https://www.googleapis.com/compute/v1/projects/my-project/global/networks/default",
        "selfLink": "https://www.googleapis.com/compute/v1/projects/my-project/global/firewalls/default-allow-http",
        "sourceRanges": [
            "0.0.0.0/0"
        ],
        "targetTags": [
            "http-server"
        ]
    }

## Function Stats
    from cloudaux.gcp.utils import get_gcp_stats
    print json.dumps(get_gcp_stats(), indent=4)

    {
       "n=get_client__args=('gce',)__kwargs={'project': 'my-project-one', 'key_file': None, 'service_type': 'client', 'http_auth': None}": [
           0.12389707565307617,
           4.506111145019531e-05,
           4.506111145019531e-05,
           4.601478576660156e-05,
           4.100799560546875e-05,
           5.793571472167969e-05
       ],
      ...
    }
## Caching Stats
### Access Details
    from cloudaux.gcp.utils import get_cache_access_details
    print get_cache_access_details(key=KEY)
    {
      "n=get_client__args=('gce',)__kwargs={'project': 'my-project-one', 'key_file': None, 'service_type': 'client', 'http_auth': None}":
        {'miss': 1,
	 'expired': 0,
	  'hit': 5}
       ...
    }

### Totals
    from cloudaux.gcp.utils import get_cache_stats
    print json.dumps(get_cache_stats(), indent=4)

    {
        "totals": {
            "keys": 3,
            "miss": 3,
            "expired": 0,
            "hit": 30
        }
    }

redpajama_set_name: RedPajamaGithub


text:
/**
 * Generated by API Builder - https://www.apibuilder.io
 * Service version: 0.15.81
 * apibuilder 0.15.33 app.apibuilder.io/apicollective/apibuilder-generator/latest/anorm_2_8_parsers
 */
package io.apibuilder.generator.v0.anorm.conversions {

  import anorm.{Column, MetaDataItem, TypeDoesNotMatch}
  import play.api.libs.json.{JsArray, JsObject, JsValue}
  import scala.util.{Failure, Success, Try}
  import play.api.libs.json.JodaReads._

  /**
    * Conversions to collections of objects using JSON.
    */
  object Util {

    def parser[T](
      f: play.api.libs.json.JsValue => T
    ) = anorm.Column.nonNull { (value, meta) =>
      val MetaDataItem(columnName, nullable, clazz) = meta
      value match {
        case json: org.postgresql.util.PGobject => parseJson(f, columnName.qualified, json.getValue)
        case json: java.lang.String => parseJson(f, columnName.qualified, json)
        case _=> {
          Left(
            TypeDoesNotMatch(
              s"Column[${columnName.qualified}] error converting $value to Json. Expected instance of type[org.postgresql.util.PGobject] and not[${value.asInstanceOf[AnyRef].getClass}]"
            )
          )
        }

      }
    }

    private[this] def parseJson[T](f: play.api.libs.json.JsValue => T, columnName: String, value: String) = {
      Try {
        f(
          play.api.libs.json.Json.parse(value)
        )
      } match {
        case Success(result) => Right(result)
        case Failure(ex) => Left(
          TypeDoesNotMatch(
            s"Column[$columnName] error parsing json $value: $ex"
          )
        )
      }
    }

  }

  object Types {
    import io.apibuilder.generator.v0.models.json._
    implicit val columnToSeqApibuilderGeneratorFileFlag: Column[Seq[_root_.io.apibuilder.generator.v0.models.FileFlag]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.FileFlag]] }
    implicit val columnToMapApibuilderGeneratorFileFlag: Column[Map[String, _root_.io.apibuilder.generator.v0.models.FileFlag]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.FileFlag]] }
    implicit val columnToSeqApibuilderGeneratorAttribute: Column[Seq[_root_.io.apibuilder.generator.v0.models.Attribute]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Attribute]] }
    implicit val columnToMapApibuilderGeneratorAttribute: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Attribute]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Attribute]] }
    implicit val columnToSeqApibuilderGeneratorError: Column[Seq[_root_.io.apibuilder.generator.v0.models.Error]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Error]] }
    implicit val columnToMapApibuilderGeneratorError: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Error]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Error]] }
    implicit val columnToSeqApibuilderGeneratorFile: Column[Seq[_root_.io.apibuilder.generator.v0.models.File]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.File]] }
    implicit val columnToMapApibuilderGeneratorFile: Column[Map[String, _root_.io.apibuilder.generator.v0.models.File]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.File]] }
    implicit val columnToSeqApibuilderGeneratorGenerator: Column[Seq[_root_.io.apibuilder.generator.v0.models.Generator]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Generator]] }
    implicit val columnToMapApibuilderGeneratorGenerator: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Generator]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Generator]] }
    implicit val columnToSeqApibuilderGeneratorHealthcheck: Column[Seq[_root_.io.apibuilder.generator.v0.models.Healthcheck]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Healthcheck]] }
    implicit val columnToMapApibuilderGeneratorHealthcheck: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Healthcheck]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Healthcheck]] }
    implicit val columnToSeqApibuilderGeneratorInvocation: Column[Seq[_root_.io.apibuilder.generator.v0.models.Invocation]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.Invocation]] }
    implicit val columnToMapApibuilderGeneratorInvocation: Column[Map[String, _root_.io.apibuilder.generator.v0.models.Invocation]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.Invocation]] }
    implicit val columnToSeqApibuilderGeneratorInvocationForm: Column[Seq[_root_.io.apibuilder.generator.v0.models.InvocationForm]] = Util.parser { _.as[Seq[_root_.io.apibuilder.generator.v0.models.InvocationForm]] }
    implicit val columnToMapApibuilderGeneratorInvocationForm: Column[Map[String, _root_.io.apibuilder.generator.v0.models.InvocationForm]] = Util.parser { _.as[Map[String, _root_.io.apibuilder.generator.v0.models.InvocationForm]] }
  }

  object Standard {
    implicit val columnToJsObject: Column[play.api.libs.json.JsObject] = Util.parser { _.as[play.api.libs.json.JsObject] }
    implicit val columnToSeqBoolean: Column[Seq[Boolean]] = Util.parser { _.as[Seq[Boolean]] }
    implicit val columnToMapBoolean: Column[Map[String, Boolean]] = Util.parser { _.as[Map[String, Boolean]] }
    implicit val columnToSeqDouble: Column[Seq[Double]] = Util.parser { _.as[Seq[Double]] }
    implicit val columnToMapDouble: Column[Map[String, Double]] = Util.parser { _.as[Map[String, Double]] }
    implicit val columnToSeqInt: Column[Seq[Int]] = Util.parser { _.as[Seq[Int]] }
    implicit val columnToMapInt: Column[Map[String, Int]] = Util.parser { _.as[Map[String, Int]] }
    implicit val columnToSeqLong: Column[Seq[Long]] = Util.parser { _.as[Seq[Long]] }
    implicit val columnToMapLong: Column[Map[String, Long]] = Util.parser { _.as[Map[String, Long]] }
    implicit val columnToSeqLocalDate: Column[Seq[_root_.org.joda.time.LocalDate]] = Util.parser { _.as[Seq[_root_.org.joda.time.LocalDate]] }
    implicit val columnToMapLocalDate: Column[Map[String, _root_.org.joda.time.LocalDate]] = Util.parser { _.as[Map[String, _root_.org.joda.time.LocalDate]] }
    implicit val columnToSeqDateTime: Column[Seq[_root_.org.joda.time.DateTime]] = Util.parser { _.as[Seq[_root_.org.joda.time.DateTime]] }
    implicit val columnToMapDateTime: Column[Map[String, _root_.org.joda.time.DateTime]] = Util.parser { _.as[Map[String, _root_.org.joda.time.DateTime]] }
    implicit val columnToSeqBigDecimal: Column[Seq[BigDecimal]] = Util.parser { _.as[Seq[BigDecimal]] }
    implicit val columnToMapBigDecimal: Column[Map[String, BigDecimal]] = Util.parser { _.as[Map[String, BigDecimal]] }
    implicit val columnToSeqJsObject: Column[Seq[_root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsObject]] }
    implicit val columnToMapJsObject: Column[Map[String, _root_.play.api.libs.json.JsObject]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsObject]] }
    implicit val columnToSeqJsValue: Column[Seq[_root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Seq[_root_.play.api.libs.json.JsValue]] }
    implicit val columnToMapJsValue: Column[Map[String, _root_.play.api.libs.json.JsValue]] = Util.parser { _.as[Map[String, _root_.play.api.libs.json.JsValue]] }
    implicit val columnToSeqString: Column[Seq[String]] = Util.parser { _.as[Seq[String]] }
    implicit val columnToMapString: Column[Map[String, String]] = Util.parser { _.as[Map[String, String]] }
    implicit val columnToSeqUUID: Column[Seq[_root_.java.util.UUID]] = Util.parser { _.as[Seq[_root_.java.util.UUID]] }
    implicit val columnToMapUUID: Column[Map[String, _root_.java.util.UUID]] = Util.parser { _.as[Map[String, _root_.java.util.UUID]] }
  }

}


text:
extern const char kSource_tizen_api[];

common::Extension* CreateExtension() {
  return new TizenExtension;
}

TizenExtension::TizenExtension() {
  SetExtensionName("tizen");
  SetJavaScriptAPI(kSource_tizen_api);
}

TizenExtension::~TizenExtension() {}


text:
package org.oscm.serviceprovisioningservice.bean;

import java.math.BigDecimal;

import org.oscm.domobjects.ParameterDefinition;
import org.oscm.domobjects.TechnicalProduct;
import org.oscm.internal.types.enumtypes.ParameterModificationType;
import org.oscm.internal.types.enumtypes.ParameterType;
import org.oscm.internal.types.enumtypes.ParameterValueType;
import org.oscm.internal.types.exception.DomainObjectException.ClassEnum;
import org.oscm.internal.types.exception.ImportException;
import org.oscm.internal.types.exception.UpdateConstraintException;
import org.oscm.serviceprovisioningservice.verification.UpdateParameterCheck;
import org.xml.sax.Attributes;

/**
 * @author yuyin
 *
 */
class TechnicalProductParameterImportParser {

    private static final String ATTRIBUTE_MANDATORY = "mandatory";
    private static final String ATTRIBUTE_MIN_VALUE = "minValue";
    private static final String ATTRIBUTE_MAX_VALUE = "maxValue";
    private static final String ATTRIBUTE_CONFIGURABLE = "configurable";
    private static final String ATTRIBUTE_MODIFICATIONTYPE = "modificationType";
    private static final String ATTRIBUTE_DEFAULT = "default";

    /**
     * The technical product to which the parameter definition belongs
     */
    private TechnicalProduct techProduct;

    /**
     * If the parameter value type is Enumeration, save the default value to
     * tempDefaultValueForEnumeration
     */
    private String tempDefaultValueForEnumeration;
    /**
     * Parse new parameter if the value of createAction is true; if false,
     * updating parameter.
     */
    private boolean createAction;

    /**
     * Parameter definition to be created or updated.
     */
    private ParameterDefinition paramDef;

    /**
     * @param techProduct
     *            the techProduct to set
     */
    void setTechProduct(TechnicalProduct techProduct) {
        this.techProduct = techProduct;
    }

    /**
     * @param tempValue
     *            the tempDefaultValueForEnumeration to set
     */
    void setTempDefaultValueForEnumeration(String tempValue) {
        this.tempDefaultValueForEnumeration = tempValue;
    }

    /**
     * @return the tempDefaultValueForEnumeration
     */
    String getTempDefaultValueForEnumeration() {
        return tempDefaultValueForEnumeration;
    }

    /**
     * @param id
     *            the parameter identifier
     * @param valueType
     *            the parameter value type
     * @param atts
     *            the parameter attributes
     * @param techProd
     *            technical product to which the parameter definition belongs
     * @param paramDefinition
     *            parameter definition to be created or updated
     * @return The created or updated parameter definition
     * @throws UpdateConstraintException
     * @throws ImportException
     */
    ParameterDefinition parseParameterDef(String id, String valueType,
            Attributes atts, TechnicalProduct techProd,
            ParameterDefinition paramDefinition)
            throws UpdateConstraintException, ImportException {
        this.paramDef = paramDefinition;
        this.techProduct = techProd;
        String[] optionalValues = getOptionalValues(atts, ATTRIBUTE_MANDATORY,
                ATTRIBUTE_DEFAULT, ATTRIBUTE_MIN_VALUE, ATTRIBUTE_MAX_VALUE,
                ATTRIBUTE_CONFIGURABLE, ATTRIBUTE_MODIFICATIONTYPE);

        parseOptionalValue(valueType, optionalValues[1], ATTRIBUTE_DEFAULT);
        parseOptionalValue(valueType, optionalValues[2], ATTRIBUTE_MIN_VALUE);
        parseOptionalValue(valueType, optionalValues[3], ATTRIBUTE_MAX_VALUE);

        return createOrUpdateProductParameterDefinition(id,
                ParameterValueType.valueOf(valueType), optionalValues[0], // mandatory
                optionalValues[1], // default value
                optionalValues[2], // minimum value
                optionalValues[3], // maximum value
                optionalValues[4], // configurable
                optionalValues[5]);// modificationType
    }

    private void parseOptionalValue(String valueType, String value,
            String attribute) throws ImportException {
        if (value == null || value.length() == 0) {
            return;
        }

        ParameterValueType type = ParameterValueType.valueOf(valueType);
        try {
            switch (type) {
            case BOOLEAN:
                if (!isBoolValue(value))
                    throw new IllegalArgumentException();
                break;
            case INTEGER:
                Integer.parseInt(value);
                break;
            case LONG:
                Long.parseLong(value);
                break;
            case DURATION:
                new BigDecimal(value);
                break;
            default:
                // strings ok, enumarations handled later
                break;
            }
        } catch (IllegalArgumentException ex) {
            throw new ImportException(String.format(
                    "The value '%s' for the attribute '%s' does not match with the required type %s.",
                    value, attribute, type.name()));
        }

    }

    private boolean isBoolValue(String value) {
        return (Boolean.TRUE.toString().equals(value)
                || Boolean.FALSE.toString().equals(value));
    }

    /**
     * Return true if the given string is null or only contains whitespaces.
     *
     * @param str
     *            the string to check
     * @return true if the given string is null or only contains whitespaces.
     */
    private boolean isBlank(String str) {
        if (str == null) {
            return true;
        }
        return str.trim().length() == 0;
    }

    /**
     * @param atts
     * @param attNames
     * @return String value of optional attributes
     */
    String[] getOptionalValues(Attributes atts, String... attNames) {
        String[] values = new String[attNames.length];
        for (int i = 0; i < attNames.length; i++) {
            values[i] = atts.getValue(attNames[i]);
        }
        return values;
    }

    /**
     * Get the parameter definition for the parameter identifier from the
     * database and create a new parameter definition, if the parameter
     * definition doesn't already exist.
     *
     * @param id
     *            the parameter identifier
     * @param valueType
     *            the parameter value type
     * @param mandatory
     *            Indicates if the parameter definition is mandatory.
     * @param defaultValue
     *            The default value to be set for the parameter definition.
     * @param minValue
     *            The minimum value allowed for the parameter.
     * @param maxValue
     *            The maximum value allowed for the parameter.
     * @param configurable
     *            Indicates whether the parameter is configurable or not.
     * @param modificationType
     *            Indicates whether the parameter is able to be modified after
     *            subscribing.
     */
    void createParameterDefinition(String id, ParameterValueType valueType,
            String mandatory, String defaultValue, String minValue,
            String maxValue, String configurable, String modificationType)
            throws ImportException {
        paramDef = new ParameterDefinition();
        paramDef.setParameterType(ParameterType.SERVICE_PARAMETER);
        paramDef.setParameterId(id);
        paramDef.setValueType(valueType);
        if (!isBlank(mandatory)) {
            paramDef.setMandatory(Boolean.parseBoolean(mandatory));
        } else {
            paramDef.setMandatory(false);
        }
        if (!isBlank(configurable)) {
            paramDef.setConfigurable(Boolean.parseBoolean(configurable));
        } else {
            paramDef.setConfigurable(true);
        }
        if (!isBlank(modificationType)) {
            paramDef.setModificationType(
                    ParameterModificationType.valueOf(modificationType));
        } else {
            paramDef.setModificationType(ParameterModificationType.STANDARD);
        }

        setDefaultValue(defaultValue, minValue, maxValue, valueType);
        if (!isBlank(minValue)) {
            paramDef.setMinimumValue(Long.valueOf(minValue));
        }
        if (!isBlank(maxValue)) {
            paramDef.setMaximumValue(Long.valueOf(maxValue));
        }

        paramDef.setTechnicalProduct(techProduct);
        setCreateAction(true);
    }

    /**
     * Get the parameter definition for the parameter identifier from the
     * database and update it , if the parameter definition already exists.
     *
     * @param id
     *            the parameter identifier
     * @param valueType
     *            the parameter value type
     * @param mandatory
     *            Indicates if the parameter definition is mandatory.
     * @param defaultValue
     *            The default value to be set for the parameter definition.
     * @param minValue
     *            The minimum value allowed for the parameter.
     * @param maxValue
     *            The maximum value allowed for the parameter.
     * @param configurable
     *            Indicates whether the parameter is configurable or not.
     * @param modificationType
     *            Indicates whether the parameter is able to be modified after
     *            subscribing.
     * @throws UpdateConstraintException
     * @throws ImportException
     */
    void updateParameterDefinition(String id, ParameterValueType valueType,
            String mandatory, String defaultValue, String minValue,
            String maxValue, String configurable, String modificationType)
            throws UpdateConstraintException, ImportException {

        boolean isDirty = false;

        if (paramDef.getValueType() != valueType) {
            paramDef.setValueType(valueType);
            isDirty = true;
        }

        if (!isBlank(mandatory)) {
            boolean flag = Boolean.parseBoolean(mandatory);
            if (paramDef.isMandatory() != flag) {
                paramDef.setMandatory(flag);
                isDirty = true;
            }
        } else {
            if (paramDef.isMandatory()) {
                paramDef.setMandatory(false);
                isDirty = true;
            }
        }

        if (!isBlank(configurable)) {
            boolean flag = Boolean.parseBoolean(configurable);
            if (paramDef.isConfigurable() != flag) {
                paramDef.setConfigurable(flag);
                isDirty = true;
            }
        } else {
            if (!paramDef.isConfigurable()) {
                paramDef.setConfigurable(true);
                isDirty = true;
            }
        }

        if (isBlank(modificationType)) {
            modificationType = ParameterModificationType.STANDARD.name();
        }
        UpdateParameterCheck.updateParameterDefinition(paramDef, techProduct,
                modificationType);
        if (isNewValue(paramDef.getModificationType().name(),
                modificationType)) {
            paramDef.setModificationType(
                    ParameterModificationType.valueOf(modificationType));
            isDirty = true;
        }

        if (isNewValue(paramDef.getDefaultValue(), defaultValue)) {
            setDefaultValue(defaultValue, minValue, maxValue, valueType);
            isDirty = true;
        } else if (valueType == ParameterValueType.ENUMERATION) {
            tempDefaultValueForEnumeration = defaultValue;
        }

        Long val = null;
        if (!isBlank(minValue)) {
            val = Long.valueOf(minValue);
        }
        if (isNewValue(paramDef.getMinimumValue(), val)) {
            paramDef.setMinimumValue(val);
            isDirty = true;
        }

        val = null;
        if (!isBlank(maxValue)) {
            val = Long.valueOf(maxValue);
        }
        if (isNewValue(paramDef.getMaximumValue(), val)) {
            paramDef.setMaximumValue(val);
            isDirty = true;
        }

        if (isDirty & paramDef.definesParametersOfUndeletedProduct()) {
            UpdateConstraintException e = new UpdateConstraintException(
                    ClassEnum.TECHNICAL_SERVICE, getTechProductBusinessKey());
            throw e;
        }
        setCreateAction(false);
    }

    /**
     * Get the parameter definition for the parameter identifier from the
     * database and update it or create a new parameter definition, if the
     * parameter definition doesn't already exist.
     *
     * @param id
     *            the parameter identifier
     * @param valueType
     *            the parameter value type
     * @param mandatory
     *            Indicates if the parameter definition is mandatory.
     * @param defaultValue
     *            The default value to be set for the parameter definition.
     * @param minValue
     *            The minimum value allowed for the parameter.
     * @param maxValue
     *            The maximum value allowed for the parameter.
     * @param configurable
     *            Indicates whether the parameter is configurable or not.
     * @param modificationType
     *            Indicates whether the parameter is able to be modified after
     *            subscribing.
     * @return The initialized parameter definition.
     * @throws UpdateConstraintException
     * @throws ImportException
     */
    ParameterDefinition createOrUpdateProductParameterDefinition(String id,
            ParameterValueType valueType, String mandatory, String defaultValue,
            String minValue, String maxValue, String configurable,
            String modificationType)
            throws UpdateConstraintException, ImportException {
        if (paramDef == null) {
            createParameterDefinition(id, valueType, mandatory, defaultValue,
                    minValue, maxValue, configurable, modificationType);
        } else {
            updateParameterDefinition(id, valueType, mandatory, defaultValue,
                    minValue, maxValue, configurable, modificationType);
        }
        return paramDef;
    }

    /**
     * Responsible for assigning the default value. The default value should be
     * in the range of the minimum and maximum value. If the default value is
     * not assigned the minimum value will be taken as a default value.
     *
     * @param defaultValue
     *            The default value for the parameter definition.
     * @param minValue
     *            The minimum value for the parameter definition.
     * @param maxValue
     *            The maximum value for the parameter definition.
     * @param valueType
     *            The value type for the parameter definition.
     * @throws ImportException
     *
     */
    void setDefaultValue(String defaultValue, String minValue, String maxValue,
            ParameterValueType valueType) throws ImportException {
        isDefaultValueRequired(defaultValue);

        if (valueType == ParameterValueType.BOOLEAN
                || valueType == ParameterValueType.STRING
                || valueType == ParameterValueType.PWD
                || valueType == ParameterValueType.DURATION
                || valueType == ParameterValueType.ENUMERATION) {
            setDefaultValueForNonDigitalTpye(defaultValue, valueType);
        } else {
            setDefaultValueForDigitalTpye(defaultValue, minValue, maxValue);
        }

    }

    /**
     * If the parameter definition is marked as non-configurable, the default
     * value will be set. If no default values is defined, the import operation
     * will fail.
     *
     * @param defaultValue
     *            The default value for the parameter definition.
     * @throws ImportException
     *
     */
    void isDefaultValueRequired(String defaultValue) throws ImportException {
        // if the parameter is not configurable and no default value is defined
        if (!paramDef.isConfigurable() && isBlank(defaultValue)) {
            ImportException e = new ImportException(
                    "The parameter default value must be set as it is not configurable");
            throw e;
        }
    }

    /**
     * Set default value to parameter definition when  valueType is
     * BOOLEAN, STRING, DURATION or ENUMERATION.
     *
     * @param defaultValue
     *            The default value for the parameter definition.
     * @param valueType
     *            The value type for the parameter definition.
     *
     */
    void setDefaultValueForNonDigitalTpye(String defaultValue,
            ParameterValueType valueType) {
        if (valueType == ParameterValueType.ENUMERATION) {
            // default value will be set after the options have been read
            if (!isBlank(defaultValue)) {
                tempDefaultValueForEnumeration = defaultValue;
            }
        } else {
            paramDef.setDefaultValue(
                    isBlank(defaultValue) ? null : defaultValue);
        }
    }

    /**
     * Set default value to parameter definition when  valueType is
     * INTEGER or LONG.
     *
     * @param defaultValue
     *            The default value for the parameter definition.
     * @param minValue
     *            The minimum value for the parameter definition.
     * @param maxValue
     *            The maximum value for the parameter definition.
     * @throws ImportException
     *
     */
    void setDefaultValueForDigitalTpye(String defaultValue, String minValue,
            String maxValue) throws ImportException {
        if (isBlank(defaultValue)) {
            paramDef.setDefaultValue(null);
        } else {
            double def = Double.parseDouble(defaultValue);
            Double min = null;
            if (!isBlank(minValue)) {
                min = Double.valueOf(minValue);
            }
            Double max = null;
            if (!isBlank(maxValue)) {
                max = Double.valueOf(maxValue);
            }
            if ((max != null && def > max.longValue())
                    || (min != null && def < min.longValue())) {
                throw new ImportException(
                        "The default value should be in the range of minimum and maximum value");
            }
            paramDef.setDefaultValue(defaultValue);
        }
    }

    /**
     * @param oldVal
     * @param newVal
     * @return true if the given oldVal is not equals with newVal
     */
    boolean isNewValue(Object oldVal, Long newVal) {
        return oldVal == null && newVal != null
                || oldVal != null && !oldVal.equals(newVal);
    }

    /**
     * @param oldVal
     * @param newVal
     * @return true if the given oldVal is not equals with newVal
     */
    boolean isNewValue(Object oldVal, String newVal) {
        return oldVal == null && !isBlank(newVal)
                || oldVal != null && !oldVal.equals(newVal);
    }

    /**
     * @return the technical product id or an empty string if the current
     *         technical product is null.
     */
    String getTechProductBusinessKey() {
        if (techProduct == null) {
            return "";
        }
        return techProduct.getTechnicalProductId();
    }

    /**
     * @param createAction
     *            the createAction to set
     */
    void setCreateAction(boolean createAction) {
        this.createAction = createAction;
    }

    /**
     * @return the createAction
     */
    boolean isCreateAction() {
        return createAction;
    }

    /**
     * @param paramDef
     *            the paramDef to set
     */
    void setParamDef(ParameterDefinition paramDef) {
        this.paramDef = paramDef;
    }

    /**
     * @return the paramDef
     */
    ParameterDefinition getParamDef() {
        return paramDef;
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Prim. fl. esseq. 305 (1818)

#### Original name
Thelephora elegans G. Mey., 1818

### Remarks
null


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/bgLayout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  >

  <fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bottom_sheet"
    android:fitsSystemWindows="true"
    tools:context="se.ifthenel.android.example.ffa.MapsActivity" />

  <RelativeLayout
    android:id="@+id/bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:background="@drawable/custom_ripple"
    android:clickable="true"
    android:clipToPadding="true"
    android:fitsSystemWindows="true"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

    <TextView
      android:id="@+id/text_bottom_sheet_title"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_toLeftOf="@+id/button_open_plan"
      android:layout_toStartOf="@+id/button_open_plan"
      android:paddingBottom="4dp"
      android:paddingLeft="16dp"
      android:paddingRight="16dp"
      android:paddingTop="22dp"
      android:text="Title"
      android:textAllCaps="true"
      android:textSize="16sp"
      android:textStyle="bold" />

    <TextView
      android:id="@+id/text_bottom_sheet_description"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@+id/text_bottom_sheet_title"
      android:layout_toLeftOf="@+id/button_open_plan"
      android:layout_toStartOf="@+id/button_open_plan"
      android:paddingLeft="16dp"
      android:paddingRight="16dp"
      android:text="Text"
      android:textSize="12sp" />

    <android.support.design.widget.FloatingActionButton
      android:id="@+id/button_open_plan"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentEnd="true"
      android:layout_alignParentRight="true"
      android:layout_centerInParent="true"
      android:background="@color/colorAccent"
      android:scaleType="center"
      android:src="@drawable/ic_floor_plan_24dp"
      android:text="Planlösning"
      app:backgroundTint="@color/colorAccent"
      app:srcCompat="@drawable/ic_floor_plan_24dp"
      app:useCompatPadding="true" />
  </RelativeLayout>

</RelativeLayout>


text:
<?php

/*
 * Abraham Williams (abraham@abrah.am) http://abrah.am
 *
 * The first PHP Library to support OAuth for Tumblr's REST API.  (Originally for Twitter, modified for Tumblr by Lucas)
 */

/* Load OAuth lib. You can find it at http://oauth.net */
require_once('OAuth.php');

/**
 * Tumblr OAuth class
 */
class TumblrOAuth {
  /* Contains the last HTTP status code returned. */
  public $http_code;
  /* Contains the last API call. */
  public $url;
  /* Set up the API root URL. */
  public $host = "http://api.tumblr.com/v2/";
  /* Set timeout default. */
  public $timeout = 45;
  /* Set connect timeout. */
  public $connecttimeout = 45;
  /* Verify SSL Cert. */
  public $ssl_verifypeer = FALSE;
  /* Respons format. */
  public $format = 'json';
  /* Decode returned json data. */
  public $decode_json = TRUE;
  /* Contains the last HTTP headers returned. */
  public $http_info;
  /* Set the useragnet. */
  public $useragent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E; .NET CLR 1.1.4322)';
  /* Immediately retry the API call if the response was not successful. */
  //public $retry = TRUE;

  /**
   * Set API URLS
   */
  function accessTokenURL()  { return 'https://www.tumblr.com/oauth/access_token'; }
  function authenticateURL() { return 'https://www.tumblr.com/oauth/authorize'; }
  function authorizeURL()    { return 'https://www.tumblr.com/oauth/authorize'; }
  function requestTokenURL() { return 'https://www.tumblr.com/oauth/request_token'; }

  /**
   * Debug helpers
   */
  function lastStatusCode() { return $this->http_status; }
  function lastAPICall() { return $this->last_api_call; }

  /**
   * construct TumblrOAuth object
   */
  function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
    $this->sha1_method = new nsx_trOAuthSignatureMethod_HMAC_SHA1();
    $this->consumer = new nsx_trOAuthConsumer($consumer_key, $consumer_secret);
    if (!empty($oauth_token) && !empty($oauth_token_secret)) {
      $this->token = new nsx_trOAuthConsumer($oauth_token, $oauth_token_secret);
    } else {
      $this->token = NULL;
    }
  }

  /**
   * Get a request_token from Tumblr
   *
   * @returns a key/value array containing oauth_token and oauth_token_secret
   */
  function getRequestToken($oauth_callback = NULL) {
    $parameters = array();
    if (!empty($oauth_callback)) {
      $parameters['oauth_callback'] = $oauth_callback;
    }
    $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
    $token = nsx_trOAuthUtil::parse_parameters($request);
    $this->token = new nsx_trOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
    return $token;
  }

  /**
   * Get the authorize URL
   *
   * @returns a string
   */
  function getAuthorizeURL($token, $sign_in_with_tumblr = TRUE) {
    if (is_array($token)) {
      $token = $token['oauth_token'];
    }
    if (empty($sign_in_with_tumblr)) {
      return $this->authorizeURL() . "?oauth_token={$token}";
    } else {
       return $this->authenticateURL() . "?oauth_token={$token}";
    }
  }

  /**
   * Exchange request token and secret for an access token and
   * secret, to sign API calls.
   *
   * @returns array("oauth_token" => "the-access-token",
   *                "oauth_token_secret" => "the-access-secret",
   *                "user_id" => "9436992",
   *                "screen_name" => "abraham")
   */
  function getAccessToken($oauth_verifier = FALSE) {
    $parameters = array();
    if (!empty($oauth_verifier)) {
      $parameters['oauth_verifier'] = $oauth_verifier;
    }
    $request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters);
    $token = nsx_trOAuthUtil::parse_parameters($request);
    $this->token = new nsx_trOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
    return $token;
  }

  /**
   * One time exchange of username and password for access token and secret.
   *
   * @returns array("oauth_token" => "the-access-token",
   *                "oauth_token_secret" => "the-access-secret",
   *                "user_id" => "9436992",
   *                "screen_name" => "abraham",
   *                "x_auth_expires" => "0")
   */
  function getXAuthToken($username, $password) {
    $parameters = array();
    $parameters['x_auth_username'] = $username;
    $parameters['x_auth_password'] = $password;
    $parameters['x_auth_mode'] = 'client_auth';
    $request = $this->oAuthRequest($this->accessTokenURL(), 'POST', $parameters);
    $token = nsx_trOAuthUtil::parse_parameters($request);
    $this->token = new nsx_trOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
    return $token;
  }

  /**
   * GET wrapper for oAuthRequest.
   */
  function get($url, $parameters = array()) {
    $response = $this->oAuthRequest($url, 'GET', $parameters);
    if ($this->format === 'json' && $this->decode_json) {
      return json_decode($response);
    }
    return $response;
  }

  /**
   * POST wrapper for oAuthRequest.
   */
  function post($url, $parameters = array()) {
    $response = $this->oAuthRequest($url, 'POST', $parameters); //prr($response);
    if ($this->format === 'json' && $this->decode_json) {
      return json_decode($response);
    }
    return $response;
  }

  /**
   * DELETE wrapper for oAuthReqeust.
   */
  function delete($url, $parameters = array()) {
    $response = $this->oAuthRequest($url, 'DELETE', $parameters);
    if ($this->format === 'json' && $this->decode_json) {
      return json_decode($response);
    }
    return $response;
  }

  /**
   * Format and sign an OAuth / API request
   */
  function oAuthRequest($url, $method, $parameters) {
    if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
      $url = "{$this->host}{$url}";
    }
    $request = nsx_trOAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
    $request->sign_request($this->sha1_method, $this->consumer, $this->token);
    switch ($method) {
    case 'GET':
      return $this->http($request->to_url(), 'GET');
    default:
      return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
    }
  }

  /**
   * Make an HTTP request
   *
   * @return API results
   */
  function http($url, $method, $postfields = NULL) {  $ref = '';
    $this->http_info = array();
    if ($method=='DELETE') $ci = curl_init(); else $ci = curl_init($url);

    $headers = array();
$headers[] = 'Connection: keep-alive';
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.34 Safari/536.11';
$headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
$headers[] = 'Accept-Encoding: gzip,deflate,sdch';
$headers[] = 'Accept-Language: en-US,en;q=0.8';
$headers[] = 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3';

     $options = array(
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => false,    // don't return headers
//        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle all encodings
        CURLOPT_USERAGENT      => "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E; .NET CLR 1.1.4322)",
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        CURLOPT_TIMEOUT        => 120,      // timeout on response
//        CURLOPT_MAXREDIRS      => $redirs,       // stop after 10 redirects
        CURLOPT_REFERER        => $ref,       // stop after 10 redirects
        CURLINFO_HEADER_OUT    => true
    );
    curl_setopt_array($ci, $options);

    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
    curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
    curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
//    curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));

    switch ($method) {
      case 'POST':
        curl_setopt($ci, CURLOPT_POST, TRUE);
        if (!empty($postfields)) {
          curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
        }
        break;
      case 'DELETE':
        curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
        if (!empty($postfields)) {
          $url = "{$url}?{$postfields}";
        }
    }
//prr($url);
    if ($method=='DELETE')  curl_setopt($ci, CURLOPT_URL, $url);

    global $nxs_skipSSLCheck; if ($nxs_skipSSLCheck===true) curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);

    $response = curl_exec($ci);  $out = array();

    /*
    $err = curl_errno($ci); if ($err==28){ sleep(10); $tm = true; $response = curl_exec($ci); } //   echo "##".$err; $errmsg = curl_error($ci); $out['errno'] = $err; $out['errmsg'] = $errmsg; prr($out);
    $err = curl_errno($ci); if ($err>0){ $errmsg = curl_error($ci); $out['errno'] = $err; $out['errmsg'] = $errmsg; curl_close($ci); return $out; }
    */
    //$err = curl_errno($ci); $errmsg = curl_error($ci); $header = curl_getinfo($ci);  $header['errno']   = $err;  $header['errmsg']  = $errmsg;  $header['content'] = $response;  prr($header); //die();

    $err = curl_errno($ci); if ($err>0){ $errmsg = curl_error($ci); $out['errno'] = $err; $out['errmsg'] = $errmsg.". Tumblr API is down. Please try later.";  $this->http_code = '404'; curl_close($ci); return json_encode($out); }

    $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
    $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
    $this->url = $url; //prr($this);
    curl_close ($ci); // prr($response);
    return $response;
  }

  /**
   * Get the header info to store.
   */
  function getHeader($ch, $header) {
    $i = strpos($header, ':');
    if (!empty($i)) {
      $key = str_replace('-', '_', strtolower(substr($header, 0, $i)));
      $value = trim(substr($header, $i + 2));
      $this->http_header[$key] = $value;
    }
    return strlen($header);
  }
}


text:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "ntru.h"

#define NUM_ITER_KEYGEN 50
#define NUM_ITER_ENCDEC 10000

/*
 * The __MACH__ and __MINGW32__ code below is from
 * https://github.com/credentials/silvia/commit/e327067cf7feaf62ac0bde84d13ee47372c0094e
 */

#ifdef __MACH__

/*
 * Mac OS X does not have clock_gettime for some reason
 *
 * Use solution from here to fix it:
 * http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x
 */

#define CLOCK_REALTIME 0

#include <mach/clock.h>
#include <mach/mach.h>

void clock_gettime(uint32_t clock, struct timespec* the_time)
{
clock_serv_t cclock;
mach_timespec_t mts;

host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);

the_time->tv_sec = mts.tv_sec;
the_time->tv_nsec = mts.tv_nsec;
}

#endif /* __MACH__ */

#ifdef __MINGW32__

/*
 * MinGW does not have clock_gettime for some reason
 *
 * Use solution from here to fix it:
 * http://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows
 */

#include <stdarg.h>
#include <windef.h>
#include <winnt.h>
#include <winbase.h>

#define CLOCK_REALTIME 0

LARGE_INTEGER getFILETIMEoffset()
{
    SYSTEMTIME s;
    FILETIME f;
    LARGE_INTEGER t;

    s.wYear = 1970;
    s.wMonth = 1;
    s.wDay = 1;
    s.wHour = 0;
    s.wMinute = 0;
    s.wSecond = 0;
    s.wMilliseconds = 0;
    SystemTimeToFileTime(&s, &f);
    t.QuadPart = f.dwHighDateTime;
    t.QuadPart <<= 32;
    t.QuadPart |= f.dwLowDateTime;
    return (t);
}

void clock_gettime(uint32_t X, struct timespec *ts)
{
    LARGE_INTEGER t;
    FILETIME f;
    double nanoseconds;
    static LARGE_INTEGER offset;
    static double frequencyToNanoseconds;
    static uint32_t initialized = 0;
    static BOOL usePerformanceCounter = 0;

    if (!initialized) {
        LARGE_INTEGER performanceFrequency;
        initialized = 1;
        usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency);
        if (usePerformanceCounter) {
            QueryPerformanceCounter(&offset);
            frequencyToNanoseconds = (double)performanceFrequency.QuadPart / 1000000000.;
        } else {
            offset = getFILETIMEoffset();
            frequencyToNanoseconds = 0.010;
        }
    }
    if (usePerformanceCounter) QueryPerformanceCounter(&t);
    else {
        GetSystemTimeAsFileTime(&f);
        t.QuadPart = f.dwHighDateTime;
        t.QuadPart <<= 32;
        t.QuadPart |= f.dwLowDateTime;
    }

    t.QuadPart -= offset.QuadPart;
    nanoseconds = (double)t.QuadPart / frequencyToNanoseconds;
    t.QuadPart = nanoseconds;
    ts->tv_sec = t.QuadPart / 1000000000;
    ts->tv_nsec = t.QuadPart % 1000000000;
}

#endif /* __MINGW32__ */

int compare_double(const void *p1, const void *p2) {
    double t1 = *(double*)p1;
    double t2 = *(double*)p2;
    return t1<t2 ? -1 : (t1>t2 ? 1 : 0);
}

double median(double *samples, int num_samples) {
    if (num_samples == 0)
        return 0;
    if (num_samples == 1)
        return samples[0];
    qsort(samples, num_samples, sizeof(samples[0]), compare_double);
    if (num_samples%2 == 0)
        return (samples[num_samples/2-1]+samples[num_samples/2]) / 2;
    else
        return samples[num_samples/2];
}

void print_time(char *label, double *samples, int num_samples) {
    double time = median(samples, num_samples);
    double per_sec = 1000000.0 / time;
#ifdef WIN32
    printf("%s %dus=%d/sec   ", label, (uint32_t)time, (uint32_t)per_sec);
#else
    printf("%s %dμs=%d/sec   ", label, (uint32_t)time, (uint32_t)per_sec);
#endif
    fflush(stdout);
}

int main(int argc, char **argv) {
    printf("Please wait...\n");

    NtruEncParams param_arr[] = ALL_PARAM_SETS;
    uint8_t success = 1;

    uint8_t param_idx;
    for (param_idx=0; param_idx<sizeof(param_arr)/sizeof(param_arr[0]); param_idx++) {
        NtruEncParams params = param_arr[param_idx];
        NtruEncKeyPair kp;
        uint32_t i;
        struct timespec t1, t2;
        printf("%-10s   ", params.name);
        fflush(stdout);

        double samples_keygen[NUM_ITER_KEYGEN];
        NtruRandGen rng = NTRU_RNG_DEFAULT;
        NtruRandContext rand_ctx;
        success &= ntru_rand_init(&rand_ctx, &rng) == NTRU_SUCCESS;
        for (i=0; i<NUM_ITER_KEYGEN; i++) {
            clock_gettime(CLOCK_REALTIME, &t1);
            success &= ntru_gen_key_pair(&params, &kp, &rand_ctx) == NTRU_SUCCESS;
            clock_gettime(CLOCK_REALTIME, &t2);
            double duration = 1000000000.0*(t2.tv_sec-t1.tv_sec) + t2.tv_nsec-t1.tv_nsec;   /* nanoseconds */
            samples_keygen[i] = duration / 1000.0;   /* microseconds */
        }
        print_time("keygen", samples_keygen, NUM_ITER_KEYGEN);

        double samples_encdec[NUM_ITER_ENCDEC];
        uint16_t max_len = ntru_max_msg_len(&params);   /* max message length for this param set */
        uint8_t plain[max_len];
        success &= ntru_rand_generate(plain, max_len, &rand_ctx) == NTRU_SUCCESS;
        uint16_t enc_len = ntru_enc_len(&params);
        uint8_t encrypted[enc_len];
        uint8_t decrypted[max_len];
        for (i=0; i<NUM_ITER_ENCDEC; i++) {
            clock_gettime(CLOCK_REALTIME, &t1);
            success &= ntru_encrypt((uint8_t*)&plain, max_len, &kp.pub, &params, &rand_ctx, (uint8_t*)&encrypted) == NTRU_SUCCESS;
            clock_gettime(CLOCK_REALTIME, &t2);
            double duration = 1000000000.0*(t2.tv_sec-t1.tv_sec) + t2.tv_nsec-t1.tv_nsec;   /* nanoseconds */
            samples_encdec[i] = duration / 1000.0;   /* microseconds */
        }
        print_time("enc", samples_encdec, NUM_ITER_ENCDEC);
        success &= ntru_rand_release(&rand_ctx) == NTRU_SUCCESS;

        uint16_t dec_len;
        for (i=0; i<NUM_ITER_ENCDEC; i++) {
            clock_gettime(CLOCK_REALTIME, &t1);
            success &= ntru_decrypt((uint8_t*)&encrypted, &kp, &params, (uint8_t*)&decrypted, &dec_len) == NTRU_SUCCESS;
            clock_gettime(CLOCK_REALTIME, &t2);
            double duration = 1000000000.0*(t2.tv_sec-t1.tv_sec) + t2.tv_nsec-t1.tv_nsec;   /* nanoseconds */
            samples_encdec[i] = duration / 1000.0;   /* microseconds */
        }
        print_time("dec", samples_encdec, NUM_ITER_ENCDEC);
        printf("\n");
    }

    if (!success)
        printf("Error!\n");
    return success ? 0 : 1;
}


text:
package rs.etf.stud.botfights.javaprocrunner;

import javax.tools.JavaCompiler;
import javax.tools.Tool;
import javax.tools.ToolProvider;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class PlayerProxy {
    class PlayerThread extends Thread {
        @Override
        public void run() {
            try {
                while (!interrupted()) {
                    playerMethod.invoke(null, paramsQueue.take());
                }
            } catch (InterruptedException ex) {
                //nothing
            } catch (IllegalAccessException | InvocationTargetException e) {
                e.printStackTrace();
            }
        }
        String getPlayerId() {
            return id;
        }
    }

    private String id;
    private String algPathName;
    private BlockingQueue<Object[]> paramsQueue;
    private AtomicInteger callCount = new AtomicInteger(0);

    private PlayerThread playerThread;

    private Method playerMethod;
    public PlayerProxy(String id, String algPathName) {
        this.id = id;
        this.algPathName = algPathName;
        paramsQueue = new ArrayBlockingQueue<Object[]>(20);
        playerThread = new PlayerThread();
    }
    public String getId() {
        return id;
    }

    public static String getCurrentPlayerId() {
        return ((PlayerThread) Thread.currentThread()).getPlayerId();
    }

    public void start() {
        playerThread.start();
    }

    public void stop() {
        playerThread.interrupt();
    }

    public void queryCall(Object[] params) {
        try {
            paramsQueue.put(params);
            callCount.incrementAndGet();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void loadAlgorithm(Tool javac) throws Exception {
        Path alg = Paths.get(algPathName);
        if (!Files.exists(alg)) throw new FileNotFoundException("File:" + alg.toAbsolutePath().toString());

        Path outputDirectory = createOutputDirectory();
        try {
            final List<String> classNames = compile(javac, outputDirectory, alg);
            if(classNames.isEmpty()){
                throw new Exception("No .class file found!");
            }
            playerMethod = load(outputDirectory, classNames);
        } finally {
            deleteDirectory(outputDirectory);
        }
    }

    private void deleteDirectory(Path outputDirectory) throws Exception {
        try (Stream<Path> s = Files.walk(outputDirectory, FileVisitOption.FOLLOW_LINKS);) {
            s.sorted(Comparator.reverseOrder())
                    .map(Path::toFile)
                    .forEach(File::delete);
        }
    }

    private Path createOutputDirectory() throws IOException {
        return Files.createTempDirectory(getClass().getCanonicalName());
    }

    private Method load(Path binDir, List<String> classNames) throws Exception {
        URLClassLoader classLoader = URLClassLoader.newInstance(new URL[]{binDir.toUri().toURL()});
        for(String className: classNames){
            Class<?> clazz = Class.forName(className, true, classLoader);
            if(!Modifier.isPublic(clazz.getModifiers()))continue;
            return Arrays.stream(clazz.getMethods())
                    .filter(method -> Modifier.isPublic(method.getModifiers()))
                    .filter(method -> Modifier.isStatic(method.getModifiers()))
                    .findFirst()
                    .orElseThrow(() -> new Exception(className + " has no public static methods!"));
        }
        throw new Exception("No public classes!");
    }

    private List<String> compile(Tool compiler, Path outputDir, Path source) throws Exception {
        compiler.run(System.in, ((PlayerInterceptor) System.out).getOrg(), System.err, "-d", outputDir.toAbsolutePath().toString(), source.toAbsolutePath().toString());
        try (Stream<Path> stream = Files.walk(outputDir)) {
            return stream.filter(Files::isRegularFile)
                    .filter(s -> s.toString().contains(".class"))
                    .map(val -> outputDir.relativize(val).toString().replaceAll("[\\\\/]", ".").replaceAll(".class", ""))
                    .collect(Collectors.toList());
        }
    }
}


text:
package org.kaazing.k3po.driver.internal.netty.bootstrap.udp;

import org.jboss.netty.channel.ChannelConfig;
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelSink;
import org.jboss.netty.channel.ServerChannel;
import org.kaazing.k3po.driver.internal.netty.bootstrap.channel.AbstractChannel;
import org.kaazing.k3po.driver.internal.netty.channel.ChannelAddress;

/*
 * A single NioDatagramChannel is divided into multiple UdpChildChannel based on the
 * remote address
 *
 * Pipeline for UdpChildChannel :
 * IdleStateHandler (optional), UdpIdleHandler (optional), script pipeline
 */
class UdpChildChannel extends AbstractChannel<ChannelConfig> {

    UdpChildChannel(ServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline,
            ChannelSink sink, ChannelConfig config) {
        super(parent, factory, pipeline, sink, config);
    }

    @Override
    protected void setBound() {
        super.setBound();
    }

    @Override
    protected void setConnected() {
        super.setConnected();
    }

    @Override
    protected void setLocalAddress(ChannelAddress localAddress) {
        super.setLocalAddress(localAddress);
    }

    @Override
    protected void setRemoteAddress(ChannelAddress remoteAddress) {
        super.setRemoteAddress(remoteAddress);
    }

    @Override
    protected boolean setClosed()
    {
        return super.setClosed();
    }
}


text:
#ifndef INFORMATION_SCHEMA_CPP_TIME_ZONE_TRANSITION_TYPE_H
#define INFORMATION_SCHEMA_CPP_TIME_ZONE_TRANSITION_TYPE_H

#include<string>

namespace dbcrudgen {
    namespace db {
        namespace mysql {
            class TimeZoneTransitionType {

            private:
                int timeZoneId;
                int transitionTypeId;
                int offset;
                int isDst;
                std::string abbreviation;

            public:

                static constexpr const char *TABLE_NAME = "time_zone_transition_type";

                struct COLUMNS {
                    struct TIME_ZONE_ID {
                        static constexpr const char *NAME = "Time_zone_id";
                        static const int INDEX = 1;
                    };
                    struct TRANSITION_TYPE_ID {
                        static constexpr const char *NAME = "Transition_type_id";
                        static const int INDEX = 2;
                    };
                    struct OFFSET {
                        static constexpr const char *NAME = "Offset";
                        static const int INDEX = 3;
                    };
                    struct IS_DST {
                        static constexpr const char *NAME = "Is_DST";
                        static const int INDEX = 4;
                    };
                    struct ABBREVIATION {
                        static constexpr const char *NAME = "Abbreviation";
                        static const int INDEX = 5;
                    };
                };

                TimeZoneTransitionType(int timeZoneId, int transitionTypeId, int offset, int isDst,
                                       std::string &abbreviation)
                        : timeZoneId{timeZoneId},
                          transitionTypeId{transitionTypeId}, offset{offset},
                          isDst{isDst}, abbreviation{abbreviation} {}

                // Get the value of timeZoneId
                int getTimeZoneId() const {
                    return timeZoneId;
                }

                // Get the value of transitionTypeId
                int getTransitionTypeId() const {
                    return transitionTypeId;
                }

                // Get the value of offset
                int getOffset() const {
                    return offset;
                }

                // Get the value of isDst
                int getIsDst() const {
                    return isDst;
                }

                // Get the value of abbreviation
                const std::string &getAbbreviation() const {
                    return abbreviation;
                }

                /**
                * Returns the table name 'time_zone_transition_type';
                */
                static const char *getDatabaseTableName() {
                    return TABLE_NAME;
                }
            };
        }
    }

}
#endif //INFORMATION_SCHEMA_CPP_TIME_ZONE_TRANSITION_TYPE_H


text:
<?php

namespace Sonata\Cache\Invalidation;

interface InvalidationInterface
{
    /**
     * @param  array $caches
     * @param  array $array
     *
     * @return void
     */
    public function invalidate(array $caches, array $array);
}


text:
require('../../modules/es.array.iterator');
require('../../modules/es.object.to-string');
require('../../modules/es.promise');
require('../../modules/es.string.iterator');
require('../../modules/esnext.iterator.constructor');
// TODO: Remove from `core-js@4`
require('../../modules/esnext.iterator.as-indexed-pairs');
require('../../modules/esnext.iterator.drop');
require('../../modules/esnext.iterator.every');
require('../../modules/esnext.iterator.filter');
require('../../modules/esnext.iterator.find');
require('../../modules/esnext.iterator.flat-map');
require('../../modules/esnext.iterator.for-each');
require('../../modules/esnext.iterator.from');
require('../../modules/esnext.iterator.indexed');
require('../../modules/esnext.iterator.map');
require('../../modules/esnext.iterator.reduce');
require('../../modules/esnext.iterator.some');
require('../../modules/esnext.iterator.take');
require('../../modules/esnext.iterator.to-array');
require('../../modules/esnext.iterator.to-async');
require('../../modules/web.dom-collections.iterator');

var path = require('../../internals/path');

module.exports = path.Iterator;


text:
class PlayerTurnValidator < ActiveModel::Validator
  def validate(play_card)
    unless this_players_turn?(play_card.round, play_card.player)
      play_card.errors.add(:base, "it's not your turn to play")
    end
  end

  private

  def this_players_turn?(round, player)
    if cards_played_in_current_trick?(round)
      players_turn_based_on_cards_played?(round, player)
    elsif first_trick?(round)
      player_won_bidding_this_round?(round, player)
    else
      player_won_previous_trick?(round, player)
    end
  end

  def cards_played_in_current_trick?(round)
    round.current_trick.cards.present?
  end

  def first_trick?(round)
    round.current_trick.order_in_round.zero?
  end

  def player_won_bidding_this_round?(round, player)
    player == round.highest_bid.player
  end

  def player_won_previous_trick?(round, player)
    player == round.previous_trick.winning_player
  end

  def players_turn_based_on_cards_played?(round, player)
    players = round.game.players
    previous_player = round.current_trick.cards.last_played.player

    player == next_player_in_order(previous_player, players)
  end

  def next_player_in_order(previous_player, players)
    players.detect do |player|
      player.order_in_game == (previous_player.order_in_game + 1) % players.size
    end
  end
end


text:
'use strict';

angular.module('CircleBlvd.directives').
directive('cbStoryPulser', ['$timeout', function ($timeout) {

    var ensureSelector = function (selector) {
        if (!selector) {
            selector = "data-story-id";
        }
        return selector;
    };

    var pulse = function (story, selector) {
        var selector = ensureSelector(selector);

        var pulseClass = "pulse";
        if (story.isDeadline || story.isNextMeeting) {
            pulseClass = "pulse-milepost";
        }
        var qStory = $("[" + selector + "='" + story.id + "']");
        qStory = qStory.find('.story');

        if (qStory.hasClass(pulseClass)) {
            return;
        }

        // Use CSS to flash a different colored background
        // for a moment then fade to whatever we were.
        qStory.addClass(pulseClass);
        $timeout(function () {
            qStory.addClass('color-transition');
        }, 10);

        $timeout(function () {
            qStory.removeClass(pulseClass);
            $timeout(function () {
                qStory.removeClass('color-transition');
            }, 500);
        }, 25);
    };

    var scrollToAndPulse = function (story, selector, onlyDirection) {
        var qStory = $("[" + selector + "='" + story.id + "']");
        qStory = qStory.find('.story');
        if (!qStory) {
            return;
        }

        var shouldScroll = true;
        if (onlyDirection === "up") {
            var bodyScrollTop = $('body').prop('scrollTop');
            if (bodyScrollTop < qStory.offset().top) {
                shouldScroll = false;
            }
        }

        if (shouldScroll) {
            var delay = 500;
            // Give the story time to close before
            // starting the scroll animation.
            $timeout(function () {
                $('body').animate({
                    // scrollTopWhenSelected
                    scrollTop: qStory.offset().top - 20
                }, delay);

                $timeout(function () {
                    pulse(story);
                }, delay + 75);
            }, 100);
        }
        else {
            pulse(story);
        }
    };

    return {
        link: function (scope, element, attr) {

            scope.$on('pulseStory', function (e, story) {
                pulse(story);
            });

            scope.$on('scrollToAndPulseStory', function (e, story, selector, onlyDirection) {
                selector = ensureSelector(selector);
                scrollToAndPulse(story, selector, onlyDirection);
            });
        }
    }
}]);


text:
# Fork-able normalize-scss<br> for libSass or Ruby Sass

## Using with node-sass

1. Copy these files to your Sass project.
2. This fork-able version requires the [support-for](https://github.com/JohnAlbin/support-for) Sass module. Add it to your package.json with:

 ```bash
npm install --save-dev support-for
```

3. Add support-for's `sass` directory to your nodeSass' [`includePaths` option](https://github.com/sass/node-sass#includepaths).

 ```js
var sass = require('node-sass'),
  path = require('path');

sass.render({
  file: scss_filename,
  includePaths: [
    path.join(__dirname, 'node_modules/support-for/sass')
  ]
}, function(err, result) { /*...*/ });
```

## Using with libSass

If you are not using node-sass with libSass, you probably already know how to include 3rd party libraries into your Sass project.

1. Copy these files to your Sass project.
2. This fork-able version requires the [support-for](https://github.com/JohnAlbin/support-for) Sass module. Add support-for's `sass` directory to your libSass include paths in the "usual way".

## Using with Ruby Sass

In addition to copying these files to your Sass project, you'll also need to:

1. Edit your `Gemfile` file to add:

 ```ruby
gem 'support-for', '~> 1.0'
```

2. If you use Compass, edit your `config.rb` file to add:

 ```ruby
require 'support-for'
```

3. Update your local Gems with:

 ```
bundle install
```


text:
<?php

namespace Quartet\Haydn\IO\ColumnMapper;

use Quartet\Haydn\IO\ColumnMapperInterface;

class ChainMapper extends AbstractColumnMapper
{
    /**
     * @var ColumnMapperInterface
     */
    protected $a;

    /**
     * @var array
     */
    protected $aliasMap;

    /**
     * @param ColumnMapperInterface $a
     * @param $map
     *  'mappedTo1' => internalKey1,
     *  'mappedTo2' => internalKey2,
     *  'mappedTo3' => internalKey1, (supports multiple mapping to same internal key)
     */
    public function __construct(ColumnMapperInterface $a, $map)
    {
        $this->a = $a;
        $this->map = array_keys($map);
        $this->aliasMap = $map;
    }

    /**
     * {@inheritdoc}
     * @throws \InvalidArgumentException
     */
    public function resolve($name)
    {
        $name = array_key_exists($name, $this->aliasMap) ? $this->aliasMap[$name] : $name;

        return $this->a->resolve($name);
    }

    /**
     * {@inheritdoc}
     */
    public function makeMap($data)
    {
        $innerMap = $this->a->makeMap($data);

        return array_map(function($element) {
            return array_key_exists($element, $this->aliasMap) ?
                $this->aliasMap[$element] : $element;
        }, $innerMap);
    }
}


text:
const { existsSync } = require('fs')
const { ensureFileSync } = require('fs-extra')
const { green, grey } = require('chalk')

const { appDir, resolveDir } = require('../utils/app-paths')
const { log, warn } = require('../utils/logger')

const modes = require('../modes')
const generators = require('../generators')
const { mount } = require('../mount')

const getAssetsFiles = require('../utils/get-assets-files')
const getFilesOptions = require('../utils/get-files-options')
const parseArgv = require('../utils/parse-argv')
const mergeObjects = require('../utils/merge-objects')
const getProfileContent = require('../utils/get-profile-content')
const getFileSize = require('../utils/get-file-size')
const validateProfileObject = require('../utils/validate-profile-object')

function printBanner (assetsOf, params) {
  console.log(` Generating files with the following options:
 ==========================
 Quasar project folder..... ${green(appDir)}
 ${green(`Quality level............. ${params.quality}/12`)}
 Icon source file.......... ${green(params.icon)}
 Icon trimming............. ${params.skipTrim ? 'no' : green('yes')}
 Icon padding.............. ${green(`horizontal: ${params.padding[0]}; vertical: ${params.padding[1]}`)}
 Background source file.... ${params.background ? green(params.background) : 'none'}
 Assets of................. ${green(assetsOf)}
 Generator filter.......... ${params.filter ? green(params.filter) : 'none'}
 Svg color................. ${green(params.svgColor)}
 Png color................. ${green(params.pngColor)}
 Splashscreen color........ ${green(params.splashscreenColor)}
 Splashscreen icon ratio... ${green(params.splashscreenIconRatio)}%
 ==========================
`)
}

function parseAssets (assets, include) {
  let files = []
  let assetsOf = []

  if (include) {
    const embeddedModes = include.filter(
      mode => existsSync(resolveDir(modes[mode].folder))
    )

    embeddedModes.forEach(mode => {
      files = files.concat(
        getAssetsFiles(modes[mode].assets)
      )
    })

    assetsOf = assetsOf.concat(embeddedModes)
  }

  if (assets && assets.length > 0) {
    files = files.concat(getAssetsFiles(assets))
    assetsOf.push('profile')
  }

  return {
    files,
    assetsOf: assetsOf.join(' | ')
  }
}

function getUniqueFiles (files) {
  const filePaths = {}
  const uniqueFiles = []

  files.forEach(file => {
    if (filePaths[file.absoluteName] === void 0) {
      filePaths[file.absoluteName] = true
      uniqueFiles.push(file)
    }
  })

  return uniqueFiles
}

function generateFile (file, opts) {
  // ensure that the file (and its folder) exists
  ensureFileSync(file.absoluteName)

  return new Promise(resolve => {
    // use the appropriate generator to handle the file creation
    generators[file.generator](file, opts, () => {
      const size = `(${getFileSize(file.absoluteName)})`
      const type = (file.generator + ':').padEnd(13, ' ')

      log(`Generated ${type} ${green(file.relativeName)} ${grey(size)}`)
      resolve()
    })
  })
}

async function generateFromProfile (profile) {
  const params = profile.params
  const { assetsOf, files } = parseAssets(profile.assets, params.include)

  const fileOptions = await getFilesOptions(params)
  let uniqueFiles = getUniqueFiles(files)

  if (params.filter) {
    uniqueFiles = uniqueFiles.filter(
      file => file.generator === params.filter
    )
  }

  if (uniqueFiles.length === 0) {
    warn(`No assets to generate! No mode/include specified, filter too specific or the respective Quasar mode(s) are not installed`)
    return Promise.resolve(0)
  }

  printBanner(assetsOf, params)

  return Promise
    .all(uniqueFiles.map(file => generateFile(file, fileOptions)))
    .then(() => { mount(uniqueFiles) })
    .then(() => uniqueFiles.length)
}

module.exports = function generate (argv) {
  const profile = {
    params: {},
    assets: []
  }

  if (argv.profile) {
    parseArgv(argv, [ 'profile' ])

    const userProfile = getProfileContent(argv.profile)

    if (userProfile.params) {
      const { profile: _, ...params } = argv

      profile.params = mergeObjects(userProfile.params, params)
      parseArgv(profile.params, [ 'include' ])
    }
    if (userProfile.assets) {
      profile.assets = userProfile.assets
    }
  }
  else {
    parseArgv(argv, [ 'mode' ])

    const { mode, ...params } = argv

    profile.params = params
    profile.params.include = mode
  }

  profile.params = mergeObjects({}, profile.params)

  parseArgv(profile.params, [
    'quality', 'filter', 'padding',
    'icon', 'background',
    'splashscreenIconRatio',
    // order matters:
    'themeColor', 'pngColor', 'splashscreenColor', 'svgColor'
  ])

  // final thorough validation
  validateProfileObject(profile)

  return generateFromProfile(profile)
    .then(numberOfFiles => {
      console.log(`\n Task done - generated ${numberOfFiles} file(s)!\n`)
    })
}


text:
"""Defines various signal for the handling of rooms."""

from database import DBSignals
from rooms import Room
from runserver import socketio

__author__ = "Benjamin Schubert <ben.c.schubert@gmail.com>"

@DBSignals.deleted.connect_via(Room)
def disconnect_deleted_room(sender, object, *args, **kwargs):
    """
    Disconnect all users from the room that was just deleted.

    :param object: the room deleted
    :param args: additional arguments
    :param kwargs: additional keyword arguments
    """
    socketio.emit("delete", object.id, namespace="/rooms", room=object.id)
    socketio.close_room(object.id, namespace="/rooms")


text:
<?xml version="1.0" encoding="utf-8" ?>
<Weavers >
  <SampleTask3 MyProperty3="PropertyValue3"/>
</Weavers>


text:
(function($){
	var forbiden_inputs = ["password","file","button","reset","submit"];
	jQuery.fn.OwlInputScan = function(){
		var allowed_string = '';
		$(forbiden_inputs).each(function(key,value){
			allowed_string = allowed_string + '[type='+value+'],';
		});
		allowed_string = allowed_string.slice(0,allowed_string.length - 1);
		var allowed = $(this).find('input,select,textarea').not(allowed_string);
		return allowed;
	}

	jQuery.fn.OwlForm = function(options){

		options = $.extend({
			defColor:"white",
			hoverColor:"red"
		}, options);

		var formJson;
		function getFormData(formArray){

			arr = {},data = formArray.serializeArray();
			$(data).each(function(index) {
				arr[$(this)[0]['name']] = $(this)[0]['value'];
			});
			return JSON.stringify(arr);
		}

		function sendData(data,method,action){
			data = $.parseJSON(data);
			var dataEncoded = $.param( data, true );

			$.ajax({
				url: action,
				type: method,
				data: dataEncoded,
				async : false
			});
		}

		var Owl = function(){
			var forms = $(this);

			$(this).each(function(index){

				formJson = getFormData($(this).OwlInputScan());
				$(this).append('<input type="hidden" data-owlInitial=\''+formJson+'\' data-owlInput>').append('<input type="hidden" data-owlFinal data-owlInput>');
			});

			$(this).bind("change",function(){
				formJson = getFormData($(this).OwlInputScan());
				if($(this).children('[data-owlInitial]').attr('data-owlInitial') != $(this).children('[data-owlFinal]').attr('data-owlFinal') && $(this).children('[data-owlFinal]').attr('data-owlFinal') != formJson && $(this).children('[data-owlInitial]').attr('data-owlInitial') != formJson){
					$(this).attr('data-owlChanged','true');
					$(this).children('[data-owlFinal]').attr('data-owlFinal',formJson);
				}
			});

			$(window).on("beforeunload",function(){
				$(forms).each(function(index){
					if($(this).attr('data-owlChanged') == 'true' && $(this).attr('data-owlSubmited') != 'true'){
						var data = $(this).children('[data-owlFinal]').attr('data-owlFinal');
						var method = $(this).attr('method');
						var action = $(this).attr('action');
						if(action.indexOf(location.host) + 1){
							var hostlength = window.location.protocol.length + location.host.length + 2;
							action = action.slice(hostlength,action.length);
						}
						sendData(data,method,action);
					}
				});
			});

			$(this).submit(function(){
				$(this).attr('data-owlSubmited','true');
			});

		};
	    return this.each(Owl);
	};
})(jQuery);