text:
- Deploying with `kubectl` has downsides:

  - we don't know *who* deployed *what* and *when*

  - there is no audit trail (except the API server logs)

  - there is no easy way to undo most operations

  - there is no review/approval process (like for code reviews)

- We have all these things for *code*, though

- Can we manage cluster state like we manage our source code?

---

## Reminder: Kubernetes is *declarative*

- All we do is create/change resources

- These resources have a perfect YAML representation

- All we do is manipulating these YAML representations

  (`kubectl run` generates a YAML file that gets applied)

- We can store these YAML representations in a code repository

- We can version that code repository and maintain it with best practices

  - define which branch(es) can go to qa/staging/production

  - control who can push to which branches

  - have formal review processes, pull requests ...

---

## Enabling git-based workflows

- There are a few tools out there to help us do that

- We'll see demos of two of them: [Flux] and [Gitkube]

- There are *many* other tools, some of them with even more features

- There are also *many* integrations with popular CI/CD systems

  (e.g.: GitLab, Jenkins, ...)

[Flux]: https://www.weave.works/oss/flux/
[Gitkube]: https://gitkube.sh/

---

## Flux overview

- We put our Kubernetes resources as YAML files in a git repository

- Flux polls that repository regularly (every 5 minutes by default)

- The resources described by the YAML files are created/updated automatically

- Changes are made by updating the code in the repository

---

## Preparing a repository for Flux

- We need a repository with Kubernetes YAML files

- I have one: https://github.com/jpetazzo/kubercoins

- Fork it to your GitHub account

- Create a new branch in your fork; e.g. `prod`

  (e.g. by adding a line in the README through the GitHub web UI)

- This is the branch that we are going to use for deployment

---

## Setting up Flux

- Clone the Flux repository:
  ```
  git clone https://github.com/fluxcd/flux
  ```

- Edit `deploy/flux-deployment.yaml`

- Change the `--git-url` and `--git-branch` parameters:
  ```yaml
  - --git-url=git@github.com:your-git-username/kubercoins
  - --git-branch=prod
  ```

- Apply all the YAML:
  ```
  kubectl apply -f deploy/
  ```

---

## Allowing Flux to access the repository

- When it starts, Flux generates an SSH key

- Display that key:
  ```
  kubectl logs deployment/flux | grep identity
  ```

- Then add that key to the repository, giving it **write** access

  (some Flux features require write access)

- After a minute or so, DockerCoins will be deployed to the current namespace

---

## Making changes

- Make changes (on the `prod` branch), e.g. change `replicas` in `worker`

- After a few minutes, the changes will be picked up by Flux and applied

---

## Other features

- Flux can keep a list of all the tags of all the images we're running

- The `fluxctl` tool can show us if we're running the latest images

- We can also "automate" a resource (i.e. automatically deploy new images)

- And much more!

---

## Gitkube overview

- We put our Kubernetes resources as YAML files in a git repository

- Gitkube is a git server (or "git remote")

- After making changes to the repository, we push to Gitkube

- Gitkube applies the resources to the cluster

---

## Setting up Gitkube

- Install the CLI:
  ```
  sudo curl -L -o /usr/local/bin/gitkube \
       https://github.com/hasura/gitkube/releases/download/v0.2.1/gitkube_linux_amd64
  sudo chmod +x /usr/local/bin/gitkube
  ```

- Install Gitkube on the cluster:
  ```
  gitkube install --expose ClusterIP
  ```

---

## Creating a Remote

- Gitkube provides a new type of API resource: *Remote*

  (this is using a mechanism called Custom Resource Definitions or CRD)

- Create and apply a YAML file containing the following manifest:
  ```yaml
	apiVersion: gitkube.sh/v1alpha1
	kind: Remote
	metadata:
	  name: example
	spec:
	  authorizedKeys:
	  - `ssh-rsa AAA...`
	  manifests:
	    path: "."
  ```

  (replace the `ssh-rsa AAA...` section with the content of `~/.ssh/id_rsa.pub`)

---

## Pushing to our remote

- Get the `gitkubed` IP address:
  ```
  kubectl -n kube-system get svc gitkubed
  IP=$(kubectl -n kube-system get svc gitkubed -o json |
  	   jq -r .spec.clusterIP)
  ```

- Get ourselves a sample repository with resource YAML files:
  ```
  git clone git://github.com/jpetazzo/kubercoins
  cd kubercoins
  ```

- Add the remote and push to it:
  ```
  git remote add k8s ssh://default-example@$IP/~/git/default-example
  git push k8s master
  ```

---

## Making changes

- Edit a local file

- Commit

- Push!

- Make sure that you push to the `k8s` remote

---

## Other features

- Gitkube can also build container images for us

  (see the [documentation](https://github.com/hasura/gitkube/blob/master/docs/remote.md) for more details)

- Gitkube can also deploy Helm charts

  (instead of raw YAML files)

???

:EN:- GitOps
:FR:- GitOps


text:
require 'rails_helper'

RSpec.describe "todos/index", type: :view do
  before(:each) do
    assign(:todos, [
      Todo.create!(
        :title => "Title",
        :completed => false
      ),
      Todo.create!(
        :title => "Title",
        :completed => false
      )
    ])
  end

  it "renders a list of todos" do
    render
    assert_select "tr>td", :text => "Title".to_s, :count => 2
    assert_select "tr>td", :text => false.to_s, :count => 2
  end
end

redpajama_set_name: RedPajamaGithub


text:
import {IAction} from "./Action";
export class ActionComputer {

    init() {
        //READ all actions

    }

    compute(action: IAction) {

    }

    update() {
        //Update all actions
    }
}


text:
package org.eclipse.mat.hprof;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.mat.SnapshotException;
import org.eclipse.mat.collect.IteratorLong;
import org.eclipse.mat.hprof.extension.IParsingEnhancer;
import org.eclipse.mat.hprof.ui.HprofPreferences;
import org.eclipse.mat.parser.IIndexBuilder;
import org.eclipse.mat.parser.IPreliminaryIndex;
import org.eclipse.mat.parser.index.IIndexReader.IOne2LongIndex;
import org.eclipse.mat.parser.index.IndexWriter;
import org.eclipse.mat.util.IProgressListener;
import org.eclipse.mat.util.MessageUtil;
import org.eclipse.mat.util.SimpleMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HprofIndexBuilder implements IIndexBuilder {

	protected static final Logger LOGGER = LoggerFactory.getLogger(HprofIndexBuilder.class);

	private File file;
	private String prefix;
	private IOne2LongIndex id2position;
	private List<IParsingEnhancer> enhancers;

	@Override
	public void init(File file, String prefix) {
		this.file = file;
		this.prefix = prefix;

		this.enhancers = new ArrayList<IParsingEnhancer>();
		// for (EnhancerRegistry.Enhancer enhancer : EnhancerRegistry.instance().delegates())
		// {
		// IParsingEnhancer parsingEnhancer = enhancer.parser();
		// if (parsingEnhancer != null)
		// this.enhancers.add(parsingEnhancer);
		// }

	}

	@Override
	public void fill(IPreliminaryIndex preliminary, IProgressListener listener) throws SnapshotException, IOException {
		HprofPreferences.HprofStrictness strictnessPreference = HprofPreferences.getCurrentStrictness();

		SimpleMonitor monitor = new SimpleMonitor(MessageUtil.format(Messages.HprofIndexBuilder_Parsing,
				new Object[] { file.getAbsolutePath() }), listener, new int[] { 500, 1500 });

		listener.beginTask(MessageUtil.format(Messages.HprofIndexBuilder_Parsing, file.getName()), 3000);

		IHprofParserHandler handler = new HprofParserHandlerImpl();
		handler.beforePass1(preliminary.getSnapshotInfo());

		SimpleMonitor.Listener mon = (SimpleMonitor.Listener) monitor.nextMonitor();
		mon.beginTask(MessageUtil.format(Messages.HprofIndexBuilder_Scanning, new Object[] { file.getAbsolutePath() }),
				(int) (file.length() / 1000));
		Pass1Parser pass1 = new Pass1Parser(handler, mon, strictnessPreference);
		Serializable id = preliminary.getSnapshotInfo().getProperty("$runtimeId");
		String dumpNrToRead;
		if (id instanceof String) {
			dumpNrToRead = (String) id;
		} else {
			dumpNrToRead = pass1.determineDumpNumber();
		}
		pass1.read(file, dumpNrToRead);

		if (listener.isCanceled())
			throw new IProgressListener.OperationCanceledException();

		mon.done();

		handler.beforePass2(listener);

		mon = (SimpleMonitor.Listener) monitor.nextMonitor();
		mon.beginTask(
				MessageUtil.format(Messages.HprofIndexBuilder_ExtractingObjects,
						new Object[] { file.getAbsolutePath() }),
				(int) (file.length() / 1000));

		Pass2Parser pass2 = new Pass2Parser(handler, mon, strictnessPreference);
		pass2.read(file, dumpNrToRead);

		if (listener.isCanceled())
			throw new IProgressListener.OperationCanceledException();

		mon.done();

		if (listener.isCanceled())
			throw new IProgressListener.OperationCanceledException();

		for (IParsingEnhancer enhancer : enhancers)
			enhancer.onParsingCompleted(handler.getSnapshotInfo());

		id2position = handler.fillIn(preliminary);
	}

	@Override
	public void clean(final int[] purgedMapping, IProgressListener listener) throws IOException {

		// //////////////////////////////////////////////////////////////
		// object 2 hprof position
		// //////////////////////////////////////////////////////////////

		File indexFile = new File(prefix + "o2hprof.index");
		listener.subTask(
				MessageUtil.format(Messages.HprofIndexBuilder_Writing, new Object[] { indexFile.getAbsolutePath() }));
		IOne2LongIndex newIndex =
				new IndexWriter.LongIndexStreamer().writeTo(indexFile, new IndexIterator(id2position, purgedMapping));

		try {
			newIndex.close();
		} catch (IOException ignore) {
			LOGGER.trace("Ouch", ignore);
		}

		try {
			id2position.close();
		} catch (IOException ignore) {
			LOGGER.trace("Ouch", ignore);
		}

		id2position.delete();
		id2position = null;
	}

	@Override
	public void cancel() {
		if (id2position != null) {
			try {
				id2position.close();
			} catch (IOException ignore) {
				// $JL-EXC$
			}
			id2position.delete();
		}
	}

	private static final class IndexIterator implements IteratorLong {
		private final IOne2LongIndex id2position;
		private final int[] purgedMapping;
		private int nextIndex = -1;

		private IndexIterator(IOne2LongIndex id2position, int[] purgedMapping) {
			this.id2position = id2position;
			this.purgedMapping = purgedMapping;
			findNext();
		}

		@Override
		public boolean hasNext() {
			return nextIndex < purgedMapping.length;
		}

		@Override
		public long next() {
			long answer = id2position.get(nextIndex);
			findNext();
			return answer;
		}

		protected void findNext() {
			nextIndex++;
			while (nextIndex < purgedMapping.length && purgedMapping[nextIndex] < 0)
				nextIndex++;
		}
	}
}


text:
typedef NS_ENUM(NSInteger, TKCropAreaCornerPosition) {
    TKCropAreaCornerPositionTopLeft,
    TKCropAreaCornerPositionTopRight,
    TKCropAreaCornerPositionBottomLeft,
    TKCropAreaCornerPositionBottomRight
};
typedef NS_ENUM(NSInteger, TKMidLineType) {

    TKMidLineTypeTop,
    TKMidLineTypeBottom,
    TKMidLineTypeLeft,
    TKMidLineTypeRight

};
@interface UIImage(Handler)
@end
@implementation UIImage(Handler)
//Fix image's rotation
- (UIImage *)fixOrientation {

    if (self.imageOrientation == UIImageOrientationUp)
        return self;

    CGAffineTransform transform = CGAffineTransformIdentity;

    switch (self.imageOrientation) {
        case UIImageOrientationDown:
        case UIImageOrientationDownMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.width, self.size.height);
            transform = CGAffineTransformRotate(transform, M_PI);
            break;

        case UIImageOrientationLeft:
        case UIImageOrientationLeftMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.width, 0);
            transform = CGAffineTransformRotate(transform, M_PI_2);
            break;

        case UIImageOrientationRight:
        case UIImageOrientationRightMirrored:
            transform = CGAffineTransformTranslate(transform, 0, self.size.height);
            transform = CGAffineTransformRotate(transform, -M_PI_2);
            break;
        default:
            break;
    }
    switch (self.imageOrientation) {
        case UIImageOrientationUpMirrored:
        case UIImageOrientationDownMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.width, 0);
            transform = CGAffineTransformScale(transform, -1, 1);
            break;

        case UIImageOrientationLeftMirrored:
        case UIImageOrientationRightMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.height, 0);
            transform = CGAffineTransformScale(transform, -1, 1);
            break;
        default:
            break;
    }
    CGContextRef ctx = CGBitmapContextCreate(NULL, self.size.width, self.size.height,
                                             CGImageGetBitsPerComponent(self.CGImage), 0,
                                             CGImageGetColorSpace(self.CGImage),
                                             CGImageGetBitmapInfo(self.CGImage));
    CGContextConcatCTM(ctx, transform);
    switch (self.imageOrientation) {
        case UIImageOrientationLeft:
        case UIImageOrientationLeftMirrored:
        case UIImageOrientationRight:
        case UIImageOrientationRightMirrored:
            CGContextDrawImage(ctx, CGRectMake(0,0,self.size.height,self.size.width), self.CGImage);
            break;

        default:
            CGContextDrawImage(ctx, CGRectMake(0,0,self.size.width,self.size.height), self.CGImage);
            break;
    }
    CGImageRef cgimg = CGBitmapContextCreateImage(ctx);
    UIImage *img = [UIImage imageWithCGImage:cgimg];
    CGContextRelease(ctx);
    CGImageRelease(cgimg);
    return img;

}
- (UIImage *)imageAtRect:(CGRect)rect
{

    UIImage *fixedImage = [self fixOrientation];
    CGImageRef imageRef = CGImageCreateWithImageInRect([fixedImage CGImage], rect);
    UIImage* subImage = [UIImage imageWithCGImage: imageRef];
    CGImageRelease(imageRef);

    return subImage;

}
@end
@interface CornerView: UIView

