text:
package net.eatcode.trainwatch.nr.dataimport;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import net.eatcode.trainwatch.nr.Location;
import net.eatcode.trainwatch.nr.LocationRepo;

public class LocationPopulator {

	private final Logger log = LoggerFactory.getLogger(this.getClass());
	private final Gson gson = new GsonBuilder().create();

	private final LocationRepo repo;

	public LocationPopulator(LocationRepo repo) {
		this.repo = repo;
	}

	public CompletableFuture<Void> populateFromFiles(String locationsFile) {
		CompletableFuture<Void> result = new CompletableFuture<>();
		populateAsync(locationsFile, result);
		return result;
	}

	private void populateAsync(String locationsFile, CompletableFuture<Void> result) {
		CompletableFuture.runAsync(() -> {
			try (Stream<String> lines = Files.lines(Paths.get(locationsFile))) {
				lines.parallel().map(this::toLocation).forEach(this::addToRepo);
				result.complete(null);
			} catch (Exception e) {
				log.error("location file parse error", e);
				result.completeExceptionally(e);
			}
		});
	}

	private Location toLocation(String json) {
		return gson.fromJson(json, Location.class);

	}

	private void addToRepo(Location location) {
		repo.put(location);
	}

}


text:
if (this.dis !== undefined) {
    var generatorPrototype = (function() { yield 3; })().__proto__;
    try {
        this.dis(generatorPrototype);
    } catch(e) {}
}

redpajama_set_name: RedPajamaGithub


text:
//
//  MLHuangzheCell.m
//  医家(医生端)
//
//  Created by 洛耳 on 15/7/27.
//  Copyright (c) 2015年 workorz. All rights reserved.
//

#import "MLHuangzheCell.h"
#import "NSDate+MLDate.h"
#import "UIImageView+WebCache.h"
#import "MLGenderAgeView.h"
#define daziti 16
#define xiaoziti 14
@interface MLHuangzheCell ()
@property (nonatomic ,weak)UIImageView *touxiang;
@property (nonatomic ,weak)UILabel *name;
@property (nonatomic ,weak)UILabel *yanzhong;
@property (nonatomic ,weak)MLGenderAgeView *ga;
/**
 *  最高血糖
 */
@property (nonatomic ,weak)UILabel *zuigaoxuetang;
/**
 *  最低血糖
 */
@property (nonatomic ,weak)UILabel *zuidixuetang;
@property (nonatomic ,weak)UIImageView *zuidiImage;
@property (nonatomic ,weak)UIImageView *zuigaoImage;
@property (nonatomic ,weak)UIView *xian;
/**
 * 医生圈Cell内容
 */
@property (nonatomic ,weak)UILabel *neirong;
@end

@implementation MLHuangzheCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //添加头像
        UIImageView *touxiang = [[UIImageView alloc] init];
        touxiang.layer.cornerRadius = 25;
        touxiang.layer.masksToBounds = YES;
        self.touxiang = touxiang;
        //添加name
        UILabel *name =[[UILabel alloc] init];
        name.font = [UIFont systemFontOfSize:daziti];
        name.textColor = [UIColor blackColor];
        self.name = name;
        //添加性别年龄
        MLGenderAgeView *ga = [[MLGenderAgeView alloc] init];
        self.ga = ga;
        [self.contentView addSubview:ga];
        //严重
        UILabel *yanzhong =[[UILabel alloc] init];
        yanzhong.font = [UIFont systemFontOfSize:xiaoziti];
        yanzhong.textColor = [UIColor colorWithRed:238/255.0 green:108/255.0 blue:154 alpha:54/255.0];
        self.yanzhong = yanzhong;
        //最高血糖图片
        UIImageView *zuigaoImage = [[UIImageView alloc] init];
        zuigaoImage.image = [UIImage imageNamed:@"icon-往上"];
        self.zuigaoImage = zuigaoImage;
        //最高血糖
        UILabel *zuigaoxuetang = [[UILabel alloc] init];
        zuigaoxuetang.font = [UIFont systemFontOfSize:xiaoziti];
        zuigaoxuetang.textColor = [UIColor colorWithRed:181/255.0 green:180/255.0 blue:180/255.0 alpha:1];
        self.zuigaoxuetang = zuigaoxuetang;
        //最低血糖图片
        UIImageView *zuidiImage = [[UIImageView alloc] init];
        zuidiImage.image = [UIImage imageNamed:@"icon-往下"];
        self.zuidiImage = zuidiImage;
        //最低血糖
        UILabel *zuidixuetang = [[UILabel alloc] init];
        zuidixuetang.font = [UIFont systemFontOfSize:xiaoziti];
        zuidixuetang.textColor = [UIColor colorWithRed:181/255.0 green:180/255.0 blue:180/255.0 alpha:1];
        self.zuidixuetang = zuidixuetang;
        //线
        UIView *xian = [[UIView alloc] init];
        xian.backgroundColor = [UIColor colorWithRed:214/255.0 green:214/255.0 blue:214/255.0 alpha:1];
        self.xian =xian;
        //内容
        UILabel *neirong = [[UILabel alloc] init];
        neirong.font = [UIFont systemFontOfSize:xiaoziti];
        neirong.textColor = [UIColor colorWithRed:181/255.0 green:180/255.0 blue:180/255.0 alpha:1];
        self.neirong = neirong;
        [self.contentView addSubview:neirong];
        [self.contentView addSubview:xian];
        [self.contentView addSubview:touxiang];
        [self.contentView addSubview:name];
        [self.contentView addSubview:zuigaoxuetang];
        [self.contentView addSubview:zuidixuetang];
        [self.contentView addSubview:zuidiImage];
        [self.contentView addSubview:zuigaoImage];
    }
    return self;
}
-(void)cellTouxiangURL:(NSString *)url andName:(NSString *)name andNianling:(NSString *)nianling andXingbie:(NSString *)xingbie andZuigaoXuetang:(NSString *)zuigao andZuidiXuetang:(NSString *)zuidi andYanzhong:(NSString *)yanzhong{
    self.xian.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 0.5);
    self.touxiang.frame = CGRectMake(10, 10, 50, 50);
    NSURL *url1 = [NSURL URLWithString:url];
    [self.touxiang sd_setImageWithURL:url1 placeholderImage:[UIImage imageNamed:@"icon-默认头像"]];
    //计算名字的长度
    NSDictionary *attrs = @{NSFontAttributeName : [UIFont systemFontOfSize:daziti]};
    CGSize nameMaxSize = CGSizeMake(200, 20);
    CGSize nameSize = [name boundingRectWithSize:nameMaxSize options:NSStringDrawingUsesFontLeading attributes:attrs context:nil].size;
    self.name.frame = CGRectMake(self.touxiang.frame.origin.x + self.touxiang.frame.size.width + 5, self.touxiang.frame.origin.y + 5, nameSize.width, 20);
    self.name.text = name;
    //性别年龄属性
    self.ga.frame = CGRectMake(self.name.frame.origin.x + self.name.frame.size.width + 5, self.name.frame.origin.y + 2, 16, 16);
    [self.ga age:nianling andGender:xingbie];
    //是否严重
    if ([yanzhong isEqualToString:@"121"]) {
        self.yanzhong.frame = CGRectMake(self.ga.frame.size.width + self.ga.frame.origin.x + 5, self.ga.frame.origin.y, 50, 20);
        self.yanzhong.text = @"严重";
    }
    //最高图片
    self.zuigaoImage.frame = CGRectMake(self.name.frame.origin.x, self.name.frame.origin.y + self.name.frame.size.height + 5 , 3.5, 13);
    //最高文字
    self.zuigaoxuetang.frame = CGRectMake(self.zuigaoImage.frame.origin.x + self.zuigaoImage.frame.size.width + 3, self.zuigaoImage.frame.origin.y , 120, 13);
    NSString *zuigaoStr = [NSString stringWithFormat:@"最高血糖:%@",zuigao];
    self.zuigaoxuetang.text = zuigaoStr;

    //最高图片
    self.zuidiImage.frame = CGRectMake(self.zuigaoxuetang.frame.origin.x + self.zuigaoxuetang.frame.size.width + 5, self.zuigaoxuetang.frame.origin.y  , 3.5, 13);
    //最高文字
    self.zuidixuetang.frame = CGRectMake(self.zuidiImage.frame.origin.x + self.zuidiImage.frame.size.width + 3, self.zuigaoImage.frame.origin.y, 120, 13);
    NSString *zuidiStr = [NSString stringWithFormat:@"最低血糖:%@",zuidi];
    self.zuidixuetang.text = zuidiStr;
}
-(void)cellTouxiangURL:(NSString *)url andName:(NSString *)name andNianling:(NSString *)nianling andXingbie:(NSString *)xingbie andKeshi:(NSString *)keshi{
    self.xian.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 0.5);
    self.touxiang.frame = CGRectMake(10, 10, 50, 50);
    NSURL *url1 = [NSURL URLWithString:url];
    [self.touxiang sd_setImageWithURL:url1 placeholderImage:[UIImage imageNamed:@"icon-默认头像"]];
    //计算名字的长度
    NSDictionary *attrs = @{NSFontAttributeName : [UIFont systemFontOfSize:daziti]};
    CGSize nameMaxSize = CGSizeMake(200, 20);
    CGSize nameSize = [name boundingRectWithSize:nameMaxSize options:NSStringDrawingUsesFontLeading attributes:attrs context:nil].size;
    self.name.frame = CGRectMake(self.touxiang.frame.origin.x + self.touxiang.frame.size.width + 5, self.touxiang.frame.origin.y + 5, nameSize.width, 20);
    self.name.text = name;
    //性别年龄属性
    self.ga.frame = CGRectMake(self.name.frame.origin.x + self.name.frame.size.width + 5, self.name.frame.origin.y + 2, 16, 16);
    [self.ga age:nianling andGender:xingbie];
    self.neirong.frame = CGRectMake(self.name.frame.origin.x, self.name.frame.origin.y + self.name.frame.size.height + 10 , [UIScreen mainScreen].bounds.size.width - self.touxiang.frame.size.width - self.touxiang.frame.origin.y - 20, 13);
    self.neirong.text = keshi;
}
@end


text:
//// [thisAndSuperInStaticMembers3.ts]
declare class B {
    static a: any;
    static f(): number;
    a: number;
    f(): number;
}

