text:
package com.github.gwtd3.api.layout;

import com.github.gwtd3.api.arrays.Array;

/**
 * The cluster layout produces dendrograms: node-link diagrams that place leaf
 * nodes of the tree at the same depth.
 *

 * For example, a cluster layout can be used to organize software classes in a package hierarchy:
 *

 * Like other classes in D3, layouts follow the method chaining pattern where setter methods return the layout itself,
 * allowing multiple setters to be invoked in a concise statement.
 *
 * @author Anthony Schiochet
 *
 */
public class Cluster<T> extends HierarchicalLayout<Cluster<T>, T, Cluster.Node<T>> {

    protected Cluster() {
    }

    /**
     * A node in the cluster layout.
     *
     * @param <T>
     */
    public static class Node<T>
            extends HierarchicalLayout.Node<T> {
        protected Node() {
        }

        /**
         * @return the computed x-coordinate of the node position.
         */
        public final native double x()/*-{
			return this.x;
        }-*/;

        /**
         * sets the x coordinate
         */
        public final native void x(double x)/*-{
			this.x = x;
        }-*/;

        /**
         * @return the computed y-coordinate of the node position.
         */
        public final native double y()/*-{
			return this.y;
        }-*/;

        /**
         * sets the y coordinate
         */
        public final native void y(double y)/*-{
			this.y = y;
        }-*/;
    }

    /**
     * Sets the available layout size. The layout size is specified in x and y, but this is not limited screen
     * coordinates and may represent an arbitrary coordinate system. For example, to produce a radial layout where the
     * tree breadth (x) is measured in degrees, and the tree depth (y) is a radius r in pixels, say [360, r].
     *

     * The size property is exclusive with {@link #nodeSize()}: setting {@link #size()} sets {@link #nodeSize()} to
     * null.
     *

     *
     * @param width
     * @param height
     * @return this layout for chaining
     */
    public final native Cluster<T> size(double width, double height) /*-{
		return this.size([ width, height ]);
    }-*/;

    /**
     * Returns the current layout size, which defaults to 1×1.
     *

     * The size property is exclusive with {@link #nodeSize()}: setting {@link #nodeSize()} sets {@link #size()} to
     * null.
     *

     *
     * @return a two-element array representing the current size of the layout, or null if nodeSize is specified
     */
    public final native Array<Double> size() /*-{
		return this.size();
    }-*/;

    /**
     * Sets a fixed size for each node.
     *

     * The nodesize property is exclusive with {@link #size()}: setting {@link #nodeSize()} sets {@link #size()} to
     * null.
     *

     *
     * @param width
     * @param height
     *
     * @return this layout for chaining
     */
    public final native Cluster<T> nodeSize(double width, double height) /*-{
		return this.nodeSize([ width, height ]);
    }-*/;

    /**
     * Returns the current node size, which defaults to null, meaning that the
     * layout has an overall fixed size, which can be retrieved using {@link #size()}.
     *

     * The nodeSize property is exclusive with {@link #size()}: setting {@link #size()} sets {@link #nodeSize()} to
     * null.
     *

     *
     * @return a two element array representing the current size of nodes
     *
     */
    public final native Array<Double> nodeSize() /*-{
		return this.nodeSize();
    }-*/;

    /**
     * Uses the specified function to compute separation between neighboring
     * nodes.
     *

     * The separation function is passed two neighboring nodes a and b, and must return the desired separation between
     * nodes. The nodes are typically siblings, though the nodes may also be cousins (or even more distant relations) if
     * the layout decides to place such nodes adjacent.
     *

     * The default separation function is:
     *
     *

     *
     * function separation(a, b) {
     *   return a.parent == b.parent ? 1 : 2;
     * }
     *
     *

     *

     * A variation that is more appropriate for radial layouts reduces the separation gap proportionally to the radius:
     * *
     *
     *

     *
     * function separation(a, b) {
     *   return (a.parent == b.parent ? 1 : 2) / a.depth;
     * }
     *
     *

     *
     *
     * @return this layout for chaining
     */
    public final native Cluster<T> separation(SeparationFunction<Cluster.Node<T>> separation) /*-{
		return this
				.separation(function(a, b) {
					return separation.@com.github.gwtd3.api.layout.SeparationFunction::separation(*)(a,b);
				});
    }-*/;

}


text:
class UserController < ApplicationController
  load_and_authorize_resource param_method: :my_sanitizer

  def index
    @users = User.excludes(:id => current_user.id)
  end

  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    if @user.save
      flash[:notice] = "Successfully created User."
      redirect_to root_path
    else
      render :action => 'new'
    end
  end

  def edit
    @user = User.find(params[:id])
  end

  def update
    @user = User.find(params[:id])
    params[:user].delete(:password) if params[:user][:password].blank?
    params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
    if @user.update_attributes( user_params )
      flash[:notice] = "Successfully updated User."
      redirect_to root_path
    else
      render :action => 'edit'
    end
  end

  def destroy
    @user = User.find(params[:id])
    if @user.destroy
      flash[:notice] = "Successfully deleted User."
      redirect_to admin_path
    end
  end

  def user_params
    params.require(:user).permit([:email, :admin, :name])
  end

end

redpajama_set_name: RedPajamaGithub


text: """Application for pomodoro technique. Timer and task manager with statistics."""


text:
// Original - Christopher Lloyd <cjwl@objc.net>
#import <Foundation/NSCharacterSet_rangeInverted.h>

@implementation NSCharacterSet_rangeInverted

-(BOOL)characterIsMember:(unichar)character {
   return (character>=_location && character<_locationPlusLength);
}

-(NSCharacterSet *)invertedSet {
   return [[[NSCharacterSet_range allocWithZone:NULL]
     initWithRange:NSMakeRange(_location,_locationPlusLength-_location)]
       autorelease];
}

@end


text:
package gov.opm.scrd.entities.application;

/**
 * This is a marker interface for rule service requests.
 *
 * @author argolite, j3_guile
 * @version 1.0
 */
public interface RuleRequest {

}


text:
<?php

namespace Omnipay\Paytrace\Message;

use Omnipay\Common\Message\RequestInterface;

abstract class AbstractResponse extends \Omnipay\Common\Message\AbstractResponse
{
    const TRANSACTION_KEY = '';

    public function __construct(RequestInterface $request, $data)
    {
        $parsedData = [];
        $responseArr = explode('|', (string)$data);
        foreach ($responseArr as $pair) {
            if (strlen(trim($pair)) == 0) {
                continue;
            }
            $tmp = explode('~', $pair);
            $parsedData[$tmp[0]] = $tmp[1];
        }
        parent::__construct($request, $parsedData);
    }

    public function getTransactionReference()
    {
        return isset($this->data[static::TRANSACTION_KEY]) ? $this->data[static::TRANSACTION_KEY] : null;
    }

    public function getMessage()
    {
        if ($this->isSuccessful()) {
            return isset($this->data['RESPONSE']) ? substr($this->data['RESPONSE'], 5) : null;
        } else {
            if (isset($this->data['ERROR'])) {
                $errorParts = explode('. ', $this->data['ERROR'], 2);
            } else {
                $errorParts = explode('. ', $this->data['RESPONSE'], 2);
            }
            return (count($errorParts) == 2) ? $errorParts[1] : null;
        }
    }

    public function getCode()
    {
        if ($this->isSuccessful()) {
            return isset($this->data['RESPONSE']) ? substr($this->data['RESPONSE'], 0, 3) : null;
        } else {
            if (isset($this->data['ERROR'])) {
                $errorParts = explode('. ', $this->data['ERROR'], 2);
            } else {
                $errorParts = explode('. ', $this->data['RESPONSE'], 2);
            }
            return (count($errorParts) == 2) ? $errorParts[0] : null;
        }
    }
}


text:
package com.cardpay.pccredit.manager.model;

import com.wicresoft.jrad.base.web.form.BaseForm;

/**
 * @author songchen
 *
 * 2014-11-14下午5:50:49
 */
public class ManagerSalaryForm extends BaseForm {
	private static final long serialVersionUID = 1L;

	private String id;

	private String customerId;
	// 客户经理姓名
	private String managerName;
	// 客户经理奖励激励金额(包含风险准备金 )= 绩效工资
	private String rewardIncentiveInformation;
	// 扣除金额
	private String deductAmount;
	// 底薪
	private String basePay;
	// 津贴
	private String allowance;
	// 责任工资
	private String dutySalary;
	// 返还金额
	private String returnPrepareAmount;
	// 准备金额总额
	private String insertPrepareAmount;
	// 风险准备金余额
	private String riskReserveBalances;
	// 罚款
	private String fine;
	//年份
	private String year;
	//月份
	private String month;
	//备注
	private String describe;
	//本月工资
	private String wage;
	//机构
	private String instCode;

    private String basicTaskBonus;

	private String middleAllowance;

	private String attendDeduct;

	private String rowIndex;

	private String  monthLoanNum;

	private String  monthEffectNum;

	private String  monthOverdueDays;

	private String  monthTimes;

	//业务量绩效
	private String volumePerformance;
	//利润提成
	private String profitDraw;
	//逾期扣款
	private String overdueDeduct;
	private String managerType;

	private String subsidies;
	private String auditNum;

	public String getAuditNum() {
		return auditNum;
	}

	public void setAuditNum(String auditNum) {
		this.auditNum = auditNum;
	}

	public String getSubsidies() {
		return subsidies;
	}

	public void setSubsidies(String subsidies) {
		this.subsidies = subsidies;
	}

	public String getManagerType() {
		return managerType;
	}

	public void setManagerType(String managerType) {
		this.managerType = managerType;
	}

	public String getVolumePerformance() {
		return volumePerformance;
	}

	public void setVolumePerformance(String volumePerformance) {
		this.volumePerformance = volumePerformance;
	}

	public String getProfitDraw() {
		return profitDraw;
	}

	public void setProfitDraw(String profitDraw) {
		this.profitDraw = profitDraw;
	}

	public String getOverdueDeduct() {
		return overdueDeduct;
	}