@property (assign, nonatomic) CGFloat lineWidth;
@property (strong, nonatomic) UIColor *lineColor;
@property (assign, nonatomic) TKCropAreaCornerPosition cornerPosition;
@property (assign, nonatomic) CornerView *relativeViewX;
@property (assign, nonatomic) CornerView *relativeViewY;
@property (strong, nonatomic) CAShapeLayer *cornerShapeLayer;

- (void)updateSizeWithWidth: (CGFloat)width height: (CGFloat)height;
@end
@implementation CornerView
- (instancetype)initWithFrame:(CGRect)frame lineColor: (UIColor *)lineColor lineWidth: (CGFloat)lineWidth {

    self = [super initWithFrame: frame];
    if(self) {
        self.lineColor = lineColor;
        self.lineWidth = lineWidth;
    }
    return self;
}
- (void)setCornerPosition:(TKCropAreaCornerPosition)cornerPosition {

    _cornerPosition = cornerPosition;
    [self drawCornerLines];

}
- (void)setLineWidth:(CGFloat)lineWidth {

    _lineWidth = lineWidth;
    [self drawCornerLines];

}
- (void)drawCornerLines {

    if(_cornerShapeLayer && _cornerShapeLayer.superlayer) {
        [_cornerShapeLayer removeFromSuperlayer];
    }
    _cornerShapeLayer = [CAShapeLayer layer];
    _cornerShapeLayer.lineWidth = _lineWidth;
    _cornerShapeLayer.strokeColor = _lineColor.CGColor;
    _cornerShapeLayer.fillColor = [UIColor clearColor].CGColor;

    UIBezierPath *cornerPath = [UIBezierPath bezierPath];
    CGFloat paddingX = _lineWidth / 2.0f;
    CGFloat paddingY = _lineWidth / 2.0f;
    switch (_cornerPosition) {
        case TKCropAreaCornerPositionTopLeft: {
            [cornerPath moveToPoint:CGPointMake(WIDTH(self), paddingY)];
            [cornerPath addLineToPoint:CGPointMake(paddingX, paddingY)];
            [cornerPath addLineToPoint:CGPointMake(paddingX, HEIGHT(self))];
            break;
        }
        case TKCropAreaCornerPositionTopRight: {
            [cornerPath moveToPoint:CGPointMake(0, paddingY)];
            [cornerPath addLineToPoint:CGPointMake(WIDTH(self) - paddingX, paddingY)];
            [cornerPath addLineToPoint:CGPointMake(WIDTH(self) - paddingX, HEIGHT(self))];
            break;
        }
        case TKCropAreaCornerPositionBottomLeft: {
            [cornerPath moveToPoint:CGPointMake(paddingX, 0)];
            [cornerPath addLineToPoint:CGPointMake(paddingX, HEIGHT(self) - paddingY)];
            [cornerPath addLineToPoint:CGPointMake(WIDTH(self), HEIGHT(self) - paddingY)];
            break;
        }
        case TKCropAreaCornerPositionBottomRight: {
            [cornerPath moveToPoint:CGPointMake(WIDTH(self) - paddingX, 0)];
            [cornerPath addLineToPoint:CGPointMake(WIDTH(self) - paddingX, HEIGHT(self) - paddingY)];
            [cornerPath addLineToPoint:CGPointMake(0, HEIGHT(self) - paddingY)];
            break;
        }
        default:
            break;
    }
    _cornerShapeLayer.path = cornerPath.CGPath;
    [self.layer addSublayer: _cornerShapeLayer];

}
- (void)updateSizeWithWidth: (CGFloat)width height: (CGFloat)height {

    switch (_cornerPosition) {
        case TKCropAreaCornerPositionTopLeft: {
            self.frame = CGRectMake(MINX(self), MINY(self), width, height);
            break;
        }
        case TKCropAreaCornerPositionTopRight: {
            self.frame = CGRectMake(MAXX(self) - width, MINY(self), width, height);
            break;
        }
        case TKCropAreaCornerPositionBottomLeft: {
            self.frame = CGRectMake(MINX(self), MAXY(self) - height, width, height);
            break;
        }
        case TKCropAreaCornerPositionBottomRight: {
            self.frame = CGRectMake(MAXX(self) - width, MAXY(self) - height, width, height);
            break;
        }
        default:
            break;
    }
    [self drawCornerLines];

}
- (void)setLineColor:(UIColor *)lineColor {

    _lineColor = lineColor;
    _cornerShapeLayer.strokeColor = lineColor.CGColor;

}
@end

@interface MidLineView : UIView
@property (strong, nonatomic) CAShapeLayer *lineLayer;
@property (assign, nonatomic) CGFloat lineWidth;
@property (assign, nonatomic) CGFloat lineHeight;
@property (strong, nonatomic) UIColor *lineColor;
@property (assign, nonatomic) TKMidLineType type;
@end
@implementation MidLineView
- (instancetype)initWithLineWidth: (CGFloat)lineWidth lineHeight: (CGFloat)lineHeight lineColor: (UIColor *)lineColor {

    self = [super initWithFrame: CGRectMake(0, 0, MID_LINE_INTERACT_WIDTH, MID_LINE_INTERACT_HEIGHT)];
    if(self) {
        self.lineWidth = lineWidth;
        self.lineHeight = lineHeight;
        self.lineColor = lineColor;
    }
    return self;

}
- (void)setType:(TKMidLineType)type {

    _type = type;
    [self drawMidLine];

}
- (void)setLineWidth:(CGFloat)lineWidth {

    _lineWidth = lineWidth;
    [self drawMidLine];

}
- (void)setLineColor:(UIColor *)lineColor {

    _lineColor = lineColor;
    _lineLayer.strokeColor = lineColor.CGColor;

}
- (void)setLineHeight:(CGFloat)lineHeight {

    _lineHeight = lineHeight;
    _lineLayer.lineWidth = lineHeight;

}
- (void)drawMidLine {

    if(_lineLayer && _lineLayer.superlayer) {
        [_lineLayer removeFromSuperlayer];
    }
    _lineLayer = [CAShapeLayer layer];
    _lineLayer.strokeColor = _lineColor.CGColor;
    _lineLayer.lineWidth = _lineHeight;
    _lineLayer.fillColor = [UIColor clearColor].CGColor;

    UIBezierPath *midLinePath = [UIBezierPath bezierPath];
    switch (_type) {
        case TKMidLineTypeTop:
        case TKMidLineTypeBottom: {
            [midLinePath moveToPoint:CGPointMake((WIDTH(self) - _lineWidth) / 2.0, HEIGHT(self) / 2.0)];
            [midLinePath addLineToPoint:CGPointMake((WIDTH(self) + _lineWidth) / 2.0, HEIGHT(self) / 2.0)];
            break;
        }
        case TKMidLineTypeRight:
        case TKMidLineTypeLeft: {
            [midLinePath moveToPoint:CGPointMake(WIDTH(self) / 2.0, (HEIGHT(self) - _lineWidth) / 2.0)];
            [midLinePath addLineToPoint:CGPointMake(WIDTH(self) / 2.0, (HEIGHT(self) + _lineWidth) / 2.0)];
            break;
        }
        default:
            break;
    }
    _lineLayer.path = midLinePath.CGPath;
    [self.layer addSublayer: _lineLayer];

}
@end

@interface CropAreaView : UIView
@property (strong, nonatomic) CAShapeLayer *crossLineLayer;
@property (assign, nonatomic) CGFloat crossLineWidth;
@property (strong, nonatomic) UIColor *crossLineColor;
@property (strong, nonatomic) UIColor *borderColor;
@property (assign, nonatomic) CGFloat borderWidth;
@property (strong, nonatomic) CAShapeLayer *borderLayer;
@property (assign, nonatomic) BOOL showCrossLines;
@end
@implementation CropAreaView

- (instancetype)init {

    self = [super init];
    if(self) {
        [self createBorderLayer];
    }
    return self;
}
- (void)setFrame:(CGRect)frame {

    [super setFrame: frame];
    if(_showCrossLines) {
        [self showCrossLineLayer];
    }
    [self resetBorderLayerPath];

}
- (void)setBounds:(CGRect)bounds {

    [super setBounds:bounds];
    if(_showCrossLines) {
        [self showCrossLineLayer];
    }
    [self resetBorderLayerPath];

}
- (void)showCrossLineLayer {

    UIBezierPath *path = [UIBezierPath bezierPath];
    [path moveToPoint:CGPointMake(WIDTH(self) / 3.0, 0)];
    [path addLineToPoint: CGPointMake(WIDTH(self) / 3.0, HEIGHT(self))];
    [path moveToPoint:CGPointMake(WIDTH(self) / 3.0 * 2.0, 0)];
    [path addLineToPoint: CGPointMake(WIDTH(self) / 3.0 * 2.0, HEIGHT(self))];
    [path moveToPoint:CGPointMake(0, HEIGHT(self) / 3.0)];
    [path addLineToPoint: CGPointMake(WIDTH(self), HEIGHT(self) / 3.0)];
    [path moveToPoint:CGPointMake(0, HEIGHT(self) / 3.0 * 2.0)];
    [path addLineToPoint: CGPointMake(WIDTH(self), HEIGHT(self) / 3.0 * 2.0)];
    if(!_crossLineLayer) {
        _crossLineLayer = [CAShapeLayer layer];
        [self.layer addSublayer: _crossLineLayer];
    }
    _crossLineLayer.lineWidth = _crossLineWidth;
    _crossLineLayer.strokeColor = _crossLineColor.CGColor;
    _crossLineLayer.path = path.CGPath;

}
- (void)setCrossLineWidth:(CGFloat)crossLineWidth {

    _crossLineWidth = crossLineWidth;
    _crossLineLayer.lineWidth = crossLineWidth;

}
- (void)setCrossLineColor:(UIColor *)crossLineColor {

    _crossLineColor = crossLineColor;
    _crossLineLayer.strokeColor = crossLineColor.CGColor;

}
- (void)setShowCrossLines:(BOOL)showCrossLines {

    if(_showCrossLines && !showCrossLines) {
        [_crossLineLayer removeFromSuperlayer];
        _crossLineLayer = nil;
    }
    else if(!_showCrossLines && showCrossLines) {
        [self showCrossLineLayer];
    }
    _showCrossLines = showCrossLines;

}
- (void)createBorderLayer {

    if(_borderLayer && _borderLayer.superlayer) {
        [_borderLayer removeFromSuperlayer];
    }
    _borderLayer = [CAShapeLayer layer];
    [self.layer addSublayer: _borderLayer];

}
- (void)resetBorderLayerPath {

    UIBezierPath *layerPath = [UIBezierPath bezierPathWithRect: CGRectMake(_borderWidth / 2.0f, _borderWidth / 2.0f, WIDTH(self) - _borderWidth, HEIGHT(self) - _borderWidth)];
    _borderLayer.lineWidth = _borderWidth;
    _borderLayer.fillColor = nil;
    _borderLayer.path = layerPath.CGPath;

}
- (void)setBorderWidth:(CGFloat)borderWidth {

    _borderWidth = borderWidth;
    [self resetBorderLayerPath];

}
- (void)setBorderColor:(UIColor *)borderColor {

    _borderColor = borderColor;
    _borderLayer.strokeColor = borderColor.CGColor;

}
- (UIView *) hitTest:(CGPoint) point withEvent:(UIEvent *)event {

    for(UIView *subView in self.subviews) {
        if(CGRectContainsPoint(subView.frame, point)) {
            return subView;
        }
    }
    if(CGRectContainsPoint(self.bounds, point)) {
        return self;
    }
    return nil;

}
@end
@interface TKImageView() {