class C extends B {
    static x: any = undefined!;
    static y1 = this.x;
    static y2 = this.x();
    static y3 = this?.x();
    static y4 = this[("x")]();
    static y5 = this?.[("x")]();
    static z3 = super.f();
    static z4 = super["f"]();

    // these should be unaffected
    x = 1;
    y = this.x;
    z = super.f();
}

//// [thisAndSuperInStaticMembers3.js]
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var C = /** @class */ (function (_super) {
    __extends(C, _super);
    function C() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        // these should be unaffected
        Object.defineProperty(_this, "x", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: 1
        });
        Object.defineProperty(_this, "y", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: _this.x
        });
        Object.defineProperty(_this, "z", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: _super.prototype.f.call(_this)
        });
        return _this;
    }
    var _a;
    _a = C;
    Object.defineProperty(C, "x", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: undefined
    });
    Object.defineProperty(C, "y1", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: _a.x
    });
    Object.defineProperty(C, "y2", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: _a.x()
    });
    Object.defineProperty(C, "y3", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: _a === null || _a === void 0 ? void 0 : _a.x()
    });
    Object.defineProperty(C, "y4", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: _a[("x")]()
    });
    Object.defineProperty(C, "y5", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: _a === null || _a === void 0 ? void 0 : _a[("x")]()
    });
    Object.defineProperty(C, "z3", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: _super.f.call(_a)
    });
    Object.defineProperty(C, "z4", {
        enumerable: true,
        configurable: true,
        writable: true,
        value: _super["f"].call(_a)
    });
    return C;
}(B));


text:
MSVC_PUSH_WARNING_LEVEL(0);
#include "Page.h"
#include "ScriptController.h"
#include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h"
#include "third_party/WebKit/Source/WebKit/chromium/src/WebViewImpl.h"
MSVC_POP_WARNING();
#undef LOG

namespace webkit_glue {

bool CanGoBackOrForward(WebKit::WebView* view, int distance) {
  if (!view)
    return false;
  WebKit::WebViewImpl* impl = reinterpret_cast<WebKit::WebViewImpl*>(view);
  return impl->page()->canGoBackOrForward(distance);
}

void GoBackOrForward(WebKit::WebView* view, int distance) {
  if (!view)
    return;
  WebKit::WebViewImpl* impl = reinterpret_cast<WebKit::WebViewImpl*>(view);
  impl->page()->goBackOrForward(distance);
}

v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame) {
  WebKit::WebFrameImpl* impl = static_cast<WebKit::WebFrameImpl*>(frame);
  return WebCore::ScriptController::mainWorldContext(impl->frame());
}

}  // webkit_glue


text:
'use strict'
const Benchmark = require('benchmark')
const suite = new Benchmark.Suite

let obj = process.env

suite
.add('for in', function() {
  for(let i in obj) {
    let o = obj[i]
  }
})
.add('while --', function() {
  let keys = Object.keys(obj)
  let l = keys.length
  while(l--) {
    let o = obj[keys[l]]
  }
})
.add('while shift', function() {
  let keys = Object.keys(obj)
  let k

  while(k = keys.shift()) {
    let o = obj[k]
  }
})
.on('cycle', function(event) {
  console.log(String(event.target))
})
.on('complete', function() {
  console.log('Fastest is ' + this.filter('fastest').map('name'))
})
.run({ 'async': true })


text:
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;

namespace Amazon.Glacier.Model
{
    ///
    /// <para>Contains the Amazon Glacier response to your request.</para>
    ///
    public class GetJobOutputResult
    {

        private Stream body;
        private string checksum;
        private int? status;
        private string contentRange;
        private string acceptRanges;
        private string contentType;
        private string archiveDescription;

        ///
        /// The job data, either archive data or inventory data.
        ///
        ///
        public Stream Body
        {
            get { return this.body; }
            set { this.body = value; }
        }

        ///
        /// Sets the Body property
        ///
        /// <param name="body">The value to set for the Body property </param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public GetJobOutputResult WithBody(Stream body)
        {
            this.body = body;
            return this;
        }

        // Check to see if Body property is set
        internal bool IsSetBody()
        {
            return this.body != null;
        }

        ///
        /// The checksum of the data in the response. This header is returned only when retrieving the output for an archive retrieval job. Furthermore,
        /// this header appears only under the following conditions:

You get the entire range of the archive.

You request a range to
        /// return of the archive that starts and ends on a multiple of 1 MB. For example, if you have an 3.1 MB archive and you specify a range to
        /// return that starts at 1 MB and ends at 2 MB, then the x-amz-sha256-tree-hash is returned as a response header.

You request a range
        /// of the archive to return that starts on a multiple of 1 MB and goes to the end of the archive. For example, if you have a 3.1 MB archive and
        /// you specify a range that starts at 2 MB and ends at 3.1 MB (the end of the archive), then the x-amz-sha256-tree-hash is returned as a
        /// response header.

        ///
        ///
        public string Checksum
        {
            get { return this.checksum; }
            set { this.checksum = value; }
        }

        ///
        /// Sets the Checksum property
        ///
        /// <param name="checksum">The value to set for the Checksum property </param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public GetJobOutputResult WithChecksum(string checksum)
        {
            this.checksum = checksum;
            return this;
        }

        // Check to see if Checksum property is set
        internal bool IsSetChecksum()
        {
            return this.checksum != null;
        }

        ///
        /// The HTTP response code for a job output request. The value depends on whether a range was specified in the request.
        ///
        ///
        public int Status
        {
            get { return this.status ?? default(int); }
            set { this.status = value; }
        }

        ///
        /// Sets the Status property
        ///
        /// <param name="status">The value to set for the Status property </param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public GetJobOutputResult WithStatus(int status)
        {
            this.status = status;
            return this;
        }

        // Check to see if Status property is set
        internal bool IsSetStatus()
        {
            return this.status.HasValue;
        }

        ///
        /// The range of bytes returned by Amazon Glacier. If only partial output is downloaded, the response provides the range of bytes Amazon Glacier
        /// returned. For example, bytes 0-1048575/8388608 returns the first 1 MB from 8 MB.
        ///
        ///
        public string ContentRange
        {
            get { return this.contentRange; }
            set { this.contentRange = value; }
        }

        ///
        /// Sets the ContentRange property
        ///
        /// <param name="contentRange">The value to set for the ContentRange property </param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public GetJobOutputResult WithContentRange(string contentRange)
        {
            this.contentRange = contentRange;
            return this;
        }

        // Check to see if ContentRange property is set
        internal bool IsSetContentRange()
        {
            return this.contentRange != null;
        }

        ///
        /// Indicates the range units accepted. For more information, go to RFC2616.
        ///
        ///
        public string AcceptRanges
        {
            get { return this.acceptRanges; }
            set { this.acceptRanges = value; }
        }

        ///
        /// Sets the AcceptRanges property
        ///
        /// <param name="acceptRanges">The value to set for the AcceptRanges property </param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public GetJobOutputResult WithAcceptRanges(string acceptRanges)
        {
            this.acceptRanges = acceptRanges;
            return this;
        }

        // Check to see if AcceptRanges property is set
        internal bool IsSetAcceptRanges()
        {
            return this.acceptRanges != null;
        }

        ///
        /// The Content-Type depends on whether the job output is an archive or a vault inventory. For archive data, the Content-Type is
        /// application/octet-stream. For vault inventory, if you requested CSV format when you initiated the job, the Content-Type is text/csv.
        /// Otherwise, by default, vault inventory is returned as JSON, and the Content-Type is application/json.
        ///
        ///
        public string ContentType
        {
            get { return this.contentType; }
            set { this.contentType = value; }
        }

        ///
        /// Sets the ContentType property
        ///
        /// <param name="contentType">The value to set for the ContentType property </param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public GetJobOutputResult WithContentType(string contentType)
        {
            this.contentType = contentType;
            return this;
        }

        // Check to see if ContentType property is set
        internal bool IsSetContentType()
        {
            return this.contentType != null;
        }

        ///
        /// The description of an archive.
        ///
        ///
        public string ArchiveDescription
        {
            get { return this.archiveDescription; }
            set { this.archiveDescription = value; }
        }

        ///
        /// Sets the ArchiveDescription property
        ///
        /// <param name="archiveDescription">The value to set for the ArchiveDescription property </param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public GetJobOutputResult WithArchiveDescription(string archiveDescription)
        {
            this.archiveDescription = archiveDescription;
            return this;
        }

        // Check to see if ArchiveDescription property is set
        internal bool IsSetArchiveDescription()
        {
            return this.archiveDescription != null;
        }
    }
}


text:
//
//  BindingPlatesViewController.m
//  sgSalerReport
//
//  Created by YaoHuiQiu on 16/5/4.
//  Copyright © 2016年 dwolf. All rights reserved.
//

#import "BindingPlatesViewController.h"
#import "AddCarController.h"

@interface BindingPlatesViewController () <UITableViewDataSource, UITableViewDelegate>
{
    UITableView * tableV;

    NSArray * dataArr;

    BOOL   pushBool;

}
@end

@implementation BindingPlatesViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self loadData];
    if ([self.delegate.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.delegate.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationBarTitleLabel.text= @"绑定车牌号";
    pushBool=YES;
    [self loadData];
}

- (void)loadData {

    NSString * path = [Util makeRequestUrl:@"usercenter" tp:@"carnolist"];

    NSDictionary * params = [NSDictionary dictionaryWithObjectsAndKeys:[Global sharedClient].member_id, @"member_id", @"1000", @"source", nil];

    [SVProgressHUD showWithStatus:@"数据加载中"];
    [HttpClient requestWithMethod:@"POST" path:path parameters:params target:self success:^(NSDictionary *dic) {

        dispatch_async(dispatch_get_main_queue(), ^{
            dataArr = dic[@"data"];
            if (dataArr.count) {

                if (tableV) {
                    [tableV reloadData];
                } else {
                    [self createTableView];
                }
            } else {
                [self createTableView];
                if (pushBool==YES) {
                      pushBool=NO;
                      [self.delegate.navigationController pushViewController:[[AddCarController alloc] init] animated:YES];
                }

            }
            [SVProgressHUD dismiss];
        });

    } failue:^(NSDictionary *dic) {
    }];
}

- (void)createTableView {

    tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, NAV_HEIGHT, WIN_WIDTH, WIN_HEIGHT- NAV_HEIGHT)];

    tableV.dataSource = self;
    tableV.delegate = self;
    tableV.backgroundColor = COLOR_LINE;

    UIView * tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIN_WIDTH, 53)];

    UIButton * btn = [UIButton buttonWithType:UIButtonTypeSystem];
    btn.frame = CGRectMake(10, 10, WIN_WIDTH - 2 * 10, 36);
    btn.backgroundColor = APP_BTN_COLOR;
    btn.layer.cornerRadius = DEFAULT_BUTTON_RADIUS;
    btn.layer.masksToBounds = YES;
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    btn.titleLabel.font = COMMON_FONT;
    [btn setTitle:@"新增车牌号" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(addNewPlate:) forControlEvents:UIControlEventTouchUpInside];

    [tableFooterView addSubview:btn];

    tableV.tableFooterView = tableFooterView;

    [self.view addSubview:tableV];
}

