text:
package unsigned.fluxify.stores;

/**
 * Created by Luca Bruzzone on 20/02/2016.
 */
public class StoreObject {
    String id;
    boolean complete;
    Object carry;

    public StoreObject(String id, boolean complete, Object carry) {
        this.id = id;
        this.complete = complete;
        this.carry = carry;
    }

    public String getId() {
        return id;
    }

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

    public boolean isComplete() {
        return complete;
    }

    public void setComplete(boolean complete) {
        this.complete = complete;
    }

    public Object getCarry() {
        return carry;
    }

    public void setCarry(Object carry) {
        this.carry = carry;
    }
}


text:
namespace initialfantasy {
    export namespace ui {
        export namespace c {
            /** 列表视图-业务对象属性设置 */
            export class BOPropertySettingConfigView extends ibas.BOQueryViewWithPanel implements app.IBOPropertySettingConfigView {
                /** 返回查询的对象 */
                get queryTarget(): any {
                    return bo.BOInformation;
                }
                /** 编辑业务对象信息 */
                editBusinessObjectEvent: Function;
                /** 选择业务对象信息,参数:编辑对象 */
                selectedBusinessObjectEvent: Function;
                /** 保存设置 */
                saveSettingsEvent: Function;
                /** 删除设置 */
                deleteSettingsEvent: Function;
                /** 复制设置 */
                copySettingsEvent: Function;
                /** 绘制视图 */
                draw(): any {
                    let that: this = this;
                    this.list = new sap.extension.m.List("", {
                        chooseType: ibas.emChooseType.SINGLE,
                        growingThreshold: sap.extension.table.visibleRowCount(15),
                        mode: sap.m.ListMode.SingleSelectMaster,
                        items: {
                            path: "/rows",
                            template: new sap.m.ObjectListItem("", {
                                title: "{description}",
                                firstStatus: new sap.m.ObjectStatus("", {
                                    text: "{objectType}"
                                }),
                                attributes: [
                                    new sap.extension.m.ObjectAttribute("", {
                                        bindingValue: {
                                            path: "name",
                                            type: new sap.extension.data.Alphanumeric(),
                                        },
                                    }),
                                    new sap.extension.m.ObjectAttribute("", {
                                        bindingValue: {
                                            path: "code",
                                            type: new sap.extension.data.Alphanumeric(),
                                        },
                                    }),
                                ]
                            })
                        },
                        selectionChange(): void {
                            that.fireViewEvents(that.selectedBusinessObjectEvent, that.list.getSelecteds().firstOrDefault());
                        },
                        nextDataSet(event: sap.ui.base.Event): void {
                            // 查询下一个数据集
                            let data: any = event.getParameter("data");
                            if (ibas.objects.isNull(data)) {
                                return;
                            }
                            if (ibas.objects.isNull(that.lastCriteria)) {
                                return;
                            }
                            let criteria: ibas.ICriteria = that.lastCriteria.next(data);
                            if (ibas.objects.isNull(criteria)) {
                                return;
                            }
                            ibas.logger.log(ibas.emMessageLevel.DEBUG, "result: {0}", criteria.toString());
                            that.fireViewEvents(that.fetchDataEvent, criteria);
                        }
                    });
                    this.table = new sap.extension.table.Table("", {
                        enableSelectAll: false,
                        visibleRowCount: sap.extension.table.visibleRowCount(14),
                        visibleRowCountMode: sap.ui.table.VisibleRowCountMode.Interactive,
                        rows: "{/rows}",
                        rowSettingsTemplate: new sap.ui.table.RowSettings("", {
                        }).bindProperty("highlight", {
                            path: "isDirty",
                            formatter(value: boolean): string {
                                if (!!value) {
                                    return sap.ui.core.MessageType.Warning;
                                } else {
                                    return sap.ui.core.MessageType.Information;
                                }
                            }
                        }),
                        columns: [
                            new sap.extension.table.Column("", {
                                label: ibas.i18n.prop("bo_bopropertyinformation_property"),
                                template: new sap.extension.m.Text("", {
                                }).bindProperty("bindingValue", {
                                    path: "propertyCode",
                                    type: new sap.extension.data.Alphanumeric()
                                }),
                                sortProperty: "propertyCode",
                                filterProperty: "propertyCode"
                            }),
                            new sap.extension.table.Column("", {
                                label: ibas.i18n.prop("bo_bopropertyinformation_description"),
                                template: new sap.extension.m.Text("", {
                                }).bindProperty("bindingValue", {
                                    path: "propertyName",
                                    type: new sap.extension.data.Alphanumeric()
                                }),
                                sortProperty: "propertyName",
                                filterProperty: "propertyName"
                            }),
                            new sap.extension.table.Column("", {
                                label: ibas.i18n.prop("bo_bopropertyinformation_mapped"),
                                template: new sap.extension.m.Text("", {
                                }).bindProperty("bindingValue", {
                                    path: "propertyAlias",
                                    type: new sap.extension.data.Alphanumeric()
                                }),
                                sortProperty: "propertyAlias"
                            }),
                            new sap.extension.table.Column("", {
                                label: ibas.i18n.prop("bo_bopropertysetting_position"),
                                template: new sap.extension.m.Input("", {
                                    type: sap.m.InputType.Number
                                }).bindProperty("bindingValue", {
                                    path: "position",
                                    type: new sap.extension.data.Numeric()
                                }),
                                sortProperty: "position"
                            }),
                            new sap.extension.table.Column("", {
                                label: ibas.i18n.prop("bo_bopropertysetting_searched"),
                                template: new sap.extension.m.EnumSelect("", {
                                    enumType: bo.emSearchedValue,
                                }).bindProperty("bindingValue", {
                                    path: "searched",
                                    type: new sap.extension.data.Enum({
                                        enumType: bo.emSearchedValue,
                                    }),
                                })
                            }),
                            new sap.extension.table.Column("", {
                                label: ibas.i18n.prop("bo_bopropertysetting_authorised"),
                                template: new sap.extension.m.EnumSelect("", {
                                    enumType: bo.emAuthorisedValue,
                                }).bindProperty("bindingValue", {
                                    path: "authorised",
                                    type: new sap.extension.data.Enum({
                                        enumType: bo.emAuthorisedValue,
                                    }),
                                })
                            }),
                            new sap.extension.table.Column("", {
                                label: ibas.i18n.prop("bo_bopropertysetting_required"),
                                template: new sap.extension.m.EnumSelect("", {
                                    enumType: bo.emRequiredValue,
                                }).bindProperty("bindingValue", {
                                    path: "required",
                                    type: new sap.extension.data.Enum({
                                        enumType: bo.emRequiredValue,
                                    }),
                                })
                            }),
                        ]
                    });
                    return new sap.m.SplitContainer("", {
                        masterPages: [
                            this.pageList = new sap.extension.m.Page("", {
                                showHeader: false,
                                floatingFooter: true,
                                footer: new sap.m.Toolbar("", {
                                    content: [
                                        new sap.m.ToolbarSpacer(""),
                                        new sap.m.Button("", {
                                            text: ibas.i18n.prop("shell_data_edit"),
                                            type: sap.m.ButtonType.Transparent,
                                            icon: "sap-icon://edit",
                                            press: function (): void {
                                                that.fireViewEvents(that.editBusinessObjectEvent, that.list.getSelecteds().firstOrDefault());
                                            }
                                        }),
                                    ]
                                }),
                                showFooter: ibas.variablesManager.getValue(ibas.VARIABLE_NAME_USER_SUPER),
                                content: [
                                    this.list
                                ]
                            })
                        ],
                        detailPages: [
                            new sap.extension.m.Page("", {
                                showHeader: true,
                                customHeader: new sap.m.Toolbar("", {
                                    content: [
                                        new sap.m.Label("", {
                                            text: ibas.i18n.prop("bo_bopropertysetting_identitycode"),
                                        }),
                                        this.inputIdentity = new sap.extension.m.SelectionInput("", {
                                            width: "auto",
                                            placeholder: ibas.i18n.prop("initialfantasy_all_identities"),
                                            showValueHelp: true,
                                            repository: bo.BORepositoryInitialFantasy,
                                            dataInfo: {
                                                type: bo.Identity,
                                                key: bo.Identity.PROPERTY_CODE_NAME,
                                                text: bo.Identity.PROPERTY_NAME_NAME
                                            },
                                            criteria: [
                                                new ibas.Condition(bo.Identity.PROPERTY_CODE_NAME, ibas.emConditionOperation.NOT_EQUAL, null),
                                            ],
                                            change(event: sap.ui.base.Event): void {
                                                let source: any = event.getSource();
                                                if (source instanceof sap.m.Input) {
                                                    let data: any = that.list.getSelecteds().firstOrDefault();
                                                    if (!ibas.objects.isNull(data)) {
                                                        that.fireViewEvents(that.selectedBusinessObjectEvent, data);
                                                    }
                                                }
                                            }
                                        }),
                                        new sap.m.ToolbarSpacer(""),
                                        new sap.m.Button("", {
                                            text: ibas.i18n.prop("initialfantasy_copy_from"),
                                            type: sap.m.ButtonType.Transparent,
                                            icon: "sap-icon://copy",
                                            press: function (): void {
                                                that.fireViewEvents(that.copySettingsEvent);
                                            },
                                        }),
                                        new sap.m.ToolbarSeparator(""),
                                        new sap.m.MenuButton("", {
                                            text: ibas.i18n.prop("shell_data_save"),
                                            type: sap.m.ButtonType.Transparent,
                                            icon: "sap-icon://save",
                                            buttonMode: sap.m.MenuButtonMode.Split,
                                            useDefaultActionOnly: true,
                                            defaultAction(): void {
                                                that.fireViewEvents(that.saveSettingsEvent);
                                            },
                                            menu: new sap.m.Menu("", {
                                                items: [
                                                    new sap.m.MenuItem("", {
                                                        text: ibas.i18n.prop("shell_data_delete"),
                                                        icon: "sap-icon://delete",
                                                        press: function (): void {
                                                            that.fireViewEvents(that.deleteSettingsEvent);
                                                        }
                                                    }),
                                                ],
                                            })
                                        }),
                                    ]
                                }),
                                content: [
                                    this.table
                                ],
                                floatingFooter: true,
                                footer: new sap.m.Toolbar("", {
                                    content: [
                                        new sap.m.MenuButton("", {
                                            text: ibas.i18n.prop("shell_data_choose"),
                                            icon: "sap-icon://menu",
                                            type: sap.m.ButtonType.Transparent,
                                            menu: new sap.m.Menu("", {
                                                items: [
                                                    new sap.m.MenuItem("", {
                                                        text: ibas.i18n.prop("shell_all"),
                                                        icon: "sap-icon://multiselect-all",
                                                        press: function (): void {
                                                            let model: any = that.table.getModel();
                                                            if (model instanceof sap.extension.model.JSONModel) {
                                                                for (let index: number = 0; index < model.size(); index++) {
                                                                    if (!that.table.isIndexSelected(index)) {
                                                                        that.table.addSelectionInterval(index, index);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }),
                                                    new sap.m.MenuItem("", {
                                                        text: ibas.i18n.prop("shell_reverse"),
                                                        icon: "sap-icon://multiselect-none",
                                                        press: function (): void {
                                                            let model: any = that.table.getModel();
                                                            if (model instanceof sap.extension.model.JSONModel) {
                                                                let selects: ibas.IList<number> = ibas.arrays.create(that.table.getSelectedIndices());
                                                                that.table.clearSelection();
                                                                for (let index: number = 0; index < model.size(); index++) {
                                                                    if (!selects.contain(index)) {
                                                                        that.table.addSelectionInterval(index, index);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }),
                                                ],
                                            })
                                        }),
                                        new sap.m.ToolbarSpacer(""),
                                        new sap.m.Button("", {
                                            text: ibas.i18n.prop("initialfantasy_reset_position"),
                                            type: sap.m.ButtonType.Transparent,
                                            icon: "sap-icon://reset",
                                            press: function (): void {
                                                for (let item of that.table.getSelecteds<app.PropertySetting>()) {
                                                    item.position = undefined;
                                                }
                                            }
                                        }),
                                        new sap.m.MenuButton("", {
                                            text: ibas.i18n.prop("bo_bopropertysetting_authorised"),
                                            icon: "sap-icon://bullet-text",
                                            type: sap.m.ButtonType.Transparent,
                                            menu: new sap.m.Menu("", {
                                                items: [
                                                    new sap.m.MenuItem("", {
                                                        text: ibas.enums.describe(bo.emAuthorisedValue, bo.emAuthorisedValue.ALL),
                                                        icon: "sap-icon://multiselect-all",
                                                        press: function (): void {
                                                            for (let item of that.table.getSelecteds<app.PropertySetting>()) {
                                                                item.authorised = bo.emAuthorisedValue.ALL;
                                                            }
                                                        }
                                                    }),
                                                    new sap.m.MenuItem("", {
                                                        text: ibas.enums.describe(bo.emAuthorisedValue, bo.emAuthorisedValue.READ),
                                                        icon: "sap-icon://multi-select",
                                                        press: function (): void {
                                                            for (let item of that.table.getSelecteds<app.PropertySetting>()) {
                                                                item.authorised = bo.emAuthorisedValue.READ;
                                                            }
                                                        }
                                                    }),
                                                    new sap.m.MenuItem("", {
                                                        text: ibas.enums.describe(bo.emAuthorisedValue, bo.emAuthorisedValue.NONE),
                                                        icon: "sap-icon://multiselect-none",
                                                        press: function (): void {
                                                            for (let item of that.table.getSelecteds<app.PropertySetting>()) {
                                                                item.authorised = bo.emAuthorisedValue.NONE;
                                                            }
                                                        }
                                                    }),
                                                    new sap.m.MenuItem("", {
                                                        text: ibas.i18n.prop("initialfantasy_default"),
                                                        icon: "sap-icon://horizontal-bar-chart",
                                                        press: function (): void {
                                                            for (let item of that.table.getSelecteds<app.PropertySetting>()) {
                                                                item.authorised = bo.emAuthorisedValue.DEFAULT;
                                                            }
                                                        }
                                                    }),
                                                ],
                                            })
                                        }),
                                    ]
                                })
                            })
                        ],
                    });
                }
                private pageList: sap.extension.m.Page;
                private list: sap.extension.m.List;
                private table: sap.extension.table.Table;
                private inputIdentity: sap.extension.m.Input;
                /** 嵌入查询面板 */
                embedded(view: any): void {
                    if (view instanceof sap.m.Toolbar) {
                        view.setDesign(sap.m.ToolbarDesign.Transparent);
                        view.setStyle(sap.m.ToolbarStyle.Clear);
                        view.setHeight("100%");
                    }
                    this.pageList.addHeaderContent(view);
                    this.pageList.setShowHeader(true);
                }
                /** 记录上次查询条件,表格滚动时自动触发 */
                query(criteria: ibas.ICriteria): void {
                    super.query(criteria);
                    // 清除历史数据
                    if (this.isDisplayed) {
                        this.list.setBusy(true);
                        this.list.setModel(null);
                    }
                }
                /** 身份 */
                get identity(): string {
                    return this.inputIdentity.getSelectedKey();
                }
                set identity(value: string) {
                    this.inputIdentity.setSelectedKey(value);
                }
                /** 显示业务对象信息 */
                showBusinessObjects(datas: bo.BOInformation[]): void {
                    let model: sap.ui.model.Model = this.list.getModel();
                    if (model instanceof sap.extension.model.JSONModel) {
                        // 已绑定过数据
                        model.addData(datas);
                    } else {
                        // 未绑定过数据
                        this.list.setModel(new sap.extension.model.JSONModel({ rows: datas }));
                    }
                    this.list.setBusy(false);
                }
                showPropertySettings(datas: app.PropertySetting[]): void {
                    this.table.setModel(new sap.extension.model.JSONModel({ rows: datas }));
                }
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package Translate;
import Parse.Parse;
import Semant.Semant;

public class Main {
  static Frame.Frame frame = new Mips.MipsFrame();

  public static void main(String argv[])  {
    for (int i = 0; i < argv.length; ++i) {
      String filename = argv[i];
      if (argv.length > 1)
	System.out.println("***Processing: " + filename);
      Parse parse = new Parse(filename);
      Translate translate = new Translate(frame);
      Semant semant = new Semant(translate, parse.errorMsg);
      Frag frags = semant.transProg(parse.absyn);
      if (!parse.errorMsg.anyErrors) {
	java.io.PrintWriter writer = new java.io.PrintWriter(System.out);
	Tree.Print printer = new Tree.Print(writer);
	for (Frag f = frags; f != null; f = f.next)
	  if (f instanceof DataFrag) {
	    DataFrag d = (DataFrag)f;
	    writer.println(d.data);
	  } else {
	    ProcFrag p = (ProcFrag)f;
	    writer.println(p.frame.name + ":");
	    if (p.body != null)
	      printer.prStm(p.body);
	  }
	writer.flush();
      }
    }
  }
}


text:
<?php

namespace Metrol\HTML;

/**
 * Assembles an unordered list used for displaying links as tabs
 */
class Tabs
{
  /**
   * Index value to be passed along with the linked URL
   *
   * @var integer
   */
  protected $id;

  /**
   * Defines the name of the index parameter for the URL.
   *
   * @var string
   */
  protected $idName;

  /**
   * Note which tab is presently selected
   *
   * @var string
   */
  protected $activeTab;

  /**
   * Which tab is actively being worked on.  Usually the last added tab.
   * The tab name is what is defined here.
   *
   * @var string
   */
  protected $tabInWork;

  /**
   * Defines what tabs will show up, and what they will link to
   * Format: $tabs["Tab Name"] = "link.php"
   * An index value will automatically be added.
   *
   * @var array
   */
  protected $tabs;

  /**
   * Initializes the Tab object
   */
  public function __construct()
  {
    $this->id        = 0;
    $this->idName    = 'id';
    $this->activeTab = '';
    $this->tabInWork = '';
    $this->tabs      = array();
  }

  /**
   * Provide the HTML output of this class
   *
   * @return string
   */
  public function __toString()
  {
    $rtn = "";

    $rtn .= "
\n";
    $rtn .= "
\n";

    $rtn .= $this->getTabs();

    $rtn .= "
\n";
    $rtn .= "
\n";
    $rtn .= "
\n\n";

    return $rtn;
  }

  /**
   * Set the value of the ID key in the URL
   *
   * @param integer
   * @return this
   */
  public function setID($id)
  {
    $this->id = intval($id);

    return $this;
  }

  /**
   * Set the name of the index field paramter.
   *
   * @param string
   * @return this
   */
  public function setIndexName($indexName)
  {
    $this->idName = $indexName;

    return $this;
  }

  /**
   * Adds new tabs to the list that will be displayed.
   * When the index value is greater than zero it will automatically be
   * appended to the URL.
   *
   * @param string Name that will show up on the tab
   * @param string URL the tab will link to
   * @param string Text to show up for the title attribute
   *
   * @return this
   */
  public function addTab($name, $url, $toolTip = null)
  {
    $dispName = "";
    $dispName .= \Metrol\Text::htmlent($name);
    $dispName .= "";

    $a = new Anchor($url, $dispName);

    if ( $this->id > 0 )
    {
      $a->param($this->idName, $this->id);
    }

    if ( $toolTip !== null )
    {
      $a->setTitle($toolTip);
    }

    $this->tabs[$name] = $a;
    $this->tabInWork = $name;

    return $this;
  }

  /**
   * Takes in an Anchor object and adds it as a tab to the list.
   *
   * @param Metrol\HTML\Anchor
   * @return this
   */
  public function addAnchorTab(Anchor $a)
  {
    $ac = clone $a;

    $name = $ac->contentsText();

    $ac->linkText("$name");

    $this->tabs[$name] = $ac;
    $this->tabInWork = $name;

    return $this;
  }

  /**
   * Adds new tabs to the list that will be displayed with links that are
   * Javascript functions.
   * When the index value is greater than zero it will automatically be
   * appended to the URL.
   *
   * @param string Name that will show up on the tab
   * @param string Javascript function to be called on click
   * @return this
   */
  public function addJSTab($name, $jsFunction)
  {
    $dispName = "";
    $dispName .= \Metrol\Text::htmlent($name);
    $dispName .= "";

    $a = new Anchor;
    $a->linkText($dispName);
    $a->setJS($jsFunction);
    $a->title($name);

    $this->tabs[$name] = $a;
    $this->tabInWork = $name;

    return $this;
  }

  /**
   * Adds an additional parameter to the link of the specified tab.
   *
   * @param string
   * @param mixed
   * @param string Which tab to affect
   * @return this
   */
  public function addParam($key, $val, $tab = "YYXXZZ")
  {
    if ( $tab == "YYXXZZ" ) {
      $tab = $this->tabInWork;
    }

    if ( !array_key_exists($tab, $this->tabs) )
    {
      return; // Couldn't find the tab requested
    }

    $this->tabs[$tab]->param($key, $val);

    return $this;
  }

  /**
   * Adds a parameter to all of the tabs already set.
   * Does not impact any new tabs added after this is called.
   *
   * @param string
   * @param mixed
   * @return this
   */
  public function addParamToAll($key, $val)
  {
    foreach ( $this->tabs as $tab )
    {
      $tab->param($key, $val);
    }

    return $this;
  }

  /**
   * Which tab is presently active
   *
   * @param string
   * @return this
   */
  public function setActiveTab($tabName)
  {
    $this->activeTab = $tabName;

    return $this;
  }

  /**
   * Assembles all tabs and their links for the toString method
   *
   * @return string
   */
  private function getTabs()
  {
    $rtn = "";

    foreach ($this->tabs as $name => $link)
    {
      $style = "";

      if ( strtoupper($name) == strtoupper($this->activeTab) )
      {
        $style = " id=\"current\"";
      }

      $rtn .= "
\n";
      $rtn .= "    $link\n";
      $rtn .= "
\n";
    }

    return $rtn;
  }
}


text:
package inf_pp.td.model;

import inf_pp.td.intercom.TowerType;
import inf_pp.td.intercom.UpgradeType;

/**
 * A tower that does damage to all creeps in range periodically
 */
public class AreaTower extends BaseTower {
	private static final long serialVersionUID = -4110046028129614203L;

	/**
	 * Constructs an AreaTower
	 */
	public AreaTower(){
		ExponentialUpgrade up=new ExponentialUpgrade();
		upgradePolicy=up;
		up.setFunction(UpgradeType.DAMAGE,new ExponentialUpgrade.ExpFun(-5,1.3f,8));
		up.setFunction(UpgradeType.RANGE,new ExponentialUpgrade.ExpFun(.2f,1.1f,1));
		up.setFunction(UpgradeType.FIRERATE,new ExponentialUpgrade.ExpFun(333,0.75f,667));
		towerType=TowerType.AREA_OF_EFFECT;
	}

	/* (non-Javadoc)
	 * @see inf_pp.td.model.BaseTower#doFire(inf_pp.td.model.Game)
	 */
	@Override
	public int doFire(Game game) {
		boolean hasFired=false;
		for (BaseCreep c : game.getCreeps()) {
			//check if creep in range
			if(c.getPosition().distance(this.position)<(float)upgradePolicy.getValue(UpgradeType.RANGE)) {
				//and fire
				c.doDamage(((Float)upgradePolicy.getValue(UpgradeType.DAMAGE)).intValue(),game);
				hasFired=true;
			}
		}
		return hasFired?((Float)upgradePolicy.getValue(UpgradeType.FIRERATE)).intValue():0;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/selectableItemBackground"
    android:padding="8dp">

    <james.apreader.common.views.FontedTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/header"
        android:text="Something"
        android:textColor="@color/colorAccent"
        android:textSize="16sp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginRight="8dp"
        android:textStyle="bold" />

    <james.apreader.common.views.FontedTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/content"
        android:text="Something else"
        android:textColor="@color/textColorSecondaryInverse"
        android:textSize="14sp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp" />

</LinearLayout>


text:
require "spec_helper"

describe User do
  it { is_expected.to have_db_index(:email) }
  it { is_expected.to have_db_index(:remember_token) }
  it { is_expected.to validate_presence_of(:email) }
  it { is_expected.to validate_presence_of(:password) }
  it { is_expected.to allow_value("foo@example.co.uk").for(:email) }
  it { is_expected.to allow_value("foo@example.com").for(:email) }
  it { is_expected.to allow_value("foo+bar@example.com").for(:email) }
  it { is_expected.not_to allow_value("foo@").for(:email) }
  it { is_expected.not_to allow_value("foo@example..com").for(:email) }
  it { is_expected.not_to allow_value("foo@.example.com").for(:email) }
  it { is_expected.not_to allow_value("foo").for(:email) }
  it { is_expected.not_to allow_value("example.com").for(:email) }
  it { is_expected.not_to allow_value("foo;@example.com").for(:email) }

  describe "#email" do
    it "stores email in down case and removes whitespace" do
      user = create(:user, email: "Jo hn.Do e @exa mp le.c om")

      expect(user.email).to eq "john.doe@example.com"
    end

    subject { create(:user) }
    it { is_expected.to validate_uniqueness_of(:email) }
  end

  describe ".authenticate" do
    it "is authenticated with correct email and password" do
      user = create(:user)
      password = user.password

      expect(User.authenticate(user.email, password)).to eq(user)
    end

    it "is authenticated with correct uppercased email and correct password" do
      user = create(:user)
      password = user.password

      expect(User.authenticate(user.email.upcase, password)).to eq(user)
    end

    it "is not authenticated with incorrect credentials" do
      user = create(:user)

      expect(User.authenticate(user.email, "bad_password")).to be_nil
    end

    it "is retrieved via a case-insensitive search" do
      user = create(:user)

      expect(User.find_by_normalized_email(user.email.upcase)).to eq(user)
    end
  end

  describe ".reset_remember_token" do
    context "when resetting authentication with reset_remember_token!" do
      it "changes the remember token" do
        old_token = "old_token"
        user = create(:user, remember_token: old_token)

        user.reset_remember_token!

        expect(user.remember_token).not_to eq old_token
      end
    end
  end

  describe "#update_password" do
    context "with a valid password" do
      it "changes the encrypted password" do
        user = create(:user, :with_forgotten_password)
        old_encrypted_password = user.encrypted_password

        user.update_password("new_password")

        expect(user.encrypted_password).not_to eq old_encrypted_password
      end

      it "clears the confirmation token" do
        user = create(:user, :with_forgotten_password)

        user.update_password("new_password")

        expect(user.confirmation_token).to be_nil
      end

      it "sets the remember token" do
        user = create(:user, :with_forgotten_password)

        user.update_password("my_new_password")

        user.reload
        expect(user.remember_token).not_to be_nil
      end
    end

    context "with blank password" do
      it "does not change the encrypted password" do
        user = create(:user, :with_forgotten_password)
        old_encrypted_password = user.encrypted_password

        user.update_password("")

        expect(user.encrypted_password.to_s).to eq old_encrypted_password
      end

      it "does not clear the confirmation token" do
        user = create(:user, :with_forgotten_password)

        user.update_password("")

        expect(user.confirmation_token).not_to be_nil
      end
    end
  end

  describe "before_create callbacks" do
    describe "#generate_remember_token" do
      it "does not generate same remember token for users with same password" do
        allow(Time).to receive(:now).and_return(Time.now)
        password = "secret"
        first_user = create(:user, password: password)
        second_user = create(:user, password: password)

        expect(second_user.remember_token).not_to eq first_user.remember_token
      end
    end
  end

  describe "#forgot_password!" do
    it "generates the confirmation token" do
      user = create(:user, confirmation_token: nil)

      user.forgot_password!

      expect(user.confirmation_token).not_to be_nil
    end
  end

  describe "a user with an optional email" do
    subject { user }

    it { is_expected.to allow_value(nil).for(:email) }
    it { is_expected.to allow_value("").for(:email) }

    def user
      @user ||= User.new
      allow(@user).to receive(:email_optional?).and_return(true)
      @user
    end
  end

  describe "user factory" do
    it "should create a valid user with just an overridden password" do
      expect(build(:user, password: "test")).to be_valid
    end
  end

  describe "email address normalization" do
    it "downcases the address and strips spaces" do
      email = "Jo hn.Do e @exa mp le.c om"

      expect(User.normalize_email(email)).to eq "john.doe@example.com"
    end
  end

  describe "the password setter on a User" do
    it "sets password to the plain-text password" do
      password = "password"
      subject.send(:password=, password)

      expect(subject.password).to eq password
    end

    it "also sets encrypted_password" do
      password = "password"
      subject.send(:password=, password)

      expect(subject.encrypted_password).to_not be_nil
    end
  end
end

describe UserWithOptionalPassword do
  it { is_expected.to allow_value(nil).for(:password) }
  it { is_expected.to allow_value("").for(:password) }

  it "cannot authenticate with blank password" do
    user = create(:user_with_optional_password)

    expect(UserWithOptionalPassword.authenticate(user.email, "")).to be_nil
  end
end


text:
require 'spec_helper'

describe "privacy/index.html.erb" do
  pending "add some examples to (or delete) #{__FILE__}"
end


text:
<?php

class Editar_eventos extends CI_Controller {

    public function __construct() {
        parent::__construct();
        if (!$this->session->userdata('session_id') || !$this->session->userdata('logado')) {
            redirect("login");
        }
        $this->load->model("master/master_model", "master");
        $this->load->model("administracao/Evento_model", "evento");
    }

    public function index() {

        $this->load->library('table');

        $dados['Menus'] = $this->master->RetornaMenu($this->session->userdata('tipo'));
        $dados['Nome'] = $this->session->userdata('usuario');

        $this->layout->region('master_corpo', 'administracao/editar_evento_view');
        $this->layout->region('html_master_header', 'master/html_master_header_view');
        $this->layout->region('master_cabecalho', 'master/master_cabecalho_view');
        $this->layout->region('master_menu', 'master/master_menu_view', $dados);
        $this->layout->region('master_label', 'master/master_label_view', $dados);
        $this->layout->region('html_master_footer', 'master/html_master_footer_view');

        $this->layout->show('master/master_view');
    }

    public function GravarEvento() {

        $codEvento = $this->input->post('id');

        $dados['nome_campeonato'] = $this->input->post('txtEvento');
        $dados['local_evento'] = $this->input->post('txtLocal');
        $dados['hora'] = $this->input->post('txtHora');
        $dados['data_evento'] = $this->input->post('calendario');
        $dados['ultima_data_inscricao'] = date("Y-m-d", strtotime("-3 days", strtotime($this->input->post('calendario'))));
        $dados['status'] = '1';
        $dados['endereco'] = $this->input->post('txtEndereco');

        $this->evento->ConfirmaEditarEvento($dados, $codEvento);

        redirect('administracao/listar_eventos');
    }

}


text:
1;

# LaTeX2HTML 99.1 release (March 30, 1999)
# labels from external_latex_labels array.

1;


text:
FactoryGirl.define do
  factory :hatchy_category, :class => 'Hatchy::Category' do
    sequence(:name) { |n| "#{n}-#{Random.new_seed}" }
  end
end


text:
package picard.sam.markduplicates.util;

import picard.PicardException;
import htsjdk.samtools.CoordinateSortedPairInfoMap;

import java.io.*;
import java.util.*;

/**
 * Disk-based implementation of ReadEndsForMarkDuplicatesMap.  A subdirectory of the system tmpdir is created to store
 * files, one for each reference sequence.  The reference sequence that is currently being queried (i.e. the
 * sequence for which remove() has been most recently called) is stored in RAM.  ReadEnds for all other sequences
 * are stored on disk.
 *

 * When put() is called for a sequence that is the current one in RAM, the ReadEnds object is merely put into the
 * in-memory map.  If put() is called for a sequence ID that is not the current RAM one, the ReadEnds object is
 * appended to the file for that sequence, creating the file if necessary.
 *

 * When remove() is called for a sequence that is the current one in RAM, remove() is called on the in-memory map.
 * If remove() is called for a sequence other than the current RAM sequence, then the current RAM sequence is written
 * to disk, the new sequence is read from disk into RAM map, and the file for the new sequence is deleted.
 *

 * If things work properly, and reads are processed in genomic order, records will be written for mates that are in
 * a later sequence.  When the mate is reached in the input SAM file, the file that was written will be deleted.
 * This should result in all temporary files being deleted by the time all the reads are processed.  The temp
 * directory is marked to be deleted on exit so everything should get cleaned up.
 *
 * @author alecw@broadinstitute.org
 */
public class DiskBasedReadEndsForMarkDuplicatesMap implements ReadEndsForMarkDuplicatesMap {
    private final CoordinateSortedPairInfoMap<String, ReadEndsForMarkDuplicates> pairInfoMap;

    public DiskBasedReadEndsForMarkDuplicatesMap(int maxOpenFiles, final ReadEndsForMarkDuplicatesCodec readEndsForMarkDuplicatesCodec) {
        pairInfoMap = new CoordinateSortedPairInfoMap<String, ReadEndsForMarkDuplicates>(maxOpenFiles, new Codec(readEndsForMarkDuplicatesCodec));
    }

    public ReadEndsForMarkDuplicates remove(int mateSequenceIndex, String key) {
        return pairInfoMap.remove(mateSequenceIndex, key);
    }

    public void put(int mateSequenceIndex, String key, ReadEndsForMarkDuplicates readEnds) {
        pairInfoMap.put(mateSequenceIndex, key, readEnds);
    }

    public int size() {
        return pairInfoMap.size();
    }

    public int sizeInRam() {
        return pairInfoMap.sizeInRam();
    }

    private static class Codec implements CoordinateSortedPairInfoMap.Codec<String, ReadEndsForMarkDuplicates> {
        private final ReadEndsForMarkDuplicatesCodec readEndsForMarkDuplicatesCodec;

        public Codec(final ReadEndsForMarkDuplicatesCodec readEndsForMarkDuplicatesCodec) {
            this.readEndsForMarkDuplicatesCodec = readEndsForMarkDuplicatesCodec;
        }

        public void setInputStream(final InputStream is) {
            readEndsForMarkDuplicatesCodec.setInputStream(is);
        }

        public void setOutputStream(final OutputStream os) {
            readEndsForMarkDuplicatesCodec.setOutputStream(os);
        }

        public Map.Entry<String, ReadEndsForMarkDuplicates> decode() {
            try {
                final String key = readEndsForMarkDuplicatesCodec.getInputStream().readUTF();
                final ReadEndsForMarkDuplicates record = readEndsForMarkDuplicatesCodec.decode();
                return new AbstractMap.SimpleEntry<java.lang.String, ReadEndsForMarkDuplicates>(key, record);
            } catch (IOException e) {
                throw new PicardException("Error loading ReadEndsForMarkDuplicatesMap from disk", e);
            }
        }

        public void encode(final String key, final ReadEndsForMarkDuplicates readEnds) {
            try {
                readEndsForMarkDuplicatesCodec.getOutputStream().writeUTF(key);
                readEndsForMarkDuplicatesCodec.encode(readEnds);
            } catch (IOException e) {
                throw new PicardException("Error spilling ReadEndsForMarkDuplicatesMap to disk.", e);
            }
        }
    }

}


text:
package com.hazelcast.sql.impl.calcite.validate.operators.misc;

import com.hazelcast.sql.SqlColumnType;
import com.hazelcast.sql.impl.calcite.validate.HazelcastCallBinding;
import com.hazelcast.sql.impl.calcite.validate.HazelcastResources;
import com.hazelcast.sql.impl.calcite.validate.operators.common.HazelcastFunction;
import com.hazelcast.sql.impl.calcite.validate.param.NoOpParameterConverter;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlCallBinding;
import org.apache.calcite.sql.SqlDynamicParam;
import org.apache.calcite.sql.SqlFunctionCategory;
import org.apache.calcite.sql.SqlIntervalQualifier;
import org.apache.calcite.sql.SqlKind;
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.SqlOperandCountRange;
import org.apache.calcite.sql.SqlOperatorBinding;
import org.apache.calcite.sql.SqlSyntax;
import org.apache.calcite.sql.SqlWriter;
import org.apache.calcite.sql.type.SqlOperandCountRanges;
import org.apache.calcite.sql.type.SqlOperandTypeInference;
import org.apache.calcite.sql.type.SqlReturnTypeInference;
import org.apache.calcite.sql.type.SqlTypeName;

import static com.hazelcast.sql.impl.calcite.validate.types.HazelcastTypeUtils.canCast;
import static com.hazelcast.sql.impl.calcite.validate.types.HazelcastTypeUtils.toHazelcastType;

public final class HazelcastCastFunction extends HazelcastFunction {

    public static final HazelcastCastFunction INSTANCE = new HazelcastCastFunction();

    private HazelcastCastFunction() {
        super(
            "CAST",
            SqlKind.CAST,
            new CastReturnTypeInference(),
            new CastOperandTypeInference(),
            SqlFunctionCategory.SYSTEM
        );
    }

    @Override
    public SqlOperandCountRange getOperandCountRange() {
        return SqlOperandCountRanges.of(2);
    }

    @Override
    public boolean checkOperandTypes(HazelcastCallBinding binding, boolean throwOnFailure) {
        RelDataType sourceType = binding.getOperandType(0);
        RelDataType targetType = binding.getOperandType(1);

        SqlNode sourceOperand = binding.operand(0);

        if (sourceOperand.getKind() == SqlKind.DYNAMIC_PARAM) {
            int sourceParameterIndex = ((SqlDynamicParam) sourceOperand).getIndex();

            binding.getValidator().setParameterConverter(sourceParameterIndex, NoOpParameterConverter.INSTANCE);
        }

        if (canCast(sourceType, targetType)) {
            return true;
        }

        if (throwOnFailure) {
            SqlColumnType sourceType0 = toHazelcastType(sourceType.getSqlTypeName()).getTypeFamily().getPublicType();
            SqlColumnType targetType0 = toHazelcastType(targetType.getSqlTypeName()).getTypeFamily().getPublicType();

            throw binding.newError(HazelcastResources.RESOURCES.cannotCastValue(sourceType0.name(), targetType0.name()));
        } else {
            return false;
        }
    }

    @Override
    public SqlSyntax getSyntax() {
        return SqlSyntax.SPECIAL;
    }

    @Override
    public String getSignatureTemplate(final int operandsCount) {
        assert operandsCount == 2;

        return "{0}({1} AS {2})";
    }

    @Override
    public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
        assert call.operandCount() == 2;

        SqlWriter.Frame frame = writer.startFunCall(getName());

        call.operand(0).unparse(writer, 0, 0);

        writer.sep("AS");

        if (call.operand(1) instanceof SqlIntervalQualifier) {
            writer.sep("INTERVAL");
        }

        call.operand(1).unparse(writer, 0, 0);

        writer.endFunCall(frame);
    }

    private static final class CastOperandTypeInference implements SqlOperandTypeInference {
        @Override
        public void inferOperandTypes(SqlCallBinding binding, RelDataType returnType, RelDataType[] operandTypes) {
            RelDataType operandType = binding.getOperandType(0);

            if (operandType.getSqlTypeName() == SqlTypeName.NULL) {
                operandType = binding.getTypeFactory().createSqlType(SqlTypeName.ANY);
            }

            operandTypes[0] = operandType;
            operandTypes[1] = binding.getOperandType(1);
        }
    }

    private static final class CastReturnTypeInference implements SqlReturnTypeInference {
        @Override
        public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
            assert opBinding.getOperandCount() == 2;

            RelDataType sourceType = opBinding.getOperandType(0);

            // Target type must take in count nullability of the source type
            RelDataType targetType = opBinding.getTypeFactory().createTypeWithNullability(
                opBinding.getOperandType(1),
                sourceType.isNullable()
            );

            return targetType;
        }
    }
}


text:
cmake_minimum_required(VERSION 2.8)

set(DEFAULT_BOOST_URL ${CMAKE_SOURCE_DIR}/vendor/boost_1_59_0.diagnose_dups.tgz)
if(NOT DEFINED BOOST_URL)
    set(BOOST_URL ${DEFAULT_BOOST_URL})
endif(NOT DEFINED BOOST_URL)

set(BOOST_ROOT ${CMAKE_BINARY_DIR}/vendor/boost)
set(BOOST_SRC ${CMAKE_BINARY_DIR}/vendor/boost-src)
set(BOOST_LOG ${BOOST_SRC}/build.log)

set(BOOST_BUILD_LIBS_STRING "")

foreach(libname ${REQUIRED_BOOST_LIBS})
    set(BOOST_BUILD_LIBS ${BOOST_BUILD_LIBS} --with-${libname})
    set(Boost_LIBRARIES ${Boost_LIBRARIES}
        ${BOOST_ROOT}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}boost_${libname}${CMAKE_STATIC_LIBRARY_SUFFIX}
        )
endforeach(libname ${REQUIRED_BOOST_LIBS})

message("Extracting boost from ${BOOST_URL}")
message("Boost build log can be found at ${BOOST_LOG}")

ExternalDependency_Add(
    boost-1.59
    BUILD_BYPRODUCTS ${Boost_LIBRARIES}
    ARGS
        URL ${BOOST_URL}
        URL_MD5 "6364a2a634aa62415e52247072ac6888"
        SOURCE_DIR ${BOOST_SRC}
        BINARY_DIR ${BOOST_SRC}
        CONFIGURE_COMMAND "./bootstrap.sh"
        BUILD_COMMAND
            echo "Building boost, build log is ${BOOST_LOG}" &&
            ./b2 --prefix=${BOOST_ROOT} --layout=system link=static
                    threading=multi install ${BOOST_BUILD_LIBS} > ${BOOST_LOG} 2>&1
        INSTALL_COMMAND "true"
)

set(Boost_INCLUDE_DIRS ${BOOST_ROOT}/include)


text:
from google.appengine.ext import db

class User(db.Model):
  "Represents a user of the system"
  twitter_username = db.StringProperty(default='')
  twitter_password = db.StringProperty(default='')
  userkey = db.StringProperty()
  network = db.StringProperty()
  last_tweet_id = db.IntegerProperty(default=0)
  last_dm_id = db.IntegerProperty(default=0)
  last_mention_id = db.IntegerProperty(default=0)
  login_step = db.IntegerProperty(default=0)
  logged_in = db.BooleanProperty(default=False)
  paused = db.BooleanProperty(default=False)
  stopped = db.BooleanProperty(default=False)
  # tracking
  date_added = db.DateTimeProperty(auto_now_add=True)

class Message(db.Model):
  "Represents an IM message from the IMified service"
  userkey = db.StringProperty(required=True)
  network = db.StringProperty(required=True)
  msg = db.StringProperty(required=True)
  step = db.IntegerProperty(required=True)
  user = db.ReferenceProperty(User)
  # tracking
  date_added = db.DateTimeProperty(auto_now_add=True)

class Tweet(db.Model):
  "Represents a tweet"
  message = db.StringProperty(required=True,multiline=True)
  fromusername = db.StringProperty(required=True)
  fromuserid = db.IntegerProperty(required=True)
  fromscreenname = db.StringProperty(required=True)
  tid = db.IntegerProperty(required=True)
  created_at = db.DateTimeProperty(required=True)
  # tracking
  user = db.ReferenceProperty(User)
  date_added = db.DateTimeProperty(auto_now_add=True)

class Mention(db.Model):
  "Represents a tweet"
  message = db.StringProperty(required=True,multiline=True)
  fromusername = db.StringProperty(required=True)
  fromscreenname = db.StringProperty(required=True)
  fromuserid = db.IntegerProperty(required=True)
  tid = db.IntegerProperty(required=True)
  created_at = db.DateTimeProperty(required=True)
  # tracking
  user = db.ReferenceProperty(User)
  date_added = db.DateTimeProperty(auto_now_add=True)

class DirectMessage(db.Model):
  "Represents a tweet"
  message = db.StringProperty(required=True,multiline=True)
  fromusername = db.StringProperty(required=True)
  fromuserid = db.IntegerProperty(required=True)
  tid = db.IntegerProperty(required=True)
  created_at = db.DateTimeProperty(required=True)
  # tracking
  user = db.ReferenceProperty(User)
  date_added = db.DateTimeProperty(auto_now_add=True)

# class Carrier(db.Model):
#     name = db.StringProperty(default = '')
#     apn = db.StringProperty()
#     username = db.StringProperty(default = '')
#     password = db.StringProperty(default = '')
#     listed = db.BooleanProperty(default = False)
#
# class MessageSent(db.Model):
#     to = db.EmailProperty()
#     when = db.DateTimeProperty(auto_now_add=True)
#     carrier = db.ReferenceProperty(Carrier)
#
# class BundleDownloaded(db.Model):
#     ip = db.StringProperty()
#     ua = db.StringProperty()
#     when = db.DateTimeProperty(auto_now_add=True)
#     carrier = db.ReferenceProperty(Carrier)


text:
options.idProperty

The property in your data model objects which should be used as the unique identifier for each row.

Type and Default

(string): Default 'id'.

Example

{idProperty: "cid"}


text:
<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="robots" content="index,follow" />
    <meta name="viewport" content="width=640, user-scalable=no,target-densitydpi=device-dpi">
    <meta name="google" value="notranslate" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telphone=no, email=no" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="HandheldFriendly" content="true">
    <meta name="MobileOptimized" content="320">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-orientation" content="portrait">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <meta name="browsermode" content="application">
    <meta name="x5-page-mode" content="app">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="msapplication-TileColor" content="#000" />
    <meta name="msapplication-TileImage" content="icon.png" />
    <title>首页</title>
    <meta name="apple-mobile-web-app-title" content="首页">
    <meta name="keywords" content="关键字" />
    <meta name="郭方超" content="郭方超, 545570335@qq.com" />
    <meta name="description" content="说明" />
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <!-- 预热页面 -->
    <link rel="dns-prefetch" href="" />
    <link rel="preconnect" href="" />
    <!--[以下开始页面样式等]-->
</head>
<doby>

</doby>

</html>


text:
"use strict";

var scribeQuotePlugin = function(block) {
  return function(scribe) {

    const quoteCommand = new scribe.api.Command('quote');
    quoteCommand.queryEnabled = () => {
      return block.inline_editable;
    };
    quoteCommand.queryState = () => {
      return block.type === 'quote';
    };

    const getBlockType = function() {
      return quoteCommand.queryState() ? 'Text' : 'Quote';
    };

    quoteCommand.execute = function quoteCommandExecute(value) {
      var data = {
        format: 'html',
        text: block.getScribeInnerContent()
      };

      block.mediator.trigger("block:replace", block.el, getBlockType(), data);
    };

    scribe.commands.quote = quoteCommand;
  };
};

module.exports = scribeQuotePlugin;


text:
/**
 * @file
 * @brief Predicate --- C API
 *
 * @author Sam Baskinger <sbaskinger@qualys.com>
 */

#include <ironbee_config_auto_gen.h>

#include <assert.h>
#include <string>
#include <ironbee/predicate/predicate_c_api.h>
#include <ironbee/predicate/dag.hpp>
#include <ironbee/predicate/call_factory.hpp>
#include <ironbee/predicate/parse.hpp>
#include <ironbee/predicate/standard.hpp>
#include <ironbee/mm.h>
#include <ironbee/mpool_lite.h>
#include <ironbee/mm_mpool_lite.h>
#include <ironbeepp/catch.hpp>
#include <boost/foreach.hpp>
#include <iostream>

namespace P = IronBee::Predicate;
using namespace std;

ib_status_t ib_predicate_parse(
    ib_predicate_node_t **node,
    const char           *expression
)
{
    assert(node != NULL);
    assert(expression != NULL);

    string expr(expression);
    size_t s = 0;

    try {
        P::CallFactory call_factory;
        P::Standard::load(call_factory);
        *node = reinterpret_cast<ib_predicate_node_t *>(
            new P::node_cp(P::parse_call(expr, s, call_factory)));
        assert(*node != NULL);
    }
    catch (const IronBee::error& e) {
        string message;

        message += *boost::get_error_info<IronBee::errinfo_what>(e);
        std::cerr<<message<<std::endl;

        return IronBee::convert_exception();
    }

    return IB_OK;
}

void ib_predicate_node_destroy(
    ib_predicate_node_t *node
)
{
    assert(node != NULL);
    delete reinterpret_cast<P::node_cp *>(node);
}

const char * ib_predicate_node_to_s(
    ib_predicate_node_t *node
)
{
    assert(node != NULL);

    return reinterpret_cast<P::node_cp *>(node)->get()->to_s().c_str();
}

/**
 * Return the number of child nodes.
 */
size_t ib_predicate_node_child_count(
    ib_predicate_node_t *node
)
{
    assert(node != NULL);

    return reinterpret_cast<P::node_cp *>(node)->get()->children().size();
}

/**
 * Return the name of the node.
 */
const char *ib_predicate_node_name(
    ib_predicate_node_t *node
)
{
    assert(node != NULL);

    return reinterpret_cast<P::call_cp *>(node)->get()->name().c_str();
}

/**
 * Return child node i or NULL if none.
 *
 * @param[in] i The child index to retrieve.
 *
 * @returns The node or NULL if the index is out of bounds.
 */
void ib_predicate_node_children(
    ib_predicate_node_t  *node,
    ib_predicate_node_t **children
)
{
    assert(node != NULL);

    int i = 0;

    BOOST_FOREACH(
        P::node_cp p,
        (*reinterpret_cast<P::node_cp *>(node))->children()
    )
    {
        children[i] = const_cast<ib_predicate_node_t *>(
            reinterpret_cast<const ib_predicate_node_t *>(
                p.get()));
        ++i;
    }
}

/**
 * Return if the given node is a literal or not.
 */
bool ib_predicate_node_is_literal(
    ib_predicate_node_t *node
)
{
    assert(node != NULL);

    return (*reinterpret_cast<P::node_cp *>(node))->is_literal();
}


text:
package org.robolectric.shadows;

import android.opengl.Matrix;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

@Implements(Matrix.class)
public class ShadowOpenGLMatrix {

  /**
   * Multiplies two 4x4 matrices together and stores the result in a third 4x4
   * matrix. In matrix notation: result = lhs x rhs. Due to the way
   * matrix multiplication works, the result matrix will have the same
   * effect as first multiplying by the rhs matrix, then multiplying by
   * the lhs matrix. This is the opposite of what you might expect.
   *
   * The same float array may be passed for result, lhs, and/or rhs. However,
   * the result element values are undefined if the result elements overlap
   * either the lhs or rhs elements.
   *
   * @param result       The float array that holds the result.
   * @param resultOffset The offset into the result array where the result is
   *                     stored.
   * @param lhs          The float array that holds the left-hand-side matrix.
   * @param lhsOffset    The offset into the lhs array where the lhs is stored
   * @param rhs          The float array that holds the right-hand-side matrix.
   * @param rhsOffset    The offset into the rhs array where the rhs is stored.
   * @throws IllegalArgumentException if result, lhs, or rhs are null, or if
   *                                  resultOffset + 16 > result.length or lhsOffset + 16 > lhs.length or
   *                                  rhsOffset + 16 > rhs.length.
   */
  @Implementation
  public static void multiplyMM(float[] result, int resultOffset,
                                float[] lhs, int lhsOffset, float[] rhs, int rhsOffset) {
    if (result == null) {
      throw new IllegalArgumentException("result == null");
    }
    if (lhs == null) {
      throw new IllegalArgumentException("lhs == null");
    }
    if (rhs == null) {
      throw new IllegalArgumentException("rhs == null");
    }
    if (resultOffset + 16 > result.length) {
      throw new IllegalArgumentException("resultOffset + 16 > result.length");
    }
    if (lhsOffset + 16 > lhs.length) {
      throw new IllegalArgumentException("lhsOffset + 16 > lhs.length");
    }
    if (rhsOffset + 16 > rhs.length) {
      throw new IllegalArgumentException("rhsOffset + 16 > rhs.length");
    }
    for (int i = 0; i < 4; i++) {
      final float rhs_i0 = rhs[I(i, 0, rhsOffset)];
      float ri0 = lhs[I(0, 0, lhsOffset)] * rhs_i0;
      float ri1 = lhs[I(0, 1, lhsOffset)] * rhs_i0;
      float ri2 = lhs[I(0, 2, lhsOffset)] * rhs_i0;
      float ri3 = lhs[I(0, 3, lhsOffset)] * rhs_i0;
      for (int j = 1; j < 4; j++) {
        final float rhs_ij = rhs[I(i, j, rhsOffset)];
        ri0 += lhs[I(j, 0, lhsOffset)] * rhs_ij;
        ri1 += lhs[I(j, 1, lhsOffset)] * rhs_ij;
        ri2 += lhs[I(j, 2, lhsOffset)] * rhs_ij;
        ri3 += lhs[I(j, 3, lhsOffset)] * rhs_ij;
      }
      result[I(i, 0, resultOffset)] = ri0;
      result[I(i, 1, resultOffset)] = ri1;
      result[I(i, 2, resultOffset)] = ri2;
      result[I(i, 3, resultOffset)] = ri3;
    }
  }

  /**
   * Multiplies a 4 element vector by a 4x4 matrix and stores the result in a
   * 4-element column vector. In matrix notation: result = lhs x rhs
   *
   * The same float array may be passed for resultVec, lhsMat, and/or rhsVec.
   * However, the resultVec element values are undefined if the resultVec
   * elements overlap either the lhsMat or rhsVec elements.
   *
   * @param resultVec       The float array that holds the result vector.
   * @param resultVecOffset The offset into the result array where the result
   *                        vector is stored.
   * @param lhsMat          The float array that holds the left-hand-side matrix.
   * @param lhsMatOffset    The offset into the lhs array where the lhs is stored
   * @param rhsVec          The float array that holds the right-hand-side vector.
   * @param rhsVecOffset    The offset into the rhs vector where the rhs vector
   *                        is stored.
   * @throws IllegalArgumentException if resultVec, lhsMat,
   *                                  or rhsVec are null, or if resultVecOffset + 4 > resultVec.length
   *                                  or lhsMatOffset + 16 > lhsMat.length or
   *                                  rhsVecOffset + 4 > rhsVec.length.
   */
  @Implementation
  public static void multiplyMV(float[] resultVec,
                                int resultVecOffset, float[] lhsMat, int lhsMatOffset,
                                float[] rhsVec, int rhsVecOffset) {
    if (resultVec == null) {
      throw new IllegalArgumentException("resultVec == null");
    }
    if (lhsMat == null) {
      throw new IllegalArgumentException("lhsMat == null");
    }
    if (rhsVec == null) {
      throw new IllegalArgumentException("rhsVec == null");
    }
    if (resultVecOffset + 4 > resultVec.length) {
      throw new IllegalArgumentException("resultVecOffset + 4 > resultVec.length");
    }
    if (lhsMatOffset + 16 > lhsMat.length) {
      throw new IllegalArgumentException("lhsMatOffset + 16 > lhsMat.length");
    }
    if (rhsVecOffset + 4 > rhsVec.length) {
      throw new IllegalArgumentException("rhsVecOffset + 4 > rhsVec.length");
    }
    final float x = rhsVec[rhsVecOffset + 0];
    final float y = rhsVec[rhsVecOffset + 1];
    final float z = rhsVec[rhsVecOffset + 2];
    final float w = rhsVec[rhsVecOffset + 3];
    resultVec[resultVecOffset + 0] = lhsMat[I(0, 0, lhsMatOffset)] * x + lhsMat[I(1, 0, lhsMatOffset)] * y + lhsMat[I(2, 0, lhsMatOffset)] * z + lhsMat[I(3, 0, lhsMatOffset)] * w;
    resultVec[resultVecOffset + 1] = lhsMat[I(0, 1, lhsMatOffset)] * x + lhsMat[I(1, 1, lhsMatOffset)] * y + lhsMat[I(2, 1, lhsMatOffset)] * z + lhsMat[I(3, 1, lhsMatOffset)] * w;
    resultVec[resultVecOffset + 2] = lhsMat[I(0, 2, lhsMatOffset)] * x + lhsMat[I(1, 2, lhsMatOffset)] * y + lhsMat[I(2, 2, lhsMatOffset)] * z + lhsMat[I(3, 2, lhsMatOffset)] * w;
    resultVec[resultVecOffset + 3] = lhsMat[I(0, 3, lhsMatOffset)] * x + lhsMat[I(1, 3, lhsMatOffset)] * y + lhsMat[I(2, 3, lhsMatOffset)] * z + lhsMat[I(3, 3, lhsMatOffset)] * w;
  }

  private static int I(int i, int j, int offset) {
    // #define I(_i, _j) ((_j)+ 4*(_i))
    return offset + j + 4 * i;
  }

}


text:
/*
 * Do not modify this file. This file is generated from the config-2014-11-12.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;

using Amazon.ConfigService.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;

namespace Amazon.ConfigService.Model.Internal.MarshallTransformations
{
    /// <summary>
    /// Response Unmarshaller for EvaluationResultIdentifier Object
    /// </summary>
    public class EvaluationResultIdentifierUnmarshaller : IUnmarshaller<EvaluationResultIdentifier, XmlUnmarshallerContext>, IUnmarshaller<EvaluationResultIdentifier, JsonUnmarshallerContext>
    {
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        EvaluationResultIdentifier IUnmarshaller<EvaluationResultIdentifier, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public EvaluationResultIdentifier Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
                return null;

            EvaluationResultIdentifier unmarshalledObject = new EvaluationResultIdentifier();

            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("EvaluationResultQualifier", targetDepth))
                {
                    var unmarshaller = EvaluationResultQualifierUnmarshaller.Instance;
                    unmarshalledObject.EvaluationResultQualifier = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("OrderingTimestamp", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    unmarshalledObject.OrderingTimestamp = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return unmarshalledObject;
        }

        private static EvaluationResultIdentifierUnmarshaller _instance = new EvaluationResultIdentifierUnmarshaller();

        /// <summary>
        /// Gets the singleton.
        /// </summary>
        public static EvaluationResultIdentifierUnmarshaller Instance
        {
            get
            {
                return _instance;
            }
        }
    }
}


text:
module Atheme
  class Global < Service
  end
end


text:
<?php
class SlugUrlComponent extends Component{
	public $name = 'SlugUrl';

	public function stringToSlug($str = null) {
		// remove some special characters
		$str_array = array(":","'","/","?");
		$str = str_replace($str_array,'', $str);

		// make unique url......
		$str = $str.' '.mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y'));

		// turn into slug
		$str = Inflector::slug($str);
		// to lowercase
		$str = strtolower($str);
		return $str;
	}

	public function getSlugId($model_name = null, $str = null){
		$model_name = ucfirst($model_name);
		$get_data = $this->$model_name->findBySlug($str);
		$this->$model_name->id = null;
		return $get_data;
	}

	// For Fatch Slug URL from Database...
	//$this->SlugUrl->getSlugUrl('Nitche',$view_page_id);
	public function getSlugUrl($model_name = null, $id = null){
		$model_name = ucfirst($model_name);
		$get_data = $this->$model_name->findByid($id);
		$this->$model_name->id = null;
		return $get_data;
	}

}

?>


text:
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Principal;
using System.Web.Mvc;

namespace RoleAuthorize.Mvc
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
    public sealed class RoleAuthorizeAttribute : System.Web.Mvc.AuthorizeAttribute, IAuthorizationFilter //TODO: Change how this works so we don't inherit AuthorizeAttribute, it brings some junk along.
    {
        private static readonly char[] Delimiter = new char[] { ',' };

        private string _RoleNames;

        public string RoleNames
        {
            get { return _RoleNames ?? string.Empty; }
            set
            {
                _RoleNames = value;
                if (value == null)
                    RoleNamesSplit = new string[0];
                else
                    RoleNamesSplit = value.Split(Delimiter).Select(_ => _.Trim()).Where(_ => !string.IsNullOrEmpty(_)).ToArray();
            }
        }

        private string[] RoleNamesSplit = new string[0];

        protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext)
        {
            if (httpContext == null)
                throw new ArgumentNullException(nameof(httpContext));

            IPrincipal user = httpContext.User;
            if (user == null || user.Identity == null || !user.Identity.IsAuthenticated)
                return false;

            var users = RoleNamesSplit.SelectMany(_ => Config.RoleConfig.GetUsers(_)).ToList();
            if (users.Count > 0 && (users.Contains(user.Identity.Name, StringComparer.OrdinalIgnoreCase) || users.Contains("*", StringComparer.OrdinalIgnoreCase)))
                return true;

            var roles = RoleNamesSplit.SelectMany(_ => Config.RoleConfig.GetRoles(_)).ToList();
            if (roles.Count > 0 && (roles.Any(user.IsInRole) || roles.Contains("*", StringComparer.OrdinalIgnoreCase))) //TODO: Only allow wildcard in users?
                return true;

            //Not sure about this.
            if (Config.RoleConfig.DefaultAllow)
                return true;

            return false;
        }

        protected override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext)
        {
            if (filterContext == null)
                throw new ArgumentNullException(nameof(filterContext));

            IPrincipal user = filterContext.HttpContext.User;
            if (Config.RoleConfig.Authenticated403 && user != null && user.Identity != null && user.Identity.IsAuthenticated)
                filterContext.Result = new HttpStatusCodeResult(403);
            else
                filterContext.Result = new HttpUnauthorizedResult();
        }
    }
}

namespace RoleAuthorize.Api
{
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
    public sealed class RoleAuthorizeAttribute : System.Web.Http.AuthorizeAttribute //TODO: Change how this works so we don't inherit AuthorizeAttribute, it brings some junk along.
    {
        private static readonly char[] Delimiter = new char[] { ',' };

        private string _RoleNames;

        public string RoleNames
        {
            get { return _RoleNames ?? string.Empty; }
            set
            {
                _RoleNames = value;
                if (value == null)
                    RoleNamesSplit = new string[0];
                else
                    RoleNamesSplit = value.Split(Delimiter).Select(_ => _.Trim()).Where(_ => !string.IsNullOrEmpty(_)).ToArray();
            }
        }

        private string[] RoleNamesSplit = new string[0];

        protected override bool IsAuthorized(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            if (actionContext == null)
                throw new ArgumentNullException("actionContext");

            IPrincipal user = System.Web.HttpContext.Current.User;//TODO: FIX THIS!!!
            //IPrincipal user = actionContext.ControllerContext.Request.RequestContext.Principal;
            if (user == null || user.Identity == null || !user.Identity.IsAuthenticated)
                return false;

            var users = RoleNamesSplit.SelectMany(_ => Config.RoleConfig.GetUsers(_)).ToList();
            if (users.Count > 0 && (users.Contains(user.Identity.Name, StringComparer.OrdinalIgnoreCase) || users.Contains("*", StringComparer.OrdinalIgnoreCase)))
                return true;

            var roles = RoleNamesSplit.SelectMany(_ => Config.RoleConfig.GetRoles(_)).ToList();
            if (roles.Count > 0 && (roles.Any(user.IsInRole) || roles.Contains("*", StringComparer.OrdinalIgnoreCase))) //TODO: Only allow wildcard in users?
                return true;

            //Not sure about this.
            if (Config.RoleConfig.DefaultAllow)
                return true;

            return false;
        }

        //TODO: Does this work?
        //protected override void HandleUnauthorizedRequest(System.Web.Http.Controllers.HttpActionContext actionContext)
        //{
        //    IPrincipal user = System.Web.HttpContext.Current.User;//TODO: FIX THIS!!!
        //    //IPrincipal user = actionContext.ControllerContext.Request.RequestContext.Principal;
        //    if (Config.RoleConfig.Authenticated403 && user != null && user.Identity != null && user.Identity.IsAuthenticated)
        //        actionContext.Response = new HttpResponseMessage(HttpStatusCode.Forbidden);
        //    else
        //        actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
        //}
    }
}


text:
/**
 * Created by yeoman generator-makrina:angular-app <%= version %> on <%= date %>.
 */

angular
  .module('dashboard')
  .component('dashboard', {
    templateUrl: 'javascripts/<%= angularAppName %>/dashboard/dashboard.template.html',
    controller: [//'Object1', 'Object2',
      function DashboardController() {
        // here populate objects
      }
    ]
  });


text:
{% extends parent_template|default:"organizer/base_organizer.html" %}

{% block title %}
{{ block.super }} - Create Startup
{% endblock %}

{% block content %}

            <form
                action="{% url 'organizer_startup_create' %}"
                method="post">
                {% csrf_token %}
                {{ form.as_p }}
                <button type="submit">
                    Create Startup</button>
            </form>

{% endblock %}


text:
#pragma once

#include "../interactionbase_api.h"
#include "CommandWithDefaultArguments.h"

namespace Interaction {

class INTERACTIONBASE_API CAddNodeToView : public CommandWithDefaultArguments
{
	public:
		CAddNodeToView();

		virtual bool canInterpret(Visualization::Item *source, Visualization::Item *target,
				const QStringList& commandTokens, const std::unique_ptr<Visualization::Cursor> &cursor);

	protected:
		virtual CommandResult* executeWithArguments(Visualization::Item *source, Visualization::Item *target,
				const QStringList &arguments, const std::unique_ptr<Visualization::Cursor> &cursor);

		virtual QString description(Visualization::Item *source, Visualization::Item *target,
				const QStringList &arguments, const std::unique_ptr<Visualization::Cursor> &cursor);

};

}


text:
package org.bc.hadoop.ide.builder;

import java.util.Iterator;
import org.eclipse.core.commands.*;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;

public class AddRemoveSampleNatureHandler extends AbstractHandler {

	private ISelection selection;

	public Object execute(ExecutionEvent event) throws ExecutionException {
		// TODO Auto-generated method stub
		ISelection selection = HandlerUtil.getCurrentSelection(event);
		//
		if (selection instanceof IStructuredSelection) {
			for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it
					.hasNext();) {
				Object element = it.next();
				IProject project = null;
				if (element instanceof IProject) {
					project = (IProject) element;
				} else if (element instanceof IAdaptable) {
					project = (IProject) ((IAdaptable) element)
							.getAdapter(IProject.class);
				}
				if (project != null) {
					try {
						toggleNature(project);
					} catch (CoreException e) {
						//TODO log something
						throw new ExecutionException("Failed to toggle nature",
								e);
					}
				}
			}
		}

		return null;
	}

	/**
	 * Toggles sample nature on a project
	 *
	 * @param project
	 *            to have sample nature added or removed
	 */
	private void toggleNature(IProject project) throws CoreException {
		IProjectDescription description = project.getDescription();
		String[] natures = description.getNatureIds();

		for (int i = 0; i < natures.length; ++i) {
			if (SampleNature.NATURE_ID.equals(natures[i])) {
				// Remove the nature
				String[] newNatures = new String[natures.length - 1];
				System.arraycopy(natures, 0, newNatures, 0, i);
				System.arraycopy(natures, i + 1, newNatures, i, natures.length - i - 1);
				description.setNatureIds(newNatures);
				project.setDescription(description, null);
				return;
			}
		}

		// Add the nature
		String[] newNatures = new String[natures.length + 1];
		System.arraycopy(natures, 0, newNatures, 0, natures.length);
		newNatures[natures.length] = SampleNature.NATURE_ID;
		description.setNatureIds(newNatures);
		project.setDescription(description, null);
	}

}


text:
[![Version](https://img.shields.io/cocoapods/v/HapticHelper.svg)](http://cocoapods.org/pods/HapticHelper)
[![License](https://img.shields.io/cocoapods/l/HapticHelper.svg?)](http://cocoapods.org/pods/HapticHelper)
[![Platform](https://img.shields.io/cocoapods/p/HapticHelper.svg?)](http://cocoapods.org/pods/HapticHelper)

## Installation
* Install with [Cocoapods](http://cocoapods.org)

  ```ruby
  pod 'HapticHelper', '~> 1.0'
  ```

## Requirements

- iOS 10.0+
- Xcode 8.0+
- Objective-C

### Haptic Feedback Requirements:
- A device with a supported Taptic Engine (iPhone 7 and iPhone 7 Plus).
- App is running in the foreground.
- System Haptics setting is enabled.

## Author
**HapticHelper** is written by [Emre YANIK (emreyanik)](https://github.com/emreyanik).

## Licenses
**HapticHelper** is under MIT license. See the [LICENSE](LICENSE) for more info.


text:
export interface RequestError extends Error {
  status: number;
}

function createError(status: number, message: string): RequestError {
  return {
    name: "prismic-request-error",
    message,
    status
  }
}

// Number of maximum simultaneous connections to the prismic server
let MAX_CONNECTIONS: number = 20;
// Number of requests currently running (capped by MAX_CONNECTIONS)
let running: number = 0;
// Requests in queue
let queue: any[]  = [];

interface RequestCallback {}

interface RequestCallbackSuccess extends RequestCallback {
  result: any;
  xhr: any;
  ttl ?: number;
}

interface RequestCallbackFailure extends RequestCallback {
  error: Error
}

function fetchRequest(
  url: string,
  onSuccess: (_: RequestCallbackSuccess) => void,
  onError: (_: RequestCallbackFailure) => void
): any {
  return fetch(url, {
    headers: {
      'Accept': 'application/json'
    }
  }).then(function (response) {
    if (~~(response.status / 100 != 2)) {
      throw createError(response.status, "Unexpected status code [" + response.status + "] on URL " + url);
    } else {
      return response.json().then(function(json) {
        return {
          response: response,
          json: json
        };
      });
    }
  }).then(function(next: any) {
    var response = next.response;
    var json = next.json;
    var cacheControl = response.headers.get('cache-control');
    const parsedCacheControl: string[] | null = cacheControl ? /max-age=(\d+)/.exec(cacheControl) : null;
    const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined;
    onSuccess({result: json, xhr: response, ttl} as RequestCallbackSuccess);
  }).catch(function (error: Error) {
    onError({error} as RequestCallbackFailure);
  });
}

export interface RequestHandler {
  request(url: String, cb: (error: Error | null, result?: any, xhr?: any) => void): void
}

function processQueue() {
  if (queue.length === 0 || running >= MAX_CONNECTIONS) {
    return;
  }
  running++;

  const next = queue.shift();

  fetchRequest(next.url,
    function({result, xhr, ttl}: RequestCallbackSuccess) {
      running--;
      next.callback(null, result, xhr, ttl);
      processQueue();
    },
    function({error}: RequestCallbackFailure) {
      next.callback(error);
      processQueue();
    }
  );
}

export class DefaultRequestHandler implements RequestHandler {
  request(url: String, cb: (error: Error | null, result?: any, xhr?: any, ttl?: number) => void): void {
    queue.push({
      'url': url,
      'callback': cb
    });
    processQueue();
  }
}


text:
@class  BAKAuthenticationViewController, BAKAuthenticationData;

@protocol BAKAuthenticationViewControllerDelegate <NSObject>

- (void)authenticationViewController:(BAKAuthenticationViewController *)authenticationViewController didTapActionButtonWithEmail:(NSString *)email password:(NSString *)password;
- (void)authenticationViewController:(BAKAuthenticationViewController *)authenticationViewController didTapForgotPasswordButtonWithEmail:(NSString *)email;

@end

@interface BAKAuthenticationViewController : UIViewController

- (instancetype)initWithAuthenticationData:(BAKAuthenticationData *)data;

@property (nonatomic, readonly) BAKAuthenticationData *data;

@property (nonatomic, weak) id<BAKAuthenticationViewControllerDelegate> delegate;

@property (nonatomic) BAKAuthenticationForm *view;
@property (readonly) BAKAuthenticationForm *authenticationForm;

- (void)showKeyboard;

@end


text:
#pragma once
#include <aws/medialive/MediaLive_EXPORTS.h>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace MediaLive
{
namespace Model
{

  /**
   * Audio Track

See Also:
   AWS
   * API Reference

   */
  class AWS_MEDIALIVE_API AudioTrack
  {
  public:
    AudioTrack();
    AudioTrack(Aws::Utils::Json::JsonView jsonValue);
    AudioTrack& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     * 1-based integer value that maps to a specific audio track
     */
    inline int GetTrack() const{ return m_track; }

    /**
     * 1-based integer value that maps to a specific audio track
     */
    inline bool TrackHasBeenSet() const { return m_trackHasBeenSet; }

    /**
     * 1-based integer value that maps to a specific audio track
     */
    inline void SetTrack(int value) { m_trackHasBeenSet = true; m_track = value; }

    /**
     * 1-based integer value that maps to a specific audio track
     */
    inline AudioTrack& WithTrack(int value) { SetTrack(value); return *this;}

  private:

    int m_track;
    bool m_trackHasBeenSet = false;
  };

} // namespace Model
} // namespace MediaLive
} // namespace Aws


text:
using System;
using Microsoft.Extensions.DependencyInjection;

using NetworkedService.Interfaces;
using NetworkedService.Models;
using System.Net.Sockets;
using System.Net;
using System.Linq;
using System.Threading;

namespace NetworkedService.Transport.Tcp
{
    public class Client : IRemoteProcedureCaller
    {
        private readonly Guid _identity = Guid.NewGuid();
        private readonly IRemoteProcedureSerializer _commandSerializer;
        private readonly IPEndPoint _address;
        private readonly string _hostname;

        public Client(string hostname, int port, IRemoteProcedureSerializer commandSerializer)
        {
            _commandSerializer = commandSerializer;

            // Find the first IPv4 address
            var address = Dns.GetHostAddresses(hostname)
                .FirstOrDefault(a => a.AddressFamily == AddressFamily.InterNetwork);

            _address = new IPEndPoint(address, port);
            _hostname = hostname;
        }

        public RemoteResult CallMethod(RemoteCommand remoteCommand)
        {
            try
            {
                var client = TryConnect(_address);

                var msg = _commandSerializer.SerializeCommand(remoteCommand);

                client.WriteFullPacket(msg);
                var reply = client.ReadFullPacket();

                if(reply == null)
                    throw new InvalidOperationException("Reply message contained invalid signature");

                return _commandSerializer.DeserializeResult(reply);
            } catch(SocketException se)
            {
                throw new InvalidOperationException(string.Format("Failed to call remote method on {0}: {1}:{2}", _hostname, _address.Address.ToString(), _address.Port), se);
            }
        }

        public static Func<IServiceProvider, Client> Factory(string hostname, int port)
        {
            return (serviceProvider) =>
            {
                var commandSerializer = serviceProvider.GetService<IRemoteProcedureSerializer>();
                return new Client(hostname, port, commandSerializer);
            };
        }

        private Socket TryConnect(IPEndPoint endpoint, int timeoutRetry = 10)
        {
            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            do
            {
                try
                {
                    if (socket.ConnectAsync(endpoint).Wait(1000))
                        return socket;
                }
                catch(SocketException)
                {
                    --timeoutRetry;
                    Thread.Sleep(500);
                }
                catch (AggregateException ae)
                {
                    ae.Handle(x =>
                    {
                        if (x is SocketException)
                        {
                            --timeoutRetry;
                            Thread.Sleep(500);
                            return true;
                        }

                        return false;
                    });
                }
            } while (timeoutRetry >= 0);

            return socket;
        }
    }
}


text:
<?php include_partial('core/container_header', array('caption' => __('Checkout suspend'))) ?>
    <div class="content_block">
        <?php echo __('You did not paid for order and your order in status pending. You can finished the payment through your orders history.') ?>
    </div>
<?php include_partial('core/container_footer') ?>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<!-- Your own application should inherit from spring-boot-starter-parent -->
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.3.0.M2</version>
	</parent>

	<groupId>org.springframework</groupId>
	<artifactId>gps-vehicle-simulator</artifactId>
	<version>1.0.0.BUILD-SNAPSHOT</version>
	<name>gps-vehicle-simulator</name>
	<description>gps-vehicle-simulator</description>
	<properties>
		<java-version>1.8</java-version>
	</properties>
	<dependencies>
 		<dependency>
			<groupId>de.micromata.jak</groupId>
			<artifactId>JavaAPIforKml</artifactId>
			<version>2.2.1</version>
		</dependency>
		<dependency>
			<groupId>com.google.maps</groupId>
			<artifactId>google-maps-services</artifactId>
			<version>0.1.7</version>
		</dependency>
		<dependency>
			<groupId>com.spatial4j</groupId>
			<artifactId>spatial4j</artifactId>
			<version>0.4.1</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.integration</groupId>
			<artifactId>spring-integration-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-oxm</artifactId>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>${java-version}</source>
					<target>${java-version}</target>
					<compilerArgument>-Xlint:all</compilerArgument>
					<showWarnings>true</showWarnings>
					<showDeprecation>true</showDeprecation>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
	<repositories>
		<repository>
			<id>repo.spring.io.milestone</id>
			<name>Spring Maven Milestone Repository</name>
			<url>https://repo.spring.io/libs-milestone</url>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>repo.spring.io.milestone</id>
			<name>Spring Maven Milestone Repository</name>
			<url>https://repo.spring.io/libs-milestone</url>
		</pluginRepository>
	</pluginRepositories>
</project>


text:
[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)
[![Version](https://img.shields.io/cocoapods/v/ReadMoreTextView.svg?style=flat)](http://cocoapods.org/pods/ReadMoreTextView)
[![License](https://img.shields.io/cocoapods/l/ReadMoreTextView.svg?style=flat)](http://cocoapods.org/pods/ReadMoreTextView)
[![Platform](https://img.shields.io/cocoapods/p/ReadMoreTextView.svg?style=flat)](http://cocoapods.org/pods/ReadMoreTextView)
[![Swift Version](https://img.shields.io/badge/Swift-4-F16D39.svg?style=flat)](https://developer.apple.com/swift)

# ReadMoreTextView

UITextView subclass with "read more"/"read less" capabilities and UITextView extensions to handle touches in characters range.

![](screenshot.gif)

## Usage

	let textView = ReadMoreTextView()

	textView.text = "Lorem ipsum dolor ..."

	textView.shouldTrim = true
	textView.maximumNumberOfLines = 4
	textView.attributedReadMoreText = NSAttributedString(string: "... Read more")
	textView.attributedReadLessText = NSAttributedString(string: " Read less")

## Custom touches handling.

This project also includes few helper methods that will allow you to detect and handle touches in arbitrary text ranges. This way you can for exapmle implement custom links handling in your `UITextView` subclass. `ReadMoreTextView` uses these methods itself to detect touches in "read more"/"read less" action areas.

```swift

extension UITextView {

	/**
	 Calls provided `test` block if point is in gliph range and there is no link detected at this point.
	 Will pass in to `test` a character index that corresponds to `point`.
	 Return `self` in `test` if text view should intercept the touch event or `nil` otherwise.
	 */
	public func hitTest(pointInGliphRange:event:test:) -> UIView?

	/**
	 Returns true if point is in text bounding rect adjusted with padding.
	 Bounding rect will be enlarged with positive padding values and decreased with negative values.
	 */
	public func pointIsInTextRange(point:range:padding:) -> Bool

	/**
	 Returns index of character for glyph at provided point. Returns `nil` if point is out of any glyph.
	 */
	public func charIndexForPointInGlyphRect(point:) -> Int?

}

extension NSLayoutManager {

    /**
     Returns characters range that completely fits into container.
     */
    public func characterRangeThatFits(textContainer:) -> NSRange

    /**
     Returns bounding rect in provided container for characters in provided range.
     */
    public func boundingRectForCharacterRange(range:inTextContainer:) -> CGRect

}

```

## Installation

Available in [Cocoa Pods](https://github.com/CocoaPods/CocoaPods):

` pod 'ReadMoreTextView' `

## License

ReadMoreTextView is available under the [MIT license](http://www.opensource.org/licenses/mit-license.php).


text:
package ro.pub.cs.systems.eim.lab07.ocwcoursesdisplayer.controller;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import ro.pub.cs.systems.eim.lab07.ocwcoursesdisplayer.R;
import ro.pub.cs.systems.eim.lab07.ocwcoursesdisplayer.model.OCWCourseContent;

public class OCWCourseListAdapter extends BaseAdapter {

    private Context context;
    private List<OCWCourseContent> content;

    private LayoutInflater layoutInflater;

    private static class OCWCourseInformationViewHolder {
        ImageView logoImageView;
        TextView nameTextView;
    }

    public OCWCourseListAdapter(Context context, List<OCWCourseContent> content) {
        this.context = context;
        this.content = content;
        this.layoutInflater = (LayoutInflater)this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

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

    @Override
    public Object getItem(int position) {
        return content.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view;
        OCWCourseInformationViewHolder ocwCourseInformationViewHolder;

        OCWCourseContent ocwCourseContent = content.get(position);

        if (convertView == null) {
            view = layoutInflater.inflate(R.layout.ocw_course_information, parent, false);
            ocwCourseInformationViewHolder = new OCWCourseInformationViewHolder();
            ocwCourseInformationViewHolder.logoImageView = (ImageView)view.findViewById(R.id.logo_image_view);
            ocwCourseInformationViewHolder.nameTextView = (TextView)view.findViewById(R.id.name_text_view);
            view.setTag(ocwCourseInformationViewHolder);
        } else {
            view = convertView;
        }
        ocwCourseInformationViewHolder = (OCWCourseInformationViewHolder)view.getTag();
        ocwCourseInformationViewHolder.logoImageView.setImageBitmap(ocwCourseContent.getLogo());
        ocwCourseInformationViewHolder.nameTextView.setText(ocwCourseContent.getName());
        return view;
    }
}