text:
package edgegateway

// Copyright (c) Microsoft and contributors.  All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"context"
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/azure"
	"github.com/Azure/go-autorest/tracing"
	"net/http"
)

// TriggersClient is the client for the Triggers methods of the Edgegateway service.
type TriggersClient struct {
	BaseClient
}

// NewTriggersClient creates an instance of the TriggersClient client.
func NewTriggersClient(subscriptionID string) TriggersClient {
	return NewTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID)
}

// NewTriggersClientWithBaseURI creates an instance of the TriggersClient client.
func NewTriggersClientWithBaseURI(baseURI string, subscriptionID string) TriggersClient {
	return TriggersClient{NewWithBaseURI(baseURI, subscriptionID)}
}

// CreateOrUpdate creates or updates a trigger.
// Parameters:
// deviceName - creates or updates a trigger
// name - the trigger name.
// trigger - the trigger.
// resourceGroupName - the resource group name.
func (client TriggersClient) CreateOrUpdate(ctx context.Context, deviceName string, name string, trigger BasicTrigger, resourceGroupName string) (result TriggersCreateOrUpdateFuture, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.CreateOrUpdate")
		defer func() {
			sc := -1
			if result.Response() != nil {
				sc = result.Response().StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.CreateOrUpdatePreparer(ctx, deviceName, name, trigger, resourceGroupName)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "CreateOrUpdate", nil, "Failure preparing request")
		return
	}

	result, err = client.CreateOrUpdateSender(req)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "CreateOrUpdate", result.Response(), "Failure sending request")
		return
	}

	return
}

// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client TriggersClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, name string, trigger BasicTrigger, resourceGroupName string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"deviceName":        autorest.Encode("path", deviceName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-03-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsContentType("application/json; charset=utf-8"),
		autorest.AsPut(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}", pathParameters),
		autorest.WithJSON(trigger),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client TriggersClient) CreateOrUpdateSender(req *http.Request) (future TriggersCreateOrUpdateFuture, err error) {
	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
	var resp *http.Response
	resp, err = autorest.SendWithSender(client, req, sd...)
	if err != nil {
		return
	}
	future.Future, err = azure.NewFutureFromResponse(resp)
	return
}

// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client TriggersClient) CreateOrUpdateResponder(resp *http.Response) (result TriggerModel, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// Delete deletes the trigger on the gateway device.
// Parameters:
// deviceName - the device name.
// name - the trigger name.
// resourceGroupName - the resource group name.
func (client TriggersClient) Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result TriggersDeleteFuture, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Delete")
		defer func() {
			sc := -1
			if result.Response() != nil {
				sc = result.Response().StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.DeletePreparer(ctx, deviceName, name, resourceGroupName)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "Delete", nil, "Failure preparing request")
		return
	}

	result, err = client.DeleteSender(req)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "Delete", result.Response(), "Failure sending request")
		return
	}

	return
}

// DeletePreparer prepares the Delete request.
func (client TriggersClient) DeletePreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"deviceName":        autorest.Encode("path", deviceName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-03-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsDelete(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client TriggersClient) DeleteSender(req *http.Request) (future TriggersDeleteFuture, err error) {
	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
	var resp *http.Response
	resp, err = autorest.SendWithSender(client, req, sd...)
	if err != nil {
		return
	}
	future.Future, err = azure.NewFutureFromResponse(resp)
	return
}

// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client TriggersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
		autorest.ByClosing())
	result.Response = resp
	return
}

// Get get a specific trigger by name.
// Parameters:
// deviceName - the device name.
// name - the trigger name.
// resourceGroupName - the resource group name.
func (client TriggersClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result TriggerModel, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Get")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.GetPreparer(ctx, deviceName, name, resourceGroupName)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "Get", nil, "Failure preparing request")
		return
	}

	resp, err := client.GetSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "Get", resp, "Failure sending request")
		return
	}

	result, err = client.GetResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "Get", resp, "Failure responding to request")
	}

	return
}

// GetPreparer prepares the Get request.
func (client TriggersClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"deviceName":        autorest.Encode("path", deviceName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-03-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client TriggersClient) GetSender(req *http.Request) (*http.Response, error) {
	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
	return autorest.SendWithSender(client, req, sd...)
}

// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client TriggersClient) GetResponder(resp *http.Response) (result TriggerModel, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// ListByDataBoxEdgeDevice lists all the triggers configured in the device.
// Parameters:
// deviceName - the device name.
// resourceGroupName - the resource group name.
// expand - specify $filter='CustomContextTag eq <tag>' to filter on custom context tag property
func (client TriggersClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string, expand string) (result TriggerListPage, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByDataBoxEdgeDevice")
		defer func() {
			sc := -1
			if result.tl.Response.Response != nil {
				sc = result.tl.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	result.fn = client.listByDataBoxEdgeDeviceNextResults
	req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName, expand)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request")
		return
	}

	resp, err := client.ListByDataBoxEdgeDeviceSender(req)
	if err != nil {
		result.tl.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request")
		return
	}

	result.tl, err = client.ListByDataBoxEdgeDeviceResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request")
	}

	return
}

// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request.
func (client TriggersClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string, expand string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"deviceName":        autorest.Encode("path", deviceName),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	const APIVersion = "2019-03-01"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}
	if len(expand) > 0 {
		queryParameters["$expand"] = autorest.Encode("query", expand)
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the
// http.Response Body if it receives an error.
func (client TriggersClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) {
	sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client))
	return autorest.SendWithSender(client, req, sd...)
}

// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always
// closes the http.Response Body.
func (client TriggersClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result TriggerList, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any.
func (client TriggersClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults TriggerList) (result TriggerList, err error) {
	req, err := lastResults.triggerListPreparer(ctx)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request")
	}
	if req == nil {
		return
	}
	resp, err := client.ListByDataBoxEdgeDeviceSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request")
	}
	result, err = client.ListByDataBoxEdgeDeviceResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "edgegateway.TriggersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request")
	}
	return
}

// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required.
func (client TriggersClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string, expand string) (result TriggerListIterator, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByDataBoxEdgeDevice")
		defer func() {
			sc := -1
			if result.Response().Response.Response != nil {
				sc = result.page.Response().Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName, expand)
	return
}


text:
package com.test.demo.myapp.activity;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.test.demo.myapp.R;

public class MyCardsAdapter extends RecyclerView.Adapter<MyCardsAdapter.ViewHolder> {
    private ListObject[] mDataset;

    // Provide a reference to the views for each data item
    // Complex data items may need more than one view per item, and
    // you provide access to all the views for a data item in a view holder
    public static class ViewHolder extends RecyclerView.ViewHolder {
        // each data item is just a string in this case
        public View cardView;
        public ViewHolder(View v) {
            super(v);
            cardView = v;
        }
    }

    // Provide a suitable constructor (depends on the kind of dataset)
    public MyCardsAdapter(ListObject[] myDataset) {
        mDataset = myDataset;
    }

    // Create new views (invoked by the layout manager)
    @Override
    public MyCardsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                        int viewType) {
        // create a new view
        View v = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.my_card, parent, false);
        ViewHolder vh = new ViewHolder(v);
        return vh;
    }

    // Replace the contents of a view (invoked by the layout manager)
    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        // - get element from your dataset at this position
        // - replace the contents of the view with that element
//        holder.mTextView.setText(mDataset[position].getText());

    }

    // Return the size of your dataset (invoked by the layout manager)
    @Override
    public int getItemCount() {
        return mDataset.length;
    }
}

redpajama_set_name: RedPajamaGithub


text:
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}

object Test extends App {
  {
    class A { def foo = ??? }
    val c = cm.classSymbol(classOf[A])
    println(c)
    println(c.fullName)
    println(c.info)
  }
}


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

import java.io.Serializable;

/**
 *
 */
public class DescribeVpnConnectionsResult implements Serializable, Cloneable {

    /**
     *

     * Information about one or more VPN connections.
     *

     */
    private com.amazonaws.internal.SdkInternalList<VpnConnection> vpnConnections;

    /**
     *

     * Information about one or more VPN connections.
     *

     *
     * @return Information about one or more VPN connections.
     */

    public java.util.List<VpnConnection> getVpnConnections() {
        if (vpnConnections == null) {
            vpnConnections = new com.amazonaws.internal.SdkInternalList<VpnConnection>();
        }
        return vpnConnections;
    }

    /**
     *

     * Information about one or more VPN connections.
     *

     *
     * @param vpnConnections
     *        Information about one or more VPN connections.
     */