	public void setOverdueDeduct(String overdueDeduct) {
		this.overdueDeduct = overdueDeduct;
	}

	public String getMonthLoanNum() {
		return monthLoanNum;
	}

	public void setMonthLoanNum(String monthLoanNum) {
		this.monthLoanNum = monthLoanNum;
	}

	public String getMonthEffectNum() {
		return monthEffectNum;
	}

	public void setMonthEffectNum(String monthEffectNum) {
		this.monthEffectNum = monthEffectNum;
	}

	public String getMonthOverdueDays() {
		return monthOverdueDays;
	}

	public void setMonthOverdueDays(String monthOverdueDays) {
		this.monthOverdueDays = monthOverdueDays;
	}

	public String getMonthTimes() {
		return monthTimes;
	}

	public void setMonthTimes(String monthTimes) {
		this.monthTimes = monthTimes;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public String getRowIndex() {
		return rowIndex;
	}

	public void setRowIndex(String rowIndex) {
		this.rowIndex = rowIndex;
	}

	public String getBasicTaskBonus() {
		return basicTaskBonus;
	}

	public void setBasicTaskBonus(String basicTaskBonus) {
		this.basicTaskBonus = basicTaskBonus;
	}

	public String getMiddleAllowance() {
		return middleAllowance;
	}

	public void setMiddleAllowance(String middleAllowance) {
		this.middleAllowance = middleAllowance;
	}

	public String getAttendDeduct() {
		return attendDeduct;
	}

	public void setAttendDeduct(String attendDeduct) {
		this.attendDeduct = attendDeduct;
	}

	public String getInstCode() {
		return instCode;
	}

	public void setInstCode(String instCode) {
		this.instCode = instCode;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getWage() {
		return wage;
	}

	public void setWage(String wage) {
		this.wage = wage;
	}

	public String getCustomerId() {
		return customerId;
	}

	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}

	public String getRewardIncentiveInformation() {
		return rewardIncentiveInformation;
	}

	public void setRewardIncentiveInformation(String rewardIncentiveInformation) {
		this.rewardIncentiveInformation = rewardIncentiveInformation;
	}

	public String getDeductAmount() {
		return deductAmount;
	}

	public void setDeductAmount(String deductAmount) {
		this.deductAmount = deductAmount;
	}

	public String getBasePay() {
		return basePay;
	}

	public void setBasePay(String basePay) {
		this.basePay = basePay;
	}

	public String getAllowance() {
		return allowance;
	}

	public void setAllowance(String allowance) {
		this.allowance = allowance;
	}

	public String getDutySalary() {
		return dutySalary;
	}

	public void setDutySalary(String dutySalary) {
		this.dutySalary = dutySalary;
	}

	public String getReturnPrepareAmount() {
		return returnPrepareAmount;
	}

	public void setReturnPrepareAmount(String returnPrepareAmount) {
		this.returnPrepareAmount = returnPrepareAmount;
	}

	public String getInsertPrepareAmount() {
		return insertPrepareAmount;
	}

	public void setInsertPrepareAmount(String insertPrepareAmount) {
		this.insertPrepareAmount = insertPrepareAmount;
	}

	public String getFine() {
		return fine;
	}

	public void setFine(String fine) {
		this.fine = fine;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getDescribe() {
		return describe;
	}

	public void setDescribe(String describe) {
		this.describe = describe;
	}

	public String getManagerName() {
		return managerName;
	}

	public void setManagerName(String managerName) {
		this.managerName = managerName;
	}

	public String getRiskReserveBalances() {
		return riskReserveBalances;
	}

	public void setRiskReserveBalances(String riskReserveBalances) {
		this.riskReserveBalances = riskReserveBalances;
	}
}


text:
'use strict';

/**
 * wraps angular's currency filter with an additional layer, in case the currency symbol is not available.
 */
angular.module('isoCurrency', ['isoCurrency.common'])
	.filter('isoCurrency', ['$filter', 'iso4217', function($filter, iso4217) {

		/**
		 * transforms an amount into the right format and currency according to a passed currency code (3 chars).
		 *
		 * @param float amount
		 * @param string currencyCode e.g. EUR, USD
		 * @param number fraction User specified fraction size that overwrites default value
		 * @return string
		 */
		return function(amount, currencyCode, fraction) {
			if (!currencyCode) {
				return;
			}
			var currency = iso4217.getCurrencyByCode(currencyCode);
			var fractionSize = (fraction === void 0) ? currency.fraction : fraction;

			// Angular polyfill for angular version <= 1.2 ( before fractionSize support )
			if(angular.version.major <= 1 && angular.version.minor <= 2) {
				var number = $filter('number')(amount, fractionSize);
				return currency.symbol + number;
			}

			return $filter('currency')(amount, currency.symbol, fractionSize);
		};

	}]);


text:
package org.ooc.parsers;

import java.io.EOFException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import org.ooc.errors.SourceContext;
import org.ooc.nodes.types.Type;
import org.ooc.nodes.types.TypeReference;
import org.ubi.SourceReader;

/**
 * The type resolver is used to keep track of all types and to return
 * references to them (TypeReference(s) or ClasssReference(s))
 *
 * @author Amos Wenger
 */
public class TypeParser implements Parser {

	/** A list of common type names, from longest to shortest */
	protected final static List<String> stdTypes;
	/** A map from common type names to an array of their "components" */
	protected final static Map<String, String[]> stdTypesMap;

	static {

		stdTypes = new ArrayList<String>();
		stdTypesMap = new HashMap<String, String[]>();

		addType("unsigned long long int");
		addType("signed long long int");
		addType("unsigned long long");
		addType("signed long long");
		addType("long long");

		addType("unsigned long int");
		addType("signed long int");
		addType("unsigned long");
		addType("signed long");

		addType("unsigned int");
		addType("signed int");
		addType("int");

		addType("unsigned short int");
		addType("signed short int");
		addType("unsigned short");
		addType("signed short");
		addType("short");

		addType("unsigned char");
		addType("signed char");
		addType("char");

		addType("long double");
		addType("double");
		addType("float");
		addType("unsigned");
		addType("signed");

		addType("long");
		addType("bool");
		addType("void");
		addType("size_t");
		addType("wchar_t");
		addType("ptrdiff_t");

	}

	/**
	 * Add a type to the type parser, so that it recognizes it later
	 * @param typeName
	 */
	public static void addType(String typeName) {

		StringTokenizer st = new StringTokenizer(typeName, " ");
		String[] breakDown = new String[st.countTokens()];
		int count = 0;
		while(st.hasMoreTokens()) {
			breakDown[count++] = st.nextToken();
		}
		stdTypes.add(typeName);
		stdTypesMap.put(typeName, breakDown);

	}

	/**
	 * Test for a validity of a type
	 * @param typeName
	 * @return
	 */
	public static boolean isValidType(String typeName) {

		return stdTypesMap.containsKey(typeName);

	}

	public boolean parse(SourceContext context) throws IOException {

		String name = readTypeName(context.reader);
		if(name.isEmpty()) {
			return false; // Failed to parse
		}

		if(Character.isJavaIdentifierPart(context.reader.peek())) {
			// We have a read a type, but it's only the beginning of another
			// word (e.g. a variable name), ignore.
			return false;
		}

		Type type = new Type(context.reader.getLocation(), context.source.getRoot(), name);
		context.add(new TypeReference(context.reader.getLocation(), type));
		type.isResolved = true;
		return true;

	}

	/**
	 * Read a standard type name, e.g. "unsigned short int" or "long long"
	 * @param context
	 * @return the read type name, or the empty string if nothing corresponds
	 * to a type name
	 * @throws IOException
	 */
	public static String readTypeName(SourceReader reader) throws EOFException {

		int mark = reader.mark();
		reference: for(String name: stdTypes) {

			String parts[] = stdTypesMap.get(name);
			reader.reset(mark);
			int count = 0;
			for(String part: parts) {
				if(count >= parts.length) {
					continue reference; // too long
				}
				reader.skipWhitespace();
				if(!(reader.matches(part, true) && !Character.isLetterOrDigit(reader.peek()))) {
					continue reference; // must match the part
				}
				count++;
			}
			if(Character.isLetterOrDigit(reader.peek())) {
				return ""; // false alert
			}

			return name;

		}
		return "";

	}

}


text:
class InsecureContentInfoBarDelegate : public ConfirmInfoBarDelegate {
 public:
  enum InfoBarType {
    DISPLAY,  // Shown when "inactive" content (e.g. images) has been blocked.
    RUN,      // Shown when "active" content (e.g. script) has been blocked.
  };

  // Depending on the |type| requested and whether an insecure content infobar
  // is already present in |infobar_service|, may do nothing; otherwise, creates
  // an insecure content delegate and either adds it to |infobar_service| or
  // replaces the existing infobar delegate.
  static void Create(InfoBarService* infobar_service, InfoBarType type);

 private:
  enum HistogramEvents {
    DISPLAY_INFOBAR_SHOWN = 0,  // Infobar was displayed.
    DISPLAY_USER_OVERRIDE,      // User clicked allow anyway button.
    DISPLAY_USER_DID_NOT_LOAD,  // User clicked the don't load button.
    DISPLAY_INFOBAR_DISMISSED,  // User clicked close button.
    RUN_INFOBAR_SHOWN,
    RUN_USER_OVERRIDE,
    RUN_USER_DID_NOT_LOAD,
    RUN_INFOBAR_DISMISSED,
    NUM_EVENTS
  };

  InsecureContentInfoBarDelegate(InfoBarService* infobar_service,
                                 InfoBarType type);
  virtual ~InsecureContentInfoBarDelegate();

  // ConfirmInfoBarDelegate:
  virtual void InfoBarDismissed() OVERRIDE;
  virtual InsecureContentInfoBarDelegate*
      AsInsecureContentInfoBarDelegate() OVERRIDE;
  virtual string16 GetMessageText() const OVERRIDE;
  virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
  virtual bool Accept() OVERRIDE;
  virtual bool Cancel() OVERRIDE;
  virtual string16 GetLinkText() const OVERRIDE;
  virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;

  InfoBarType type_;

  DISALLOW_IMPLICIT_CONSTRUCTORS(InsecureContentInfoBarDelegate);
};

#endif  // CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_


text:
@implementation A0ThemeReact

- (NSString *)getStyleKeyFromThemeKey:(NSString *)key {
    NSString *tmp = [key substringFromIndex:7];
    NSString *styleKey = [[[tmp substringToIndex:1] lowercaseString] stringByAppendingString:[tmp substringFromIndex:1]];
    return styleKey;
}

- (void)themeLockColorForKey:(NSString *)key style:(NSDictionary *)style {
    NSString *styleKey = [self getStyleKeyFromThemeKey:key];
    NSString *value = style[styleKey];
    if (value) {
        unsigned rgbValue = 0;
        NSScanner *scanner = [NSScanner scannerWithString:value];
        [scanner setScanLocation:1]; // bypass '#' character
        [scanner scanHexInt:&rgbValue];
        UIColor *color = [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
        [_theme registerColor:color forKey:key];
    }
}

- (void)themeLockImageForKey:(NSString *)key style:(NSDictionary *)style {
    NSString *styleKey = [self getStyleKeyFromThemeKey:key];
    NSString *value = style[styleKey];
    if (value) {
        [_theme registerImageWithName:value bundle:NULL forKey:key];
    }
}

- (void)themeLockWithStyle:(NSDictionary*)style {
    _theme = [[A0Theme alloc] init];

    // Primary Button
    [self themeLockColorForKey:A0ThemePrimaryButtonNormalColor style:style];
    [self themeLockColorForKey:A0ThemePrimaryButtonHighlightedColor style:style];
    [self themeLockColorForKey:A0ThemePrimaryButtonTextColor style:style];
    // Secondary Button
    [self themeLockColorForKey:A0ThemeSecondaryButtonBackgroundColor style:style];
    [self themeLockColorForKey:A0ThemeSecondaryButtonTextColor style:style];
    // Text field
    [self themeLockColorForKey:A0ThemeTextFieldTextColor style:style];
    [self themeLockColorForKey:A0ThemeTextFieldPlaceholderTextColor style:style];
    [self themeLockColorForKey:A0ThemeTextFieldIconColor style:style];
    // Title
    [self themeLockColorForKey:A0ThemeTitleTextColor style:style];
    // Icon
    [self themeLockColorForKey:A0ThemeIconBackgroundColor style:style];
    // Background
    [self themeLockColorForKey:A0ThemeScreenBackgroundColor style:style];
    // Description
    [self themeLockColorForKey:A0ThemeDescriptionTextColor style:style];
    [self themeLockColorForKey:A0ThemeSeparatorTextColor style:style];
    // Credentials Box
    [self themeLockColorForKey:A0ThemeCredentialBoxBorderColor style:style];
    [self themeLockColorForKey:A0ThemeCredentialBoxSeparatorColor style:style];
    [self themeLockColorForKey:A0ThemeCredentialBoxBackgroundColor style:style];
    // Close
    [self themeLockColorForKey:A0ThemeCloseButtonTintColor style:style];

    // Primary Button
    [self themeLockImageForKey:A0ThemePrimaryButtonNormalImageName style:style];
    [self themeLockImageForKey:A0ThemePrimaryButtonHighlightedImageName style:style];
    // Secondary Button
    [self themeLockImageForKey:A0ThemeSecondaryButtonNormalImageName style:style];
    [self themeLockImageForKey:A0ThemeSecondaryButtonHighlightedImageName style:style];
    // Icon
    [self themeLockImageForKey:A0ThemeIconImageName style:style];
    // Screen
    [self themeLockImageForKey:A0ThemeScreenBackgroundImageName style:style];

    [[A0Theme sharedInstance] registerTheme:_theme];
}

@end


text:
NSString * const KGOEntityNameEventCategory = @"KGOCalendar";

@implementation KGOCalendar
@dynamic title;
@dynamic identifier;
@dynamic type;
@dynamic subCalendars;
@dynamic parentCalendar;
@dynamic events;
@dynamic groups;

+ (KGOCalendar *)calendarWithID:(NSString *)identifier
{
    NSPredicate *pred = [NSPredicate predicateWithFormat:@"identifier like %@", identifier];
    KGOCalendar *category = [[[CoreDataManager sharedManager] objectsForEntity:KGOEntityNameEventCategory
                                                               matchingPredicate:pred] lastObject];
    if (!category) {
        category = [[CoreDataManager sharedManager] insertNewObjectForEntityForName:KGOEntityNameEventCategory];
        category.identifier = identifier;
    }

    DLog(@"%@ %d", category.identifier, category.events.count);

    return category;
}

+ (KGOCalendar *)calendarWithDictionary:(NSDictionary *)aDict
{
    KGOCalendar *category = nil;
    NSString *identifier = [aDict stringForKey:@"id" nilIfEmpty:YES];
    if (identifier) {
        category = [KGOCalendar calendarWithID:identifier];
        NSString *title = [aDict stringForKey:@"title" nilIfEmpty:YES];
        if (title && ![category.title isEqualToString:title]) {
            category.title = title;
        }
        NSString *type = [aDict stringForKey:@"type" nilIfEmpty:YES];
        if (type && ![category.type isEqualToString:type]) {
            category.type = type;
        }
    }

    return category;
}

#pragma mark KGOCategory

- (id<KGOCategory>)parent
{
    return self.parentCalendar;
}

- (NSArray *)children
{
    // TODO: sort
    return [self.subCalendars allObjects];
}

- (NSArray *)items
{
    // TODO: refine
    return [self.events allObjects];
}

#pragma mark - Core data generated accessors

- (void)addSubCategoriesObject:(KGOCalendar *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"subCalendars"] addObject:value];
    [self didChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)removeSubCategoriesObject:(KGOCalendar *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"subCalendars"] removeObject:value];
    [self didChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)addSubCategories:(NSSet *)value {
    [self willChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"subCalendars"] unionSet:value];
    [self didChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
}

- (void)removeSubCategories:(NSSet *)value {
    [self willChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"subCalendars"] minusSet:value];
    [self didChangeValueForKey:@"subCalendars" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
}

- (void)addEventsObject:(KGOEvent *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"events" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"events"] addObject:value];
    [self didChangeValueForKey:@"events" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)removeEventsObject:(KGOEvent *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"events" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"events"] removeObject:value];
    [self didChangeValueForKey:@"events" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)addEvents:(NSSet *)value {
    [self willChangeValueForKey:@"events" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"events"] unionSet:value];
    [self didChangeValueForKey:@"events" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
}

