text:
@interface UMComSysLikeTableViewCell ()

@property (nonatomic, strong) UMComLike *like;

@property (nonatomic, strong) UILabel *commentTextView;

@property (nonatomic, assign) CGSize cellSize;

@property (nonatomic, strong) UMComMutiStyleTextView *feedCreatorView;

@property (nonatomic, strong) UMImageView *feedImgView;

@end

@implementation UMComSysLikeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier cellSize:(CGSize)cellSize
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier cellSize:cellSize];
    if (self) {
        _cellSize = cellSize;

        self.commentTextView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
        [self.contentView addSubview:self.commentTextView];

        //创建在feed下面有图片的时候单独创建feed作者控件
        self.feedCreatorView = [[UMComMutiStyleTextView alloc] initWithFrame:CGRectMake(UMCom_SysCommonCell_SubViews_LeftEdge, UMCom_SysCommonCell_Content_TopEdge + self.userNameLabel.frame.size.height+10, cellSize.width-80, 50)];
        self.feedCreatorView.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:self.feedCreatorView];

        self.feedImgView = [[UMImageView alloc]initWithFrame: CGRectMake(68, 188, UMCom_SysCommonCell_Feed_IMGHeight, UMCom_SysCommonCell_Feed_IMGHeight)];
        self.feedImgView.hidden = YES;
        [self.contentView addSubview:self.feedImgView];
    }

    return self;
}