    public void setVpnConnections(
            java.util.Collection<VpnConnection> vpnConnections) {
        if (vpnConnections == null) {
            this.vpnConnections = null;
            return;
        }

        this.vpnConnections = new com.amazonaws.internal.SdkInternalList<VpnConnection>(
                vpnConnections);
    }

    /**
     *

     * Information about one or more VPN connections.
     *

     *

     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setVpnConnections(java.util.Collection)} or
     * {@link #withVpnConnections(java.util.Collection)} if you want to override
     * the existing values.
     *

     *
     * @param vpnConnections
     *        Information about one or more VPN connections.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public DescribeVpnConnectionsResult withVpnConnections(
            VpnConnection... vpnConnections) {
        if (this.vpnConnections == null) {
            setVpnConnections(new com.amazonaws.internal.SdkInternalList<VpnConnection>(
                    vpnConnections.length));
        }
        for (VpnConnection ele : vpnConnections) {
            this.vpnConnections.add(ele);
        }
        return this;
    }

    /**
     *

     * Information about one or more VPN connections.
     *

     *
     * @param vpnConnections
     *        Information about one or more VPN connections.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public DescribeVpnConnectionsResult withVpnConnections(
            java.util.Collection<VpnConnection> vpnConnections) {
        setVpnConnections(vpnConnections);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getVpnConnections() != null)
            sb.append("VpnConnections: " + getVpnConnections());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof DescribeVpnConnectionsResult == false)
            return false;
        DescribeVpnConnectionsResult other = (DescribeVpnConnectionsResult) obj;
        if (other.getVpnConnections() == null
                ^ this.getVpnConnections() == null)
            return false;
        if (other.getVpnConnections() != null
                && other.getVpnConnections().equals(this.getVpnConnections()) == false)
            return false;
        return true;
    }

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

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

    @Override
    public DescribeVpnConnectionsResult clone() {
        try {
            return (DescribeVpnConnectionsResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}


text:
Provides integration for DoctrineExtensions_ for your Symfony2 Project.

Features
========

This bundle allows to easily use DoctrineExtensions_ in your Symfony2
project by configuring it through a ``ListenerManager`` and the DIC.

DoctrineExtensions's features
-----------------------------

- **Tree** - this extension automates the tree handling process and adds some tree specific functions on repository. (**closure**, **nestedset** or **materialized path**)
- **Translatable** - gives you a very handy solution for translating records into diferent languages. Easy to setup, easier to use.
- **Sluggable** - urlizes your specified fields into single unique slug
- **Timestampable** - updates date fields on create, update and even property change.
- **Blameable** - updates string or assocation fields on create, update and even property change with a user name resp. reference.
- **Loggable** - helps tracking changes and history of objects, also supports version managment.
- **Sortable** - makes any document or entity sortable
- **Translator** - explicit way to handle translations
- **Softdeleteable** - allows to implicitly remove records
- **Uploadable** - provides file upload handling in entity fields
- **Reference Integrity** - provides reference integrity for MongoDB, supports 'nullify' and 'restrict'

All these extensions can be nested together. And most already use only
annotations without interface requirement to not to aggregate the
entity itself and has implemented proper caching for metadata.

See the official documentation_ for more details.

Installation
============

Add stof/doctrine-extensions-bundle to composer.json
-----------------------------

.. code-block:: json

    "require": {
        "php": ">=5.3.2",
        "symfony/symfony": "~2.1",
        "_comment": "your other packages",

        "stof/doctrine-extensions-bundle": "~1.1@dev",
    }

Add DoctrineExtensionsBundle to your application kernel
-------------------------------------------------------

.. code-block:: php

    // app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            // ...
        );
    }

Add the extensions to your mapping
----------------------------------

Some of the extensions uses their own entities to do their work. You need
to register their mapping in Doctrine when you want to use them.

.. code-block:: yaml

    # app/config/config.yml
    doctrine:
        orm:
            entity_managers:
                default:
                    mappings:
                        gedmo_translatable:
                            type: annotation
                            prefix: Gedmo\Translatable\Entity
                            dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
                            alias: GedmoTranslatable # this one is optional and will default to the name set for the mapping
                            is_bundle: false
                        gedmo_translator:
                            type: annotation
                            prefix: Gedmo\Translator\Entity
                            dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity"
                            alias: GedmoTranslator # this one is optional and will default to the name set for the mapping
                            is_bundle: false
                        gedmo_loggable:
                            type: annotation
                            prefix: Gedmo\Loggable\Entity
                            dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
                            alias: GedmoLoggable # this one is optional and will default to the name set for the mapping
                            is_bundle: false
                        gedmo_tree:
                            type: annotation
                            prefix: Gedmo\Tree\Entity
                            dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
                            alias: GedmoTree # this one is optional and will default to the name set for the mapping
                            is_bundle: false

.. note::

    If you are using the short syntax for the ORM configuration, the `mappings`
    key is directly under `orm:`

.. note::

    If you are using several entity managers, take care to register the entities
    for the right ones.

.. note::

    The mapping for MongoDB is similar. The ODM documents are in the `Document`
    subnamespace of each extension instead of `Entity`.

Enable the softdeleteable filter
--------------------------------

If you want to use the SoftDeleteable behavior, you have to enable the
doctrine filter.

.. code-block:: yaml

    # app/config/config.yml
    doctrine:
        orm:
            entity_managers:
                default:
                    filters:
                        softdeleteable:
                            class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
                            enabled: true

.. note::

    If you are using the short syntax for the ORM configuration, the `filters`
    key is directly under `orm:`

.. note::

    If you are using several entity managers, take care to register the filter
    for the right ones.

To disable the behaviour, e.g. for admin users who may see deleted items,
disable the filter. Here is an example:

.. code-block:: php

    $filters = $em->getFilters();
    $filters->disable('softdeleteable');

Using Uploadable extension
--------------------------

If you want to use the Uploadable extension, first read the documentation in DoctrineExtensions. Once everything is
ready, use the form component as usual. Then, after you verify the form is valid, do the following:

.. code-block:: php

    $document = new Document();
    $form = $this->createFormBuilder($document)
        ->add('name')
        ->add('myFile')
        ->getForm()
    ;

    if ($this->getRequest()->getMethod() === 'POST') {
        $form->bind($this->getRequest());

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            $em->persist($document);

            $uploadableManager = $this->get('stof_doctrine_extensions.uploadable.manager');

            // Here, "getMyFile" returns the "UploadedFile" instance that the form bound in your $myFile property
            $uploadableManager->markEntityToUpload($document, $document->getMyFile());

            $em->flush();

            $this->redirect($this->generateUrl(...));
        }
    }

    return array('form' => $form->createView());

And that's it. The Uploadable extension handles the rest of the stuff. Remember to read its documentation!

Configure the bundle
====================

You have to activate the extensions for each entity manager for which
you want to enable the extensions. The id is the id of the DBAL
connection when using the ORM behaviors. It is the id of the document
manager when using mongoDB.

This bundle needs a default locale used if the translation does not
exists in the asked language. If you don't provide it explicitly, it
will default to ``en``.

in YAML:

.. code-block:: yaml

    # app/config/config.yml
    stof_doctrine_extensions:
        default_locale: en_US

        # Only used if you activated the Uploadable extension
        uploadable:
            # Default file path: This is one of the three ways you can configure the path for the Uploadable extension
            default_file_path:       %kernel.root_dir%/../web/uploads

            # Mime type guesser class: Optional. By default, we provide an adapter for the one present in the HttpFoundation component of Symfony
            mime_type_guesser_class: Stof\DoctrineExtensionsBundle\Uploadable\MimeTypeGuesserAdapter

            # Default file info class implementing FileInfoInterface: Optional. By default we provide a class which is prepared to receive an UploadedFile instance.
            default_file_info_class: Stof\DoctrineExtensionsBundle\Uploadable\UploadedFileInfo
        orm:
            default: ~
        mongodb:
            default: ~

or in XML:

.. code-block:: xml

    <!-- app/config/config.xml -->
    <container xmlns:stof_doctrine_extensions="http://symfony.com/schema/dic/stof_doctrine_extensions">
        <stof_doctrine_extensions:config default-locale="en_US">
            <stof_doctrine_extensions:orm>
                <stof_doctrine_extensions:entity-manager id="default" />
            </stof_doctrine_extensions:orm>
            <stof_doctrine_extensions:mongodb>
                <stof_doctrine_extensions:document-manager id="default" />
            </stof_doctrine_extensions:mongodb>
        </stof_doctrine_extensions:config>
    </container>

Activate the extensions you want
================================

By default the bundle does not attach any listener.
For each of your entity manager, declare the extensions you want to enable:

.. code-block:: yaml

    # app/config/config.yml
    stof_doctrine_extensions:
        default_locale: en_US
        orm:
            default:
                tree: true
                timestampable: false # not needed: listeners are not enabled by default
            other:
                timestampable: true

or in XML:

.. code-block:: xml

    <!-- app/config/config.xml -->
    <container xmlns:doctrine_extensions="http://symfony.com/schema/dic/stof_doctrine_extensions">
        <stof_doctrine_extensions:config default-locale="en_US">
            <stof_doctrine_extensions:orm>
                <stof_doctrine_extensions:entity-manager
                    id="default"
                    tree="true"
                    timestampable="false"
                />
                <stof_doctrine_extensions:entity-manager
                    id="other"
                    timestampable="true"
                />
            </stof_doctrine_extensions:orm>
        </stof_doctrine_extensions:config>
    </container>

Same is available for MongoDB using ``document-manager`` in the XML
files instead of ``entity-manager``.

.. caution::

    If you configure the listeners of an entity manager in several
    config file the last one will be used. So you have to list all the
    listeners you want to detach.

Use the DoctrineExtensions library
==================================

All explanations about this library are available on the official documentation_.

Advanced use
============

Overriding the listeners
------------------------

You can change the listeners used by extending the Gedmo listeners (or
the listeners of the bundle for translations) and giving the class name
in the configuration.

in YAML:

.. code-block:: yaml

    # app/config/config.yml
    stof_doctrine_extensions:
        class:
            tree:           MyBundle\TreeListener
            timestampable:  MyBundle\TimestampableListener
            blameable:      ~
            sluggable:      ~
            translatable:   ~
            loggable:       ~
            softdeleteable: ~
            uploadable:     ~

or in XML:

.. code-block:: xml

    <!-- app/config/config.xml -->
    <container xmlns:doctrine_extensions="http://symfony.com/schema/dic/stof_doctrine_extensions">
        <stof_doctrine_extensions:config>
            <stof_doctrine_extensions:class
                tree="MyBundle\TreeListener"
                timestampable="MyBundle\TimestampableListener"
            />
        </stof_doctrine_extensions:config>
    </container>

.. _DoctrineExtensions: https://github.com/Atlantic18/DoctrineExtensions
.. _documentation:      https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/


text:
Styleguide

A tool to make creating and maintaining styleguides easy.

#####v2.0.6

To run: harp server --port 8000

For downloads, how to get started and detailed documentation please refer to the Styleguide Website

Thanks to

Node.js

Harp.js

Node Livereload

Node Watch

Known issues

1 - You should allow unregistered applications to run in order to use the Start.app file. You can do so in Settings > Security & Privacy

2 - The compiled offline version have a smaller issue on Chrome. Chrome have a security policy of not allowing communication with iframes under file:// protocol, so any interaction that needs such communication will be removed (basically the sidebar menu). This is only for the offline compiled version.

3 - If you are a Mac user and after running the Start.app you have this error:

npm ERR! Please try running this command again as root/Administrator.

You have probably installed Node with sudo or root permission. You will need to fix permissions to the .npm folder with the following command:

sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib/node_modules

After that, try running the Start.app again.

4 - If you have XCode installed but have not agreed with the License you will get this error:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

Open XCode and accept the license, then try running Start.app again.

5 - If you get a 404 - No data received error, you might have a port conflict, there are two ways you can change the port number (default to 9241):

Change the PORT variable inside styleguide/structure/_node-files/watch.js

Set an environment variable (PORT or STYLEGUIDE_PORT):

  If you are running the Styleguide manually, in the last step you might do:

  PORT=7000 node watch.js

  or

  STYLEGUIDE_PORT=7000 node watch.js

  The Start.app is self contained, and for security reasons it does not have access to external variables.
  If you want to change the port for the Start.app it is recommended to change the watch.js file.
  You can, if you want, add a variable to your .bashrc file and it will be available for the Start.app:

  touch ~/.bashrc
  echo 'export PORT=1234' >> ~/.bashrc

  or

  echo 'export STYLEGUIDE_PORT=1234' >> ~/.bashrc


text:
require 'rails_helper'

RSpec.describe User, type: :model do
  describe 'validations' do
    subject { build(:user) }
    it { should validate_presence_of(:nickname) }
    it { should validate_uniqueness_of(:nickname).case_insensitive }
  end

  describe '::find_or_create_with_identity' do
    let(:identity) { Identity.find_or_create_with_auth_hash!(auth_hash) }
    let(:user) { User.find_or_create_with_identity!(identity) }
    it 'creates user with identity' do
      expect(user.nickname).to eq(auth_hash.info.name)
      expect(user.image).to eq(auth_hash.info.image)
    end
  end

  describe '#avatar' do
    let(:user) { create(:user) }
    it 'returns image with size' do
      expect(user.avatar(24)).to eq("#{user.image}&s=24")
    end
  end

  describe '#rate_limit' do
    let(:user) { create(:user) }
    before do
      stub_request(:get, 'https://api.github.com/rate_limit').
        to_return(status: 200, headers: { 'X-RateLimit-Limit': 5000, 'X-RateLimit-Remaining': 4999 })
    end
    it 'returns rate_limit' do
      expect(user.rate_limit.remaining).to eq(4999)
      expect(user.rate_limit.limit).to eq(5000)
    end
  end

end


text:
module.exports = function(config){
  config.set({

    basePath : './',

    files : [
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-resource/angular-resource.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-loader/angular-loader.js',
      'app/app.js',
      'app/login/login.js',
      'app/login/login_test.js'
    ],

    // list of files to exclude
    exclude: [

    ],

    // test results reporter to use
    reporters: ['progress'],

    // web server PORT
    port: 9876,

    colors: true,

    autoWatch : true,

    preprocessors: {
       'app/tests/*.js': [ 'browserify' ] //Mention path as per your test js folder
    },

    frameworks: ['jasmine', 'browserify'],

    browsers : ['Chrome'],

    plugins : [
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine',
            'karma-junit-reporter',
            'karma-browserify'
            ],

    junitReporter : {
      outputFile: 'test_out/unit.xml',
      suite: 'unit'
    }

  });
};


text:
using System;
using System.Globalization;
using System.Linq;
using IgorSoft.PowerShellCloudProvider.Interface.Composition;
using IgorSoft.PowerShellCloudProvider.Interface.IO;
using IgorSoft.PowerShellCloudProvider.Tests.Fixtures;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace IgorSoft.PowerShellCloudProvider.Tests.Provider
{
    [TestClass]
    public class GetChildItemTests
    {
        private FileSystemFixture fileSystemFixture;

        private CompositionFixture compositionFixture;

        private MockingFixture mockingFixture;

        [TestInitialize]
        public void Initialize()
        {
            fileSystemFixture = new FileSystemFixture();
            compositionFixture = new CompositionFixture();
            mockingFixture = new MockingFixture();
        }

        [TestCleanup]
        public void Cleanup()
        {
            mockingFixture = null;
            compositionFixture = null;
            fileSystemFixture = null;
        }

        [TestMethod]
        public void GetChildItem_WherePathIsRoot_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\", rootDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\"
            );

            Assert.AreEqual(rootDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItems, result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }

        [TestMethod]
        public void GetChildItem_WherePathIsRootAndCredentialsAreSpecified_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName("@TestUser");
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\", rootDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var pipelineFixture = new PipelineFixture();
            pipelineFixture.SetVariable("credential", PipelineFixture.GetCredential("TestUser", "TestPassword"));
            var result = pipelineFixture.Invoke(
                FileSystemFixture.NewDriveCommandWithCredential,
                @"Get-ChildItem -Path Y:\"
            );

            Assert.AreEqual(rootDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItems, result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }

        [TestMethod]
        public void GetChildItem_WherePathIsRootAndFilterIsSpecified_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItemsWithFilter(rootName, @"\", "*File.ext", rootDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\ -Filter *File.ext"
            );

            Assert.AreEqual(rootDirectoryItems.Count(i => i.Name.EndsWith("File.ext", StringComparison.Ordinal)), result.Count, "Unexpected number of results");
            CollectionAssert.AllItemsAreInstancesOfType(result.Select(i => i.BaseObject).ToList(), typeof(FileInfoContract), "Results are not of type FileInfoContract");
            CollectionAssert.AreEqual(rootDirectoryItems.Where(i => i.Name.EndsWith("File.ext", StringComparison.Ordinal)).ToList(), result.Select(i => i.BaseObject).ToList(), "Mismatched result");
        }

        [TestMethod]
        public void GetChildItem_WherePathIsSubSubDirectoryAndFilterIsSpecified_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems = fileSystemFixture.SubDirectoryItems;
            var subSubDirectoryItems = fileSystemFixture.SubSubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItemsWithFilter(rootName, @"\SubDir\SubSubDir", "*File.ext", rootDirectoryItems, subDirectoryItems, subSubDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\SubDir\SubSubDir -Filter *File.ext"
            );

            Assert.AreEqual(subSubDirectoryItems.Count(i => i.Name.EndsWith("File.ext", StringComparison.Ordinal)), result.Count, "Unexpected number of results");
            CollectionAssert.AllItemsAreInstancesOfType(result.Select(i => i.BaseObject).ToList(), typeof(FileInfoContract), "Results are not of type FileInfoContract");
            CollectionAssert.AreEqual(subSubDirectoryItems.Where(i => i.Name.EndsWith("File.ext", StringComparison.Ordinal)).ToList(), result.Select(i => i.BaseObject).ToList(), "Mismatched result");
        }

        [TestMethod]
        public void GetChildItem_WherePathIsRootAndIncludeIsSpecified_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\", rootDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\ -Include *File.ext"
            );

            Assert.AreEqual(3, result.Count, "Unexpected number of results");
            CollectionAssert.AreEqual(rootDirectoryItems.Where(i => i.Name.EndsWith("File.ext", StringComparison.Ordinal)).ToList(), result.Select(r => r.BaseObject).ToList(), "Mismatched result");
        }

        [TestMethod]
        public void GetChildItem_WherePathIsRootAndExcludeIsSpecified_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems = fileSystemFixture.SubDirectoryItems;
            var subSubDirectoryItems = fileSystemFixture.SubSubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir\SubSubDir", rootDirectoryItems, subDirectoryItems, subSubDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\ -Exclude *File.ext"
            );

            Assert.AreEqual(2, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItems.Where(i => !i.Name.EndsWith("File.ext", StringComparison.Ordinal)).ToList(), result.Select(i => i.BaseObject).ToList(), "Mismatched result");
        }

        [TestMethod]
        public void GetChildItem_WherePathIsUnknownRoot_Throws()
        {
            var gatewayMock = new Mock<ICloudGateway>(MockBehavior.Strict);

            compositionFixture.ExportGateway(gatewayMock.Object);

            try {
                new PipelineFixture().Invoke(
                    FileSystemFixture.NewDriveCommand,
                    @"Get-ChildItem -Path Undefined:\"
                );

                throw new InvalidOperationException("Expected Exception was not thrown");
            } catch (AssertFailedException ex) {
                Assert.IsTrue(ex.Message.EndsWith(@"ObjectNotFound: (Undefined:String) [Get-ChildItem], DriveNotFoundException", StringComparison.Ordinal));
            }
        }

        [TestMethod]
        public void GetChildItem_WherePathIsSubDirectory_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems = fileSystemFixture.SubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir", rootDirectoryItems, subDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\SubDir"
            );

            Assert.AreEqual(subDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(subDirectoryItems, result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }

        [TestMethod]
        public void GetChildItem_WherePathIsSubSubDirectory_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems = fileSystemFixture.SubDirectoryItems;
            var subSubDirectoryItems = fileSystemFixture.SubSubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir\SubSubDir", rootDirectoryItems, subDirectoryItems, subSubDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\SubDir\SubSubDir"
            );

            Assert.AreEqual(subSubDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(subSubDirectoryItems, result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }

        [TestMethod]
        public void GetChildItemRecursive_WherePathIsRoot_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems = fileSystemFixture.SubDirectoryItems;
            var subSubDirectoryItems = fileSystemFixture.SubSubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir\SubSubDir", rootDirectoryItems, subDirectoryItems, subSubDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\ -Recurse"
            );

            Assert.AreEqual(rootDirectoryItems.Length + subDirectoryItems.Length + subSubDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItems.Union(subDirectoryItems).Union(subSubDirectoryItems).ToList(), result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }

        [TestMethod]
        public void GetChildItemRecursive_WherePathIsSubDirectory_CallsGatewayCorrectly()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems = fileSystemFixture.SubDirectoryItems;
            var subSubDirectoryItems = fileSystemFixture.SubSubDirectoryItems;

            var gatewayMock = mockingFixture.InitializeGetChildItems(rootName, @"\SubDir\SubSubDir", rootDirectoryItems, subDirectoryItems, subSubDirectoryItems);
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\SubDir -Recurse"
            );

            Assert.AreEqual(subDirectoryItems.Length + subSubDirectoryItems.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(subDirectoryItems.Union(subSubDirectoryItems).ToList(), result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
        [TestMethod]
        public void GetChildItem_WherePathIsRootAndForceIsSpecified_RefreshesResult()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var rootDirectoryItemsRefreshed = fileSystemFixture.RootDirectoryItems
                .Select(f => f is FileInfoContract
                    ? new FileInfoContract(f.Id.Value.Insert(f.Id.Value.IndexOf(".ext", StringComparison.Ordinal), "Refreshed"), f.Name.Insert(f.Name.IndexOf(".ext", StringComparison.Ordinal), "Refreshed"), f.Created, f.Updated, ((FileInfoContract)f).Size, ((FileInfoContract)f).Hash) as FileSystemInfoContract
                    : new DirectoryInfoContract(f.Id + "Refreshed", f.Name + "Refreshed", f.Created, f.Updated) as FileSystemInfoContract)
                .ToArray();

            var gatewayMock = new MockingFixture().InitializeGetChildItems(rootName, null);
            gatewayMock.SetupSequence(g => g.GetChildItem(rootName, new DirectoryId(@"\")))
                .Returns(rootDirectoryItems)
                .Returns(rootDirectoryItemsRefreshed)
                .Throws(new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, @"Redundant access to \")));
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\",
                @"Get-ChildItem -Path X:\ -Force"
            );

            Assert.AreEqual(rootDirectoryItemsRefreshed.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(rootDirectoryItemsRefreshed, result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
        [TestMethod]
        public void GetChildItem_WherePathIsSubDirectoryAndForceIsSpecified_RefreshesResult()
        {
            var rootName = FileSystemFixture.GetRootName();
            var rootDirectoryItems = fileSystemFixture.RootDirectoryItems;
            var subDirectoryItems = fileSystemFixture.SubDirectoryItems;
            var subDirectoryItemsRefreshed = fileSystemFixture.SubDirectoryItems
                .Select(f => f is FileInfoContract
                    ? new FileInfoContract(f.Id.Value.Insert(f.Id.Value.IndexOf(".ext", StringComparison.Ordinal), "Refreshed"), f.Name.Insert(f.Name.IndexOf(".ext", StringComparison.Ordinal), "Refreshed"), f.Created, f.Updated, ((FileInfoContract)f).Size, ((FileInfoContract)f).Hash) as FileSystemInfoContract
                    : new DirectoryInfoContract(f.Id + "Refreshed", f.Name + "Refreshed", f.Created, f.Updated) as FileSystemInfoContract)
                .ToArray();

            var gatewayMock = new MockingFixture().InitializeGetChildItems(rootName, string.Empty, rootDirectoryItems);
            gatewayMock.SetupSequence(g => g.GetChildItem(rootName, new DirectoryId(@"\SubDir")))
                .Returns(subDirectoryItems)
                .Returns(subDirectoryItemsRefreshed)
                .Throws(new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, @"Redundant access to \SubDir")));
            compositionFixture.ExportGateway(gatewayMock.Object);

            var result = new PipelineFixture().Invoke(
                FileSystemFixture.NewDriveCommand,
                @"Get-ChildItem -Path X:\SubDir",
                @"Get-ChildItem -Path X:\SubDir -Force"
            );

            Assert.AreEqual(subDirectoryItemsRefreshed.Length, result.Count, "Unexpected number of results");
            CollectionAssert.AreEquivalent(subDirectoryItemsRefreshed, result.Select(p => p.BaseObject).Cast<FileSystemInfoContract>().ToList());
        }
    }
}


text:
require_relative 'helper'

class TestCheersIntegration < Minitest::Unit::TestCase

  def test_zero_arguments_prints_help_message
    output = `./cheers`
    expected = <<EOS
I'd cheer for you, if only I knew who you were :(
Try again with `./cheers [Name] [MM/DD Birthday]
EOS
    assert_equal expected, output
  end

  def test_one_valid_argument_with_valid_name
    output = `./cheers Abby`
    expected = <<EOS
Give me an... A
Give me a... B
Give me a... B
Give me a... Y
Abby's just GRAND!

I would wish you a Happy Birthday, if I knew when that was!
EOS
    assert_equal expected, output
  end

  def test_one_valid_argument_with_hyphenated_name
    output = `./cheers Mary-Jane`
    expected = <<EOS
Give me an... M
Give me an... A
Give me an... R
Give me a... Y
Give me a... J
Give me an... A
Give me an... N
Give me an... E
Mary-Jane's just GRAND!

I would wish you a Happy Birthday, if I knew when that was!
EOS
    assert_equal expected, output
  end

  def test_one_valid_argument_with_spaced_name
    output = `./cheers "Mary Jane"`
    expected = <<EOS
Give me an... M
Give me an... A
Give me an... R
Give me a... Y
Give me a... J
Give me an... A
Give me an... N
Give me an... E
Mary Jane's just GRAND!

I would wish you a Happy Birthday, if I knew when that was!
EOS
    assert_equal expected, output
  end

  def test_one_valid_argument_no_name_valid_bday
    output = `./cheers 08/25`
    expected = <<EOS
I'd cheer for you, if only I knew who you were :(
Try again with `./cheers [Name] [MM/DD Birthday]
EOS
    assert_equal expected, output
  end

  def test_one_invalid_argument_invalid_name_numbers_no_bday
    output = `./cheers 1234`
    expected = <<EOS
I'd cheer for you, if only I knew who you were :(
Try again with `./cheers [Name] [MM/DD Birthday]
EOS
    assert_equal expected, output
  end

  def test_one_invalid_argument_invalid_name_spaces_no_bday
    output = `./cheers " "`
    expected = <<EOS
I'd cheer for you, if only I knew who you were :(
Try again with `./cheers [Name] [MM/DD Birthday]
EOS
    assert_equal expected, output
  end

  def test_one_invalid_argument_no_name_invalid_bday
    output = `./cheers 99/99`
    expected =<<EOS
I'd cheer for you, if only I knew who you were :(
Try again with `./cheers [Name] [MM/DD Birthday]
EOS
    assert_equal expected, output
  end

  def test_two_valid_arguments
    output = `./cheers Abby 08/25`
    expected = <<EOS
Give me an... A
Give me a... B
Give me a... B
Give me a... Y
Abby's just GRAND!

Awesome! Your birthday's in 125 days! Happy Birthday in advance!
EOS
    assert_equal expected, output
  end

  def test_two_arguments_with_valid_name_invalid_bday_bad_format
    output = `./cheers Abby 9825`
    expected = <<EOS
Give me an... A
Give me a... B
Give me a... B
Give me a... Y
Abby's just GRAND!

I would wish you a Happy Birthday, if I knew when that was!
EOS
    assert_equal expected, output
  end

  def test_two_arguments_with_valid_name_invalid_bday_date_range_month
    output = `./cheers Abby 25/25`
    expected = <<EOS
Give me an... A
Give me a... B
Give me a... B
Give me a... Y
Abby's just GRAND!

I would wish you a Happy Birthday, if I knew when that was!
EOS
    assert_equal expected, output
  end

  def test_two_arguments_with_valid_name_invalid_bday_date_range_day
    output = `./cheers Abby 08/45`
    expected = <<EOS
Give me an... A
Give me a... B
Give me a... B
Give me a... Y
Abby's just GRAND!

I would wish you a Happy Birthday, if I knew when that was!
EOS
    assert_equal expected, output
  end

  def test_two_arguments_with_valid_name_invalid_bday_too_many_numbers
    output = `./cheers Abby 08/25/10`
    expected = <<EOS
Give me an... A
Give me a... B
Give me a... B
Give me a... Y
Abby's just GRAND!

I would wish you a Happy Birthday, if I knew when that was!
EOS
    assert_equal expected, output
  end

  def test_two_arguments_with_invalid_name_valid_bday
    output = `./cheers 1234 08/25`
    expected = <<EOS
I'd cheer for you, if only I knew who you were :(
Try again with `./cheers [Name] [MM/DD Birthday]
EOS
    assert_equal expected, output
  end

  def test_two_arguments_with_invalid_name_invalid_bday
    output = `./cheers 1234 25/25`
    expected = <<EOS
I'd cheer for you, if only I knew who you were :(
Try again with `./cheers [Name] [MM/DD Birthday]
EOS
    assert_equal expected, output
  end

  # Scenarios discussed in class:
  # 0 args -> help message
  # 1 valid arg
  # 1 invalid arg
  # 2 args
  #   * valid + valid
  #   * valid + invalid
  #   * invalid + valid
  #   * invalid + invalid
  #
  # Valid Names:
  #    * Regular name
  #    * Name with hyphens
  # Invalid Names:
  #   * birthday instead of name
  #   * all non-word characters
  #   * "" (empty string)
  #   * "  " (whitespace)
  # Valid Months:
  #   * m/dd (8/25)
  #   * mm/dd (08/25)
  #   * birthdays that already happened this year
  #   * birthdays that haven't happened yet this year
  # Invalid Months:
  #   * dd/mm (25/08)
  #   * dd/mm/yy (08/25/2015)

end


text:
var Analytics = function(analyticsId, appName, appVersion) {
  this.analyticsId = analyticsId;
  this.appName = appName;
  this.appVersion = appVersion;
  this.analyticsUserId = Pebble.getAccountToken();
}

Analytics.prototype._trackGA = function(type, params) {
  var req = new XMLHttpRequest();
  var url = 'http://www.google-analytics.com/collect';
  var trackingParams = 'v=1'
  + '&tid=' + this.analyticsId
  + '&cid=' + this.analyticsUserId
  + '&t=' + type
  + '&an=' + this.appName
  + '&av=' + this.appVersion;

  for (parameterKey in params) {
    if (params.hasOwnProperty(parameterKey)) {
      trackingParams += '&'+ parameterKey +'='+ params[parameterKey];
    }
  }

  function reqListener () {
    // DO NOTHING!
  }

  req.open('POST', url, true);
  req.onload = reqListener;
  req.setRequestHeader('Content-length', trackingParams.length);
  req.send(trackingParams);
}

Analytics.prototype.trackScreen = function (screenName) {
  this._trackGA('appview', {'cd': screenName});
}

Analytics.prototype.trackEvent = function (category, action) {
  this._trackGA('event', {'ec': category, 'ea': action});
}

// If require() will work some day. This would be nessecary.
// module.exports.Analytics = Analytics;


text:
<?php

/**
 * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2012-12-12 at 13:17:14.
 */
class AmazonReportRequestTest extends PHPUnit_Framework_TestCase {

