text:
package importer

import (
	"fmt"
	"strconv"
	"strings"

	"github.com/pingcap/errors"
	"github.com/pingcap/log"
	"github.com/pingcap/tidb/parser"
	"github.com/pingcap/tidb/parser/ast"
	"github.com/pingcap/tidb/parser/types"
	_ "github.com/pingcap/tidb/types/parser_driver" // for parser driver
	"github.com/pingcap/tidb/util/dbutil"
	"go.uber.org/zap"
)

type column struct {
	idx     int
	name    string
	data    *datum
	tp      *types.FieldType
	comment string
	min     string
	max     string
	step    int64
	set     []string

	table *table
}

func (col *column) String() string {
	if col == nil {
		return "<nil>"
	}

	return fmt.Sprintf("[column]idx: %d, name: %s, tp: %v, min: %s, max: %s, step: %d, set: %v\n",
		col.idx, col.name, col.tp, col.min, col.max, col.step, col.set)
}

func (col *column) parseRule(kvs []string) {
	if len(kvs) != 2 {
		return
	}

	key := strings.TrimSpace(kvs[0])
	value := strings.TrimSpace(kvs[1])
	if key == "range" {
		fields := strings.Split(value, ",")
		if len(fields) == 1 {
			col.min = strings.TrimSpace(fields[0])
		} else if len(fields) == 2 {
			col.min = strings.TrimSpace(fields[0])
			col.max = strings.TrimSpace(fields[1])
		}
	} else if key == "step" {
		var err error
		col.step, err = strconv.ParseInt(value, 10, 64)
		if err != nil {
			log.Fatal("parseRule", zap.Error(err))
		}
	} else if key == "set" {
		fields := strings.Split(value, ",")
		for _, field := range fields {
			col.set = append(col.set, strings.TrimSpace(field))
		}
	}
}

// parse the data rules.
// rules like `a int unique comment '[[range=1,10;step=1]]'`,
// then we will get value from 1,2...10
func (col *column) parseColumnComment() {
	comment := strings.TrimSpace(col.comment)
	start := strings.Index(comment, "[[")
	end := strings.Index(comment, "]]")
	var content string
	if start < end {
		content = comment[start+2 : end]
	}

	fields := strings.Split(content, ";")
	for _, field := range fields {
		field = strings.TrimSpace(field)
		kvs := strings.Split(field, "=")
		col.parseRule(kvs)
	}
}

func (col *column) parseColumn(cd *ast.ColumnDef) {
	col.name = cd.Name.Name.L
	col.tp = cd.Tp
	col.parseColumnOptions(cd.Options)
	col.parseColumnComment()
	col.table.columns = append(col.table.columns, col)
}

func (col *column) parseColumnOptions(ops []*ast.ColumnOption) {
	for _, op := range ops {
		switch op.Tp {
		case ast.ColumnOptionPrimaryKey, ast.ColumnOptionAutoIncrement, ast.ColumnOptionUniqKey:
			col.table.uniqIndices[col.name] = col
		case ast.ColumnOptionComment:
			col.comment = op.Expr.(ast.ValueExpr).GetDatumString()
		}
	}
}

type table struct {
	name         string
	columns      []*column
	columnList   string
	indices      map[string]*column
	uniqIndices  map[string]*column
	unsignedCols map[string]*column
}

func (t *table) printColumns() string {
	ret := ""
	for _, col := range t.columns {
		ret += fmt.Sprintf("%v", col)
	}

	return ret
}

func (t *table) String() string {
	if t == nil {
		return "<nil>"
	}

	ret := fmt.Sprintf("[table]name: %s\n", t.name)
	ret += "[table]columns:\n"
	ret += t.printColumns()

	ret += fmt.Sprintf("[table]column list: %s\n", t.columnList)

	ret += "[table]indices:\n"
	for k, v := range t.indices {
		ret += fmt.Sprintf("key->%s, value->%v", k, v)
	}

	ret += "[table]unique indices:\n"
	for k, v := range t.uniqIndices {
		ret += fmt.Sprintf("key->%s, value->%v", k, v)
	}

	return ret
}

func newTable() *table {
	return &table{
		indices:      make(map[string]*column),
		uniqIndices:  make(map[string]*column),
		unsignedCols: make(map[string]*column),
	}
}

func (t *table) findCol(cols []*column, name string) *column {
	for _, col := range cols {
		if col.name == name {
			return col
		}
	}
	return nil
}

func (t *table) parseTableConstraint(cons *ast.Constraint) {
	switch cons.Tp {
	case ast.ConstraintPrimaryKey, ast.ConstraintKey, ast.ConstraintUniq,
		ast.ConstraintUniqKey, ast.ConstraintUniqIndex:
		for _, indexCol := range cons.Keys {
			name := indexCol.Column.Name.L
			t.uniqIndices[name] = t.findCol(t.columns, name)
		}
	case ast.ConstraintIndex:
		for _, indexCol := range cons.Keys {
			name := indexCol.Column.Name.L
			t.indices[name] = t.findCol(t.columns, name)
		}
	}
}

func (t *table) buildColumnList() {
	columns := make([]string, 0, len(t.columns))
	for _, column := range t.columns {
		columns = append(columns, dbutil.ColumnName(column.name))
	}

	t.columnList = strings.Join(columns, ",")
}

func parseTable(t *table, stmt *ast.CreateTableStmt) error {
	t.name = stmt.Table.Name.L
	t.columns = make([]*column, 0, len(stmt.Cols))

	for i, col := range stmt.Cols {
		column := &column{idx: i + 1, table: t, step: defaultStep, data: newDatum()}
		column.parseColumn(col)
	}

	for _, cons := range stmt.Constraints {
		t.parseTableConstraint(cons)
	}

	t.buildColumnList()

	return nil
}

func parseTableSQL(table *table, sql string) error {
	stmt, err := parser.New().ParseOneStmt(sql, "", "")
	if err != nil {
		return errors.Trace(err)
	}

	switch node := stmt.(type) {
	case *ast.CreateTableStmt:
		err = parseTable(table, node)
	default:
		err = errors.Errorf("invalid statement - %v", stmt.Text())
	}

	return errors.Trace(err)
}

func parseIndex(table *table, stmt *ast.CreateIndexStmt) error {
	if table.name != stmt.Table.Name.L {
		return errors.Errorf("mismatch table name for create index - %s : %s", table.name, stmt.Table.Name.L)
	}

	for _, indexCol := range stmt.IndexPartSpecifications {
		name := indexCol.Column.Name.L
		if stmt.KeyType == ast.IndexKeyTypeUnique {
			table.uniqIndices[name] = table.findCol(table.columns, name)
		} else {
			table.indices[name] = table.findCol(table.columns, name)
		}
	}

	return nil
}

func parseIndexSQL(table *table, sql string) error {
	if len(sql) == 0 {
		return nil
	}

	stmt, err := parser.New().ParseOneStmt(sql, "", "")
	if err != nil {
		return errors.Trace(err)
	}

	switch node := stmt.(type) {
	case *ast.CreateIndexStmt:
		err = parseIndex(table, node)
	default:
		err = errors.Errorf("invalid statement - %v", stmt.Text())
	}

	return errors.Trace(err)
}


text:
================
zsh-formula
================

This formula installs and configures zsh.

Available states
================

.. contents::

``zsh``
------------

Installs zsh.

``zsh.completions``
-------------------

Installs zsh-completions (archlinux only).

``zsh.grml``
-------------------

Install grml zsh config, on archlinux it uses the package, on debian you can use the repository. and with Redhat and Suse it will download the configs from https://grml.org/zsh/#grmlzshconfig

redpajama_set_name: RedPajamaGithub


text:
package com.pattern.thai.mvpapplication.models.api;

import com.pattern.thai.mvpapplication.models.entitys.AData;

import java.util.List;
import java.util.concurrent.TimeUnit;

import io.reactivex.Observable;
import io.rx_cache2.DynamicKey;
import io.rx_cache2.EvictProvider;
import io.rx_cache2.LifeCache;
import io.rx_cache2.Reply;

/**
 * Created by ggttoo44 on 2017/5/9.
 */

public interface CommonCache {
    @LifeCache(duration = 2, timeUnit = TimeUnit.MINUTES)
    Observable<Reply<List<AData>>> getDatas(Observable<List<AData>> users, DynamicKey idLastUserQueried, EvictProvider evictProvider);
}


