text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using SmartQuant.FinChart;
using System.Drawing;
using System.Drawing.Drawing2D;

#if GTK
using Gtk;
using Compatibility.Gtk;
#else
using System.Windows.Forms;
#endif

namespace SmartQuant.Controls.BarChart
{
    public class BarChart2 : FrameworkControl, IGroupListener
    {
        private bool freezeUpdate;
        private Dictionary<int, GroupItem2> table;
        private Dictionary<string, List<int>> groupIdsBySelectorKey;
        private Dictionary<object, List<GroupEvent>> eventsBySelectorKey;
        private Chart chart;
        private ComboBox cbxSelector;

        public PermanentQueue<Event> Queue { get; private set; }

        public BarChart2()
        {
            InitComponent();
            this.table = new Dictionary<int, GroupItem2>();
            this.groupIdsBySelectorKey = new Dictionary<string, List<int>>();
            this.eventsBySelectorKey = new Dictionary<object, List<GroupEvent>>();
        }

        protected override void OnInit()
        {
            Queue = new PermanentQueue<Event>();
            Queue.AddReader(this);
            Reset(true);
            this.framework.EventManager.Dispatcher.FrameworkCleared += OnFrameworkCleared;
            this.framework.GroupDispatcher.AddListener(this);
            this.eventsBySelectorKey[""] = new List<GroupEvent>();
        }

        protected override void OnClosing(CancelEventArgs args)
        {
            this.framework.EventManager.Dispatcher.FrameworkCleared -= OnFrameworkCleared;
            this.framework.GroupDispatcher.RemoveListener(this);
            Queue.RemoveReader(this);
        }

        private void OnFrameworkCleared(object sender, FrameworkEventArgs args)
        {
            InvokeAction(delegate
            {
                #if GTK
                this.cbxSelector.ClearTexts();
                #else
                this.cbxSelector.Items.Clear();
                #endif
                Reset(false);
            });
            this.eventsBySelectorKey.Clear();
            this.eventsBySelectorKey[""] = new List<GroupEvent>();
        }

        public bool OnNewGroup(Group group)
        {
            if (!group.Fields.ContainsKey("Pad"))
                return false;
            var gi = new GroupItem2(group);
            this.table[group.Id] = gi;
            if (this.groupIdsBySelectorKey.ContainsKey(gi.SelectorKey))
            {
                if (!this.groupIdsBySelectorKey[gi.SelectorKey].Contains(group.Id))
                    this.groupIdsBySelectorKey[gi.SelectorKey].Add(group.Id);
            }
            else
                this.groupIdsBySelectorKey[gi.SelectorKey] = new List<int>() { group.Id };
            InvokeAction(delegate
            {
                #if GTK
                if (cbxSelector.ContainsText(gi.SelectorKey))
                    return;
                this.cbxSelector.AppendText(gi.SelectorKey);
                this.eventsBySelectorKey[gi.SelectorKey] = new List<GroupEvent>();
                this.freezeUpdate = true;
                if (this.cbxSelector.Model.IterNChildren() == 1)
                    this.cbxSelector.Active = 0;
                #else
                if (this.cbxSelector.Items.Contains(gi.SelectorKey))
                    return;
                this.cbxSelector.Items.Add(gi.SelectorKey);
                this.eventsBySelectorKey[gi.SelectorKey] = new List<GroupEvent>();
                this.freezeUpdate = true;
                if (this.cbxSelector.Items.Count == 1)
                    this.cbxSelector.SelectedIndex = 0;
                #endif
                this.freezeUpdate = false;
            });
            return true;
        }

        public void OnNewGroupUpdate(GroupUpdate groupUpdate)
        {
            // no-op
        }

        public void OnNewGroupEvent(GroupEvent groupEvent)
        {
            var groupItem2 = this.table[groupEvent.Group.Id];
            object obj;
            groupItem2.Table.TryGetValue((int)groupEvent.Obj.TypeId, out obj);
            switch (groupEvent.Obj.TypeId)
            {
                case DataObjectType.Bar:
                    if (obj == null)
                    {
                        obj = new BarSeries(groupItem2.Name, "", -1);
                        groupItem2.Table.Add((int)groupEvent.Obj.TypeId, obj);
                    }
                    (obj as BarSeries).Add(groupEvent.Obj as Bar);
                    break;
                case DataObjectType.Fill:
                    if (obj == null)
                    {
                        obj = new FillSeries(groupItem2.Name);
                        groupItem2.Table.Add((int)groupEvent.Obj.TypeId, obj);
                    }
                    (obj as FillSeries).Add(groupEvent.Obj as Fill);
                    break;
                case DataObjectType.TimeSeriesItem:
                    if (obj == null)
                    {
                        obj = new TimeSeries(groupItem2.Name, "");
                        groupItem2.Table.Add((int)groupEvent.Obj.TypeId, obj);
                    }
                    (obj as TimeSeries).Add((groupEvent.Obj as TimeSeriesItem).DateTime, (groupEvent.Obj as TimeSeriesItem).Value);
                    break;
            }
        }

        public void UpdateGUI()
        {
            if (UpdatedSuspened && this.framework.Mode == FrameworkMode.Simulation)
                return;
            var evnts = Queue.DequeueAll(this);
            if (evnts == null)
                return;
            var list1 = new List<GroupEvent>();
            foreach (Event e in evnts)
            {
                if (e.TypeId == EventType.GroupEvent)
                {
                    GroupEvent groupEvent = e as GroupEvent;
                    GroupItem2 groupItem2 = this.table[groupEvent.Group.Id];
                    string selected = GetComboBoxSelected();
                    if (selected == null && string.IsNullOrWhiteSpace(groupItem2.SelectorKey) || selected != null && selected == groupItem2.SelectorKey)
                        list1.Add(groupEvent);
                    List<GroupEvent> list2;
                    if (this.eventsBySelectorKey.TryGetValue(groupItem2.SelectorKey, out list2))
                        list2.Add(groupEvent);
                }
                else if (e.TypeId == EventType.OnFrameworkCleared)
                {
                    list1.Clear();
                    Reset(false);
                }
            }
            for (int i = 0; i < list1.Count; ++i)
                ProcessEvent(list1[i], i == list1.Count - 1);
            SetSeries();
        }