    /**
     * @var AmazonReportRequest
     */
    protected $object;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp() {
        resetLog();
        $this->object = new AmazonReportRequest('testStore', true, null, __DIR__.'/../../test-config.php');
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
    protected function tearDown() {

    }

    public function testSetReportType(){
        $this->assertFalse($this->object->setReportType(null)); //can't be nothing
        $this->assertFalse($this->object->setReportType(5)); //can't be an int
        $this->assertNull($this->object->setReportType('Type'));
        $o = $this->object->getOptions();
        $this->assertArrayHasKey('ReportType',$o);
        $this->assertEquals('Type',$o['ReportType']);
    }

    /**
    * @return array
    */
    public function timeProvider() {
        return array(
            array(null, null, false, false), //nothing given, so no change
            array(true, true, false, false), //not strings or numbers
            array('', '', false, false), //strings, but empty
            array('-1 min', null, true, false), //one set
            array(null, '-1 min', false, true), //other set
            array('-1 min', '-1 min', true, true), //both set
        );
    }

    /**
     * @dataProvider timeProvider
     */
    public function testSetTimeLimits($a, $b, $c, $d){
        $this->object->setTimeLimits($a,$b);
        $o = $this->object->getOptions();
        if ($c){
            $this->assertArrayHasKey('StartDate',$o);
            $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['StartDate']);
        } else {
            $this->assertArrayNotHasKey('StartDate',$o);
        }

        if ($d){
            $this->assertArrayHasKey('EndDate',$o);
            $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['EndDate']);
        } else {
            $this->assertArrayNotHasKey('EndDate',$o);
        }
    }

