text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _regenerator = require('babel-runtime/regenerator');

var _regenerator2 = _interopRequireDefault(_regenerator);

var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');

var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);

exports.default = function (client, name, keyPair) {
  var _this = this;

  var defaultValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

  var record = client.record.getRecord(name);
  var readyPromise = new Promise(function (resolve, reject) {
    record.once('ready', function () {
      return resolve();
    });
    record.once('error', reject);
  });
  var pemPublicKey = keyPair.exportKey('pkcs1-public-pem');
  var currentData = {};
  readyPromise.then(function () {
    currentData = record.get();
  });
  var callbacks = {};
  var errbacks = new Set([]);
  var getSignature = function getSignature(value) {
    var data = Object.assign({}, value);
    delete data.signature;
    var pairs = Object.keys(data).map(function (key) {
      return [key, data[key]];
    });
    pairs.sort(function (x, y) {
      return x[0] > y[0] ? 1 : -1;
    });
    var pairString = JSON.stringify(pairs);
    var signature = keyPair.sign(pairString).toString('base64');
    return signature;
  };
  record.subscribe(function () {
    var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(value) {
      var data, signature, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, errback;

      return _regenerator2.default.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              _context.prev = 0;
              data = Object.assign({}, value);
              signature = data.signature;

              delete data.signature;

              if (!(Object.keys(data).length > 0 && signature !== getSignature(data))) {
                _context.next = 6;
                break;
              }

              throw new Error('Invalid signature for record ' + name);

            case 6:
              Object.keys(callbacks).forEach(function (k) {
                if (!data[k] && !currentData[k]) {
                  callbacks[k].forEach(function (callback) {
                    return callback();
                  });
                }
              });
              Object.keys(currentData).forEach(function (k) {
                if (!data[k] && callbacks[k]) {
                  callbacks[k].forEach(function (callback) {
                    return callback();
                  });
                }
              });
              Object.keys(data).forEach(function (k) {
                if (data[k] !== currentData[k] && callbacks[k]) {
                  callbacks[k].forEach(function (callback) {
                    return callback(data[k]);
                  });
                }
              });
              currentData = data;
              _context.next = 33;
              break;

            case 12:
              _context.prev = 12;
              _context.t0 = _context['catch'](0);
              _iteratorNormalCompletion = true;
              _didIteratorError = false;
              _iteratorError = undefined;
              _context.prev = 17;

              for (_iterator = errbacks[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                errback = _step.value;
                // eslint-disable-line no-restricted-syntax
                errback(_context.t0);
              }
              _context.next = 25;
              break;

            case 21:
              _context.prev = 21;
              _context.t1 = _context['catch'](17);
              _didIteratorError = true;
              _iteratorError = _context.t1;

            case 25:
              _context.prev = 25;
              _context.prev = 26;

              if (!_iteratorNormalCompletion && _iterator.return) {
                _iterator.return();
              }

            case 28:
              _context.prev = 28;

              if (!_didIteratorError) {
                _context.next = 31;
                break;
              }

              throw _iteratorError;

            case 31:
              return _context.finish(28);

            case 32:
              return _context.finish(25);

            case 33:
            case 'end':
              return _context.stop();
          }
        }
      }, _callee, _this, [[0, 12], [17, 21, 25, 33], [26,, 28, 32]]);
    }));

    return function (_x2) {
      return _ref.apply(this, arguments);
    };
  }(), true);
  var subscribe = function () {
    var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(key, callback, errback) {
      return _regenerator2.default.wrap(function _callee2$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              callbacks[key] = callbacks[key] || [];
              callbacks[key].push(callback);
              if (errback) {
                errbacks.add(errback);
              }

            case 3:
            case 'end':
              return _context2.stop();
          }
        }
      }, _callee2, _this);
    }));

    return function subscribe(_x3, _x4, _x5) {
      return _ref2.apply(this, arguments);
    };
  }();
  var unsubscribe = function unsubscribe(key, callback, errback) {
    callbacks[key] = callbacks[key] || [];
    callbacks[key] = callbacks[key].filter(function (cb) {
      return cb !== callback;
    });
    if (errback) {
      errbacks.delete(errback);
    }
  };
  var discard = function () {
    var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
      return _regenerator2.default.wrap(function _callee3$(_context3) {
        while (1) {
          switch (_context3.prev = _context3.next) {
            case 0:
              if (!record.isDestroyed) {
                _context3.next = 2;
                break;
              }

              return _context3.abrupt('return');

            case 2:
              record.unsubscribe();
              _context3.next = 5;
              return new Promise(function (resolve, reject) {
                record.once('discard', resolve);
                record.once('error', reject);
                record.discard();
              });

            case 5:
            case 'end':
              return _context3.stop();
          }
        }
      }, _callee3, _this);
    }));

    return function discard() {
      return _ref3.apply(this, arguments);
    };
  }();
  var set = function () {
    var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(key, value) {
      var remoteValue, data;
      return _regenerator2.default.wrap(function _callee4$(_context4) {
        while (1) {
          switch (_context4.prev = _context4.next) {
            case 0:
              _context4.next = 2;
              return readyPromise;

            case 2:
              remoteValue = record.get();

              if (Object.keys(remoteValue).length > 0 && remoteValue.signature !== getSignature(remoteValue)) {
                console.error('Invalid signature for record ' + name + ', clearing.'); // eslint-disable-line no-console
                remoteValue = {};
              }
              data = Object.assign({}, remoteValue, defaultValue, {
                publicKey: pemPublicKey
              });

              data[key] = value;
              data.signature = getSignature(data);
              _context4.next = 9;
              return new Promise(function (resolve, reject) {
                record.set(data, function (errorMessage) {
                  if (errorMessage) {
                    reject(new Error(errorMessage));
                  } else {
                    resolve();
                  }
                });
              });

            case 9:
            case 'end':
              return _context4.stop();
          }
        }
      }, _callee4, _this);
    }));

    return function set(_x6, _x7) {
      return _ref4.apply(this, arguments);
    };
  }();
  return { set: set, subscribe: subscribe, unsubscribe: unsubscribe, discard: discard, readyPromise: readyPromise };
};

var _deepstream = require('deepstream.io-client-js');

var _deepstream2 = _interopRequireDefault(_deepstream);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }


text:
<?php

namespace AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use AppBundle\Entity\Video;

class VideoType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $formBuilder, array $options)
    {
        $formBuilder
            ->add('link', TextType::class)
            ->add('submit', SubmitType::class)
        ;
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => Video::class,
        ));
    }
}

redpajama_set_name: RedPajamaGithub


text:
<Record>
<Term>Membrane Transport Modulators</Term>
<SemanticType>Pharmacologic Substance</SemanticType>
<ParentTerm>Molecular Mechanisms of Pharmacological Action</ParentTerm>
<ClassificationPath>Chemical Actions and Uses/Pharmacologic Actions/Molecular Mechanisms of Pharmacological Action/Membrane Transport Modulators</ClassificationPath>
<BroaderTerm>Pharmacologic Actions</BroaderTerm>
<BroaderTerm>Membrane Transport Modulators</BroaderTerm>
<BroaderTerm>Chemical Actions and Uses</BroaderTerm>
<BroaderTerm>Molecular Mechanisms of Pharmacological Action</BroaderTerm>
<ChildTerm>Calcium Channel Agonists</ChildTerm>
<ChildTerm>Calcium Channel Blockers</ChildTerm>
<ChildTerm>Potassium Channel Blockers</ChildTerm>
<ChildTerm>Sodium Channel Blockers</ChildTerm>
<ChildTerm>Sodium Chloride Symporter Inhibitors</ChildTerm>
<ChildTerm>Sodium Potassium Chloride Symporter Inhibitors</ChildTerm>
<ChildTerm>Ionophores</ChildTerm>
<Synonym>Membrane Transport Modulators</Synonym>
<Synonym>Membrane Transport Protein Modulators</Synonym>
<Description>Agents that affect ION PUMPS; ION CHANNELS; ABC TRANSPORTERS; and other MEMBRANE TRANSPORT PROTEINS.</Description>
<Source>MeSH</Source>
</Record>


text:
package search

import (
	"math"
	"time"

	"github.com/blugelabs/bluge/numeric"
	"github.com/blugelabs/bluge/numeric/geo"
)

type TextValueSource interface {
	Fields() []string
	Value(match *DocumentMatch) []byte
}

type TextValuesSource interface {
	Fields() []string
	Values(match *DocumentMatch) [][]byte
}

type NumericValueSource interface {
	Fields() []string
	Number(match *DocumentMatch) float64
}

type NumericValuesSource interface {
	Fields() []string
	Numbers(match *DocumentMatch) []float64
}

type DateValueSource interface {
	Fields() []string
	Date(match *DocumentMatch) time.Time
}

type DateValuesSource interface {
	Fields() []string
	Dates(match *DocumentMatch) []time.Time
}

type GeoPointValueSource interface {
	Fields() []string
	GeoPoint(match *DocumentMatch) *geo.Point
}

type GeoPointValuesSource interface {
	Fields() []string
	GeoPoints(match *DocumentMatch) []*geo.Point
}

type FieldSource string

func Field(field string) FieldSource {
	return FieldSource(field)
}

func (f FieldSource) Fields() []string {
	return []string{string(f)}
}

func (f FieldSource) Value(match *DocumentMatch) []byte {
	return firstTerm(RemoveNumericPaddedTerms(f.Values(match)))
}

func (f FieldSource) Values(match *DocumentMatch) [][]byte {
	return match.DocValues(string(f))
}

func (f FieldSource) Number(match *DocumentMatch) float64 {
	return firstNumber(f.Numbers(match))
}

func (f FieldSource) Numbers(match *DocumentMatch) []float64 {
	var rv []float64
	for _, term := range f.Values(match) {
		prefixCoded := numeric.PrefixCoded(term)
		shift, err := prefixCoded.Shift()
		if err == nil && shift == 0 {
			i64, err := prefixCoded.Int64()
			if err == nil {
				f64 := numeric.Int64ToFloat64(i64)
				rv = append(rv, f64)
			}
		}
	}
	return rv
}

func (f FieldSource) Date(match *DocumentMatch) time.Time {
	return firstDate(f.Dates(match))
}

func (f FieldSource) Dates(match *DocumentMatch) []time.Time {
	var rv []time.Time
	for _, term := range f.Values(match) {
		prefixCoded := numeric.PrefixCoded(term)
		shift, err := prefixCoded.Shift()
		if err == nil && shift == 0 {
			i64, err := prefixCoded.Int64()
			if err == nil {
				t := time.Unix(0, i64)
				rv = append(rv, t)
			}
		}
	}
	return rv
}