text:
CQChartsColumnExprEdit::
CQChartsColumnExprEdit(QWidget *parent) :
 CQChartsLineEdit(parent)
{
  updateTip();

  connect(this, SIGNAL(editingFinished()), this, SLOT(updateSlot()));
}

void
CQChartsColumnExprEdit::
setModelData(CQChartsModelData *modelData)
{
  modelData_ = modelData;
}

void
CQChartsColumnExprEdit::
setAllowPrefix(bool b)
{
  allowPrefix_ = b;
}

void
CQChartsColumnExprEdit::
setExpr(const QString &expr)
{
  expr_ = expr;

  updateSlot();
}

void
CQChartsColumnExprEdit::
updateTip()
{
  auto tip = QString("tcl expression\n");

  if (allowPrefix())
    tip += "+<expr> OR -<column> OR =<column>:<expr>\n";

  tip += "Use: $header for column row value\n"
         "Use: <header> = <expression> to assign header with expression\n";

  tip += "Variables:\n";
  tip += "  @<N>      : Value of column N\n";
  tip += "  @#<N>     : Stringify Value of column N\n";
  tip += "  @#<N>     : Stringify Value of column N\n";
  tip += "  @c        : column number\n";
  tip += "  @r        : row number\n";
  tip += "  @nc       : column count\n";
  tip += "  @nr       : row count\n";
  tip += "  @v        : cell value\n";
  tip += "  @{<name>} : named column value\n";
  tip += "  #{<name>} : column number for name\n";

  tip += "Functions: ";

  QStringList fnNames;

  if (modelData_) {
  //auto *absModel  = CQChartsModelUtil::getBaseModel(modelData_->currentModel().data());
    auto *exprModel = CQChartsModelUtil::getExprModel(modelData_->currentModel().data());

    if (exprModel) {
      auto exprFnNames = exprModel->fnNames();

      for (const auto &fnName : exprFnNames)
        fnNames << fnName;
    }
  }

  if (! fnNames.length())
    fnNames = QStringList() <<
      "column" << "row" << "cell" << "setColumn" << "setRow" << "setCell" << "header" <<
      "setHeader" << "type" << "setType" << "map" << "bucket" << "norm" << "key" << "rand";

  int  len   = 11;
  bool first = true;

  for (const auto &fnName : fnNames) {
    if (! first) {
      tip += ", ";
      len += 2;
    }

    tip += fnName;
    len += fnName.size();

    if (len > 60) {
      tip += "\n";

      len   = 0;
      first = true;
    }
    else
      first = false;
  }

  setToolTip(tip);
}

void
CQChartsColumnExprEdit::
updateSlot()
{
  expr_ = text().trimmed();

  function_ = CQChartsExprModel::Function::EVAL;
  column_   = CQChartsColumn();
  subExpr_  = expr_;

  if (allowPrefix_) {
    if (modelData_ && expr_.length()) {
      auto model = modelData_->currentModel();

      (void) CQChartsModelUtil::decodeExpression(model.data(), expr_, function_, column_, expr_);
    }
  }

  Q_EMIT exprChanged();
}


text:
namespace juce
{

static juce_wchar getDefaultPasswordChar() noexcept
{
   #if JUCE_LINUX
    return 0x2022;
   #else
    return 0x25cf;
   #endif
}

//==============================================================================
AlertWindow::AlertWindow (const String& title,
                          const String& message,
                          AlertIconType iconType,
                          Component* comp)
   : TopLevelWindow (title, true),
     alertIconType (iconType),
     associatedComponent (comp)
{
    setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows());

    if (message.isEmpty())
        text = " "; // to force an update if the message is empty

    setMessage (message);

    AlertWindow::lookAndFeelChanged();
    constrainer.setMinimumOnscreenAmounts (0x10000, 0x10000, 0x10000, 0x10000);
}

AlertWindow::~AlertWindow()
{
    // Ensure that the focus does not jump to another TextEditor while we
    // remove children.
    for (auto* t : textBoxes)
        t->setWantsKeyboardFocus (false);

    // Give away focus before removing the editors, so that any TextEditor
    // with focus has a chance to dismiss native keyboard if shown.
    if (hasKeyboardFocus (true))
        Component::unfocusAllComponents();

    removeAllChildren();
}

void AlertWindow::userTriedToCloseWindow()
{
    if (escapeKeyCancels || buttons.size() > 0)
        exitModalState (0);
}

//==============================================================================
void AlertWindow::setMessage (const String& message)
{
    auto newMessage = message.substring (0, 2048);

    if (text != newMessage)
    {
        text = newMessage;
        updateLayout (true);
        repaint();
    }
}

//==============================================================================
void AlertWindow::exitAlert (Button* button)
{
    if (auto* parent = button->getParentComponent())
        parent->exitModalState (button->getCommandID());
}

//==============================================================================
void AlertWindow::addButton (const String& name,
                             const int returnValue,
                             const KeyPress& shortcutKey1,
                             const KeyPress& shortcutKey2)
{
    auto* b = new TextButton (name, {});
    buttons.add (b);

    b->setWantsKeyboardFocus (true);
    b->setMouseClickGrabsKeyboardFocus (false);
    b->setCommandToTrigger (nullptr, returnValue, false);
    b->addShortcut (shortcutKey1);
    b->addShortcut (shortcutKey2);
    b->onClick = [this, b] { exitAlert (b); };

    Array<TextButton*> buttonsArray (buttons.begin(), buttons.size());
    auto& lf = getLookAndFeel();

    auto buttonHeight = lf.getAlertWindowButtonHeight();
    auto buttonWidths = lf.getWidthsForTextButtons (*this, buttonsArray);

    jassert (buttonWidths.size() == buttons.size());
    int i = 0;

    for (auto* button : buttons)
        button->setSize (buttonWidths[i++], buttonHeight);

    addAndMakeVisible (b, 0);
    updateLayout (false);
}

int AlertWindow::getNumButtons() const
{
    return buttons.size();
}

void AlertWindow::triggerButtonClick (const String& buttonName)
{
    for (auto* b : buttons)
    {
        if (buttonName == b->getName())
        {
            b->triggerClick();
            break;
        }
    }
}

void AlertWindow::setEscapeKeyCancels (bool shouldEscapeKeyCancel)
{
    escapeKeyCancels = shouldEscapeKeyCancel;
}

//==============================================================================
void AlertWindow::addTextEditor (const String& name,
                                 const String& initialContents,
                                 const String& onScreenLabel,
                                 const bool isPasswordBox)
{
    auto* ed = new TextEditor (name, isPasswordBox ? getDefaultPasswordChar() : 0);
    ed->setSelectAllWhenFocused (true);
    ed->setEscapeAndReturnKeysConsumed (false);
    textBoxes.add (ed);
    allComps.add (ed);

    ed->setColour (TextEditor::outlineColourId, findColour (ComboBox::outlineColourId));
    ed->setFont (getLookAndFeel().getAlertWindowMessageFont());
    addAndMakeVisible (ed);
    ed->setText (initialContents);
    ed->setCaretPosition (initialContents.length());
    textboxNames.add (onScreenLabel);

    updateLayout (false);
}

TextEditor* AlertWindow::getTextEditor (const String& nameOfTextEditor) const
{
    for (auto* tb : textBoxes)
        if (tb->getName() == nameOfTextEditor)
            return tb;

    return nullptr;
}

String AlertWindow::getTextEditorContents (const String& nameOfTextEditor) const
{
    if (auto* t = getTextEditor (nameOfTextEditor))
        return t->getText();

    return {};
}

//==============================================================================
void AlertWindow::addComboBox (const String& name,
                               const StringArray& items,
                               const String& onScreenLabel)
{
    auto* cb = new ComboBox (name);
    comboBoxes.add (cb);
    allComps.add (cb);

    cb->addItemList (items, 1);

    addAndMakeVisible (cb);
    cb->setSelectedItemIndex (0);

    comboBoxNames.add (onScreenLabel);
    updateLayout (false);
}

ComboBox* AlertWindow::getComboBoxComponent (const String& nameOfList) const
{
    for (auto* cb : comboBoxes)
        if (cb->getName() == nameOfList)
            return cb;

    return nullptr;
}

//==============================================================================
class AlertTextComp  : public TextEditor
{
public:
    AlertTextComp (AlertWindow& owner, const String& message, const Font& font)
    {
        if (owner.isColourSpecified (AlertWindow::textColourId))
            setColour (TextEditor::textColourId, owner.findColour (AlertWindow::textColourId));

        setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
        setColour (TextEditor::outlineColourId, Colours::transparentBlack);
        setColour (TextEditor::shadowColourId, Colours::transparentBlack);

        setReadOnly (true);
        setMultiLine (true, true);
        setCaretVisible (false);
        setScrollbarsShown (true);
        lookAndFeelChanged();
        setWantsKeyboardFocus (false);
        setFont (font);
        setText (message, false);

        bestWidth = 2 * (int) std::sqrt (font.getHeight() * (float) font.getStringWidth (message));
    }