    public function testResetTimeLimit(){
        $this->object->setTimeLimits('-1 min','-1 min');
        $o = $this->object->getOptions();
        $this->assertArrayHasKey('StartDate',$o);
        $this->assertArrayHasKey('EndDate',$o);

        $this->object->resetTimeLimits();
        $check = $this->object->getOptions();
        $this->assertArrayNotHasKey('StartDate',$check);
        $this->assertArrayNotHasKey('EndDate',$check);
    }

    public function testSetShowSalesChannel(){
        $this->assertFalse($this->object->setShowSalesChannel(null)); //can't be nothing
        $this->assertFalse($this->object->setShowSalesChannel(5)); //can't be an int
        $this->assertFalse($this->object->setShowSalesChannel('banana')); //can't be a random word
        $this->assertNull($this->object->setShowSalesChannel(false));
        $this->assertNull($this->object->setShowSalesChannel(true));
        $this->assertNull($this->object->setShowSalesChannel('false'));
        $this->assertNull($this->object->setShowSalesChannel('true'));
        $o = $this->object->getOptions();
        $this->assertArrayHasKey('ReportOptions',$o);
        $this->assertEquals('ShowSalesChannel=true',$o['ReportOptions']);
    }

    public function testSetMarketplaces(){
        $this->assertFalse($this->object->setMarketplaces(null)); //can't be nothing
        $this->assertFalse($this->object->setMarketplaces(5)); //can't be an int

        $list = array('One','Two','Three');
        $this->assertNull($this->object->setMarketplaces($list));

        $o = $this->object->getOptions();
        $this->assertArrayHasKey('MarketplaceIdList.Id.1',$o);
        $this->assertEquals('One',$o['MarketplaceIdList.Id.1']);
        $this->assertArrayHasKey('MarketplaceIdList.Id.2',$o);
        $this->assertEquals('Two',$o['MarketplaceIdList.Id.2']);
        $this->assertArrayHasKey('MarketplaceIdList.Id.3',$o);
        $this->assertEquals('Three',$o['MarketplaceIdList.Id.3']);

        $this->assertNull($this->object->setMarketplaces('Four')); //will cause reset
        $o2 = $this->object->getOptions();
        $this->assertArrayHasKey('MarketplaceIdList.Id.1',$o2);
        $this->assertEquals('Four',$o2['MarketplaceIdList.Id.1']);
        $this->assertArrayNotHasKey('MarketplaceIdList.Id.2',$o2);
        $this->assertArrayNotHasKey('MarketplaceIdList.Id.3',$o2);

        $this->object->resetMarketplaces();
        $o3 = $this->object->getOptions();
        $this->assertArrayNotHasKey('MarketplaceIdList.Id.1',$o3);
    }