func (f FieldSource) GeoPoint(match *DocumentMatch) *geo.Point {
	return firstGeoPoint(f.GeoPoints(match))
}

func (f FieldSource) GeoPoints(match *DocumentMatch) []*geo.Point {
	var rv []*geo.Point
	for _, term := range f.Values(match) {
		prefixCoded := numeric.PrefixCoded(term)
		shift, err := prefixCoded.Shift()
		if err == nil && shift == 0 {
			i64, err := prefixCoded.Int64()
			if err == nil {
				rv = append(rv, &geo.Point{
					Lon: geo.MortonUnhashLon(uint64(i64)),
					Lat: geo.MortonUnhashLat(uint64(i64)),
				})
			}
		}
	}
	return rv
}

type ScoreSource struct{}

func DocumentScore() *ScoreSource {
	return &ScoreSource{}
}

func (n *ScoreSource) Fields() []string {
	return []string{}
}

func (n *ScoreSource) Value(d *DocumentMatch) []byte {
	return numeric.MustNewPrefixCodedInt64(numeric.Float64ToInt64(d.Score), 0)
}

func (n *ScoreSource) Values(d *DocumentMatch) [][]byte {
	return [][]byte{numeric.MustNewPrefixCodedInt64(numeric.Float64ToInt64(d.Score), 0)}
}

func (n *ScoreSource) Number(d *DocumentMatch) float64 {
	return d.Score
}

func (n *ScoreSource) Numbers(d *DocumentMatch) []float64 {
	return []float64{d.Score}
}

type MissingTextValueSource struct {
	primary, replacement TextValueSource
}

func MissingTextValue(primary, replacement TextValueSource) *MissingTextValueSource {
	return &MissingTextValueSource{
		primary:     primary,
		replacement: replacement,
	}
}

func (f *MissingTextValueSource) Fields() []string {
	return append(f.primary.Fields(), f.replacement.Fields()...)
}

func (f *MissingTextValueSource) Value(match *DocumentMatch) []byte {
	primaryValue := f.primary.Value(match)
	if primaryValue == nil {
		return f.replacement.Value(match)
	}
	return primaryValue
}

type MissingNumericSource struct {
	primary, replacement NumericValuesSource
}

func MissingNumeric(primary, replacement NumericValuesSource) *MissingNumericSource {
	return &MissingNumericSource{
		primary:     primary,
		replacement: replacement,
	}
}

func (f *MissingNumericSource) Fields() []string {
	var rv []string
	rv = append(rv, f.primary.Fields()...)
	rv = append(rv, f.replacement.Fields()...)
	return rv
}

func (f *MissingNumericSource) Numbers(match *DocumentMatch) []float64 {
	primaryValues := f.primary.Numbers(match)
	if len(primaryValues) == 0 {
		return f.replacement.Numbers(match)
	}
	return primaryValues
}

type MissingDateSource struct {
	primary, replacement DateValuesSource
}

func MissingDate(primary, replacement DateValuesSource) *MissingDateSource {
	return &MissingDateSource{
		primary:     primary,
		replacement: replacement,
	}
}

func (f *MissingDateSource) Fields() []string {
	var rv []string
	rv = append(rv, f.primary.Fields()...)
	rv = append(rv, f.replacement.Fields()...)
	return rv
}

func (f *MissingDateSource) Numbers(match *DocumentMatch) []time.Time {
	primaryValues := f.primary.Dates(match)
	if len(primaryValues) == 0 {
		return f.replacement.Dates(match)
	}
	return primaryValues
}

type MissingGeoPointSource struct {
	primary, replacement GeoPointValuesSource
}

func MissingGeoPoints(primary, replacement GeoPointValuesSource) *MissingGeoPointSource {
	return &MissingGeoPointSource{
		primary:     primary,
		replacement: replacement,
	}
}

func (f *MissingGeoPointSource) Fields() []string {
	var rv []string
	rv = append(rv, f.primary.Fields()...)
	rv = append(rv, f.replacement.Fields()...)
	return rv
}

func (f *MissingGeoPointSource) GeoPoints(match *DocumentMatch) []*geo.Point {
	primaryValues := f.primary.GeoPoints(match)
	if len(primaryValues) == 0 {
		return f.replacement.GeoPoints(match)
	}
	return primaryValues
}

type FilteringTextSource struct {
	source TextValuesSource
	filter func([]byte) bool
}

func FilterText(source TextValuesSource, filter func([]byte) bool) *FilteringTextSource {
	return &FilteringTextSource{
		source: source,
		filter: filter,
	}
}

func (f *FilteringTextSource) Fields() []string {
	return f.source.Fields()
}

func (f *FilteringTextSource) Values(match *DocumentMatch) [][]byte {
	var rv [][]byte
	values := f.source.Values(match)
	for _, val := range values {
		if f.filter(val) {
			rv = append(rv, val)
		}
	}
	return rv
}

func firstTerm(sourceValues [][]byte) []byte {
	if len(sourceValues) > 0 {
		return sourceValues[0]
	}
	return nil
}

func firstNumber(sourceValues []float64) float64 {
	if len(sourceValues) > 0 {
		return sourceValues[0]
	}
	return math.NaN()
}

func firstDate(sourceValues []time.Time) time.Time {
	if len(sourceValues) > 0 {
		return sourceValues[0]
	}
	return time.Time{}
}

func firstGeoPoint(sourceValues []*geo.Point) *geo.Point {
	if len(sourceValues) > 0 {
		return sourceValues[0]
	}
	return nil
}

func RemoveNumericPaddedTerms(sourceValues [][]byte) [][]byte {
	var allValidNumeric = true
	var zeroPaddedNumeric [][]byte
	for _, term := range sourceValues {
		prefixCoded := numeric.PrefixCoded(term)
		shift, err := prefixCoded.Shift()
		if err == nil && shift == 0 {
			zeroPaddedNumeric = append(zeroPaddedNumeric, term)
		} else {
			allValidNumeric = false
			break
		}
	}
	// if all terms we saw looked like valid numeric encoded terms
	// AND there was at least one zero padded numeric term
	// return only the zero padded numeric terms
	if allValidNumeric && len(zeroPaddedNumeric) > 0 {
		return zeroPaddedNumeric
	}
	// otherwise return all the terms
	return sourceValues
}

type PointDistanceSource struct {
	a, b GeoPointValueSource
	unit geo.DistanceUnit
}

func NewGeoPointDistanceSource(a, b GeoPointValueSource, unit geo.DistanceUnit) *PointDistanceSource {
	return &PointDistanceSource{
		a:    a,
		b:    b,
		unit: unit,
	}
}

func (p PointDistanceSource) Fields() []string {
	return append(p.a.Fields(), p.b.Fields()...)
}

func (p PointDistanceSource) Value(match *DocumentMatch) []byte {
	distInt64 := numeric.Float64ToInt64(p.Number(match))
	return numeric.MustNewPrefixCodedInt64(distInt64, 0)
}

func (p PointDistanceSource) Values(match *DocumentMatch) [][]byte {
	return [][]byte{p.Value(match)}
}

func (p PointDistanceSource) Number(match *DocumentMatch) float64 {
	pointA := p.a.GeoPoint(match)
	pointB := p.b.GeoPoint(match)
	dist := geo.Haversin(pointA.Lon, pointA.Lat, pointB.Lon, pointB.Lat)
	// dist is returned in km, convert to desired unit
	return geo.Convert(dist, geo.Kilometer, p.unit)
}

func (p PointDistanceSource) Numbers(match *DocumentMatch) []float64 {
	return []float64{p.Number(match)}
}

type ConstantGeoPointSource geo.Point

func NewConstantGeoPointSource(p geo.Point) *ConstantGeoPointSource {
	rv := ConstantGeoPointSource(p)
	return &rv
}

func (p *ConstantGeoPointSource) Fields() []string {
	return nil
}

func (p *ConstantGeoPointSource) GeoPoint(_ *DocumentMatch) *geo.Point {
	var gp = geo.Point(*p)
	return &gp
}

type ConstantTextValueSource []byte

func (c ConstantTextValueSource) Fields() []string {
	return nil
}

func (c ConstantTextValueSource) Value(_ *DocumentMatch) []byte {
	return c
}


text:
from django.template.defaulttags import register

import pytz
import json

@register.filter
def get_item(dictionary, key):
    return dictionary.get(key)


text:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Jasmine Spec Runner v2.3.4</title>

  <link rel="shortcut icon" type="image/png" href="lib/jasmine-2.3.4/jasmine_favicon.png">
  <link rel="stylesheet" href="lib/jasmine-2.3.4/jasmine.css">

  <!--snippet for Jquery library  to handle Ajax call-->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

  <script src="lib/jquery-2.1.4.min.js"></script>
  <script src="lib/jasmine-2.3.4/jasmine.js"></script>
  <script src="lib/jasmine-2.3.4/jasmine-html.js"></script>
  <script src="lib/jasmine-2.3.4/boot.js"></script>

  <!-- include source files here... -->
  <script src="src/invertedIndex.js"></script>

  <!-- include spec files here... -->
  <script src="spec/invertedIndexTest.js"></script>
</head>

<body>
</body>
</html>


text:
#ifndef JAPA_DYNAMIC_TABLE_H
#define JAPA_DYNAMIC_TABLE_H

#include <memory>

namespace japa
{

template< class T > class DynamicTableIterator;

/**
 * \french
 * Permet de r�soudre un probl�me avec une approche de programmation
 * dynamique.
 *
 * Cette classe est abstraite, car diff�rents type de probl�mes demandent
 * diff�rentes stuctures de donn�es pour �tre r�solus optimalement.
 *
 * @param T Le type utilis� pour noter le score.
 * \endfrench
 *
 * \english
 * Dynamic programming problem solving framework.
 *
 * This is an abstract class because different type of problems need
 * different data structures to be best resolved.
 *
 * @param T The score's data type.
 * \endenglish
 *
 *
 * @version 1.1
 */
template< class T >
class DynamicTable
{
public :
    /**
     * \french
     * R�soud un probl�me par programmation dynamique.
     * \endfrench
     *
     * \english
     * Solve a problem using dynamic programming.
     * \endenglish
     */
    virtual void solve() = 0;