        public void Crosshair(bool isChecked)
        {
            this.chart.ActionType = isChecked ? ChartActionType.None : ChartActionType.Cross;
        }

        public void ZoomIn() => this.chart.ZoomIn();

        public void ZoomOut() => this.chart.ZoomOut();

        private void ProcessEvent(GroupEvent groupEvent, bool lastEvent)
        {
            OnNewGroupEvent(groupEvent);
        }

        private void SetSeries()
        {
            List<int> list;
            var selected = GetComboBoxSelected();
            if (selected == null || !this.groupIdsBySelectorKey.TryGetValue(selected, out list))
                return;
            this.chart.Reset();
            for (int i = 0; i < list.Count; ++i)
            {
                var item = this.table[i];
                foreach (var key in item.Table.Keys)
                {
                    EnsurePadExists(item.PadNumber, item.Format);
                    int padNumber = this.chart.VolumePadVisible || item.PadNumber <= 1 ? item.PadNumber : item.PadNumber + 1;
                    if (key == DataObjectType.Bar)
                    {
                        if (item.IsColor)
                            this.chart.SetMainSeries(item.Table[key] as BarSeries, true, item.Color);
                        else
                            this.chart.SetMainSeries(item.Table[key] as BarSeries);
                    }
                    if (key == DataObjectType.TimeSeriesItem)
                    {
                        var color = item.IsColor ? item.Color : Color.White;
                        if (item.IsStyle)
                            this.chart.DrawSeries(item.Table[key] as TimeSeries, padNumber, color, item.Style);
                        else
                            this.chart.DrawSeries(item.Table[key] as TimeSeries, padNumber, color);
                    }
                    if (item.Table[key] is FillSeries)
                    {
                        foreach (Fill fill in item.Table[key] as FillSeries)
                            this.chart.DrawFill(fill, padNumber);
                    }
                }
            }
        }

        private void EnsurePadExists(int newPad, string labelFormat)
        {
            while (this.chart.PadCount < newPad + 1)
                this.chart.AddPad();
            this.chart.Pads[newPad].AxisLabelFormat = labelFormat;
        }

        private void Reset(bool clearTable)
        {
            if (clearTable)
            {
                this.table.Clear();
                this.groupIdsBySelectorKey.Clear();
                this.eventsBySelectorKey.Clear();
            }
            else
            {
                foreach (var item in this.table.Values)
                    item.Table.Clear();
            }
            this.chart.Reset();
        }

        private void OnSelectorValueChanged(object sender, EventArgs e)
        {
            if (this.freezeUpdate)
                return;
            Reset(false);
            var selected = GetComboBoxSelected();
            var list = this.eventsBySelectorKey[selected];
            if (list.Count <= 0)
                return;
            for (int i = 0; i < list.Count; ++i)
                ProcessEvent(list[i], i == list.Count - 1);
            SetSeries();
        }

        private void InitComponent()
        {
            this.chart = new Chart();
            #if GTK
            this.cbxSelector = ComboBox.NewText();
            this.cbxSelector.Changed += OnSelectorValueChanged;
            InitChartCommon();
            VBox vb = new VBox();
            vb.PackStart(this.cbxSelector, false, true, 0);
            vb.PackEnd(this.chart, true, true, 0);
            Add(vb);
            ShowAll();
            #else
            this.cbxSelector = new ComboBox();
            SuspendLayout();
            this.cbxSelector.Dock = DockStyle.Top;
            this.cbxSelector.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cbxSelector.FormattingEnabled = true;
            this.cbxSelector.TabIndex = 1;
            this.cbxSelector.SelectedIndexChanged += OnSelectorValueChanged;
            this.chart.Dock = DockStyle.Fill;
            this.chart.AutoScroll = true;
            this.chart.TabIndex = 0;
            InitChartCommon();
            AutoScaleMode = AutoScaleMode.Font;
            Controls.Add(this.chart);
            Controls.Add(this.cbxSelector);
            ResumeLayout(false);
            #endif
        }

        private void InitChartCommon()
        {
            this.chart.ActionType = ChartActionType.None;
            this.chart.BarSeriesStyle = BSStyle.Candle;
            this.chart.BorderColor = Color.Gray;
            this.chart.BottomAxisGridColor = Color.LightGray;
            this.chart.BottomAxisLabelColor = Color.LightGray;
            this.chart.CanvasColor = Color.MidnightBlue;
            this.chart.ChartBackColor = Color.MidnightBlue;
            this.chart.ContextMenuEnabled = true;
            this.chart.CrossColor = Color.DarkGray;
            this.chart.DateTipRectangleColor = Color.LightGray;
            this.chart.DateTipTextColor = Color.Black;
            this.chart.DrawItems = false;
            this.chart.Font = new Font("Microsoft Sans Serif", 7f, FontStyle.Regular, GraphicsUnit.Point, (byte)204);
            this.chart.ItemTextColor = Color.LightGray;
            this.chart.LabelDigitsCount = 2;
            this.chart.MinNumberOfBars = 125;
            this.chart.PrimitiveDeleteImage = null;
            this.chart.PrimitivePropertiesImage = null;
            this.chart.RightAxesFontSize = 7;
            this.chart.RightAxisGridColor = Color.DimGray;
            this.chart.RightAxisMajorTicksColor = Color.LightGray;
            this.chart.RightAxisMinorTicksColor = Color.LightGray;
            this.chart.RightAxisTextColor = Color.LightGray;
            this.chart.ScaleStyle = PadScaleStyle.Arith;
            this.chart.SelectedFillHighlightColor = Color.FromArgb(100, 173, 216, 230);
            this.chart.SelectedItemTextColor = Color.Yellow;
            this.chart.SessionEnd = TimeSpan.Parse("00:00:00");
            this.chart.SessionGridColor = Color.Empty;
            this.chart.SessionGridEnabled = false;
            this.chart.SessionStart = TimeSpan.Parse("00:00:00");
            this.chart.SmoothingMode = SmoothingMode.Default;
            this.chart.SplitterColor = Color.LightGray;
            this.chart.UpdateStyle = ChartUpdateStyle.Trailing;
            this.chart.ValTipRectangleColor = Color.LightGray;
            this.chart.ValTipTextColor = Color.Black;
            this.chart.VolumePadVisible = false;
        }