    public function testRequestReport(){
        resetLog();
        $this->object->setMock(true,'requestReport.xml');
        $this->assertFalse($this->object->requestReport());
        $this->object->setReportType('Type');

        $this->assertNull($this->object->requestReport());

        $o = $this->object->getOptions();
        $this->assertEquals('RequestReport',$o['Action']);

        $check = parseLog();
        $this->assertEquals('Single Mock File set: requestReport.xml',$check[1]);
        $this->assertEquals('Log Type must be set in order to request a report!',$check[2]);
        $this->assertEquals('Fetched Mock File: mock/requestReport.xml',$check[3]);

        return $this->object;
    }

    /**
     * @depends testRequestReport
     */
    public function testGetReportRequestId($o){
        $get = $o->getReportRequestId();
        $this->assertEquals('2291326454',$get);

        $this->assertFalse($this->object->getReportRequestId()); //not fetched yet for this object
    }

    /**
     * @depends testRequestReport
     */
    public function testGetReportType($o){
        $get = $o->getReportType();
        $this->assertEquals('_GET_MERCHANT_LISTINGS_DATA_',$get);

        $this->assertFalse($this->object->getReportType()); //not fetched yet for this object
    }

    /**
     * @depends testRequestReport
     */
    public function testGetStartDate($o){
        $get = $o->getStartDate();
        $this->assertEquals('2009-01-21T02:10:39+00:00',$get);

        $this->assertFalse($this->object->getStartDate()); //not fetched yet for this object
    }