    void updateLayout (const int width)
    {
        AttributedString s;
        s.setJustification (Justification::topLeft);
        s.append (getText(), getFont());

        TextLayout text;
        text.createLayoutWithBalancedLineLengths (s, (float) width - 8.0f);
        setSize (width, jmin (width, (int) (text.getHeight() + getFont().getHeight())));
    }

    int bestWidth;

    JUCE_DECLARE_NON_COPYABLE (AlertTextComp)
};

void AlertWindow::addTextBlock (const String& textBlock)
{
    auto* c = new AlertTextComp (*this, textBlock, getLookAndFeel().getAlertWindowMessageFont());
    textBlocks.add (c);
    allComps.add (c);
    addAndMakeVisible (c);

    updateLayout (false);
}

//==============================================================================
void AlertWindow::addProgressBarComponent (double& progressValue)
{
    auto* pb = new ProgressBar (progressValue);
    progressBars.add (pb);
    allComps.add (pb);
    addAndMakeVisible (pb);

    updateLayout (false);
}

//==============================================================================
void AlertWindow::addCustomComponent (Component* const component)
{
    customComps.add (component);
    allComps.add (component);
    addAndMakeVisible (component);

    updateLayout (false);
}

int AlertWindow::getNumCustomComponents() const                 { return customComps.size(); }
Component* AlertWindow::getCustomComponent (int index) const    { return customComps [index]; }

Component* AlertWindow::removeCustomComponent (const int index)
{
    auto* c = getCustomComponent (index);

    if (c != nullptr)
    {
        customComps.removeFirstMatchingValue (c);
        allComps.removeFirstMatchingValue (c);
        removeChildComponent (c);

        updateLayout (false);
    }

    return c;
}

//==============================================================================
void AlertWindow::paint (Graphics& g)
{
    auto& lf = getLookAndFeel();
    lf.drawAlertBox (g, *this, textArea, textLayout);

    g.setColour (findColour (textColourId));
    g.setFont (lf.getAlertWindowFont());

    for (int i = textBoxes.size(); --i >= 0;)
    {
        auto* te = textBoxes.getUnchecked(i);

        g.drawFittedText (textboxNames[i],
                          te->getX(), te->getY() - 14,
                          te->getWidth(), 14,
                          Justification::centredLeft, 1);
    }

    for (int i = comboBoxNames.size(); --i >= 0;)
    {
        auto* cb = comboBoxes.getUnchecked(i);

        g.drawFittedText (comboBoxNames[i],
                          cb->getX(), cb->getY() - 14,
                          cb->getWidth(), 14,
                          Justification::centredLeft, 1);
    }

    for (auto* c : customComps)
        g.drawFittedText (c->getName(),
                          c->getX(), c->getY() - 14,
                          c->getWidth(), 14,
                          Justification::centredLeft, 1);
}

void AlertWindow::updateLayout (const bool onlyIncreaseSize)
{
    const int titleH = 24;
    const int iconWidth = 80;

    auto& lf = getLookAndFeel();
    auto messageFont (lf.getAlertWindowMessageFont());

    auto wid = jmax (messageFont.getStringWidth (text),
                     messageFont.getStringWidth (getName()));

    auto sw = (int) std::sqrt (messageFont.getHeight() * (float) wid);
    auto w = jmin (300 + sw * 2, (int) ((float) getParentWidth() * 0.7f));
    const int edgeGap = 10;
    const int labelHeight = 18;
    int iconSpace = 0;

    AttributedString attributedText;
    attributedText.append (getName(), lf.getAlertWindowTitleFont());

    if (text.isNotEmpty())
        attributedText.append ("\n\n" + text, messageFont);

    attributedText.setColour (findColour (textColourId));

    if (alertIconType == NoIcon)
    {
        attributedText.setJustification (Justification::centredTop);
        textLayout.createLayoutWithBalancedLineLengths (attributedText, (float) w);
    }
    else
    {
        attributedText.setJustification (Justification::topLeft);
        textLayout.createLayoutWithBalancedLineLengths (attributedText, (float) w);
        iconSpace = iconWidth;
    }

    w = jmax (350, (int) textLayout.getWidth() + iconSpace + edgeGap * 4);
    w = jmin (w, (int) ((float) getParentWidth() * 0.7f));

    auto textLayoutH = (int) textLayout.getHeight();
    auto textBottom = 16 + titleH + textLayoutH;
    int h = textBottom;

    int buttonW = 40;

    for (auto* b : buttons)
        buttonW += 16 + b->getWidth();

    w = jmax (buttonW, w);

    h += (textBoxes.size() + comboBoxes.size() + progressBars.size()) * 50;

    if (auto* b = buttons[0])
        h += 20 + b->getHeight();

    for (auto* c : customComps)
    {
        w = jmax (w, (c->getWidth() * 100) / 80);
        h += 10 + c->getHeight();

        if (c->getName().isNotEmpty())
            h += labelHeight;
    }

    for (auto* tb : textBlocks)
        w = jmax (w, static_cast<const AlertTextComp*> (tb)->bestWidth);

    w = jmin (w, (int) ((float) getParentWidth() * 0.7f));

    for (auto* tb : textBlocks)
    {
        auto* ac = static_cast<AlertTextComp*> (tb);
        ac->updateLayout ((int) ((float) w * 0.8f));
        h += ac->getHeight() + 10;
    }

    h = jmin (getParentHeight() - 50, h);

    if (onlyIncreaseSize)
    {
        w = jmax (w, getWidth());
        h = jmax (h, getHeight());
    }

    if (! isVisible())
        centreAroundComponent (associatedComponent, w, h);
    else
        setBounds (getBounds().withSizeKeepingCentre (w, h));

    textArea.setBounds (edgeGap, edgeGap, w - (edgeGap * 2), h - edgeGap);

    const int spacer = 16;
    int totalWidth = -spacer;

    for (auto* b : buttons)
        totalWidth += b->getWidth() + spacer;

    auto x = (w - totalWidth) / 2;
    auto y = (int) ((float) getHeight() * 0.95f);

    for (auto* c : buttons)
    {
        int ny = proportionOfHeight (0.95f) - c->getHeight();
        c->setTopLeftPosition (x, ny);
        if (ny < y)
            y = ny;

        x += c->getWidth() + spacer;

        c->toFront (false);
    }

    y = textBottom;

    for (auto* c : allComps)
    {
        h = 22;

        const int comboIndex = comboBoxes.indexOf (dynamic_cast<ComboBox*> (c));
        if (comboIndex >= 0 && comboBoxNames [comboIndex].isNotEmpty())
            y += labelHeight;

        const int tbIndex = textBoxes.indexOf (dynamic_cast<TextEditor*> (c));
        if (tbIndex >= 0 && textboxNames[tbIndex].isNotEmpty())
            y += labelHeight;

        if (customComps.contains (c))
        {
            if (c->getName().isNotEmpty())
                y += labelHeight;

            c->setTopLeftPosition (proportionOfWidth (0.1f), y);
            h = c->getHeight();
        }
        else if (textBlocks.contains (c))
        {
            c->setTopLeftPosition ((getWidth() - c->getWidth()) / 2, y);
            h = c->getHeight();
        }
        else
        {
            c->setBounds (proportionOfWidth (0.1f), y, proportionOfWidth (0.8f), h);
        }

        y += h + 10;
    }

    setWantsKeyboardFocus (getNumChildComponents() == 0);
}

bool AlertWindow::containsAnyExtraComponents() const
{
    return allComps.size() > 0;
}

//==============================================================================
void AlertWindow::mouseDown (const MouseEvent& e)
{
    dragger.startDraggingComponent (this, e);
}

void AlertWindow::mouseDrag (const MouseEvent& e)
{
    dragger.dragComponent (this, e, &constrainer);
}

bool AlertWindow::keyPressed (const KeyPress& key)
{
    for (auto* b : buttons)
    {
        if (b->isRegisteredForShortcut (key))
        {
            b->triggerClick();
            return true;
        }
    }

    if (key.isKeyCode (KeyPress::escapeKey) && escapeKeyCancels)
    {
        exitModalState (0);
        return true;
    }

    if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1)
    {
        buttons.getUnchecked(0)->triggerClick();
        return true;
    }

    return false;
}