    CGFloat currentMinSpace;

}
@property (strong, nonatomic) UIView *cropMaskView;
@property (strong, nonatomic) UIImageView *imageView;
@property (strong, nonatomic) CornerView *topLeftCorner;
@property (strong, nonatomic) CornerView *topRightCorner;
@property (strong, nonatomic) CornerView *bottomLeftCorner;
@property (strong, nonatomic) CornerView *bottomRightCorner;
@property (strong, nonatomic) CropAreaView *cropAreaView;
@property (strong, nonatomic) UIPanGestureRecognizer *topLeftPan;
@property (strong, nonatomic) UIPanGestureRecognizer *topRightPan;
@property (strong, nonatomic) UIPanGestureRecognizer *bottomLeftPan;
@property (strong, nonatomic) UIPanGestureRecognizer *bottomRightPan;
@property (strong, nonatomic) UIPanGestureRecognizer *cropAreaPan;
@property (strong, nonatomic) UIPinchGestureRecognizer *cropAreaPinch;
@property (assign, nonatomic) CGSize pinchOriSize;
@property (assign, nonatomic) CGPoint cropAreaOriCenter;
@property (assign, nonatomic) CGRect cropAreaOriFrame;
@property (strong, nonatomic) MidLineView *topMidLine;
@property (strong, nonatomic) MidLineView *leftMidLine;
@property (strong, nonatomic) MidLineView *bottomMidLine;
@property (strong, nonatomic) MidLineView *rightMidLine;
@property (strong, nonatomic) UIPanGestureRecognizer *topMidPan;
@property (strong, nonatomic) UIPanGestureRecognizer *bottomMidPan;
@property (strong, nonatomic) UIPanGestureRecognizer *leftMidPan;
@property (strong, nonatomic) UIPanGestureRecognizer *rightMidPan;
@property (assign, nonatomic) CGFloat paddingLeftRight;
@property (assign, nonatomic) CGFloat paddingTopBottom;
@property (assign, nonatomic) CGFloat imageAspectRatio;
@property (assign, nonatomic, readonly) CGFloat cornerMargin;
@end
@implementation TKImageView

- (instancetype)initWithFrame:(CGRect)frame {

    self = [super initWithFrame: frame];
    if(self) {
        [self commonInit];
    }
    return self;

}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {

    self = [super initWithCoder: aDecoder];
    if(self) {
        [self commonInit];
    }
    return self;

}
- (void)commonInit {

    [self setUp];
    [self createCorners];
    [self resetCropAreaOnCornersFrameChanged];
    [self bindPanGestures];

}
- (void)dealloc {

    [_cropAreaView removeObserver: self forKeyPath: @"frame"];
    [_cropAreaView removeObserver: self forKeyPath: @"center"];
    [_imageView removeObserver: self forKeyPath: @"frame"];

}
- (void)setUp {

    _imageView = [[UIImageView alloc]initWithFrame: self.bounds];
    _imageView.contentMode = UIViewContentModeScaleToFill;
    _imageView.userInteractionEnabled = YES;
    _imageAspectRatio = 0;
    [self addSubview: _imageView];

    _cropMaskView = [[UIView alloc]initWithFrame: _imageView.bounds];
    _cropMaskView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.8];
    _cropMaskView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [_imageView addSubview: _cropMaskView];

    UIColor *defaultColor = [UIColor colorWithWhite: 1 alpha: 0.8];
    _cropAreaBorderLineColor = defaultColor;
    _cropAreaCornerLineColor = [UIColor whiteColor];
    _cropAreaBorderLineWidth = 2;
    _cropAreaCornerLineWidth = 4;
    _cropAreaCornerWidth = 20;
    _cropAreaCornerHeight = 20;
    _cropAspectRatio = 0;
    _minSpace = 10;
    currentMinSpace = _minSpace;
    _cropAreaCrossLineWidth = 2;
    _cropAreaCrossLineColor = defaultColor;
    _cropAreaMidLineWidth = 20;
    _cropAreaMidLineHeight = 4;
    _cropAreaMidLineColor = defaultColor;

    _cropAreaView = [[CropAreaView alloc] init];
    _cropAreaView.borderWidth = _cropAreaBorderLineWidth;
    _cropAreaView.borderColor = _cropAreaBorderLineColor;
    _cropAreaView.crossLineColor = _cropAreaCrossLineColor;
    _cropAreaView.crossLineWidth = _cropAreaCrossLineWidth;
    _cropAreaView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [_imageView addSubview: _cropAreaView];

    [_cropAreaView addObserver: self
                    forKeyPath: @"frame"
                       options: NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
                       context: NULL];
    [_cropAreaView addObserver: self
                    forKeyPath: @"center"
                       options: NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
                       context: NULL];
    [_imageView addObserver: self
                    forKeyPath: @"frame"
                       options: NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
                       context: NULL];

}
#pragma mark - PanGesture Bind
- (void)bindPanGestures {

    _topLeftPan = [[UIPanGestureRecognizer alloc]initWithTarget: self action: @selector(handleCornerPan:)];
    _topRightPan = [[UIPanGestureRecognizer alloc]initWithTarget: self action: @selector(handleCornerPan:)];
    _bottomLeftPan = [[UIPanGestureRecognizer alloc]initWithTarget: self action: @selector(handleCornerPan:)];
    _bottomRightPan = [[UIPanGestureRecognizer alloc]initWithTarget: self action: @selector(handleCornerPan:)];
    _cropAreaPan = [[UIPanGestureRecognizer alloc]initWithTarget: self action: @selector(handleCropAreaPan:)];

    [_topLeftCorner addGestureRecognizer: _topLeftPan];
    [_topRightCorner addGestureRecognizer: _topRightPan];
    [_bottomLeftCorner addGestureRecognizer: _bottomLeftPan];
    [_bottomRightCorner addGestureRecognizer: _bottomRightPan];
    [_cropAreaView addGestureRecognizer: _cropAreaPan];

}
#pragma mark - PinchGesture CallBack
- (void)handleCropAreaPinch: (UIPinchGestureRecognizer *)pinchGesture {

    switch (pinchGesture.state) {
        case UIGestureRecognizerStateBegan: {
            _pinchOriSize = _cropAreaView.frame.size;
            break;
        }
        case UIGestureRecognizerStateChanged: {
            [self resetCropAreaByScaleFactor: pinchGesture.scale];
            break;
        }
        default:
            break;
    }

}
#pragma mark - PanGesture CallBack
- (void)handleCropAreaPan: (UIPanGestureRecognizer *)panGesture {

    switch (panGesture.state) {
        case UIGestureRecognizerStateBegan: {
            _cropAreaOriCenter = _cropAreaView.center;
            break;
        }
        case UIGestureRecognizerStateChanged: {
            CGPoint translation = [panGesture translationInView: _imageView];
            CGPoint willCenter = CGPointMake(_cropAreaOriCenter.x + translation.x, _cropAreaOriCenter.y + translation.y);
            CGFloat centerMinX = WIDTH(_cropAreaView) / 2.0f + self.cornerMargin * _cornerBorderInImage ;
            CGFloat centerMaxX = WIDTH(_imageView) - WIDTH(_cropAreaView) / 2.0f - self.cornerMargin * _cornerBorderInImage;
            CGFloat centerMinY = HEIGHT(_cropAreaView) / 2.0f + self.cornerMargin * _cornerBorderInImage;
            CGFloat centerMaxY = HEIGHT(_imageView) - HEIGHT(_cropAreaView) / 2.0f - self.cornerMargin * _cornerBorderInImage;
            _cropAreaView.center = CGPointMake(MIN(MAX(centerMinX, willCenter.x), centerMaxX), MIN(MAX(centerMinY, willCenter.y), centerMaxY));
            [self resetCornersOnCropAreaFrameChanged];
            break;
        }
        default:
            break;
    }

}
- (void)handleMidPan: (UIPanGestureRecognizer *)panGesture {

    MidLineView *midLineView = (MidLineView *)panGesture.view;
    switch (panGesture.state) {
        case UIGestureRecognizerStateBegan: {
            _cropAreaOriFrame = _cropAreaView.frame;
            break;
        }
        case UIGestureRecognizerStateChanged: {
            CGPoint translation = [panGesture translationInView: _cropAreaView];
            switch (midLineView.type) {
                case TKMidLineTypeTop: {
                    CGFloat minHeight = currentMinSpace + (_cropAreaCornerHeight - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth) * 2;
                    CGFloat maxHeight = CGRectGetMaxY(_cropAreaOriFrame) - (_cropAreaCornerLineWidth - _cropAreaBorderLineWidth);
                    CGFloat willHeight = MIN(MAX(minHeight, CGRectGetHeight(_cropAreaOriFrame) - translation.y), maxHeight);
                    CGFloat deltaY = willHeight - CGRectGetHeight(_cropAreaOriFrame);
                    _cropAreaView.frame = CGRectMake(CGRectGetMinX(_cropAreaOriFrame), CGRectGetMinY(_cropAreaOriFrame) - deltaY, CGRectGetWidth(_cropAreaOriFrame), willHeight);
                    break;
                }
                case TKMidLineTypeBottom: {
                    CGFloat minHeight = currentMinSpace + (_cropAreaCornerHeight - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth) * 2;
                    CGFloat maxHeight = HEIGHT(_imageView) - CGRectGetMinY(_cropAreaOriFrame) - (_cropAreaCornerLineWidth - _cropAreaBorderLineWidth);
                    CGFloat willHeight = MIN(MAX(minHeight, CGRectGetHeight(_cropAreaOriFrame) + translation.y), maxHeight);
                    _cropAreaView.frame = CGRectMake(CGRectGetMinX(_cropAreaOriFrame), CGRectGetMinY(_cropAreaOriFrame), CGRectGetWidth(_cropAreaOriFrame), willHeight);
                    break;
                }
                case TKMidLineTypeLeft: {
                    CGFloat minWidth = currentMinSpace + (_cropAreaCornerWidth - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth) * 2;
                    CGFloat maxWidth = CGRectGetMaxX(_cropAreaOriFrame) - (_cropAreaCornerLineWidth - _cropAreaBorderLineWidth);
                    CGFloat willWidth = MIN(MAX(minWidth, CGRectGetWidth(_cropAreaOriFrame) - translation.x), maxWidth);
                    CGFloat deltaX = willWidth - CGRectGetWidth(_cropAreaOriFrame);
                    _cropAreaView.frame = CGRectMake(CGRectGetMinX(_cropAreaOriFrame) - deltaX, CGRectGetMinY(_cropAreaOriFrame), willWidth, CGRectGetHeight(_cropAreaOriFrame));
                    break;
                }
                case TKMidLineTypeRight: {
                    CGFloat minWidth = currentMinSpace + (_cropAreaCornerWidth - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth) * 2;
                    CGFloat maxWidth = WIDTH(_imageView) - CGRectGetMinX(_cropAreaOriFrame) - (_cropAreaCornerLineWidth - _cropAreaBorderLineWidth);
                    CGFloat willWidth = MIN(MAX(minWidth, CGRectGetWidth(_cropAreaOriFrame) + translation.x), maxWidth);
                    _cropAreaView.frame = CGRectMake(CGRectGetMinX(_cropAreaOriFrame), CGRectGetMinY(_cropAreaOriFrame), willWidth, CGRectGetHeight(_cropAreaOriFrame));
                    break;
                }
                default:
                    break;
            }
            [self resetCornersOnCropAreaFrameChanged];
            break;
        }
        default:
            break;
    }

}
- (void)handleCornerPan: (UIPanGestureRecognizer *)panGesture {

    CornerView *panView = (CornerView *)panGesture.view;
    CornerView *relativeViewX = panView.relativeViewX;
    CornerView *relativeViewY = panView.relativeViewY;
    CGPoint locationInImageView = [panGesture locationInView: _imageView];
    NSInteger xFactor = MINX(relativeViewY) > MINX(panView) ? -1 : 1;
    NSInteger yFactor = MINY(relativeViewX) > MINY(panView) ? -1 : 1;
    CGFloat approachAspectRatio = 0;
    if(panView == _topLeftCorner) {
        approachAspectRatio = (MINX(panView) + self.cornerMargin) / (MINY(panView) + self.cornerMargin);
    }
    else if(panView == _topRightCorner) {
        approachAspectRatio = (WIDTH(_imageView) - MAXX(panView) + self.cornerMargin) / (MINY(panView) + self.cornerMargin);
    }
    else if(panView == _bottomLeftCorner) {
        approachAspectRatio = (MINX(panView) + self.cornerMargin) / (HEIGHT(_imageView) - MAXY(panView) + self.cornerMargin);
    }
    else if(panView == _bottomRightCorner) {
        approachAspectRatio = (WIDTH(_imageView) - MAXX(panView) + self.cornerMargin) /(HEIGHT(_imageView) - MAXY(panView) + self.cornerMargin);
    }

    CGFloat spaceX = MIN(MAX((locationInImageView.x - relativeViewY.center.x) * xFactor + _cropAreaCornerWidth - self.cornerMargin * 2, currentMinSpace + _cropAreaCornerWidth * 2 - self.cornerMargin * 2), xFactor < 0 ? relativeViewY.center.x + _cropAreaCornerWidth / 2.0 - self.cornerMargin * 2 + self.cornerMargin * !_cornerBorderInImage : WIDTH(_imageView) - relativeViewY.center.x + _cropAreaCornerWidth / 2.0 - self.cornerMargin * 2 + self.cornerMargin * !_cornerBorderInImage);

    CGFloat spaceY = MIN(MAX((locationInImageView.y - relativeViewX.center.y) * yFactor + _cropAreaCornerHeight - self.cornerMargin * 2, currentMinSpace + _cropAreaCornerHeight * 2 - self.cornerMargin * 2), yFactor < 0 ? relativeViewX.center.y + _cropAreaCornerHeight / 2.0 - self.cornerMargin * 2 + self.cornerMargin * !_cornerBorderInImage : HEIGHT(_imageView) - relativeViewX.center.y + _cropAreaCornerHeight / 2.0 - self.cornerMargin * 2 + self.cornerMargin * !_cornerBorderInImage);

    if(_cropAspectRatio > 0) {
        if(_cropAspectRatio >= approachAspectRatio) {
            spaceY = MAX(spaceX / _cropAspectRatio, currentMinSpace + _cropAreaCornerHeight * 2 - self.cornerMargin * 2);
            spaceX = spaceY * _cropAspectRatio;
        }
        else {
            spaceX = MAX(spaceY * _cropAspectRatio, currentMinSpace + _cropAreaCornerWidth * 2 - self.cornerMargin * 2);
            spaceY = spaceX / _cropAspectRatio;
        }
    }

    CGFloat centerX = (spaceX - _cropAreaCornerWidth + self.cornerMargin * 2) * xFactor + relativeViewY.center.x;
    CGFloat centerY = (spaceY - _cropAreaCornerHeight + self.cornerMargin * 2) * yFactor + relativeViewX.center.y;
    panView.center = CGPointMake(centerX, centerY);
    relativeViewX.frame = CGRectMake(MINX(panView), MINY(relativeViewX), WIDTH(relativeViewX), HEIGHT(relativeViewX));
    relativeViewY.frame = CGRectMake(MINX(relativeViewY), MINY(panView), WIDTH(relativeViewY), HEIGHT(relativeViewY));
    [self resetCropAreaOnCornersFrameChanged];
    [self resetCropTransparentArea];

}
#pragma mark - Position/Resize Corners&CropArea
- (void)resetCornersOnCropAreaFrameChanged {

    _topLeftCorner.frame = CGRectMake(MINX(_cropAreaView) - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth, MINY(_cropAreaView) - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth, _cropAreaCornerWidth, _cropAreaCornerHeight);
    _topRightCorner.frame = CGRectMake(MAXX(_cropAreaView) - _cropAreaCornerWidth + _cropAreaCornerLineWidth - _cropAreaBorderLineWidth, MINY(_cropAreaView) - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth, _cropAreaCornerWidth, _cropAreaCornerHeight);
    _bottomLeftCorner.frame = CGRectMake(MINX(_cropAreaView) - _cropAreaCornerLineWidth + _cropAreaBorderLineWidth, MAXY(_cropAreaView) - _cropAreaCornerHeight + _cropAreaCornerLineWidth - _cropAreaBorderLineWidth, _cropAreaCornerWidth, _cropAreaCornerHeight);
    _bottomRightCorner.frame = CGRectMake(MAXX(_cropAreaView) - _cropAreaCornerWidth + _cropAreaCornerLineWidth - _cropAreaBorderLineWidth, MAXY(_cropAreaView) - _cropAreaCornerHeight + _cropAreaCornerLineWidth - _cropAreaBorderLineWidth, _cropAreaCornerWidth, _cropAreaCornerHeight);

}