        private string GetComboBoxSelected()
        {
            #if GTK
            return this.cbxSelector.ActiveText;
            #else
            return this.cbxSelector.SelectedItem.ToString();
            #endif
        }
    }
}


text:
//
//  KKBaseTextField.m
//  LoveCare
//
//  Created by KaKa on 15/12/3.
//  Copyright © 2015年 KaKa. All rights reserved.
//

#import "KKBaseTextField.h"

#define DEFAULT_TEXT_MIN_LEN                4

@interface KKBaseTextFieldLeftLabel : UILabel
@property (nonatomic,assign) CGFloat                 padding;

+(instancetype)leftLabelWithSize:(CGSize)size padding:(CGFloat)padding text:(NSString*)text;

@end

@implementation KKBaseTextFieldLeftLabel

+(instancetype)leftLabelWithSize:(CGSize)size padding:(CGFloat)padding text:(NSString *)text {
    KKBaseTextFieldLeftLabel* label = [[self alloc] init];
    label.frame = CGRectMake(0, 0, size.width, size.height);
    label.padding = padding;
    label.text = text;
    label.backgroundColor = [UIColor clearColor];
    return label;
}

-(CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines {
    CGRect rect = [super textRectForBounds:bounds limitedToNumberOfLines:numberOfLines];
    rect.origin.x = _padding;
    rect.origin.y = (CGRectGetHeight(bounds)-CGRectGetHeight(rect))/2;
    return rect;
}

-(void)drawTextInRect:(CGRect)rect {
    CGRect drawRect = [self textRectForBounds:rect limitedToNumberOfLines:self.numberOfLines];
    [super drawTextInRect:drawRect];
}

@end

@interface KKBaseTextField()<UIPickerViewDelegate,UIPickerViewDataSource,UITextFieldDelegate,UIActionSheetDelegate>
@property (nonatomic,assign) CGRect                 rightViewRect;
@property (nonatomic,assign) CGFloat                leftPadding;
@property (nonatomic,assign) CGFloat                rightPadding;
@property (nonatomic,assign) UIEdgeInsets           textEdgeInsets;
@property (nonatomic,assign) int                    maxLength;
/**
 *  是否自动分割,默认为NO
 */
@property (nonatomic, assign) BOOL                  isAutoSegment;

@property (nonatomic, strong) UIPickerView*         pickerView;

@property (nonatomic, strong) NSMutableDictionary*  pickViewDataDict;

@property (nonatomic, strong) UIActionSheet*        actionSheet;

@property (nonatomic, assign) NSInteger             selectIndex;

@property (nonatomic, strong) UIDatePicker*         datePickerView;

@property (nonatomic, strong) NSDateFormatter*      formatter;

@end

@implementation KKBaseTextField

-(instancetype)init {
    self = [super init];
    if (self) {
        _textEdgeInsets = UIEdgeInsetsZero;
        self.delegate = self;
        self.borderStyle = UITextBorderStyleNone;
        self.clearButtonMode = UITextFieldViewModeWhileEditing;
        self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        self.tfFont(@14).tfBgColor([UIColor whiteColor]);
    }
    return self;
}

+(instancetype)textField {
    KKBaseTextField* textFiled = [[KKBaseTextField alloc] init];
    return textFiled;
}

+(instancetype)textFieldWithPlaceholder:(NSString *)placeholder {
    KKBaseTextField* textFiled = [self textField];
    textFiled.tfPlaceholder(placeholder);
    return textFiled;
}

-(KKBaseTextField *(^)(CGRect ))tfFrame {
    return ^KKBaseTextField*(CGRect frame){
        self.frame = frame;
        return self;
    };
}

-(KKBaseTextField *(^)(NSString *))tfPlaceholder {
    return ^KKBaseTextField*(NSString* placeholder){
        self.placeholder = placeholder;
        return self;
    };
}

-(KKBaseTextField *(^)(UIColor *))tfPlaceholderColor {
    return ^KKBaseTextField*(UIColor* color){
        [self setValue:color forKeyPath:@"_placeholderLabel.textColor"];
        return self;
    };
}

-(KKBaseTextField *(^)(BOOL))tfSecureTextEntry {
    return ^KKBaseTextField*(BOOL secureTextEntry){
        self.secureTextEntry = secureTextEntry;
        return self;
    };
}

-(KKBaseTextField *(^)(UIKeyboardType))tfKeyboardType {
    return ^KKBaseTextField*(UIKeyboardType type){
        self.keyboardType = type;
        return self;
    };
}

-(KKBaseTextField *(^)(UIColor *))tfBgColor {
    return ^KKBaseTextField*(UIColor* color){
        self.backgroundColor = color;
        return self;
    };
}

-(KKBaseTextField *(^)(id))tfFont {
    return ^KKBaseTextField*(id font){
        self.font = [font isKindOfClass:[UIFont class]]?font:[UIFont systemFontOfSize:[font floatValue]];
        if ([self.leftView isKindOfClass:[KKBaseTextFieldLeftLabel class]]) {
            KKBaseTextFieldLeftLabel* leftView = (KKBaseTextFieldLeftLabel*)self.leftView;
            leftView.font = self.font;
        }
        return self;
    };
}

-(KKBaseTextField *(^)(UIColor *))tfTextColor {
    return ^KKBaseTextField*(UIColor* color){
        self.textColor = color;
        if ([self.leftView isKindOfClass:[KKBaseTextFieldLeftLabel class]]) {
            KKBaseTextFieldLeftLabel* leftView = (KKBaseTextFieldLeftLabel*)self.leftView;
            leftView.textColor = color;
        }
        return self;
    };
}

-(KKBaseTextField *(^)(UITextBorderStyle))tfBorderStyle {
    return ^KKBaseTextField*(UITextBorderStyle style){
        self.borderStyle = style;
        return self;
    };
}

-(KKBaseTextField *(^)(NSString *, CGSize, CGFloat))tfTitleLeftView {
    return ^KKBaseTextField*(NSString* title,CGSize size,CGFloat titlePadding){
        self.leftViewMode = UITextFieldViewModeAlways;
        UILabel* leftView = [KKBaseTextFieldLeftLabel leftLabelWithSize:size padding:titlePadding text:title];
        leftView.textColor = self.textColor;
        leftView.font = self.font;
        self.leftView = leftView;
        return self;
    };
}

-(KKBaseTextField *(^)(id, CGSize,CGFloat))tfImageLeftView {
    return ^KKBaseTextField*(id image,CGSize size,CGFloat padding){
        self.leftViewMode = UITextFieldViewModeAlways;
        self.leftView = [self imageForLeftOrRightView:image size:size padding:padding];
        return self;
    };
}

-(KKBaseTextField *(^)(id, CGSize,CGFloat))tfImageRightView {
    return ^KKBaseTextField*(id image,CGSize size,CGFloat padding){
        _rightViewRect.size = size;
        self.rightViewMode = UITextFieldViewModeAlways;
        self.rightView = [self imageForLeftOrRightView:image size:size padding:padding];
        return self;
    };
}

-(KKBaseTextField *(^)(UIView*, CGFloat))tfRightView {
    return ^KKBaseTextField*(UIView* rightView,CGFloat padding){
        _rightViewRect.size = rightView.frame.size;
        _rightPadding = padding;
        self.rightViewMode = UITextFieldViewModeAlways;
        self.rightView = rightView;
        return self;
    };
}

-(KKBaseTextField *(^)(UIEdgeInsets))tfTextEdgeInsets {
    return ^KKBaseTextField*(UIEdgeInsets insets){
        _textEdgeInsets = insets;
        return self;
    };
}

-(KKBaseTextField *(^)(int))tfTextMaxLength {
    return ^KKBaseTextField*(int maxLength){
        _maxLength = maxLength;
        return self;
    };
}

-(KKBaseTextField *(^)())tfTextAutoSegment {
    return ^KKBaseTextField*(){
        _isAutoSegment = YES;
        if (_maxLength != 0) {
            _maxLength += _maxLength%DEFAULT_TEXT_MIN_LEN==0?_maxLength/DEFAULT_TEXT_MIN_LEN-1:_maxLength/DEFAULT_TEXT_MIN_LEN;
        }
        return self;
    };
}

-(KKBaseTextField *(^)())tfCreateToolbar {
    return ^KKBaseTextField*(){
        UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44)];
        UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
        UIBarButtonItem *done = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(textFieldDone)];
        toolBar.items = @[space, done];
        self.inputAccessoryView = toolBar;
        return self;
    };
}