void AlertWindow::lookAndFeelChanged()
{
    const int newFlags = getLookAndFeel().getAlertBoxWindowFlags();

    setUsingNativeTitleBar ((newFlags & ComponentPeer::windowHasTitleBar) != 0);
    setDropShadowEnabled (isOpaque() && (newFlags & ComponentPeer::windowHasDropShadow) != 0);
    updateLayout (false);
}

int AlertWindow::getDesktopWindowStyleFlags() const
{
    return getLookAndFeel().getAlertBoxWindowFlags();
}

//==============================================================================
class AlertWindowInfo
{
public:
    AlertWindowInfo (const String& t, const String& m, Component* component,
                     AlertWindow::AlertIconType icon, int numButts,
                     ModalComponentManager::Callback* cb, bool runModally)
        : title (t), message (m), iconType (icon), numButtons (numButts),
          associatedComponent (component), callback (cb), modal (runModally)
    {
    }

    String title, message, button1, button2, button3;

    int invoke() const
    {
        MessageManager::getInstance()->callFunctionOnMessageThread (showCallback, (void*) this);
        return returnValue;
    }

private:
    AlertWindow::AlertIconType iconType;
    int numButtons, returnValue = 0;
    WeakReference<Component> associatedComponent;
    ModalComponentManager::Callback* callback;
    bool modal;

    void show()
    {
        auto& lf = associatedComponent != nullptr ? associatedComponent->getLookAndFeel()
                                                  : LookAndFeel::getDefaultLookAndFeel();

        std::unique_ptr<Component> alertBox (lf.createAlertWindow (title, message, button1, button2, button3,
                                                                   iconType, numButtons, associatedComponent));

        jassert (alertBox != nullptr); // you have to return one of these!

        alertBox->setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows());

       #if JUCE_MODAL_LOOPS_PERMITTED
        if (modal)
        {
            returnValue = alertBox->runModalLoop();
        }
        else
       #endif
        {
            ignoreUnused (modal);

            alertBox->enterModalState (true, callback, true);
            alertBox.release();
        }
    }

    static void* showCallback (void* userData)
    {
        static_cast<AlertWindowInfo*> (userData)->show();
        return nullptr;
    }
};

#if JUCE_MODAL_LOOPS_PERMITTED
void AlertWindow::showMessageBox (AlertIconType iconType,
                                  const String& title,
                                  const String& message,
                                  const String& buttonText,
                                  Component* associatedComponent)
{
    if (LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows())
    {
        NativeMessageBox::showMessageBox (iconType, title, message, associatedComponent);
    }
    else
    {
        AlertWindowInfo info (title, message, associatedComponent, iconType, 1, nullptr, true);
        info.button1 = buttonText.isEmpty() ? TRANS("OK") : buttonText;

        info.invoke();
    }
}
#endif

void AlertWindow::showMessageBoxAsync (AlertIconType iconType,
                                       const String& title,
                                       const String& message,
                                       const String& buttonText,
                                       Component* associatedComponent,
                                       ModalComponentManager::Callback* callback)
{
    if (LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows())
    {
        NativeMessageBox::showMessageBoxAsync (iconType, title, message, associatedComponent, callback);
    }
    else
    {
        AlertWindowInfo info (title, message, associatedComponent, iconType, 1, callback, false);
        info.button1 = buttonText.isEmpty() ? TRANS("OK") : buttonText;

        info.invoke();
    }
}

bool AlertWindow::showOkCancelBox (AlertIconType iconType,
                                   const String& title,
                                   const String& message,
                                   const String& button1Text,
                                   const String& button2Text,
                                   Component* associatedComponent,
                                   ModalComponentManager::Callback* callback)
{
    if (LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows())
        return NativeMessageBox::showOkCancelBox (iconType, title, message, associatedComponent, callback);

    AlertWindowInfo info (title, message, associatedComponent, iconType, 2, callback, callback == nullptr);
    info.button1 = button1Text.isEmpty() ? TRANS("OK")     : button1Text;
    info.button2 = button2Text.isEmpty() ? TRANS("Cancel") : button2Text;

    return info.invoke() != 0;
}

int AlertWindow::showYesNoCancelBox (AlertIconType iconType,
                                     const String& title,
                                     const String& message,
                                     const String& button1Text,
                                     const String& button2Text,
                                     const String& button3Text,
                                     Component* associatedComponent,
                                     ModalComponentManager::Callback* callback)
{
    if (LookAndFeel::getDefaultLookAndFeel().isUsingNativeAlertWindows())
        return NativeMessageBox::showYesNoCancelBox (iconType, title, message, associatedComponent, callback);

    AlertWindowInfo info (title, message, associatedComponent, iconType, 3, callback, callback == nullptr);
    info.button1 = button1Text.isEmpty() ? TRANS("Yes")     : button1Text;
    info.button2 = button2Text.isEmpty() ? TRANS("No")      : button2Text;
    info.button3 = button3Text.isEmpty() ? TRANS("Cancel")  : button3Text;

    return info.invoke();
}

#if JUCE_MODAL_LOOPS_PERMITTED
bool AlertWindow::showNativeDialogBox (const String& title,
                                       const String& bodyText,
                                       bool isOkCancel)
{
    if (isOkCancel)
        return NativeMessageBox::showOkCancelBox (AlertWindow::NoIcon, title, bodyText);

    NativeMessageBox::showMessageBox (AlertWindow::NoIcon, title, bodyText);
    return true;
}
#endif

} // namespace juce


text:
package org.fiware.apps.marketplace.rdf;

import java.io.IOException;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.StaleReaderException;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.LockObtainFailedException;
import org.fiware.apps.marketplace.model.Description;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;

@Service("rdfIndexer")
public class RdfIndexer {

	@Value("${lucene.IndexPath}") private String lucenePath;

	private static final Logger logger = LoggerFactory.getLogger(RdfIndexer.class);

	public void indexOrUpdateService(Description description) throws IOException {

		Model model = new RdfHelper(description.getUrl()).getModel();
		String serviceId = description.getId().toString();

		// Delete previous indexes for this description (if any)
		// If a description is being updated, a JenaException should have been thrown previously and
		// this method won't be called, so the previous index is not deleted.
		deleteService(description);

		IndexBuilderStringExtended larqBuilder = new IndexBuilderStringExtended(lucenePath, serviceId);

		StmtIterator indexModel = model.listStatements();
		while(indexModel.hasNext()) {
			Statement statement = indexModel.next();
			larqBuilder.indexStatement(statement);
		}

		larqBuilder.closeWriter();

	}

	public void deleteService(Description description) {

		Analyzer analyzer = new StandardAnalyzer();
		IndexWriter indexWriter = null;

		try {
			indexWriter = new IndexWriter(lucenePath, analyzer);
			indexWriter.deleteDocuments(new Term ("docId", description.getId().toString()));
		} catch (StaleReaderException e) {
			logger.error("Deleting Service from Index - StaleReaderException", e);
		} catch (CorruptIndexException e) {
			logger.error("Deleting Service from Index - CorruptIndexException", e);
		} catch (LockObtainFailedException e) {
			logger.error("Deleting Service from Index - LockObtainFailedException", e);
		} catch (IOException e) {
			logger.error("Deleting Service from Index - IOException", e);
		}

		try {
			indexWriter.optimize();
			indexWriter.close();
		} catch (IOException e) {
			logger.error("Deleting Service form Index (Optimizing) - IOException", e);
		}

	}

}


text:
namespace ppapi {
namespace thunk {

namespace {

void HistogramCustomTimes(PP_Instance instance,
                          struct PP_Var name,
                          int64_t sample,
                          int64_t min,
                          int64_t max,
                          uint32_t bucket_count) {
  VLOG(4) << "PPB_UMA_Private::HistogramCustomTimes()";
  EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance);
  if (enter.failed())
    return;
  enter.functions()->HistogramCustomTimes(instance,
                                          name,
                                          sample,
                                          min,
                                          max,
                                          bucket_count);
}

void HistogramCustomCounts(PP_Instance instance,
                           struct PP_Var name,
                           int32_t sample,
                           int32_t min,
                           int32_t max,
                           uint32_t bucket_count) {
  VLOG(4) << "PPB_UMA_Private::HistogramCustomCounts()";
  EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance);
  if (enter.failed())
    return;
  enter.functions()->HistogramCustomCounts(instance,
                                           name,
                                           sample,
                                           min,
                                           max,
                                           bucket_count);
}

void HistogramEnumeration(PP_Instance instance,
                          struct PP_Var name,
                          int32_t sample,
                          int32_t boundary_value) {
  VLOG(4) << "PPB_UMA_Private::HistogramEnumeration()";
  EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance);
  if (enter.failed())
    return;
  enter.functions()->HistogramEnumeration(instance,
                                          name,
                                          sample,
                                          boundary_value);
}