- (void)removeEvents:(NSSet *)value {
    [self willChangeValueForKey:@"events" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"events"] minusSet:value];
    [self didChangeValueForKey:@"events" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
}

- (void)addGroupsObject:(KGOCalendarGroup *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"groups" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"groups"] addObject:value];
    [self didChangeValueForKey:@"groups" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)removeGroupsObject:(KGOCalendarGroup *)value {
    NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
    [self willChangeValueForKey:@"groups" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [[self primitiveValueForKey:@"groups"] removeObject:value];
    [self didChangeValueForKey:@"groups" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
    [changedObjects release];
}

- (void)addGroups:(NSSet *)value {
    [self willChangeValueForKey:@"groups" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"groups"] unionSet:value];
    [self didChangeValueForKey:@"groups" withSetMutation:NSKeyValueUnionSetMutation usingObjects:value];
}

- (void)removeGroups:(NSSet *)value {
    [self willChangeValueForKey:@"groups" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
    [[self primitiveValueForKey:@"groups"] minusSet:value];
    [self didChangeValueForKey:@"groups" withSetMutation:NSKeyValueMinusSetMutation usingObjects:value];
}

@end


text:
""" IFont Object

A Font specifies a font for displaying text.  This is an abstract definition,
and the actual font which is displayed will depend upon the capabilities of the
toolkit and the fonts available in the OS.

"""

from __future__ import absolute_import, division, print_function

from traits.api import Enum, Event, Int, Unicode

from .i_object import IObject

class IFont(IObject):

    #: the font family to use, if available
    family = Unicode('sanserif')

    #: the size of the font, in points
    size = Int

    #: the style of the font to use, if possible
    style = Enum("normal", "italic", "oblique")

    #: the weight of the font to use, if possible
    weight = Enum("normal", "light", "demibold", "bold", "black")


text:
package org.springframework.boot.web.context;

import java.io.File;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import org.springframework.boot.web.server.WebServer;
import org.springframework.util.StringUtils;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.contentOf;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

/**
 * Tests {@link WebServerPortFileWriter}.
 *
 * @author David Liu
 * @author Phillip Webb
 * @author Andy Wilkinson
 */
class WebServerPortFileWriterTest {

	@TempDir
	File tempDir;

	@BeforeEach
	@AfterEach
	void reset() {
		System.clearProperty("PORTFILE");
	}

	@Test
	void createPortFile() throws Exception {
		File file = new File(this.tempDir, "port.file");
		WebServerPortFileWriter listener = new WebServerPortFileWriter(file);
		listener.onApplicationEvent(mockEvent("", 8080));
		assertThat(contentOf(file)).isEqualTo("8080");
	}

	@Test
	void overridePortFileWithDefault() throws Exception {
		System.setProperty("PORTFILE", new File(this.tempDir, "port.file").getAbsolutePath());
		WebServerPortFileWriter listener = new WebServerPortFileWriter();
		listener.onApplicationEvent(mockEvent("", 8080));
		String content = contentOf(new File(System.getProperty("PORTFILE")));
		assertThat(content).isEqualTo("8080");
	}

	@Test
	void overridePortFileWithExplicitFile() throws Exception {
		File file = new File(this.tempDir, "port.file");
		System.setProperty("PORTFILE", new File(this.tempDir, "override.file").getAbsolutePath());
		WebServerPortFileWriter listener = new WebServerPortFileWriter(file);
		listener.onApplicationEvent(mockEvent("", 8080));
		String content = contentOf(new File(System.getProperty("PORTFILE")));
		assertThat(content).isEqualTo("8080");
	}

	@Test
	void createManagementPortFile() throws Exception {
		File file = new File(this.tempDir, "port.file");
		WebServerPortFileWriter listener = new WebServerPortFileWriter(file);
		listener.onApplicationEvent(mockEvent("", 8080));
		listener.onApplicationEvent(mockEvent("management", 9090));
		assertThat(contentOf(file)).isEqualTo("8080");
		String managementFile = file.getName();
		managementFile = managementFile.substring(0,
				managementFile.length() - StringUtils.getFilenameExtension(managementFile).length() - 1);
		managementFile = managementFile + "-management." + StringUtils.getFilenameExtension(file.getName());
		String content = contentOf(new File(file.getParentFile(), managementFile));
		assertThat(content).isEqualTo("9090");
		assertThat(collectFileNames(file.getParentFile())).contains(managementFile);
	}

	@Test
	void createUpperCaseManagementPortFile() throws Exception {
		File file = new File(this.tempDir, "port.file");
		file = new File(file.getParentFile(), file.getName().toUpperCase(Locale.ENGLISH));
		WebServerPortFileWriter listener = new WebServerPortFileWriter(file);
		listener.onApplicationEvent(mockEvent("management", 9090));
		String managementFile = file.getName();
		managementFile = managementFile.substring(0,
				managementFile.length() - StringUtils.getFilenameExtension(managementFile).length() - 1);
		managementFile = managementFile + "-MANAGEMENT." + StringUtils.getFilenameExtension(file.getName());
		String content = contentOf(new File(file.getParentFile(), managementFile));
		assertThat(content).isEqualTo("9090");
		assertThat(collectFileNames(file.getParentFile())).contains(managementFile);
	}

	private WebServerInitializedEvent mockEvent(String namespace, int port) {
		WebServer webServer = mock(WebServer.class);
		given(webServer.getPort()).willReturn(port);
		WebServerApplicationContext applicationContext = mock(WebServerApplicationContext.class);
		given(applicationContext.getServerNamespace()).willReturn(namespace);
		given(applicationContext.getWebServer()).willReturn(webServer);
		WebServerInitializedEvent event = mock(WebServerInitializedEvent.class);
		given(event.getApplicationContext()).willReturn(applicationContext);
		given(event.getWebServer()).willReturn(webServer);
		return event;
	}

	private Set<String> collectFileNames(File directory) {
		Set<String> names = new HashSet<>();
		if (directory.isDirectory()) {
			for (File file : directory.listFiles()) {
				names.add(file.getName());
			}
		}
		return names;
	}

}


text:
import { Directive, Optional, Input, NgModule, Host, ComponentFactoryResolver, ViewContainerRef } from '@angular/core';
import { ISortingExpression } from '../data-operations/sorting-expression.interface';
import { FilteringExpressionsTree, IFilteringExpressionsTree } from '../data-operations/filtering-expressions-tree';
import { IFilteringExpression } from '../data-operations/filtering-expression.interface';
import { IgxColumnComponent } from './columns/column.component';
import { IGroupingExpression } from '../data-operations/grouping-expression.interface';
import { IPagingState } from '../data-operations/paging-state.interface';
import { GridColumnDataType } from '../data-operations/data-util';
import { IgxBooleanFilteringOperand, IgxNumberFilteringOperand, IgxDateFilteringOperand,
    IgxStringFilteringOperand, IFilteringOperation} from '../data-operations/filtering-condition';
import { GridSelectionRange } from './selection/selection.service';
import { IGroupByExpandState } from '../data-operations/groupby-expand-state.interface';
import { IGroupingState } from '../data-operations/groupby-state.interface';
import { IgxGridBaseDirective } from './grid-base.directive';
import { IgxGridComponent } from './grid/grid.component';
import { IgxHierarchicalGridComponent } from './hierarchical-grid/hierarchical-grid.component';
import { IPinningConfig } from './grid.common';
import { delay, take } from 'rxjs/operators';

export interface IGridState {
    columns?: IColumnState[];
    filtering?: IFilteringExpressionsTree;
    advancedFiltering?: IFilteringExpressionsTree;
    paging?: IPagingState;
    sorting?: ISortingExpression[];
    groupBy?: IGroupingState;
    cellSelection?: GridSelectionRange[];
    rowSelection?: any[];
    columnSelection?: string[];
    rowPinning?: any[];
    pinningConfig?: IPinningConfig;
    expansion?: any[];
    rowIslands?: IGridStateCollection[];
    id?: string;
}

export interface IGridStateCollection {
    id: string;
    parentRowID: any;
    state: IGridState;
}

export interface IGridStateOptions {
    columns?: boolean;
    filtering?: boolean;
    advancedFiltering?: boolean;
    sorting?: boolean;
    groupBy?: boolean;
    paging?: boolean;
    cellSelection?: boolean;
    rowSelection?: boolean;
    columnSelection?: boolean;
    rowPinning?: boolean;
    pinningConfig?: boolean;
    expansion?: boolean;
    rowIslands?: boolean;
}

export interface IColumnState {
    pinned: boolean;
    sortable: boolean;
    filterable: boolean;
    editable: boolean;
    sortingIgnoreCase: boolean;
    filteringIgnoreCase: boolean;
    headerClasses: string;
    headerGroupClasses: string;
    maxWidth: string;
    groupable: boolean;
    movable: boolean;
    hidden: boolean;
    dataType: GridColumnDataType;
    hasSummary: boolean;
    field: string;
    width: any;
    header: string;
    resizable: boolean;
    searchable: boolean;
}

export type GridFeatures = keyof IGridStateOptions;

interface Feature {
    getFeatureState: (context: IgxGridStateDirective) => IGridState;
    restoreFeatureState: (context: IgxGridStateDirective, state: IColumnState[] | IPagingState | ISortingExpression[] |
        IGroupingState | IFilteringExpressionsTree | GridSelectionRange[] | IPinningConfig | any[]) => void;
}

@Directive({
    selector: '[igxGridState]'
})
export class IgxGridStateDirective {
    private static ngAcceptInputType_options: IGridStateOptions | '';

    private featureKeys: GridFeatures[] = [];
    private state: IGridState;
    private currGrid: IgxGridBaseDirective;
    private _options: IGridStateOptions = {
        columns: true,
        filtering: true,
        advancedFiltering: true,
        sorting: true,
        groupBy: true,
        paging: true,
        cellSelection: true,
        rowSelection: true,
        columnSelection: true,
        rowPinning: true,
        expansion: true,
        rowIslands: true
    };
    private FEATURES = {
        sorting:  {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const sortingState = context.currGrid.sortingExpressions;
                sortingState.forEach(s => {
                    delete s.strategy;
                    delete s.owner;
                });
                return { sorting: sortingState };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: ISortingExpression[]): void => {
                context.currGrid.sortingExpressions = state;
            }
        },
        filtering: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const filteringState = context.currGrid.filteringExpressionsTree;
                if (filteringState) {
                    delete filteringState.owner;
                    for (const item of filteringState.filteringOperands) {
                        delete (item as IFilteringExpressionsTree).owner;
                    }
                }
                return { filtering: filteringState };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: FilteringExpressionsTree): void => {
                const filterTree = context.createExpressionsTreeFromObject(state);
                context.currGrid.filteringExpressionsTree = filterTree as FilteringExpressionsTree;
            }
        },
        advancedFiltering: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const filteringState = context.currGrid.advancedFilteringExpressionsTree;
                let advancedFiltering: any;
                if (filteringState) {
                    delete filteringState.owner;
                    for (const item of filteringState.filteringOperands) {
                        delete (item as IFilteringExpressionsTree).owner;
                    }
                    advancedFiltering = filteringState;
                } else {
                    advancedFiltering = {};
                }
                return { advancedFiltering };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: FilteringExpressionsTree): void => {
                const filterTree = context.createExpressionsTreeFromObject(state);
                context.currGrid.advancedFilteringExpressionsTree = filterTree as FilteringExpressionsTree;
            }
        },
        columns: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const gridColumns: IColumnState[] = context.currGrid.columns.map((c) => ({
                        pinned: c.pinned,
                        sortable: c.sortable,
                        filterable: c.filterable,
                        editable: c.editable,
                        sortingIgnoreCase: c.sortingIgnoreCase,
                        filteringIgnoreCase: c.filteringIgnoreCase,
                        headerClasses: c.headerClasses,
                        headerGroupClasses: c.headerGroupClasses,
                        maxWidth: c.maxWidth,
                        groupable: c.groupable,
                        movable: c.movable,
                        hidden: c.hidden,
                        dataType: c.dataType,
                        hasSummary: c.hasSummary,
                        field: c.field,
                        width: c.width,
                        header: c.header,
                        resizable: c.resizable,
                        searchable: c.searchable,
                        selectable: c.selectable
                    }));
                return { columns: gridColumns };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: IColumnState[]): void => {
                const newColumns = [];
                const factory = context.resolver.resolveComponentFactory(IgxColumnComponent);
                state.forEach((colState) => {
                    const ref = factory.create(context.viewRef.injector);
                    Object.assign(ref.instance, colState);
                    ref.changeDetectorRef.detectChanges();
                    newColumns.push(ref.instance);
                });
                context.currGrid.columnList.reset(newColumns);
                context.currGrid.columnList.notifyOnChanges();
            }
        },
        groupBy: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const grid = context.currGrid as IgxGridComponent;
                const groupingExpressions = grid.groupingExpressions;
                groupingExpressions.forEach(expr => {
                    delete expr.strategy;
                });
                const expansionState = grid.groupingExpansionState;
                const groupsExpanded = grid.groupsExpanded;

                return { groupBy: { expressions: groupingExpressions, expansion: expansionState, defaultExpanded: groupsExpanded}  };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: IGroupingState): void => {
                const grid = context.currGrid as IgxGridComponent;
                grid.groupingExpressions = state.expressions as IGroupingExpression[];
                if (grid.groupsExpanded !== state.defaultExpanded) {
                    grid.toggleAllGroupRows();
                } else {
                    grid.groupingExpansionState = state.expansion as IGroupByExpandState[];
                }
            }
        },
        paging: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const pagingState = context.currGrid.pagingState;
                return { paging: pagingState };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: IPagingState): void => {
                if (context.currGrid.perPage !== state.recordsPerPage) {
                    context.currGrid.perPage = state.recordsPerPage;
                    context.currGrid.cdr.detectChanges();
                }
                context.currGrid.page = state.index;
            }
        },
        rowSelection: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const selection = context.currGrid.selectedRows;
                return { rowSelection: selection };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: any[]): void => {
                context.currGrid.selectRows(state, true);
            }
        },
        cellSelection: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const selection = context.currGrid.getSelectedRanges().map(range =>
                    ({ rowStart: range.rowStart, rowEnd: range.rowEnd, columnStart: range.columnStart, columnEnd: range.columnEnd }));
                return { cellSelection: selection };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: GridSelectionRange[]): void => {
                state.forEach(r => {
                    const range = { rowStart: r.rowStart, rowEnd: r.rowEnd, columnStart: r.columnStart, columnEnd: r.columnEnd};
                    context.currGrid.selectRange(range);
                });
            }
        },
        columnSelection: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const selection = context.currGrid.selectedColumns().map(c => c.field);
                return { columnSelection: selection };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: string[]): void => {
                context.currGrid.deselectAllColumns();
                context.currGrid.selectColumns(state);
            }
        },
        rowPinning: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const pinned = context.currGrid.pinnedRows.map(x => x.rowID);
                return { rowPinning: pinned };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: any[]): void => {
                // clear current state.
                context.currGrid.pinnedRows.forEach(row => row.unpin());
                state.forEach(rowID => context.currGrid.pinRow(rowID));
            }
        },
        pinningConfig: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => ({ pinningConfig: context.currGrid.pinning }),
            restoreFeatureState: (context: IgxGridStateDirective, state: IPinningConfig): void => {
                context.currGrid.pinning = state;
            }
        },
        expansion: {
            getFeatureState: (context: IgxGridStateDirective): IGridState => {
                const expansionStates = Array.from(context.currGrid.expansionStates);
                return { expansion: expansionStates };
            },
            restoreFeatureState: (context: IgxGridStateDirective, state: any[]): void => {
                const expansionStates = new Map<any, boolean>(state);
                context.currGrid.expansionStates = expansionStates;
            }
        },
        rowIslands: {
            getFeatureState(context: IgxGridStateDirective): IGridState {
                const childGridStates: IGridStateCollection[] = [];
                const rowIslands = (context.currGrid as any).allLayoutList;
                if (rowIslands) {
                    rowIslands.forEach(rowIsland => {
                        const childGrids = rowIsland.rowIslandAPI.getChildGrids();
                        childGrids.forEach(chGrid => {
                            const parentRowID = this.getParentRowID(chGrid);
                            context.currGrid = chGrid;
                            if (context.currGrid) {
                                const childGridState = context.buildState(context.featureKeys) as IGridState;
                                childGridStates.push({ id: `${rowIsland.id}`, parentRowID, state: childGridState });
                            }
                        });
                    });
                }
                context.currGrid = context.grid;
                return { rowIslands: childGridStates };
            },
            restoreFeatureState(context: IgxGridStateDirective, state: any): void {
                const rowIslands = (context.currGrid as any).allLayoutList;
                if (rowIslands) {
                    rowIslands.forEach(rowIsland => {
                        const childGrids = rowIsland.rowIslandAPI.getChildGrids();
                        childGrids.forEach(chGrid => {
                            const parentRowID = this.getParentRowID(chGrid);
                            context.currGrid = chGrid;
                            const childGridState = state.find(st => st.id === rowIsland.id && st.parentRowID === parentRowID);
                            if (childGridState && context.currGrid) {
                                context.restoreGridState(childGridState.state, context.featureKeys);
                            }
                        });
                    });
                }
                context.currGrid = context.grid;
            },
            /**
             * Traverses the hierarchy up to the root grid to return the ID of the expanded row.
             */
            getParentRowID: (grid: IgxHierarchicalGridComponent) => {
                let childGrid;
                while (grid.parent) {
                    childGrid = grid;
                    grid = grid.parent;
                }
                return grid.hgridAPI.getParentRowId(childGrid);
            }
        }
    };

    /**
     *  An object with options determining if a certain feature state should be saved.
     * ```html
     * <igx-grid [igxGridState]="options"></igx-grid>
     * ```
     * ```typescript
     * public options = {selection: false, advancedFiltering: false};
     * ```
     */
    @Input('igxGridState')
    public get options(): IGridStateOptions {
       return this._options;
    }

    public set options(value: IGridStateOptions) {
        Object.assign(this._options, value);
        if (!(this.grid instanceof IgxGridComponent)) {
            delete this._options.groupBy;
        } else {
            delete this._options.rowIslands;
        }
    }

    /**
     * @hidden
     */
    constructor(
        @Host() @Optional() public grid: IgxGridBaseDirective,
        private resolver: ComponentFactoryResolver,
        private viewRef: ViewContainerRef) { }

    /**
     * Gets the state of a feature or states of all grid features, unless a certain feature is disabled through the `options` property.
     *
     * @param `serialize` determines whether the returned object will be serialized to JSON string. Default value is true.
     * @param `feature` string or array of strings determining the features to be added in the state. If skipped, all features are added.
     * @returns Returns the serialized to JSON string IGridState object, or the non-serialized IGridState object.
     * ```html
     * <igx-grid [igxGridState]="options"></igx-grid>
     * ```
     * ```typescript
     * @ViewChild(IgxGridStateDirective, { static: true }) public state;
     * let state = this.state.getState(); // returns string
     * let state = this.state(false) // returns `IGridState` object
     * ```
     */
    public getState(serialize = true, features?: GridFeatures | GridFeatures[]): IGridState | string  {
        let state: IGridState | string;
        this.currGrid = this.grid;
        this.state = state = this.buildState(features) as IGridState;
        if (serialize) {
            state = JSON.stringify(state, this.stringifyCallback) as string;
        }
        return state;
    }

    /**
     * Restores grid features' state based on the IGridState object passed as an argument.
     *
     * @param IGridState object to restore state from.
     * @returns
     * ```html
     * <igx-grid [igxGridState]="options"></igx-grid>
     * ```
     * ```typescript
     * @ViewChild(IgxGridStateDirective, { static: true }) public state;
     * this.state.setState(gridState);
     * ```
     */
    public setState(state: IGridState | string, features?: GridFeatures | GridFeatures[]) {
        if (typeof state === 'string') {
            state = JSON.parse(state) as IGridState;
        }
        this.state = state;
        this.currGrid = this.grid;
        this.restoreGridState(state, features);
        this.grid.cdr.detectChanges(); // TODO
    }

    /**
     * Builds an IGridState object.
     */
    private buildState(keys?: GridFeatures | GridFeatures[]): IGridState {
        this.applyFeatures(keys);
        let gridState = {} as IGridState;
        this.featureKeys.forEach(f => {
            if (this.options[f]) {
                if (!(this.grid instanceof IgxGridComponent) && f === 'groupBy') {
                    return;
                }
                const feature = this.getFeature(f);
                const featureState: IGridState = feature.getFeatureState(this);
                gridState = Object.assign(gridState, featureState);
            }
        });
        return gridState;
    }

    /**
     * The method that calls corresponding methods to restore features from the passed IGridState object.
     */
    private restoreGridState(state: IGridState, features?: GridFeatures | GridFeatures[]) {
        // TODO Notify the grid that columnList.changes is triggered by the state directive
        // instead of piping it like below
        const columns = 'columns';
        this.grid.columnList.changes.pipe(delay(0), take(1)).subscribe(() => {
            this.featureKeys = this.featureKeys.filter(f => f !== columns);
            this.restoreFeatures(state);
        });
        this.applyFeatures(features);
        if (this.featureKeys.includes(columns) && this.options[columns] && state[columns]) {
            this.getFeature(columns).restoreFeatureState(this, state[columns]);
        } else {
            this.restoreFeatures(state);
        }
    }

    private restoreFeatures(state: IGridState) {
        this.featureKeys.forEach(f => {
            if (this.options[f]) {
                const featureState = state[f];
                if (featureState) {
                    const feature = this.getFeature(f);
                    feature.restoreFeatureState(this, featureState);
                }
            }
        });
    }

    /**
     * Returns a collection of all grid features.
     */
    private applyFeatures(keys?: GridFeatures | GridFeatures[]) {
        this.featureKeys = [];
        if (!keys) {
            for (const key of Object.keys(this.options)) {
                this.featureKeys.push(key as GridFeatures);
            }
        } else if (Array.isArray(keys)) {
            this.featureKeys = [...keys as GridFeatures[]];
        } else {
            this.featureKeys.push(keys);
        }
    }

    /**
     * This method builds a FilteringExpressionsTree from a provided object.
     */
    private createExpressionsTreeFromObject(exprTreeObject: FilteringExpressionsTree): FilteringExpressionsTree {
        if (!exprTreeObject || !exprTreeObject.filteringOperands) {
            return null;
        }

        const expressionsTree = new FilteringExpressionsTree(exprTreeObject.operator, exprTreeObject.fieldName);

        for (const item of exprTreeObject.filteringOperands) {
            // Check if item is an expressions tree or a single expression.
            if ((item as FilteringExpressionsTree).filteringOperands) {
                const subTree = this.createExpressionsTreeFromObject((item as FilteringExpressionsTree));
                expressionsTree.filteringOperands.push(subTree);
            } else {
                const expr = item as IFilteringExpression;
                let dataType: string;
                if (this.currGrid.columnList.length > 0) {
                    dataType = this.currGrid.columnList.find(c => c.field === expr.fieldName).dataType;
                } else {
                    dataType = this.state.columns.find(c => c.field === expr.fieldName).dataType;
                }
                // when ESF, values are stored in Set.
                // First those values are converted to an array before returning string in the stringifyCallback
                // now we need to convert those back to Set
                if (Array.isArray(expr.searchVal)) {
                    expr.searchVal = new Set(expr.searchVal);
                } else {
                    expr.searchVal = (dataType === 'date') ? new Date(Date.parse(expr.searchVal)) : expr.searchVal;
                }
                expr.condition = this.generateFilteringCondition(dataType, expr.condition.name);
                expressionsTree.filteringOperands.push(expr);
            }
        }

        return expressionsTree;
    }

    /**
     * Returns the filtering logic function for a given dataType and condition (contains, greaterThan, etc.)
     */
    private generateFilteringCondition(dataType: string, name: string): IFilteringOperation {
        let filters;
        switch (dataType) {
            case GridColumnDataType.Boolean:
                filters = IgxBooleanFilteringOperand.instance();
                break;
            case GridColumnDataType.Number:
                filters = IgxNumberFilteringOperand.instance();
                break;
            case GridColumnDataType.Date:
                filters = IgxDateFilteringOperand.instance();
                break;
            case GridColumnDataType.String:
            default:
                filters = IgxStringFilteringOperand.instance();
                break;
        }
        return filters.condition(name);
    }

    private stringifyCallback(key: string, val: any) {
        if (key === 'searchVal' && val instanceof Set) {
            return Array.from(val);
        }
        return val;
    }

    private getFeature(key: string): Feature {
        const feature: Feature = this.FEATURES[key];
        return feature;
    }
}