    /**
     * \french
     * Trouve le score associ� � une cellule.
     *
     * @param i La coordonn�e en i de la cellule.
     * @param j La coordonn�e en j de la cellule.
     * @param score ( out )Le score associ� � la cellule.
     *
     * @return true si un score est associ� � la cellule,
     *         false sinon.  Dans un tel cas, la valeur de
     *         score est ind�termin�e.
     * \endfrench
     *
     * \english
     * Gets a cell's score.
     *
     * @param i Cell's i coordinate.
     * @param j Cell's j coordinate
     * @param score A reference to the variable which will contain the score.
     *
     * @return true if the cell's score is defined.
     *         false if the cell's score is undefined, which will
     *         yield no coherent value to score variable.
     * \endenglish
     */
    virtual bool getScore( const int i, const int j, T& score ) const = 0;

    /**
     * \french
     * Permet de retracer la solution optimale.
     * \endfrench
     *
     * \english
     * Iterator over the optimal solution.
     * \endenglish
     *
     *
     * @version 1.1
     */
    class Iterator
    {
    public :
        /**
         * \french
         * Constructeur.
         *
         * @param iter L'it�rateur envelopp�.
         * \endfrench
         *
         * \english
         * Constructor.
         *
         * @param iter Wrapped iterator.
         * \endenglish
         */
        Iterator( DynamicTableIterator< T >* iter );

        /**
         * \french
         * Constructeur de copie.
         *
         * @param copy L'objet � copier.
         * \endfrench
         *
         * \english
         * Copy constructor.
         *
         * @param copy The copied object.
         * \endenglish
         */
        Iterator( const Iterator& copy );

        /**
         * \french
         * Destructeur.
         * \endfrench
         *
         * \english
         * Destructor.
         * \endenglish
         */
        virtual ~Iterator();

        /**
         * \french
         * Indique s'il reste des cellules � visiter.
         *
         * @return false si l'it�rateur a fini d'�num�rer les
         *         cellules.
         * \endfrench
         *
         * \english
         * Indicates if there are more cells to visit.
         *
         * @return false if there is no more cell.
         * \endenglish
         */
        bool hasNext() const;

        /**
         * \french
         * Positionne l'it�rateur sur la prochaine cellule.
         * \endfrench
         *
         * \english
         * Point the iterator on the next cell.
         * \endenglish
         */
        void next();

        /**
         * \french
         * Donne acc�s � la position en i de la cellule courante.
         *
         * @return La position en i de la cellule courante.
         * \endfrench
         *
         * \english
         * Gets the current cell's i coordinate.
         *
         * @return The current cell's i coordinate.
         * \endenglish
         */
        int i() const;

        /**
         * \french
         * Donne acc�s � la position en j de la cellule courante.
         *
         * @return La position en j de la cellule courante.
         * \endfrench
         * \english
         * Gets the current cell's j coordinate.
         *
         * @return The current cell's j coordinate.
         * \endenglish
         */
        int j() const;

        /**
         * \french
         * Donne acc�s au score de la cellule courante.
         *
         * @return Le score associ� � la cellule courante.
         * \endfrench
         *
         * \english
         * Gets the current cell's score.
         *
         * @return The current cell's score.
         * \endenglish
         */
        T score() const;

        private :
            /**
             * \french
             * L'it�rateur emball�
             * \endfrench
             *
             * \english
             * The wrapped iterator.
             * \endenglish
             */

            std::auto_ptr< DynamicTableIterator< T > > m_iterator;
    };

    /**
     * \french
     * Donne acc�s � un it�rateur sur la solution optimale.
     *
     * @note Cette fonction doit �tre appel�e apr�s solve pour
     *       retourner une valeur coh�rente.
     *
     * @return Un it�rateur sur la solution optimale.
     * \endfrench
     *
     * \english
     * Gets an iterator on the best solution.
     *
     * @note solve must be called before this function in order to
     *       have coherent results.
     *
     * @return An iterator on the best solution.
     * \endenglish
     *
     * @see solve()
     */
    virtual Iterator getIterator() const = 0;

};

/**
 * \french
 * It�rateur de solution optimale.
 *
 * Permet de parcourir la solution optimale d'une table dynamique.
 *
 * @note Cette classe a �t� fait pour contourner le fait qu'une fonction ne
 *       peut retourner un  objet abstrait.  Les objets descendants servent
 *       � construire un  DynamicTable::Iterator.
 *
 * Contraintes sur l'it�rateur:
 *
 *
 * @version 1.1
 * \endfrench
 *
 * \english
 * Iterator on a dynamic table's best solution.
 *
 * @note This class has for purpose to bypass the fact that a function can't
 *       return an abstract object.  So this class descendant's allow to build
 *       DynamicTable::Iterator objects.
 * \endenglish
 *
 * @param T The score's data type
 *
 *
 * @version 1.1
 *
 * @see ::DynamicTable
 */
template< class T >
class DynamicTableIterator
{
    friend class DynamicTable< T >::Iterator;

public :
    /**
     * @copydoc DynamicTable::Iterator::hasNext()
     */

    virtual bool hasNext() const = 0;

    /**
     * @copydoc DynamicTable::Iterator::next()
     */
    virtual void next() = 0;

    /**
     * @copydoc DynamicTable::Iterator::i()
     */
    virtual int i() const = 0;

    /**
     * @copydoc DynamicTable::Iterator::j()
     */
    virtual int j() const = 0;

    /**
     * @copydoc DynamicTable::Iterator::score()
     */
    virtual T score() const = 0;

protected :
    /**
     * \french
     * Produit une copie de l'it�rateur.
     *
     * @return Un pointeur vers une copie de l'it�rateur.  Cette copie sera
     *         d�truite par l'objet courant.
     * \endfrench
     *
     * \english
     * Copy the iterator.
     *
     * @return A pointer on the iterator's copy.  This copy will be deleted
     *         by the current object.
     * \endenglish
     */
    virtual DynamicTableIterator* clone() const = 0;

};

// ------------------------------------------------------------------------ //

template< class T >
DynamicTable< T >::Iterator::Iterator( DynamicTableIterator< T >* iter )
        : m_iterator( iter )
{}

// ------------------------------------------------------------------------ //
template< class T >
DynamicTable< T >::Iterator::Iterator( const Iterator& copy )
        : m_iterator( copy.m_iterator -> clone() )
{}

// ------------------------------------------------------------------------ //
template< class T >
DynamicTable< T >::Iterator::~Iterator()
{}

// ------------------------------------------------------------------------ //
template< class T >
bool DynamicTable< T >::Iterator::hasNext() const
{
    return m_iterator -> hasNext();
}

// ------------------------------------------------------------------------ //
template< class T >
void DynamicTable< T >::Iterator::next()
{
    m_iterator -> next();
}

// ------------------------------------------------------------------------ //
template< class T >
int DynamicTable< T >::Iterator::i() const
{
    return m_iterator -> i();
}

// ------------------------------------------------------------------------ //
template< class T >
int DynamicTable< T >::Iterator::j() const
{
    return m_iterator -> j();
}

// ------------------------------------------------------------------------ //
template< class T >
T DynamicTable< T >::Iterator::score() const
{
    return m_iterator -> score();
}

}// namespace japa

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<org.chromium.chrome.browser.webapps.WebApkIconNameUpdateCustomView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="16dp"
    android:layout_marginEnd="16dp"
    android:paddingTop="16dp"
    android:gravity="center|top"
    android:orientation="horizontal">

    <!-- The icon, name and short_name as it is before updating. -->
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        android:orientation="vertical"
        android:gravity="center">

        <ImageView
            android:id="@+id/app_icon_old"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:visibility="gone"
            android:contentDescription="@string/webapp_update_current_icon" />

        <TextView
            android:id="@+id/short_app_name_old"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="6dp"
            android:visibility="gone"
            android:maxLines="5"
            android:ellipsize="end"
            android:gravity="center"
            android:textAppearance="@style/TextAppearance.TextMediumThick.Primary" />

        <TextView
            android:id="@+id/app_name_old"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:maxLines="5"
            android:ellipsize="end"
            android:gravity="center"
            android:textAppearance="@style/TextAppearance.TextSmall.Primary" />
    </LinearLayout>

    <androidx.appcompat.widget.AppCompatImageView
        android:layout_width="46dp"
        android:layout_height="46dp"
        android:layout_marginTop="20dp"
        android:importantForAccessibility="no"
        app:srcCompat="@drawable/ic_forward_arrow_black_24dp" />

    <!-- The icon, name and short_name as it will be after the update. -->
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        android:orientation="vertical"
        android:gravity="center">

        <ImageView
            android:id="@+id/app_icon_new"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:visibility="gone"
            android:contentDescription="@string/webapp_update_new_icon"/>

        <TextView
            android:id="@+id/short_app_name_new"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="6dp"
            android:visibility="gone"
            android:maxLines="5"
            android:ellipsize="end"
            android:gravity="center"
            android:textAppearance="@style/TextAppearance.TextMediumThick.Primary" />

        <TextView
            android:id="@+id/app_name_new"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:maxLines="5"
            android:ellipsize="end"
            android:gravity="center"
            android:textAppearance="@style/TextAppearance.TextSmall.Primary" />
    </LinearLayout>
</org.chromium.chrome.browser.webapps.WebApkIconNameUpdateCustomView>


text:
package rc

import (
	"encoding/json"
	"fmt"
	"math"
	"strconv"

	"github.com/pkg/errors"
)

// Params is the input and output type for the Func
type Params map[string]interface{}

// ErrParamNotFound - this is returned from the Get* functions if the
// parameter isn't found along with a zero value of the requested
// item.
//
// Returning an error of this type from an rc.Func will cause the http
// method to return http.StatusBadRequest
type ErrParamNotFound string

// Error turns this error into a string
func (e ErrParamNotFound) Error() string {
	return fmt.Sprintf("Didn't find key %q in input", string(e))
}

// IsErrParamNotFound returns whether err is ErrParamNotFound
func IsErrParamNotFound(err error) bool {
	_, isNotFound := err.(ErrParamNotFound)
	return isNotFound
}

// NotErrParamNotFound returns true if err != nil and
// !IsErrParamNotFound(err)
//
// This is for checking error returns of the Get* functions to ignore
// error not found returns and take the default value.
func NotErrParamNotFound(err error) bool {
	return err != nil && !IsErrParamNotFound(err)
}

// ErrParamInvalid - this is returned from the Get* functions if the
// parameter is invalid.
//
//
// Returning an error of this type from an rc.Func will cause the http
// method to return http.StatusBadRequest
type ErrParamInvalid struct {
	error
}

// IsErrParamInvalid returns whether err is ErrParamInvalid
func IsErrParamInvalid(err error) bool {
	_, isInvalid := err.(ErrParamInvalid)
	return isInvalid
}