- (void)resetCropAreaOnCornersFrameChanged {

    _cropAreaView.frame = CGRectMake(MINX(_topLeftCorner) + self.cornerMargin, MINY(_topLeftCorner) + self.cornerMargin, MAXX(_topRightCorner) - MINX(_topLeftCorner) - self.cornerMargin * 2, MAXY(_bottomLeftCorner) - MINY(_topLeftCorner) - self.cornerMargin * 2);

}
- (void)resetMinSpaceIfNeeded {

    CGFloat willMinSpace = MIN(WIDTH(_cropAreaView) - _cropAreaCornerWidth * 2 + self.cornerMargin * 2, HEIGHT(_cropAreaView) - _cropAreaCornerHeight * 2 + self.cornerMargin * 2);
    currentMinSpace = MIN(willMinSpace, _minSpace);

}
- (void)resetCropTransparentArea {

    UIBezierPath *path = [UIBezierPath bezierPathWithRect: _imageView.bounds];
    UIBezierPath *clearPath = [[UIBezierPath bezierPathWithRect: _cropAreaView.frame] bezierPathByReversingPath];
    [path appendPath: clearPath];
    CAShapeLayer *shapeLayer = (CAShapeLayer *)_cropMaskView.layer.mask;
    if(!shapeLayer) {
        shapeLayer = [CAShapeLayer layer];
        [_cropMaskView.layer setMask: shapeLayer];
    }
    shapeLayer.path = path.CGPath;

}
- (void)resetCornersOnSizeChanged {

    [_topLeftCorner updateSizeWithWidth: _cropAreaCornerWidth height: _cropAreaCornerHeight];
    [_topRightCorner updateSizeWithWidth: _cropAreaCornerWidth height: _cropAreaCornerHeight];
    [_bottomLeftCorner updateSizeWithWidth: _cropAreaCornerWidth height: _cropAreaCornerHeight];
    [_bottomRightCorner updateSizeWithWidth: _cropAreaCornerWidth height: _cropAreaCornerHeight];

}
- (void)createCorners {
    _topLeftCorner = [[CornerView alloc]initWithFrame: CGRectMake(0, 0, _cropAreaCornerWidth, _cropAreaCornerHeight) lineColor:_cropAreaCornerLineColor lineWidth: _cropAreaCornerLineWidth];
    _topLeftCorner.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin;
    _topLeftCorner.cornerPosition = TKCropAreaCornerPositionTopLeft;

    _topRightCorner = [[CornerView alloc]initWithFrame: CGRectMake(WIDTH(_imageView) -  _cropAreaCornerWidth, 0, _cropAreaCornerWidth, _cropAreaCornerHeight) lineColor: _cropAreaCornerLineColor lineWidth: _cropAreaCornerLineWidth];
    _topRightCorner.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin;
    _topRightCorner.cornerPosition = TKCropAreaCornerPositionTopRight;

    _bottomLeftCorner = [[CornerView alloc]initWithFrame: CGRectMake(0, HEIGHT(_imageView) -  _cropAreaCornerHeight, _cropAreaCornerWidth, _cropAreaCornerHeight) lineColor: _cropAreaCornerLineColor lineWidth: _cropAreaCornerLineWidth];
    _bottomLeftCorner.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
    _bottomLeftCorner.cornerPosition = TKCropAreaCornerPositionBottomLeft;

    _bottomRightCorner = [[CornerView alloc]initWithFrame: CGRectMake(WIDTH(_imageView) - _cropAreaCornerWidth, HEIGHT(_imageView) -  _cropAreaCornerHeight, _cropAreaCornerWidth, _cropAreaCornerHeight) lineColor: _cropAreaCornerLineColor lineWidth: _cropAreaCornerLineWidth];
    _bottomRightCorner.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
    _bottomRightCorner.cornerPosition = TKCropAreaCornerPositionBottomRight;

    _topLeftCorner.relativeViewX = _bottomLeftCorner;
    _topLeftCorner.relativeViewY = _topRightCorner;

    _topRightCorner.relativeViewX = _bottomRightCorner;
    _topRightCorner.relativeViewY = _topLeftCorner;

    _bottomLeftCorner.relativeViewX = _topLeftCorner;
    _bottomLeftCorner.relativeViewY = _bottomRightCorner;

    _bottomRightCorner.relativeViewX = _topRightCorner;
    _bottomRightCorner.relativeViewY = _bottomLeftCorner;

    [_imageView addSubview: _topLeftCorner];
    [_imageView addSubview: _topRightCorner];
    [_imageView addSubview: _bottomLeftCorner];
    [_imageView addSubview: _bottomRightCorner];

}
- (void)createMidLines {

    if(_topMidLine && _bottomMidLine && _leftMidLine && _rightMidLine) return;
    _topMidLine = [[MidLineView alloc]initWithLineWidth: _cropAreaMidLineWidth lineHeight: _cropAreaMidLineHeight lineColor: _cropAreaMidLineColor];
    _topMidLine.type = TKMidLineTypeTop;

    _bottomMidLine = [[MidLineView alloc]initWithLineWidth: _cropAreaMidLineWidth lineHeight: _cropAreaMidLineHeight lineColor: _cropAreaMidLineColor];
    _bottomMidLine.type = TKMidLineTypeBottom;

    _leftMidLine = [[MidLineView alloc]initWithLineWidth: _cropAreaMidLineWidth lineHeight: _cropAreaMidLineHeight lineColor: _cropAreaMidLineColor];
    _leftMidLine.type = TKMidLineTypeLeft;

    _rightMidLine = [[MidLineView alloc]initWithLineWidth: _cropAreaMidLineWidth lineHeight: _cropAreaMidLineHeight lineColor: _cropAreaMidLineColor];
    _rightMidLine.type = TKMidLineTypeRight;

    _topMidPan = [[UIPanGestureRecognizer alloc]initWithTarget:self action: @selector(handleMidPan:)];
    [_topMidLine addGestureRecognizer: _topMidPan];

    _bottomMidPan = [[UIPanGestureRecognizer alloc]initWithTarget:self action: @selector(handleMidPan:)];
    [_bottomMidLine addGestureRecognizer: _bottomMidPan];

    _leftMidPan = [[UIPanGestureRecognizer alloc]initWithTarget:self action: @selector(handleMidPan:)];
    [_leftMidLine addGestureRecognizer: _leftMidPan];

    _rightMidPan = [[UIPanGestureRecognizer alloc]initWithTarget:self action: @selector(handleMidPan:)];
    [_rightMidLine addGestureRecognizer: _rightMidPan];

    [_cropAreaView addSubview: _topMidLine];
    [_cropAreaView addSubview: _bottomMidLine];
    [_cropAreaView addSubview: _leftMidLine];
    [_cropAreaView addSubview: _rightMidLine];

}
- (void)removeMidLines {

    [_topMidLine removeFromSuperview];
    [_bottomMidLine removeFromSuperview];
    [_leftMidLine removeFromSuperview];
    [_rightMidLine removeFromSuperview];

    _topMidLine = nil;
    _bottomMidLine = nil;
    _leftMidLine = nil;
    _rightMidLine = nil;

}
- (void)resetMidLines {

    CGFloat lineMargin = _cropAreaMidLineHeight / 2.0 - _cropAreaBorderLineWidth;
    _topMidLine.frame = CGRectMake((WIDTH(_cropAreaView) - MID_LINE_INTERACT_WIDTH) / 2.0, - MID_LINE_INTERACT_HEIGHT / 2.0 - lineMargin, MID_LINE_INTERACT_WIDTH, MID_LINE_INTERACT_HEIGHT);
    _bottomMidLine.frame = CGRectMake((WIDTH(_cropAreaView) - MID_LINE_INTERACT_WIDTH) / 2.0, HEIGHT(_cropAreaView) - MID_LINE_INTERACT_HEIGHT / 2.0 + lineMargin, MID_LINE_INTERACT_WIDTH, MID_LINE_INTERACT_HEIGHT);
    _leftMidLine.frame = CGRectMake(- MID_LINE_INTERACT_WIDTH / 2.0 - lineMargin, (HEIGHT(_cropAreaView) - MID_LINE_INTERACT_HEIGHT) / 2.0, MID_LINE_INTERACT_WIDTH, MID_LINE_INTERACT_HEIGHT);
    _rightMidLine.frame = CGRectMake(WIDTH(_cropAreaView) - MID_LINE_INTERACT_WIDTH / 2.0 + lineMargin, (HEIGHT(_cropAreaView) - MID_LINE_INTERACT_HEIGHT) / 2.0, MID_LINE_INTERACT_WIDTH, MID_LINE_INTERACT_HEIGHT);

}
- (void)resetImageView {

    CGFloat selfAspectRatio = WIDTH(self) / HEIGHT(self);
    if(_imageAspectRatio > selfAspectRatio) {
        _paddingLeftRight = 0;
        _paddingTopBottom = floor((HEIGHT(self) - WIDTH(self) / _imageAspectRatio) / 2.0);
        _imageView.frame = CGRectMake(0, _paddingTopBottom, WIDTH(self), floor(WIDTH(self) / _imageAspectRatio));
    }
    else {
        _paddingTopBottom = 0;
        _paddingLeftRight = floor((WIDTH(self) - HEIGHT(self) * _imageAspectRatio) / 2.0);
        _imageView.frame = CGRectMake(_paddingLeftRight, 0, floor(HEIGHT(self) * _imageAspectRatio), HEIGHT(self));
    }

}
- (void)resetCropAreaByAspectRatio {

    if(_imageAspectRatio == 0) return;
    CGFloat tmpCornerMargin = self.cornerMargin * _cornerBorderInImage;
    CGFloat width, height;
    if(_cropAspectRatio == 0) {
        width = (WIDTH(_imageView) - 2 * tmpCornerMargin) * _initialScaleFactor;
        height = (HEIGHT(_imageView) - 2 * tmpCornerMargin) * _initialScaleFactor;
        if(_showMidLines) {
            [self createMidLines];
            [self resetMidLines];
        }
    }
    else {
        [self removeMidLines];
        if(_imageAspectRatio > _cropAspectRatio) {
            height = (HEIGHT(_imageView) - 2 * tmpCornerMargin) * _initialScaleFactor;
            width = height * _cropAspectRatio;
        }
        else {
            width = (WIDTH(_imageView) - 2 * tmpCornerMargin) * _initialScaleFactor;
            height = width / _cropAspectRatio;
        }
    }
    _cropAreaView.frame = CGRectMake((WIDTH(_imageView) - width) / 2.0, (HEIGHT(_imageView) - height) / 2.0, width, height);
    [self resetCornersOnCropAreaFrameChanged];
    [self resetCropTransparentArea];
    [self resetMinSpaceIfNeeded];
}
- (void)resetCropAreaByScaleFactor: (CGFloat)scaleFactor {

    CGPoint center = _cropAreaView.center;
    CGFloat tmpCornerMargin = self.cornerMargin * _cornerBorderInImage;
    CGFloat width = _pinchOriSize.width * scaleFactor;
    CGFloat height = _pinchOriSize.height * scaleFactor;
    CGFloat widthMax = MIN(WIDTH(_imageView) - center.x - tmpCornerMargin, center.x - tmpCornerMargin) * 2;
    CGFloat widthMin = currentMinSpace + _cropAreaCornerWidth * 2.0 - tmpCornerMargin * 2.0;
    CGFloat heightMax = MIN(HEIGHT(_imageView) - center.y - tmpCornerMargin, center.y - tmpCornerMargin) * 2;
    CGFloat heightMin = currentMinSpace + _cropAreaCornerWidth * 2.0 - tmpCornerMargin * 2;

    BOOL isMinimum = NO;
    if(_cropAspectRatio > 1) {
        if(height <= heightMin) {
            height = heightMin;
            width = height * _cropAspectRatio;
            isMinimum = YES;
        }
    }
    else {
        if(width <= widthMin) {
            width = widthMin;
            height = width / (_cropAspectRatio == 0 ? 1 : _cropAspectRatio);
            isMinimum = YES;
        }
    }
    if(!isMinimum) {
        if(_cropAspectRatio == 0) {
            if(width >= widthMax) {
                width = MIN(width, WIDTH(_imageView) - 2 * tmpCornerMargin);
                center.x = center.x > WIDTH(_imageView) / 2.0 ? WIDTH(_imageView) - width / 2.0 - tmpCornerMargin : width / 2.0 + tmpCornerMargin;
            }
            if(height > heightMax) {
                height = MIN(height, HEIGHT(_imageView) - 2 * tmpCornerMargin);
                center.y = center.y > HEIGHT(_imageView) / 2.0 ? HEIGHT(_imageView) - height / 2.0 - tmpCornerMargin : height / 2.0 + tmpCornerMargin;
            }

        }
        else if(_imageAspectRatio > _cropAspectRatio) {
            if(height >= heightMax) {
                height = MIN(height, HEIGHT(_imageView) - 2 * tmpCornerMargin);
                center.y = center.y > HEIGHT(_imageView) / 2.0 ? HEIGHT(_imageView) - height / 2.0 - tmpCornerMargin : height / 2.0 + tmpCornerMargin;
            }
            width = height * _cropAspectRatio;
            if(width > widthMax) {
                center.x = center.x > WIDTH(_imageView) / 2.0 ? WIDTH(_imageView) - width / 2.0 - tmpCornerMargin : width / 2.0 + tmpCornerMargin;
            }
        }
        else {
            if(width >= widthMax) {
                width = MIN(width, WIDTH(_imageView) - 2 * tmpCornerMargin);
                center.x = center.x > WIDTH(_imageView) / 2.0 ? WIDTH(_imageView) - width / 2.0 - tmpCornerMargin : width / 2.0 + tmpCornerMargin;
            }
            height = width / _cropAspectRatio;
            if(height > heightMax) {
                center.y = center.y > HEIGHT(_imageView) / 2.0 ? HEIGHT(_imageView) - height / 2.0 - tmpCornerMargin : height / 2.0 + tmpCornerMargin;
            }
        }
    }
    _cropAreaView.bounds = CGRectMake(0, 0, width, height);
    _cropAreaView.center = center;
    [self resetCornersOnCropAreaFrameChanged];

}
#pragma mark - Setter & Getters
- (void)setInitialScaleFactor:(CGFloat)initialScaleFactor {

    _initialScaleFactor = MIN(1.0f, initialScaleFactor);

}
- (CGFloat)cornerMargin {

    return _cropAreaCornerLineWidth - _cropAreaBorderLineWidth;

}
- (void)setMaskColor:(UIColor *)maskColor {

    _maskColor = maskColor;
    _cropMaskView.backgroundColor = maskColor;

}
- (void)setMinSpace:(CGFloat)minSpace {

    _minSpace = minSpace;
    currentMinSpace = minSpace;

}
- (void)setToCropImage:(UIImage *)toCropImage {

    _toCropImage = toCropImage;
    _imageAspectRatio = toCropImage.size.width / toCropImage.size.height;
    _imageView.image = toCropImage;
    [self resetImageView];
    [self resetCropAreaByAspectRatio];

}
- (void)setNeedScaleCrop:(BOOL)needScaleCrop {

    if(!_needScaleCrop && needScaleCrop) {
        _cropAreaPinch = [[UIPinchGestureRecognizer alloc]initWithTarget: self action:@selector(handleCropAreaPinch:)];
        [_cropAreaView addGestureRecognizer: _cropAreaPinch];
    }
    else if(_needScaleCrop && !needScaleCrop){
        [_cropAreaView removeGestureRecognizer: _cropAreaPinch];
        _cropAreaPinch = nil;
    }
    _needScaleCrop = needScaleCrop;

}
- (void)setCropAreaCrossLineWidth:(CGFloat)cropAreaCrossLineWidth {

    _cropAreaCrossLineWidth = cropAreaCrossLineWidth;
    _cropAreaView.crossLineWidth = cropAreaCrossLineWidth;

}
- (void)setCropAreaCrossLineColor:(UIColor *)cropAreaCrossLineColor {

    _cropAreaCrossLineColor = cropAreaCrossLineColor;
    _cropAreaView.crossLineColor = cropAreaCrossLineColor;

}
- (void)setCropAreaMidLineWidth:(CGFloat)cropAreaMidLineWidth {

    _cropAreaMidLineWidth = cropAreaMidLineWidth;
    _topMidLine.lineWidth = cropAreaMidLineWidth;
    _bottomMidLine.lineWidth = cropAreaMidLineWidth;
    _leftMidLine.lineWidth = cropAreaMidLineWidth;
    _rightMidLine.lineWidth = cropAreaMidLineWidth;
    if(_showMidLines) {
        [self resetMidLines];
    }

}
- (void)setCropAreaMidLineHeight:(CGFloat)cropAreaMidLineHeight {

    _cropAreaMidLineHeight = cropAreaMidLineHeight;
    _topMidLine.lineHeight = cropAreaMidLineHeight;
    _bottomMidLine.lineHeight = cropAreaMidLineHeight;
    _leftMidLine.lineHeight = cropAreaMidLineHeight;
    _rightMidLine.lineHeight = cropAreaMidLineHeight;
    if(_showMidLines) {
        [self resetMidLines];
    }

}
- (void)setCropAreaMidLineColor:(UIColor *)cropAreaMidLineColor {

    _cropAreaMidLineColor = cropAreaMidLineColor;
    _topMidLine.lineColor = cropAreaMidLineColor;
    _bottomMidLine.lineColor = cropAreaMidLineColor;
    _leftMidLine.lineColor = cropAreaMidLineColor;
    _rightMidLine.lineColor = cropAreaMidLineColor;

}
- (void)setCropAreaBorderLineWidth:(CGFloat)cropAreaBorderLineWidth {

    _cropAreaBorderLineWidth = cropAreaBorderLineWidth;
    _cropAreaView.borderWidth = cropAreaBorderLineWidth;
    [self resetCropAreaOnCornersFrameChanged];

}
- (void)setCropAreaBorderLineColor:(UIColor *)cropAreaBorderLineColor {

    _cropAreaBorderLineColor = cropAreaBorderLineColor;
    _cropAreaView.borderColor = cropAreaBorderLineColor;

}
- (void)setCropAreaCornerLineColor:(UIColor *)cropAreaCornerLineColor {

    _cropAreaCrossLineColor = cropAreaCornerLineColor;
    _topLeftCorner.lineColor = cropAreaCornerLineColor;
    _topRightCorner.lineColor = cropAreaCornerLineColor;
    _bottomLeftCorner.lineColor = cropAreaCornerLineColor;
    _bottomRightCorner.lineColor = cropAreaCornerLineColor;

}
- (void)setCropAreaCornerLineWidth:(CGFloat)cropAreaCornerLineWidth {

    _cropAreaCornerLineWidth = cropAreaCornerLineWidth;
    _topLeftCorner.lineWidth = cropAreaCornerLineWidth;
    _topRightCorner.lineWidth = cropAreaCornerLineWidth;
    _bottomLeftCorner.lineWidth = cropAreaCornerLineWidth;
    _bottomRightCorner.lineWidth = cropAreaCornerLineWidth;
    [self resetCropAreaByAspectRatio];

}
- (void)setCropAreaCornerWidth:(CGFloat)cropAreaCornerWidth {

    _cropAreaCornerWidth = cropAreaCornerWidth;
    [self resetCornersOnSizeChanged];

}
- (void)setCropAreaCornerHeight:(CGFloat)cropAreaCornerHeight {

    _cropAreaCornerHeight = cropAreaCornerHeight;
    [self resetCornersOnSizeChanged];

}
- (void)setCropAspectRatio:(CGFloat)cropAspectRatio {

    _cropAspectRatio = MAX(cropAspectRatio, 0);
    [self resetCropAreaByAspectRatio];

}
- (void)setShowMidLines:(BOOL)showMidLines {

    if(_cropAspectRatio == 0) {
        if(!_showMidLines && showMidLines) {
            [self createMidLines];
            [self resetMidLines];
        }
        else if(_showMidLines && !showMidLines) {
            [self removeMidLines];
        }
    }
    _showMidLines = showMidLines;

}
- (void)setShowCrossLines:(BOOL)showCrossLines {

    _showCrossLines = showCrossLines;
    _cropAreaView.showCrossLines = _showCrossLines;

}
- (void)setCornerBorderInImage:(BOOL)cornerBorderInImage {

    _cornerBorderInImage = cornerBorderInImage;
    [self resetCropAreaByAspectRatio];

}
- (void)setFrame:(CGRect)frame {

    [super setFrame: frame];
    [self resetImageView];

}
- (void)setCenter:(CGPoint)center {

    [super setCenter: center];
    [self resetImageView];

}
#pragma mark - KVO CallBack
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {

    if([object isEqual: _cropAreaView]) {
        if(_showMidLines){
            [self resetMidLines];
        }
        [self resetCropTransparentArea];
        return;
    }
    if([object isEqual: _imageView]) {
        [self resetCropAreaByAspectRatio];
    }

}
#pragma Instance Methods
- (UIImage *)currentCroppedImage {

    CGFloat scaleFactor = WIDTH(_imageView) / _toCropImage.size.width;
    return [_toCropImage imageAtRect: CGRectMake((MINX(_cropAreaView) + _cropAreaBorderLineWidth) / scaleFactor, (MINY(_cropAreaView) + _cropAreaBorderLineWidth) / scaleFactor, (WIDTH(_cropAreaView) - 2 * _cropAreaBorderLineWidth) / scaleFactor, (HEIGHT(_cropAreaView) - 2 * _cropAreaBorderLineWidth) / scaleFactor)];

}
@end