- (void)reloadCellWithObj:(id)obj
               timeString:(NSString *)timeString
                 mutiText:(UMComMutiText *)commentMutiText
             feedMutiText:(UMComMutiText *)feedMutiText
{
    self.like = (UMComLike *)obj;
    UMComUser *user = _like.creator;
    NSString *iconUrl = [user iconUrlStrWithType:UMComIconSmallType];

    [self.portrait setImageURL:iconUrl placeHolderImage:[UMComImageView placeHolderImageGender:user.gender.integerValue]];
    //计算头像的位置
    self.portrait.frame = CGRectMake(UMCom_SysCommonCell_Comment_LeftMargin, UMCom_SysCommonCell_Comment_UserImgTopMargin, UMCom_SysCommonCell_Comment_UserImgWidth, UMCom_SysCommonCell_Comment_UserImgHeight);
    self.portrait.layer.cornerRadius = self.portrait.frame.size.width/2;

    //设置timeLabel
    self.timeLabel.textColor = UMComColorWithHexString(@"#A5A5A5");
    self.timeLabel.textAlignment = NSTextAlignmentRight;
    self.timeLabel.font = UMComFontNotoSansLightWithSafeSize(10);
    self.timeLabel.text = timeString;
    CGSize timeStringSize = [timeString sizeWithFont:UMComFontNotoSansLightWithSafeSize(10)];
    CGFloat timeLabelHeight = 0;
    if (timeStringSize.height > UMCom_SysCommonCell_Comment_TimerHeight) {
        timeLabelHeight = timeStringSize.height + 5;//加5个像素的上下margin
    }
    else
    {
        timeLabelHeight = UMCom_SysCommonCell_Comment_TimerHeight + 5;//加5个像素的上下margin
    }

    self.timeLabel.frame = CGRectMake(_cellSize.width-timeStringSize.width - UMCom_SysCommonCell_Comment_RightMargin, UMCom_SysCommonCell_Comment_TimerTopMargin, timeStringSize.width, timeLabelHeight);
    //self.timeLabel.backgroundColor = [UIColor redColor];

    //设置用户的名字
    self.userNameLabel.font = UMComFontNotoSansLightWithSafeSize(14);
    self.userNameLabel.text = self.like.creator.name;
    CGFloat userNameWidth = _cellSize.width - UMCom_SysCommonCell_Comment_LeftMargin - UMCom_SysCommonCell_Comment_UserImgWidth - UMCom_SysCommonCell_Comment_SpaceBetweenUserImgAndUserName - UMCom_SysCommonCell_Comment_RightMargin - self.timeLabel.bounds.size.width;
    CGFloat userNameHeight = UMCom_SysCommonCell_Comment_UserNameHeight + 5;
    self.userNameLabel.frame =CGRectMake(UMCom_SysCommonCell_Comment_LeftMargin + UMCom_SysCommonCell_Comment_UserImgWidth + UMCom_SysCommonCell_Comment_SpaceBetweenUserImgAndUserName, UMCom_SysCommonCell_Comment_UserNameTopMargin, userNameWidth, userNameHeight);

    //self.userNameLabel.backgroundColor = [UIColor grayColor];

    //设置评论内容
    //self.commentTextView.backgroundColor = [UIColor purpleColor];
    CGRect commentFrame = self.commentTextView.frame;
    commentFrame.size.height = UMCom_SysCommonCell_Comment_CommentDefaultHeight;

    commentFrame.size.width = _cellSize.width - self.userNameLabel.frame.origin.x - UMCom_SysCommonCell_Comment_RightMargin;

    commentFrame.origin.x = self.userNameLabel.frame.origin.x;
    commentFrame.origin.y = self.userNameLabel.frame.origin.y + self.userNameLabel.frame.size.height + UMCom_SysCommonCell_Comment_SpaceBetweenUserNameAndComment;

    self.commentTextView.frame = commentFrame;
    self.commentTextView.text = UMComLocalizedString(@"um_com_assistCommentText", @"赞了这条评论");
    self.commentTextView.textColor = UMComColorWithHexString(@"#A5A5A5");
    self.commentTextView.font = UMComFontNotoSansLightWithSafeSize(14);

    //设置feed的背景区域
    UMComFeed *feed = self.like.feed;
    CGFloat bgimageViewHeight = 0;
    if (feed.image_urls && [feed.image_urls count] > 0) {
        //有图片的布局
        if ([feed.status integerValue] < FeedStatusDeleted)
        {
            bgimageViewHeight = UMCom_SysCommonCell_FeedWithIMG_Height;
        }
        else
        {
            bgimageViewHeight = UMCom_SysCommonCell_FeedWithoutIMG_Height;
        }
    }
    else{
        //无图片的布局
        bgimageViewHeight = UMCom_SysCommonCell_FeedWithoutIMG_Height;
    }

    self.bgimageView.frame = CGRectMake(self.userNameLabel.frame.origin.x, self.commentTextView.frame.origin.y + self.commentTextView.frame.size.height + UMCom_SysCommonCell_Comment_CommentBotoom, _cellSize.width - self.userNameLabel.frame.origin.x - UMCom_SysCommonCell_Comment_RightMargin, bgimageViewHeight);

    CGRect bgImageFrame = self.bgimageView.frame;

    //设置背景中的feed
    CGSize userNameSize;
    CGFloat userNamelHeight = 0;
    NSString* userName = feed.creator.name;
    if (feed.image_urls && [feed.image_urls count] > 0)
    {
        if ([feed.status integerValue] < FeedStatusDeleted)
        {
            userName = [NSString stringWithFormat:@"@%@",userName];
            userNameSize = [userName sizeWithFont:UMComFontNotoSansLightWithSafeSize(14)];
            if (userNameSize.width > self.contentView.frame.size.width-80-self.feedImgView.frame.size.width - 12) {
                userNameSize.width = self.contentView.frame.size.width-80-self.feedImgView.frame.size.width - 12;
            }
            //有图片,显示图片,feed的用户,和feedTextView
            self.feedImgView.hidden = NO;
            self.feedImgView.frame = CGRectMake(bgImageFrame.origin.x + UMCom_SysCommonCell_Feed_IMGLeftMargin, bgImageFrame.origin.y + UMCom_SysCommonCell_Feed_IMGTopMargin, UMCom_SysCommonCell_Feed_IMGWidth, UMCom_SysCommonCell_Feed_IMGHeight);
            NSString*  urlString = [[feed.image_urls firstObject] valueForKey:@"small_url_string"];
            if (urlString) {
                self.feedImgView.isAutoStart = YES;
                [self.feedImgView setImageURL:[NSURL URLWithString:urlString] placeholderImage:UMComImageWithImageName(@"photox")];
            }

            //布局有图片的的feedCreatorView
            //设置feedCreatorView的位置
            if (userNameSize.height > UMCom_SysCommonCell_FeedCreator_DefaultHeight) {
                userNamelHeight = userNameSize.height + 5;//加5个margin的距离
            }
            else
            {
                userNamelHeight = UMCom_SysCommonCell_FeedCreator_DefaultHeight + 5;//加5个margin的距离
            }

            self.feedCreatorView.hidden = NO;
            //布局有图片的的feedTextView
            //self.feedTextView.backgroundColor = [UIColor brownColor];
            self.feedCreatorView.frame = CGRectMake(bgImageFrame.origin.x+UMCom_SysCommonCell_FeedCreatorWithImg_LeftMargin, bgImageFrame.origin.y+UMCom_SysCommonCell_FeedCreatorWithImg_TopMargin, userNameSize.width, userNamelHeight);
            self.feedTextView.frame = CGRectMake( self.feedCreatorView.frame.origin.x, self.feedCreatorView.frame.origin.y + self.feedCreatorView.frame.size.height + UMCom_SysCommonCell_SpaceBetweenFeedTextWithIMGAndFeedCreator, bgImageFrame.size.width - (self.feedCreatorView.frame.origin.x -bgImageFrame.origin.x), UMCom_SysCommonCell_FeedTextWithIMG_DefaultHeight);
        }
        else
        {
            self.feedCreatorView.hidden = YES;
            self.feedImgView.hidden = YES;
            //self.feedTextView.backgroundColor = [UIColor brownColor];
            self.feedTextView.frame = CGRectMake(bgImageFrame.origin.x+UMCom_SysCommonCell_FeedCreator_LeftMargin, bgImageFrame.origin.y+UMCom_SysCommonCell_FeedCreator_TopMargin, bgImageFrame.size.width - UMCom_SysCommonCell_FeedCreator_LeftMargin, bgImageFrame.size.height -UMCom_SysCommonCell_FeedCreator_TopMargin);
        }

    }
    else
    {
        if ([feed.status integerValue] < FeedStatusDeleted)
        {
            userName = [NSString stringWithFormat:@"@%@:",userName];
            userNameSize = [userName sizeWithFont:UMComFontNotoSansLightWithSafeSize(14)];
            if (userNameSize.width > self.contentView.frame.size.width-80) {
                userNameSize.width = self.contentView.frame.size.width-80;
            }
            self.feedImgView.hidden = YES;
            self.feedCreatorView.hidden = NO;

            //设置feedCreatorView的位置
            CGFloat userNamelHeight = 0;
            if (userNameSize.height > UMCom_SysCommonCell_FeedCreator_DefaultHeight) {
                userNamelHeight = userNameSize.height + 5;//加5个margin的距离
            }
            else
            {
                userNamelHeight = UMCom_SysCommonCell_FeedCreator_DefaultHeight + 5;//加5个margin的距离
            }

            //self.feedCreatorView.backgroundColor = [UIColor orangeColor];
            self.feedCreatorView.frame = CGRectMake(bgImageFrame.origin.x+UMCom_SysCommonCell_FeedCreator_LeftMargin, bgImageFrame.origin.y+UMCom_SysCommonCell_FeedCreator_TopMargin, userNameSize.width, userNamelHeight);

            //设置feedTextView的位置
            //self.feedTextView.backgroundColor = [UIColor brownColor];
            self.feedTextView.frame = CGRectMake(self.feedCreatorView.frame.origin.x + self.feedCreatorView.frame.size.width, bgImageFrame.origin.y+UMCom_SysCommonCell_FeedTextWithoutIMG_TopMargin, bgImageFrame.size.width - (self.feedCreatorView.frame.origin.x-bgImageFrame.origin.x + self.feedCreatorView.frame.size.width), userNamelHeight);//此处的高度用feedCreatorView的默认高度来保持和feedCreatorView的高度一致

        }
        else
        {
            self.feedImgView.hidden = YES;
            self.feedCreatorView.hidden = YES;
            //self.feedTextView.backgroundColor = [UIColor brownColor];
            self.feedTextView.frame = CGRectMake(bgImageFrame.origin.x+UMCom_SysCommonCell_FeedCreator_LeftMargin, bgImageFrame.origin.y+UMCom_SysCommonCell_FeedCreator_TopMargin, bgImageFrame.size.width - UMCom_SysCommonCell_FeedCreator_LeftMargin, bgImageFrame.size.height -UMCom_SysCommonCell_FeedCreator_TopMargin);
        }
    }

    //设置feedCreatorView的富文本
    __weak typeof(self) weakSelf = self;
    NSMutableArray* feedCheckWords = [NSMutableArray array];
    if(feed.creator.name){
        NSString *checkuserName = [NSString stringWithFormat:UserNameString,feed.creator.name];
        [feedCheckWords addObject:checkuserName];
    }

    UMComMutiText *feedCreatorText = [UMComMutiText mutiTextWithSize:CGSizeMake(userNameSize.width, MAXFLOAT) font:UMComFontNotoSansLightWithSafeSize(14) string:userName lineSpace:2 checkWords:feedCheckWords];
    [self.feedCreatorView setMutiStyleTextViewWithMutiText:feedCreatorText];
    self.feedCreatorView.clickOnlinkText = ^(UMComMutiStyleTextView *styleView,UMComMutiTextRun *run){
        UMComMutiTextRunClickUser *userRun = (UMComMutiTextRunClickUser *)run;
        UMComUser *user = [weakSelf.like.feed relatedUserWithUserName:userRun.text];
        if (!user) {
            //如果为空直接到当前feed的个人中心
            user = weakSelf.like.feed.creator;
        }
        [weakSelf turnToUserCenterWithUser:user];
    };

    //设置feedTextView的富文本
    [self.feedTextView setMutiStyleTextViewWithMutiText:feedMutiText];
    self.feedTextView.clickOnlinkText = ^(UMComMutiStyleTextView *styleView,UMComMutiTextRun *run){
        if ([run isKindOfClass:[UMComMutiTextRunClickUser class]]) {
            UMComMutiTextRunClickUser *userRun = (UMComMutiTextRunClickUser *)run;
            UMComUser *user = [weakSelf.like.feed relatedUserWithUserName:userRun.text];
            if (!user) {
                //如果为空直接到当前feed的个人中心
                user = weakSelf.like.feed.creator;
            }
            [weakSelf turnToUserCenterWithUser:user];
        }else if ([run isKindOfClass:[UMComMutiTextRunTopic class]])
        {
            UMComMutiTextRunTopic *topicRun = (UMComMutiTextRunTopic *)run;
            UMComTopic *topic = [weakSelf.like.feed relatedTopicWithTopicName:topicRun.text];
            [weakSelf turnToTopicViewWithTopic:topic];
        }else{
            if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(customObj:clickOnFeedText:)]) {
                __strong typeof(weakSelf)strongSelf = weakSelf;
                [weakSelf.delegate customObj:strongSelf clickOnFeedText:weakSelf.like.feed];
            }
        }
    };

}