-(KKBaseTextField *(^)())tfCreatePickerView {
    return ^KKBaseTextField*(){
        self.inputView = self.pickerView;
        return self;
    };
}

-(KKBaseTextField *(^)(NSString *,NSString *))tfCreateActionSheet {
    return ^KKBaseTextField*(NSString* title,NSString* cancelButtonTitle){
        _actionSheet = [[UIActionSheet alloc] initWithTitle:title delegate:self cancelButtonTitle:cancelButtonTitle destructiveButtonTitle:nil otherButtonTitles:nil, nil];
        self.inputAccessoryView = _actionSheet;
        return self;
    };
}

-(KKBaseTextField *(^)(UIDatePickerMode, NSString *))tfCreateDatePicker {
    return ^KKBaseTextField*(UIDatePickerMode mode,NSString* formatter){
        self.datePickerView.datePickerMode = mode;
        [self.formatter setDateFormat:formatter];
        self.inputAccessoryView = self.datePickerView;
        return self;
    };
}

-(void)reloadPickerView {
    [self.pickerView reloadAllComponents];
}

-(void)reloadActionSheet {
    NSInteger buttons = [_baseTextFieldDataSource textFieldNumberOfButtonsInActionSheet:self];
    for (int i = 0; i < buttons; i++) {
        [_actionSheet addButtonWithTitle:[_baseTextFieldDataSource textFiled:self actionSheetTitleForIndex:i]];
    }
}

#pragma mark --------------------private--------------------
- (UIView*)imageForLeftOrRightView:(id)image size:(CGSize)size padding:(CGFloat)padding {
    UIImage* img = [image isKindOfClass:[UIImage class]]?image:[UIImage imageNamed:image];
    UIImageView* imageView = [[UIImageView alloc] initWithImage:img];
    UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width+padding*2, size.height)];
    [view addSubview:imageView];
    imageView.center = CGPointMake(view.frame.size.width/2, view.frame.size.height/2);
    return view;
}

#pragma mark -------------------- Set&&Get --------------------
-(UIPickerView *)pickerView {
    if (!_pickerView) {
        _pickerView = [[UIPickerView alloc] init];
        _pickerView.backgroundColor = [UIColor whiteColor];
        _pickerView.delegate = self;
        _pickerView.dataSource = self;
    }
    return _pickerView;
}

-(NSMutableDictionary *)pickViewDataDict {
    if (!_pickViewDataDict) {
        _pickViewDataDict = [[NSMutableDictionary alloc] init];
    }
    return _pickViewDataDict;
}

-(UIDatePicker *)datePickerView {
    if (!_datePickerView) {
        _datePickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 216)];
        _datePickerView.backgroundColor = [UIColor whiteColor];
        [_datePickerView addTarget:self action:@selector(datePickerAction:) forControlEvents:UIControlEventValueChanged];
    }
    return _datePickerView;
}