text:
@interface FGXChatInputBar : UIView

@end


text:
package leap.agent;

import leap.lang.logging.Log;
import leap.lang.logging.LogFactory;

class AgentLoader {

    private static final Log log = LogFactory.get(AgentLoader.class);

    private static boolean sunJdk;

    static {
        try{
            Class.forName("com.sun.tools.attach.VirtualMachine");
            sunJdk = true;
        }catch(Exception e) {
            log.error("No tools.jar in classpath, cannot load agent!");
            sunJdk = false;
        }
    }

    static boolean load() {
        if(sunJdk) {
            return SunJdkAgentLoader.load();
        }else{
            return false;
        }
    }

}


text:
class LocSearch
  def initialize(node)
    @node = node
  end

  class ModsRecord < LocSearch
    MODS_NS = { "mods" => "http://www.loc.gov/mods/v3" }
    def title
      title = @node.xpath('.//mods:titleInfo/mods:title', MODS_NS).first.content
      subtitle = @node.xpath('.//mods:titleInfo/mods:subTitle', MODS_NS).first
      title += " : #{subtitle.content}" if subtitle
      title
    end

    def lccn
      @node.xpath('.//mods:mods/mods:identifier[@type="lccn"]', MODS_NS).first.try(:content)
    end

    def isbn
      @node.xpath('.//mods:mods/mods:identifier[@type="isbn"]', MODS_NS).first.try(:content)
    end

    def creator
      statement_of_responsibility = @node.at('.//mods:note[@type="statement of responsibility"]', MODS_NS).try(:content)
      if statement_of_responsibility
        statement_of_responsibility
      else
        names = @node.xpath('.//mods:name', MODS_NS)
        creator = names.map do |name|
          name.xpath('.//mods:namePart', MODS_NS).map do |part|
            if part.content
              part.content
            else
              nil
            end
          end.compact.join(", ")
        end.join(" ; ")
        creator
      end
    end

    def publisher
      @node.xpath('.//mods:publisher', MODS_NS).map do |e|
        e.content
      end.join(", ")
    end

    def pubyear
      @node.xpath('.//mods:dateIssued', MODS_NS).first.try(:content)
    end
  end

  class DCRecord < LocSearch
    DC_NS = { "dc" => "http://purl.org/dc/elements/1.1/" }
    def title
      @node.xpath('.//dc:title', DC_NS).first.content
    end

    def lccn
      @node.xpath('.//dc:identifier[@type="lccn"]', DC_NS).first.content
    end

    def creator
    end
  end

  # http://www.loc.gov/z3950/lcserver.html
  LOC_SRU_BASEURL = "http://lx2.loc.gov:210/LCDB".freeze
  def self.make_sru_request_uri(query, options = {})
    if options[:page]
      page = options[:page].to_i
      options[:startRecord] = (page - 1) * 10 + 1
      options.delete :page
    end
    options = { maximumRecords: 10, recordSchema: :mods }.merge(options)
    options = options.merge({ query: query, version: "1.1", operation: "searchRetrieve" })
    params = options.map do |k, v|
        "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"
      end.join('&')
    "#{LOC_SRU_BASEURL}?#{params}"
  end

  def self.search(query, options = {})
    if query.present?
      url = make_sru_request_uri(query, options)
      doc = Nokogiri::XML(Faraday.get(url).body)
      items = doc.search('//zs:record').map{|e| ModsRecord.new e }
      @results = { items: items,
                   total_entries: doc.xpath('//zs:numberOfRecords').first.try(:content).to_i }
    else
      { items: [], total_entries: 0 }
    end
  end

  def self.import_from_sru_response(lccn)
    identifier_type_lccn = IdentifierType.find_or_create_by!(name: 'lccn')
    identifier = Identifier.find_by(body: lccn, identifier_type_id: identifier_type_lccn.id)
    return if identifier

    url = make_sru_request_uri("bath.lccn=\"^#{lccn}\"")
    response = Nokogiri::XML(Faraday.get(url).body)
    record = response.at('//zs:recordData', {"zs" => "http://www.loc.gov/zing/srw/"})
    return unless record.try(:content)

    doc = Nokogiri::XML::Document.new
    doc << record.at("//mods:mods", { "mods" => "http://www.loc.gov/mods/v3" })
    Manifestation.import_record_from_loc(doc)
  end