// Reshape reshapes one blob of data into another via json serialization
//
// out should be a pointer type
//
// This isn't a very efficient way of dealing with this!
func Reshape(out interface{}, in interface{}) error {
	b, err := json.Marshal(in)
	if err != nil {
		return errors.Wrapf(err, "Reshape failed to Marshal")
	}
	err = json.Unmarshal(b, out)
	if err != nil {
		return errors.Wrapf(err, "Reshape failed to Unmarshal")
	}
	return nil
}

// Get gets a parameter from the input
//
// If the parameter isn't found then error will be of type
// ErrParamNotFound and the returned value will be nil.
func (p Params) Get(key string) (interface{}, error) {
	value, ok := p[key]
	if !ok {
		return nil, ErrParamNotFound(key)
	}
	return value, nil
}

// GetString gets a string parameter from the input
//
// If the parameter isn't found then error will be of type
// ErrParamNotFound and the returned value will be "".
func (p Params) GetString(key string) (string, error) {
	value, err := p.Get(key)
	if err != nil {
		return "", err
	}
	str, ok := value.(string)
	if !ok {
		return "", ErrParamInvalid{errors.Errorf("expecting string value for key %q (was %T)", key, value)}
	}
	return str, nil
}

// GetInt64 gets a int64 parameter from the input
//
// If the parameter isn't found then error will be of type
// ErrParamNotFound and the returned value will be 0.
func (p Params) GetInt64(key string) (int64, error) {
	value, err := p.Get(key)
	if err != nil {
		return 0, err
	}
	switch x := value.(type) {
	case int:
		return int64(x), nil
	case int64:
		return x, nil
	case float64:
		if x > math.MaxInt64 || x < math.MinInt64 {
			return 0, ErrParamInvalid{errors.Errorf("key %q (%v) overflows int64 ", key, value)}
		}
		return int64(x), nil
	case string:
		i, err := strconv.ParseInt(x, 10, 0)
		if err != nil {
			return 0, ErrParamInvalid{errors.Wrapf(err, "couldn't parse key %q (%v) as int64", key, value)}
		}
		return i, nil
	}
	return 0, ErrParamInvalid{errors.Errorf("expecting int64 value for key %q (was %T)", key, value)}
}

// GetFloat64 gets a float64 parameter from the input
//
// If the parameter isn't found then error will be of type
// ErrParamNotFound and the returned value will be 0.
func (p Params) GetFloat64(key string) (float64, error) {
	value, err := p.Get(key)
	if err != nil {
		return 0, err
	}
	switch x := value.(type) {
	case float64:
		return x, nil
	case int:
		return float64(x), nil
	case int64:
		return float64(x), nil
	case string:
		f, err := strconv.ParseFloat(x, 64)
		if err != nil {
			return 0, ErrParamInvalid{errors.Wrapf(err, "couldn't parse key %q (%v) as float64", key, value)}
		}
		return f, nil
	}
	return 0, ErrParamInvalid{errors.Errorf("expecting float64 value for key %q (was %T)", key, value)}
}

// GetBool gets a boolean parameter from the input
//
// If the parameter isn't found then error will be of type
// ErrParamNotFound and the returned value will be false.
func (p Params) GetBool(key string) (bool, error) {
	value, err := p.Get(key)
	if err != nil {
		return false, err
	}
	switch x := value.(type) {
	case int:
		return x != 0, nil
	case int64:
		return x != 0, nil
	case float64:
		return x != 0, nil
	case bool:
		return x, nil
	case string:
		b, err := strconv.ParseBool(x)
		if err != nil {
			return false, ErrParamInvalid{errors.Wrapf(err, "couldn't parse key %q (%v) as bool", key, value)}
		}
		return b, nil
	}
	return false, ErrParamInvalid{errors.Errorf("expecting bool value for key %q (was %T)", key, value)}
}

// GetStruct gets a struct from key from the input into the struct
// pointed to by out. out must be a pointer type.
//
// If the parameter isn't found then error will be of type
// ErrParamNotFound and out will be unchanged.
func (p Params) GetStruct(key string, out interface{}) error {
	value, err := p.Get(key)
	if err != nil {
		return err
	}
	err = Reshape(out, value)
	if err != nil {
		return ErrParamInvalid{errors.Wrapf(err, "key %q", key)}
	}
	return nil
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="%level" name="ModernMT" packages="">
    <Appenders>
        <Console name="Console" target="SYSTEM_ERR">
            <PatternLayout>
                <Pattern>%d %-5level %c [%t] %msg%n%throwable</Pattern>
            </PatternLayout>
        </Console>
    </Appenders>
    <Loggers>
        <Root level="%level">
            <AppenderRef ref="Console"/>
        </Root>
    </Loggers>
</Configuration>


text:
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'concat'
})
export class ConcatPipe implements PipeTransform {

  transform(value: any, arg: any): any {

    return value + arg;
  }

}


text:
<?php

namespace phpDocumentor\Event\Mock;

use phpDocumentor\Event\EventAbstract as BaseClass;

/**
 * EventAbstract Mocking Class.
 *
 * We need a real mock because events may be constructed using a static factory method. But we cannot invoke
 * those on a mock constructed with Mockery, phpUnit or directly on the abstract class.
 */
class EventAbstract extends BaseClass
{

}


text:
package fr.free.nrw.commons.utils;

import android.os.Handler;
import android.os.Looper;

import java.util.concurrent.Executor;

public class ExecutorUtils {

    private static final Executor uiExecutor = new Executor() {
        @Override
        public void execute(Runnable command) {
            if (Looper.myLooper() == Looper.getMainLooper()) {
                command.run();
            } else {
                new Handler(Looper.getMainLooper()).post(command);
            }
        }
    };

    public static Executor uiExecutor () { return uiExecutor;}

}


text:
package types

// DO NOT EDIT. THIS FILE WAS AUTOMATICALLY GENERATED

// SoftLayer_Notification_Occurrence_Event_Type - This represents the type of
// SoftLayer_Notification_Occurrence_Event.
type SoftLayer_Notification_Occurrence_Event_Type struct {

	// KeyName - The friendly unique identifier for this event type.
	KeyName string `json:"keyName,omitempty"`
}

func (softlayer_notification_occurrence_event_type *SoftLayer_Notification_Occurrence_Event_Type) String() string {
	return "SoftLayer_Notification_Occurrence_Event_Type"
}


text:
import React, { PropTypes } from 'react'
import { Router } from 'react-router'
import { Provider } from 'react-redux'
import { deal as createDealAction } from '../actions/deal';
import { bid as createBidAction, bidChange as createBidChangeAction } from '../actions/bid';
import PubNub from 'pubnub';

class AppContainer extends React.Component {
  static propTypes = {
    history: PropTypes.object.isRequired,
    routes: PropTypes.object.isRequired,
    routerKey: PropTypes.number,
    store: PropTypes.object.isRequired
  }

  componentWillMount() {
    const { store } = this.props;
    this.pubnub = PubNub.init({
      publish_key: 'pub-c-8eb80bba-400f-4167-89d4-6a49c7516c85',
      subscribe_key: 'sub-c-c655cf06-3794-11e6-885b-02ee2ddab7fe'
    });

    this.pubnub.subscribe({
      channel: 'deals',
      message(message, envelope, channelOrGroup, time, channel) {
        const deal = JSON.parse(message);
        store.dispatch(createDealAction(deal));
      }
    });

    this.pubnub.subscribe({
      channel: 'bids',
      message(message, envelope, channelOrGroup, time, channel) {
        const bid = JSON.parse(message);
        store.dispatch(createBidAction(bid));
      }
    });

    this.pubnub.subscribe({
      channel: 'bidChanges',
      message(message, envelope, channelOrGroup, time, channel) {
        const bid = JSON.parse(message);
        store.dispatch(createBidChangeAction(bid));
      }
    });

  }

  render () {
    const { history, routes, routerKey, store } = this.props

    return (
      <Provider store={store}>
        <div style={{ height: '100%' }}>
          <Router history={history} children={routes} key={routerKey} />
        </div>
      </Provider>
    )
  }
}

export default AppContainer


text:
// Copyright 2020 Google
//
// 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.

package com.google.firebase.testing.cppsdk;

/** An example subclass of {@link TickerObserver} for unit-testing the ticker mechanism. */
public final class TickerExample implements TickerObserver {
  // When the callback should happen.
  private final long delay;

  public TickerExample(long delay) {
    this.delay = delay;
    TickerAndroid.register(this);
  }

  @Override
  public void elapse() {
    // We pass in ticker directly to save a few JNI calls. A fake should implement the logic right
    // here without using native function. We use native function here in order to consolidate logic
    // in the unit test .cc file.
    nativeFunction(TickerAndroid.now(), delay);
  }

  private native void nativeFunction(long ticker, long delay);
}


text:
import defineDynamicBlock from '../../../src/lib/define-dynamic-block';

import BlockType from 'scratch-vm/src/extension-support/block-type';

const MockScratchBlocks = {
    OUTPUT_SHAPE_HEXAGONAL: 1,
    OUTPUT_SHAPE_ROUND: 2,
    OUTPUT_SHAPE_SQUARE: 3
};

const categoryInfo = {
    name: 'test category',
    color1: '#111',
    color2: '#222',
    color3: '#333'
};

const penIconURI = 'data:image/svg+xml;base64,fake_pen_icon_svg_base64_data';

const testBlockInfo = {
    commandWithIcon: {
        blockType: BlockType.COMMAND,
        blockIconURI: penIconURI,
        text: 'command with icon'
    },
    commandWithoutIcon: {
        blockType: BlockType.COMMAND,
        text: 'command without icon'
    },
    terminalCommand: {
        blockType: BlockType.COMMAND,
        isTerminal: true,
        text: 'terminal command'
    },
    reporter: {
        blockType: BlockType.REPORTER,
        text: 'reporter'
    },
    boolean: {
        blockType: BlockType.BOOLEAN,
        text: 'Boolean'
    },
    hat: {
        blockType: BlockType.HAT,
        text: 'hat'
    }
};

// similar to goog.mixin from the Closure library
const mixin = function (target, source) {
    for (const x in source) {
        target[x] = source[x];
    }
};

class MockBlock {
    constructor (blockInfo, extendedOpcode) {
        // mimic Closure-style inheritance by mixing in `defineDynamicBlock` output as this instance's prototype
        // see also the `Blockly.Block` constructor
        const prototype = defineDynamicBlock(MockScratchBlocks, categoryInfo, blockInfo, extendedOpcode);
        mixin(this, prototype);
        this.init();

        // bootstrap the mutation<->DOM cycle
        this.blockInfoText = JSON.stringify(blockInfo);
        const xmlElement = this.mutationToDom();

        // parse blockInfo from XML to fill dynamic properties
        this.domToMutation(xmlElement);
    }

