text:
NoGreenObstacleDetector::NoGreenObstacleDetector()
{
  DEBUG_REQUEST_REGISTER("Vision:NoGreenObstacleDetector:draw_detector_field", "", false);
  DEBUG_REQUEST_REGISTER("Vision:NoGreenObstacleDetector:draw_detector_behind_ball", "", false);
  DEBUG_REQUEST_REGISTER("Vision:NoGreenObstacleDetector:draw_ball_pos", "", false);
  getDebugParameterList().add(&params);
}

NoGreenObstacleDetector::~NoGreenObstacleDetector() {
  getDebugParameterList().remove(&params);
}

void NoGreenObstacleDetector::create_detector_on_field(DetectorField& detectorField,  double xOffset) {
  // create detector points on field
  // (x) x3 --- x4
  //       |   |
  // (0) x1 --- x2 (y)
  Vector2d x1(xOffset, -params.detector_width/2);
  Vector2d x2(xOffset,  params.detector_width/2);
  Vector2d x3(x1.x + params.detector_range, x1.y);
  Vector2d x4(x3.x, x2.y);
  detectorField = DetectorField(x1, x2, x3, x4);
}

bool NoGreenObstacleDetector::create_detector_behind_ball(DetectorField& detectorField) {
  if (getBallModel().valid && getBallModel().knows) {
    const Vector2d& ball_position = getBallModel().position;

    DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_ball_pos",
      FIELD_DRAWING_CONTEXT;
      PEN("FACEFF", 5);
      CIRCLE(ball_position.x, ball_position.y, 50);
    );

    Vector2d ball_direction(ball_position);
    ball_direction.normalize();

    Vector2d offset = ball_direction * params.ball_offset;

    Vector2d left(params.behind_ball_width/2, 0);
    left.rotate(ball_position.angle() - Math::pi_2);

    Vector2d x1 = (ball_position + offset) + left;
    Vector2d x2 = (ball_position + offset) - left;

    offset = offset + (ball_direction * params.behind_ball_range);

    Vector2d x3 = (ball_position + offset) + left;
    Vector2d x4 = (ball_position + offset) - left;

    detectorField.edges = {x1, x2, x3, x4};
    return true;
  }
  return false;
}

bool NoGreenObstacleDetector::projectDetector(DetectorField& detectorField, DetectorImage& detectorImage) {
  if(!detectorField.projectOnImage(detectorImage, getCameraMatrix(), getCameraInfo())) {
    return false;
  }

  int expectedArea = detectorImage.area();

  // limit detectorImage to be inside image bounds
  bool limitSuccess = detectorImage.limit((int) getCameraInfo().resolutionWidth-1, (int) getCameraInfo().resolutionHeight-1, 0, 0);
  if(!limitSuccess) {
    return false;
  }
  // check if detectorImage is still big enough
  int detectorArea = detectorImage.area();
  bool bigEnough = ((double) detectorArea / expectedArea >= params.min_expected_area);

  return bigEnough;
}

void NoGreenObstacleDetector::execute()
{
  getVisionObstacle().valid = false;
  getVisionObstaclePreview().valid = false;
  getObstacleBehindBall().valid = false;

  bool success = false;

  if(params.enable_obstacle_detector) {
    create_detector_on_field(detectorField, params.detector_field_offset);

    DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_field",
      FIELD_DRAWING_CONTEXT;
      PEN("FF69B4", 5);
      BOX(detectorField.minX(), detectorField.minY(), detectorField.maxX(), detectorField.maxY());
    );

    // project detector field onto image
    DetectorImage detectorImage;
    success = projectDetector(detectorField, detectorImage);
    DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_field",
      IMAGE_DRAWING_CONTEXT;
      if (success) {
        PEN("FF69B4", 5);
      } else {
        PEN("FF4D4D", 5);
      }
      BOX(detectorImage.minX(), detectorImage.minY(), detectorImage.maxX(), detectorImage.maxY());
    );
    if(success) {
      // calculate green density
      double green_density       = detectorImage.green_density(getBallDetectorIntegralImage());
      double green_density_left  = detectorImage.green_density_left(getBallDetectorIntegralImage());
      double green_density_right = detectorImage.green_density_right(getBallDetectorIntegralImage());

      DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_field",
        FIELD_DRAWING_CONTEXT;
        PEN("FF69B4", 5);

        TEXT_DRAWING(1000,    0, green_density       * 100 << '%');
        TEXT_DRAWING(1000, 1000, green_density_left  * 100 << '%');
        TEXT_DRAWING(1000,-1000, green_density_right * 100 << '%');
      );

      // set representation if detector is occupied
      getVisionObstacle().valid = true;
      getVisionObstacle().isOccupied = green_density <= params.max_green_density;
      if (getVisionObstacle().isOccupied) {
        getVisionObstacle().onTheRight = green_density_right <= green_density_left;
        getVisionObstacle().onTheLeft = green_density_right > green_density_left;
      } else {
        getVisionObstacle().onTheRight = false;
        getVisionObstacle().onTheLeft = false;
      }
    }
  }

  // preview
  if(params.enable_preview_obstacle_detector) {
    DetectorField previewDetectorField;
    detectorField.createPreview(previewDetectorField, getMotionStatus());

    DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_field",
      FIELD_DRAWING_CONTEXT;
      PEN("0080FF", 5);
      LINE(previewDetectorField.edges[0].x, previewDetectorField.edges[0].y, previewDetectorField.edges[1].x, previewDetectorField.edges[1].y);
      LINE(previewDetectorField.edges[1].x, previewDetectorField.edges[1].y, previewDetectorField.edges[3].x, previewDetectorField.edges[3].y);
      LINE(previewDetectorField.edges[2].x, previewDetectorField.edges[2].y, previewDetectorField.edges[3].x, previewDetectorField.edges[3].y);
      LINE(previewDetectorField.edges[0].x, previewDetectorField.edges[0].y, previewDetectorField.edges[2].x, previewDetectorField.edges[2].y);
    );

    DetectorImage previewDetectorImage;
    success = projectDetector(previewDetectorField, previewDetectorImage);
    DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_field",
      IMAGE_DRAWING_CONTEXT;
      if (success) {
        PEN("FF69B4", 5);
      } else {
        PEN("FF4D4D", 5);
      }
      BOX(previewDetectorImage.minX(), previewDetectorImage.minY(), previewDetectorImage.maxX(), previewDetectorImage.maxY());
    );
    if(success) {
      // calculate green density
      double green_density = previewDetectorImage.green_density(getBallDetectorIntegralImage());
      double green_density_left = previewDetectorImage.green_density_left(getBallDetectorIntegralImage());
      double green_density_right = previewDetectorImage.green_density_right(getBallDetectorIntegralImage());

      // set representation if detector is occupied
      getVisionObstaclePreview().valid = true;
      getVisionObstaclePreview().isOccupied = green_density <= params.max_green_density;
      if (getVisionObstaclePreview().isOccupied) {
        getVisionObstaclePreview().onTheRight = green_density_right <= green_density_left;
        getVisionObstaclePreview().onTheLeft = green_density_right > green_density_left;
      } else {
        getVisionObstaclePreview().onTheRight = false;
        getVisionObstaclePreview().onTheLeft = false;
      }
    }
  }

  if(params.enable_obstacle_detector_behind_ball) {
    DetectorField detectorBehindBall;
    success = create_detector_behind_ball(detectorBehindBall);
    if(success) {
      DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_behind_ball",
        FIELD_DRAWING_CONTEXT;
        PEN("0080FF", 5);
        DetectorField& detector = detectorBehindBall;
        LINE(detector.edges[0].x, detector.edges[0].y, detector.edges[1].x, detector.edges[1].y);
        LINE(detector.edges[1].x, detector.edges[1].y, detector.edges[3].x, detector.edges[3].y);
        LINE(detector.edges[2].x, detector.edges[2].y, detector.edges[3].x, detector.edges[3].y);
        LINE(detector.edges[0].x, detector.edges[0].y, detector.edges[2].x, detector.edges[2].y);
      );

      DetectorImage detectorImageBehindBall;
      success = projectDetector(detectorBehindBall, detectorImageBehindBall);
      DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_behind_ball",
        IMAGE_DRAWING_CONTEXT;
        if (!success) {
          PEN("FF4D4D", 5);
          BOX(detectorImageBehindBall.minX(), detectorImageBehindBall.minY(),
              detectorImageBehindBall.maxX(), detectorImageBehindBall.maxY());
        }
      );
      if(success) {
        if(params.check_green) {
          // calculate green density
          double green_density = detectorImageBehindBall.green_density(getBallDetectorIntegralImage());
          double green_density_left = detectorImageBehindBall.green_density_left(getBallDetectorIntegralImage());
          double green_density_right = detectorImageBehindBall.green_density_right(getBallDetectorIntegralImage());

          DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_behind_ball",
            FIELD_DRAWING_CONTEXT;
            DetectorField& detector = detectorBehindBall;

            PEN("0080FF", 5);
            TEXT_DRAWING(detector.edges[0].x, detector.edges[0].y       , green_density * 100 << '%');
            TEXT_DRAWING(detector.edges[0].x, detector.edges[0].y + 1000, green_density_left * 100 << '%');
            TEXT_DRAWING(detector.edges[0].x, detector.edges[0].y - 1000, green_density_right * 100 << '%');
          );

          // set representation if detector is occupied
          getObstacleBehindBall().valid = true;
          getObstacleBehindBall().isOccupied = green_density <= params.max_green_density;
          if (getObstacleBehindBall().isOccupied) {
            getObstacleBehindBall().onTheRight = green_density_right <= green_density_left;
            getObstacleBehindBall().onTheLeft = green_density_right > green_density_left;
          } else {
            getObstacleBehindBall().onTheRight = false;
            getObstacleBehindBall().onTheLeft = false;
          }
        }

        if(params.check_brightness) {
          // calculate brightness density
          double density = detectorImageBehindBall.density(getBallDetectorIntegralImage(), 0);
          double density_left = detectorImageBehindBall.density_left(getBallDetectorIntegralImage(), 0);
          double density_right = detectorImageBehindBall.density_right(getBallDetectorIntegralImage(), 0);

          DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_behind_ball",
            FIELD_DRAWING_CONTEXT;
            DetectorField& detector = detectorBehindBall;

            PEN("FFBFF8", 5);
            TEXT_DRAWING(detector.edges[0].x + 2000, detector.edges[0].y       , density);
            TEXT_DRAWING(detector.edges[0].x + 2000, detector.edges[0].y + 1000, density_left);
            TEXT_DRAWING(detector.edges[0].x + 2000, detector.edges[0].y - 1000, density_right);
          );

          // set representation if detector is occupied
          getObstacleBehindBall().valid = true;
          getObstacleBehindBall().isOccupied = density >= params.min_brightness_density;
          if (getObstacleBehindBall().isOccupied) {
            getObstacleBehindBall().onTheRight = density_right >= density_left;
            getObstacleBehindBall().onTheLeft = density_right < density_left;
          } else {
            getObstacleBehindBall().onTheRight = false;
            getObstacleBehindBall().onTheLeft = false;
          }
        }

        DEBUG_REQUEST("Vision:NoGreenObstacleDetector:draw_detector_behind_ball",
          IMAGE_DRAWING_CONTEXT;
          if(getObstacleBehindBall().valid) {
            if(getObstacleBehindBall().isOccupied) {
              PEN("FF4D4D", 5);
            } else {
              PEN("AAFCC7", 5);
            }

            BOX(detectorImageBehindBall.minX(), detectorImageBehindBall.minY(),
                detectorImageBehindBall.maxX(), detectorImageBehindBall.maxY());

            int halfX = (detectorImageBehindBall.maxX() - detectorImageBehindBall.minX()) / 2;

            if(getObstacleBehindBall().onTheRight) {
              PEN("FF4D4D", 3);
            } else {
              PEN("AAFCC7", 3);
            }
            BOX(detectorImageBehindBall.minX()+1 + halfX, detectorImageBehindBall.minY()+1,
                detectorImageBehindBall.maxX()-1, detectorImageBehindBall.maxY()-1);

            if(getObstacleBehindBall().onTheLeft) {
              PEN("FF4D4D", 3);
            } else {
              PEN("AAFCC7", 3);
            }
            BOX(detectorImageBehindBall.minX()+1, detectorImageBehindBall.minY()+1,
                detectorImageBehindBall.maxX()-1 - halfX, detectorImageBehindBall.maxY()-1);
          }
        );
      }
    }
  } // end if params.enable_obstacle_detector_behind_ball
} // end execute