int32_t IsCrashReportingEnabled(PP_Instance instance,
                                struct PP_CompletionCallback callback) {
  VLOG(4) << "PPB_UMA_Private::IsCrashReportingEnabled()";
  EnterInstanceAPI<PPB_UMA_Singleton_API> enter(instance, callback);
  if (enter.failed())
    return enter.retval();
  return enter.SetResult(enter.functions()->IsCrashReportingEnabled(
      instance,
      enter.callback()));
}

const PPB_UMA_Private_0_3 g_ppb_uma_private_thunk_0_3 = {
  &HistogramCustomTimes,
  &HistogramCustomCounts,
  &HistogramEnumeration,
  &IsCrashReportingEnabled
};

}  // namespace

PPAPI_THUNK_EXPORT const PPB_UMA_Private_0_3* GetPPB_UMA_Private_0_3_Thunk() {
  return &g_ppb_uma_private_thunk_0_3;
}

}  // namespace thunk
}  // namespace ppapi


text:
import {NgModule} from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {MatDialogModule} from '@angular/material/dialog';
import {MatExpansionModule} from '@angular/material/expansion';

const MATERIAL_MODULES = [
  MatButtonModule,
  MatDialogModule,
  MatExpansionModule,
];

@NgModule({
  imports: MATERIAL_MODULES,
  exports: MATERIAL_MODULES,
})
export class MaterialModule {
}


text:
namespace AutoTestRegister {
    QUICK_TEST_MAIN(QuickTests)
}

int main(int argc, char *argv[])
{
    qputenv("QML_DISABLE_DISK_CACHE", "true");

    QGuiApplication app(argc,argv);

    TestRunner runner;
    runner.add<QuickFluxUnitTests>();
    runner.add(QString(SRCDIR) + "/qmltests");

    bool error = runner.exec(app.arguments());

    if (!error) {
        qWarning() << "All test cases passed!";
    }

    return error;
}


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('url', models.CharField(max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='Page',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('url', models.CharField(max_length=20)),
                ('body', models.CharField(max_length=1000)),
                ('date', models.DateTimeField()),
            ],
        ),
    ]


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 -->

<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="lb_navigation_menu_contentDescription" msgid="8126335323963415494">"Menyu ya kusogeza"</string>
    <string name="orb_search_action" msgid="7534843523462177008">"Kitendo cha Kutafuta"</string>
    <string name="lb_search_bar_hint" msgid="4819380969103509861">"Tafuta"</string>
    <string name="lb_search_bar_hint_speech" msgid="2795474673510974502">"Tamka ili utafute"</string>
    <string name="lb_search_bar_hint_with_title" msgid="7453744869467668159">"Tafuta <xliff:g id="SEARCH_CONTEXT">%1$s</xliff:g>"</string>
    <string name="lb_search_bar_hint_with_title_speech" msgid="5851694095153624617">"Tamka ili utafute <xliff:g id="SEARCH_CONTEXT">%1$s</xliff:g>"</string>
    <string name="lb_control_display_fast_forward_multiplier" msgid="2721825378927619928">"X%1$d"</string>
    <string name="lb_control_display_rewind_multiplier" msgid="6173753802428649303">"X%1$d"</string>
    <string name="lb_playback_controls_play" msgid="1590369760862605402">"Cheza"</string>
    <string name="lb_playback_controls_pause" msgid="1769131316742618433">"Sitisha"</string>
    <string name="lb_playback_controls_fast_forward" msgid="8966769845721269304">"Sogeza Mbele Haraka"</string>
    <string name="lb_playback_controls_fast_forward_multiplier" msgid="801276177839339511">"Sogeza Mbele X%1$d"</string>
    <string name="lb_playback_controls_rewind" msgid="1412664391757869774">"Rudisha nyuma"</string>
    <string name="lb_playback_controls_rewind_multiplier" msgid="8651612807713092781">"Rudisha nyuma X%1$d"</string>
    <string name="lb_playback_controls_skip_next" msgid="4877009494447817003">"Nenda kwenye Inayofuata"</string>
    <string name="lb_playback_controls_skip_previous" msgid="3147124289285911980">"Nenda kwenye Iliyotangulia"</string>
    <string name="lb_playback_controls_more_actions" msgid="2827883329510404797">"Vitendo zaidi"</string>
    <string name="lb_playback_controls_thumb_up" msgid="8332816524260995892">"Acha Kuchagua \'Bomba\'"</string>
    <string name="lb_playback_controls_thumb_up_outline" msgid="1038344559734334272">"Chagua \'Bomba\'"</string>
    <string name="lb_playback_controls_thumb_down" msgid="5075744418630733006">"Acha kuchagua \'Hainipendezi\'"</string>
    <string name="lb_playback_controls_thumb_down_outline" msgid="2847309435442474470">"Chagua \'Hainipendezi\'"</string>
    <string name="lb_playback_controls_repeat_none" msgid="5812341701962930499">"Usirudie Yoyote"</string>
    <string name="lb_playback_controls_repeat_all" msgid="5164826436271322261">"Rudia Zote"</string>
    <string name="lb_playback_controls_repeat_one" msgid="7675097479246139440">"Rudia Moja"</string>
    <string name="lb_playback_controls_shuffle_enable" msgid="7809089255981448519">"Washa Kipengele cha Kuchanganya"</string>
    <string name="lb_playback_controls_shuffle_disable" msgid="8182435535948303910">"Zima Kipengele cha Kuchanganya"</string>
    <string name="lb_playback_controls_high_quality_enable" msgid="1862669142355962638">"Washa Ubora wa Juu"</string>
    <string name="lb_playback_controls_high_quality_disable" msgid="3000046054608531995">"Zima Ubora wa Juu"</string>
    <string name="lb_playback_controls_closed_captioning_enable" msgid="3934392140182327163">"Washa Manukuu"</string>
    <string name="lb_playback_controls_closed_captioning_disable" msgid="5508271941331836786">"Zima Manukuu"</string>
    <string name="lb_playback_controls_picture_in_picture" msgid="8800305194045609275">"Weka Hali ya Picha ndani ya Picha"</string>
    <string name="lb_playback_time_separator" msgid="6549544638083578695">"/"</string>
    <string name="lb_playback_controls_shown" msgid="7794717158616536936">"Inaonyesha udhibiti wa maudhui"</string>
    <string name="lb_playback_controls_hidden" msgid="619396299825306757">"Imeficha udhibiti wa maudhui, bonyeza d-pad ili uuonyeshe"</string>
    <string name="lb_guidedaction_finish_title" msgid="7747913934287176843">"Maliza"</string>
    <string name="lb_guidedaction_continue_title" msgid="1122271825827282965">"Endelea"</string>
    <string name="lb_media_player_error" msgid="8748646000835486516">"Msimbo wa hitilafu wa Kichezaji Maudhui %1$d %2$d za ziada"</string>
    <string name="lb_onboarding_get_started" msgid="7674487829030291492">"ANZA"</string>
    <string name="lb_onboarding_accessibility_next" msgid="4213611627196077555">"Endelea"</string>