    /**
     * @depends testRequestReport
     */
    public function testGetEndDate($o){
        $get = $o->getEndDate();
        $this->assertEquals('2009-02-13T02:10:39+00:00',$get);

        $this->assertFalse($this->object->getEndDate()); //not fetched yet for this object
    }

    /**
     * @depends testRequestReport
     */
    public function testGetIsScheduled($o){
        $get = $o->getIsScheduled();
        $this->assertEquals('false',$get);

        $this->assertFalse($this->object->getIsScheduled()); //not fetched yet for this object
    }

    /**
     * @depends testRequestReport
     */
    public function testGetSubmittedDate($o){
        $get = $o->getSubmittedDate();
        $this->assertEquals('2009-02-20T02:10:39+00:00',$get);

        $this->assertFalse($this->object->getSubmittedDate()); //not fetched yet for this object
    }

    /**
     * @depends testRequestReport
     */
    public function testGetStatus($o){
        $get = $o->getStatus();
        $this->assertEquals('_SUBMITTED_',$get);

        $this->assertFalse($this->object->getStatus()); //not fetched yet for this object
    }

    /**
     * @depends testRequestReport
     */
    public function testGetResponse($o){
        $x = array();
        $x['ReportRequestId'] = '2291326454';
        $x['ReportType'] = '_GET_MERCHANT_LISTINGS_DATA_';
        $x['StartDate'] = '2009-01-21T02:10:39+00:00';
        $x['EndDate'] = '2009-02-13T02:10:39+00:00';
        $x['Scheduled'] = 'false';
        $x['SubmittedDate'] = '2009-02-20T02:10:39+00:00';
        $x['ReportProcessingStatus'] = '_SUBMITTED_';

        $this->assertEquals($x,$o->getResponse());

        $this->assertFalse($this->object->getResponse()); //not fetched yet for this object
    }

}

require_once('helperFunctions.php');


text:
<?php

/**
 * Just monad
 *
 * @package bingo-functional
 * @author Lochemem Bruno Michael
 * @license Apache-2.0
 */

namespace Chemem\Bingo\Functional\Functors\Monads;

use Chemem\Bingo\Functional\Functors\Functor;
use Chemem\Bingo\Functional\Functors\ApplicativeFunctor;

class Just extends Maybe
{
  public const of = __CLASS__ . '::of';

  private $value;

  public function __construct($value)
  {
    $this->value = $value;
  }

  /**
   * {@inheritdoc}
   */
  public static function of($value): Monad
  {
    return new static($value);
  }

  /**
   * {@inheritdoc}
   */
  public function isJust(): bool
  {
    return true;
  }

  /**
   * {@inheritdoc}
   */
  public function isNothing(): bool
  {
    return false;
  }

  /**
   * {@inheritdoc}
   */
  public function getJust()
  {
    return $this->value;
  }

  /**
   * {@inheritdoc}
   */
  public function getNothing()
  {
  }

  /**
   * {@inheritdoc}
   */
  public function flatMap(callable $fn)
  {
    return $fn($this->getJust());
  }

  /**
   * {@inheritdoc}
   */
  public function getOrElse($default)
  {
    return $this->value;
  }

  /**
   * {@inheritdoc}
   */
  public function ap(ApplicativeFunctor $just): ApplicativeFunctor
  {
    return $this->bind(function ($action) use ($just) {
      return $just->map($action);
    });
  }

  /**
   * {@inheritdoc}
   */
  public function map(callable $fn): Functor
  {
    return new static($fn($this->getJust()));
  }

  /**
   * {@inheritdoc}
   */
  public function bind(callable $function): Monad
  {
    return $function($this->getJust());
  }

  /**
   * {@inheritdoc}
   */
  public function filter(callable $fn): Monad
  {
    return $fn($this->getJust()) ? $this : new Nothing();
  }

  /**
   * {@inheritdoc}
   */
  public function orElse(Maybe $maybe): Maybe
  {
    return $this;
  }
}


text:
package tensor

import (
	"fmt"
	"sync/atomic"

	"github.com/apache/arrow/go/arrow"
	"github.com/apache/arrow/go/arrow/array"
	"github.com/apache/arrow/go/arrow/internal/debug"
)

// Interface represents an n-dimensional array of numerical data.
type Interface interface {
	// Retain increases the reference count by 1.
	// Retain may be called simultaneously from multiple goroutines.
	Retain()

	// Release decreases the reference count by 1.
	// Release may be called simultaneously from multiple goroutines.
	// When the reference count goes to zero, the memory is freed.
	Release()

	// Len returns the number of elements in the tensor.
	Len() int

	// Shape returns the size - in each dimension - of the tensor.
	Shape() []int64

	// Strides returns the number of bytes to step in each dimension when traversing the tensor.
	Strides() []int64

	// NumDims returns the number of dimensions of the tensor.
	NumDims() int

	// DimName returns the name of the i-th dimension.
	DimName(i int) string

	// DimNames returns the names for all dimensions
	DimNames() []string

	DataType() arrow.DataType
	Data() *array.Data

	// IsMutable returns whether the underlying data buffer is mutable.
	IsMutable() bool
	IsContiguous() bool
	IsRowMajor() bool
	IsColMajor() bool
}

type tensorBase struct {
	refCount int64
	dtype    arrow.DataType
	bw       int64 // bytes width
	data     *array.Data
	shape    []int64
	strides  []int64
	names    []string
}