- (void)addNewPlate:(UIButton *)sender {

    [self.delegate.navigationController pushViewController:[[AddCarController alloc] init] animated:YES];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    return 64;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return dataArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString * identifier = @"BindingPlate";

    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];

    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor =COLOR_LINE;

        UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIN_WIDTH, 60)];
        view.backgroundColor = [UIColor whiteColor];

        [cell addSubview:view];

        UILabel * topLab = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 150, 21)];
        topLab.textColor = COLOR_FONT_BLACK;
        topLab.font = COMMON_FONT;
        topLab.tag = 8000;

        [view addSubview:topLab];

        UILabel * bottomLab = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(topLab.frame) + 10, 150, 21)];
        bottomLab.textColor = COLOR_FONT_SECOND;
        bottomLab.font = DESC_FONT;
        bottomLab.tag = 9000;

        [view addSubview:bottomLab];

    }
    UILabel * topLab = [cell viewWithTag:8000];

    topLab.text = [dataArr[indexPath.row] valueForKey:@"car_no"];
    [topLab sizeToFit];

//    NSString * temp = [[dataArr[indexPath.row] valueForKey:@"creat_time"] stringByReplacingOccurrencesOfString:@"-" withString:@"."];
    NSString * temp = [dataArr[indexPath.row]valueForKey:@"creat_time"];
    UILabel * bottomLab = [cell viewWithTag:9000];
    bottomLab.text  = temp;
    bottomLab.frame = CGRectMake(10, CGRectGetMaxY(topLab.frame) + 2, 150, 21);
    [bottomLab sizeToFit];

    for(UIView* subView in cell.subviews){
        if([subView isKindOfClass:[UIButton class]]){
            [subView removeFromSuperview];
        }
    }
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeSystem];

    btn.frame = CGRectMake(WIN_WIDTH - 10 - 70, (60 - 30)/2, 70, 30);
    btn.backgroundColor = APP_BTN_COLOR;
    btn.layer.cornerRadius = DEFAULT_BUTTON_RADIUS;
    btn.layer.masksToBounds = YES;
    btn.titleLabel.font = DESC_FONT;
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btn setTitle:@"解除绑定" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(removeBinding:) forControlEvents:UIControlEventTouchUpInside];
    btn.tag = indexPath.row + 200;
    [cell addSubview:btn];

    return cell;
}
- (void)removeBinding:(UIButton *)sender{

    [self confirm:@"确认解除绑定?" afterOK:^{
        int index=(int)sender.tag;
        [self loadData:index];
    }];
}