#pragma mark - override method
//点赞用户头像
- (void)didSelectedUser
{
    [self turnToUserCenterWithUser:self.like.creator];
}

-(void)handleGesture:(UIGestureRecognizer*)gestureRecognizer
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(customObj:clickOnFeedText:)]) {
        [self.delegate customObj:self clickOnFeedText:self.like.feed];
    }
}

@end


text:
package com.squareup.wire.schema.internal.parser;

import java.io.File;

public class RpcMethodDefinition {

    protected String methodName;
    protected String requestType;
    protected String responseType;
    protected String packageName;
    protected String sourceFileName;

    public RpcMethodDefinition(String methodName, String requestType, String responseType, String packageName, String sourceFileName) {
        this.methodName = methodName;
        this.requestType = requestType;
        this.responseType = responseType;
        this.packageName = packageName;
        this.sourceFileName = sourceFileName;
    }

    public String getMethodName() {
        return methodName;
    }

    public String getRequestType() {
        return requestType;
    }

    public String getResponseType() {
        return responseType;
    }

    public String getPackageName() {
        return packageName;
    }

    public String getSourceFileName() {
        return sourceFileName;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package demotls

import (
	"crypto/tls"
	"crypto/x509"
	"fmt"

	"github.com/tangfeixiong/go-to-bigdata/insecure"
)

const (
	port = 10000
)

var (
	demoKeyPair  *tls.Certificate
	demoCertPool *x509.CertPool
	demoAddr     string
)

func init() {
	var err error
	pair, err := tls.X509KeyPair([]byte(insecure.Cert), []byte(insecure.Key))
	if err != nil {
		panic(err)
	}
	demoKeyPair = &pair
	demoCertPool = x509.NewCertPool()
	ok := demoCertPool.AppendCertsFromPEM([]byte(insecure.Cert))
	if !ok {
		panic("bad certs")
	}
	demoAddr = fmt.Sprintf("localhost:%d", port)
}


text:
namespace Microsoft.Azure.Management.AppPlatform
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// BuildServiceBuilderOperations operations.
    /// </summary>
    public partial interface IBuildServiceBuilderOperations
    {
        /// <summary>
        /// Get a KPack builder.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group that contains the resource. You can
        /// obtain this value from the Azure Resource Manager API or the
        /// portal.
        /// </param>
        /// <param name='serviceName'>
        /// The name of the Service resource.
        /// </param>
        /// <param name='buildServiceName'>
        /// The name of the build service resource.
        /// </param>
        /// <param name='builderName'>
        /// The name of the builder resource.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<BuilderResource>> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, string buildServiceName, string builderName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Create or update a KPack builder.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group that contains the resource. You can
        /// obtain this value from the Azure Resource Manager API or the
        /// portal.
        /// </param>
        /// <param name='serviceName'>
        /// The name of the Service resource.
        /// </param>
        /// <param name='buildServiceName'>
        /// The name of the build service resource.
        /// </param>
        /// <param name='builderName'>
        /// The name of the builder resource.
        /// </param>
        /// <param name='builderResource'>
        /// The target builder for the create or update operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<BuilderResource>> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string buildServiceName, string builderName, BuilderResource builderResource, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Delete a KPack builder.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group that contains the resource. You can
        /// obtain this value from the Azure Resource Manager API or the
        /// portal.
        /// </param>
        /// <param name='serviceName'>
        /// The name of the Service resource.
        /// </param>
        /// <param name='buildServiceName'>
        /// The name of the build service resource.
        /// </param>
        /// <param name='builderName'>
        /// The name of the builder resource.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string buildServiceName, string builderName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List KPack builders result.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group that contains the resource. You can
        /// obtain this value from the Azure Resource Manager API or the
        /// portal.
        /// </param>
        /// <param name='serviceName'>
        /// The name of the Service resource.
        /// </param>
        /// <param name='buildServiceName'>
        /// The name of the build service resource.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<BuilderResource>>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, string buildServiceName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Create or update a KPack builder.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group that contains the resource. You can
        /// obtain this value from the Azure Resource Manager API or the
        /// portal.
        /// </param>
        /// <param name='serviceName'>
        /// The name of the Service resource.
        /// </param>
        /// <param name='buildServiceName'>
        /// The name of the build service resource.
        /// </param>
        /// <param name='builderName'>
        /// The name of the builder resource.
        /// </param>
        /// <param name='builderResource'>
        /// The target builder for the create or update operation
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<BuilderResource>> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string buildServiceName, string builderName, BuilderResource builderResource, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Delete a KPack builder.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group that contains the resource. You can
        /// obtain this value from the Azure Resource Manager API or the
        /// portal.
        /// </param>
        /// <param name='serviceName'>
        /// The name of the Service resource.
        /// </param>
        /// <param name='buildServiceName'>
        /// The name of the build service resource.
        /// </param>
        /// <param name='builderName'>
        /// The name of the builder resource.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string buildServiceName, string builderName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List KPack builders result.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<BuilderResource>>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
    }
}


text:
package LeetcodeTemplate;

public class _0084LargestRectangleInHistogram {