/**
 * @hidden
 */
@NgModule({
    declarations: [IgxGridStateDirective],
    exports: [IgxGridStateDirective]
})
export class IgxGridStateModule { }


text:
var request = require('superagent');
var Promise = require('bluebird');
var _ = require('lodash');

var METHOD_MAP = {
    'create': 'post',
    'update': 'put',
    'delete': 'del',
    'read': 'get',
    'patch': 'patch'
};

function sync(method, model, options) {
    return new Promise(function(resolve, reject) {
        var req;
        var url = (options.url || _.result(model,'url'));
        var data = (options.data || (method === 'update' || method === 'create') ? model.toJSON() : {});
        var ajaxConfig = (_.result(model, 'ajaxConfig') || {});

        function success(res) {
            options.res = {
                headers: res.headers
            };
            if (options.success) {
                options.success(res.body);
            }
            if (options.complete) {
                options.complete(res.body);
            }
            resolve(res.body);
        }

        function error(err) {
            if (options.error) {
                options.error(err);
            }
            if (options.complete) {
                options.complete(err);
            }
            reject(err);
        }

        function send() {

            req = request[METHOD_MAP[method]](url);

            // invoke exposed method on the request
            module.exports.editRequest(req, method, model, options);
            if (method === 'create' || method === 'update') {
                req.send(data);
            } else {
                req.query(data);
            }

            _.each(ajaxConfig.headers, function(val, key){
                req.set(key, val);
            });

            if (options.headers) {
                _.each(options.headers, function(val, key){
                    req.set(key, val);
                });
            }

            req.on('error', error);
            req.end(function(res){
                if (!res.ok) {
                    error(res);
                } else {
                    success(res);
                }
            });
        }
        send();
        model.trigger('request', model, req, options);
    });
}