// Retain increases the reference count by 1.
// Retain may be called simultaneously from multiple goroutines.
func (tb *tensorBase) Retain() {
	atomic.AddInt64(&tb.refCount, 1)
}

// Release decreases the reference count by 1.
// Release may be called simultaneously from multiple goroutines.
// When the reference count goes to zero, the memory is freed.
func (tb *tensorBase) Release() {
	debug.Assert(atomic.LoadInt64(&tb.refCount) > 0, "too many releases")

	if atomic.AddInt64(&tb.refCount, -1) == 0 {
		tb.data.Release()
		tb.data = nil
	}
}

func (tb *tensorBase) Len() int {
	o := int64(1)
	for _, v := range tb.shape {
		o *= v
	}
	return int(o)
}

func (tb *tensorBase) Shape() []int64           { return tb.shape }
func (tb *tensorBase) Strides() []int64         { return tb.strides }
func (tb *tensorBase) NumDims() int             { return len(tb.shape) }
func (tb *tensorBase) DimName(i int) string     { return tb.names[i] }
func (tb *tensorBase) DataType() arrow.DataType { return tb.dtype }
func (tb *tensorBase) Data() *array.Data        { return tb.data }
func (tb *tensorBase) DimNames() []string       { return tb.names }

// IsMutable returns whether the underlying data buffer is mutable.
func (tb *tensorBase) IsMutable() bool { return false } // FIXME(sbinet): implement it at the array.Data level

func (tb *tensorBase) IsContiguous() bool {
	return tb.IsRowMajor() || tb.IsColMajor()
}

func (tb *tensorBase) IsRowMajor() bool {
	strides := rowMajorStrides(tb.dtype, tb.shape)
	return equalInt64s(strides, tb.strides)
}

func (tb *tensorBase) IsColMajor() bool {
	strides := colMajorStrides(tb.dtype, tb.shape)
	return equalInt64s(strides, tb.strides)
}

func (tb *tensorBase) offset(index []int64) int64 {
	var offset int64
	for i, v := range index {
		offset += v * tb.strides[i]
	}
	return offset / tb.bw
}

// New returns a new n-dim array from the provided backing data and the shape and strides.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
//
// New panics if the backing data is not a numerical type.
func New(data *array.Data, shape, strides []int64, names []string) Interface {
	dt := data.DataType()
	switch dt.ID() {
	case arrow.INT8:
		return NewInt8(data, shape, strides, names)
	case arrow.INT16:
		return NewInt16(data, shape, strides, names)
	case arrow.INT32:
		return NewInt32(data, shape, strides, names)
	case arrow.INT64:
		return NewInt64(data, shape, strides, names)
	case arrow.UINT8:
		return NewUint8(data, shape, strides, names)
	case arrow.UINT16:
		return NewUint16(data, shape, strides, names)
	case arrow.UINT32:
		return NewUint32(data, shape, strides, names)
	case arrow.UINT64:
		return NewUint64(data, shape, strides, names)
	case arrow.FLOAT32:
		return NewFloat32(data, shape, strides, names)
	case arrow.FLOAT64:
		return NewFloat64(data, shape, strides, names)
	default:
		panic(fmt.Errorf("arrow/tensor: invalid data type %s", dt.Name()))
	}
}

func newTensor(dtype arrow.DataType, data *array.Data, shape, strides []int64, names []string) *tensorBase {
	tb := tensorBase{
		refCount: 1,
		dtype:    dtype,
		bw:       int64(dtype.(arrow.FixedWidthDataType).BitWidth()) / 8,
		data:     data,
		shape:    shape,
		strides:  strides,
		names:    names,
	}
	tb.data.Retain()

	if len(tb.shape) > 0 && len(tb.strides) == 0 {
		tb.strides = rowMajorStrides(dtype, shape)
	}
	return &tb
}

func rowMajorStrides(dtype arrow.DataType, shape []int64) []int64 {
	dt := dtype.(arrow.FixedWidthDataType)
	rem := int64(dt.BitWidth() / 8)
	for _, v := range shape {
		rem *= v
	}

	if rem == 0 {
		strides := make([]int64, len(shape))
		rem := int64(dt.BitWidth() / 8)
		for i := range strides {
			strides[i] = rem
		}
		return strides
	}

	var strides []int64
	for _, v := range shape {
		rem /= v
		strides = append(strides, rem)
	}
	return strides
}

func colMajorStrides(dtype arrow.DataType, shape []int64) []int64 {
	dt := dtype.(arrow.FixedWidthDataType)
	total := int64(dt.BitWidth() / 8)
	for _, v := range shape {
		if v == 0 {
			strides := make([]int64, len(shape))
			for i := range strides {
				strides[i] = total
			}
			return strides
		}
	}

	var strides []int64
	for _, v := range shape {
		strides = append(strides, total)
		total *= v
	}
	return strides
}