-(NSDateFormatter *)formatter {
    if (!_formatter) {
        _formatter = [[NSDateFormatter alloc] init];
    }
    return _formatter;
}

#pragma mark --------------------- Action ---------------------
-(void)textFieldDone {
    [self endEditing:YES];
    if (_baseTextFieldDelegate && [_baseTextFieldDelegate respondsToSelector:@selector(textFieldDidClickCompleteButton:)]) {
        [_baseTextFieldDelegate textFieldDidClickCompleteButton:self];
    }
}

-(void)datePickerAction:(UIDatePicker*)picker {
    self.text = [self.formatter stringFromDate:picker.date];
}

#pragma mark --------------- UITextFieldDelegate ---------------
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
    if ([textField isFirstResponder]) {
        [textField resignFirstResponder];
    }
    return YES;
}

-(void)textFieldDidBeginEditing:(UITextField *)textField {
    if(_actionSheet) [_actionSheet showInView:self];
    if(_datePickerView) self.text = [self.formatter stringFromDate:self.datePickerView.date];
}

-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {

    if (_maxLength != 0 && textField.text.length >= _maxLength) {
        return range.length != 0;
    }
    if (_isAutoSegment && range.length != 1 && (textField.text.length+1)%(DEFAULT_TEXT_MIN_LEN+1) == 0) {
        textField.text = [textField.text stringByAppendingString:@" "];
    }
    return YES;
}

-(void)textFieldDidEndEditing:(UITextField *)textField {
    if(self.text.length == 0 && _pickerView)
        self.text = self.pickViewDataDict[[NSString stringWithFormat:@"%ld",_selectIndex]];
    if ([_baseTextFieldDelegate respondsToSelector:@selector(textFiledDidEndEdit:)]) {
        [_baseTextFieldDelegate textFiledDidEndEdit:self];
    }
}

#pragma mark ---------------UIPickerViewDelegate,UIPickerViewDataSource-------------
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return 1;
}

-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
    return [_baseTextFieldDataSource textFieldNumberOfRowInPickerView:self];
}

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    NSString* title = [_baseTextFieldDataSource textFiled:self pickViewTitleForRow:row];
    [self.pickViewDataDict setValue:title forKey:[NSString stringWithFormat:@"%ld",row]];
    return title;
}

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    _selectIndex = row;
    self.text = self.pickViewDataDict[[NSString stringWithFormat:@"%ld",row]];
    if ([_baseTextFieldDelegate respondsToSelector:@selector(textFiled:didSelectInputView:)]) {
        [_baseTextFieldDelegate textFiled:self didSelectInputView:_selectIndex];
    }
}

#pragma mark --------------------UIActionSheetDelegate--------------------
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
    if(buttonIndex != 0) {
        self.text = [actionSheet buttonTitleAtIndex:buttonIndex];
    } else {
        [self endEditing:YES];
    }
    if ([_baseTextFieldDelegate respondsToSelector:@selector(textFiled:didSelectInputView:)]) {
        [_baseTextFieldDelegate textFiled:self didSelectInputView:buttonIndex];
    }
}

#pragma mark --------------- override ---------------
-(CGRect)rightViewRectForBounds:(CGRect)bounds {
    if (CGRectEqualToRect(CGRectZero, _rightViewRect)) {
        return [super rightViewRectForBounds:bounds];
    }
    int width = self.frame.size.width;
    int height = self.frame.size.height;
    int rigthRectWidth = _rightViewRect.size.width;
    int rigthRectHeight = _rightViewRect.size.height;
    return CGRectMake(width-rigthRectWidth-_rightPadding, (height-rigthRectHeight)/2, rigthRectWidth, rigthRectHeight);
}

-(CGRect)textRectForBounds:(CGRect)bounds {
    CGRect rect = [super textRectForBounds:bounds];
    return UIEdgeInsetsInsetRect(rect, _textEdgeInsets);
}

-(CGRect)editingRectForBounds:(CGRect)bounds {
    CGRect rect = [super textRectForBounds:bounds];
    return UIEdgeInsetsInsetRect(rect, _textEdgeInsets);
}

-(void)didMoveToSuperview {
    [super didMoveToSuperview];
    if(_pickerView) [self reloadPickerView];
    if(_actionSheet) [self reloadActionSheet];
}

@end

redpajama_set_name: RedPajamaGithub


text:
geppetto
========

Automation Tool with HTML UI and Node Backend


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>org.jug.montpellier</groupId>
	<artifactId>vux</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>vux</name>
	<description>Proxy micro service for the Voice User eXperince using api.api from Google</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.4.3.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web-services</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-guava</artifactId>
            <version>2.7.3</version>
        </dependency>
		<dependency>
			<groupId>ai.api</groupId>
			<artifactId>libai</artifactId>
			<version>1.2.3</version>
		</dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>


text:
var step = ''
            +'
Test Purpose:
'
            +'
Verifies the interfaces and methods of calendar is supported and valid.
'
            +'
Test Steps:
'
            +'
'
              +'
when open the page,if the page show 'undefined' means the tizen.calendar is undefined and you can not do the following steps.
'
              +'
Click the \'Add\' button, check if the calendar can add an item synchronously.
'
              +'
Click the \'addBatch\' button, check if the calendar can add an array of items asynchronously.
'
              +'
Click the \'Update\' button, check if an existing item in the calendar can be updated.
'
              +'
Click the \'updateBatch\' button, check if an array of existing items in the calendar can be updated.
'
              +'
Click the \'Remove\' button, check if an item can be removed from the calendar that corresponds to the specified identifier.
'
              +'
Click the \'removeBatch\' button, check if several items can be removed from the calendar asynchronously depending on the specified identifiers
'
              +'
Click the \'Find\' button, check if an array of CalendarItem objects for items stored in the calendar can be found.
'
              +'
Click the \'Clone\' button, check if the CalendarItem object can be cloned, detached from any calendar.
'
            +'
'
            +'
Expected Result:
'
            +'