module.exports = sync;
module.exports.editRequest = _.noop;


text:
'use strict';

var api = require('./Path.api');
var sinon = require('sinon');

var path = {};

api.forEach(function (method) {
    path[method] = sinon.stub();
});

module.exports = path;


text:
module Network.Eureka.Version.Cabal (
    fromVersions
  , fromVersion
  , fromString
  , showVersion
  , versionInRangeP
  ) where

import Data.Maybe (listToMaybe)
import qualified Data.Version as DV (Version, Version (Version),
  parseVersion, showVersion)
import Network.Eureka.Version.Types (Version, Predicate)
import Text.ParserCombinators.ReadP (readP_to_S)

versionInRangeP :: [Int] -> [Int] -> Predicate
versionInRangeP lower upper ver =
      ver >= fromVersions lower
  &&  ver <  fromVersions upper

fromVersions :: [Int] -> Version
fromVersions vs = fromVersion $ DV.Version vs []

fromVersion :: DV.Version -> Version
fromVersion = id

fromString :: String -> Maybe Version
fromString =
  fmap fst
  . listToMaybe
  . filter (null . snd)
  . readP_to_S DV.parseVersion

showVersion :: Version -> String
showVersion = DV.showVersion


text:
<?php //netteCache[01]000398a:2:{s:4:"time";s:21:"0.89709800 1384961045";s:9:"callbacks";a:2:{i:0;a:3:{i:0;a:2:{i:0;s:19:"Nette\Caching\Cache";i:1;s:9:"checkFile";}i:1;s:76:"P:\Documents\Entwicklung\www\eymedia\sandbox\app\templates\Post\create.latte";i:2;i:1384961023;}i:1;a:3:{i:0;a:2:{i:0;s:19:"Nette\Caching\Cache";i:1;s:10:"checkConst";}i:1;s:25:"Nette\Framework::REVISION";i:2;s:30:"695f643 released on 2013-11-05";}}}?><?php