    jsonInit (json) {
        this.result = Object.assign({}, json);
    }
    interpolate_ () {
        // TODO: add tests for this?
    }
    setCheckboxInFlyout (isEnabled) {
        this.result.checkboxInFlyout_ = isEnabled;
    }
    setOutput (isEnabled) {
        this.result.outputConnection = isEnabled; // Blockly calls `makeConnection_` here
    }
    setOutputShape (outputShape) {
        this.result.outputShape_ = outputShape;
    }
    setNextStatement (isEnabled) {
        this.result.nextConnection = isEnabled; // Blockly calls `makeConnection_` here
    }
    setPreviousStatement (isEnabled) {
        this.result.previousConnection = isEnabled; // Blockly calls `makeConnection_` here
    }
}

describe('defineDynamicBlock', () => {
    test('is a function', () => {
        expect(typeof defineDynamicBlock).toBe('function');
    });
    test('can define a command block with an icon', () => {
        const extendedOpcode = 'test.commandWithIcon';
        const block = new MockBlock(testBlockInfo.commandWithIcon, extendedOpcode);
        expect(block.result).toEqual({
            category: categoryInfo.name,
            colour: categoryInfo.color1,
            colourSecondary: categoryInfo.color2,
            colourTertiary: categoryInfo.color3,
            extensions: ['scratch_extension'],
            inputsInline: true,
            nextConnection: true,
            outputShape_: MockScratchBlocks.OUTPUT_SHAPE_SQUARE,
            previousConnection: true,
            type: extendedOpcode
        });
    });
    test('can define a command block without an icon', () => {
        const extendedOpcode = 'test.commandWithoutIcon';
        const block = new MockBlock(testBlockInfo.commandWithoutIcon, extendedOpcode);
        expect(block.result).toEqual({
            category: categoryInfo.name,
            colour: categoryInfo.color1,
            colourSecondary: categoryInfo.color2,
            colourTertiary: categoryInfo.color3,
            // extensions: undefined, // no icon means no extension
            inputsInline: true,
            nextConnection: true,
            outputShape_: MockScratchBlocks.OUTPUT_SHAPE_SQUARE,
            previousConnection: true,
            type: extendedOpcode
        });
    });
    test('can define a terminal command', () => {
        const extendedOpcode = 'test.terminal';
        const block = new MockBlock(testBlockInfo.terminalCommand, extendedOpcode);
        expect(block.result).toEqual({
            category: categoryInfo.name,
            colour: categoryInfo.color1,
            colourSecondary: categoryInfo.color2,
            colourTertiary: categoryInfo.color3,
            // extensions: undefined, // no icon means no extension
            inputsInline: true,
            nextConnection: false, // terminal
            outputShape_: MockScratchBlocks.OUTPUT_SHAPE_SQUARE,
            previousConnection: true,
            type: extendedOpcode
        });
    });
    test('can define a reporter', () => {
        const extendedOpcode = 'test.reporter';
        const block = new MockBlock(testBlockInfo.reporter, extendedOpcode);
        expect(block.result).toEqual({
            category: categoryInfo.name,
            checkboxInFlyout_: true,
            colour: categoryInfo.color1,
            colourSecondary: categoryInfo.color2,
            colourTertiary: categoryInfo.color3,
            // extensions: undefined, // no icon means no extension
            inputsInline: true,
            // nextConnection: undefined, // reporter
            outputConnection: true, // reporter
            outputShape_: MockScratchBlocks.OUTPUT_SHAPE_ROUND, // reporter
            // previousConnection: undefined, // reporter
            type: extendedOpcode
        });
    });
    test('can define a Boolean', () => {
        const extendedOpcode = 'test.boolean';
        const block = new MockBlock(testBlockInfo.boolean, extendedOpcode);
        expect(block.result).toEqual({
            category: categoryInfo.name,
            // checkboxInFlyout_: undefined,
            colour: categoryInfo.color1,
            colourSecondary: categoryInfo.color2,
            colourTertiary: categoryInfo.color3,
            // extensions: undefined, // no icon means no extension
            inputsInline: true,
            // nextConnection: undefined, // reporter
            outputConnection: true, // reporter
            outputShape_: MockScratchBlocks.OUTPUT_SHAPE_HEXAGONAL, // Boolean
            // previousConnection: undefined, // reporter
            type: extendedOpcode
        });
    });
    test('can define a hat', () => {
        const extendedOpcode = 'test.hat';
        const block = new MockBlock(testBlockInfo.hat, extendedOpcode);
        expect(block.result).toEqual({
            category: categoryInfo.name,
            colour: categoryInfo.color1,
            colourSecondary: categoryInfo.color2,
            colourTertiary: categoryInfo.color3,
            // extensions: undefined, // no icon means no extension
            inputsInline: true,
            nextConnection: true,
            outputShape_: MockScratchBlocks.OUTPUT_SHAPE_SQUARE,
            // previousConnection: undefined, // hat
            type: extendedOpcode
        });
    });
});


text:
"""
DRAC Power Driver using the Base Server Profile
"""

from oslo.utils import excutils
from oslo.utils import importutils

from ironic.common import exception
from ironic.common.i18n import _LE
from ironic.common import states
from ironic.drivers import base
from ironic.drivers.modules.drac import common as drac_common
from ironic.drivers.modules.drac import resource_uris
from ironic.openstack.common import log as logging

pywsman = importutils.try_import('pywsman')

LOG = logging.getLogger(__name__)

POWER_STATES = {
    '2': states.POWER_ON,
    '3': states.POWER_OFF,
    '11': states.REBOOT,
}

REVERSE_POWER_STATES = dict((v, k) for (k, v) in POWER_STATES.items())

def _get_power_state(node):
    """Returns the current power state of the node

    :param node: The node.
    :returns: power state, one of :mod: `ironic.common.states`.
    :raises: DracClientError if the client received unexpected response.
    :raises: InvalidParameterValue if required DRAC credentials are missing.
    """

    client = drac_common.get_wsman_client(node)
    options = pywsman.ClientOptions()
    filter_query = ('select EnabledState,ElementName from CIM_ComputerSystem '
                    'where Name="srv:system"')
    try:
        doc = client.wsman_enumerate(resource_uris.DCIM_ComputerSystem,
                                     options, filter_query=filter_query)
    except exception.DracClientError as exc:
        with excutils.save_and_reraise_exception():
            LOG.error(_LE('DRAC driver failed to get power state for node '
                          '%(node_uuid)s. Reason: %(error)s.'),
                      {'node_uuid': node.uuid, 'error': exc})

    enabled_state = drac_common.find_xml(doc, 'EnabledState',
                                         resource_uris.DCIM_ComputerSystem)
    return POWER_STATES[enabled_state.text]

def _set_power_state(node, target_state):
    """Turns the server power on/off or do a reboot.

    :param node: an ironic node object.
    :param target_state: target state of the node.
    :raises: DracClientError if the client received unexpected response.
    :raises: InvalidParameterValue if an invalid power state was specified.
    """

    client = drac_common.get_wsman_client(node)
    options = pywsman.ClientOptions()
    options.add_selector('CreationClassName', 'DCIM_ComputerSystem')
    options.add_selector('Name', 'srv:system')
    options.add_property('RequestedState', REVERSE_POWER_STATES[target_state])

    try:
        root = client.wsman_invoke(resource_uris.DCIM_ComputerSystem, options,
                                   'RequestStateChange')
    except exception.DracClientError as exc:
        with excutils.save_and_reraise_exception():
            LOG.error(_LE('DRAC driver failed to set power state for node '
                          '%(node_uuid)s to %(target_power_state)s. '
                          'Reason: %(error)s.'),
                      {'node_uuid': node.uuid,
                       'target_power_state': target_state,
                       'error': exc})

    return_value = drac_common.find_xml(root, 'ReturnValue',
                                        resource_uris.DCIM_ComputerSystem).text
    if return_value != drac_common.RET_SUCCESS:
        message = drac_common.find_xml(root, 'Message',
                                       resource_uris.DCIM_ComputerSystem).text
        LOG.error(_LE('DRAC driver failed to set power state for node '
                      '%(node_uuid)s to %(target_power_state)s. '
                      'Reason: %(error)s.'),
                  {'node_uuid': node.uuid,
                   'target_power_state': target_state,
                   'error': message})
        raise exception.DracOperationError(operation='set_power_state',
                                           error=message)

class DracPower(base.PowerInterface):
    """Interface for power-related actions."""

    def get_properties(self):
        return drac_common.COMMON_PROPERTIES

    def validate(self, task):
        """Validate the driver-specific Node power info.

        This method validates whether the 'driver_info' property of the
        supplied node contains the required information for this driver to
        manage the power state of the node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue if required driver_info attribute
                 is missing or invalid on the node.
        """
        return drac_common.parse_driver_info(task.node)

    def get_power_state(self, task):
        """Return the power state of the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :returns: a power state. One of :mod:`ironic.common.states`.
        :raises: DracClientError if the client received unexpected response.
        """
        return _get_power_state(task.node)

    def set_power_state(self, task, power_state):
        """Set the power state of the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :param power_state: Any power state from :mod:`ironic.common.states`.
        :raises: DracClientError if the client received unexpected response.
        :raises: DracOperationError if failed to set the power state.
        """
        return _set_power_state(task.node, power_state)

    def reboot(self, task):
        """Perform a hard reboot of the task's node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: DracClientError if the client received unexpected response.
        :raises: DracOperationError if failed to set the power state.
        """
        return _set_power_state(task.node, states.REBOOT)


text:
using System;
using System.Diagnostics.Contracts;

namespace Zabavnov.MVVM
{
    /// <summary>
    ///     declare binder for control of type <typeparamref name="TControl" /> to property of type
    ///     <typeparamref name="TValueProperty" />
    /// </summary>
    /// <typeparam name="TControl"></typeparam>
    /// <typeparam name="TValueProperty"></typeparam>
    [ContractClass(typeof(PropertyBinderContract<,>))]
    public interface IPropertyBinder<in TControl, TValueProperty>
    {
        /// <summary>
        ///     The property name
        /// </summary>
        string PropertyName { get; }

        /// <summary>
        ///     Bind control to property and return <see cref="IBindableProperty{TControl,TProperty}" />
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="control"></param>
        /// <returns></returns>
        IBindableProperty<T, TValueProperty> BindTo<T>(T control) where T : class, TControl ;
    }