Test passes if interfaces and methods of calendar is supported and valid normally.
'
          +'';


text:
@interface CZNewsTableViewController : UITableViewController

@end


text:
package it.unibz.krdb.obda.exception;

public class QueryResultException extends Exception {

	private static final long serialVersionUID = 1L;

	public QueryResultException() {
	}

	public QueryResultException(String message) {
		super(message);
	}

	public QueryResultException(Throwable cause) {
		super(cause);
	}

	public QueryResultException(String message, Throwable cause) {
		super(message, cause);
	}
}


text:
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]

#ifndef _MSC_TIME_H_ // [
#define _MSC_TIME_H_

#if _MSC_VER > 1000
#pragma once
#endif

#include <windows.h>
#include <winsock.h>
#include <time.h>

#include "msvc_export.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef void*	timer_t;

#ifndef sleep
#define sleep(t) Sleep((t)*1000)
#endif

MSVC_EXPORT
int gettimeofday(struct timeval *tv/*in*/, struct timezone *tz/*in*/);

MSVC_EXPORT
void usleep(DWORD waitTime);

MSVC_EXPORT
int clock_nanosleep(int clock_id, int flags,
	const struct timespec *request,
	struct timespec *remain);

MSVC_EXPORT
int nanosleep(const struct timespec *req, struct timespec *rem);

typedef enum {
	CLOCK_MONOTONIC = 0,
	CLOCK_REALTIME,
} clockid_t;

MSVC_EXPORT
int clock_gettime(clockid_t clk_id, struct timespec *tp);

MSVC_EXPORT
struct tm *localtime_r(const time_t *timep, struct tm *result);

#ifdef __cplusplus
}
#endif

#endif // _MSC_TIME_H_ ]


text:
package com.onextent.augie.system;

import java.util.AbstractSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

import com.onextent.android.codeable.CodeableName;
import com.onextent.augie.AugSysLog;
import com.onextent.augie.AugieScape;
import com.onextent.augie.Augiement;
import com.onextent.augie.AugiementDependencyRegistry;
import com.onextent.augie.AugiementException;

	//todo:
	//  UNREG
	//  removes module and any modules that depend on it and puts 'em in inactive reg

public class AugiementRegistryImpl extends AbstractSet<Augiement> implements AugiementDependencyRegistry {

    private final Map<CodeableName, Augiement> active;
    private final Map<CodeableName, Augiement> waiting;
    private final AugieScape augieScape;

    public AugiementRegistryImpl(AugieScape av) {
        active = new LinkedHashMap<CodeableName, Augiement>();
        waiting = new LinkedHashMap<CodeableName, Augiement>();
        augieScape = av;
    }

    private void create(Augiement a) {
        try {
            a.onCreate(augieScape, this);
        } catch (AugiementException e) {
            AugSysLog.e( "augiement onCreate error", e);
            //todo: make error visible in ui
        }
    }

    private void tryWaiting() {
        Set<Augiement> trymes = new HashSet<Augiement>();
        for (Augiement a : waiting.values()) {
            trymes.add(a);
        }
        for (Augiement a : trymes) {
            waiting.values().remove(a);
            add(a);
        }
    }

    @Override
    public boolean add(Augiement object) {

        assert(object != null);

        boolean dependsAllmet = true;
        Set<CodeableName> dependencyNames = object.getMeta().getDependencyNames();

        if (dependencyNames == null) {

            active.put(object.getCodeableName(), object);
            create(object);
            AugSysLog.d( "augiement " + object.getCodeableName() + " registered w/no deps");
            tryWaiting();

        } else {

            for (CodeableName dname : dependencyNames) {
                if (!active.containsKey(dname)) {
                    AugSysLog.d( "augiement " + object.getCodeableName() + " waiting for " + dname);
                    waiting.put(object.getCodeableName(), object);
                    dependsAllmet = false;
                    break;
                }
            }

            if (dependsAllmet) {
                active.put(object.getCodeableName(), object);
                create(object);
                AugSysLog.d( "augiement " + object.getCodeableName() + " registered w/deps");
                tryWaiting();
            }
        }

        return dependsAllmet;
    }

    private class ARIterator implements Iterator<Augiement> {

        final Iterator<Augiement> actives;
        Augiement last;

        ARIterator() {

            actives = active.values().iterator();
            last = null;
        }

        @Override
        public boolean hasNext() {
            return actives.hasNext();
        }

        @Override
        public Augiement next() {
            last = actives.next();
            return last;
        }

        @Override
        public void remove() {
            Augiement a = active.remove(last);
            if (a != null) {
                //move dependencies to waiting

            }
        }
    }

    @Override
    public Iterator<Augiement> iterator() {
        return new ARIterator();
    }

    @Override
    public int size() {
        return active.size();
    }

    @Override
    public boolean contains(Object object) {
        return active.values().contains(object);
    }

    @Override
    public boolean isEmpty() {
        return active.isEmpty();
    }

    @Override
    public void clear() {
        super.clear();
        active.clear();
        waiting.clear();
    }
}


text:
__version__ = "1.1.8"
__author__ = "Dan Loewenherz"
__copyright__ = "Copyright 2012-2017 Lionheart Software LLC"
__maintainer__ = "Dan Loewenherz"
__email__ = "dan@lionheartsw.com"
__license__ = "Apache 2.0"


text:
/*jslint nomen: true, unparam: true, regexp: true */
/*global define, window, document */