func equalInt64s(a, b []int64) bool {
	if len(a) != len(b) {
		return false
	}
	for i := range a {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}


text:
package de.saumya.mojo.proxy;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import de.saumya.mojo.proxy.Controller.FileLocation.Type;
import de.saumya.mojo.ruby.GemScriptingContainer;

public class Controller {

    private static final String SHA1 = ".sha1";

    private static final String RUBYGEMS_URL = "https://rubygems.org/gems";

    private static final String RUBYGEMS_S3_URL = "http://s3.amazonaws.com/production.s3.rubygems.org/gems";

    public static final String[] PLATFORMS = { "-universal-java-1.5",
                                               "-universal-java-1.6",
                                               "-universal-java-1.7",
                                               "-universal-java-1.8",
                                               "-universal-java",
                                               "-universal-jruby-1.2",
                                               "-jruby",
                                               "-java",
                                               "-universal-ruby-1.8.7",
                                               "-universal-ruby-1.9.2",
                                               "-universal-ruby-1.9.3",
                                               "-universal-ruby",
                                               "" };

    static final Map<String, Set<String>> BROKEN_GEMS = new HashMap<String, Set<String>>();

    static {
         // activeresource-2.0.0 does not exist !!!
        Set<String> rails = new TreeSet<String>();
        rails.add("2.0.0");
        BROKEN_GEMS.put("rails", rails);

	// juby-openssl-0.7.6 can not open gem with jruby-1.6.8
        Set<String> openssl = new TreeSet<String>();
        openssl.add("0.7.6");
        BROKEN_GEMS.put("jruby-openssl", openssl);
    }

    private final File localStorage;

    private final GemScriptingContainer script = new GemScriptingContainer();

    public static class FileLocation {
        enum Type {
            XML_CONTENT,
            HTML_CONTENT,
            ASCII_FILE,
            XML_FILE,
            REDIRECT,
            NOT_FOUND ,
            ASCII_CONTENT,
            REDIRECT_TO_DIRECTORY,
            TEMP_UNAVAILABLE }

        public FileLocation() {
            this(null, null, null, Type.REDIRECT_TO_DIRECTORY);
        }

        public FileLocation(String message) {
            this(null, null, message, Type.NOT_FOUND);
        }

        public FileLocation(String content, Type type) {
            this(null, null, content, type);
        }

        public FileLocation(File local, Type type) {
            this(local, null, null, type);
        }

        public FileLocation(URL remote) {
            this(null, remote, null, Type.REDIRECT);
        }

        private FileLocation(File localFile, URL remoteFile, String content, Type type) {
            this.content = content;
            this.remoteUrl = remoteFile;
            this.localFile = localFile;
            this.type = type;
        }

        final File localFile;
        final URL remoteUrl;
        final String content;
        final Type type;
    }

     private final Object createPom;

     // assume there will be only one instance of this class per servlet container
     private final Set<String> fileLocks = new HashSet<String>();

     public Controller(File storage) throws IOException{
         this.localStorage = storage;
         this.localStorage.mkdirs();
         this.createPom = script.runScriptletFromClassloader("create_pom.rb");
     }

     public FileLocation locate(String path) throws IOException{
        // release/rubygems/name/version
        // release/rubygems/name/version/
        // release/rubygems/name/version/name-version.gem
        // release/rubygems/name/version/name-version.gem.md5
        // release/rubygems/name/version/name-version.pom
        // release/rubygems/name/version/name-version.pom.md5
        // release/rubygems/name
        // release/rubygems/name/
        // release/rubygems/name/maven-metadata.xml

        path = path.replaceAll("/+", "/");
        if(path.endsWith("/")){
            path += "index.html";
        }

        String[] parts = path.split("/");

        if(parts.length == 0){
            // TODO make listing with two directories 'releases', 'prereleases'
            return new FileLocation("for maven", Type.ASCII_CONTENT);
        }
        else {
            boolean prereleases = parts[0].contains("pre");
            if(parts.length > 1 && !"rubygems".equals(parts[1])){
                return notFound("Only rubygems/ groupId is supported through this proxy.");
            }
            switch(parts.length){
            case 1:
            case 2:
                // TODO make listing with one directory 'rubygems'
                return notFound("directory listing not implemented");
            case 3:
                if("index.html".equals(parts[2])) {
                    return notFound("directory listing not implemented");
                }
                else {
                    return new FileLocation();
                }
            case 4:
                if("maven-metadata.xml".equals(parts[3])){
                    return metadata(parts[2], prereleases);
                }
                else if(("maven-metadata.xml" + SHA1).equals(parts[3])){
                    return metadataSha1(parts[2], prereleases);
                }
                else if("index.html".equals(parts[3])){
                    return versionListDirectory(parts[2], path, prereleases);
                }
                else {
                    return notFound("not found");
                }
            case 5:
                String filename = parts[4].replace("-SNAPSHOT", "");
                if("index.html".equals(filename)){
                    return directory(parts[2], parts[3], path);
                }
                if(filename.endsWith(".gem")){
                    // keep it backward compatible
                    filename = filename.replace("-java.gem", ".gem");
                    File local = new File(localStorage, filename.replace(".gem", ".pom"));
                    if(!local.exists()){
                        try {
                            if (!createFiles(parts[2], parts[3])){
                                return new FileLocation(filename + " is being generated", Type.TEMP_UNAVAILABLE);
                            }
                        } catch (FileNotFoundException e) {
                            return notFound("not found");
                        }
                    }
                    String url = null;
		    for( String platform : PLATFORMS )
		    {
			url = RUBYGEMS_S3_URL + "/" + filename.replace(".gem", platform + ".gem");
			if ( exists( url ) ) {
			    break;
			}
                    }
                    return new FileLocation( new URL( url ) );
                }
                if(filename.endsWith(SHA1) || filename.endsWith(".pom")){
                    File local = new File(localStorage, filename);
                    if(!local.exists()){
                        try {
                            if (!createFiles(parts[2], parts[3])){
                                return new FileLocation(filename + " is being generated", Type.TEMP_UNAVAILABLE);
                            }
                        } catch (FileNotFoundException e) {
                            return notFound("not found");
                        }
                    }
                    return new FileLocation(local, filename.endsWith(SHA1)? Type.ASCII_FILE: Type.XML_FILE);
                }
                return notFound("not found");
            default:
                return notFound("Completely unhandleable request!");
        }
        }
    }

    public boolean exists(String url){
        try {
           HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
           con.setRequestMethod("HEAD");
           return con.getResponseCode() == HttpURLConnection.HTTP_OK;
        }
        catch (FileNotFoundException e) {
            //e.printStackTrace();
            return false;
        }
        catch (IOException e) {
            e.printStackTrace();
            return false;
        }
    }

    private FileLocation directory(String gemname, String version, String path) throws IOException {
        HtmlDirectoryBuilder builder = new HtmlDirectoryBuilder();

        builder.buildHeader(path);

        String basename = gemname + "-" + version;
        String pomfile = basename + ".pom";
        String gemfile = basename + ".gem";
        builder.buildFileLink(pomfile);
        builder.buildFileLink(pomfile + SHA1);
        builder.buildFileLink(gemfile);
        builder.buildFileLink(gemfile + SHA1);

        builder.buildFooter();

        return new FileLocation(builder.toHTML(), Type.HTML_CONTENT);
    }

    private boolean createFiles(String name, String version) throws IOException {
        String gemname = name + "-" + version.replace( "-SNAPSHOT", "" );
        try {
            synchronized (fileLocks) {
                if (fileLocks.contains(gemname)) {
                    return false;
                }
                else {
                    fileLocks.add(gemname);
                }
            }

            File gemfile = new File(this.localStorage, gemname + ".gem");
            File gemfileSha = new File(this.localStorage, gemname + ".gem" + SHA1);

            File pomfile = new File(this.localStorage, gemname + ".pom");
            File pomfileSha = new File(this.localStorage, gemname + ".pom" + SHA1);

            if (!(gemfileSha.exists() && pomfile.exists() && pomfileSha.exists())) {
		String url = null;
		for( String platform : PLATFORMS )
		{
		    url = RUBYGEMS_URL + "/" + gemname + platform + ".gem";
		    try {
			downloadGemfile(gemfile, new URL(url));
			break;
		    }
		    catch (FileNotFoundException ignore) {
		    }
		}

                String pom = createPom(gemfile);

                writeUTF8(pomfile, pom);
                writeUTF8(pomfileSha, sha1(pom));
            }

            // we do not keep the gemfile on disc
            gemfile.delete();
            return true;
        }
        finally {
            synchronized (fileLocks) {
                fileLocks.remove(gemname);
            }
        }
    }

    private String createPom(File gemfile) {
        // protect the script container
        synchronized (script) {
            return script.callMethod(createPom, "create", gemfile.getAbsolutePath(), String.class)
                         .replaceAll("&", "&").replaceAll("&amp;", "&");
        }
    }

    private void downloadGemfile(File gemfile, URL url) throws IOException {
        InputStream input = null;
        OutputStream output = null;
        MessageDigest sha = newSha1Digest();
        try {
            input = new BufferedInputStream(url.openStream());
            output = new BufferedOutputStream(new FileOutputStream(gemfile));

            int b = input.read();
            while(b != -1){
                output.write(b);
                sha.update((byte) b);
                b = input.read();
            }
        }
        finally {
            if( input != null){
                input.close();
            }
            if( output != null){
                output.close();
                writeSha(new File(gemfile.getAbsolutePath() + SHA1), sha);
            }
        }
    }

    private void writeSha(File file, MessageDigest sha) throws IOException {
        writeUTF8(file, toHex(sha.digest()));
    }

    private void writeUTF8(File file, String content) throws IOException {
        PrintWriter writer = null;
        try {
           writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file),
                                                           Charset.forName("UTF-8")));
           writer.print(content);
        }
        finally {
            if(writer != null){
                writer.close();
            }
        }
    }

    private FileLocation versionListDirectory(String name, String path, boolean prereleases) throws IOException {
        HtmlDirectoryBuilder html = new HtmlDirectoryBuilder();

        html.buildHeader(path);

        VersionDirectoryBuilder builder = new VersionDirectoryBuilder(name, prereleases, html, BROKEN_GEMS.get(name));
        builder.build();

        html.buildFileLink("maven-metadata.xml");
        html.buildFileLink("maven-metadata.xml" + SHA1);

        html.buildFooter();

        return new FileLocation(html.toHTML(), Type.HTML_CONTENT);
    }

    private FileLocation notFound(String message) {
        return new FileLocation(message);
    }

    private FileLocation metadata(String name, boolean prereleases) throws IOException {
        MavenMetadataBuilder builder = new MavenMetadataBuilder(name, prereleases, BROKEN_GEMS.get(name));
        builder.build();
        return new FileLocation(builder.toXML(), Type.XML_CONTENT);
    }

    private FileLocation metadataSha1(String name, boolean prereleases) throws IOException {
        MavenMetadataBuilder builder = new MavenMetadataBuilder(name, prereleases, BROKEN_GEMS.get(name));
        builder.build();
        return new FileLocation(sha1(builder.toXML()), Type.ASCII_CONTENT);
    }

    private String sha1(String text) {
        MessageDigest md = newSha1Digest();
        try {
            md.update(text.getBytes("UTF-8"));
        }
        catch (UnsupportedEncodingException e) {
            throw new RuntimeException("should not happen", e);
        }
        return toHex(md.digest());
    }

    private MessageDigest newSha1Digest() {
        MessageDigest md;
        try {
            md = MessageDigest.getInstance("SHA-1");
        }
        catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("error getting sha1 instance", e);
        }
        return md;
    }

    private String toHex(byte[] data) {
        StringBuilder buf = new StringBuilder();//data.length * 2);
        for (byte b: data) {
            if(b < 0){
                buf.append(Integer.toHexString(256 + b));
            }
            else if(b < 16) {
                buf.append('0').append(Integer.toHexString(b));
            }
            else {
                buf.append(Integer.toHexString(b));
            }
        }
        return buf.toString();
    }
}


text:
<?php

namespace Google\AdsApi\AdManager\v202205;

/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class DisapproveCreativeReviews extends \Google\AdsApi\AdManager\v202205\CreativeReviewAction
{

    public function __construct()
    {

    }

}


text:
Dish::Plate.class_eval do
  def as_hash
    warn "Dish::Plate#as_hash is deprecated. Please use `to_h` instead."
    to_h
  end
end