// source file: P:\Documents\Entwicklung\www\eymedia\sandbox\app\templates\Post\create.latte

?><?php
// prolog Nette\Latte\Macros\CoreMacros
list($_l, $_g) = Nette\Latte\Macros\CoreMacros::initRuntime($template, 'kwm9eoy40j')
;
// prolog Nette\Latte\Macros\UIMacros
//
// block content
//
if (!function_exists($_l->blocks['content'][] = '_lb3d33cc49d4_content')) { function _lb3d33cc49d4_content($_l, $_args) { extract($_args)
?>
New post

<?php $_ctrl = $_control->getComponent("postForm"); if ($_ctrl instanceof Nette\Application\UI\IRenderable) $_ctrl->validateControl(); $_ctrl->render() ;
}}

//
// end of blocks
//

// template extending and snippets support

$_l->extends = empty($template->_extended) && isset($_control) && $_control instanceof Nette\Application\UI\Presenter ? $_control->findLayoutTemplateFile() : NULL; $template->_extended = $_extended = TRUE;

if ($_l->extends) {
	ob_start();

} elseif (!empty($_control->snippetMode)) {
	return Nette\Latte\Macros\UIMacros::renderSnippets($_control, $_l, get_defined_vars());
}

//
// main template
//
if ($_l->extends) { ob_end_clean(); return Nette\Latte\Macros\CoreMacros::includeTemplate($_l->extends, get_defined_vars(), $template)->render(); }
call_user_func(reset($_l->blocks['content']), $_l, get_defined_vars()) ;


text:
import { MenuController } from './menu-controller';
/**
 * @name MenuClose
 * @description
 * The `menuClose` directive can be placed on any button to close an open menu.
 *
 * @usage
 *
 * A simple `menuClose` button can be added using the following markup:
 *
 * ```html
 * <button ion-button menuClose>Close Menu</button>
 * ```
 *
 * To close a certain menu by its id or side, give the `menuClose`
 * directive a value.
 *
 * ```html
 * <button ion-button menuClose="left">Close Left Menu</button>
 * ```
 *
 * @demo /docs/demos/src/menu/
 * @see {@link /docs/components#menus Menu Component Docs}
 * @see {@link ../../menu/Menu Menu API Docs}
 */
export declare class MenuClose {
    private _menu;
    /**
     * @hidden
     */
    menuClose: string;
    constructor(_menu: MenuController);
    /**
    * @hidden
    */
    close(): void;
}


text:
package com.gofish.sentiment.newslinker;

import io.vertx.circuitbreaker.CircuitBreaker;
import io.vertx.circuitbreaker.CircuitBreakerOptions;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.streams.ReadStream;
import io.vertx.ext.web.client.HttpRequest;
import io.vertx.ext.web.client.HttpResponse;
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.client.WebClientOptions;
import io.vertx.ext.web.codec.BodyCodec;
import io.vertx.rx.java.RxHelper;
import io.vertx.rx.java.SingleOnSubscribeAdapter;
import rx.Observable;
import rx.Single;

import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @author Luke Herron
 */
public class NewsLinkerServiceImpl implements NewsLinkerService {

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

    private final Vertx vertx;
    private final WebClient webClient;
    private final HttpRequest<JsonObject> request;
    private final CircuitBreaker breaker;
    private final String apiKey;
    private final String baseUrl;
    private final String urlPath;
    private final Integer port;

    private final AtomicLong timeoutTimeStamp;
    private final AtomicLong timeoutDelay;

    public NewsLinkerServiceImpl(Vertx vertx, JsonObject config) {
        this.vertx = vertx;
        JsonObject apiConfig = config.getJsonObject("api");
        apiKey = apiConfig.getString("key", "");
        baseUrl = apiConfig.getString("base.url", "");
        urlPath = apiConfig.getString("url.path", "");
        port = apiConfig.getInteger("port", 443);

        webClient = WebClient.create(vertx, getWebClientOptions());
        request = getHttpRequest();
        breaker = CircuitBreaker.create("newslinker-circuit-breaker", vertx,
                new CircuitBreakerOptions().setMaxRetries(5).setMaxFailures(5).setTimeout(30000).setResetTimeout(30000));

        timeoutTimeStamp = new AtomicLong(0);
        timeoutDelay = new AtomicLong(0);
    }

    @Override
    public void linkEntities(JsonObject article, Handler<AsyncResult<JsonObject>> resultHandler) {
        LOG.info("Starting entity linking");

        final String articleName = article.getString("name");
        final String articleDescription = article.getString("description");

        if (articleName == null && articleDescription == null) {
            resultHandler.handle(Future.failedFuture("Invalid Request"));
        }
        else if (articleName == null) {
            resultHandler.handle(Future.failedFuture("Invalid article headline supplied"));
        }
        else if (articleDescription == null) {
            resultHandler.handle(Future.failedFuture("Invalid article lead paragraph supplied"));
        }

        final String text = String.join(". ", articleName, articleDescription);
        final Buffer buffer = Buffer.buffer(text);
        final ReadStream<Buffer> readStream = RxHelper.toReadStream(Observable.just(buffer));

        rxLinkEntities(readStream)
                .map(HttpResponse::body)
                .flatMap(body -> rxAddNewEntities(article, body))
                .subscribe(RxHelper.toSubscriber(resultHandler));
    }