(function (factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        // Register as an anonymous AMD module:
        define([
            'jquery',
            'load-image',
            'canvas-to-blob',
            './jquery.fileupload'
        ], factory);
    } else {
        // Browser globals:
        factory(
            window.jQuery,
            window.loadImage,
            window.canvasToBlob
        );
    }
}(function ($, loadImage, canvasToBlob) {
    'use strict';

    // The File Upload IP version extends the basic fileupload widget
    // with image processing functionality:
    $.widget('blueimpIP.fileupload', $.blueimp.fileupload, {

        options: {
            // The regular expression to define which image files are to be
            // resized, given that the browser supports the operation:
            resizeSourceFileTypes: /^image\/(gif|jpeg|png)$/,
            // The maximum file size of images that are to be resized:
            resizeSourceMaxFileSize: 20000000, // 20MB
            // The maximum width of the resized images:
            resizeMaxWidth: undefined,
            // The maximum height of the resized images:
            resizeMaxHeight: undefined,
            // The minimum width of the resized images:
            resizeMinWidth: undefined,
            // The minimum height of the resized images:
            resizeMinHeight: undefined,

            // The add callback is invoked as soon as files are added to the fileupload
            // widget (via file input selection, drag & drop or add API call).
            // See the basic file upload widget for more information:
            add: function (e, data) {
                $(this).fileupload('resize', data).done(function () {
                    data.submit();
                });
            }
        },

        // Resizes the image file at the given index and stores the created blob
        // at the original position of the files list, returns a Promise object:
        _resizeImage: function (files, index, options) {
            var that = this,
                file = files[index],
                deferred = $.Deferred(),
                canvas,
                blob;
            options = options || this.options;
            loadImage(
                file,
                function (img) {
                    var width = img.width,
                        height = img.height;
                    canvas = loadImage.scale(img, {
                        maxWidth: options.resizeMaxWidth,
                        maxHeight: options.resizeMaxHeight,
                        minWidth: options.resizeMinWidth,
                        minHeight: options.resizeMinHeight,
                        canvas: true
                    });
                    if (width !== canvas.width || height !== canvas.height) {
                        canvasToBlob(canvas, function (blob) {
                            if (!blob.name) {
                                if (file.type === blob.type) {
                                    blob.name = file.name;
                                } else if (file.name) {
                                    blob.name = file.name.replace(
                                        /\..+$/,
                                        '.' + blob.type.substr(6)
                                    );
                                }
                            }
                            files[index] = blob;

                            deferred.resolveWith(that);
                        }, file);
                    } else {
                        deferred.resolveWith(that);
                    }
                }
            );
            return deferred.promise();
        },

        // Resizes the images given as files property of the data parameter,
        // returns a Promise object that allows to bind a done handler, which
        // will be invoked after processing all images is done:
        resize: function (data) {
            var that = this,
                options = $.extend({}, this.options, data),
                resizeAll = $.type(options.resizeSourceMaxFileSize) !== 'number',
                isXHRUpload = this._isXHRUpload(options);
            $.each(data.files, function (index, file) {
                if (isXHRUpload && that._resizeSupport &&
                        (options.resizeMaxWidth || options.resizeMaxHeight ||
                            options.resizeMinWidth || options.resizeMinHeight) &&
                        (resizeAll || file.size < options.resizeSourceMaxFileSize) &&
                        options.resizeSourceFileTypes.test(file.type)) {
                    that._processing += 1;
                    if (that._processing === 1) {
                        that.element.addClass('fileupload-processing');
                    }
                    that._processingQueue = that._processingQueue.pipe(function () {
                        var deferred = $.Deferred();
                        that._resizeImage(
                            data.files,
                            index,
                            options
                        ).done(function () {
                            that._processing -= 1;
                            if (that._processing === 0) {
                                that.element
                                    .removeClass('fileupload-processing');
                            }
                            deferred.resolveWith(that);
                        });
                        return deferred.promise();
                    });
                }
            });
            return this._processingQueue;
        },

        _create: function () {
            $.blueimp.fileupload.prototype._create.call(this);
            this._processing = 0;
            this._processingQueue = $.Deferred().resolveWith(this).promise();
            this._resizeSupport = canvasToBlob && canvasToBlob(
                document.createElement('canvas'),
                $.noop
            );
        }

    });

}));


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace QlikApp.Web.WebApi.Models
{
    /// <summary>
    /// A message in the system
    /// </summary>
    public class Message
    {
        /// <summary>
        /// A unique identifier for the message
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// The actual message text
        /// </summary>
        public string Body { get; set; }
    }
}


text:
/**
 * Contains the Border class, which represents a UI border component.
 */
declare module "ui/border" {
    import contentView = require("ui/content-view");
    import color = require("color");
    import dependencyObservable = require("ui/core/dependency-observable");

    /**
     * Represents a UI border component.
     */
    export class Border extends contentView.ContentView {
        public static cornerRadiusProperty : dependencyObservable.Property;
        public static borderWidthProperty: dependencyObservable.Property;
        public static borderColorProperty: dependencyObservable.Property;

        /**
         * Gets or sets the corner radius of the border component.
         */
        cornerRadius: number;

        /**
         * Gets or sets the border width of the border component.
         */
        borderWidth: number;

        /**
         * Gets or sets the border color of the border component.
         */
        borderColor: color.Color;
    }
}


text:
@charset "UTF-8";

@import "default.css";

	ul.dropdown li a {
	 display: block;
	 padding: 5px 30px;
	}

/* ------------- Override default */

	ul.dropdown li {
	 padding: 0;
	}

	ul.dropdown ul a { /* POI, proposal: override abstract a */
	 padding: 8px;
	}

/* ------------- Reinitiate default: post-override activities  */

	ul.dropdown *.dir { /* POI */
	 padding: 5px 30px;
	}

	ul.dropdown ul *.dir {
	 padding: 8px 30px 8px 8px;
	}