end


text:
define(function() {
  return true;
})


text:
var noBounce = function() {
  var module = {};

  var settings = {
    animate: true
  };

  var track = [];

  var velocity = {
    x: 0,
    y: 0
  };

  var vector = {
    subtraction: function(v1, v2) {
      return {
        x: v1.x - v2.x,
        y: v1.y - v2.y
      };
    },
    length: function(v) {
      return Math.sqrt((v.x * v.x) + (v.y * v.y));
    },
    unit: function(v) {
      var length = vector.length(v);
      v.x /= length;
      v.y /= length;
    },
    skalarMult: function(v, s) {
      v.x *= s;
      v.y *= s;
    }
  };

  var requestAnimFrame = (function() {
    return window.requestAnimationFrame ||
      window.webkitRequestAnimationFrame ||
      window.mozRequestAnimationFrame ||
      window.oRequestAnimationFrame ||
      window.msRequestAnimationFrame ||
      function(callback) {
        window.setTimeout(callback, 1000 / 60);
      };
  })();

  function handleTouchStart(evt) {
    var point,
      touch;

    touch = evt.changedTouches[0];
    point = {
      x: touch.clientX,
      y: touch.clientY,
      timeStamp: evt.timeStamp
    };
    track = [point];
  }

  function handleTouchMove(evt) {
    var point,
      touch;

    evt.preventDefault();

    touch = evt.changedTouches[0];
    point = {
      x: touch.clientX,
      y: touch.clientY,
      timeStamp: evt.timeStamp
    };
    track.push(point);
    doScroll();
  }

  function handleTouchEnd(evt) {
    if (track.length > 2 && settings.animate) {
      velocity = calcVelocity();
      requestAnimFrame(animate);
    }
  }

  function calcVelocity() {
    var p1,
      p2,
      v,
      timeDiff,
      length;

    p1 = track[0];
    p2 = track[track.length - 1];
    timeDiff = p2.timeStamp - p1.timeStamp;
    v = vector.subtraction(p2, p1);
    length = vector.length(v);
    vector.unit(v);
    vector.skalarMult(v, length / timeDiff * 20);
    return v;
  }

  function doScroll() {
    var p1,
      p2,
      x,
      y;

    if (track.length > 1) {
      p1 = track[track.length - 1];
      p2 = track[track.length - 2];
      x = p2.x - p1.x;
      y = p2.y - p1.y;
      requestAnimFrame(function() {
        window.scrollBy(x, y);
      });
    }
  }

  function animate() {
    scrollBy(-velocity.x, -velocity.y);
    vector.skalarMult(velocity, 0.95);
    if (vector.length(velocity) > 0.2) {
      requestAnimFrame(animate);
    }
  }

  //Returns true if it is a DOM element
  function isElement(o) {
    return (
      typeof HTMLElement === "object" ? o instanceof HTMLElement : //DOM2
      o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"
    );
  }

  module.init = function(options) {
    if (typeof options.animate === "boolean") {
      settings.animate = options.animate;
    }
    if (isElement(options.element)) {
      settings.element = options.element;
    }

    var element = settings.element || document;

    element.addEventListener("touchstart", handleTouchStart);
    element.addEventListener("touchmove", handleTouchMove);
    element.addEventListener("touchend", handleTouchEnd);
    element.addEventListener("touchcancel", handleTouchEnd);
    element.addEventListener("touchleave", handleTouchEnd);
  };

  return module;
}();


text:
namespace Azure.ResourceManager.AppService.Models
{
    /// <summary> Backup status. </summary>
    public enum WebAppBackupStatus
    {
        /// <summary> InProgress. </summary>
        InProgress,
        /// <summary> Failed. </summary>
        Failed,
        /// <summary> Succeeded. </summary>
        Succeeded,
        /// <summary> TimedOut. </summary>
        TimedOut,
        /// <summary> Created. </summary>
        Created,
        /// <summary> Skipped. </summary>
        Skipped,
        /// <summary> PartiallySucceeded. </summary>
        PartiallySucceeded,
        /// <summary> DeleteInProgress. </summary>
        DeleteInProgress,
        /// <summary> DeleteFailed. </summary>
        DeleteFailed,
        /// <summary> Deleted. </summary>
        Deleted
    }
}


text:
package com.owera.xaps.dbi;

public class Permission {
	private Integer id;
	private User user;
	private Integer unittypeId;
	private Integer profileId;

	public Permission(User user, Integer unittypeId, Integer profileId) {
		this.user = user;
		this.unittypeId = unittypeId;
		this.profileId = profileId;
	}

	public User getUser() {
		return user;
	}

	public Integer getId() {
		return id;
	}

	protected void setId(Integer id) {
		this.id = id;
	}

	public Integer getUnittypeId() {
		return unittypeId;
	}

	public Integer getProfileId() {
		return profileId;
	}

	public boolean isUnittypeAdmin() {
		if (profileId == null)
			return true;
		return false;
	}

}


text:
namespace java.lang
{
	[global::MonoJavaBridge.JavaClass()]
	public partial class InstantiationException : java.lang.Exception
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		protected InstantiationException(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public InstantiationException() : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.lang.InstantiationException._m0.native == global::System.IntPtr.Zero)
				global::java.lang.InstantiationException._m0 = @__env.GetMethodIDNoThrow(global::java.lang.InstantiationException.staticClass, "<init>", "()V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.lang.InstantiationException.staticClass, global::java.lang.InstantiationException._m0);
			Init(@__env, handle);
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public InstantiationException(java.lang.String arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.lang.InstantiationException._m1.native == global::System.IntPtr.Zero)
				global::java.lang.InstantiationException._m1 = @__env.GetMethodIDNoThrow(global::java.lang.InstantiationException.staticClass, "<init>", "(Ljava/lang/String;)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.lang.InstantiationException.staticClass, global::java.lang.InstantiationException._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
			Init(@__env, handle);
		}
		static InstantiationException()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::java.lang.InstantiationException.staticClass = @__env.NewGlobalRef(@__env.FindClass("java/lang/InstantiationException"));
		}
	}
}


text:
package org.aws4j.data.dynamo.model;

import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;

@DynamoDBTable(tableName = "counter")
public class Counter {

	private String category;
	private Integer count;

	@DynamoDBHashKey( attributeName="counter" )
	public String getCategory() {
		return category;
	}
	public void setCategory( String category ) {
		this.category = category;
	}

	@DynamoDBAttribute( attributeName="count" )
	public Integer getCount() {
		return count;
	}
	public void setCount( Integer count ) {
		this.count = count;
	}

}