    /**
     * Takes request data and sends it to the Microsoft Cognitive Services API. This API processes the text submitted in
     * the request and returns a response containing entity linked keywords
     * @param readStream ReadStream buffer representing the request data to send
     * @return Single which emits the result of the HttpResponse
     */
    private Single<HttpResponse<JsonObject>> rxLinkEntities(ReadStream<Buffer> readStream) {

        return Single.create(new SingleOnSubscribeAdapter<HttpResponse<JsonObject>>(fut ->
                breaker.<HttpResponse<JsonObject>>execute(future -> {
                    request.sendStream(readStream, response -> {
                        if (response.failed()) {
                            LOG.error(response.cause().getMessage(), response.cause());
                            future.fail(response.cause());
                        }

                        HttpResponse<JsonObject> result = response.result();
                        if (result.statusCode() != 200 && result.statusCode() != 429) {
                            future.fail(result.body() == null ? result.statusMessage() : result.body().encode());
                        } else {
                            future.complete(result);
                        }
                    });
                }).setHandler(fut)));
    }

    /**
     * Updates a supplied news article with the supplied entity linking response
     * @param article JsonObject which represents the news article to be updated with the linking results
     * @param linkerResponse JsonObject which holds the entity linking results
     * @return Single which emits the news article which has been updated with the linking results
     */
    private Single<JsonObject> rxAddNewEntities(JsonObject article, JsonObject linkerResponse) {
        JsonArray responseEntities = Optional.ofNullable(linkerResponse.getJsonArray("entities"))
                .orElseThrow(() -> new RuntimeException(linkerResponse.containsKey("error") ?
                        linkerResponse.encode() : new JsonObject().put("error", linkerResponse).encode()));

        JsonArray articleEntities = article.getJsonArray("about", new JsonArray());

        // Add any entities to articleEntities if they can only be found in responseEntities
        responseEntities.stream()
                .map(entity -> (JsonObject) entity)
                .filter(entity -> articleEntities.stream()
                        .map(articleEntity -> ((JsonObject) articleEntity).getString("name"))
                        .noneMatch(name -> entity.getString("name").equalsIgnoreCase(name)))
                .map(entity -> new JsonObject()
                        .put("name", entity.getString("name"))
                        .put("readLink", ""))
                .forEach(articleEntities::add);

        return Single.just(article);
    }

    /**
     * Retrieves the HttpRequest, configured for access to the Microsoft Cognitive Services API
     * @return HTTP client request object
     */
    private HttpRequest<JsonObject> getHttpRequest() {
        return webClient.post(port, baseUrl, urlPath)
                .putHeader("Content-Type", "text/plain; charset=UTF-8")
                .putHeader("Ocp-Apim-Subscription-Key", apiKey)
                .as(BodyCodec.jsonObject());
    }

    /**
     * Creates and returns an HttpClientOptions object. Values for each option are retrieved from the config json object
     * (this config json object is passed in to the verticle when it is deployed)
     * @return HttpClientOptions object to configure this verticles HttpClient
     */
    private WebClientOptions getWebClientOptions() {
        return new WebClientOptions()
                .setPipelining(true)
                .setPipeliningLimit(10)
                .setIdleTimeout(0)
                .setSsl(!baseUrl.equalsIgnoreCase("localhost"))
                .setKeepAlive(true);
    }

    @Override
    public void getTimeout(Handler<AsyncResult<Long>> timeoutHandler) {
        final long delay = timeoutDelay.get() - (System.currentTimeMillis() - timeoutTimeStamp.get());
        timeoutHandler.handle(Future.succeededFuture(delay));
    }

    @Override
    public void setTimeout(Long delay) {
        timeoutTimeStamp.set(System.currentTimeMillis());
        timeoutDelay.set(delay);
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.core.util;

import java.util.Map;

/**
 * Configuration property source which provides configuration values from a specific place. Samples may include
 * properties file supported by frameworks or other source.
 *
 * Note that environment configuration (environment variables and system properties) are supported by default and
 * don't need a source implementation.
 */
@FunctionalInterface
public interface ConfigurationSource {
    /**
     * Returns all properties (name and value) which names start with given path.
     * Null (or empty) path indicate that all properties should be returned.
     *
     * Example:
     *

     * With following configuration properties:
     *

     *
azure.sdk.foo = 1

     *
azure.sdk.bar.baz = 2

     *

     *
     *

     * {@link ConfigurationSource} implementation must the following behavior:
     *

     *
{@code getProperties(null} must return both properties

     *
{@code getProperties("azure.sdk")} must return both properties

     *
{@code getProperties("azure.sdk.foo")} must return {"azure.sdk.foo", "1"}

     *
{@code getProperties("azure.sdk.ba")} must return empty map

     *

     *
     * @param source property name prefix
     * @return Map of properties under given path.
     */
    Map<String, String> getProperties(String source);
}


text:
package pt.davidafsilva.ghn;

import java.util.concurrent.atomic.AtomicReference;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Screen;
import javafx.stage.Stage;
import pt.davidafsilva.ghn.model.User;
import pt.davidafsilva.ghn.ui.login.LoginController;
import pt.davidafsilva.ghn.ui.login.LoginView;
import pt.davidafsilva.ghn.ui.main.NotificationsController;
import pt.davidafsilva.ghn.ui.main.NotificationsView;
import pt.davidafsilva.ghn.util.Schedulers;

/**
 * @author david
 */
public class ApplicationController {

  private static final AtomicReference<ApplicationController> CONTROLLER = new AtomicReference<>();

  private final ApplicationContext ctx;

  private ApplicationController(final Application application, final Stage primaryStage) {
    this.ctx = new ApplicationContext(application, primaryStage);
  }

  public ApplicationContext getApplicationContext() {
    return ctx;
  }

  static void start(final Application application, final Stage primaryStage) {
    primaryStage.setTitle("GitHub Notification Center");
    primaryStage.getIcons().add(new Image(ApplicationController.class
        .getResourceAsStream("/ghnc-64.png")));

    final ApplicationController appController = new ApplicationController(application,
        primaryStage);
    CONTROLLER.set(appController);
    //appController.showLoginView(primaryStage);

    appController.ctx.setUser(
        new User("davidafsilva", "xxx", "https://avatars1.githubusercontent.com/u/2266642?v=3"));
    appController.showMainView();
  }

  static void stop() {
    CONTROLLER.get().exit();
  }

  private void showLoginView(final Stage stage) {
    // create the login view
    final LoginController loginController = new LoginController(this);
    final LoginView loginView = loginController.initView();

    final Scene scene = new Scene(loginView, 300, 350);
    scene.getStylesheets().add(ApplicationController.class.getResource("/app.css")
        .toExternalForm());
    stage.setScene(scene);
    stage.setOnShown(event -> ctx.getConfiguration().getSecuredConfiguration()
        .getToken().ifPresent(loginController::autoLogin));
    stage.show();
  }

  public void showMainView() {
    final Stage stage = ctx.getPrimaryStage();

    // close login view
    stage.close();

    // create notifications view
    final NotificationsController controller = new NotificationsController(this);
    final NotificationsView view = controller.initView();

    // open main view
    final Rectangle2D screenResolution = Screen.getPrimary().getVisualBounds();
    final double width = Math.max(screenResolution.getWidth() * .65, 600);
    final double height = Math.max(screenResolution.getHeight() * .70, 400);
    final Scene scene = new Scene(view, width, height);
    scene.getStylesheets().add(ApplicationController.class.getResource("/app.css")
        .toExternalForm());
    stage.setMinWidth(650);
    stage.setWidth(width);
    stage.setMinHeight(400);
    stage.setHeight(height);
    stage.setScene(scene);
    stage.setOnShown(e -> {
      // load categories
      controller.loadCategories();
      //  load notifications
      controller.loadNotifications();
    });
    stage.show();
  }

  public void exit() {
    Schedulers.dispose();
    Platform.exit();
  }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Deferred</title>


text:
/* eslint-disable func-names, prefer-arrow-callback, space-before-function-paren */

$(function() {
  $('.reveal-variables').off('click').on('click', function() {
    $('.js-build').toggle().niceScroll();
    $(this).hide();
  });
});


text:
#pragma once
#include <aws/health/Health_EXPORTS.h>
#include <aws/health/HealthRequest.h>
#include <aws/health/model/EventFilter.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Health
{
namespace Model
{

  /**
   */
  class AWS_HEALTH_API DescribeEventsRequest : public HealthRequest
  {
  public:
    DescribeEventsRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DescribeEvents"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
Values to narrow the results returned.

     */
    inline const EventFilter& GetFilter() const{ return m_filter; }

    /**
     *
Values to narrow the results returned.

     */
    inline bool FilterHasBeenSet() const { return m_filterHasBeenSet; }

    /**
     *
Values to narrow the results returned.

     */
    inline void SetFilter(const EventFilter& value) { m_filterHasBeenSet = true; m_filter = value; }

    /**
     *
Values to narrow the results returned.

     */
    inline void SetFilter(EventFilter&& value) { m_filterHasBeenSet = true; m_filter = std::move(value); }

    /**
     *
Values to narrow the results returned.

     */
    inline DescribeEventsRequest& WithFilter(const EventFilter& value) { SetFilter(value); return *this;}

    /**
     *
Values to narrow the results returned.

     */
    inline DescribeEventsRequest& WithFilter(EventFilter&& value) { SetFilter(std::move(value)); return *this;}

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; }

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline DescribeEventsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline DescribeEventsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
If the results of a search are large, only a portion of the results are
     * returned, and a nextToken pagination token is returned in the
     * response. To retrieve the next batch of results, reissue the search request and
     * include the returned token. When all results have been returned, the response
     * does not contain a pagination token value.

     */
    inline DescribeEventsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}

    /**
     *
The maximum number of items to return in one batch, between 10 and 100,
     * inclusive.

     */
    inline int GetMaxResults() const{ return m_maxResults; }

    /**
     *
The maximum number of items to return in one batch, between 10 and 100,
     * inclusive.

     */
    inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; }

    /**
     *
The maximum number of items to return in one batch, between 10 and 100,
     * inclusive.

     */
    inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }

    /**
     *
The maximum number of items to return in one batch, between 10 and 100,
     * inclusive.

     */
    inline DescribeEventsRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline const Aws::String& GetLocale() const{ return m_locale; }

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline bool LocaleHasBeenSet() const { return m_localeHasBeenSet; }

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline void SetLocale(const Aws::String& value) { m_localeHasBeenSet = true; m_locale = value; }

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline void SetLocale(Aws::String&& value) { m_localeHasBeenSet = true; m_locale = std::move(value); }

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline void SetLocale(const char* value) { m_localeHasBeenSet = true; m_locale.assign(value); }

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline DescribeEventsRequest& WithLocale(const Aws::String& value) { SetLocale(value); return *this;}

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline DescribeEventsRequest& WithLocale(Aws::String&& value) { SetLocale(std::move(value)); return *this;}

    /**
     *
The locale (language) to return information in. English (en) is the default
     * and the only supported value at this time.

     */
    inline DescribeEventsRequest& WithLocale(const char* value) { SetLocale(value); return *this;}

  private:

    EventFilter m_filter;
    bool m_filterHasBeenSet;

    Aws::String m_nextToken;
    bool m_nextTokenHasBeenSet;

    int m_maxResults;
    bool m_maxResultsHasBeenSet;

    Aws::String m_locale;
    bool m_localeHasBeenSet;
  };

} // namespace Model
} // namespace Health
} // namespace Aws