/* ------------- Custom */

	ul.dropdown li {

	}

	/* Especially for IE6 or lower */

	ul.dropdown ul a {
	 /*width: 139px;*/
	}

	ul.dropdown ul *.dir {
	 /*width: 129px;*/
	}

	ul.dropdown ul li.dir ul { /* POI, proposal */
	 margin-top: -1px ;
	 margin-left: 1px;
	}

	/* Roll-overs: li level */

	/* First-level abstract */
	ul.dropdown li.hover,
	ul.dropdown li:hover {
	 border-top-color: #5b5b5b;
	 background-color: #3d3d3d;
	}

	/* Non-first-level abstract */
	ul.dropdown ul li.hover,
	ul.dropdown ul li:hover {
	 background: #4c4c4c url(../../../../images/mtv.com/comnav-arrowover.png) 100% 50% no-repeat;
	}

	ul.dropdown ul ul li.hover,
	ul.dropdown ul ul li:hover {
	 background: #595959 url(../../../../images/mtv.com/comnav-arrowover2.png) 100% 50% no-repeat;
	}

	/* Proposals for Open */

	ul.dropdown ul a.open,
	ul.dropdown ul li:hover > a.dir {
	 border-top-color: #5b5b5b;
     background-image: url(../../../../images/mtv.com/comnav-arrowover.png);
	}

	ul.dropdown ul ul a.open,
	ul.dropdown ul ul li:hover > a.dir { /* ? merge with ul.dropdown ul a.dir:hover */
	 border-top-color: #595959;
	 background: #595959 url(../../../../images/mtv.com/comnav-arrowover2.png) 100% 50% no-repeat;
	 color: #fff;
	}

	/* Override UPPER TWO definitions */
	ul.dropdown ul a.open:hover,
	ul.dropdown ul li:hover > a.dir:hover { /* ? merge with ul.dropdown ul a.dir:hover */
	 background: #4698ca url(../../../../images/mtv.com/comnav-arrowon.png) 100% 50% no-repeat;
	 color: #fff;
	}


text:
package main

type T chan byte

var sink T

func main() {
	sink = make(T, -1)            // ERROR "negative buffer argument in make.*"
	sink = make(T, uint64(1<<63)) // ERROR "buffer argument too large in make.*"

	sink = make(T, 0.5) // ERROR "constant 0.5 truncated to integer"
	sink = make(T, 1.0)
	sink = make(T, float32(1.0)) // ERROR "non-integer buffer argument in make.*"
	sink = make(T, float64(1.0)) // ERROR "non-integer buffer argument in make.*"
	sink = make(T, 1+0i)
	sink = make(T, complex64(1+0i))  // ERROR "non-integer buffer argument in make.*"
	sink = make(T, complex128(1+0i)) // ERROR "non-integer buffer argument in make.*"
}


text:
import { zip } from 'zip';
import ExportSTL from 'files/ExportSTL';

var Export = {};

Export.exportMaterialise = function (main, statusWidget) {
  var xhr = new XMLHttpRequest();
  // xhr.open('POST', 'https://i.materialise.com/upload', true);
  // xhr.open('POST', 'uploadMaterialise.php', true);
  xhr.open('POST', 'https://i.materialise.com/web-api/tool/20cc0fd6-3cef-4111-a201-0b87026d892c/model', true);

  xhr.onprogress = function (event) {
    if (event.lengthComputable && event.total) {
      var val = Math.round(event.loaded * 100.0 / event.total);
      statusWidget.setMessage('Materialise upload: ' + val + '%');
    }
  };

  var hideStatus = function () {
    statusWidget.setMessage('');
  };
  xhr.onerror = hideStatus;
  xhr.onabort = hideStatus;

  xhr.onload = function () {
    hideStatus();

    if (xhr.status === 200) {
      var json = JSON.parse(xhr.responseText);
      window.open('https://i.materialise.com/en/3dprint#modelId=' + json.modelID, '_blank');
    }
  };

  var meshes = main.getMeshes();
  var box = main.computeBoundingBoxMeshes(meshes);
  var radius = main.computeRadiusFromBoundingBox(box);
  var data = ExportSTL.exportBinarySTL(meshes, { colorMagic: true, swapXY: true });

  // var blob = new Blob([data], { type: 'application/octet-stream' });
  // Export.exportFileMaterialise(radius, xhr, domStatus, blob);

  statusWidget.setMessage('Creating zip...');
  zip.useWebWorkers = true;
  zip.workerScriptsPath = 'worker/';
  zip.createWriter(new zip.BlobWriter('application/zip'), function (zipWriter) {
    zipWriter.add('yourMesh.stl', new zip.BlobReader(data), function () {
      zipWriter.close(Export.exportFileMaterialise.bind(this, radius, xhr, statusWidget));
    });
  }, onerror);

  return xhr;
};

Export.exportFileMaterialise = function (radius, xhr, statusWidget, blob) {
  if (xhr.isAborted) return;

  var fd = new FormData();
  fd.append('file', blob, 'yourMesh.zip');
  // fd.append('scale', 100 * 4.0 / radius);
  // fd.append('useAjax', 'true');
  // fd.append('plugin', '');
  // fd.append('forceEmbedding', false);

  statusWidget.setMessage('Materialise upload...');
  xhr.send(fd);
};

export default Export;


text:
<?php
/**
 * HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
 */

/**
 * The MIT License (MIT)
 *
 * Copyright (C) 2014 hellosign.com
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

namespace HelloSign;

/**
 * Class to hold an embedded signature request response
 */
class EmbeddedResponse extends AbstractResource
{
    /**
     * @var string
     * @ignore
     */
    protected $resource_type = 'embedded';

    /**
     * URL of the signature page to display in the embedded iFrame
     *
     * @var string
     */
    protected $sign_url = null;

    /**
     * When the link expires
     *
     * @var integer
     */
    protected $expires_at = null;

    /**
     * @return string
     * @ignore
     */
    public function getSignUrl()
    {
        return $this->sign_url;
    }

    /**
     * @return integer
     * @ignore
     */
    public function getExpiresAt()
    {
        return $this->expires_at;
    }
}


text:
class ChangeAnswerAndField < ActiveRecord::Migration
  def up
    change_table :answers do |t|
      t.rename :text, :value
    end

    change_table :fields do |t|
      t.remove :key
    end
  end

  def down
    change_table :answers do |t|
      t.rename :value, :value
    end

    change_table :fields do |t|
      t.string :key
    end
  end
end


text:
import style from './index.scss'
import React from 'react'
import ReactDOM from 'react-dom'

ReactDOM.render(

111
,
  document.getElementById('app')
)