    [ContractClassFor(typeof(IPropertyBinder<,>))]
    internal abstract class PropertyBinderContract<TControl, TValueProperty> : IPropertyBinder<TControl, TValueProperty>
    {
        #region Implementation of IPropertyBinder<in TControl,TValueProperty>

        /// <summary>
        ///     The property name
        /// </summary>
        public string PropertyName
        {
            get
            {
                Contract.Ensures(!String.IsNullOrEmpty(Contract.Result<string>()));
                throw new NotSupportedException();
            }
        }

        /// <summary>
        ///     Bind control to property and return <see cref="IBindableProperty{TControl,TProperty}" />
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="control"></param>
        /// <returns></returns>
        public IBindableProperty<T, TValueProperty> BindTo<T>(T control) where T : class, TControl
        {
            Contract.Requires(control != null);
            throw new NotSupportedException();
        }

        #endregion
    }
}


text:
package Paws::WAFRegional::DisassociateWebACLResponse;
  use Moose;

  has _request_id => (is => 'ro', isa => 'Str');

### main pod documentation begin ###

=head1 NAME

Paws::WAFRegional::DisassociateWebACLResponse

=head1 ATTRIBUTES

=head2 _request_id => Str

=cut

1;


text:
package at.ac.tuwien.dsg.salam.composer.model;

import org.jgrapht.graph.DefaultWeightedEdge;

public class RelationEdge extends DefaultWeightedEdge {

    private static final long serialVersionUID = 3470367083442610368L;

}


text:
using System;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using GameDevWare.Serialization;

namespace Colyseus
{
	using PatchListener = Listener<Action<string[], object>>;
	using FallbackPatchListener = Listener<Action<string[], string, object>>;

	public struct Listener<T>
	{
		public T callback;
		public string operation;
		public Regex[] rules;
	}

	public class DeltaContainer
	{
		public IndexedDictionary<string, object> data;
		private Dictionary<string, List<PatchListener>> listeners;
		private List<FallbackPatchListener> fallbackListeners;

		private Dictionary<string, Regex> matcherPlaceholders = new Dictionary<string, Regex>()
		{
			{":id", new Regex(@"^([a-zA-Z0-9\-_]+)$")},
			{":number", new Regex(@"^([0-9]+)$")},
			{":string", new Regex(@"^(\w+)$")},
			{":axis", new Regex(@"^([xyz])$")},
			{"*", new Regex(@"(.*)")},
		};

		public DeltaContainer(IndexedDictionary<string, object> data)
		{
			this.data = data;
			this.Reset();
		}

		public PatchObject[] Set(IndexedDictionary<string, object> newData)
		{
			var patches = Compare.GetPatchList(this.data, newData);

			this.CheckPatches(patches);
			this.data = newData;

			return patches;
		}

		public void RegisterPlaceholder(string placeholder, Regex matcher)
		{
			this.matcherPlaceholders[placeholder] = matcher;
		}

		public FallbackPatchListener Listen(Action<string[], string, object> callback)
		{
			FallbackPatchListener listener = new FallbackPatchListener
			{
				callback = callback,
				operation = "",
				rules = new Regex[] { }
			};

			this.fallbackListeners.Add(listener);

			return listener;
		}

		public PatchListener Listen(string segments, string operation, Action<string[], object> callback)
		{
			var regexpRules = this.ParseRegexRules(segments.Split('/'));

			PatchListener listener = new PatchListener
			{
				callback = callback,
				operation = operation,
				rules = regexpRules
			};

			this.listeners[operation].Add(listener);

			return listener;
		}

		public void RemoveListener(PatchListener listener)
		{
			for (var i = this.listeners[listener.operation].Count - 1; i >= 0; i--)
			{
				if (this.listeners[listener.operation][i].Equals(listener))
				{
					this.listeners[listener.operation].RemoveAt(i);
				}
			}
		}

		public void RemoveAllListeners()
		{
			this.Reset();
		}

		protected Regex[] ParseRegexRules(string[] rules)
		{
			Regex[] regexpRules = new Regex[rules.Length];

			for (int i = 0; i < rules.Length; i++)
			{
				var segment = rules[i];
				if (segment.IndexOf(':') == 0)
				{
					if (this.matcherPlaceholders.ContainsKey(segment))
					{
						regexpRules[i] = this.matcherPlaceholders[segment];
					}
					else
					{
						regexpRules[i] = this.matcherPlaceholders["*"];
					}
				}
				else
				{
					regexpRules[i] = new Regex(segment);
				}
			}

			return regexpRules;
		}

		private void CheckPatches(PatchObject[] patches)
		{
			for (var i = patches.Length - 1; i >= 0; i--)
			{
				var matched = false;
				var op = patches[i].op;
				for (var j = 0; j < this.listeners[op].Count; j++)
				{
					var listener = this.listeners[op][j];
					var matches = this.CheckPatch(patches[i], listener);
					if (matches.Length > 0)
					{
						listener.callback.Invoke(matches, patches[i].value);
						matched = true;
					}
				}

				// check for fallback listener
				var fallbackListenersCount = this.fallbackListeners.Count;
				if (!matched && fallbackListenersCount > 0)
				{
					for (var j = 0; j < fallbackListenersCount; j++)
					{
						this.fallbackListeners[j].callback.Invoke(patches[i].path, patches[i].op, patches[i].value);
					}
				}
			}
		}

		private string[] CheckPatch(PatchObject patch, PatchListener listener)
		{
			// skip if rules count differ from patch
			if (patch.path.Length != listener.rules.Length)
			{
				return new string[] { };
			}

			List<string> pathVars = new List<string>();

			for (var i = 0; i < listener.rules.Length; i++)
			{
				var matches = listener.rules[i].Matches(patch.path[i]);
				if (matches.Count == 0 || matches.Count > 2)
				{
					return new string[] { };
				}
				else if (matches[0].Groups.Count > 1)
				{
					pathVars.Add(matches[0].ToString());
					// pathVars = pathVars.concat(matches.slice(1));
				}
			}

			return pathVars.ToArray();
		}

		private void Reset()
		{
			this.listeners = new Dictionary<string, List<PatchListener>>()
			{
				{"add", new List<PatchListener>()},
				{"remove", new List<PatchListener>()},
				{"replace", new List<PatchListener>()}
			};
			this.fallbackListeners = new List<FallbackPatchListener>();
		}
	}
}


text: __author__ = 'DataCentric1'


text:
from setuptools import setup

setup(
    # GETTING-STARTED: set your app name:
    name='UberVest API',
    # GETTING-STARTED: set your app version:
    version='1.0',
    # GETTING-STARTED: set your app description:
    description='System Level Integration Project at University of Edinburgh',
    # GETTING-STARTED: set author name (your name):
    author='SLIP A 2015',
    # GETTING-STARTED: set author email (your email):
    author_email='slip.group.a.2015@gmail.com',
    # GETTING-STARTED: set author url (your url):
    url='http://easycz.github.io/SLIP-A-2015/',
    # GETTING-STARTED: define required django version:
    install_requires=[
        'Django==1.8.4'
    ],
    dependency_links=[
        'https://pypi.python.org/simple/django/'
    ],
)


text:
package org.drools.benchmarks.common.util;

import org.drools.benchmarks.model.B;
import org.drools.benchmarks.model.C;
import org.drools.benchmarks.model.D;
import org.drools.benchmarks.model.E;
import org.drools.core.builder.conf.impl.DecisionTableConfigurationImpl;
import org.kie.api.KieServices;
import org.kie.api.io.Resource;
import org.kie.api.runtime.KieSession;
import org.kie.internal.builder.DecisionTableConfiguration;
import org.kie.internal.builder.DecisionTableInputType;

public final class TestUtil {

    public static boolean isDebug() {
        return Boolean.TRUE.toString().equals(System.getProperty(Constants.PROP_KEY_DEBUG));
    }

    public static boolean dumpDrl() {
        return isDebug() || Boolean.TRUE.toString().equals(System.getProperty(Constants.PROP_KEY_DUMP_DRL));
    }

    public static boolean dumpRete() {
        return isDebug() || Boolean.TRUE.toString().equals(System.getProperty(Constants.PROP_KEY_DUMP_RETE));
    }

    public static void insertJoinedFactsToSession(final KieSession kieSession, final int numberOfJoins, final int baseFactValue) {
        switch (numberOfJoins) {

            case 1:
                kieSession.insert( new B( baseFactValue + 3 ) );
                break;
            case 2:
                kieSession.insert( new B( baseFactValue + 3 ) );
                kieSession.insert( new C( baseFactValue + 4 ) );
                break;
            case 3:
                kieSession.insert( new B( baseFactValue + 3 ) );
                kieSession.insert( new C( baseFactValue + 4 ) );
                kieSession.insert( new D( baseFactValue + 5 ) );
                break;
            case 4:
                kieSession.insert( new B( baseFactValue + 3 ) );
                kieSession.insert( new C( baseFactValue + 4 ) );
                kieSession.insert( new D( baseFactValue + 5 ) );
                kieSession.insert( new E( baseFactValue + 6 ) );
                break;
            default:
                throw new IllegalArgumentException("Unsupported number of joins (" + numberOfJoins + ")!");
        }
    }

    public static Resource getClassPathDTableResource(final String resourceName, final DecisionTableInputType dTableType) {
        final Resource dTableResource = KieServices.get().getResources().newClassPathResource(resourceName);
        final DecisionTableConfiguration resourceConfig = new DecisionTableConfigurationImpl();
        resourceConfig.setInputType(dTableType);
        dTableResource.setConfiguration(resourceConfig);
        return dTableResource;
    }

    private TestUtil() {
        // Instantiation of util classes not allowed.
    }
}


text:
"""
    SleekXMPP: The Sleek XMPP Library
    Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
    This file is part of SleekXMPP.

    See the file LICENSE for copying permission.
"""

import logging

from sleekxmpp.xmlstream import JID
from sleekxmpp.exceptions import IqError, IqTimeout

log = logging.getLogger(__name__)