text:
package testsuite.simple;

import testsuite.BaseTestCase;

import java.sql.SQLException;

/**
 *
 * @author Mark Matthews
 * @version $Id: NumbersTest.java 3726 2005-05-19 15:52:24Z mmatthews $
 */
public class NumbersTest extends BaseTestCase {
	// ~ Static fields/initializers
	// ---------------------------------------------

	private static final long TEST_BIGINT_VALUE = 6147483647L;

	// ~ Constructors
	// -----------------------------------------------------------

	/**
	 * Creates a new NumbersTest object.
	 *
	 * @param name
	 *            DOCUMENT ME!
	 */
	public NumbersTest(String name) {
		super(name);
	}

	// ~ Methods
	// ----------------------------------------------------------------

	/**
	 * Runs all test cases in this test suite
	 *
	 * @param args
	 */
	public static void main(String[] args) {
		junit.textui.TestRunner.run(NumbersTest.class);
	}

	/**
	 * DOCUMENT ME!
	 *
	 * @throws Exception
	 *             DOCUMENT ME!
	 */
	public void setUp() throws Exception {
		super.setUp();
		createTestTable();
	}

	/**
	 * DOCUMENT ME!
	 *
	 * @throws SQLException
	 *             DOCUMENT ME!
	 */
	public void testNumbers() throws SQLException {
		this.rs = this.stmt.executeQuery("SELECT * from number_test");

		while (this.rs.next()) {
			long minBigInt = this.rs.getLong(1);
			long maxBigInt = this.rs.getLong(2);
			long testBigInt = this.rs.getLong(3);
			assertTrue("Minimum bigint not stored correctly",
					(minBigInt == Long.MIN_VALUE));
			assertTrue("Maximum bigint not stored correctly",
					(maxBigInt == Long.MAX_VALUE));
			assertTrue("Test bigint not stored correctly",
					(TEST_BIGINT_VALUE == testBigInt));
		}
	}

	private void createTestTable() throws SQLException {
		try {
			this.stmt.executeUpdate("DROP TABLE number_test");
		} catch (SQLException sqlEx) {
			;
		}

		this.stmt
				.executeUpdate("CREATE TABLE number_test (minBigInt bigint, maxBigInt bigint, testBigInt bigint)");
		this.stmt
				.executeUpdate("INSERT INTO number_test (minBigInt,maxBigInt,testBigInt) values ("
						+ Long.MIN_VALUE
						+ ","
						+ Long.MAX_VALUE
						+ ","
						+ TEST_BIGINT_VALUE + ")");
	}
}


text:
require 'spec_helper'
require 'email_spec'

describe Spree::OrderMailer do
  include EmailSpec::Helpers
  include EmailSpec::Matchers

  let(:order) do
    order = stub_model(Spree::Order)
    product = stub_model(Spree::Product, :name => %Q{The "BEST" product})
    variant = stub_model(Spree::Variant, :product => product)
    price = stub_model(Spree::Price, :variant => variant, :amount => 5.00)
    line_item = stub_model(Spree::LineItem, :variant => variant, :order => order, :quantity => 1, :price => 4.99)
    variant.stub(:default_price => price)
    order.stub(:line_items => [line_item])
    order
  end

  context ":from not set explicitly" do
    it "falls back to spree config" do
      message = Spree::OrderMailer.confirm_email(order)
      message.from.should == [Spree::Config.emails_sent_from]
    end
  end

  it "doesn't aggressively escape double quotes in confirmation body" do
    confirmation_email = Spree::OrderMailer.confirm_email(order)
    confirmation_email.body.should_not include(""")
  end

  it "confirm_email accepts an order id as an alternative to an Order object" do
    Spree::Order.should_receive(:find).with(order.id).and_return(order)
    lambda {
      confirmation_email = Spree::OrderMailer.confirm_email(order.id)
    }.should_not raise_error
  end

  it "cancel_email accepts an order id as an alternative to an Order object" do
    Spree::Order.should_receive(:find).with(order.id).and_return(order)
    lambda {
      cancel_email = Spree::OrderMailer.cancel_email(order.id)
    }.should_not raise_error
  end

  context "only shows eligible adjustments in emails" do
    before do
      order.adjustments.create({:label    => "Eligible Adjustment",
                                :amount   => 10,
                                :eligible => true}, :without_protection => true)

      order.adjustments.create!({:label    => "Ineligible Adjustment",
                                 :amount   => -10,
                                 :eligible => false}, :without_protection => true)
    end

    let!(:confirmation_email) { Spree::OrderMailer.confirm_email(order) }
    let!(:cancel_email) { Spree::OrderMailer.cancel_email(order) }

    specify do
      confirmation_email.body.should_not include("Ineligible Adjustment")
    end

    specify do
      cancel_email.body.should_not include("Ineligible Adjustment")
    end
  end

  context "displays unit costs from line item" do
    # Regression test for #2772

    # Tests mailer view spree/order_mailer/confirm_email.text.erb
    specify do
      confirmation_email = Spree::OrderMailer.confirm_email(order)
      confirmation_email.body.should include("4.99")
      confirmation_email.body.should_not include("5.00")
    end

    # Tests mailer view spree/order_mailer/cancel_email.text.erb
    specify do
      cancel_email = Spree::OrderMailer.cancel_email(order)
      cancel_email.body.should include("4.99")
      cancel_email.body.should_not include("5.00")
    end
  end

  context "emails must be translatable" do
    context "en locale" do
      before do
        en_confirm_mail = { :order_mailer => { :confirm_email => { :dear_customer => 'Dear Customer,' } } }
        en_cancel_mail = { :order_mailer => { :cancel_email => { :order_summary_canceled => 'Order Summary [CANCELED]' } } }
        I18n.backend.store_translations :en, en_confirm_mail
        I18n.backend.store_translations :en, en_cancel_mail
        I18n.locale = :en
      end

      context "confirm_email" do
        specify do
          confirmation_email = Spree::OrderMailer.confirm_email(order)
          confirmation_email.body.should include("Dear Customer,")
        end
      end

      context "cancel_email" do
        specify do
          cancel_email = Spree::OrderMailer.cancel_email(order)
          cancel_email.body.should include("Order Summary [CANCELED]")
        end
      end
    end

    context "pt-BR locale" do
      before do
        pt_br_confirm_mail = { :order_mailer => { :confirm_email => { :dear_customer => 'Caro Cliente,' } } }
        pt_br_cancel_mail = { :order_mailer => { :cancel_email => { :order_summary_canceled => 'Resumo da Pedido [CANCELADA]' } } }
        I18n.backend.store_translations :'pt-BR', pt_br_confirm_mail
        I18n.backend.store_translations :'pt-BR', pt_br_cancel_mail
        I18n.locale = :'pt-BR'
      end

      after do
        I18n.locale = I18n.default_locale
      end

      context "confirm_email" do
        specify do
          confirmation_email = Spree::OrderMailer.confirm_email(order)
          confirmation_email.body.should include("Caro Cliente,")
        end
      end

      context "cancel_email" do
        specify do
          cancel_email = Spree::OrderMailer.cancel_email(order)
          cancel_email.body.should include("Resumo da Pedido [CANCELADA]")
        end
      end
    end

    context "using EUR as the currency" do
      before do
        Spree::Config[:currency] = "EUR"
      end

      # Regression test for #2690
      it "doesn't aggressively escape money amounts" do
        confirm_email = Spree::OrderMailer.confirm_email(order)
        confirm_email.body.should_not include("€") # escaped € symbol
      end

    end
  end
end


text:
using System.Composition;
using System.Threading.Tasks;
using OmniSharp.Cake.Extensions;
using OmniSharp.Mef;
using OmniSharp.Models.V2.CodeActions;

namespace OmniSharp.Cake.Services.RequestHandlers.Refactoring.V2
{
    [OmniSharpHandler(OmniSharpEndpoints.V2.RunCodeAction, Constants.LanguageNames.Cake), Shared]
    public class RunCodeActionsHandler : BaseCodeActionsHandler<RunCodeActionRequest, RunCodeActionResponse>
    {
        [ImportingConstructor]
        public RunCodeActionsHandler(
            OmniSharpWorkspace workspace)
            : base(workspace)
        {
        }

        protected override bool IsValid(RunCodeActionRequest request) => request.WantsTextChanges;

        protected override Task<RunCodeActionResponse> TranslateResponse(RunCodeActionResponse response, RunCodeActionRequest request)
        {
            return response.TranslateAsync(Workspace);
        }
    }
}