	public static void main(String[] args) {
		System.out.println(largestRectangleArea(new int[] { 2, 1, 5, 6, 2, 3 }));
	}

	public static int largestRectangleArea(int[] heights) {

	}
}


text:
package org.arquillian.smart.testing.mvn.ext.custom.assertions;

import org.arquillian.smart.testing.mvn.ext.checker.SkipInstallationChecker;
import org.assertj.core.api.SoftAssertions;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

public class MavenExtensionSoftAssertions extends SoftAssertions implements TestRule {

    public SkipInstallationCheckerAssert assertThat(SkipInstallationChecker actual) {
        return proxy(SkipInstallationCheckerAssert.class, SkipInstallationChecker.class, actual);
    }

    @Override
    public Statement apply(Statement base, Description description) {
        return new Statement() {
            public void evaluate() throws Throwable {
                base.evaluate();
                assertAll();
            }
        };
    }
}


text:
var gotFromServer = JSON.parse($("#data").html());
console.log(JSON.stringify(gotFromServer));

var questions = [];

gotFromServer.forEach(function(question, question_index) {
	questions.push([ "
", question.question, "
" ].join("")
	.concat(
		question.answers.map(function(answer, index) {
			return ["<input id='",
				answer.id,
				"' required type='radio' name='",
				question_index,
				"'> " ,
				answer.answerText ,
				"
"].join("");
		}) .join("")
	).concat("
"));
});

$(".questions").html(questions.reduce(function(result, item) {
	return result.concat(item);
},""));

function parseJson() {
	var dom_questions = {}
	var last_question;
	$(".questions")
		.children()
		.map(function() {
			if($(this).prop("tagName") == "H3") {
				last_question = this.id;
				dom_questions[this.id] = {
					id: this.id,
					question: $(this).text(),
					answers: []
				};
			}
			if($(this).prop("tagName") == "INPUT") {
				dom_questions[last_question].answers.push({
					id: this.id,
					correct: $(this).is(':checked')
				});
			}
			return this;
		});
	return JSON.stringify(dom_questions);
}

$("#send").click(function(e) {
	$("#test").val(parseJson());
});


text:
'use strict'

import { createStore } from 'redux'
import rootReducer from '../reducers'

function configureStore(initialState={}) {
  const store = createStore(rootReducer, initialState)
  return store
}

export default configureStore


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:startColor="@color/color_gray_000000_22"
        android:centerColor="@color/color_gray_000000_12"
        android:endColor="@color/color_transparent_000000_00"
        android:angle="-90" />
</shape>


text:
cask 'mumble' do
  version '1.3.1'
  sha256 '052ba6d5bc1fc64aed90881bcab036bf93ae857228be316243a6eb15dac99ce6'

  # github.com/mumble-voip/mumble/ was verified as official when first introduced to the cask
  url "https://github.com/mumble-voip/mumble/releases/download/#{version}/Mumble-#{version}.dmg"
  appcast 'https://github.com/mumble-voip/mumble/releases.atom'
  name 'Mumble'
  homepage 'https://wiki.mumble.info/wiki/Main_Page'

  app 'Mumble.app'
end


text:
__attribute__((visibility("hidden")))
@interface BufferInfo : NSObject
{
    unsigned long long _size;
    unsigned long long _usage;
}

@property(readonly, nonatomic) unsigned long long usage; // @synthesize usage=_usage;
@property(readonly, nonatomic) unsigned long long size; // @synthesize size=_size;
- (void)resetUsage;
- (void)incrementUsage;
- (id)initWithSize:(unsigned long long)arg1 usage:(unsigned long long)arg2;

@end


text:
using System;
using System.Collections.Generic;
using System.Data.Entity;

namespace EF_Sample07.DataLayer.Context
{
    public interface IUnitOfWork : IDisposable
    {
        IDbSet<TEntity> Set<TEntity>() where TEntity : class;
        int SaveAllChanges();
        void MarkAsChanged<TEntity>(TEntity entity) where TEntity : class;
        IList<T> GetRows<T>(string sql, params object[] parameters) where T : class;
        IEnumerable<TEntity> AddThisRange<TEntity>(IEnumerable<TEntity> entities) where TEntity : class;
        void SetConnectionString(string connectionString);
    }
}


text:
using Babe.Lua;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Babe.Lua.Package;
using Babe.Lua.Grammar;

namespace Babe.Lua.DataModel
{
	class FileManager
	{
		public List<LuaFile> Files { get; private set; }

		public List<LuaMember> CurrentFileToken { get; private set; }

		int _current = -1;
		public LuaFile CurrentFile
		{
			get
			{
				if (_current != -1) return Files[_current];
				else return null;
			}
			set
			{
				if (_current != -1 && value != null)
				{
					Files[_current] = value;
					RefreshCurrentFile();
				}
				else
				{
					_current = -1;
				}
			}
		}

		static FileManager _instance;
		public static FileManager Instance
		{
			get
			{
				if (_instance == null) _instance = new FileManager();
				return _instance;
			}
		}

		private FileManager()
		{
			Files = new List<LuaFile>();
			CurrentFileToken = new List<LuaMember>();
		}

		public void ClearData()
		{
			Files.Clear();
			CurrentFileToken.Clear();
			_current = -1;
		}

		public void AddFile(LuaFile file)
		{
			var index = Files.IndexOf(file);
			if (index != -1) Files[index] = file;
			else
			{
				Files.Add(file);
			}
		}

		public void SetActiveFile(string file)
		{
			for (int i = 0; i < Files.Count; i++)
			{
				if (file.Equals(Files[i].File))
				{
					_current = i;

					RefreshCurrentFile();

					return;
				}
			}
		}

		public void RefreshCurrentFile()
		{
			if (CurrentFile != null)
			{
				CurrentFileToken = new List<LuaMember>();
				foreach (var token in CurrentFile.Tokens)
				{
					if (token.Category == Irony.Parsing.TokenCategory.Content && token.Terminal.Name == LuaTerminalNames.Identifier)
						CurrentFileToken.Add(new LuaMember(token));
				}
			}
		}

		public List<LuaMember> GetAllGlobals()
		{
			List<LuaMember> list = new List<LuaMember>();
			for (int i = 0; i < Files.Count; i++)
			{
				list.AddRange(Files[i].Members);
			}
			return list;
		}

		public List<LuaMember> SearchInFile(LuaFile file, string keyword)
		{
			List<LuaMember> members = new List<LuaMember>();

			if (file != null)
			{
				try
				{
					System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(System.Text.RegularExpressions.Regex.Escape(keyword));

					List<string> lines = new List<string>();
					using (StreamReader sr = new StreamReader(file.File))
					{
						while (sr.Peek() >= 0)
						{
							lines.Add(sr.ReadLine());
						}
					}

					for (int i = 0; i < lines.Count; i++)
					{
						var match = reg.Match(lines[i]);
						while (match.Success)
						{
							var lm = new LuaMember(keyword, i, match.Index);
							lm.Preview = lines[i];
							lm.File = file;
							members.Add(lm);
							match = match.NextMatch();
						}
					}

					//int index = -1;
					//for(int i = 0;i<lines.Count;i++)
					//{
					//	index = lines[i].IndexOf(keyword);
					//	while (index != -1)
					//	{
					//		var lm = new LuaMember(keyword, i, index);
					//		lm.Preview = lines[i];
					//		lm.File = file.File;
					//		members.Add(lm);
					//		index = lines[i].IndexOf(keyword, index + keyword.Length);
					//	}
					//}
				}
				catch { }
			}

			return members;
		}

		public List<LuaMember> Search(string keyword, bool AllFile)
		{
			List<LuaMember> results = new List<LuaMember>();
			if (!AllFile)
			{
				//var result = Babe.Lua.TextMarker.FindWordTaggerProvider.CurrentTagger.SearchText(keyword);
				//foreach (var span in result)
				//{
				//	var line = span.Start.GetContainingLine();
				//	var lm = new LuaMember(keyword, line.LineNumber, span.Start - line.Start);
				//	lm.File = DTEHelper.Current.DTE.ActiveDocument.FullName;
				//	lm.Preview = line.GetText();
				//	results.Add(lm);
				//}
				DTEHelper.Current.DTE.ActiveDocument.Save();
				results = SearchInFile(CurrentFile, keyword);
			}
			else
			{
				DTEHelper.Current.DTE.Documents.SaveAll();
				//bool saved = false;
				//while (!saved)
				//{
				//	saved = true;
				//	foreach (EnvDTE.Document doc in DTEHelper.Current.DTE.Documents)
				//	{
				//		if (!doc.Saved)
				//		{
				//			saved = false;
				//			break;
				//		}
				//	}
				//}

				//List<LuaMember> members = new List<LuaMember>();

				//HashSet<string> OpenFiles = new HashSet<string>();
				//foreach (EnvDTE.Document doc in DTEHelper.Current.DTE.Documents)
				//{
				//	OpenFiles.Add(doc.FullName);

				//}

				for (int i = 0; i < Files.Count; i++)
				{
					//if (OpenFiles.Contains(Files[i].File)) continue;
					results.AddRange(SearchInFile(Files[i], keyword));
				}
			}

			return results;
		}

		public List<LuaMember> FindDefination(string keyword)
		{
			List<LuaMember> members = new List<LuaMember>();

			string[] keywords = keyword.Split(new char[] { '.', ':' }, StringSplitOptions.RemoveEmptyEntries);
			if (keywords.Length == 0) return null;

			for (int i = 0; i < Files.Count; i++)
			{
				try
				{
					List<string> lines = new List<string>();
					using (StreamReader sr = new StreamReader(Files[i].File))
					{
						while (sr.Peek() >= 0)
						{
							lines.Add(sr.ReadLine());
						}
					}

					foreach (LuaMember member in Files[i].Members)
					{
						if (member is LuaTable)
						{
							foreach (LuaMember lm in (member as LuaTable).Members)
							{
								if (lm.Name.Equals(keyword))
								{
									var lmp = lm.Copy();
									lmp.Preview = lines[lm.Line];
									lmp.File = Files[i];
									members.Add(lmp);
								}
							}
						}

						if (member.Name.Equals(keyword))
						{
							var lmp = member.Copy();
							lmp.Preview = lines[member.Line];
							lmp.File = Files[i];
							members.Add(lmp);
						}
					}
				}
				catch { }
			}

			return members;
		}

		public IEnumerable<LuaMember> FindReferencesInFile(LuaFile file, string keyword)
		{
			if (file != null)
			{
				List<string> lines = new List<string>();
				try
				{
					using (StreamReader sr = new StreamReader(file.File))
					{
						while (sr.Peek() >= 0)
						{
							lines.Add(sr.ReadLine());
						}
					}
				}
				catch
                {
                    yield break;
                }

                //for (int i = 0; i < file.Tokens.Count; i++)
                //{
                //    if(file.Tokens[i].Text.Equals(keyword))
                //    {
                //        var lm = new LuaMember(file.Tokens[i]);
                //        lm.Preview = lines[lm.Line];
                //        lm.File = file;
                //        yield return lm;
                //    }
                //}
                foreach (var token in file.Tokens)
                {
                    if (token.EditorInfo == null || token.EditorInfo.Type != Irony.Parsing.TokenType.String)
                    {
                        if (token.ValueString.Equals(keyword))
                        {
                            var lmp = new LuaMember(token);
                            lmp.Preview = lines[lmp.Line];
                            lmp.File = file;
                            yield return lmp;
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(token.ValueString)) continue;
                        int index = token.ValueString.IndexOf(keyword);
                        if (index != -1)
                        {

                            var lmp = new LuaMember(keyword, token.Location.Line, token.Location.Column + 1 + index);
                            lmp.Preview = lines[lmp.Line];
                            lmp.File = file;
                            yield return lmp;
                        }
                    }
                }
			}
		}

		public IEnumerable<IEnumerable<LuaMember>> FindReferences(string keyword, bool AllFile)
		{
			if (!AllFile)
			{
				DTEHelper.Current.DTE.ActiveDocument.Save();
				yield return FindReferencesInFile(CurrentFile, keyword);
			}
			else
			{
				DTEHelper.Current.DTE.Documents.SaveAll();

				for (int i = 0; i < Files.Count; i++)
				{
					yield return FindReferencesInFile(Files[i], keyword);
                }
			}
		}
	}
}


text:
package org.apache.reef.wake.time.event;

import org.apache.reef.wake.EventHandler;
import org.apache.reef.wake.time.Time;

/**
 * An alarm is a timer event to be invoked at a given time.
 * Contains a (future) timestamp and the event handler to invoke.
 */
public abstract class Alarm extends Time implements Runnable {

  private final EventHandler<Alarm> handler;

  public Alarm(final long timestamp, final EventHandler<Alarm> handler) {
    super(timestamp);
    this.handler = handler;
  }

  /**
   * Invoke the event handler and pass a reference to self as a parameter.
   */
  @Override
  public final void run() {
    this.handler.onNext(this);
  }
}


text:
layout: post
title:  "Using Jupyter Notebook"
date:   2017-08-15 16:04:00 +0800
categories: ["development", "python"]
---

Install Anaconda for use of Jupyter Notebook.

Run Jupyter Notebook in localhost using: `jupyter notebook` or launch it from Anaconda-Navigator.


text:
<?php

/**
 * This code was generated by
 * \ / _    _  _|   _  _
 * | (_)\/(_)(_|\/| |(/_  v1.0.0
 * /       /
 */

namespace Twilio\Tests\Integration\Video\V1\Room;

use Twilio\Exceptions\DeserializeException;
use Twilio\Exceptions\TwilioException;
use Twilio\Http\Response;
use Twilio\Tests\HolodeckTestCase;
use Twilio\Tests\Request;

class RoomRecordingTest extends HolodeckTestCase {
    public function testFetchRequest() {
        $this->holodeck->mock(new Response(500, ''));

        try {
            $this->twilio->video->v1->rooms("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                                    ->recordings("RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch();
        } catch (DeserializeException $e) {}
          catch (TwilioException $e) {}

        $this->assertRequest(new Request(
            'get',
            'https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
        ));
    }

    public function testFetchResponse() {
        $this->holodeck->mock(new Response(
            200,
            '
            {
                "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "status": "processing",
                "date_created": "2015-07-30T20:00:00Z",
                "sid": "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "source_sid": "MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "size": 0,
                "type": "audio",
                "duration": 0,
                "container_format": "mka",
                "codec": "OPUS",
                "grouping_sids": {
                    "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                },
                "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "links": {
                    "media": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media"
                }
            }
            '
        ));

        $actual = $this->twilio->video->v1->rooms("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                                          ->recordings("RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch();

        $this->assertNotNull($actual);
    }

    public function testReadRequest() {
        $this->holodeck->mock(new Response(500, ''));

        try {
            $this->twilio->video->v1->rooms("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                                    ->recordings->read();
        } catch (DeserializeException $e) {}
          catch (TwilioException $e) {}

        $this->assertRequest(new Request(
            'get',
            'https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings'
        ));
    }

    public function testReadEmptyResponse() {
        $this->holodeck->mock(new Response(
            200,
            '
            {
                "recordings": [],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "recordings"
                }
            }
            '
        ));

        $actual = $this->twilio->video->v1->rooms("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                                          ->recordings->read();

        $this->assertNotNull($actual);
    }

    public function testReadResultsResponse() {
        $this->holodeck->mock(new Response(
            200,
            '
            {
                "recordings": [
                    {
                        "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "status": "completed",
                        "date_created": "2015-07-30T20:00:00Z",
                        "sid": "RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "source_sid": "MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "size": 23,
                        "type": "audio",
                        "duration": 10,
                        "container_format": "mka",
                        "codec": "OPUS",
                        "grouping_sids": {
                            "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                            "participant_sid": "PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                        },
                        "room_sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "links": {
                            "media": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings/RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media"
                        }
                    }
                ],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings?PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "recordings"
                }
            }
            '
        ));

        $actual = $this->twilio->video->v1->rooms("RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                                          ->recordings->read();

        $this->assertNotNull($actual);
    }
}


text:
package com.jetbrains.python.codeInsight.completion;

import com.intellij.codeInsight.AutoPopupController;
import com.intellij.codeInsight.completion.InsertionContext;
import com.intellij.codeInsight.completion.util.ParenthesesInsertHandler;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.psi.PyFunction;
import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.impl.PyCallExpressionHelper;
import com.jetbrains.python.psi.resolve.PyResolveContext;

/**
 * @author yole
 */
public class PyFunctionInsertHandler extends ParenthesesInsertHandler<LookupElement> {
  public static PyFunctionInsertHandler INSTANCE = new PyFunctionInsertHandler();

  @Override
  public void handleInsert(InsertionContext context, LookupElement item) {
    super.handleInsert(context, item);
    if (hasParams(context, item)) {
      AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), (PyFunction) item.getObject());
    }
  }

  @Override
  protected boolean placeCaretInsideParentheses(InsertionContext context, LookupElement item) {
    return hasParams(context, item);
  }

  private static boolean hasParams(InsertionContext context, LookupElement item) {
    return hasParams(context, (PyFunction) item.getObject());
  }

  public static boolean hasParams(InsertionContext context, PyFunction function) {
    final PsiElement element = context.getFile().findElementAt(context.getStartOffset());
    PyReferenceExpression refExpr = PsiTreeUtil.getParentOfType(element, PyReferenceExpression.class);
    int implicitArgsCount = refExpr != null
                            ? PyCallExpressionHelper.getImplicitArgumentCount(refExpr, function, PyResolveContext.noImplicits())
                            : 0;
    return function.getParameterList().getParameters().length > implicitArgsCount;
  }
}


text:
package org.tensorflow.distruntime;

public interface CleanupAllResponseOrBuilder extends
    // @@protoc_insertion_point(interface_extends:tensorflow.CleanupAllResponse)
    com.google.protobuf.MessageOrBuilder {
}


text:
import { DatePipe } from '@angular/common';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { AgendaEvent, EventPresenceStatus } from '../../interfaces/agenda.interfaces';

@Component({
  selector: 'agenda-events',
  encapsulation: ViewEncapsulation.None,
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: 'agenda.component.html',
  styles: [ `
    .limited-description {
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      line-height: 16px; /* fallback */
      max-height: 58px; /* fallback */
      -webkit-line-clamp: 3; /* number of lines to show */
      -webkit-box-orient: vertical;
    }` ],
})
export class AgendaComponent {
  statuses = EventPresenceStatus;
  @Input() events: AgendaEvent[];
  @Output() detailClicked = new EventEmitter<AgendaEvent>();

  constructor(private datePipe: DatePipe) {
  }

  showDetails(event: AgendaEvent) {
    this.detailClicked.emit(event);
  }

  getFormattedDate(date: string) {
    return `${this.datePipe.transform(date, 'mediumDate')} ${this.datePipe.transform(date, 'shortTime')}`;
  }
}


text:
@interface DateUtil : NSObject

+ (NSDate *)toDate:(NSString *)datetimeString;

+ (NSString *)stringFromDate:(NSDate *)date;

+ (NSDate *)getDateFormString:(NSString *)str;

+ (NSDate *)getDateFormStringWithTimeZone:(NSString *)str;

+ (NSString *)getRelativeDate:(NSDate *)date;

+ (NSString *)getStringFromDate:(NSDate *)date;

+ (NSDate *)getFirstTimeOfYear:(int)year;

+ (NSCalendar *)gregorian;
@end


text:
<?php

namespace Seat\EveApi\Corporation;

use Seat\EveApi\BaseApi;
use Pheal\Pheal;

class Titles extends BaseApi
{

    static function getRolesFromRolegroup($rolegroup)
    {
        $roles = array();
        if(count($rolegroup) > 0) {
            foreach($rolegroup as $role) {
                array_push($roles, $role->roleID);
            }
        }
        return json_encode($roles);
    }

    public static function Update($keyID, $vCode)
    {

        // Start and validate they key pair
        BaseApi::bootstrap();
        BaseApi::validateKeyPair($keyID, $vCode);

        // Set key scopes and check if the call is banned
        $scope = 'Corp';
        $api = 'Titles';

        if (BaseApi::isBannedCall($api, $scope, $keyID))
            return;

        // Get the characters for this key
        $characters = BaseApi::findKeyCharacters($keyID);

        // Check if this key has any characters associated with it
        if (!$characters)
            return;

        // Lock the call so that we are the only instance of this running now()
        // If it is already locked, just return without doing anything
        if (!BaseApi::isLockedCall($api, $scope, $keyID))
            $lockhash = BaseApi::lockCall($api, $scope, $keyID);
        else
            return;

        // So I think a corporation key will only ever have one character
        // attached to it. So we will just use that characterID for auth
        // things, but the corporationID for locking etc.
        $corporationID = BaseApi::findCharacterCorporation($characters[0]);

        // Prepare the Pheal instance
        $pheal = new Pheal($keyID, $vCode);

        // Do the actual API call. pheal-ng actually handles some internal
        // caching too.
        try {

            $title_list = $pheal
                ->corpScope
                ->Titles(array('characterID' => $characters[0]));

        } catch (\Pheal\Exceptions\APIException $e) {

            // If we cant get account status information, prevent us from calling
            // this API again
            BaseApi::banCall($api, $scope, $keyID, 0, $e->getCode() . ': ' . $e->getMessage());
            return;

        } catch (\Pheal\Exceptions\PhealException $e) {

            throw $e;
        }

        // Check if the data in the database is still considered up to date.
        // checkDbCache will return true if this is the case
        if (!BaseApi::checkDbCache($scope, $api, $title_list->cached_until, $corporationID)) {

            foreach ($title_list->titles as $title) {

                $title_data = \EveCorporationTitlemap::where('corporationID', '=', $corporationID)
                    ->where('titleID', '=', $title->titleID)
                    ->first();

                if (!$title_data)
                    $title_info = new \EveCorporationTitlemap;
                else
                    $title_info = $title_data;

                $title_info->corporationID         = $corporationID;
                $title_info->titleID               = $title->titleID;
                $title_info->titleName             = $title->titleName;
                $title_info->roles                 = Titles::getRolesFromRolegroup($title->roles);
                $title_info->grantableRoles        = Titles::getRolesFromRolegroup($title->grantableRoles);
                $title_info->rolesAtHQ             = Titles::getRolesFromRolegroup($title->rolesAtHQ);
                $title_info->grantableRolesAtHQ    = Titles::getRolesFromRolegroup($title->grantableRolesAtHQ);
                $title_info->rolesAtBase           = Titles::getRolesFromRolegroup($title->rolesAtBase);
                $title_info->grantableRolesAtBase  = Titles::getRolesFromRolegroup($title->grantableRolesAtBase);
                $title_info->rolesAtOther          = Titles::getRolesFromRolegroup($title->rolesAtOther);
                $title_info->grantableRolesAtOther = Titles::getRolesFromRolegroup($title->grantableRolesAtOther);
                $title_info->save();

            }

            // Update the cached_until time in the database for this api call
            BaseApi::setDbCache($scope, $api, $title_list->cached_until, $corporationID);
        }

        // Unlock the call
        BaseApi::unlockCall($lockhash);

        return $title_list;
    }
}


text:
import { Arr, Obj, Type } from '@ephox/katamari';

import Editor from 'tinymce/core/api/Editor';
import { Dialog } from 'tinymce/core/api/ui/Ui';
import I18n from 'tinymce/core/api/util/I18n';

import * as Options from '../api/Options';
import * as PluginUrls from '../data/PluginUrls';

interface PluginData {
  // The name is just used for sorting alphabetically.
  readonly name: string;
  readonly html: string;
}

const tab = (editor: Editor): Dialog.TabSpec & { name: string } => {
  const availablePlugins = () => {
    const premiumPlugins = Arr.filter(PluginUrls.urls, ({ type }) => {
      return type === PluginUrls.PluginType.Premium;
    });

    const sortedPremiumPlugins = Arr.sort(
      Arr.map(premiumPlugins, (p) => p.name),
      (s1, s2) => s1.localeCompare(s2)
    );

    const premiumPluginList = Arr.map(sortedPremiumPlugins, (pluginName) => `<li>${pluginName}</li>`).join('');
    return '
' +
      '
' + I18n.translate('Premium plugins:') + '
' +
      '
' +
      premiumPluginList +
      '
' + I18n.translate('Learn more...') + '
' +
      '
' +
      '
';
  };

  const makeLink = (p: { name: string; url: string }): string =>
    `<a href="${p.url}" target="_blank" rel="noopener">${p.name}</a>`;

  const identifyUnknownPlugin = (editor: Editor, key: string): PluginData => {
    const getMetadata = editor.plugins[key].getMetadata;
    if (Type.isFunction(getMetadata)) {
      const metadata = getMetadata();
      return { name: metadata.name, html: makeLink(metadata) };
    } else {
      return { name: key, html: key };
    }
  };

  const getPluginData = (editor: Editor, key: string): PluginData => Arr.find(PluginUrls.urls, (x) => {
    return x.key === key;
  }).fold(() => {
    return identifyUnknownPlugin(editor, key);
  }, (x) => {
    // We know this plugin, so use our stored details.
    const name = x.type === PluginUrls.PluginType.Premium ? `${x.name}*` : x.name;
    const html = makeLink({ name, url: `https://www.tiny.cloud/docs/tinymce/6/${x.slug}/` });
    return { name, html };
  });

  const getPluginKeys = (editor: Editor) => {
    const keys = Obj.keys(editor.plugins);
    const forcedPlugins = Options.getForcedPlugins(editor);

    return Type.isUndefined(forcedPlugins) ?
      keys :
      Arr.filter(keys, (k) => !Arr.contains(forcedPlugins, k));
  };

  const pluginLister = (editor: Editor) => {
    const pluginKeys = getPluginKeys(editor);
    const sortedPluginData = Arr.sort(
      Arr.map(pluginKeys, (k) => getPluginData(editor, k)),
      (pd1, pd2) => pd1.name.localeCompare(pd2.name)
    );

    const pluginLis = Arr.map(sortedPluginData, (key) => {
      return '
' + key.html + '
';
    });
    const count = pluginLis.length;
    const pluginsString = pluginLis.join('');

    const html = '
' + I18n.translate([ 'Plugins installed ({0}):', count ]) + '
' +
      '
' + pluginsString + '
';

    return html;
  };

  const installedPlugins = (editor: Editor) => {
    if (editor == null) {
      return '';
    }
    return '
' +
      pluginLister(editor) +
      '
';
  };

  const htmlPanel: Dialog.HtmlPanelSpec = {
    type: 'htmlpanel',
    presets: 'document',
    html: [
      installedPlugins(editor),
      availablePlugins()
    ].join('')
  };
  return {
    name: 'plugins',
    title: 'Plugins',
    items: [
      htmlPanel
    ]
  };
};

export {
  tab
};


text:
FROM kollaglue/fedora-rdo-nova-base
MAINTAINER Steven Dake <sdake@redhat.com>

# broken out by operation - we don't need libvirt and
# 200 deps for libguestfs (?)
RUN yum -y install curl \
	iscsi-initiator-utils \
	iptables \
	iptables-ipv6 \
	ipmitool \
	libvirt-python \
	python-libguestfs \
	openssh-clients \
	rsync \
	lvm2 \
	python-cinderclient \
	genisoimage \
	bridge-utils \
	openstack-nova-compute \
	; yum clean all

ADD ./start.sh /start.sh
CMD ["/start.sh"]


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.maps.route.implementation.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/** Defines values for GeoJsonObjectType. */
public enum GeoJsonObjectType {
    /** Enum value Point. */
    GEO_JSON_POINT("Point"),

    /** Enum value MultiPoint. */
    GEO_JSON_MULTI_POINT("MultiPoint"),

    /** Enum value LineString. */
    GEO_JSON_LINE_STRING("LineString"),

    /** Enum value MultiLineString. */
    GEO_JSON_MULTI_LINE_STRING("MultiLineString"),

    /** Enum value Polygon. */
    GEO_JSON_POLYGON("Polygon"),

    /** Enum value MultiPolygon. */
    GEO_JSON_MULTI_POLYGON("MultiPolygon"),

    /** Enum value GeometryCollection. */
    GEO_JSON_GEOMETRY_COLLECTION("GeometryCollection"),

    /** Enum value Feature. */
    GEO_JSON_FEATURE("Feature"),

    /** Enum value FeatureCollection. */
    GEO_JSON_FEATURE_COLLECTION("FeatureCollection");

    /** The actual serialized value for a GeoJsonObjectType instance. */
    private final String value;

    GeoJsonObjectType(String value) {
        this.value = value;
    }

    /**
     * Parses a serialized value to a GeoJsonObjectType instance.
     *
     * @param value the serialized value to parse.
     * @return the parsed GeoJsonObjectType object, or null if unable to parse.
     */
    @JsonCreator
    public static GeoJsonObjectType fromString(String value) {
        GeoJsonObjectType[] items = GeoJsonObjectType.values();
        for (GeoJsonObjectType item : items) {
            if (item.toString().equalsIgnoreCase(value)) {
                return item;
            }
        }
        return null;
    }

    @JsonValue
    @Override
    public String toString() {
        return this.value;
    }
}


text:
require 'rubygems'
require 'capistrano'
require 'fileutils'

example_deploy = File.join(File.dirname(__FILE__), 'deploy.rb.example')
real_deploy = File.join(RAILS_ROOT, 'config', 'deploy.rb')
real_example = File.join(RAILS_ROOT, 'config', 'deploy.rb.example')

if !File.exists? real_deploy
  FileUtils.cp example_deploy, real_deploy
  puts "SuperDeploy installed. Please edit config/deploy.rb"
elsif !File.exists? real_example
  FileUtils.cp example_deploy, real_example
  puts "SuperDeploy installed. Please edit config/deploy.rb.example"
else
  puts "You already have a config/deploy.rb.example file..."
end

exec "capify #{RAILS_ROOT}"


text:
/a/lib/tsc.js -w
//// [/user/username/projects/myproject/a.ts]
import { x } from "../b";

//// [/user/username/projects/b.ts]
export const x = 10;

//// [/user/username/projects/myproject/tsconfig.json]
{"compilerOptions":{"rootDir":".","outDir":"lib"}}

//// [/a/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }

//// [/user/username/projects/myproject/lib/b.js]
"use strict";
exports.__esModule = true;
exports.x = 10;

//// [/user/username/projects/myproject/lib/myproject/a.js]
"use strict";
exports.__esModule = true;

Output::
>> Screen clear
12:00:23 AM - Starting compilation in watch mode...

a.ts(1,19): error TS6059: File '/user/username/projects/b.ts' is not under 'rootDir' '/user/username/projects/myproject'. 'rootDir' is expected to contain all source files.

12:00:34 AM - Found 1 error. Watching for file changes.

Program root files: ["/user/username/projects/myproject/a.ts"]
Program options: {"rootDir":"/user/username/projects/myproject","outDir":"/user/username/projects/myproject/lib","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/b.ts
/user/username/projects/myproject/a.ts

Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/user/username/projects/b.ts
/user/username/projects/myproject/a.ts

WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
  {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/a.ts:
  {"fileName":"/user/username/projects/myproject/a.ts","pollingInterval":250}
/user/username/projects/b.ts:
  {"fileName":"/user/username/projects/b.ts","pollingInterval":250}
/a/lib/lib.d.ts:
  {"fileName":"/a/lib/lib.d.ts","pollingInterval":250}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/node_modules/@types:
  {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject:
  {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}

exitCode:: ExitStatus.undefined

Change:: Make changes to file a

//// [/user/username/projects/myproject/a.ts]

import { x } from "../b";

//// [/user/username/projects/myproject/lib/myproject/a.js] file written with same contents

Output::
>> Screen clear
12:00:38 AM - File change detected. Starting incremental compilation...

a.ts(3,19): error TS6059: File '/user/username/projects/b.ts' is not under 'rootDir' '/user/username/projects/myproject'. 'rootDir' is expected to contain all source files.

12:00:42 AM - Found 1 error. Watching for file changes.

Program root files: ["/user/username/projects/myproject/a.ts"]
Program options: {"rootDir":"/user/username/projects/myproject","outDir":"/user/username/projects/myproject/lib","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/b.ts
/user/username/projects/myproject/a.ts

Semantic diagnostics in builder refreshed for::
/user/username/projects/myproject/a.ts

WatchedFiles::
/user/username/projects/myproject/tsconfig.json:
  {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/a.ts:
  {"fileName":"/user/username/projects/myproject/a.ts","pollingInterval":250}
/user/username/projects/b.ts:
  {"fileName":"/user/username/projects/b.ts","pollingInterval":250}
/a/lib/lib.d.ts:
  {"fileName":"/a/lib/lib.d.ts","pollingInterval":250}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/node_modules/@types:
  {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject:
  {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}

exitCode:: ExitStatus.undefined


text:
@interface TKRecordLogAndUncaughtExceptionTool : NSObject

+ (TKRecordLogAndUncaughtExceptionTool *)sharedInstance;

#pragma mark 保存错误调试信息
- (void)redirectNSLogToDocumentFolder;

@end