class StaticCaps(object):

    """
    Extend the default StaticDisco implementation to provide
    support for extended identity information.
    """

    def __init__(self, xmpp, static):
        """
        Augment the default XEP-0030 static handler object.

        Arguments:
            static -- The default static XEP-0030 handler object.
        """
        self.xmpp = xmpp
        self.disco = self.xmpp['xep_0030']
        self.caps = self.xmpp['xep_0115']
        self.static = static
        self.ver_cache = {}
        self.jid_vers = {}

    def supports(self, jid, node, ifrom, data):
        """
        Check if a JID supports a given feature.

        The data parameter may provide:
            feature  -- The feature to check for support.
            local    -- If true, then the query is for a JID/node
                        combination handled by this Sleek instance and
                        no stanzas need to be sent.
                        Otherwise, a disco stanza must be sent to the
                        remove JID to retrieve the info.
            cached   -- If true, then look for the disco info data from
                        the local cache system. If no results are found,
                        send the query as usual. The self.use_cache
                        setting must be set to true for this option to
                        be useful. If set to false, then the cache will
                        be skipped, even if a result has already been
                        cached. Defaults to false.
        """
        feature = data.get('feature', None)

        data = {'local': data.get('local', False),
                'cached': data.get('cached', True)}

        if not feature:
            return False

        if node in (None, ''):
            info = self.caps.get_caps(jid)
            if info and feature in info['features']:
                return True

        try:
            info = self.disco.get_info(jid=jid, node=node,
                                       ifrom=ifrom, **data)
            info = self.disco._wrap(ifrom, jid, info, True)
            return feature in info['disco_info']['features']
        except IqError:
            return False
        except IqTimeout:
            return None

    def has_identity(self, jid, node, ifrom, data):
        """
        Check if a JID has a given identity.

        The data parameter may provide:
            category -- The category of the identity to check.
            itype    -- The type of the identity to check.
            lang     -- The language of the identity to check.
            local    -- If true, then the query is for a JID/node
                        combination handled by this Sleek instance and
                        no stanzas need to be sent.
                        Otherwise, a disco stanza must be sent to the
                        remove JID to retrieve the info.
            cached   -- If true, then look for the disco info data from
                        the local cache system. If no results are found,
                        send the query as usual. The self.use_cache
                        setting must be set to true for this option to
                        be useful. If set to false, then the cache will
                        be skipped, even if a result has already been
                        cached. Defaults to false.
        """
        identity = (data.get('category', None),
                    data.get('itype', None),
                    data.get('lang', None))

        data = {'local': data.get('local', False),
                'cached': data.get('cached', True)}

        trunc = lambda i: (i[0], i[1], i[2])

        if node in (None, ''):
            info = self.caps.get_caps(jid)
            if info and identity in map(trunc, info['identities']):
                return True

        try:
            info = self.disco.get_info(jid=jid, node=node,
                                       ifrom=ifrom, **data)
            info = self.disco._wrap(ifrom, jid, info, True)
            return identity in map(trunc, info['disco_info']['identities'])
        except IqError:
            return False
        except IqTimeout:
            return None

    def cache_caps(self, jid, node, ifrom, data):
        with self.static.lock:
            verstring = data.get('verstring', None)
            info = data.get('info', None)
            if not verstring or not info:
                return
            self.ver_cache[verstring] = info

    def assign_verstring(self, jid, node, ifrom, data):
        with self.static.lock:
            if isinstance(jid, JID):
                jid = jid.full
            self.jid_vers[jid] = data.get('verstring', None)

    def get_verstring(self, jid, node, ifrom, data):
        with self.static.lock:
            return self.jid_vers.get(jid, None)

    def get_caps(self, jid, node, ifrom, data):
        with self.static.lock:
            return self.ver_cache.get(data.get('verstring', None), None)


text:
// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
package com.yahoo.bard.webservice.druid.model.dimension.extractionfunction;

import java.util.Objects;

/**
 * Base class model for Lookup property of Lookup Extraction Function.
 */
public abstract class Lookup {
    private final String type;

    /**
     * Constructor.
     *
     * @param type  type of the lookup, can be "map" or "namespace".
     */
    protected Lookup(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    @Override
    public int hashCode() {
        return Objects.hash(type);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) { return true; }
        if (obj == null || getClass() != obj.getClass()) { return false; }
        Lookup other = (Lookup) obj;
        return Objects.equals(type, other.type);
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>SB Admin - Bootstrap Admin Template</title>

    <link href="css/bootstrap.css" rel="stylesheet">

    <link href="css/sb-admin.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    Toggle navigation

                </button>
                Agent Portal

                                            John Smith

 Yesterday at 4:32 PM

Lorem ipsum dolor sit amet, consectetur...

                                            John Smith

 Yesterday at 4:32 PM

Lorem ipsum dolor sit amet, consectetur...

                                            John Smith

 Yesterday at 4:32 PM

Lorem ipsum dolor sit amet, consectetur...

                            Read All New Messages

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            View All

                     John Smith

                             Profile

                             Inbox

                             Settings

                             Log Out

                         Search

                         Profile

                         Subscriptions

                                LiveCareer 14 Day Full Access

                                MyPerfectResume 14 Day Full Access

                         Refund Requests

                         Activity History

                         Offer History

                         Email

                        User Management

                            Process Refunds

                                  Dashboard

                                 Pending Refund Requests

                                 Process Refunds

                                    Transaction ID
                                    GuWID
                                    SKU Name
                                    Amount
                                    Date Charged
                                    Date Refund Requested
                                    Days used
                                    Suggested Refund Amount
                                    Type
                                    Amount to Refund
                                    Reason for Refund

                                    0987654
                                    f079d260-d43e-11e4-8cf1-005056a96a4d
                                    Professional Resume Rev
                                    19.95
                                    5/14/2015
                                    5/15/2015

                                    19.95

                                        <select name="option" id="option">
                                            <option value="Full Refund">Full Refund</option>
                                            <option value="Partial/Pro-rated Refund">Partial/Pro-rated Refund</option>
                                            <option value="Intercept Refund">Intercept Refund</option>
                                            <option value="Reject">Reject</option>
                                        </select>

                                    <input type="text" placeholder="-">

                                        <select name="option" id="option">
                                            <option value="After hours">After hours</option>
                                            <option value="Agent error">Agent error</option>
                                            <option value="BBB">BBB</option>
                                            <option value="Attorney General">Attorney General</option>
                                            <option value="Chargeback">Chargeback</option>
                                            <option value="Corporate">Corporate</option>
                                            <option value="Courtesy">Courtesy</option>
                                            <option value="Duplicate charge">Duplicate charge</option>
                                            <option value="Employee account">Employee account</option>
                                            <option value="Fraud">Fraud</option>
                                            <option value="Never accessed">Never accessed</option>
                                            <option value="Supervisor approval">Supervisor approval</option>
                                            <option value="Supervisor approval/Chargeback">Supervisor approval/Chargeback</option>
                                            <option value="Technical issue">Technical issue</option>
                                            <option value="Denied 1st refund request">Denied 1st refund request</option>
                                            <option value="Chargeback mitigation (Intercept)">Chargeback mitigation (Intercept)</option>
                                            <option value="Cancelled during trial">Cancelled during trial</option>
                                            <option value="Free month">Free month</option>
                                            <option value="Upsell">Upsell</option>
                                            <option value="Same day cancellation">Same day cancellation</option>
                                            <option value="Retention">Retention</option>
                                            <option value="Trial Fee ($1 & $1.95)">Trial Fee ($1 & $1.95)</option>
                                        </select>

                                    17017454
                                    52406f66-f9a3-11e4-8cf1-005056a96a4d
                                    MyPerfectResume 14 Day Full Access
                                    35.80
                                    5/13/2015
                                    5/15/2015
                                    3
                                    30.00

                                        <select name="option" id="option">
                                            <option value="Full Refund">Full Refund</option>
                                            <option value="Partial/Pro-rated Refund">Partial/Pro-rated Refund</option>
                                            <option value="Intercept Refund">Intercept Refund</option>
                                            <option value="Reject">Reject</option>
                                        </select>

                                    <input type="text" placeholder="30.00">

                                        <select>
                                            <option value="After hours">After hours</option>
                                            <option value="Agent error">Agent error</option>
                                            <option value="BBB">BBB</option>
                                            <option value="Attorney General">Attorney General</option>
                                            <option value="Chargeback">Chargeback</option>
                                            <option value="Corporate">Corporate</option>
                                            <option value="Courtesy">Courtesy</option>
                                            <option value="Duplicate charge">Duplicate charge</option>
                                            <option value="Employee account">Employee account</option>
                                            <option value="Fraud">Fraud</option>
                                            <option value="Never accessed">Never accessed</option>
                                            <option value="Supervisor approval">Supervisor approval</option>
                                            <option value="Supervisor approval/Chargeback">Supervisor approval/Chargeback</option>
                                            <option value="Technical issue">Technical issue</option>
                                            <option value="Denied 1st refund request">Denied 1st refund request</option>
                                            <option value="Chargeback mitigation (Intercept)">Chargeback mitigation (Intercept)</option>
                                            <option value="Cancelled during trial">Cancelled during trial</option>
                                            <option value="Free month">Free month</option>
                                            <option value="Upsell">Upsell</option>
                                            <option value="Same day cancellation">Same day cancellation</option>
                                            <option value="Retention">Retention</option>
                                            <option value="Trial Fee ($1 & $1.95)">Trial Fee ($1 & $1.95)</option>
                                        </select>

Total: $30.00

                            <button>Submit</button>
                            <button onclick="window.location.href='refund-requests.html'">Cancel, Go back</button>


text:
# CSS Syntax
A CSS rule-set consists of a selector and a declaration block:
![selector](./img03/selector.gif)

The selector points to the HTML element you want to style.

The declaration block contains one or more declarations separated by semicolons.

Each declaration includes a CSS property name and a value, separated by a colon.

A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces.

In the following example all <p> elements will be center-aligned, with a red text color:
```css
p {
    color: red;
    text-align: center;
}
```
# CSS Selectors
CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class, attribute, and more.
# The element Selector
The element selector selects elements based on the element name.

You can select all <p> elements on a page like this (in this case, all <p> elements will be center-aligned, with a red text color):
```css
p {
    text-align: center;
    color: red;
}
```
# The id Selector
The id selector uses the id attribute of an HTML element to select a specific element.

The id of an element should be unique within a page, so the id selector is used to select one unique element!

To select an element with a specific id, write a hash (#) character, followed by the id of the element.

The style rule below will be applied to the HTML element with id="para1":
```css
#para1 {
    text-align: center;
    color: red;
}
```
# The class Selector
The class selector selects elements with a specific class attribute.

To select elements with a specific class, write a period (.) character, followed by the name of the class.

In the example below, all HTML elements with class="center" will be red and center-aligned:
```css
.center {
    text-align: center;
    color: red;
}
```
You can also specify that only specific HTML elements should be affected by a class.

In the example below, only <p> elements with class="center" will be center-aligned:
```css
p.center {
    text-align: center;
    color: red;
}
```
HTML elements can also refer to more than one class.

In the example below, the <p> element will be styled according to class="center" and to class="large":
```
<p class="center large">This paragraph refers to two classes.</p>
```
# Grouping Selectors
If you have elements with the same style definitions, like this:
```css
h1 {
    text-align: center;
    color: red;
}

h2 {
    text-align: center;
    color: red;
}

p {
    text-align: center;
    color: red;
}
```
It will be better to group the selectors, to minimize the code.

To group selectors, separate each selector with a comma.

In the example below we have grouped the selectors from the code above:
```css
h1, h2, p {
    text-align: center;
    color: red;
}
```
# CSS Comments
Comments are used to explain the code, and may help when you edit the source code at a later date.

Comments are ignored by browsers.

A CSS comment starts with /* and ends with */. Comments can also span multiple lines:

```css
p {
    color: red;
    /* This is a single-line comment */
    text-align: center;
}
/* This is
a multi-line
comment */
```


text:
import React, { Component } from 'react';
import {
    View,
    ScrollView,
    Text,
    Modal,
} from 'react-native';
import Button from 'react-native-button';
import ModalStyles from './styles';

export default class WarningModal extends Component {
    static propTypes = {
        visible: React.PropTypes.bool.isRequired,
        buttons: React.PropTypes.arrayOf(
            React.PropTypes.shape({
                text: React.PropTypes.node.isRequired, // eslint-disable-line react/no-unused-prop-types
                action: React.PropTypes.func.isRequired // eslint-disable-line react/no-unused-prop-types
            })
        ).isRequired,
        title: React.PropTypes.string,
        message: React.PropTypes.string,
        close: React.PropTypes.func.isRequired
    };

    executeAction = (action) => {
        return () => {
            action();
            this.props.close();
        };
    };

    renderButtons = () => {
        const buttons = this.props.buttons || [];
        let buttonsView = null;

        if (buttons.length === 1) {
            buttonsView = (
                <View style={ModalStyles.buttonWrapper}>
                    <Button style={ModalStyles.button}
                            styleDisabled={ModalStyles.buttonDisabled}
                            containerStyle={ModalStyles.buttonContainer}
                            onPress={this.executeAction(buttons[0].action)}
                    >
                        {buttons[0].text}
                    </Button>
                </View>
            );
        } else if (buttons.length === 2) {
            buttonsView = (
                <View style={ModalStyles.buttonWrapper}>
                    <Button style={ModalStyles.button}
                            styleDisabled={ModalStyles.buttonDisabled}
                            containerStyle={[ModalStyles.buttonContainer, ModalStyles.secondaryButton]}
                            onPress={this.executeAction(buttons[0].action)}
                    >
                        {buttons[0].text}
                    </Button>
                    <Button style={ModalStyles.button}
                            styleDisabled={ModalStyles.buttonDisabled}
                            containerStyle={ModalStyles.buttonContainer}
                            onPress={this.executeAction(buttons[1].action)}
                    >
                        {buttons[1].text}
                    </Button>
                </View>
            );
        }

        return buttonsView;
    };

    render() {
        return (
            <View>
                <Modal animationType={'fade'}
                       visible={this.props.visible}
                       transparent
                       onRequestClose={() => {}}
                >
                    <View style={ModalStyles.container}>
                        <ScrollView style={ModalStyles.scrollView}
                                    contentContainerStyle={ModalStyles.scrollViewContainer}
                        >
                            <View style={ModalStyles.innerContainer}>
                                <Text style={ModalStyles.title}>{this.props.title}</Text>
                                <Text style={ModalStyles.text}>{this.props.message}</Text>
                                {this.renderButtons()}
                            </View>
                        </ScrollView>
                    </View>
                </Modal>
            </View>
        );
    }
}


text:
Zotero.ProgressWindow = new function() {

	/**
	 * Creates a new object representing a line in the progressWindow.
	 */
	this.ItemProgress = function(iconSrc, title, parentItemProgress) {

	};

	/**
	 * Sets the current save progress for this item.
	 * @param {Integer} percent A percentage from 0 to 100.
	 */
	this.ItemProgress.prototype.setProgress = function(percent) {

	};

	/**
	 * Sets the icon for this item.
	 */
	this.ItemProgress.prototype.setIcon = function(iconSrc) {

	};

	/**
	 * Indicates that an error occurred saving this item.
	 */
	this.ItemProgress.prototype.setError = function() {

	};

	this.ErrorMessage = function(err) {

	};

	/**
	 * Initializes and shows the progress div
	 */
	this.show = function() {

	}

	/**
	 * Changes the headline of the save window
	 */
	this.changeHeadline = function(text, icon, postText) {

	}

	/**
	 * Starts the timer to close the progress div
	 */
	this.startCloseTimer = function(delay) {

	}

	/**
	 * Closes the progress div
	 */
	this.close = function() {

	}
}


text: Sample codes for the 10th AI tool seminar


text:
package com.webserveis.app.abouttemplate;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.SpannableString;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.regex.Pattern;

public class AboutListAdapter extends RecyclerView.Adapter<AboutListAdapter.ViewHolder> {

    private static final String TAG = AboutListAdapter.class.getSimpleName();
    private AppCompatActivity context;
    private List<AboutItem> listItems;

    public AboutListAdapter(List<AboutItem> listItems, Context context) {
        super();
        this.listItems = listItems;
        this.context = (AppCompatActivity) context;

    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        Log.i(TAG, "onCreateViewHolder: ");
        View v = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.draw_item_about, parent, false);
        final ViewHolder vh = new ViewHolder(v);

        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                final int position = vh.getAdapterPosition();
                if (position != RecyclerView.NO_POSITION) {
                    Log.d(TAG, "onClick: position " + position);
                    AboutItem entry = listItems.get(position);
                    if (entry.getUri() != null) {
                        Uri uri = Uri.parse(entry.getUri());

                        if (uri.getScheme().equals("http") || uri.getScheme().equals("https")) {
                            Log.d(TAG, "is web: " + uri.toString());
                            Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
                            context.startActivity(browserIntent);
                        } else if (uri.getScheme().equals("mailto")) {
                            Log.d(TAG, "is email: " + uri.toString());
                            Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
                            context.startActivity(browserIntent);
                        } else if (uri.getScheme().equals("dialog")) {
                            Log.d(TAG, "Show dialog: " + uri.toString());

                            new CustomDialogHTML();
                            CustomDialogHTML myDiag = CustomDialogHTML.newInstance(entry.getText(), uri);
                            //myDiag.setCancelable(false);
                            myDiag.show(context.getSupportFragmentManager(), "DiaglogCustomHTML");
                        }
                    }

                }
            }

        });