text:
 Profile data Generator
========================

## Requirements

(1) set environment variables:

```
export GITHUB_HOST=https://api.github.com
export GITHUB_USER=kuronekomichael
export GITHUB_TOKEN=3eb623e7faefeafwfefefeeaa5447679c95b12f5
```

(2) edit `repos.js`

```
module.exports = [
    'OpenKinect/libfreenect2',
    'defunkt/dotjs'
];
```

## Testing

```
mocha
```

or

```
npm test
```

## Generate Profile data

```
npm start
```

redpajama_set_name: RedPajamaGithub


text:
module WhereIn3 where

--A definition can be demoted to the local 'where' binding of a friend declaration,
--if it is only used by this friend declaration.

--Demoting a definition narrows down the scope of the definition.
--In this example, demote the top level 'sq' to 'sumSquares'
--In this case (there are multi matches), the parameters are not folded after demoting.

sumSquares x y = sq p x + sq p y
         where p=2  {-There is a comment-}

sq :: Int -> Int -> Int
sq pow 0 = 0
sq pow z = z^pow  --there is a comment

anotherFun 0 y = sq y
     where  sq x = x^2


text:
<?php

namespace Bootstrap\Site\Providers;

use Hubzero\Module\Loader;
use Hubzero\Base\ServiceProvider;

/**
 * Module loader service provider
 */
class ModuleServiceProvider extends ServiceProvider
{
	/**
	 * Register the service provider.
	 *
	 * @return  void
	 */
	public function register()
	{
		$this->app['module'] = function($app)
		{
			return new Loader($app, $app['profiler']);
		};
	}
}


text:
/**
 * @description The current version of the SDK, i.e. `3.0.2`.
 */
export const VERSION: string;

export type callback<T = any> = (err?: BraintreeError, data?: T) => void;

/**
 * Enum for {@link BraintreeError} types.
 */
export type BraintreeErrorTypes = 'CUSTOMER' | 'MERCHANT' | 'NETWORK' | 'INTERNAL' | 'UNKNOWN';

export interface BraintreeError {
    /**
     * @description A code that corresponds to specific errors.
     */
    code: string;

    /**
     * @description A short description of the error.
     */
    message: string;

    /**
     * @description The type of error.
     */
    type: BraintreeErrorTypes;

    /**
     * @description Additional information about the error, such as an underlying network error response.
     */
    details: any;
}


text:
package com.amazonaws.services.ecr.model.transform;