</resources>


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Peek;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Navigation;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.SymbolMapping;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Editor.Implementation.Peek
{
    internal sealed class PeekableItemSource : IPeekableItemSource
    {
        private readonly ITextBuffer _textBuffer;
        private readonly IPeekableItemFactory _peekableItemFactory;
        private readonly IPeekResultFactory _peekResultFactory;
        private readonly IWaitIndicator _waitIndicator;

        public PeekableItemSource(
            ITextBuffer textBuffer,
            IPeekableItemFactory peekableItemFactory,
            IPeekResultFactory peekResultFactory,
            IWaitIndicator waitIndicator)
        {
            _textBuffer = textBuffer;
            _peekableItemFactory = peekableItemFactory;
            _peekResultFactory = peekResultFactory;
            _waitIndicator = waitIndicator;
        }

        public void AugmentPeekSession(IPeekSession session, IList<IPeekableItem> peekableItems)
        {
            if (!string.Equals(session.RelationshipName, PredefinedPeekRelationships.Definitions.Name, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            var triggerPoint = session.GetTriggerPoint(_textBuffer.CurrentSnapshot);
            if (!triggerPoint.HasValue)
            {
                return;
            }

            var document = triggerPoint.Value.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
            if (document == null)
            {
                return;
            }

            _waitIndicator.Wait(EditorFeaturesResources.Peek, EditorFeaturesResources.Loading_Peek_information, allowCancel: true, action: context =>
            {
                var cancellationToken = context.CancellationToken;

                IEnumerable<IPeekableItem> results;

                if (!document.SupportsSemanticModel)
                {
                    // For documents without semantic models, just try to use the goto-def service
                    // as a reasonable place to peek at.
                    var goToDefinitionService = document.GetLanguageService<IGoToDefinitionService>();
                    var navigableItems = goToDefinitionService.FindDefinitionsAsync(document, triggerPoint.Value.Position, cancellationToken)
                                                              .WaitAndGetResult(cancellationToken);

                    results = GetPeekableItemsForNavigableItems(navigableItems, document.Project, _peekResultFactory, cancellationToken);
                }
                else
                {
                    var semanticModel = document.GetSemanticModelAsync(cancellationToken).WaitAndGetResult(cancellationToken);
                    var symbol = SymbolFinder.GetSemanticInfoAtPositionAsync(
                        semanticModel,
                        triggerPoint.Value.Position,
                        document.Project.Solution.Workspace,
                        cancellationToken).WaitAndGetResult(cancellationToken)
                                          .GetAnySymbol(includeType: true);

                    if (symbol == null)
                    {
                        return;
                    }

                    symbol = symbol.GetOriginalUnreducedDefinition();

                    // Get the symbol back from the originating workspace
                    var symbolMappingService = document.Project.Solution.Workspace.Services.GetService<ISymbolMappingService>();
                    var mappingResult = symbolMappingService.MapSymbolAsync(document, symbol, cancellationToken)
                                                            .WaitAndGetResult(cancellationToken);

                    mappingResult ??= new SymbolMappingResult(document.Project, symbol);

                    results = _peekableItemFactory.GetPeekableItemsAsync(mappingResult.Symbol, mappingResult.Project, _peekResultFactory, cancellationToken)
                                                 .WaitAndGetResult(cancellationToken);
                }

                peekableItems.AddRange(results);
            });
        }

        private static IEnumerable<IPeekableItem> GetPeekableItemsForNavigableItems(
            IEnumerable<INavigableItem> navigableItems, Project project,
            IPeekResultFactory peekResultFactory,
            CancellationToken cancellationToken)
        {
            if (navigableItems != null)
            {
                var workspace = project.Solution.Workspace;
                var navigationService = workspace.Services.GetService<IDocumentNavigationService>();

                foreach (var item in navigableItems)
                {
                    var document = item.Document;
                    if (navigationService.CanNavigateToPosition(workspace, document.Id, item.SourceSpan.Start))
                    {
                        var text = document.GetTextSynchronously(cancellationToken);
                        var linePositionSpan = text.Lines.GetLinePositionSpan(item.SourceSpan);
                        yield return new ExternalFilePeekableItem(
                            new FileLinePositionSpan(document.FilePath, linePositionSpan),
                            PredefinedPeekRelationships.Definitions, peekResultFactory);
                    }
                }
            }
        }

        public void Dispose()
        {
        }
    }
}


text:
<?php if ($this->session->flashdata('msg')): ?>

        ×
        Success! <?= $this->session->flashdata('msg'); ?>.

<?php endif; ?>


text:
import Vue from 'vue';
import { createStore } from '~/ide/stores';
import emptyState from '~/ide/components/commit_sidebar/empty_state.vue';
import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper';

describe('IDE commit panel empty state', () => {
  let vm;
  let store;

  beforeEach(() => {
    store = createStore();

    const Component = Vue.extend(emptyState);

    Vue.set(store.state, 'noChangesStateSvgPath', 'no-changes');

    vm = createComponentWithStore(Component, store);

    vm.$mount();
  });

  afterEach(() => {
    vm.$destroy();
  });

  it('renders no changes text when last commit message is empty', () => {
    expect(vm.$el.textContent).toContain('No changes');
  });
});


text:
module.exports = function(grunt) {
    'use strict';

    // Force use of Unix newlines
    grunt.util.linefeed = '\n';

    RegExp.quote = function (string) {
      return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
    };

    var fs = require('fs');
    var path = require('path');
    var configBridge = grunt.file.readJSON('../../bower_components/bootstrap/grunt/configBridge.json', { encoding: 'utf8' });

    // Project configuration.
    grunt.initConfig({

        // Metadata.
        pkg: grunt.file.readJSON('package.json'),
        banner: '/*!\n' +
                ' * Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
                ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
                ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
                ' */\n',
        jqueryCheck: configBridge.config.jqueryCheck.join('\n'),
        jqueryVersionCheck: configBridge.config.jqueryVersionCheck.join('\n'),

        less: {
          compileCore: {
            options: {
              strictMath: true,
              sourceMap: false,
              outputSourceFiles: true,
              sourceMapURL: '<%= pkg.name %>.css.map',
              sourceMapFilename: 'css/<%= pkg.name %>.css.map'
            },
            src: 'less/custom-bootstrap.less',
            dest: 'css/<%= pkg.name %>.css'
          },
          compileTheme: {
            options: {
              strictMath: true,
              sourceMap: false,
              outputSourceFiles: true,
              sourceMapURL: '<%= pkg.name %>-theme.css.map',
              sourceMapFilename: 'css/<%= pkg.name %>-theme.css.map'
            },
            src: 'less/theme.less',
            dest: 'css/<%= pkg.name %>-theme.css'
          }
        },

        autoprefixer: {
          options: {
            browsers: configBridge.config.autoprefixerBrowsers
          },
          core: {
            options: {
              map: false
            },
            src: 'css/<%= pkg.name %>.css'
          },
          theme: {
            options: {
              map: false
            },
            src: 'css/<%= pkg.name %>-theme.css'
          }
        },

        csslint: {
          options: {
            csslintrc: '../../bower_components/bootstrap/less/.csslintrc'
          },
          dist: [
            'css/custom-bootstrap.css'
          ]
        },

        cssmin: {
          options: {
            compatibility: 'ie8',
            keepSpecialComments: '0',
            noAdvanced: true
          },
          minifyCore: {
            src: 'css/<%= pkg.name %>.css',
            dest: 'css/<%= pkg.name %>.min.css'
          },
          minifyTheme: {
            src: 'css/<%= pkg.name %>-theme.css',
            dest: 'css/<%= pkg.name %>-theme.min.css'
          }
        },

        usebanner: {
          options: {
            position: 'top',
            banner: '<%= banner %>'
          },
          files: {
            src: 'css/*.css'
          }
        },

        csscomb: {
          options: {
            config: '../../bower_components/bootstrap/less/.csscomb.json'
          },
          dist: {
            expand: true,
            cwd: 'css/',
            src: ['*.css', '!*.min.css'],
            dest: 'css/'
          }
        },

        watch: {
          less: {
            files: 'less/**/*.less',
            tasks: 'default'
          }
        }

    });

    // These plugins provide necessary tasks.
    require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
    require('time-grunt')(grunt);

    // Define your tasks here
    grunt.registerTask('default', ['less:compileCore', 'autoprefixer:core', 'usebanner', 'csscomb:dist', 'cssmin:minifyCore']);//'csslint',

    // CSS distribution task.
    grunt.registerTask('less-compile', ['less:compileCore', 'less:compileTheme']);
    grunt.registerTask('csslint', ['csslint:dist']);//esta dando erro
    grunt.registerTask('dist-css', ['less-compile', 'autoprefixer:core', 'autoprefixer:theme', 'usebanner', 'csscomb:dist', 'cssmin:minifyCore', 'cssmin:minifyTheme']);

};


text:
package org.apache.ode.bpel.compiler.api;

import java.net.URI;

/**
 * Interface for objects that have some relation to a particular
 * location in a source file.
 *
 * @author Maciej Szefler - m s z e f l e r @ g m a i l . c o m
 *
 */
public interface SourceLocation {
    /**
     * URI of the source file.
     * @return
     */
    URI getURI();

    /**
     * Line number.
     * @return
     */
    int getLineNo();

    /**
     * Column number.
     * @return
     */
    int getColumnNo();

    /**
     * Location path (not a file path, but a path in an expression).
     * @return
     */
    String getPath();
}


text:
define([], function () {
    return {
        get: function (url, success, error) {
            request = new XMLHttpRequest();
            request.open('GET', url, true);
            request.onload = function() {
                if (request.status >= 200 && request.status < 400){
                    success(request.responseText);
                } else {
                    error();
                }
            };
            request.onerror = function() {
                error();
            };
            request.send();
        }
    };
});


text:
using ppapi::StringVar;
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_ImageData_API;
using blink::WebFloatPoint;
using blink::WebFloatRect;
using blink::WebFont;
using blink::WebFontDescription;
using blink::WebRect;
using blink::WebTextRun;
using blink::WebCanvas;

namespace content {

namespace {

// Same as WebPreferences::kCommonScript. I'd use that directly here, but get an
// undefined reference linker error.
const char kCommonScript[] = "Zyyy";

base::string16 GetFontFromMap(
    const webkit_glue::ScriptFontFamilyMap& map,
    const std::string& script) {
  webkit_glue::ScriptFontFamilyMap::const_iterator it =
      map.find(script);
  if (it != map.end())
    return it->second;
  return base::string16();
}

// Splits a PP_BrowserFont_Trusted_TextRun into a sequence or LTR and RTL
// WebTextRuns that can be used for WebKit. Normally WebKit does this for us,
// but the font drawing and measurement routines we call happen after this
// step. So for correct rendering of RTL content, we need to do it ourselves.
class TextRunCollection {
 public:
  explicit TextRunCollection(const PP_BrowserFont_Trusted_TextRun& run)
      : bidi_(NULL),
        num_runs_(0) {
    StringVar* text_string = StringVar::FromPPVar(run.text);
    if (!text_string)
      return;  // Leave num_runs_ = 0 so we'll do nothing.
    text_ = base::UTF8ToUTF16(text_string->value());

    if (run.override_direction) {
      // Skip autodetection.
      num_runs_ = 1;
      override_run_ = WebTextRun(text_, PP_ToBool(run.rtl), true);
    } else {
      bidi_ = ubidi_open();
      UErrorCode uerror = U_ZERO_ERROR;
      ubidi_setPara(bidi_, text_.data(), text_.size(), run.rtl, NULL, &uerror);
      if (U_SUCCESS(uerror))
        num_runs_ = ubidi_countRuns(bidi_, &uerror);
    }
  }

  ~TextRunCollection() {
    if (bidi_)
      ubidi_close(bidi_);
  }

  const base::string16& text() const { return text_; }
  int num_runs() const { return num_runs_; }

  // Returns a WebTextRun with the info for the run at the given index.
  // The range covered by the run is in the two output params.
  WebTextRun GetRunAt(int index, int32_t* run_start, int32_t* run_len) const {
    DCHECK(index < num_runs_);
    if (bidi_) {
      bool run_rtl = !!ubidi_getVisualRun(bidi_, index, run_start, run_len);
      return WebTextRun(base::string16(&text_[*run_start], *run_len),
                        run_rtl, true);
    }

    // Override run, return the single one.
    DCHECK(index == 0);
    *run_start = 0;
    *run_len = static_cast<int32_t>(text_.size());
    return override_run_;
  }

 private:
  // Will be null if we skipped autodetection.
  UBiDi* bidi_;

  // Text of all the runs.
  base::string16 text_;

  int num_runs_;

  // When the content specifies override_direction (bidi_ is null) then this
  // will contain the single text run for WebKit.
  WebTextRun override_run_;

  DISALLOW_COPY_AND_ASSIGN(TextRunCollection);
};

bool PPTextRunToWebTextRun(const PP_BrowserFont_Trusted_TextRun& text,
                           WebTextRun* run) {
  StringVar* text_string = StringVar::FromPPVar(text.text);
  if (!text_string)
    return false;

  *run = WebTextRun(base::UTF8ToUTF16(text_string->value()),
                    PP_ToBool(text.rtl),
                    PP_ToBool(text.override_direction));
  return true;
}

// The PP_* version lacks "None", so is just one value shifted from the
// WebFontDescription version. These values are checked in
// PPFontDescToWebFontDesc to make sure the conversion is correct. This is a
// macro so it can also be used in the COMPILE_ASSERTS.
#define PP_FAMILY_TO_WEB_FAMILY(f) \
  static_cast<WebFontDescription::GenericFamily>(f + 1)

// Assumes the given PP_FontDescription has been validated.
WebFontDescription PPFontDescToWebFontDesc(
    const PP_BrowserFont_Trusted_Description& font,
    const ppapi::Preferences& prefs) {
  // Verify that the enums match so we can just static cast.
  COMPILE_ASSERT(static_cast<int>(WebFontDescription::Weight100) ==
                 static_cast<int>(PP_BROWSERFONT_TRUSTED_WEIGHT_100),
                 FontWeight100);
  COMPILE_ASSERT(static_cast<int>(WebFontDescription::Weight900) ==
                 static_cast<int>(PP_BROWSERFONT_TRUSTED_WEIGHT_900),
                 FontWeight900);
  COMPILE_ASSERT(WebFontDescription::GenericFamilyStandard ==
                 PP_FAMILY_TO_WEB_FAMILY(PP_FONTFAMILY_DEFAULT),
                 StandardFamily);
  COMPILE_ASSERT(WebFontDescription::GenericFamilySerif ==
                 PP_FAMILY_TO_WEB_FAMILY(PP_FONTFAMILY_SERIF),
                 SerifFamily);
  COMPILE_ASSERT(WebFontDescription::GenericFamilySansSerif ==
                 PP_FAMILY_TO_WEB_FAMILY(PP_FONTFAMILY_SANSSERIF),
                 SansSerifFamily);
  COMPILE_ASSERT(WebFontDescription::GenericFamilyMonospace ==
                 PP_FAMILY_TO_WEB_FAMILY(PP_FONTFAMILY_MONOSPACE),
                 MonospaceFamily);

  StringVar* face_name = StringVar::FromPPVar(font.face);  // Possibly null.

  WebFontDescription result;
  base::string16 resolved_family;
  if (!face_name || face_name->value().empty()) {
    // Resolve the generic family.
    switch (font.family) {
      case PP_BROWSERFONT_TRUSTED_FAMILY_SERIF:
        resolved_family = GetFontFromMap(prefs.serif_font_family_map,
                                         kCommonScript);
        break;
      case PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF:
        resolved_family = GetFontFromMap(prefs.sans_serif_font_family_map,
                                         kCommonScript);
        break;
      case PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE:
        resolved_family = GetFontFromMap(prefs.fixed_font_family_map,
                                         kCommonScript);
        break;
      case PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT:
      default:
        resolved_family = GetFontFromMap(prefs.standard_font_family_map,
                                         kCommonScript);
        break;
    }
  } else {
    // Use the exact font.
    resolved_family = base::UTF8ToUTF16(face_name->value());
  }
  result.family = resolved_family;

  result.genericFamily = PP_FAMILY_TO_WEB_FAMILY(font.family);

  if (font.size == 0) {
    // Resolve the default font size, using the resolved family to see if
    // we should use the fixed or regular font size. It's difficult at this
    // level to detect if the requested font is fixed width, so we only apply
    // the alternate font size to the default fixed font family.
    if (StringToLowerASCII(resolved_family) ==
        StringToLowerASCII(GetFontFromMap(prefs.fixed_font_family_map,
                                          kCommonScript)))
      result.size = static_cast<float>(prefs.default_fixed_font_size);
    else
      result.size = static_cast<float>(prefs.default_font_size);
  } else {
    // Use the exact size.
    result.size = static_cast<float>(font.size);
  }

  result.italic = font.italic != PP_FALSE;
  result.smallCaps = font.small_caps != PP_FALSE;
  result.weight = static_cast<WebFontDescription::Weight>(font.weight);
  result.letterSpacing = static_cast<short>(font.letter_spacing);
  result.wordSpacing = static_cast<short>(font.word_spacing);
  return result;
}

}  // namespace

// static
bool BrowserFontResource_Trusted::IsPPFontDescriptionValid(
    const PP_BrowserFont_Trusted_Description& desc) {
  // Check validity of string. We can't check the actual text since we could
  // be on the wrong thread and don't know if we're in the plugin or the host.
  if (desc.face.type != PP_VARTYPE_STRING &&
      desc.face.type != PP_VARTYPE_UNDEFINED)
    return false;

  // Check enum ranges.
  if (static_cast<int>(desc.family) < PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT ||
      static_cast<int>(desc.family) > PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE)
    return false;
  if (static_cast<int>(desc.weight) < PP_BROWSERFONT_TRUSTED_WEIGHT_100 ||
      static_cast<int>(desc.weight) > PP_BROWSERFONT_TRUSTED_WEIGHT_900)
    return false;

  // Check for excessive sizes which may cause layout to get confused.
  if (desc.size > 200)
    return false;

  return true;
}

BrowserFontResource_Trusted::BrowserFontResource_Trusted(
    ppapi::proxy::Connection connection,
    PP_Instance instance,
    const PP_BrowserFont_Trusted_Description& desc,
    const ppapi::Preferences& prefs)
    : PluginResource(connection, instance),
      font_(WebFont::create(PPFontDescToWebFontDesc(desc, prefs))) {
}

BrowserFontResource_Trusted::~BrowserFontResource_Trusted() {
}

ppapi::thunk::PPB_BrowserFont_Trusted_API*
BrowserFontResource_Trusted::AsPPB_BrowserFont_Trusted_API() {
  return this;
}

PP_Bool BrowserFontResource_Trusted::Describe(
    PP_BrowserFont_Trusted_Description* description,
    PP_BrowserFont_Trusted_Metrics* metrics) {
  if (description->face.type != PP_VARTYPE_UNDEFINED)
    return PP_FALSE;

  // While converting the other way in PPFontDescToWebFontDesc we validated
  // that the enums can be casted.
  WebFontDescription web_desc = font_->fontDescription();
  description->face =
      StringVar::StringToPPVar(base::UTF16ToUTF8(web_desc.family));
  description->family =
      static_cast<PP_BrowserFont_Trusted_Family>(web_desc.genericFamily);
  description->size = static_cast<uint32_t>(web_desc.size);
  description->weight = static_cast<PP_BrowserFont_Trusted_Weight>(
      web_desc.weight);
  description->italic = web_desc.italic ? PP_TRUE : PP_FALSE;
  description->small_caps = web_desc.smallCaps ? PP_TRUE : PP_FALSE;
  description->letter_spacing = static_cast<int32_t>(web_desc.letterSpacing);
  description->word_spacing = static_cast<int32_t>(web_desc.wordSpacing);

  metrics->height = font_->height();
  metrics->ascent = font_->ascent();
  metrics->descent = font_->descent();
  metrics->line_spacing = font_->lineSpacing();
  metrics->x_height = static_cast<int32_t>(font_->xHeight());

  // Convert the string.
  return PP_TRUE;
}

PP_Bool BrowserFontResource_Trusted::DrawTextAt(
    PP_Resource image_data,
    const PP_BrowserFont_Trusted_TextRun* text,
    const PP_Point* position,
    uint32_t color,
    const PP_Rect* clip,
    PP_Bool image_data_is_opaque) {
  PP_Bool result = PP_FALSE;
  // Get and map the image data we're painting to.
  EnterResourceNoLock<PPB_ImageData_API> enter(image_data, true);
  if (enter.failed())
    return result;

  PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(
      enter.object());
  SkCanvas* canvas = image->GetPlatformCanvas();
  bool needs_unmapping = false;
  if (!canvas) {
    needs_unmapping = true;
    image->Map();
    canvas = image->GetPlatformCanvas();
    if (!canvas)
      return result;  // Failure mapping.
  }

  DrawTextToCanvas(canvas, *text, position, color, clip, image_data_is_opaque);

  if (needs_unmapping)
    image->Unmap();
  return PP_TRUE;
}

int32_t BrowserFontResource_Trusted::MeasureText(
    const PP_BrowserFont_Trusted_TextRun* text) {
  WebTextRun run;
  if (!PPTextRunToWebTextRun(*text, &run))
    return -1;
  return font_->calculateWidth(run);
}

uint32_t BrowserFontResource_Trusted::CharacterOffsetForPixel(
    const PP_BrowserFont_Trusted_TextRun* text,
    int32_t pixel_position) {
  TextRunCollection runs(*text);
  int32_t cur_pixel_offset = 0;
  for (int i = 0; i < runs.num_runs(); i++) {
    int32_t run_begin = 0;
    int32_t run_len = 0;
    WebTextRun run = runs.GetRunAt(i, &run_begin, &run_len);
    int run_width = font_->calculateWidth(run);
    if (pixel_position < cur_pixel_offset + run_width) {
      // Offset is in this run.
      return static_cast<uint32_t>(font_->offsetForPosition(
              run, static_cast<float>(pixel_position - cur_pixel_offset))) +
          run_begin;
    }
    cur_pixel_offset += run_width;
  }
  return runs.text().size();
}

int32_t BrowserFontResource_Trusted::PixelOffsetForCharacter(
    const PP_BrowserFont_Trusted_TextRun* text,
    uint32_t char_offset) {
  TextRunCollection runs(*text);
  int32_t cur_pixel_offset = 0;
  for (int i = 0; i < runs.num_runs(); i++) {
    int32_t run_begin = 0;
    int32_t run_len = 0;
    WebTextRun run = runs.GetRunAt(i, &run_begin, &run_len);
    if (char_offset >= static_cast<uint32_t>(run_begin) &&
        char_offset < static_cast<uint32_t>(run_begin + run_len)) {
      // Character we're looking for is in this run.
      //
      // Here we ask WebKit to give us the rectangle around the character in
      // question, and then return the left edge. If we asked for a range of
      // 0 characters starting at the character in question, it would give us
      // a 0-width rect around the insertion point. But that will be on the
      // right side of the character for an RTL run, which would be wrong.
      WebFloatRect rect = font_->selectionRectForText(
          run, WebFloatPoint(0.0f, 0.0f), font_->height(),
          char_offset - run_begin, char_offset - run_begin + 1);
      return cur_pixel_offset + static_cast<int>(rect.x);
    } else {
      // Character is past this run, account for the pixels and continue
      // looking.
      cur_pixel_offset += font_->calculateWidth(run);
    }
  }
  return -1;  // Requested a char beyond the end.
}

void BrowserFontResource_Trusted::DrawTextToCanvas(
    SkCanvas* destination,
    const PP_BrowserFont_Trusted_TextRun& text,
    const PP_Point* position,
    uint32_t color,
    const PP_Rect* clip,
    PP_Bool image_data_is_opaque) {
  // Convert position and clip.
  WebFloatPoint web_position(static_cast<float>(position->x),
                             static_cast<float>(position->y));
  WebRect web_clip;
  if (!clip) {
    // Use entire canvas. SkCanvas doesn't have a size on it, so we just use
    // the current clip bounds.
    SkRect skclip;
    destination->getClipBounds(&skclip);
    web_clip = WebRect(skclip.fLeft, skclip.fTop, skclip.fRight - skclip.fLeft,
                       skclip.fBottom - skclip.fTop);
  } else {
    web_clip = WebRect(clip->point.x, clip->point.y,
                       clip->size.width, clip->size.height);
  }

  TextRunCollection runs(text);
  for (int i = 0; i < runs.num_runs(); i++) {
    int32_t run_begin = 0;
    int32_t run_len = 0;
    WebTextRun run = runs.GetRunAt(i, &run_begin, &run_len);
    font_->drawText(destination, run, web_position, color, web_clip,
                    PP_ToBool(image_data_is_opaque));

    // Advance to the next run. Note that we avoid doing this for the last run
    // since it's unnecessary, measuring text is slow, and most of the time
    // there will be only one run anyway.
    if (i != runs.num_runs() - 1)
      web_position.x += font_->calculateWidth(run);
  }
}

}  // namespace content


text:
With our german-speaking podcast Working Draft we introduced a new community to gather our listeners and interested engineers and designers to discuss related topics.

## Unsere Idee

> Wir haben uns zur Aufgabe gemacht, die deutschsprachige Web-Entwickler:innen und -Designer:innen Community näher zusammen zu bringen.
>
> Mit dem Working Draft Podcast versuchen wir, jede Woche spannende Themen aus den Bereichen Frontend-Entwicklung, Backend-Technologien, täglicher Zusammenarbeit und mehr mit unseren Gästen zusammen an die Hörer:innen zu bringen.
>
> Mit unserem Slack-Channel wollen wir noch näher zusammen kommen - gerade in der Zeit, in der die Remote-Arbeit ein "normaler" Bestandteil unserer täglichen Arbeit geworden ist.
>
> Lasst uns über Themen austauschen, die unsere Branche beschäftigen, die nächste Konferenz finden, auf der wir uns treffen können und job-suchende und -anbietende zusammen bringen.

## Spannend?

Wenn sich die Communiy für dich spannend anhört, schau einfach mal auf draft.community vorbei.