text:
CREATE DATABASE hapi_api_development;
CREATE DATABASE hapi_api_test;
CREATE DATABASE hapi_api_production;
CREATE USER happ WITH PASSWORD 'hopp';
CREATE USER happai WITH PASSWORD 'hopp@tr0p';
GRANT ALL PRIVILEGES ON DATABASE hapi_api_test to happ;
GRANT ALL PRIVILEGES ON DATABASE hapi_api_development to happ;
GRANT ALL PRIVILEGES ON DATABASE hapi_api_production to happai;


text:
var fs = require('fs');
var https = require('https');
var request = require('request');
var path = require('path');
var prompt = require('prompt');
var dir = path.dirname();
var mixinsPath = 'sass/utils';
var availableMixins = [];

module.exports = function explore() {
  var options = {
    url: 'https://api.github.com/repositories/35896497/contents/utils/mixins',
    method: 'GET',
    headers: {
      'User-Agent': 'Super Agent/0.0.1',
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  };

  function startPrompt(json) {
    prompt.message = 'SassySass'.magenta;
    prompt.delimiter = ' ';

    prompt.start();

    prompt.get({
      properties: {
        mixinSelected: {
          description: 'What mixin would you like to install?\n'.red + json.map(function(name, index) { return index + '. ' + name; }).join('\n').white + '\n'
        }
      }
    },
    function (err, result) {
      if(err) {
        return console.log(err);
      }

      var mixinFile = availableMixins[result.mixinSelected];
      console.log(mixinFile);
      var file = fs.createWriteStream(dir + '/' + mixinsPath + '/mixins/' + mixinFile);
      var req = https.get('https://raw.githubusercontent.com/ryanburgess/sassysass/master/utils/mixins/' + mixinFile, function(response) {
        console.log(req);
        response.pipe(file);
        file.on('finish', function() {
          file.close(function (err) {
            if(err) {
              return console.log(err);
            }
            fs.appendFile(dir + '/' + mixinsPath + '/_mixins.scss', '@import \"mixins/' + mixinFile.substr(1).split('.scss')[0] + '\";\n', function (err) {
              if (err) {
                console.log(err);
              }
            });
            console.log('\n Mixin ' + mixinFile + ' successfully added.'.magenta);
          });  // close() is async, call cb after close completes.
        });
      }).on('error', function(err) { // Handle errors
        fs.unlink(dir + mixinsPath); // Delete the file async. (But we don't check the result)
        console.log(err);
      });
    });
  }

  // API Github requests user agent
  console.log('Fetching mixins...\n\n'.red);
  request(options, function (error, response, body) {
    if (!error) {
      JSON.parse(body).forEach(function (e) {
        availableMixins.push(e.name);
      });
      startPrompt(availableMixins);
    }
  });
};


text:
#ifndef _TESTMESSAGEFORMAT
#define _TESTMESSAGEFORMAT

#include "unicode/utypes.h"

#if !UCONFIG_NO_FORMATTING

#include "unicode/unistr.h"
#include "unicode/fmtable.h"
#include "unicode/msgfmt.h"
#include "intltest.h"

/**
 * TestMessageFormat tests MessageFormat, and also a few unctions in ChoiceFormat
 */
class TestMessageFormat: public IntlTest {
public:
    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );

    /**
     * regression test for a specific bug regarding ChoiceFormat boundaries
     **/
    void testBug1(void);
    /**
     * regression test for a specific bug regarding MessageFormat using ChoiceFormat
     **/
    void testBug2(void);
    /**
     * regression test for a specific bug involving NumberFormat and Locales
     **/
    void testBug3(void);
    /**
     * test MessageFormat with various given patterns
     **/
    void PatternTest(void);
    /**
     * test MesageFormat formatting functionality in a simple example
     **/
    void sample(void);

    /**
    * tests the static MessageFormat::format method
     **/
    void testStaticFormat(/* char* par */);
    /**
     * tests MesageFormat functionality with a simple format
     **/
    void testSimpleFormat(/* char* par */);
    /**
     * tests MesageFormat functionality with a format including a ChoiceFormat
     **/
    void testMsgFormatChoice(/* char* par */);
    /**
     * tests MesageFormat functionality with a PluralFormat.
     **/
    void testMsgFormatPlural(/* char* par */);

    /**
     * tests MessageFormat functionality with a SelectFormat.
     **/
    void testMsgFormatSelect(/* char* par */);

    /**
     * Internal method to format a MessageFormat object with passed args
     **/
    void internalFormat(MessageFormat* msgFmt ,
        Formattable* args , int32_t numOfArgs ,
        UnicodeString expected ,char* errMsg);

    /**
     * Internal method to create a MessageFormat object with passed args
     **/
    MessageFormat* internalCreate(
        UnicodeString pattern ,Locale locale , UErrorCode& err, char* errMsg);

    /**
     * Verify that MessageFormat accomodates more than 10 arguments
     * and more than 10 subformats.
     */
    void TestUnlimitedArgsAndSubformats();

    /**
     * Test RBNF extensions to MessageFormat.
     */
    void TestRBNF();

    //
    /**
     * ------------ API tests ----------
     * These routines test various API functionality.
     * In addition to the methods their name suggests,
     * they often test other methods as well.
     **/
    void testCopyConstructor(void);
    void testCopyConstructor2(void);
    void testAssignment(void);
    void testClone(void);
    void testEquals(void);
    void testNotEquals(void);
    void testSetLocale(void);
    void testFormat(void);
    void testParse(void);
    void testAdopt(void);
    void TestTurkishCasing(void);
    void testAutoQuoteApostrophe(void);

    /* Provide better code coverage */
    void testCoverage(void);

private:
};

#endif /* #if !UCONFIG_NO_FORMATTING */

#endif


text:
import React from 'react';

export class StoreOrder extends React.Component {
    constructor() {
        super();
        this.state = { orders: [] };
    }

    componentDidMount() {
      const storeToken =  localStorage.getItem('storeToken');
      if (storeToken) {
        fetch('https://localhost:3000/panel/order', {
          headers: new Headers({
            'Content-Type': 'application/json',
            'Authorization': 'JWT ' + localStorage.getItem('storeToken')
          })
        })
            .then((resp) => resp.json())
            .then((result) => {
              console.log(result.data);
                this.setState({orders:result.data});
            });
      } else {
        browserHistory.push('/panel/login');
      }
    }

    render() {
        return (

              {this.state.orders.map( (order) => {
                return

                                  {order.item.title}

                                  Shipping address: {order.shippingAddress}

                                  Buyer: {order.buyer.firstName}

                                  Transaction id: {order.transactionId}

                                  {order.item.price}€

                })}

        );
    }
}


text:
$( document ).ready(function() {

	if($('#cod').is(':checked')) {
		$('#fee').text("2.00");
	}else{
		$('#fee').text("0.00");
	}

        $("#cod").click(function() {
            var checked = $(this).is(':checked');
            if (checked) {
            	$('#fee').text("2.00");
            	var fee =      parseFloat($('#fee').text());
                var total_fee = parseFloat($('#total_fee').text());
                var total_with_delivery = parseFloat(total_fee + fee).toFixed(2);
                 console.log(fee);
                  console.log(total_fee);
                console.log(total_with_delivery);

                $('#total_fee').text(total_with_delivery);
            }
        });

        $("#ub").click(function() {
            var checked = $(this).is(':checked');
            if (checked) {
                $('#fee').text("0.00");
            }
        });

	// $('#cod:checked')

	$("#owl-example1").owlCarousel({
	  navigation : false, // Show next and prev buttons
	  pagination : false,
      slideSpeed : 300,
      autoHeight:true,
      paginationSpeed : 400,
      	  autoPlay:true,
      autoplayTimeout:1000,
      singleItem:true
	});

	$("input[name='box-quantity']").TouchSpin({
		initval: 1,
		min:1,
		max:50,
		buttondown_class: 'btn btn-danger',
		buttonup_class: 'btn btn-primary',
		buttondown_txt: '',
		buttonup_txt: ''
	});

	$('#mealbox_modal').on('hidden.bs.modal', function (e) {	  //reset form

      $("#menu-form input[type='checkbox']").removeAttr('checked');
      $("#alert-out").remove();
      $("#box-qty").val("1");
      $("#per-price").text("0.00");
      $("#total-price").text("0.00");
	});

	$('#alacarte_modal').on('shown.bs.modal', function (e) {
		var id = $(e.relatedTarget).data('id');
		$('#george').html('loading...').load('http://localhost.com/lovelymealbox/meal/ajax_alacarte?id='+id);

	});

	var alcarte_form = $('#alacarte-form');
		alcarte_form.on('change',function(e){
		var alacarte_price = parseFloat($("#alacarte-price").text()).toFixed(2);
    	var qty1 = parseInt($("#alacarte-qty").val());
    	var total = parseFloat(alacarte_price*qty1).toFixed(2);
    	$("#alacarte-total").text(total);
	});

	$('#alacarte_submit').click(function(e){
		var url = "http://localhost.com/lovelymealbox/meal/ajax_add_alacarte";
	      e.preventDefault();
		    $.ajax({
		        url : url,
		        type: "POST",
		        dataType: "JSON",
		        data: $('#alacarte-form').serializeArray(),
		        success: function(data)
		        {
		           if (data.status == 'failed') {
		           	 $('#alacarte_message').html("
×Unknown Error
");
		           }else{
		           	  location.reload();
		           }
		        },
		        error: function (jqXHR, textStatus, errorThrown)
		        {
		          console.log(jqXHR);
		        }
		    });
	});

	$('.del_item').click(function(e){
		var url = "http://localhost.com/lovelymealbox/meal/delete_item"
		e.preventDefault();
		item_id = $(this).data("item-id");

	    $.ajax({
	        url : url,
	        type: "POST",
	        dataType: "JSON",
	        data: { id : item_id },
	        success: function(data)
	        {
	            location.reload();
	        },
	        error: function (jqXHR, textStatus, errorThrown)
	        {
	          console.log(jqXHR);
	        }
	    });

	});

	$('#mealbox_submit').click(function(e){
		var url = "http://localhost.com/lovelymealbox/meal/ajax_meal_add";
	      e.preventDefault();
		    $.ajax({
		        url : url,
		        type: "POST",
		        dataType: "JSON",
		        data: $('#menu-form').serializeArray(),
		        success: function(data)
		        {
		           if (data.status == 'failed') {
		           	 $('#message').html("
×"+data.message+"
");
		           }else{
		           	  location.reload();
		           }
		        },
		        error: function (jqXHR, textStatus, errorThrown)
		        {
		          console.log(jqXHR);
		        }
		    });

	});

	var quantity_box = $(".quantity_box");
	quantity_box.on('change',function(e){
		var value = $(this).val();
		var id = $(this).closest('tr').attr('id');

		$.ajax({
			url: 'http://localhost.com/lovelymealbox/cart/update',
			type: 'post',
			data: {key: id, value: value},
			dataType: 'text',
			success: function(json) {
				location.reload();
			},
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			}
		});
	});

	var menu_form = $('#menu-form');
	menu_form.on('change',function(e){
	    var meat_length  = $('input[class="meat"]:checked').length;
	    var vege_length  = $('input[class="vege"]:checked').length;

		meat_string = Array(meat_length+1).join("m");
	    vege_string = Array(vege_length+1).join("v");

	    code = vege_string+meat_string;
		switch (code) {
		    case 'vvm':
		    case 'vm':
		    case 'vmm':
		    case 'mm':
		    case 'vvv':
				$("#per-price").text("6.00");
	        	var single1 = parseFloat($("#per-price").text()).toFixed(2);
	        	var qty1 = parseInt($("#box-qty").val());
	        	var total = parseFloat(single1*qty1).toFixed(2);
	        	$("#total-price").text(total);
	        	break;
		    default:
		        $("#per-price").text("0.00");
	        	$("#total-price").text("0.00");
		        break;
		}
	});

});

var cart = {
	'remove' :function(key) {
		$.ajax({
			url: 'http://localhost.com/lovelymealbox/cart/remove',
			type: 'post',
			data: 'key=' + key,
			dataType: 'text',
			success: function(json) {
				location.reload();
			},
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			}
		});
	}
}