- (void)loadData:(int)sender {

    NSString * path = [Util makeRequestUrl:@"usercenter" tp:@"removecarno"];
    NSDictionary *dic=dataArr[sender - 200];
    NSString * car_no =dic[@"car_no"];

    NSDictionary * params = [NSDictionary dictionaryWithObjectsAndKeys:[Global sharedClient].member_id, @"member_id", car_no, @"car_no", @"1000", @"source", nil];

    [HttpClient requestWithMethod:@"POST" path:path parameters:params target:self success:^(NSDictionary *dic) {

        [SVProgressHUD showSuccessWithStatus:dic[@"data"]];

        [self loadData];

    } failue:^(NSDictionary *dic) {

    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
package cz.kec.wls.feedcombiner.utils;

import cz.kec.wls.feedcombiner.datastore.CombinedFeedDao;
import cz.kec.wls.feedcombiner.datastore.DaoFactory;
import cz.kec.wls.feedcombiner.model.CombinedFeed;
import java.net.URI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Creates mock data, so a new instance of feed combiner is not so empty.
 *
 * @author Daniel Kec <daniel at kecovi.cz>
 * @since 14:15:26 6.12.2014
 */
public abstract class MockUtils {

    private static final Logger LOG = LoggerFactory.getLogger(MockUtils.class);

    public static void createMockFeeds() {
        CombinedFeedDao combinedFeedDao = DaoFactory.getCombinedFeedDao();
        //check if there are real feeds in the storage
        if (!combinedFeedDao.getAllCombinedFeeds().isEmpty()) {
            return;//thera are some persisted feeds in the storage
        }

        LOG.info("There are no combine feeds in the storage. Let's add some mocks.");

        CombinedFeed combinedFeed = new CombinedFeed("All in one", "All aggregated to one mighty feed.");
        combinedFeed.getUris().add(URI.create("http://www.reddit.com/r/worldnews/.rss"));
        combinedFeed.getUris().add(URI.create("http://www.buzzfeed.com/index.xml"));
        combinedFeed.getUris().add(URI.create("http://marek.potociar.net/feed/"));
        combinedFeedDao.createCombinedFeed(combinedFeed);

        CombinedFeed combinedFeed2 = new CombinedFeed("BuzzFeed and Zive.cz", "BuzzFeed mixed with Zive");
        combinedFeed2.getUris().add(URI.create("http://www.zive.cz/rss/sc-47/"));
        combinedFeed2.getUris().add(URI.create("http://www.buzzfeed.com/index.xml"));
        combinedFeedDao.createCombinedFeed(combinedFeed2);
    }
}


text:
namespace BetterModules.Core.DataAccess.DataContext
{
    public class DefaultUnitOfWorkFactory : IUnitOfWorkFactory
    {
        private readonly ISessionFactoryProvider sessionFactoryProvider;

        public DefaultUnitOfWorkFactory(ISessionFactoryProvider sessionFactoryProvider)
        {
            this.sessionFactoryProvider = sessionFactoryProvider;
        }

        public IUnitOfWork New()
        {
            return new DefaultUnitOfWork(sessionFactoryProvider);
        }
    }
}


text:
namespace YAMP
{
    using System;

    /// <summary>
    /// Provides a kind attribute to be read by the help method. This attribute specifies the kind of function / constant that is declared.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class LinkAttribute : Attribute
    {
        #region ctor

        /// <summary>
        /// Creates a new attribute for storing more information about a function.
        /// </summary>
        /// <param name="urlKey">The url to store.</param>
        public LinkAttribute(String urlKey)
        {
            UrlKey = urlKey;
        }

        #endregion

        #region Property

        /// <summary>
        /// Gets the stored URL.
        /// </summary>
        public String UrlKey { get; private set; }

        #endregion
    }
}


text:
<?php

echo $this->element('form');


text:
package com.frequentis.cis.callback.cap;

import com.google.publicalerts.cap.Alert;

public interface CAPAppCallback {

	public void capReceived(Alert capMsg);

	public void capReceived(String capMsg);

}


text:
/*
 ******* www.devandclick.fr *******
 modeles :
 1 : suivant,precedent
 2 : pagination
 3 : pagination + suivant,precedent

 @nbParPage : nombre d'elements par page
 @divSelect : elements a paginer
 @divPager : nom du div ou s'insere la pagination
 @model : Modeles de pagination voir ci-dessus
 @element : Id de la div des élément p
 */
function pagination(nbParPage,divSelect,divPager,model)
{
    //Initialisation
    var nbElem = $(divSelect).length;
    var nbPage = Math.ceil(nbElem / nbParPage);
    var pageLoad = 1;
    $('.ul_pager').width($('#galery').width()/2);

    $(divSelect).each(function(index) {
        if (index < nbParPage)
            $(divSelect).eq(index).show();
        else
            $(divSelect).eq(index).hide();
    });

    //Reset & verification
    function reset() {
        if (nbPage < 2) $(divPager).hide();
        if (pageLoad == nbPage) $(divPager + ' span.suivant').hide(); else $(divPager + ' span.suivant').show();
        if (pageLoad == 1) $(divPager + ' span.precedent').hide(); else $(divPager + ' span.precedent').show();
        $(divPager + ' ul li').removeClass('selected');
        $(divPager + ' ul li').eq(pageLoad -1).addClass('selected');
    }

    //Pagination generation
    if (model != 1) {
        $(divPager).html('

');
        for(i = 1; i <= nbPage; i++) $(divPager + ' ul').append('
' + i + '
');

        //Changement click page
        $(divPager + ' ul li').click(function() {
            if ($(this).index() + 1 != pageLoad) {
                pageLoad = $(this).index() + 1;
                $(divSelect).hide();

                $(divSelect).each(function(i) {
                    if (i >= ((pageLoad * nbParPage) - nbParPage) && i < (pageLoad * nbParPage)) $(this).show();
                });

                reset();
            }
        });
    }

    //Suivant Precedent
    if (model == 1) {
        $(divPager).prepend('Precedent ');
        $(divPager).append('Suivant ');
    } else if (model == 3) {
        $(divPager + ' ul').before('Precedent ');
        $(divPager + ' ul').after('Suivant ');
    }

    //Evenement click sur suivant
    $(divPager + ' span.suivant').click(function() {
        if (pageLoad < nbPage) {
            pageLoad += 1;
            $(divSelect).hide();

            $(divSelect).each(function(i) {
                if (i >= ((pageLoad * nbParPage) - nbParPage) && i < (pageLoad * nbParPage)) $(this).show();
            });

            reset();
        }
    });

    //Evenement click sur precedent
    $(divPager + ' span.precedent').click(function() {
        if (pageLoad -1 >= 1) {
            pageLoad -= 1;
            $(divSelect).hide();

            $(divSelect).each(function(i) {
                if (i >= ((pageLoad * nbParPage) - nbParPage) && i < (pageLoad * nbParPage)) $(this).show();
            });

            reset();
        }
    });

    reset();
}


text:
var http = require('http');

http.createServer(function (request, response) {
  response.writeHead(200, {'Content-Type': 'text/plain'});
  response.end('Hello World\n');
}).listen();')})


text:
namespace {
class ExpandDeviceSelectorLabel;
class ExpandDeviceSelectorButton;

const char kAudioDevicesCountHistogramName[] =
    "Media.GlobalMediaControls.NumberOfAvailableAudioDevices";
const char kCastDeviceCountHistogramName[] =
    "Media.GlobalMediaControls.CastDeviceCount";
const char kDeviceSelectorAvailableHistogramName[] =
    "Media.GlobalMediaControls.DeviceSelectorAvailable";
const char kDeviceSelectorOpenedHistogramName[] =
    "Media.GlobalMediaControls.DeviceSelectorOpened";
}  // anonymous namespace

namespace global_media_controls {
class MediaItemUIView;
}  // namespace global_media_controls

namespace media_router {
class CastDialogSinkButton;
}

class MediaItemUIDeviceSelectorDelegate;
class MediaItemUIDeviceSelectorObserver;

class MediaItemUIDeviceSelectorView
    : public global_media_controls::MediaItemUIDeviceSelector,
      public IconLabelBubbleView::Delegate,
      public media_router::CastDialogController::Observer,
      public MediaItemUIFooterView::Delegate {
 public:
  METADATA_HEADER(MediaItemUIDeviceSelectorView);
  MediaItemUIDeviceSelectorView(
      const std::string& item_id,
      MediaItemUIDeviceSelectorDelegate* delegate,
      std::unique_ptr<media_router::CastDialogController> cast_controller,
      bool has_audio_output,
      global_media_controls::GlobalMediaControlsEntryPoint entry_point,
      bool show_expand_button = true);
  ~MediaItemUIDeviceSelectorView() override;

  // Called when audio output devices are discovered.
  void UpdateAvailableAudioDevices(
      const media::AudioDeviceDescriptions& device_descriptions);

  // global_media_controls::MediaItemUIDeviceSelector:
  void SetMediaItemUIView(
      global_media_controls::MediaItemUIView* view) override;
  void OnColorsChanged(SkColor foreground_color,
                       SkColor background_color) override;
  void UpdateCurrentAudioDevice(const std::string& current_device_id) override;

  // Called when the audio device switching has become enabled or disabled.
  void UpdateIsAudioDeviceSwitchingEnabled(bool enabled);

  // IconLabelBubbleView::Delegate
  SkColor GetIconLabelBubbleSurroundingForegroundColor() const override;
  SkColor GetIconLabelBubbleBackgroundColor() const override;

  //  media_router::CastDialogController::Observer
  void OnModelUpdated(const media_router::CastDialogModel& model) override;
  void OnControllerInvalidated() override;

  // MediaItemUIFooterView::Delegate
  void OnDeviceSelected(int tag) override;
  void OnDropdownButtonClicked() override;
  bool IsDeviceSelectorExpanded() override;

  // views::View
  bool OnMousePressed(const ui::MouseEvent& event) override;

  void AddObserver(MediaItemUIDeviceSelectorObserver* observer);

  views::Label* GetExpandDeviceSelectorLabelForTesting();
  views::Button* GetDropdownButtonForTesting();
  std::string GetEntryLabelForTesting(views::View* entry_view);
  bool GetEntryIsHighlightedForTesting(views::View* entry_view);
  bool GetDeviceEntryViewVisibilityForTesting();
  std::vector<media_router::CastDialogSinkButton*>
  GetCastSinkButtonsForTesting();

 private:
  friend class MediaItemUIDeviceSelectorViewTest;
  FRIEND_TEST_ALL_PREFIXES(MediaItemUIDeviceSelectorViewTest,
                           AudioDevicesCountHistogramRecorded);
  FRIEND_TEST_ALL_PREFIXES(MediaItemUIDeviceSelectorViewTest,
                           DeviceSelectorOpenedHistogramRecorded);

  void UpdateVisibility();
  bool ShouldBeVisible() const;
  void CreateExpandButtonStrip(bool show_expand_button);
  void ShowOrHideDeviceList();
  void ShowDevices();
  void HideDevices();
  void RemoveDevicesOfType(DeviceEntryUIType type);
  void StartCastSession(CastDeviceEntryView* entry);
  void DoStartCastSession(media_router::UIMediaSink sink);
  void RecordStartCastingMetrics(media_router::SinkIconType sink_icon_type);
  void RecordStartCastingWithCastAndDialPresent(
      media_router::SinkIconType sink_icon_type);
  void RecordStopCastingMetrics();
  void RecordCastDeviceCountAfterDelay();
  void RecordCastDeviceCount();
  DeviceEntryUI* GetDeviceEntryUI(views::View* view) const;
  void RegisterAudioDeviceCallbacks();

  bool has_expand_button_been_shown_ = false;
  bool have_devices_been_shown_ = false;

  bool is_expanded_ = false;
  bool is_audio_device_switching_enabled_ = false;
  bool has_cast_device_ = false;
  const std::string item_id_;
  const raw_ptr<MediaItemUIDeviceSelectorDelegate> delegate_;
  std::string current_device_id_ =
      media::AudioDeviceDescription::kDefaultDeviceId;
  SkColor foreground_color_ = global_media_controls::kDefaultForegroundColor;
  SkColor background_color_ = global_media_controls::kDefaultBackgroundColor;
  global_media_controls::GlobalMediaControlsEntryPoint const entry_point_;

  // Child views
  raw_ptr<AudioDeviceEntryView> current_audio_device_entry_view_ = nullptr;
  raw_ptr<views::View> expand_button_strip_ = nullptr;
  raw_ptr<ExpandDeviceSelectorLabel> expand_label_ = nullptr;
  raw_ptr<ExpandDeviceSelectorButton> dropdown_button_ = nullptr;
  raw_ptr<views::View> device_entry_views_container_ = nullptr;

  base::CallbackListSubscription audio_device_subscription_;
  base::CallbackListSubscription is_device_switching_enabled_subscription_;

  raw_ptr<global_media_controls::MediaItemUIView> media_item_ui_ = nullptr;

  std::unique_ptr<media_router::CastDialogController> cast_controller_;

  base::ObserverList<MediaItemUIDeviceSelectorObserver> observers_;

  // Each button has a unique tag, which is used to look up DeviceEntryUI* in
  // |device_entry_ui_map_|.
  int next_tag_ = 0;
  std::map<int, DeviceEntryUI*> device_entry_ui_map_;

  base::WeakPtrFactory<MediaItemUIDeviceSelectorView> weak_ptr_factory_{this};
};

#endif  // CHROME_BROWSER_UI_VIEWS_GLOBAL_MEDIA_CONTROLS_MEDIA_ITEM_UI_DEVICE_SELECTOR_VIEW_H_


text:
@interface IsAnythingTests : MatcherTestCase
@end

@implementation IsAnythingTests

- (void)testCopesWithNilsAndUnknownTypes
{
    id matcher = anything();

    assertNilSafe(matcher);
    assertUnknownTypeSafe(matcher);
}

- (void)testAlwaysEvaluatesToTrue
{
    assertMatches(@"nil", anything(), nil);
    assertMatches(@"object", anything(), [[NSObject alloc] init]);
    assertMatches(@"string", anything(), @"hi");
}

- (void)testHasUsefulDefaultDescription
{
    assertDescription(@"ANYTHING", anything());
}

- (void)testCanOverrideDescription
{
    NSString *description = @"DESCRIPTION";
    assertDescription(description, anythingWithDescription(description));
}

- (void)testMatchAlwaysSucceedsSoShouldNotGenerateMismatchDescription
{
    assertNoMismatchDescription(anything(), @"hi");
}

@end


text:
LOGCOMMAND="tag -a -m \"last push\" push"
COMMAND="push"

#add a tag to the log to indicate the last pushed commit
$SOURCE_CONTROL $LOGCOMMAND

#push the current HEAD
$SOURCE_CONTROL $COMMAND


text:
<?php

namespace PlaygroundDesign\Mapper;

interface ThemeInterface
{
    public function findById($id);

    public function insert($theme);

    public function update($theme);
}


text:
package com.my.dn.data;

public class FloatPoint {
	public float x;
	public float y;
}


text:
<link href="https://cdn.datatables.net/select/1.1.0/css/select.dataTables.min.css" rel="stylesheet" type="text/css">

排程更新
          <a class="btn btn-primary pull-right" href="<?php echo base_url('Schedule');?>">回列表

排程更新

                <form id="schedules_form" method="post" action="<?php echo base_url('Schedule/add_confirm');?>" enctype="multipart/form-data">

                    標題
                    <input id="title" name="title" type="text" class="form-control" value="<?php echo $schedule_data['main'][0]['title'];?>">

                    排程描述
                    <textarea id="description" name="description" class="form-control" rows="4"><?php echo $schedule_data['main'][0]['description'];?></textarea>

                          撥放清單

                              <button type="button" class="btn btn-default btn-sm" id="btn_add" data-toggle="modal" data-target="#modal_add">加入</button>
                              <button type="button" class="btn btn-default btn-sm" id="btn_setting" data-toggle="modal" data-target="#modal_set">設定</button>

                                影片編號
                                影片名稱
                                影片長度
                                起始時間
                                結束時間
                                操作

                              <?php foreach($schedule_data['info'] as $row): ?>

                                <?php echo $row['vid'];?>
                                <?php echo $row['title'];?>
                                <?php echo $row['video_length'];?>
                                <?php echo $row['startTime'];?>
                                <?php echo $row['endTime'];?>

                                    <button type='button' class='btn btn-default moveUp'>上移</button>
                                    <button type='button' class='btn btn-default moveDown'>下移</button>
                                    <button type="button" class="btn btn-default btn_upd">修改起始時間</button>
                                    <button type="button" class="btn btn-default btn_del">刪除</button>

                              <?php endforeach ?>

                  <input type="hidden" id="startDate" value="<?php echo $schedule_data['main'][0]['startDate'];?>">
                  <input type="hidden" id="startTime" value="<?php echo $schedule_data['main'][0]['startTime'];?>">
                  <button type="submit" class="btn btn-primary btn-lg" id="schedule_add_confirm" style="margin-right: 25px">送出</button>
                  <button type="reset" class="btn btn-success btn-lg">回復原始設定</button>
                </form>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

影像清單

        <form>

影像清單

                      影片編號
                      影片名稱
                      影片長度

                    <?php foreach($video_data as $video_item): ?>

                      <?php echo $video_item['id']; ?>
                      <?php echo $video_item['title']; ?>
                      <?php echo $video_item['video_length']; ?>

                    <?php endforeach ?>

        </form>

        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary" id="modal_add_confirm">新增</button>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

更新影片

        <form class="form-horizontal">

            影片名稱

              <input type="text" class="form-control" id="update_title" readonly>
              <input type="hidden" id="update_video_id" value="">

            影片長度

              <input type="text" class="form-control" id="update_video_length" readonly>

            起始時間

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

            結束時間

              <input type="text" class="form-control" id="update_end_time" readonly>

        </form>

        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary" id="modal_update_confirm">更新</button>

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

系統設定

        <form class="form-horizontal">

            影像間隔

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

        </form>

        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary" id="btn_systemConfirm">保存</button>


text:
package com.apache.commons.codec.net;

import java.io.UnsupportedEncodingException;
import java.util.BitSet;

import com.apache.commons.codec.CharEncoding;
import com.apache.commons.codec.DecoderException;
import com.apache.commons.codec.EncoderException;
import com.apache.commons.codec.StringDecoder;
import com.apache.commons.codec.StringEncoder;

/**
 *

 * Similar to the Quoted-Printable content-transfer-encoding defined in RFC 1521 and designed to allow text containing mostly ASCII
 * characters to be decipherable on an ASCII terminal without decoding.
 *

 *
 *

 * RFC 1522 describes techniques to allow the encoding of non-ASCII
 * text in various portions of a RFC 822 [2] message header, in a manner which is unlikely to confuse existing message
 * handling software.
 *

 *
 * @see MIME (Multipurpose Internet Mail Extensions) Part Two: Message
 *          Header Extensions for Non-ASCII Text
 *
 * @author Apache Software Foundation
 * @since 1.3
 * @version $Id: QCodec.java 797857 2009-07-25 23:43:33Z ggregory $
 */
public class QCodec extends RFC1522Codec implements StringEncoder, StringDecoder {
    /**
     * The default charset used for string decoding and encoding.
     */
    private final String charset;

    /**
     * BitSet of printable characters as defined in RFC 1522.
     */
    private static final BitSet PRINTABLE_CHARS = new BitSet(256);
    // Static initializer for printable chars collection
    static {
        // alpha characters
        PRINTABLE_CHARS.set(' ');
        PRINTABLE_CHARS.set('!');
        PRINTABLE_CHARS.set('"');
        PRINTABLE_CHARS.set('#');
        PRINTABLE_CHARS.set('$');
        PRINTABLE_CHARS.set('%');
        PRINTABLE_CHARS.set('&');
        PRINTABLE_CHARS.set('\'');
        PRINTABLE_CHARS.set('(');
        PRINTABLE_CHARS.set(')');
        PRINTABLE_CHARS.set('*');
        PRINTABLE_CHARS.set('+');
        PRINTABLE_CHARS.set(',');
        PRINTABLE_CHARS.set('-');
        PRINTABLE_CHARS.set('.');
        PRINTABLE_CHARS.set('/');
        for (int i = '0'; i <= '9'; i++) {
            PRINTABLE_CHARS.set(i);
        }
        PRINTABLE_CHARS.set(':');
        PRINTABLE_CHARS.set(';');
        PRINTABLE_CHARS.set('<');
        PRINTABLE_CHARS.set('>');
        PRINTABLE_CHARS.set('@');
        for (int i = 'A'; i <= 'Z'; i++) {
            PRINTABLE_CHARS.set(i);
        }
        PRINTABLE_CHARS.set('[');
        PRINTABLE_CHARS.set('\\');
        PRINTABLE_CHARS.set(']');
        PRINTABLE_CHARS.set('^');
        PRINTABLE_CHARS.set('`');
        for (int i = 'a'; i <= 'z'; i++) {
            PRINTABLE_CHARS.set(i);
        }
        PRINTABLE_CHARS.set('{');
        PRINTABLE_CHARS.set('|');
        PRINTABLE_CHARS.set('}');
        PRINTABLE_CHARS.set('~');
    }

    private static final byte BLANK = 32;

    private static final byte UNDERSCORE = 95;

    private boolean encodeBlanks = false;

    /**
     * Default constructor.
     */
    public QCodec() {
        this(CharEncoding.UTF_8);
    }

    /**
     * Constructor which allows for the selection of a default charset
     *
     * @param charset
     *                  the default string charset to use.
     *
     * @see Standard charsets
     */
    public QCodec(final String charset) {
        super();
        this.charset = charset;
    }

    protected String getEncoding() {
        return "Q";
    }

    protected byte[] doEncoding(byte[] bytes) {
        if (bytes == null) {
            return null;
        }
        byte[] data = QuotedPrintableCodec.encodeQuotedPrintable(PRINTABLE_CHARS, bytes);
        if (this.encodeBlanks) {
            for (int i = 0; i < data.length; i++) {
                if (data[i] == BLANK) {
                    data[i] = UNDERSCORE;
                }
            }
        }
        return data;
    }

    protected byte[] doDecoding(byte[] bytes) throws DecoderException {
        if (bytes == null) {
            return null;
        }
        boolean hasUnderscores = false;
        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] == UNDERSCORE) {
                hasUnderscores = true;
                break;
            }
        }
        if (hasUnderscores) {
            byte[] tmp = new byte[bytes.length];
            for (int i = 0; i < bytes.length; i++) {
                byte b = bytes[i];
                if (b != UNDERSCORE) {
                    tmp[i] = b;
                } else {
                    tmp[i] = BLANK;
                }
            }
            return QuotedPrintableCodec.decodeQuotedPrintable(tmp);
        }
        return QuotedPrintableCodec.decodeQuotedPrintable(bytes);
    }

    /**
     * Encodes a string into its quoted-printable form using the specified charset. Unsafe characters are escaped.
     *
     * @param pString
     *                  string to convert to quoted-printable form
     * @param charset
     *                  the charset for pString
     * @return quoted-printable string
     *
     * @throws EncoderException
     *                  thrown if a failure condition is encountered during the encoding process.
     */
    public String encode(final String pString, final String charset) throws EncoderException {
        if (pString == null) {
            return null;
        }
        try {
            return encodeText(pString, charset);
        } catch (UnsupportedEncodingException e) {
            throw new EncoderException(e.getMessage(), e);
        }
    }

    /**
     * Encodes a string into its quoted-printable form using the default charset. Unsafe characters are escaped.
     *
     * @param pString
     *                  string to convert to quoted-printable form
     * @return quoted-printable string
     *
     * @throws EncoderException
     *                  thrown if a failure condition is encountered during the encoding process.
     */
    public String encode(String pString) throws EncoderException {
        if (pString == null) {
            return null;
        }
        return encode(pString, getDefaultCharset());
    }

    /**
     * Decodes a quoted-printable string into its original form. Escaped characters are converted back to their original
     * representation.
     *
     * @param pString
     *                  quoted-printable string to convert into its original form
     *
     * @return original string
     *
     * @throws DecoderException
     *                  A decoder exception is thrown if a failure condition is encountered during the decode process.
     */
    public String decode(String pString) throws DecoderException {
        if (pString == null) {
            return null;
        }
        try {
            return decodeText(pString);
        } catch (UnsupportedEncodingException e) {
            throw new DecoderException(e.getMessage(), e);
        }
    }

    /**
     * Encodes an object into its quoted-printable form using the default charset. Unsafe characters are escaped.
     *
     * @param pObject
     *                  object to convert to quoted-printable form
     * @return quoted-printable object
     *
     * @throws EncoderException
     *                  thrown if a failure condition is encountered during the encoding process.
     */
    public Object encode(Object pObject) throws EncoderException {
        if (pObject == null) {
            return null;
        } else if (pObject instanceof String) {
            return encode((String) pObject);
        } else {
            throw new EncoderException("Objects of type " +
                  pObject.getClass().getName() +
                  " cannot be encoded using Q codec");
        }
    }

    /**
     * Decodes a quoted-printable object into its original form. Escaped characters are converted back to their original
     * representation.
     *
     * @param pObject
     *                  quoted-printable object to convert into its original form
     *
     * @return original object
     *
     * @throws DecoderException
     *                  Thrown if the argument is not a String. Thrown if a failure condition is
     *                  encountered during the decode process.
     */
    public Object decode(Object pObject) throws DecoderException {
        if (pObject == null) {
            return null;
        } else if (pObject instanceof String) {
            return decode((String) pObject);
        } else {
            throw new DecoderException("Objects of type " +
                  pObject.getClass().getName() +
                  " cannot be decoded using Q codec");
        }
    }

    /**
     * The default charset used for string decoding and encoding.
     *
     * @return the default string charset.
     */
    public String getDefaultCharset() {
        return this.charset;
    }

    /**
     * Tests if optional tranformation of SPACE characters is to be used
     *
     * @return true if SPACE characters are to be transformed, false otherwise
     */
    public boolean isEncodeBlanks() {
        return this.encodeBlanks;
    }

    /**
     * Defines whether optional tranformation of SPACE characters is to be used
     *
     * @param b
     *                  true if SPACE characters are to be transformed, false otherwise
     */
    public void setEncodeBlanks(boolean b) {
        this.encodeBlanks = b;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/bPublishUpdate"
        android:title="@string/publish_update">
    </item>
    <item
        android:id="@+id/bPublishNotify"
        android:title="@string/publish_notify">
    </item>
    <item
        android:id="@+id/bPublishDelete"
        android:title="@string/publish_delete">
    </item>
    <item
        android:id="@+id/bRemove"
        android:title="@string/remove">
    </item>
</menu>


text:
var common = require('../common.js');
var assert = require('assert');
var events = require('../fastemitter.js');

var callbacks_called = [];

var e = new events.EventEmitter();

function callback1() {
  callbacks_called.push('callback1');
  e.on('foo', callback2);
  e.on('foo', callback3);
  e.removeListener('foo', callback1);
}

function callback2() {
  callbacks_called.push('callback2');
  e.removeListener('foo', callback2);
}

function callback3() {
  callbacks_called.push('callback3');
  e.removeListener('foo', callback3);
}

e.on('foo', callback1);
assert.equal(1, e.listeners('foo').length);

e.emit('foo');
assert.equal(2, e.listeners('foo').length);
assert.deepEqual(['callback1'], callbacks_called);

e.emit('foo');
assert.equal(0, e.listeners('foo').length);
assert.deepEqual(['callback1', 'callback2', 'callback3'], callbacks_called);

e.emit('foo');
assert.equal(0, e.listeners('foo').length);
assert.deepEqual(['callback1', 'callback2', 'callback3'], callbacks_called);

e.on('foo', callback1);
e.on('foo', callback2);
assert.equal(2, e.listeners('foo').length);
e.removeAllListeners('foo');
assert.equal(0, e.listeners('foo').length);

// Verify that removing callbacks while in emit allows emits to propagate to
// all listeners
callbacks_called = [];

e.on('foo', callback2);
e.on('foo', callback3);
assert.equal(2, e.listeners('foo').length);
e.emit('foo');
assert.deepEqual(['callback2', 'callback3'], callbacks_called);
assert.equal(0, e.listeners('foo').length);


text:
require 'spec_helper'

describe Api::WebcamFeedsController do
  let(:user) { FactoryBot.create(:user) }
  include Devise::Test::ControllerHelpers

  it 'shows webcam feeds' do
    sign_in user
    expect(user.device.webcam_feeds.length).to be(0)
    2.times do |num|
      x = "feed " + num.to_s
      WebcamFeed.create! name: x, device: user.device, url: num
    end
    get :index, format: :json
    expect(response.status).to eq(200)
    expect(json.length).to eq(2)
    expect(user.device.webcam_feeds.reload.first).to be
    expect(json.length).to eq(2)
  end
end


text:
package me.panavtec.threaddecoratedview.sample;

import me.panavtec.threaddecoratedview.views.qualifiers.NotDecorated;
import me.panavtec.threaddecoratedview.views.qualifiers.ThreadDecoratedView;

@ThreadDecoratedView public interface MainView {
  @NotDecorated void initUi();
  void sampleUiMethod();
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Usuario extends CI_Controller {
//Listar Usuario
    public function listar(){
        autoriza();
        autorizaAdmRedirect();
            $this->load->model('Usuarios','usuario');
            $dados['usuarios'] = $this->usuario->listarCliente();
            $this->load->view('template/header');
            $this->load->view('template/adm');
            $this->load->view('listaUsuario',$dados);
            $this->load->view('template/footer');
    }
//Carregar view de novo Usuarario
    public function novoUsuario(){
        autoriza();
        autorizaAdmRedirect();
            $this->load->view('template/header');
            $this->load->view('template/adm');
            $this->load->view('novoUsuario');
            $this->load->view('template/footer');
    }
//Cadastar Usuarario no banco de Dados
    public function cadastrar(){
        autoriza();
        autorizaAdmRedirect();
            $this->load->model('Usuarios', 'user');
            $this->user->nome = $this->input->post('empresa');
            $this->user->senha = hash('sha256',$this->input->post('senha'));
            $this->user->email = $this->input->post('email');
            $this->user->permissao = $this->input->post('permissao');
            $this->user->cadastrarUsuario();
            redirect('listaUsuarios');
    }
//Exibir Usuario do banco de dados
    public function exibirUsuario($id=null){
        autoriza();
        autorizaAdmRedirect();
        $this->load->model('Usuarios','usuario');
        $dados['use'] = $this->usuario->buscar($id);
        $this->load->view('template/header');
        $this->load->view('template/adm');
        $this->load->view('exibirUsuario',$dados);
        $this->load->view('template/footer');
    }
//Atualizar Usuarario no banco de Dados
    public function atualizar($id=null){
        autoriza();
        autorizaAdmRedirect();
            $this->load->model('Usuarios','usuario');
            $this->usuario->nome = $this->input->post('empresa');
            $this->usuario->senha = hash('sha256',$this->input->post('senha'));
            $this->usuario->email = $this->input->post('email');
            $this->usuario->permissao = $this->input->post('permissao');
            $this->usuario->atualizar($id);
            redirect('listaUsuarios');
    }
//Deletar Usuario do banco de dados
    public function deletar($id=null){
        autoriza();
        autorizaAdmRedirect();
            $this->load->model('Usuarios','usuario');
            $this->usuario->deletar($id);
            redirect('listaUsuarios');
    }

}


text:
// KPU Affine Dependence Graph representation
// An object representing the affine data dependencies
// in the system of recurrence equations
//
// # Code

/** @namespace */
var KPU 	 = KPU    	    || {};
KPU.DgVertex = KPU.DgVertex || function(name) {
    this.name = name;
};
KPU.AffineDependenceGraph	     = KPU.AffineDependenceGraph	    || function() {
    this.vertices = [];
};

KPU.DgVertex.prototype = {
    name: function() {
        return this.name;
    },
    setName: function(name) {
        this.name = name;
    }
};

KPU.AffineDependenceGraph.prototype = {
    v: function(index) {
        return this.vertices[index];
    },
    setVertex: function(index, dgVertex) {
        this.vertices[index] = dgVertex;
    }
};


text:
#!/usr/bin/env node

var fs = require('fs');
var nopt = require("nopt");
var ChaosPlanFactory = require('./lib/ChaosPlanFactory');
var ChaosPlanExecutor = require('./lib/ChaosPlanExecutor');
var DockerLogger = require('./lib/DockerLogger');
var Executor = require('./lib/Executor');
var clc = require('cli-color');
var Spinner = require('cli-spinner').Spinner;

var knownOpts = {
    "composeFile" : [String],
    "plan": [String],
    "logPath": [String],
    "duration": [Number]
};
var shortHands = {};

var options = nopt(knownOpts, shortHands, process.argv);

var dockerComposeFile, planFile, command, duration;

if (!options.duration) {
    options.duration =  30000;
}

duration = options.duration;
if (!options.composeFile) {
    options.composeFile = process.cwd() + '/docker-compose.yml';
}
try {
    dockerComposeFile = fs.realpathSync(options.composeFile);
} catch (err) {
    console.log("A docker-compose.yml file could not be found");
    process.exit(1);
}

if (!options.plan) {
    console.log("A plan file is needed so we know where to create chaos");
    process.exit(1);
}

planFile = fs.realpathSync(options.plan);

//
// Command
//
var command = options.argv.remain[0];
if (!command) {
    console.log("you need to pass the command to be executed");
    process.exit(1);
}

command = command.split(' ');
var prog = fs.realpathSync(command.shift());
command = command.length === 1 ? prog : prog + ' ' + command.join(' ');

//
// Log Path
//
var logPath = '/tmp/logs-' + (new Date().toISOString());
if (options.logPath) {
    logPath = options.logPath;
    if (fs.existsSync(logPath)){
        console.log("Log path " + logPath + " already exists. Aborting");
        process.exit(1);
    }
}
fs.mkdirSync(logPath);

console.log(clc.whiteBright('Test:'), clc.white(command));
console.log(clc.whiteBright('Chaos Plan:'), clc.white(planFile));
console.log(clc.whiteBright('Docker-compose:'), clc.white(dockerComposeFile));
console.log(clc.whiteBright('Logs:'), clc.white(logPath));
console.log();

var planData = fs.readFileSync(planFile);

var chaosPlanFactory = new ChaosPlanFactory();
var chaosPlan = chaosPlanFactory.getChaosPlan(planData);

var exitCode = 0;
var executor = new Executor();

var spinner = new Spinner('Running ... ');

executor.on('start', function() {
    spinner.start();
});
executor.on('pass', function() {
    console.log(clc.green("Passed"));
    spinner.stop();
});
executor.on('fail', function(stdout, stderr) {
    exitCode = 1;
    console.log(clc.red("Failed"));
    if (stdout.length) {
        console.log(stdout);
    }
    if (stderr.length) {
        console.log(stderr);
    }
    spinner.stop();
});
executor.exec(command);

process.on('beforeExit', function() {
    process.exit(exitCode);
});

var dockerLogger = new DockerLogger(logPath);
dockerLogger.start(function() {});

var chaosPlanExecutor = new ChaosPlanExecutor();
chaosPlanExecutor.exec(dockerComposeFile, chaosPlan);
chaosPlanExecutor.on('dockerContainersChanged', function() {
    dockerLogger.update(function() {});
});
chaosPlanExecutor.on('error', function(err) {
    console.log(err);
    process.exit(1);
});

setTimeout(function() {
    console.log("Stopping execution");
    executor.stop();
    chaosPlanExecutor.stop();
    dockerLogger.stop();
    process.exit(exitCode);
}, duration);


text:
/**
 * Description: Using koa HTTP response object.
 *
 * How to run:
 * node --harmony eg3_response_object.js
 * Open browser -> localhost:9000
 *
 * To terminate the program use Ctrl+C / Cmd+C
 */

'use strict';

/**
 * 1st way the koa application object;
 */
var koa = require('koa');
var app = koa();

/**
 * Using middleware with koa
 * app.use(<middleware-setup>);
 */
app.use(function*() {

	/**
	 * Properties of response object.
	 */
	this.response.body = {
		name: "Ashwin Hegde",
		department: "Engineering"
	};

	this.response.status = 200;

	this.response.type = "application/json";

	/**
	 * Response functions
	 */

	this.response.set("location", "/user/Ashwin");

	this.response.set({
		"tag": 10748,
		"last-modified": new Date
	});

	this.response.redirect("https://www.github.com/hegdeashwin/learning-koa");
});

/**
 * Listen the application on port 9000 and log the console to show user on which port app is running.
 */
app.listen(9000);
console.log('koa application in listening on port 9000');


text:
<?php

namespace Nette\Forms\Controls;

use Nette,
	Nette\Forms\Form;

/**
 * Single line text input control.
 *
 * @author     David Grudl
 * @property-write $type
 */
class TextInput extends TextBase
{

	/**
	 * @param  string  label
	 * @param  int  maximum number of characters the user may enter
	 */
	public function __construct($label = NULL, $maxLength = NULL)
	{
		parent::__construct($label);
		$this->control->type = 'text';
		$this->control->maxlength = $maxLength;
	}

	/**
	 * Loads HTTP data.
	 * @return void
	 */
	public function loadHttpData()
	{
		$this->setValue($this->getHttpData(Form::DATA_LINE));
	}

	/**
	 * Changes control's type attribute.
	 * @param  string
	 * @return self
	 */
	public function setType($type)
	{
		$this->control->type = $type;
		return $this;
	}

	/**
	 * Generates control's HTML element.
	 * @return Nette\Utils\Html
	 */
	public function getControl()
	{
		$input = parent::getControl();

		foreach ($this->getRules() as $rule) {
			if ($rule->isNegative || $rule->branch) {

			} elseif (in_array($rule->validator, array(Form::MIN, Form::MAX, Form::RANGE), TRUE)
				&& in_array($input->type, array('number', 'range', 'datetime-local', 'datetime', 'date', 'month', 'week', 'time'), TRUE)
			) {
				if ($rule->validator === Form::MIN) {
					$range = array($rule->arg, NULL);
				} elseif ($rule->validator === Form::MAX) {
					$range = array(NULL, $rule->arg);
				} else {
					$range = $rule->arg;
				}
				if (isset($range[0]) && is_scalar($range[0])) {
					$input->min = isset($input->min) ? max($input->min, $range[0]) : $range[0];
				}
				if (isset($range[1]) && is_scalar($range[1])) {
					$input->max = isset($input->max) ? min($input->max, $range[1]) : $range[1];
				}

			} elseif ($rule->validator === Form::PATTERN && is_scalar($rule->arg)
				&& in_array($input->type, array('text', 'search', 'tel', 'url', 'email', 'password'), TRUE)
			) {
				$input->pattern = $rule->arg;
			}
		}

		if ($input->type !== 'password') {
			$input->value = $this->rawValue === '' ? $this->translate($this->emptyValue) : $this->rawValue;
		}
		return $input;
	}

}


text:
package org.apache.geode.codeAnalysis;

import org.junit.experimental.categories.Category;

import org.apache.geode.test.junit.categories.SerializationTest;

@Category({SerializationTest.class})
public class AnalyzeManagementSerializablesJUnitTest extends AnalyzeSerializablesJUnitTestBase {
  @Override
  protected String getModuleName() {
    return "geode-management";
  }

  @Override
  // Override this method because geode-management module has no data serializable classes
  public void testDataSerializables() throws Exception {

  }
}


text:
/**
 * TODO
 */
package io.scif.tools.commands;


text:
from model.account import Account
from taskutils.ndbsharded import ndbshardedmap, futurendbshardedmapwithcount
import logging
# from taskutils.future import twostagefuture
from taskutils.ndbsharded import futurendbshardedpagemap, futurendbshardedmap

def IncrementAccountsWithShardedMapExperiment():
    def Go():
        def AddFreeCredit(creditamount):
            def IncrementBalance(account, headers):
#                 headers = kwargs.get("headers")
                logging.debug("headers: %s" % headers)
                account.balance += creditamount
                account.put()

            ndbshardedmap(IncrementBalance, Account.query(), includeheaders = True)
        AddFreeCredit(10)
    return "Increment Accounts With Sharded Map", Go

def IncrementAccountsWithFutureShardedMapExperiment():
    def Go():
        def AddFreeCredit(creditamount):
            def IncrementBalance(futurekey, account):
                account.balance += creditamount
                account.put()
                return 1

            futureobj = futurendbshardedmapwithcount(IncrementBalance, Account.query(), queue="background")
            return futureobj.key
        return AddFreeCredit(10)
    return "Increment Accounts With Future Sharded Map", Go

# def CountAndIncrementAccountsExperiment():
#     def Go():
#         def AddFreeCredit(creditamount):
#             def IncrementBalance(account):
#                 account.balance += creditamount
#                 account.put()
#
#             def GetIncrementAccountsFuture(countfuture, parentkey, onsuccessf, onfailuref, **taskkwargs):
#                 future = futurendbshardedmap(IncrementBalance, Account.query(), parentkey=parentkey, onsuccessf=onsuccessf, onfailuref = onfailuref, **taskkwargs)
#                 future.set_weight(countfuture.get_result())
#                 return future
#
#             def GetCountAccountsFuture(parentkey, onsuccessf, onfailuref, **taskkwargs):
#                 return futurendbshardedpagemap(None, Account.query(), parentkey=parentkey, onsuccessf=onsuccessf, onfailuref = onfailuref, **taskkwargs)
#
#             futureobj = twostagefuture(GetCountAccountsFuture, GetIncrementAccountsFuture, queue="background")
#             #futureobj = futurendbshardedmapwithcount(IncrementBalance, Account.query(), queue="background")
#             return futureobj.key
#
#         raise Exception("To be fixed")
#         return AddFreeCredit(10)
#     return "Count & Increment", Go


text:
import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar

from azure.core.exceptions import (
    ClientAuthenticationError,
    HttpResponseError,
    ResourceExistsError,
    ResourceNotFoundError,
    ResourceNotModifiedError,
    map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat

from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request, _format_url_section

if sys.version_info >= (3, 8):
    from typing import Literal  # pylint: disable=no-name-in-module, ungrouped-imports
else:
    from typing_extensions import Literal  # type: ignore  # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]

_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False

def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
    _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
    _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

    api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01"))  # type: Literal["2017-12-01"]
    accept = _headers.pop("Accept", "application/json")

    # Construct URL
    _url = kwargs.pop(
        "template_url",
        "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers",
    )  # pylint: disable=line-too-long
    path_format_arguments = {
        "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
        "locationName": _SERIALIZER.url("location_name", location_name, "str"),
    }

    _url = _format_url_section(_url, **path_format_arguments)

    # Construct parameters
    _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")

    # Construct headers
    _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")

    return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)

class LocationBasedPerformanceTierOperations:
    """
    .. warning::
        **DO NOT** instantiate this class directly.

        Instead, you should access the following operations through
        :class:`~azure.mgmt.rdbms.postgresql.PostgreSQLManagementClient`'s
        :attr:`location_based_performance_tier` attribute.
    """

    models = _models

    def __init__(self, *args, **kwargs):
        input_args = list(args)
        self._client = input_args.pop(0) if input_args else kwargs.pop("client")
        self._config = input_args.pop(0) if input_args else kwargs.pop("config")
        self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
        self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")

    @distributed_trace
    def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.PerformanceTierProperties"]:
        """List all the performance tiers at specified location in a given subscription.

        :param location_name: The name of the location. Required.
        :type location_name: str
        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: An iterator like instance of either PerformanceTierProperties or the result of
         cls(response)
        :rtype:
         ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.PerformanceTierProperties]
        :raises ~azure.core.exceptions.HttpResponseError:
        """
        _headers = kwargs.pop("headers", {}) or {}
        _params = case_insensitive_dict(kwargs.pop("params", {}) or {})

        api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01"))  # type: Literal["2017-12-01"]
        cls = kwargs.pop("cls", None)  # type: ClsType[_models.PerformanceTierListResult]

        error_map = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError,
            304: ResourceNotModifiedError,
        }
        error_map.update(kwargs.pop("error_map", {}) or {})

        def prepare_request(next_link=None):
            if not next_link:

                request = build_list_request(
                    location_name=location_name,
                    subscription_id=self._config.subscription_id,
                    api_version=api_version,
                    template_url=self.list.metadata["url"],
                    headers=_headers,
                    params=_params,
                )
                request = _convert_request(request)
                request.url = self._client.format_url(request.url)  # type: ignore

            else:
                request = HttpRequest("GET", next_link)
                request = _convert_request(request)
                request.url = self._client.format_url(request.url)  # type: ignore
                request.method = "GET"
            return request

        def extract_data(pipeline_response):
            deserialized = self._deserialize("PerformanceTierListResult", pipeline_response)
            list_of_elem = deserialized.value
            if cls:
                list_of_elem = cls(list_of_elem)
            return None, iter(list_of_elem)

        def get_next(next_link=None):
            request = prepare_request(next_link)

            pipeline_response = self._client._pipeline.run(  # type: ignore # pylint: disable=protected-access
                request, stream=False, **kwargs
            )
            response = pipeline_response.http_response

            if response.status_code not in [200]:
                map_error(status_code=response.status_code, response=response, error_map=error_map)
                raise HttpResponseError(response=response, error_format=ARMErrorFormat)

            return pipeline_response

        return ItemPaged(get_next, extract_data)

    list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers"}  # type: ignore


text:
import module as mojom

# This module provides a mechanism for determining the packed order and offsets
# of a mojom.Struct.
#
# ps = pack.PackedStruct(struct)
# ps.packed_fields will access a list of PackedField objects, each of which
# will have an offset, a size and a bit (for mojom.BOOLs).

# Size of struct header in bytes: num_bytes [4B] + version [4B].
HEADER_SIZE = 8

class PackedField(object):
  kind_to_size = {
    mojom.BOOL:                  1,
    mojom.INT8:                  1,
    mojom.UINT8:                 1,
    mojom.INT16:                 2,
    mojom.UINT16:                2,
    mojom.INT32:                 4,
    mojom.UINT32:                4,
    mojom.FLOAT:                 4,
    mojom.HANDLE:                4,
    mojom.MSGPIPE:               4,
    mojom.SHAREDBUFFER:          4,
    mojom.DCPIPE:                4,
    mojom.DPPIPE:                4,
    mojom.NULLABLE_HANDLE:       4,
    mojom.NULLABLE_MSGPIPE:      4,
    mojom.NULLABLE_SHAREDBUFFER: 4,
    mojom.NULLABLE_DCPIPE:       4,
    mojom.NULLABLE_DPPIPE:       4,
    mojom.INT64:                 8,
    mojom.UINT64:                8,
    mojom.DOUBLE:                8,
    mojom.STRING:                8,
    mojom.NULLABLE_STRING:       8
  }

  @classmethod
  def GetSizeForKind(cls, kind):
    if isinstance(kind, (mojom.Array, mojom.Map, mojom.Struct)):
      return 8
    if (isinstance(kind, mojom.Interface) or
        isinstance(kind, mojom.InterfaceRequest)):
      kind = mojom.MSGPIPE
    if isinstance(kind, mojom.Enum):
      # TODO(mpcomplete): what about big enums?
      return cls.kind_to_size[mojom.INT32]
    if not kind in cls.kind_to_size:
      raise Exception("Invalid kind: %s" % kind.spec)
    return cls.kind_to_size[kind]

  def __init__(self, field, index, ordinal):
    """
    Args:
      field: the original field.
      index: the position of the original field in the struct.
      ordinal: the ordinal of the field for serialization.
    """
    self.field = field
    self.index = index
    self.ordinal = ordinal
    self.size = self.GetSizeForKind(field.kind)
    self.offset = None
    self.bit = None
    self.min_version = None

def GetPad(offset, size):
  """Returns the pad necessary to reserve space for alignment of |size|."""
  return (size - (offset % size)) % size

def GetFieldOffset(field, last_field):
  """Returns a 2-tuple of the field offset and bit (for BOOLs)."""
  if (field.field.kind == mojom.BOOL and
      last_field.field.kind == mojom.BOOL and
      last_field.bit < 7):
    return (last_field.offset, last_field.bit + 1)

  offset = last_field.offset + last_field.size
  pad = GetPad(offset, field.size)
  return (offset + pad, 0)

def GetPayloadSizeUpToField(field):
  """Returns the payload size (not including struct header) if |field| is the
  last field.
  """
  if not field:
    return 0
  offset = field.offset + field.size
  pad = GetPad(offset, 8)
  return offset + pad

class PackedStruct(object):
  def __init__(self, struct):
    self.struct = struct
    # |packed_fields| contains all the fields, in increasing offset order.
    self.packed_fields = []
    # |packed_fields_in_ordinal_order| refers to the same fields as
    # |packed_fields|, but in ordinal order.
    self.packed_fields_in_ordinal_order = []

    # No fields.
    if (len(struct.fields) == 0):
      return

    # Start by sorting by ordinal.
    src_fields = self.packed_fields_in_ordinal_order
    ordinal = 0
    for index, field in enumerate(struct.fields):
      if field.ordinal is not None:
        ordinal = field.ordinal
      src_fields.append(PackedField(field, index, ordinal))
      ordinal += 1
    src_fields.sort(key=lambda field: field.ordinal)

    # Set |min_version| for each field.
    next_min_version = 0
    for packed_field in src_fields:
      if packed_field.field.min_version is None:
        assert next_min_version == 0
      else:
        assert packed_field.field.min_version >= next_min_version
        next_min_version = packed_field.field.min_version
      packed_field.min_version = next_min_version

    src_field = src_fields[0]
    src_field.offset = 0
    src_field.bit = 0
    dst_fields = self.packed_fields
    dst_fields.append(src_field)

    # Then find first slot that each field will fit.
    for src_field in src_fields[1:]:
      last_field = dst_fields[0]
      for i in xrange(1, len(dst_fields)):
        next_field = dst_fields[i]
        offset, bit = GetFieldOffset(src_field, last_field)
        if offset + src_field.size <= next_field.offset:
          # Found hole.
          src_field.offset = offset
          src_field.bit = bit
          dst_fields.insert(i, src_field)
          break
        last_field = next_field
      if src_field.offset is None:
        # Add to end
        src_field.offset, src_field.bit = GetFieldOffset(src_field, last_field)
        dst_fields.append(src_field)

class ByteInfo(object):
  def __init__(self):
    self.is_padding = False
    self.packed_fields = []

def GetByteLayout(packed_struct):
  total_payload_size = GetPayloadSizeUpToField(
      packed_struct.packed_fields[-1] if packed_struct.packed_fields else None)
  bytes = [ByteInfo() for i in xrange(total_payload_size)]

  limit_of_previous_field = 0
  for packed_field in packed_struct.packed_fields:
    for i in xrange(limit_of_previous_field, packed_field.offset):
      bytes[i].is_padding = True
    bytes[packed_field.offset].packed_fields.append(packed_field)
    limit_of_previous_field = packed_field.offset + packed_field.size

  for i in xrange(limit_of_previous_field, len(bytes)):
    bytes[i].is_padding = True

  for byte in bytes:
    # A given byte cannot both be padding and have a fields packed into it.
    assert not (byte.is_padding and byte.packed_fields)

  return bytes

class VersionInfo(object):
  def __init__(self, version, num_fields, num_bytes):
    self.version = version
    self.num_fields = num_fields
    self.num_bytes = num_bytes

def GetVersionInfo(packed_struct):
  """Get version information for a struct.

  Args:
    packed_struct: A PackedStruct instance.

  Returns:
    A non-empty list of VersionInfo instances, sorted by version in increasing
    order.
    Note: The version numbers may not be consecutive.
  """
  versions = []
  last_version = 0
  last_num_fields = 0
  last_payload_size = 0

  for packed_field in packed_struct.packed_fields_in_ordinal_order:
    if packed_field.min_version != last_version:
      versions.append(
          VersionInfo(last_version, last_num_fields,
                      last_payload_size + HEADER_SIZE))
      last_version = packed_field.min_version

    last_num_fields += 1
    # The fields are iterated in ordinal order here. However, the size of a
    # version is determined by the last field of that version in pack order,
    # instead of ordinal order. Therefore, we need to calculate the max value.
    last_payload_size = max(GetPayloadSizeUpToField(packed_field),
                            last_payload_size)

  assert len(versions) == 0 or last_num_fields != versions[-1].num_fields
  versions.append(VersionInfo(last_version, last_num_fields,
                              last_payload_size + HEADER_SIZE))
  return versions


text:
import org.jetbrains.annotations.*;

import java.util.Objects;

class A{
  void test(Object bar) {
    if (Objects.equals(foo(), bar)) {}
  }

  @Nullable Object foo();
}


text:
using JetBrains.ReSharper.Psi.CSharp.Tree;

namespace MockMetrics.Eating.Expression
{
    public class AnonymousMethodExpressionEater : ExpressionEater<IAnonymousMethodExpression>
    {
        public AnonymousMethodExpressionEater(IEater eater) : base(eater)
        {
        }

        public override ExpressionKind Eat(ISnapshot snapshot, IAnonymousMethodExpression expression)
        {
            foreach (var anonymousMethodParameterDeclaration in expression.ParameterDeclarations)
            {
                Eater.Eat(snapshot, anonymousMethodParameterDeclaration);
            }

            Eater.Eat(snapshot, expression.Body);

            return ExpressionKind.StubCandidate;
        }
    }
}


text:
package org.jetbrains.plugins.groovy.actions;

import com.intellij.ide.IdeView;
import com.intellij.ide.actions.CreateFileFromTemplateDialog;
import com.intellij.ide.actions.JavaCreateTemplateInPackageAction;
import com.intellij.ide.fileTemplates.FileTemplate;
import com.intellij.ide.fileTemplates.FileTemplateManager;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.InputValidatorEx;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.util.IncorrectOperationException;
import icons.JetgroovyIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
import org.jetbrains.plugins.groovy.util.LibrariesUtil;

import static org.jetbrains.plugins.groovy.projectRoots.RootTypesKt.ROOT_TYPES;

public class NewGroovyClassAction extends JavaCreateTemplateInPackageAction<GrTypeDefinition> implements DumbAware {

  public NewGroovyClassAction() {
    super(GroovyBundle.message("newclass.menu.action.text"), GroovyBundle.message("newclass.menu.action.description"),
          JetgroovyIcons.Groovy.Class, ROOT_TYPES);
  }

  @Override
  protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
    builder
      .setTitle(GroovyBundle.message("newclass.dlg.title"))
      .addKind("Class", JetgroovyIcons.Groovy.Class, GroovyTemplates.GROOVY_CLASS)
      .addKind("Interface", JetgroovyIcons.Groovy.Interface, GroovyTemplates.GROOVY_INTERFACE);

    if (GroovyConfigUtils.getInstance().isVersionAtLeast(directory, GroovyConfigUtils.GROOVY2_3, true)) {
      builder.addKind("Trait", JetgroovyIcons.Groovy.Trait, GroovyTemplates.GROOVY_TRAIT);
    }

    builder
      .addKind("Enum", JetgroovyIcons.Groovy.Enum, GroovyTemplates.GROOVY_ENUM)
      .addKind("Annotation", JetgroovyIcons.Groovy.AnnotationType, GroovyTemplates.GROOVY_ANNOTATION);

    for (FileTemplate template : FileTemplateManager.getInstance(project).getAllTemplates()) {
      FileType fileType = FileTypeManagerEx.getInstanceEx().getFileTypeByExtension(template.getExtension());
      if (fileType.equals(GroovyFileType.GROOVY_FILE_TYPE) && JavaDirectoryService.getInstance().getPackage(directory) != null) {
        builder.addKind(template.getName(), JetgroovyIcons.Groovy.Class, template.getName());
      }
    }

    builder.setValidator(new InputValidatorEx() {

      @Override
      public String getErrorText(String inputString) { return "This is not a valid Groovy qualified name"; }

      @Override
      public boolean checkInput(String inputString) { return true; }

      @Override
      public boolean canClose(String inputString) {
        return !StringUtil.isEmptyOrSpaces(inputString) && PsiNameHelper.getInstance(project).isQualifiedName(inputString);
      }
    });
  }

  @Override
  protected boolean isAvailable(DataContext dataContext) {
    return super.isAvailable(dataContext) && LibrariesUtil.hasGroovySdk(LangDataKeys.MODULE.getData(dataContext));
  }

  @Override
  protected String getActionName(PsiDirectory directory, @NotNull String newName, String templateName) {
    return GroovyBundle.message("newclass.menu.action.text");
  }

  @Override
  protected PsiElement getNavigationElement(@NotNull GrTypeDefinition createdElement) {
    return createdElement.getLBrace();
  }

  @Override
  public void update(@NotNull AnActionEvent e) {
    super.update(e);
    Presentation presentation = e.getPresentation();
    if (!presentation.isVisible()) return;

    IdeView view = e.getData(LangDataKeys.IDE_VIEW);
    if (view == null) return;
    Project project = e.getProject();
    if (project == null) return;

    ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    for (PsiDirectory dir : view.getDirectories()) {
      if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && checkPackageExists(dir)) {
        for (GroovySourceFolderDetector detector : GroovySourceFolderDetector.EP_NAME.getExtensions()) {
          if (detector.isGroovySourceFolder(dir)) {
            presentation.setWeight(Presentation.HIGHER_WEIGHT);
            break;
          }
        }
        return;
      }
    }
  }

  @Override
  protected final GrTypeDefinition doCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException {
    final String fileName = className + NewGroovyActionBase.GROOVY_EXTENSION;
    final PsiFile fromTemplate = GroovyTemplatesFactory.createFromTemplate(dir, className, fileName, templateName, true);
    if (fromTemplate instanceof GroovyFile) {
      CodeStyleManager.getInstance(fromTemplate.getManager()).reformat(fromTemplate);
      return ((GroovyFile)fromTemplate).getTypeDefinitions()[0];
    }
    final String description = fromTemplate.getFileType().getDescription();
    throw new IncorrectOperationException(GroovyBundle.message("groovy.file.extension.is.not.mapped.to.groovy.file.type", description));
  }
}