import java.util.List;
import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.ecr.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * BatchGetImageRequestMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class BatchGetImageRequestMarshaller {

    private static final MarshallingInfo<String> REGISTRYID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("registryId").build();
    private static final MarshallingInfo<String> REPOSITORYNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("repositoryName").build();
    private static final MarshallingInfo<List> IMAGEIDS_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("imageIds").build();
    private static final MarshallingInfo<List> ACCEPTEDMEDIATYPES_BINDING = MarshallingInfo.builder(MarshallingType.LIST)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("acceptedMediaTypes").build();

    private static final BatchGetImageRequestMarshaller instance = new BatchGetImageRequestMarshaller();

    public static BatchGetImageRequestMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(BatchGetImageRequest batchGetImageRequest, ProtocolMarshaller protocolMarshaller) {

        if (batchGetImageRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(batchGetImageRequest.getRegistryId(), REGISTRYID_BINDING);
            protocolMarshaller.marshall(batchGetImageRequest.getRepositoryName(), REPOSITORYNAME_BINDING);
            protocolMarshaller.marshall(batchGetImageRequest.getImageIds(), IMAGEIDS_BINDING);
            protocolMarshaller.marshall(batchGetImageRequest.getAcceptedMediaTypes(), ACCEPTEDMEDIATYPES_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
cask 'font-noto-serif-sinhala' do
  version :latest
  sha256 :no_check

  # noto-website-2.storage.googleapis.com was verified as official when first introduced to the cask
  url 'https://noto-website-2.storage.googleapis.com/pkgs/NotoSerifSinhala-unhinted.zip'
  name 'Noto Serif Sinhala'
  homepage 'https://www.google.com/get/noto/#serif-sinh'

  font 'NotoSerifSinhala-Black.ttf'
  font 'NotoSerifSinhala-Bold.ttf'
  font 'NotoSerifSinhala-ExtraBold.ttf'
  font 'NotoSerifSinhala-ExtraLight.ttf'
  font 'NotoSerifSinhala-Light.ttf'
  font 'NotoSerifSinhala-Medium.ttf'
  font 'NotoSerifSinhala-Regular.ttf'
  font 'NotoSerifSinhala-SemiBold.ttf'
  font 'NotoSerifSinhala-Thin.ttf'
end


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

package com.google.api.services.memcache.v1beta2.model;

/**
 * Model definition for Instance.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Memorystore for Memcached API. For a detailed
 * explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

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

  /**
   * The full name of the Google Compute Engine [network](https://cloud.google.com/vpc/docs/vpc) to
   * which the instance is connected. If left unspecified, the `default` network will be used.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String authorizedNetwork;

  /**
   * Output only. The time the instance was created.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String createTime;

  /**
   * Output only. Endpoint for Discovery API
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String discoveryEndpoint;

  /**
   * User provided name for the instance only used for display purposes. Cannot be more than 80
   * characters.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String displayName;

  /**
   * List of messages that describe current statuses of memcached instance.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<InstanceMessage> instanceMessages;

  /**
   * Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for
   * more details. https://cloud.google.com/compute/docs/labeling-resources
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.String> labels;

  /**
   * Output only. The full version of memcached server running on this instance. System
   * automatically determines the full memcached version for an instance based on the input
   * MemcacheVersion. The full version format will be "memcached-1.5.16".
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String memcacheFullVersion;

  /**
   * Output only. List of Memcached nodes. Refer to [Node] message for more details.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<Node> memcacheNodes;

  /**
   * The major version of Memcached software. If not provided, latest supported version will be
   * used. Currently the latest supported major version is MEMCACHE_1_5. The minor version will be
   * automatically determined by our system based on the latest supported minor version.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String memcacheVersion;

  /**
   * Required. Unique name of the resource in this scope including project and location using the
   * form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: Memcached
   * instances are managed and addressed at regional level so location_id here refers to a GCP
   * region; however, users may choose which zones Memcached nodes within an instances should be
   * provisioned in. Refer to [zones] field for more details.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String name;

  /**
   * Required. Configuration for Memcached nodes.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private NodeConfig nodeConfig;

  /**
   * Required. Number of nodes in the Memcached instance.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer nodeCount;

  /**
   * Optional: User defined parameters to apply to the memcached process on each node.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private MemcacheParameters parameters;

  /**
   * Output only. The state of this Memcached instance.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String state;

  /**
   * Output only. The time the instance was updated.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String updateTime;

  /**
   * Zones where Memcached nodes should be provisioned in. Memcached nodes will be equally
   * distributed across these zones. If not provided, the service will by default create nodes in
   * all zones in the region for the instance.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<java.lang.String> zones;

  /**
   * The full name of the Google Compute Engine [network](https://cloud.google.com/vpc/docs/vpc) to
   * which the instance is connected. If left unspecified, the `default` network will be used.
   * @return value or {@code null} for none
   */
  public java.lang.String getAuthorizedNetwork() {
    return authorizedNetwork;
  }

  /**
   * The full name of the Google Compute Engine [network](https://cloud.google.com/vpc/docs/vpc) to
   * which the instance is connected. If left unspecified, the `default` network will be used.
   * @param authorizedNetwork authorizedNetwork or {@code null} for none
   */
  public Instance setAuthorizedNetwork(java.lang.String authorizedNetwork) {
    this.authorizedNetwork = authorizedNetwork;
    return this;
  }

  /**
   * Output only. The time the instance was created.
   * @return value or {@code null} for none
   */
  public String getCreateTime() {
    return createTime;
  }

  /**
   * Output only. The time the instance was created.
   * @param createTime createTime or {@code null} for none
   */
  public Instance setCreateTime(String createTime) {
    this.createTime = createTime;
    return this;
  }

  /**
   * Output only. Endpoint for Discovery API
   * @return value or {@code null} for none
   */
  public java.lang.String getDiscoveryEndpoint() {
    return discoveryEndpoint;
  }

  /**
   * Output only. Endpoint for Discovery API
   * @param discoveryEndpoint discoveryEndpoint or {@code null} for none
   */
  public Instance setDiscoveryEndpoint(java.lang.String discoveryEndpoint) {
    this.discoveryEndpoint = discoveryEndpoint;
    return this;
  }

  /**
   * User provided name for the instance only used for display purposes. Cannot be more than 80
   * characters.
   * @return value or {@code null} for none
   */
  public java.lang.String getDisplayName() {
    return displayName;
  }

  /**
   * User provided name for the instance only used for display purposes. Cannot be more than 80
   * characters.
   * @param displayName displayName or {@code null} for none
   */
  public Instance setDisplayName(java.lang.String displayName) {
    this.displayName = displayName;
    return this;
  }

  /**
   * List of messages that describe current statuses of memcached instance.
   * @return value or {@code null} for none
   */
  public java.util.List<InstanceMessage> getInstanceMessages() {
    return instanceMessages;
  }

  /**
   * List of messages that describe current statuses of memcached instance.
   * @param instanceMessages instanceMessages or {@code null} for none
   */
  public Instance setInstanceMessages(java.util.List<InstanceMessage> instanceMessages) {
    this.instanceMessages = instanceMessages;
    return this;
  }

  /**
   * Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for
   * more details. https://cloud.google.com/compute/docs/labeling-resources
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.String> getLabels() {
    return labels;
  }

  /**
   * Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for
   * more details. https://cloud.google.com/compute/docs/labeling-resources
   * @param labels labels or {@code null} for none
   */
  public Instance setLabels(java.util.Map<String, java.lang.String> labels) {
    this.labels = labels;
    return this;
  }

  /**
   * Output only. The full version of memcached server running on this instance. System
   * automatically determines the full memcached version for an instance based on the input
   * MemcacheVersion. The full version format will be "memcached-1.5.16".
   * @return value or {@code null} for none
   */
  public java.lang.String getMemcacheFullVersion() {
    return memcacheFullVersion;
  }

  /**
   * Output only. The full version of memcached server running on this instance. System
   * automatically determines the full memcached version for an instance based on the input
   * MemcacheVersion. The full version format will be "memcached-1.5.16".
   * @param memcacheFullVersion memcacheFullVersion or {@code null} for none
   */
  public Instance setMemcacheFullVersion(java.lang.String memcacheFullVersion) {
    this.memcacheFullVersion = memcacheFullVersion;
    return this;
  }

  /**
   * Output only. List of Memcached nodes. Refer to [Node] message for more details.
   * @return value or {@code null} for none
   */
  public java.util.List<Node> getMemcacheNodes() {
    return memcacheNodes;
  }

  /**
   * Output only. List of Memcached nodes. Refer to [Node] message for more details.
   * @param memcacheNodes memcacheNodes or {@code null} for none
   */
  public Instance setMemcacheNodes(java.util.List<Node> memcacheNodes) {
    this.memcacheNodes = memcacheNodes;
    return this;
  }

  /**
   * The major version of Memcached software. If not provided, latest supported version will be
   * used. Currently the latest supported major version is MEMCACHE_1_5. The minor version will be
   * automatically determined by our system based on the latest supported minor version.
   * @return value or {@code null} for none
   */
  public java.lang.String getMemcacheVersion() {
    return memcacheVersion;
  }

  /**
   * The major version of Memcached software. If not provided, latest supported version will be
   * used. Currently the latest supported major version is MEMCACHE_1_5. The minor version will be
   * automatically determined by our system based on the latest supported minor version.
   * @param memcacheVersion memcacheVersion or {@code null} for none
   */
  public Instance setMemcacheVersion(java.lang.String memcacheVersion) {
    this.memcacheVersion = memcacheVersion;
    return this;
  }

  /**
   * Required. Unique name of the resource in this scope including project and location using the
   * form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: Memcached
   * instances are managed and addressed at regional level so location_id here refers to a GCP
   * region; however, users may choose which zones Memcached nodes within an instances should be
   * provisioned in. Refer to [zones] field for more details.
   * @return value or {@code null} for none
   */
  public java.lang.String getName() {
    return name;
  }

  /**
   * Required. Unique name of the resource in this scope including project and location using the
   * form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: Memcached
   * instances are managed and addressed at regional level so location_id here refers to a GCP
   * region; however, users may choose which zones Memcached nodes within an instances should be
   * provisioned in. Refer to [zones] field for more details.
   * @param name name or {@code null} for none
   */
  public Instance setName(java.lang.String name) {
    this.name = name;
    return this;
  }

  /**
   * Required. Configuration for Memcached nodes.
   * @return value or {@code null} for none
   */
  public NodeConfig getNodeConfig() {
    return nodeConfig;
  }

  /**
   * Required. Configuration for Memcached nodes.
   * @param nodeConfig nodeConfig or {@code null} for none
   */
  public Instance setNodeConfig(NodeConfig nodeConfig) {
    this.nodeConfig = nodeConfig;
    return this;
  }

  /**
   * Required. Number of nodes in the Memcached instance.
   * @return value or {@code null} for none
   */
  public java.lang.Integer getNodeCount() {
    return nodeCount;
  }

  /**
   * Required. Number of nodes in the Memcached instance.
   * @param nodeCount nodeCount or {@code null} for none
   */
  public Instance setNodeCount(java.lang.Integer nodeCount) {
    this.nodeCount = nodeCount;
    return this;
  }

  /**
   * Optional: User defined parameters to apply to the memcached process on each node.
   * @return value or {@code null} for none
   */
  public MemcacheParameters getParameters() {
    return parameters;
  }

  /**
   * Optional: User defined parameters to apply to the memcached process on each node.
   * @param parameters parameters or {@code null} for none
   */
  public Instance setParameters(MemcacheParameters parameters) {
    this.parameters = parameters;
    return this;
  }

  /**
   * Output only. The state of this Memcached instance.
   * @return value or {@code null} for none
   */
  public java.lang.String getState() {
    return state;
  }

  /**
   * Output only. The state of this Memcached instance.
   * @param state state or {@code null} for none
   */
  public Instance setState(java.lang.String state) {
    this.state = state;
    return this;
  }

  /**
   * Output only. The time the instance was updated.
   * @return value or {@code null} for none
   */
  public String getUpdateTime() {
    return updateTime;
  }

  /**
   * Output only. The time the instance was updated.
   * @param updateTime updateTime or {@code null} for none
   */
  public Instance setUpdateTime(String updateTime) {
    this.updateTime = updateTime;
    return this;
  }

  /**
   * Zones where Memcached nodes should be provisioned in. Memcached nodes will be equally
   * distributed across these zones. If not provided, the service will by default create nodes in
   * all zones in the region for the instance.
   * @return value or {@code null} for none
   */
  public java.util.List<java.lang.String> getZones() {
    return zones;
  }

  /**
   * Zones where Memcached nodes should be provisioned in. Memcached nodes will be equally
   * distributed across these zones. If not provided, the service will by default create nodes in
   * all zones in the region for the instance.
   * @param zones zones or {@code null} for none
   */
  public Instance setZones(java.util.List<java.lang.String> zones) {
    this.zones = zones;
    return this;
  }

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

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

}


text:
{% extends "global/prototypes_base.html" %}

{% block page_title %}
  Token
{% endblock %}

{% block content %}

    {% include "includes/prototypes_banner.html" %}

        <form action="retrieve-token" method="get" class="form">

            Submit a token

            Enter token
            <input type="text" class="form-control" id="token">

            <button type="submit" class="button">Next</button>

        </form>

{% endblock %}


text:
<form id="asignacion" action="tareasignada" method="post" class="pure-form" >

		Asignado por:
		<select name = "investigador" id = "invest" onchange="onChangeSetVar()" required>
			%s
		</select>

  	Proyecto:
  	<select name = "workingpaper" required>
     	<option selected value="">-Working Paper-</option>
     	%s
  	</select>

   Asignar a:
   <select name = "asistente" required>
   	<option selected value="">-Asistente-</option>
  	%s
  	</select>

  	Descripción de la Asignación:

   <input type="text" name="descripcion" placeholder="Descripción de la asignación" required/>

  	Prioridad:
  	<select name = "prioridad">
      <option value = "1">Alta</option>
     	<option value = "2">Media</option>
    	<option selected value = "3">Baja</option>
 	</select>

    Justificación para prioridad solicitada:
    <textarea id="justificacion" name="justificacion" placeholder="Justificación para prioridad solicitada"></textarea>

		<button class="btn btn-primary" type="submit">Guardar</button>

</form>


text:
package joshie.harvest.quests.player.recipes;

import joshie.harvest.api.quests.HFQuest;
import joshie.harvest.api.quests.Quest;
import joshie.harvest.npcs.HFNPCs;
import joshie.harvest.quests.Quests;
import joshie.harvest.quests.base.QuestRecipe;

import java.util.Set;

@HFQuest("recipe.egg.scrambled")
public class QuestDanieru10KScrambledEgg extends QuestRecipe {
    public QuestDanieru10KScrambledEgg() {
        super("egg_scrambled", HFNPCs.BLACKSMITH, 10000);
    }

    @Override
    public boolean canStartQuest(Set<Quest> active, Set<Quest> finished) {
        return finished.contains(Quests.DANIERU_5K);
    }
}


text:
package com.mike.utility.cache;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.jakewharton.disklrucache.DiskLruCache;
import com.mike.utility.BitmapUtil;
import com.mike.utility.Util;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;

public class DiskCache {
    private static final int VALUE_IDX = 0;
    private static final int METADATA_IDX = 1;

    private DiskLruCache diskLruCache;
    private MessageDigest messageDigest;

    private int mAppVersion;

    private DiskCache(File dir, int appVersion, long maxSize) throws IOException {
        mAppVersion = appVersion;
        diskLruCache = DiskLruCache.open(dir, appVersion, 2, maxSize);
        try {
            messageDigest = MessageDigest.getInstance("MD5");
        }catch (NoSuchAlgorithmException e){
            e.printStackTrace();
        }

    }

    // for testing purpose
    DiskCache(DiskLruCache diskLruCache, int appVersion, MessageDigest messageDigest) throws IOException {
        mAppVersion = appVersion;
        this.diskLruCache = diskLruCache;
        this.messageDigest = messageDigest;
    }

    public static synchronized DiskCache open(File dir, int appVersion, long maxSize)
            throws IOException {
        return new DiskCache(dir, appVersion, maxSize);
    }

    /**
     * User should be sure there are no outstanding operations.
     * @throws IOException
     */
    public void clear() throws IOException {
        File dir = diskLruCache.getDirectory();
        long maxSize = diskLruCache.getMaxSize();
        diskLruCache.delete();
        diskLruCache = DiskLruCache.open(dir, mAppVersion, 2, maxSize);
    }

    public DiskLruCache getCache() {
        return diskLruCache;
    }

    public InputStreamEntry getInputStream(String key) throws IOException {
        DiskLruCache.Snapshot snapshot = diskLruCache.get(toInternalKey(key));
        if (snapshot == null) return null;
        return new InputStreamEntry(snapshot, readMetadata(snapshot));
    }

    public BitmapEntry getBitmap(String key) throws IOException {
        DiskLruCache.Snapshot snapshot = diskLruCache.get(toInternalKey(key));
        if (snapshot == null) return null;

        try {
            Bitmap bitmap = BitmapFactory.decodeStream(snapshot.getInputStream(VALUE_IDX));
            return new BitmapEntry(bitmap, readMetadata(snapshot));
        } finally {
            snapshot.close();
        }
    }

    public BitmapEntry getBitmap(String key, int reqWidth, int reqHeight) throws IOException {
        DiskLruCache.Snapshot snapshot = diskLruCache.get(toInternalKey(key));
        if (snapshot == null) return null;
        try {
            BitmapFactory.Options options = BitmapUtil.calculateOptions(snapshot.getInputStream(VALUE_IDX), reqWidth, reqHeight);
            snapshot.close();
            // reset stream.
            snapshot = diskLruCache.get(toInternalKey(key));
            Bitmap bitmap = BitmapFactory.decodeStream(snapshot.getInputStream(VALUE_IDX), null, options);
            return new BitmapEntry(bitmap, readMetadata(snapshot));
        } finally {
            snapshot.close();
        }
    }

    public StringEntry getString(String key) throws IOException {
        DiskLruCache.Snapshot snapshot = diskLruCache.get(toInternalKey(key));
        if (snapshot == null) return null;

        try {
            return new StringEntry(snapshot.getString(VALUE_IDX), readMetadata(snapshot));
        } finally {
            snapshot.close();
        }
    }

    public boolean contains(String key) throws IOException {
        DiskLruCache.Snapshot snapshot = diskLruCache.get(toInternalKey(key));
        if(snapshot==null) return false;

        snapshot.close();
        return true;
    }

    public OutputStream openStream(String key) throws IOException {
        return openStream(key, new HashMap<String, Serializable>());
    }

    public OutputStream openStream(String key, Map<String, ? extends Serializable> metadata)
            throws IOException {
        DiskLruCache.Editor editor = diskLruCache.edit(toInternalKey(key));
        try {
            writeMetadata(metadata, editor);
            BufferedOutputStream bos = new BufferedOutputStream(editor.newOutputStream(VALUE_IDX));
            return new CacheOutputStream(bos, editor);
        } catch (IOException e) {
            editor.abort();
            throw e;
        }
    }

    public void put(String key, InputStream is) throws IOException {
        put(key, is, new HashMap<String, Serializable>());
    }

    public void put(String key, InputStream is, Map<String, Serializable> annotations)
            throws IOException {
        OutputStream os = null;
        try {
            os = openStream(key, annotations);
            Util.copyStream(is, os);
        } finally {
            if (os != null)
                os.close();
        }
    }

    public void put(String key, String value) throws IOException {
        put(key, value, new HashMap<String, Serializable>());
    }

    public void put(String key, String value, Map<String, ? extends Serializable> annotations)
            throws IOException {
        OutputStream cos = null;
        try {
            cos = openStream(key, annotations);
            cos.write(value.getBytes());
        } finally {
            if (cos != null) cos.close();
        }

    }

    private void writeMetadata(Map<String, ? extends Serializable> metadata,
                               DiskLruCache.Editor editor) throws IOException {
        ObjectOutputStream oos = null;
        try {
            oos = new ObjectOutputStream(new BufferedOutputStream(
                    editor.newOutputStream(METADATA_IDX)));
            oos.writeObject(metadata);
        } finally {
            if(oos != null)
                oos.close();
        }
    }

    private Map<String, Serializable> readMetadata(DiskLruCache.Snapshot snapshot)
            throws IOException {
        ObjectInputStream ois = null;
        try {
            ois = new ObjectInputStream(new BufferedInputStream(
                    snapshot.getInputStream(METADATA_IDX)));
            @SuppressWarnings("unchecked")
            Map<String, Serializable> annotations = (Map<String, Serializable>) ois.readObject();
            return annotations;
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } finally {
            if(ois != null)
                ois.close();
        }
    }

    private String toInternalKey(String key) {
        return md5(key);
    }

    private String md5(String s) {
        try {
            messageDigest.update(s.getBytes("UTF-8"));
            byte[] digest = messageDigest.digest();
            BigInteger bigInt = new BigInteger(1, digest);
            return bigInt.toString(16);
        } catch (UnsupportedEncodingException e) {
            throw new AssertionError();
        }
    }

    private class CacheOutputStream extends FilterOutputStream {

        private final DiskLruCache.Editor editor;
        private boolean failed = false;

        private CacheOutputStream(OutputStream os, DiskLruCache.Editor editor) {
            super(os);
            this.editor = editor;
        }

        @Override
        public void close() throws IOException {
            IOException closeException = null;
            try {
                super.close();
            } catch (IOException e) {
                closeException = e;
            }

            if (failed) {
                editor.abort();
            } else {
                editor.commit();
            }

            if (closeException != null) throw closeException;
        }

        @Override
        public void flush() throws IOException {
            try {
                super.flush();
            } catch (IOException e) {
                failed = true;
                throw e;
            }
        }

        @Override
        public void write(int oneByte) throws IOException {
            try {
                super.write(oneByte);
            } catch (IOException e) {
                failed = true;
                throw e;
            }
        }

        @Override
        public void write(byte[] buffer) throws IOException {
            try {
                super.write(buffer);
            } catch (IOException e) {
                failed = true;
                throw e;
            }
        }

        @Override
        public void write(byte[] buffer, int offset, int length) throws IOException {
            try {
                super.write(buffer, offset, length);
            } catch (IOException e) {
                failed = true;
                throw e;
            }
        }
    }

    public static class InputStreamEntry {
        private final DiskLruCache.Snapshot snapshot;
        private final Map<String, Serializable> metadata;

        public InputStreamEntry(DiskLruCache.Snapshot snapshot, Map<String, Serializable> metadata) {
            this.metadata = metadata;
            this.snapshot = snapshot;
        }

        public InputStream getInputStream() {
            return snapshot.getInputStream(VALUE_IDX);
        }

        public Map<String, Serializable> getMetadata() {
            return metadata;
        }

        public void close() {
            snapshot.close();

        }

    }

    public static class BitmapEntry {
        private final Bitmap bitmap;
        private final Map<String, Serializable> metadata;

        public BitmapEntry(Bitmap bitmap, Map<String, Serializable> metadata) {
            this.bitmap = bitmap;
            this.metadata = metadata;
        }

        public Bitmap getBitmap() {
            return bitmap;
        }

        public Map<String, Serializable> getMetadata() {
            return metadata;
        }
    }

    public static class StringEntry {
        private final String string;
        private final Map<String, Serializable> metadata;

        public StringEntry(String string, Map<String, Serializable> metadata) {
            this.string = string;
            this.metadata = metadata;
        }

        public String getString() {
            return string;
        }

        public Map<String, Serializable> getMetadata() {
            return metadata;
        }
    }
}


text:
MLS.mixedCart = {
    element: null,

    callbacks :
    {
        scrollPrevious: function(e){
            e.preventDefault();
            var type = "prev";
            MLS.mixedCart.callbacks.scroll(type);
        },

        scrollNext: function(e){
            e.preventDefault();
            var type = "next";
            MLS.mixedCart.callbacks.scroll(type);
        },

        scroll: function(type) { // MINICART  scroll minicart items .............................................................
            var $e = MLS.mixedCart.element;
            if (type == "next") { // if scroll up, calculate max scroll up
                var inMini = $e.find('.minicart-item').length,
                    maxScrollPos = - (Math.ceil(inMini / 3) - 1) * 247,

                    // get current position
                    curPos = $e.find('.minicart-item').eq(0).attr('data-vpos'),

                    //calculate new offset before actually moving
                    newPos = curPos - 247;

                // check position, move and adjust options as required
                $e.find('.prev-items').addClass('on'); //turn on prev
                $e.find('.minicart-item').each(function(){ // move up
                    MLS.ui.vScroll(this, newPos);
                });

                if (newPos > maxScrollPos) { // if beginning/middle
                    $e.find('.next-items').removeClass('off'); //turn on next if needed
                } else { // if end
                    $e.find('.next-items').addClass('off'); //turn off next
                }

            } else { // if scroll down
                // get current position
                var curPos = $e.find('.minicart-item').eq(0).attr('data-vpos'),
                    curPosParse = Math.ceil(curPos),

                    //calculate new offset before actually moving
                    newPos = curPosParse + 247;

                // check position, move and adjust options as required
                $e.find('.minicart-item').each(function(){ //move down
                    MLS.ui.vScroll(this, newPos);
                });

                $e.find('.next-items').removeClass('off'); //turn on next
                if (newPos == 0) { // if beginning/middle
                    $e.find('.prev-items').removeClass('on'); //turn off prev
                }
            }
        },
    },

    init : function (d)
    {
        this.element = $jQ(d).parent();

        var itemCount = this.element.find("#mixedcart-item-list > li").length,
            $e = this.element;

        if (itemCount > 3)
        {
            $e.find('.minicart-item').eq(0).attr('data-vpos', 0);
            $e.find('.minicart-item').each(function() {
                MLS.ui.vScroll(this, 0);
            });
            $e.find('.mixedcart-next').addClass('on');
        } else {
            $e.find('.next-items').addClass("off");
        }

        // next 3 items
        $e.find('.prev-items').unbind('click', this.callbacks.scrollPrevious).click(this.callbacks.scrollPrevious);
        $e.find('.next-items').unbind('click', this.callbacks.scrollNext).click(this.callbacks.scrollNext);
    }
};


text:
[![Build Status](https://travis-ci.org/boxen/puppet-hub.png)](https://travis-ci.org/boxen/puppet-hub)

Install [Hub](https://github.com/defunkt/hub), a GitHub-focused `git` wrapper.

## Usage

```puppet
include hub
```

## Configuration

You can use hiera to configure the following:

* `hub::protocol`: one of `'https'` or `'git'`
  Protocol for `hub` to use by default when cloning from github like `hub clone user/repo`. Defaults to `'https'`
* `hub::alias_hub_to_git`: boolean
  Whether or not to set a shell alias `git=hub`

## Required Puppet Modules

* `boxen`

## Development

Write code. Run `script/cibuild` to test it. Check the `script`
directory for other useful tools.


text:
/*! ColResize 0.0.8
 */

/**
 * @summary     ColResize
 * @description Provide the ability to resize columns in a DataTable
 * @version     0.0.8
 * @file        dataTables.colResize.js
 * @author      Silvacom Ltd.
 *
 * For details please refer to: http://www.datatables.net
 *
 * Special thank to everyone who has contributed to this plug in
 * - dykstrad
 * - tdillan (for 0.0.3 and 0.0.5 bug fixes)
 * - kylealonius (for 0.0.8 bug fix)
 */

(function (window, document, undefined) {

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * DataTables plug-in API functions test
     *
     * This are required by ColResize in order to perform the tasks required, and also keep this
     * code portable, to be used for other column resize projects with DataTables, if needed.
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

    /**
     * Plug-in for DataTables which will resize the columns depending on the handle clicked
     *  @method  $.fn.dataTableExt.oApi.fnColResize
     *  @param   object oSettings DataTables settings object - automatically added by DataTables!
     *  @param   int iCol Take the column to be resized
     *  @returns void
     */
    $.fn.dataTableExt.oApi.fnColResize = function (oSettings, iCol) {
        var v110 = $.fn.dataTable.Api ? true : false;

        /*
         * Update DataTables' event handlers
         */

        /* Fire an event so other plug-ins can update */
        $(oSettings.oInstance).trigger('column-resize', [ oSettings, {
            "iCol": iCol
        } ]);
    };

    var factory = function ($, DataTable) {
        "use strict";

        /**
         * ColResize provides column resize control for DataTables
         * @class ColResize
         * @constructor
         * @param {object} dt DataTables settings object
         * @param {object} opts ColResize options
         */
        var ColResize = function (dt, opts) {
            var oDTSettings;

            if ($.fn.dataTable.Api) {
                oDTSettings = new $.fn.dataTable.Api(dt).settings()[0];
            }
            // 1.9 compatibility
            else if (dt.fnSettings) {
                // DataTables object, convert to the settings object
                oDTSettings = dt.fnSettings();
            }
            else if (typeof dt === 'string') {
                // jQuery selector
                if ($.fn.dataTable.fnIsDataTable($(dt)[0])) {
                    oDTSettings = $(dt).eq(0).dataTable().fnSettings();
                }
            }
            else if (dt.nodeName && dt.nodeName.toLowerCase() === 'table') {
                // Table node
                if ($.fn.dataTable.fnIsDataTable(dt.nodeName)) {
                    oDTSettings = $(dt.nodeName).dataTable().fnSettings();
                }
            }
            else if (dt instanceof jQuery) {
                // jQuery object
                if ($.fn.dataTable.fnIsDataTable(dt[0])) {
                    oDTSettings = dt.eq(0).dataTable().fnSettings();
                }
            }
            else {
                // DataTables settings object
                oDTSettings = dt;
            }

            // Convert from camelCase to Hungarian, just as DataTables does
            if ($.fn.dataTable.camelToHungarian) {
                $.fn.dataTable.camelToHungarian(ColResize.defaults, opts || {});
            }

            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
             * Public class variables
             * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

            /**
             * @namespace Settings object which contains customizable information for ColResize instance
             */
            this.s = {
                /**
                 * DataTables settings object
                 *  @property dt
                 *  @type     Object
                 *  @default  null
                 */
                "dt": null,

                /**
                 * Initialisation object used for this instance
                 *  @property init
                 *  @type     object
                 *  @default  {}
                 */
                "init": $.extend(true, {}, ColResize.defaults, opts),

                /**
                 * @namespace Information used for the mouse drag
                 */
                "mouse": {
                    "startX": -1,
                    "startY": -1,
                    "targetIndex": -1,
                    "targetColumn": -1,
                    "neighbourIndex": -1,
                    "neighbourColumn": -1
                },

                /**
                 * Status variable keeping track of mouse down status
                 *  @property isMousedown
                 *  @type     boolean
                 *  @default  false
                 */
                "isMousedown": false
            };

            /**
             * @namespace Common and useful DOM elements for the class instance
             */
            this.dom = {
                /**
                 * Resizing element (the one the mouse is resizing)
                 *  @property resize
                 *  @type     element
                 *  @default  null
                 */
                "resizeCol": null,

                /**
                 * Resizing element neighbour (the column next to the one the mouse is resizing)
                 * This is for fixed table resizing.
                 *  @property resize
                 *  @type     element
                 *  @default  null
                 */
                "resizeColNeighbour": null,

                /**
                 *  Array of events to be restored, used for overriding existing events from other plugins for a time.
                 *  @property restoreEvents
                 *  @type     array
                 *  @default  []
                 */
                "restoreEvents": []
            };

            /* Constructor logic */
            this.s.dt = oDTSettings.oInstance.fnSettings();
            this.s.dt._colResize = this;
            this._fnConstruct();

            /* Add destroy callback */
            oDTSettings.oApi._fnCallbackReg(oDTSettings, 'aoDestroyCallback', $.proxy(this._fnDestroy, this), 'ColResize');

            return this;
        };

        ColResize.prototype = {
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
             * Public methods
             * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

            /**
             * Reset the column widths to the original widths that was detected on
             * start up.
             *  @return {this} Returns `this` for chaining.
             *
             *  @example
             *    // DataTables initialisation with ColResize
             *    var table = $('#example').dataTable( {
             *        "sDom": 'Zlfrtip'
             *    } );
             *
             *    // Add click event to a button to reset the ordering
             *    $('#resetOrdering').click( function (e) {
             *        e.preventDefault();
             *        $.fn.dataTable.ColResize( table ).fnReset();
             *    } );
             */
            "fnReset": function () {
                var a = [];
                for (var i = 0, iLen = this.s.dt.aoColumns.length; i < iLen; i++) {
                    this.s.dt.aoColumns[i].width = this.s.dt.aoColumns[i]._ColResize_iOrigWidth;
                }

                this.s.dt.adjust().draw();

                return this;
            },

            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
             * Private methods (they are of course public in JS, but recommended as private)
             * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

            /**
             * Constructor logic
             *  @method  _fnConstruct
             *  @returns void
             *  @private
             */
            "_fnConstruct": function () {
                var that = this;
                var iLen = that.s.dt.aoColumns.length;
                var i;

                that._fnSetupMouseListeners();

                /* Add event handlers for the resize handles */
                for (i = 0; i < iLen; i++) {
                    /* Mark the original column width for later reference */
                    this.s.dt.aoColumns[i]._ColResize_iOrigWidth = this.s.dt.aoColumns[i].width;
                }

                this._fnSetColumnIndexes();

                /* State saving */
                this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
                    that._fnStateSave.call(that, oData);
                }, "ColResize_State" );

                // State loading
                this._fnStateLoad();
            },

            /**
             * @method  _fnStateSave
             * @param   object oState DataTables state
             * @private
             */
            "_fnStateSave": function (oState) {
                this.s.dt.aoColumns.forEach(function(col, index) {
                    oState.columns[index].width = col.sWidthOrig;
                });
            },

            /**
             * If state has been loaded, apply the saved widths to the columns
             * @method  _fnStateLoad
             * @private
             */
            "_fnStateLoad": function() {
                var that = this,
                    loadedState = this.s.dt.oLoadedState;
                if (loadedState && loadedState.columns) {
                    var colStates = loadedState.columns,
                        currCols = this.s.dt.aoColumns;
                    // Only apply the saved widths if the number of columns is the same.
                    // Otherwise, we don't know if we're applying the width to the correct column.
                    if (colStates.length > 0 && colStates.length === currCols.length) {
                        colStates.forEach(function(state, index) {
                            var col = that.s.dt.aoColumns[index];
                            if (state.width) {
                                col.sWidthOrig = col.sWidth = state.width;
                            }
                        });
                    }
                }
            },

            /**
             * Remove events of type from obj add it to restoreEvents array to be restored at a later time
             * @param until string flag when to restore the event
             * @param obj Object to remove events from
             * @param type type of event to remove
             * @param namespace namespace of the event being removed
             */
            "_fnDelayEvents": function (until, obj, type, namespace) {
                var that = this;
                //Get the events for the object
                var events = $._data($(obj).get(0), 'events');
                $.each(events, function (i, o) {
                    //If the event type matches
                    if (i == type) {
                        //Loop through the possible many events with that type
                        $.each(o, function (k, v) {
                            //Somehow it is possible for the event to be undefined make sure it is defined first
                            if (v) {
                                if (namespace) {
                                    //Add the event to the array of events to be restored later
                                    that.dom.restoreEvents.push({"until": until, "obj": obj, "type": v.type, "namespace": v.namespace, "handler": v.handler});
                                    //If the namespace matches
                                    if (v.namespace == namespace) {
                                        //Turn off/unbind the event
                                        $(obj).off(type + "." + namespace);
                                    }
                                } else {
                                    //Add the event to the array of events to be restored later
                                    that.dom.restoreEvents.push({"until": until, "obj": obj, "type": v.type, "namespace": null, "handler": v.handler});
                                    //Turn off/unbind the event
                                    $(obj).off(type);
                                }
                            }
                        });
                    }
                });
            },

            /**
             * Loop through restoreEvents array and restore the events on the elements provided
             */
            "_fnRestoreEvents": function (until) {
                var that = this;
                //Loop through the events to be restored
                var i;
                for (i = that.dom.restoreEvents.length; i--;) {
                    if (that.dom.restoreEvents[i].until == undefined || that.dom.restoreEvents[i].until == null || that.dom.restoreEvents[i].until == until) {
                        if (that.dom.restoreEvents[i].namespace) {
                            //Turn on the event for the object provided
                            $(that.dom.restoreEvents[i].obj).off(that.dom.restoreEvents[i].type + "." + that.dom.restoreEvents[i].namespace).on(that.dom.restoreEvents[i].type + "." + that.dom.restoreEvents[i].namespace, that.dom.restoreEvents[i].handler);
                            that.dom.restoreEvents.splice(i, 1);
                        } else {
                            //Turn on the event for the object provided
                            $(that.dom.restoreEvents[i].obj).off(that.dom.restoreEvents[i].type).on(that.dom.restoreEvents[i].type, that.dom.restoreEvents[i].handler);
                            that.dom.restoreEvents.splice(i, 1);
                        }
                    }
                }
            },

            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
             * Mouse drop and drag
             */

            "_fnSetupMouseListeners":function() {
                var that = this;
                $(that.s.dt.nTableWrapper).off("mouseenter.ColResize").on("mouseenter.ColResize","th",function(e) {
                    e.preventDefault();
                    that._fnMouseEnter.call(that, e, this);
                });
                $(that.s.dt.nTableWrapper).off("mouseleave.ColResize").on("mouseleave.ColResize","th",function(e) {
                    e.preventDefault();
                    that._fnMouseLeave.call(that, e, this);
                });
            },

            /**
             * Add mouse listeners to the resize handle on TH element
             *  @method  _fnMouseListener
             *  @param   i Column index
             *  @param   nTh TH resize handle element clicked on
             *  @returns void
             *  @private
             */
            "_fnMouseListener": function (i, nTh) {
                var that = this;
                $(nTh).off('mouseenter.ColResize').on('mouseenter.ColResize', function (e) {
                    e.preventDefault();
                    that._fnMouseEnter.call(that, e, nTh);
                });
                $(nTh).off('mouseleave.ColResize').on('mouseleave.ColResize', function (e) {
                    e.preventDefault();
                    that._fnMouseLeave.call(that, e, nTh);
                });
            },

            /**
             *
             * @param e Mouse event
             * @param nTh TH element that the mouse is over
             */
            "_fnMouseEnter": function (e, nTh) {
                var that = this;
                if(!that.s.isMousedown) {
                    //Once the mouse has entered the cell add mouse move event to see if the mouse is over resize handle
                    $(nTh).off('mousemove.ColResizeHandle').on('mousemove.ColResizeHandle', function (e) {
                        e.preventDefault();
                        that._fnResizeHandleCheck.call(that, e, nTh);
                    });
                }
            },

            /**
             * Clear mouse events when the mouse has left the th
             * @param e Mouse event
             * @param nTh TH element that the mouse has just left
             */
            "_fnMouseLeave": function (e, nTh) {
                //Once the mouse has left the TH make suure to remove the mouse move listener
                $(nTh).off('mousemove.ColResizeHandle');
            },

            /**
             * Mouse down on a TH element in the table header
             *  @method  _fnMouseDown
             *  @param   event e Mouse event
             *  @param   element nTh TH element to be resized
             *  @returns void
             *  @private
             */
            "_fnMouseDown": function (e, nTh) {
                var that = this;

                that.s.isMousedown = true;

                /* Store information about the mouse position */
                var target = $(e.target).closest('th, td');
                var offset = target.offset();

                /* Store information about the mouse position for resize calculations in mouse move function */
                this.s.mouse.startX = e.pageX;
                this.s.mouse.startY = e.pageY;

                //Store the indexes of the columns the mouse is down on
                var idx = that.dom.resizeCol[0].cellIndex;
                var idxNeighbour = that.dom.resizeColNeighbour[0].cellIndex;

                if (idx === undefined) {
                    return;
                }

                this.s.mouse.targetIndex = idx;
                this.s.mouse.targetColumn = this.s.dt.aoColumns[ idx ];

                this.s.mouse.neighbourIndex = idxNeighbour;
                this.s.mouse.neighbourColumn = this.s.dt.aoColumns[ idxNeighbour ];

                /* Add event handlers to the document */
                $(document)
                    .off('mousemove.ColResize').on('mousemove.ColResize', function (e) {
                        that._fnMouseMove.call(that, e);
                    })
                    .off('mouseup.ColResize').on('mouseup.ColResize', function (e) {
                        that._fnMouseUp.call(that, e);
                    });
            },

            /**
             * Deal with a mouse move event while dragging to resize a column
             *  @method  _fnMouseMove
             *  @param   e Mouse event
             *  @returns void
             *  @private
             */
            "_fnMouseMove": function (e) {
                var that = this;

                var offset = $(that.s.mouse.targetColumn.nTh).offset();
                var relativeX = (e.pageX - offset.left);
                var distFromLeft = relativeX;
                var distFromRight = $(that.s.mouse.targetColumn.nTh).outerWidth() - relativeX - 1;

                //Change in mouse x position
                var dx = e.pageX - that.s.mouse.startX;
                //Get the minimum width of the column (default minimum 10px)
                var minColumnWidth = Math.max(parseInt($(that.s.mouse.targetColumn.nTh).css('min-width')), 10);
                //Store the previous width of the column
                var prevWidth = $(that.s.mouse.targetColumn.nTh).width();
                //As long as the cursor is past the handle, resize the columns
                if ((dx > 0 && distFromRight <= 0) || (dx < 0 && distFromRight >= 0)) {
                    if (!that.s.init.tableWidthFixed) {
                        //As long as the width is larger than the minimum
                        var newColWidth = Math.max(minColumnWidth, prevWidth + dx);
                        //Get the width difference (take into account the columns minimum width)
                        var widthDiff = newColWidth - prevWidth;
                        var colResizeIdx = parseInt(that.dom.resizeCol.attr("data-column-index"));
                        //Set datatable column widths
                        that.s.mouse.targetColumn.sWidthOrig = that.s.mouse.targetColumn.sWidth = that.s.mouse.targetColumn.width = newColWidth + "px";
                        var domCols = $(that.s.dt.nTableWrapper).find("th[data-column-index='"+colResizeIdx+"']");
                        //For each table expand the width by the same amount as the column
                        //This accounts for other datatable plugins like FixedColumns
                        domCols.parents("table").each(function() {
                            if(!$(this).parent().hasClass("DTFC_LeftBodyLiner")) {
                                var newWidth = $(this).width() + widthDiff;
                                $(this).width(newWidth);
                            } else {
                                var newWidth =$(that.s.dt.nTableWrapper).find(".DTFC_LeftHeadWrapper").children("table").width();
                                $(this).parents(".DTFC_LeftWrapper").width(newWidth);
                                $(this).parent().width(newWidth+15);
                                $(this).width(newWidth);
                            }
                        });
                        //Apply the new width to the columns after the table has been resized
                        domCols.width(that.s.mouse.targetColumn.width);
                    } else {
                        //A neighbour column must exist in order to resize a column in a table with a fixed width
                        if (that.s.mouse.neighbourColumn) {
                            //Get the minimum width of the neighbor column (default minimum 10px)
                            var minColumnNeighbourWidth = Math.max(parseInt($(that.s.mouse.neighbourColumn.nTh).css('min-width')), 10);
                            //Store the previous width of the neighbour column
                            var prevNeighbourWidth = $(that.s.mouse.neighbourColumn.nTh).width();
                            //As long as the width is larger than the minimum
                            var newColWidth = Math.max(minColumnWidth, prevWidth + dx);
                            var newColNeighbourWidth = Math.max(minColumnNeighbourWidth, prevNeighbourWidth - dx);
                            //Get the width difference (take into account the columns minimum width)
                            var widthDiff = newColWidth - prevWidth;
                            var widthDiffNeighbour = newColNeighbourWidth - prevNeighbourWidth;
                            //Get the column index for the column being changed
                            var colResizeIdx = parseInt(that.dom.resizeCol.attr("data-column-index"));
                            var neighbourColResizeIdx = parseInt(that.dom.resizeColNeighbour.attr("data-column-index"));
                            //Set datatable column widths
                            that.s.mouse.neighbourColumn.sWidthOrig = that.s.mouse.neighbourColumn.sWidth = that.s.mouse.neighbourColumn.width = newColNeighbourWidth + "px";
                            that.s.mouse.targetColumn.sWidthOrig = that.s.mouse.targetColumn.sWidth = that.s.mouse.targetColumn.width = newColWidth + "px";
                            //Get list of columns based on column index in all affected tables tables. This accounts for other plugins like FixedColumns
                            var domNeighbourCols = $(that.s.dt.nTableWrapper).find("th[data-column-index='" + neighbourColResizeIdx + "']");
                            var domCols = $(that.s.dt.nTableWrapper).find("th[data-column-index='" + colResizeIdx + "']");
                            //If dx if positive (the width is getting larger) shrink the neighbour columns first
                            if(dx>0) {
                                domNeighbourCols.width(that.s.mouse.neighbourColumn.width);
                                domCols.width(that.s.mouse.targetColumn.width);
                            } else {
                                //Apply the new width to the columns then to the neighbour columns
                                domCols.width(that.s.mouse.targetColumn.width);
                                domNeighbourCols.width(that.s.mouse.neighbourColumn.width);
                            }
                        }
                    }
                }
                that.s.mouse.startX = e.pageX;
            },

            /**
             * Check to see if the mouse is over the resize handle area
             * @param e
             * @param nTh
             */
            "_fnResizeHandleCheck": function (e, nTh) {
                var that = this;

                var offset = $(nTh).offset();
                var relativeX = (e.pageX - offset.left);
                var relativeY = (e.pageY - offset.top);
                var distFromLeft = relativeX;
                var distFromRight = $(nTh).outerWidth() - relativeX - 1;

                var handleBuffer = this.s.init.handleWidth / 2;
                var leftHandleOn = distFromLeft < handleBuffer;
                var rightHandleOn = distFromRight < handleBuffer;

                //If this is the first table cell
                if ($(nTh).prev("th").length == 0) {
                    if(this.s.init.rtl)
                        rightHandleOn = false;
                    else
                        leftHandleOn = false;
                }
                //If this is the last cell and the table is fixed width don't let them expand the last cell directly
                if ($(nTh).next("th").length == 0 && this.s.init.tableWidthFixed) {
                    if(this.s.init.rtl)
                        leftHandleOn = false;
                    else
                        rightHandleOn = false;
                }

                var resizeAvailable = leftHandleOn||rightHandleOn;

                //If table is in right to left mode flip which TH is being resized
                if (that.s.init.rtl) {
                    //Handle is to the left
                    if (leftHandleOn) {
                        that.dom.resizeCol = $(nTh);
                        that.dom.resizeColNeighbour = $(nTh).next();
                    } else if (rightHandleOn) {
                        that.dom.resizeCol = $(nTh).prev();
                        that.dom.resizeColNeighbour = $(nTh);
                    }
                } else {
                    //Handle is to the right
                    if (rightHandleOn) {
                        that.dom.resizeCol = $(nTh);
                        that.dom.resizeColNeighbour = $(nTh).next();
                    } else if (leftHandleOn) {
                        that.dom.resizeCol = $(nTh).prev();
                        that.dom.resizeColNeighbour = $(nTh);
                    }
                }

                //If table width is fixed make sure both columns are resizable else just check the one.
                if(this.s.init.tableWidthFixed)
                    resizeAvailable &= this.s.init.exclude.indexOf(parseInt($(that.dom.resizeCol).attr("data-column-index"))) == -1 && this.s.init.exclude.indexOf(parseInt($(that.dom.resizeColNeighbour).attr("data-column-index"))) == -1;
                else
                    resizeAvailable &= this.s.init.exclude.indexOf(parseInt($(that.dom.resizeCol).attr("data-column-index"))) == -1;

                $(nTh).off('mousedown.ColResize');
                if (resizeAvailable) {
                    $(nTh).css("cursor", "ew-resize");

                    //Delay other mousedown events from the Reorder plugin
                    that._fnDelayEvents(null, nTh, "mousedown", "ColReorder");
                    that._fnDelayEvents("click", nTh, "click", "DT");

                    $(nTh).off('mousedown.ColResize').on('mousedown.ColResize', function (e) {
                        e.preventDefault();
                        that._fnMouseDown.call(that, e, nTh);
                    })
                        .off('click.ColResize').on('click.ColResize', function (e) {
                            that._fnClick.call(that, e);
                        });
                } else {
                    $(nTh).css("cursor", "pointer");
                    $(nTh).off('mousedown.ColResize click.ColResize');
                    //Restore any events that were removed
                    that._fnRestoreEvents();
                    //This is to restore column sorting on click functionality
                    if (!that.s.isMousedown)
                    //Restore click event if mouse is not down
                        this._fnRestoreEvents("click");
                }
            },

            "_fnClick": function (e) {
                var that = this;
                that.s.isMousedown = false;
                e.stopImmediatePropagation();
            },

            /**
             * Finish off the mouse drag
             *  @method  _fnMouseUp
             *  @param   e Mouse event
             *  @returns void
             *  @private
             */
            "_fnMouseUp": function (e) {
                var that = this;
                that.s.isMousedown = false;

                //Fix width of column to be the size the dom is limited to (for when user sets min-width on a column)
                that.s.mouse.targetColumn.width = that.dom.resizeCol.width();

                $(document).off('mousemove.ColResize mouseup.ColResize');
                this.s.dt.oInstance.fnAdjustColumnSizing();
                //Table width fix, prevents extra gaps between tables
                var LeftWrapper = $(that.s.dt.nTableWrapper).find(".DTFC_LeftWrapper");
                var DTFC_LeftWidth = LeftWrapper.width();
                LeftWrapper.children(".DTFC_LeftHeadWrapper").children("table").width(DTFC_LeftWidth);

                if (that.s.init.resizeCallback) {
                    that.s.init.resizeCallback.call(that, that.s.mouse.targetColumn);
                }
            },

            /**
             * Clean up ColResize memory references and event handlers
             *  @method  _fnDestroy
             *  @returns void
             *  @private
             */
            "_fnDestroy": function () {
                var i, iLen;

                for (i = 0, iLen = this.s.dt.aoDrawCallback.length; i < iLen; i++) {
                    if (this.s.dt.aoDrawCallback[i].sName === 'ColResize_Pre') {
                        this.s.dt.aoDrawCallback.splice(i, 1);
                        break;
                    }
                }

                $(this.s.dt.nTHead).find('*').off('.ColResize');

                $.each(this.s.dt.aoColumns, function (i, column) {
                    $(column.nTh).removeAttr('data-column-index');
                });

                this.s.dt._colResize = null;
                this.s = null;
            },

            /**
             * Add a data attribute to the column headers, so we know the index of
             * the row to be reordered. This allows fast detection of the index, and
             * for this plug-in to work with FixedHeader which clones the nodes.
             *  @private
             */
            "_fnSetColumnIndexes": function () {
                $.each(this.s.dt.aoColumns, function (i, column) {
                    $(column.nTh).attr('data-column-index', i);
                });
            }
        };

        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * Static parameters
         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

        /**
         * ColResize default settings for initialisation
         *  @namespace
         *  @static
         */
        ColResize.defaults = {
            /**
             * Callback function that is fired when columns are resized
             *  @type function():void
             *  @default null
             *  @static
             */
            "resizeCallback": null,

            /**
             * Exclude array for columns that are not resizable
             *  @property exclude
             *  @type     array of indexes that are excluded from resizing
             *  @default  []
             */
            "exclude": [],

            /**
             * Check to see if user is using a fixed table width or dynamic
             * if true:
             *      -Columns will resize themselves and their neighbour
             *      -If neighbour is excluded resize will not occur
             * if false:
             *      -Columns will resize themselves and increase or decrease the width of the table accordingly
             */
            "tableWidthFixed": true,

            /**
             * Width of the resize handle in pixels
             *  @property handleWidth
             *  @type     int (pixels)
             *  @default  10
             */
            "handleWidth": 10,

            /**
             * Right to left support, when true flips which column they are resizing on mouse down
             *  @property rtl
             *  @type     bool
             *  @default  false
             */
            "rtl": false
        };

        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * Constants
         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

        /**
         * ColResize version
         *  @constant  version
         *  @type      String
         *  @default   As code
         */
        ColResize.version = "0.0.8";

        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * DataTables interfaces
         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

        // Expose
        $.fn.dataTable.ColResize = ColResize;
        $.fn.DataTable.ColResize = ColResize;

        // Register a new feature with DataTables
        if (typeof $.fn.dataTable == "function" &&
            typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
            $.fn.dataTableExt.fnVersionCheck('1.9.3')) {
            $.fn.dataTableExt.aoFeatures.push({
                "fnInit": function (settings) {
                    var table = settings.oInstance;

                    if (!settings._colResize) {
                        var dtInit = settings.oInit;
                        var opts = dtInit.colResize || dtInit.oColResize || {};

                        new ColResize(settings, opts);
                    }
                    else {
                        table.oApi._fnLog(settings, 1, "ColResize attempted to initialise twice. Ignoring second");
                    }

                    return null;
                    /* No node for DataTables to insert */
                },
                "cFeature": "Z",
                "sFeature": "ColResize"
            });
        } else {
            alert("Warning: ColResize requires DataTables 1.9.3 or greater - www.datatables.net/download");
        }

// API augmentation
        if ($.fn.dataTable.Api) {
            $.fn.dataTable.Api.register('colResize.reset()', function () {
                return this.iterator('table', function (ctx) {
                    ctx._colResize.fnReset();
                });
            });
        }

        return ColResize;
    }; // /factory

// Define as an AMD module if possible
    if ( typeof define === 'function' && define.amd ) {
        define( ['jquery', 'datatables'], factory );
    }
    else if ( typeof exports === 'object' ) {
        // Node/CommonJS
        factory( require('jquery'), require('datatables') );
    }
    else if (jQuery && !jQuery.fn.dataTable.ColResize) {
        // Otherwise simply initialise as normal, stopping multiple evaluation
        factory(jQuery, jQuery.fn.dataTable);
    }

})(window, document);


text:
package org.apache.nifi.xml.processing.stream;

import org.apache.nifi.xml.processing.ProcessingException;

import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.stream.StreamSource;
import java.util.Objects;

/**
 * Standard implementation of XMLStreamReader provider with secure processing enabled
 */
public class StandardXMLEventReaderProvider implements XMLEventReaderProvider {
    /**
     * Get XML Event Reader
     *
     * @param streamSource Stream Source for Reader
     * @return Configured XML Event Reader
     */
    @Override
    public XMLEventReader getEventReader(final StreamSource streamSource) {
        Objects.requireNonNull(streamSource, "StreamSource required");

        final XMLInputFactory inputFactory = XMLInputFactory.newFactory();
        inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
        inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);

        try {
            return inputFactory.createXMLEventReader(streamSource);
        } catch (final XMLStreamException e) {
            throw new ProcessingException("Reader creation failed", e);
        }
    }
}


text:
cask "dropbox-passwords" do
  version "8.2.12"
  sha256 "f891e724be047cc3fef0d6804ad3e979a28b9cebd6c37ba49920395522eeb419"

  url "https://clientupdates.dropboxstatic.com/dbx-releng/dropbox_passwords/mac/DropboxPasswords_#{version}.dmg",
      verified: "clientupdates.dropboxstatic.com/"
  name "Dropbox Passwords"
  desc "Password manager that syncs across devices"
  homepage "https://www.dropbox.com/features/security/passwords"

  livecheck do
    url "https://www.dropbox.com/dropbox-passwords-download/mac/stable"
    strategy :sparkle
  end

  depends_on macos: ">= :sierra"

  app "Dropbox Passwords.app"
end


text:
package org.voovan.tools.bucket;

import org.voovan.tools.TEnv;
import org.voovan.tools.hashwheeltimer.HashWheelTask;

import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 无锁令牌桶
 *
 * @author helyho
 * DBase Framework.
 * WebSite: https://github.com/helyho/DBase
 * Licence: Apache v2 License
 */
public class TokenBucket extends Bucket{

    private AtomicInteger atomicInteger = new AtomicInteger(0);
    private long lastVisitTime = System.currentTimeMillis();
    private int releaseTime = Integer.MAX_VALUE;

    /**
     * 令牌桶构造函数
     * @param tokenSize 令牌桶默认大小, 每个时间周期新增的量
     * @param interval 令牌桶的新增周期, 每次触发新增一个令牌到令牌桶, 单位: 秒
     * @param releaseTime 令牌桶失效并自动移除的时间
     */
    public TokenBucket(int tokenSize, int interval, int releaseTime){
        init(tokenSize, interval, releaseTime);
    }

    /**
     * 令牌桶构造函数
     * @param tokenSize 令牌桶默认大小
     * @param interval 令牌桶的新增周期, 每次触发新增一个令牌到令牌桶, 单位: 秒
     */
    public TokenBucket(int tokenSize, int interval){
        init(tokenSize, interval, Integer.MAX_VALUE);
    }

    /**
     * 令牌桶构造函数
     * @param tokenSize 令牌桶默认大小
     * @param interval 令牌桶的新增周期, 每次触发新增一个令牌到令牌桶, 单位: 秒
     * @param releaseTime 令牌存活自动释放时间
     */
    public void init(int tokenSize, int interval, int releaseTime){
        this.releaseTime = releaseTime;

        this.hashWheelTask = new HashWheelTask() {
            @Override
            public void run() {
                if (System.currentTimeMillis() - lastVisitTime >= releaseTime) {
                    this.cancel();
                } else {
                    atomicInteger.getAndUpdate((val) -> {
                        int newSize = val + tokenSize;
                        return newSize >= tokenSize ? tokenSize : newSize;
                    });
                }
            }
        };

        atomicInteger.set(tokenSize);
        //刷新令牌桶的任务
        Bucket.BUCKET_HASH_WHEEL_TIMER.addTask(hashWheelTask, interval);
    }

    public int getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(int releaseTime) {
        this.releaseTime = releaseTime;
    }

    /**
     * 获取令牌, 立即返回
     * @return true: 拿到令牌, false: 没有拿到令牌
     */
    public boolean acquire() {
        lastVisitTime = System.currentTimeMillis();
        int value = atomicInteger.getAndUpdate((val) -> {
            if(val <= 0){
                return 0;
            } else {
                return val-1;
            }
        });

        return value > 0 ;
    }

    /**
     * 获取令牌, 带有时间等待
     * @param timeout 等待时间
     * @throws TimeoutException 超时异常
     */
    public void acquire(int timeout) throws TimeoutException {
        lastVisitTime = System.currentTimeMillis();
        TEnv.wait(timeout, ()->!acquire());
    }
}


text:
package quasar.yggdrasil.bytecode

import org.scalacheck._
import Gen._

trait RandomLibrary extends Library {

  private lazy val genMorphism1 = for {
    op <- choose(0, 1000)
    n  <- identifier
    ns <- listOfN(2, identifier)
  } yield Morphism1(Vector(ns: _*), n, op)

  private lazy val genMorphism2 = for {
    op <- choose(0, 1000)
    n  <- identifier
    ns <- listOfN(2, identifier)
  } yield Morphism2(Vector(ns: _*), n, op)

  private lazy val genOp1 = for {
    op <- choose(0, 1000)
    n  <- identifier
    ns <- listOfN(2, identifier)
  } yield Op1(Vector(ns: _*), n, op)

  private lazy val genOp2 = for {
    op <- choose(0, 1000)
    n  <- identifier
    ns <- listOfN(2, identifier)
  } yield Op2(Vector(ns: _*), n, op)

  private lazy val genReduction = for {
    op <- choose(0, 1000)
    n  <- identifier
    ns <- listOfN(2, identifier)
  } yield Reduction(Vector(ns: _*), n, op)

  val reductions = Set(
    Reduction(Vector(), "count", 0x2000),
    Reduction(Vector(), "max", 0x2001),
    Reduction(Vector(), "min", 0x2004),
    Reduction(Vector(), "sum", 0x2002),
    Reduction(Vector(), "mean", 0x2013),
    Reduction(Vector(), "geometricMean", 0x2003),
    Reduction(Vector(), "sumSq", 0x2005),
    Reduction(Vector(), "variance", 0x2006),
    Reduction(Vector(), "stdDev", 0x2007),
    Reduction(Vector(), "median", 0x2008),
    Reduction(Vector(), "mode", 0x2009))

  lazy val libMorphism1 = containerOfN[Set, Morphism1](30, genMorphism1).sample.get.map(op => (op.opcode, op)).toMap.values.toSet //make sure no duplicate opcodes
  lazy val libMorphism2 = containerOfN[Set, Morphism2](30, genMorphism2).sample.get.map(op => (op.opcode, op)).toMap.values.toSet //make sure no duplicate opcodes
  lazy val lib1 = containerOfN[Set, Op1](30, genOp1).sample.get.map(op => (op.opcode, op)).toMap.values.toSet //make sure no duplicate opcodes
  lazy val lib2 = containerOfN[Set, Op2](30, genOp2).sample.get.map(op => (op.opcode, op)).toMap.values.toSet //make sure no duplicate opcodes
  lazy val libReduction = reductions ++ containerOfN[Set, Reduction](30, genReduction).sample.get.map(op => (op.opcode, op)).toMap.values.toSet //make sure no duplicate opcodes

  lazy val expandGlob = Morphism1(Vector("std", "fs"), "expandGlob", 0x0004)

  case class Morphism1(namespace: Vector[String], name: String, opcode: Int) extends Morphism1Like {
    val tpe = UnaryOperationType(JType.JUniverseT, JType.JUniverseT)
    val rowLevel: Boolean = false
  }

  case class Morphism2(namespace: Vector[String], name: String, opcode: Int) extends Morphism2Like {
    val tpe = BinaryOperationType(JType.JUniverseT, JType.JUniverseT, JType.JUniverseT)
    val rowLevel: Boolean = false
  }

  case class Op1(namespace: Vector[String], name: String, opcode: Int) extends Op1Like with Morphism1Like {
    val tpe = UnaryOperationType(JType.JUniverseT, JType.JUniverseT)
    val rowLevel: Boolean = true
  }

  case class Op2(namespace: Vector[String], name: String, opcode: Int) extends Op2Like with Morphism2Like {
    val tpe = BinaryOperationType(JType.JUniverseT, JType.JUniverseT, JType.JUniverseT)
    val rowLevel: Boolean = true
  }

  case class Reduction(namespace: Vector[String], name: String, opcode: Int) extends ReductionLike with Morphism1Like {
    val tpe = UnaryOperationType(JType.JUniverseT, JType.JUniverseT)
    val rowLevel: Boolean = false
  }
}