text:
define("ace/ext/spellcheck", ["require", "exports", "module", "ace/lib/event", "ace/editor", "ace/config"], function (e, t, n) {
  "use strict";
  var r = e("../lib/event");
  t.contextMenuHandler = function (e) {
    var t = e.target, n = t.textInput.getElement();
    if (!t.selection.isEmpty()) return;
    var i = t.getCursorPosition(), s = t.session.getWordRange(i.row, i.column), o = t.session.getTextRange(s);
    t.session.tokenRe.lastIndex = 0;
    if (!t.session.tokenRe.test(o)) return;
    var u = "\x01\x01", a = o + " " + u;
    n.value = a, n.setSelectionRange(o.length, o.length + 1), n.setSelectionRange(0, 0), n.setSelectionRange(0, o.length);
    var f = !1;
    r.addListener(n, "keydown", function l() {
      r.removeListener(n, "keydown", l), f = !0
    }), t.textInput.setInputHandler(function (e) {
      console.log(e, a, n.selectionStart, n.selectionEnd);
      if (e == a) return "";
      if (e.lastIndexOf(a, 0) === 0) return e.slice(a.length);
      if (e.substr(n.selectionEnd) == a) return e.slice(0, -a.length);
      if (e.slice(-2) == u) {
        var r = e.slice(0, -2);
        if (r.slice(-1) == " ") return f ? r.substring(0, n.selectionEnd) : (r = r.slice(0, -1), t.session.replace(s, r), "")
      }
      return e
    })
  };
  var i = e("../editor").Editor;
  e("../config").defineOptions(i.prototype, "editor", {
    spellcheck: {
      set: function (e) {
        var n = this.textInput.getElement();
        n.spellcheck = !!e, e ? this.on("nativecontextmenu", t.contextMenuHandler) : this.removeListener("nativecontextmenu", t.contextMenuHandler)
      }, value: !0
    }
  })
});
(function () {
  window.require(["ace/ext/spellcheck"], function (m) {
    if (typeof module == "object" && typeof exports == "object" && module) {
      module.exports = m;
    }
  });
})();


text:
package tmcdb.test;

import alma.ACS.jbaci.DataAccess;
import alma.ACS.jbaci.DataAccessSupport;
import alma.ACSErr.CompletionHolder;
import alma.acs.exceptions.AcsJException;
import alma.acs.time.TimeHelper;

public class MCTestDataAccess<T extends Number> extends DataAccessSupport<T> implements DataAccess<T> {

	private long timestamp = 0L;
	private T value;

	public MCTestDataAccess (T value, long timstamp) {
		this.value = value;
		this.timestamp = timstamp;
	}

	@SuppressWarnings("unchecked")
	@Override
	public T get(CompletionHolder completionHolder) throws AcsJException {
		timestamp += 10000000; //increment 1 sec
		if (value instanceof Double) {
			value = (T)Double.valueOf(value.doubleValue() + 1);
		} else if (value instanceof Float) {
			value = (T)Float.valueOf(value.floatValue() + 1);
		} else if (value instanceof Long) {
			value = (T)Long.valueOf(value.longValue() + 1);
		} else if (value instanceof Integer) {
			value = (T)Integer.valueOf(value.intValue() + 1);
		}
		return value;
	}

	@Override
	public boolean initializeValue() {
		// tnakamot: this method now returns false so that this.value won't
		//           be initialized by BACI properties which initializes the
		//           value with set(...) method, and this instance keeps the
		//           original value set in the constructor.
		return false;
	}

	@Override
	public void set(T value, CompletionHolder completion)
			throws AcsJException {
		timestamp = TimeHelper.getTimeStamp().value;
		this.value = value;
	}

}


text:
import GameObject from "./gameobject"
import Drawable from "./drawable"

interface ParticleSystemOptions {
    vertical:number,
    horizontal:number,
    variation:number,
    particleCount:number,
    texture:string,
    lifeTime:number,
    systemLifeTime:number,
    x:number,
    y:number
}

class Particle extends Drawable {
    lifeTime:number;
    vertical:number;
    horizontal:number;
    lifeStart:number;
    scale:number;
    alive:boolean;
    variation:number;
    constructor(options:ParticleSystemOptions) {
        super(options.texture, options.x || 0, options.y || 0);
        this.variation = options.variation || 0.1;
        this.lifeTime = (options.lifeTime / 2) + (options.lifeTime / 2) * Math.random();
        this.vertical = options.vertical + (this.variation * Math.random() - (this.variation / 2.0));
        this.horizontal = options.horizontal + (this.variation * Math.random() - (this.variation / 2.0));
        this.lifeStart = Date.now();
        this.scale = 1.0;
        this.alive = true;
    }
    update(delta:number) {
        this.y += this.vertical * delta;
        this.x += this.horizontal * delta;
        var lifeSoFar:number = Date.now() - this.lifeStart;
        this.scale = (1.0 - (1.0 / this.lifeTime) * lifeSoFar);
        if(this.scale < 0) {
            this.scale = 0;
        }
        if(this.alive && lifeSoFar > this.lifeTime) {
            this.alive = false;
            this.emit("eol", this);
        }
    }
    draw(context:CanvasRenderingContext2D) {
        context.save();
        context.translate(this.x, this.y);
        //context.scale(this.scale, this.scale);
        context.rotate(this.rotation * (Math.PI / 180));
        var width = (this.texture.width * this.scale);
        var height = (this.texture.height * this.scale);
        context.drawImage(this.texture, width / 2 * -1, height / 2 * -1, width, height);
        context.restore();
    }
}

class ParticleSystem extends GameObject {
    texture:string;
    x:number;
    y:number;
    width:number;
    height:number;
    particles:Particle[];
    rotation:number;
    particleCount:number;
    systemLifeTime:number;
    lifeStart:number;
    alive:boolean;
    options:ParticleSystemOptions;
    constructor(options:ParticleSystemOptions) {
        super();
        this.options = options;
        this.x = options.x || 0;
        this.y = options.y || 0;
        this.width = 0;
        this.height = 0;
        this.lifeStart = Date.now();
        this.systemLifeTime = options.systemLifeTime || 0;
        this.texture = options.texture;
        this.particleCount = options.particleCount || 50;
        this.particles = [];
        this.alive = true;
    }
    fill() {
        for(var i = 0; i < this.particleCount; i++) {
            this.addParticle();
        }
    }
    addParticle() {
        this.options.x = this.x + (Math.random() * this.width | 0);
        this.options.y = this.y + (Math.random() * this.height | 0);
        var particle = new Particle(this.options);
        this.particles.push(particle);
        particle.on("eol", (particle:Particle) => {
            particle.x = this.x + (Math.random() * this.width | 0);
            particle.y = this.y + (Math.random() * this.height | 0);
            particle.lifeStart = Date.now();
            particle.alive = true;
        });
    }
    update(delta:number) {
        super.update(delta);
        for(var i:number = 0; i < this.particles.length; i++) {
            this.particles[i].update(delta);
        }
        if(this.systemLifeTime !== 0 && Date.now() - this.lifeStart > this.systemLifeTime) {
            this.alive = false;
            this.emit("eol", this);
        }
        if(this.particles.length < this.particleCount) {
            this.addParticle();
        }
    }
    draw(context:CanvasRenderingContext2D) {
        if(this.alive) {
            super.draw(context);
            for(var i:number = 0; i < this.particles.length; i++) {
                this.particles[i].draw(context);
            }
        }
    }
}

export default ParticleSystem;


text:
package Google::Ads::GoogleAds::V12::Enums::AccountBudgetProposalTypeEnum;

use strict;
use warnings;

use Const::Exporter enums => [
  UNSPECIFIED => "UNSPECIFIED",
  UNKNOWN     => "UNKNOWN",
  CREATE      => "CREATE",
  UPDATE      => "UPDATE",
  END         => "END",
  REMOVE      => "REMOVE"
];

1;


text:
import React, { useMemo } from 'react';
import Overlay, { OverlayProps } from '@uiw/react-overlay';
import Icon from '@uiw/react-icon';
import Button from '@uiw/react-button';
import { HTMLDivProps } from '@uiw/utils';
import './style/index.less';

export interface DrawerProps extends OverlayProps {
  footer?: React.ReactNode;
  icon?: JSX.Element | string | false | null;
  title?: React.ReactNode;
  bodyProps?: HTMLDivProps;
  placement?: 'top' | 'right' | 'bottom' | 'left';
  size?: number;
  isCloseButtonShown?: boolean;
  onClose?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
}

export default (props: DrawerProps = {}) => {
  const {
    prefixCls = 'w-drawer',
    className,
    style,
    placement = 'right',
    size = 260,
    title,
    footer,
    icon,
    isCloseButtonShown = true,
    bodyProps,
    timeout = 300,
    isOpen = false,
    maskClosable = true,
    ...overlayProps
  } = props;
  const cls = [className, prefixCls, placement]
    .filter(Boolean)
    .join(' ')
    .trim();
  const bodyCls = [
    bodyProps ? bodyProps.className : null,
    prefixCls ? `${prefixCls}-body-inner` : null,
  ]
    .filter(Boolean)
    .join(' ')
    .trim();
  const styl = {
    ...style,
    [/^(top|bottom)$/.test(placement!) ? 'height' : 'width']: size,
  };
  const footerView = useMemo(
    () =>
      footer ? <div className={`${prefixCls}-footer`}>{footer}
 : null,
    [footer],
  );
  const iconView = useMemo(() => (icon ? <Icon type={icon} /> : null), [icon]);
  const titleView = useMemo(() => (title ?
{title}
 : null), [title]);
  return (
    <Overlay
      className={cls}
      timeout={timeout}
      isOpen={isOpen}
      maskClosable={maskClosable}
      {...overlayProps}
    >
      <div className={`${prefixCls}-wrapper`} style={styl}>
        {(title || icon) && (
          <div className={`${prefixCls}-header`}>
            {iconView}
            {titleView}
            {title && isCloseButtonShown && (
              <Button basic onClick={props.onClose} icon="close" type="light" />
            )}

        )}
        <div className={`${prefixCls}-body`}>

            {props.children}

        {footerView}

    </Overlay>
  );
};


text:
<TITLE>STIX Font Table for All Fonts (3040-309F)</TITLE>

STIX Font Character Tables

Hiragana: 3040 - 309F

0	1	2	3	4	5	6	7

8	9	A	B	C	D	E	F

306

の

CJK Symbols and Punctuation
/\

General
<

O

:

\/
Latin Extended-D


text:
/,
                               ngraph::Node* node)
                    {
                        throw std::runtime_error("Unimplemented op '" + node->description() +
                                                 "' in CPU assignment");
                    }

                private:
                    CPU_ExternalFunction* m_external_function;
                };
            }
        }
    }
}


text:
var test  = require('tape')
  , rhumb = require('../../lib/rhumb')

test("Routing should match /page-{num} with path /page-four", function(t) {
  t.plan(1)

  var router = rhumb.create()

  router.add("/page-{num}", function(params) {
    t.deepEqual(params, { num : "four" })
  })

  router.match("/page-four")
})

test("Routing should match /page-{num} with path /page-4", function(t) {
  t.plan(1)

  var router = rhumb.create()

  router.add("/page-{num}", function(params) {
    t.deepEqual(params, { num : "4" })
  })

  router.match("/page-4")
})

test("Routing should match /i-{action}-you with path /i-poke-you", function(t) {
  t.plan(1)
  var router = rhumb.create()

  router.add("/i-{action}-you", function(params) {
    t.deepEqual(params, { action: "poke" })
  })

  router.match("/i-poke-you")
})

test("Routing should match /fix/i-{action}-you/faff with path /fix/i-poke-you/faff", function(t) {
  t.plan(1)
  var router = rhumb.create()

  router.add("/fix/i-{action}-you/faff", function(params) {
    t.deepEqual(params, { action: "poke" })
  })

  router.match("/fix/i-poke-you/faff")
})

test("Routing should match /{day}-{month}-{year} with path /mon-01-2020", function(t) {
  t.plan(1)
  var router = rhumb.create()

  router.add("/{day}-{month}-{year}", function(params) {
    t.deepEqual(params, { day: "mon", month: "01", year: "2020" })
  })

  router.match("mon-01-2020")
})


text:
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="description" content="Doctrine : JSDoc parser">

    <link rel="stylesheet" type="text/css" media="screen" href="css/styles.css">

    <title>JS Parser Demo</title>

JS Parser Demo

using doctrine (doctrine)
        see samples in Google Closure Compiler

        /**
        <textarea id="code" style="width:100%;height:100px;"></textarea>
        */


text:
package com.worldnet.automerger;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author Leonardo Pavone - 12/07/17.
 */
public class PropertiesUtil {

  private static Properties properties;

  private static void load(){

    properties = new Properties();
    try(InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("config.properties")) {
      if(is != null){
        properties.load(is);
      }
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }

  public static String getString(String propertyName){
    if(properties == null){
      load();
    }
    return properties.getProperty(propertyName);
  }
}