        return vh;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        AboutItem entry = listItems.get(position);
        Log.i(TAG, "onBindViewHolder: ");
        Log.d(TAG, "entry: " + entry.toString());

        holder.ivImage.setImageResource(entry.getImage());
        //holder.ivImage.setColorFilter(ContextCompat.getColor(context, R.color.colorAccent));
        //holder.ivImage.setColorFilter(Color.argb(255, 255, 255, 255));
        holder.tvText.setText(entry.getText());
        holder.tvText2.setText(entry.getText2());
    }

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

    public class ViewHolder extends RecyclerView.ViewHolder {
        public ImageView ivImage;
        public TextView tvText;
        public TextView tvText2;

        public ViewHolder(View itemView) {
            super(itemView);
            ivImage = (ImageView) itemView.findViewById(R.id.image);
            tvText = (TextView) itemView.findViewById(R.id.text);
            tvText2 = (TextView) itemView.findViewById(R.id.text2);

        }
    }

}


text:
package com.handsomezhou.contactssearch.view;

import android.content.Context;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.handsomezhou.contactssearch.R;
import com.handsomezhou.contactssearch.util.ViewUtil;

public class SearchBox extends LinearLayout {
	private Context mContext;
	/* start: search box */
	private View mSearchBox;

	private EditText mSearchEt;

	private ImageView mDeleteIv;
	/* end: search box */
	private OnSearchBox mOnSearchBox;

	public interface OnSearchBox {
		void onSearchTextChanged(String curCharacter);
	}

	public SearchBox(Context context, AttributeSet attrs) {
		super(context, attrs);
		mContext = context;
		initView();
		initData();
		initListener();
	}

	public OnSearchBox getOnSearchBox() {
		return mOnSearchBox;
	}

	public void setOnSearchBox(OnSearchBox onSearchBox) {
		mOnSearchBox = onSearchBox;
	}

	public EditText getSearchEt() {
		return mSearchEt;
	}

	public void setSearchEt(EditText searchEt) {
		mSearchEt = searchEt;
	}

	public String getSearchEtInput() {
		return mSearchEt.getText().toString();
	}

	private void initView() {
		LayoutInflater.from(mContext).inflate(R.layout.search_box, this);
		mSearchBox = findViewById(R.id.search_box);

		mSearchEt = (EditText) findViewById(R.id.search_edit_text);
		mDeleteIv = (ImageView) findViewById(R.id.delete_image_view);

		return;
	}

	private void initData() {

		return;
	}

	private void initListener() {
		mSearchEt.addTextChangedListener(new TextWatcher() {

			@Override
			public void onTextChanged(CharSequence s, int start, int before,
					int count) {
				// TODO Auto-generated method stub

			}

			@Override
			public void beforeTextChanged(CharSequence s, int start, int count,
					int after) {
				// TODO Auto-generated method stub

			}

			@Override
			public void afterTextChanged(Editable s) {
				if (null != mOnSearchBox) {
					String inputStr=s.toString();
					mOnSearchBox.onSearchTextChanged(inputStr);
					if(TextUtils.isEmpty(inputStr)){
						ViewUtil.hideView(mDeleteIv);
					}else{
						ViewUtil.showView(mDeleteIv);
					}
				}

			}
		});

		mDeleteIv.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				delete();
			}
		});

		return;
	}

	private void delete() {
		mSearchEt.setText("");
		ViewUtil.hideView(mDeleteIv);
	}

}


text:
@implementation NSDictionary (JAGKeyValueSwapping)

- (NSDictionary *)swapKeysWithValues {
    NSMutableDictionary *switchedDict = [NSMutableDictionary dictionary];
    for (id key in [self allKeys]) {
        id value = self[key];
        if (switchedDict[value]) {
            NSLog(@"JAG > Failed to swap dictionary. Duplicate values found! key = %@ / value = %@", key, value);
            continue;
        }
        switchedDict[value] = key;
    }

    return [switchedDict copy]; // return a immutable instance
}

@end


text:
package io.pivotal.sensor.dao;

import org.springframework.data.repository.CrudRepository;

import io.pivotal.sensor.model.RFID;

public interface RFIDRepository extends CrudRepository<RFID, String> {

	RFID findByRfid(String rfid);

}