text:
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import * as dom from '../../../../base/browser/dom.js';
import { createFastDomNode } from '../../../../base/browser/fastDomNode.js';
import { PartFingerprints, ViewPart } from '../../view/viewPart.js';
import { withUndefinedAsNull } from '../../../../base/common/types.js';
var Coordinate = /** @class */ (function () {
    function Coordinate(top, left) {
        this.top = top;
        this.left = left;
    }
    return Coordinate;
}());
var ViewContentWidgets = /** @class */ (function (_super) {
    __extends(ViewContentWidgets, _super);
    function ViewContentWidgets(context, viewDomNode) {
        var _this = _super.call(this, context) || this;
        _this._viewDomNode = viewDomNode;
        _this._widgets = {};
        _this.domNode = createFastDomNode(document.createElement('div'));
        PartFingerprints.write(_this.domNode, 1 /* ContentWidgets */);
        _this.domNode.setClassName('contentWidgets');
        _this.domNode.setPosition('absolute');
        _this.domNode.setTop(0);
        _this.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement('div'));
        PartFingerprints.write(_this.overflowingContentWidgetsDomNode, 2 /* OverflowingContentWidgets */);
        _this.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');
        return _this;
    }
    ViewContentWidgets.prototype.dispose = function () {
        _super.prototype.dispose.call(this);
        this._widgets = {};
    };
    // --- begin event handlers
    ViewContentWidgets.prototype.onConfigurationChanged = function (e) {
        var keys = Object.keys(this._widgets);
        for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
            var widgetId = keys_1[_i];
            this._widgets[widgetId].onConfigurationChanged(e);
        }
        return true;
    };
    ViewContentWidgets.prototype.onDecorationsChanged = function (e) {
        // true for inline decorations that can end up relayouting text
        return true;
    };
    ViewContentWidgets.prototype.onFlushed = function (e) {
        return true;
    };
    ViewContentWidgets.prototype.onLineMappingChanged = function (e) {
        var keys = Object.keys(this._widgets);
        for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
            var widgetId = keys_2[_i];
            this._widgets[widgetId].onLineMappingChanged(e);
        }
        return true;
    };
    ViewContentWidgets.prototype.onLinesChanged = function (e) {
        return true;
    };
    ViewContentWidgets.prototype.onLinesDeleted = function (e) {
        return true;
    };
    ViewContentWidgets.prototype.onLinesInserted = function (e) {
        return true;
    };
    ViewContentWidgets.prototype.onScrollChanged = function (e) {
        return true;
    };
    ViewContentWidgets.prototype.onZonesChanged = function (e) {
        return true;
    };
    // ---- end view event handlers
    ViewContentWidgets.prototype.addWidget = function (_widget) {
        var myWidget = new Widget(this._context, this._viewDomNode, _widget);
        this._widgets[myWidget.id] = myWidget;
        if (myWidget.allowEditorOverflow) {
            this.overflowingContentWidgetsDomNode.appendChild(myWidget.domNode);
        }
        else {
            this.domNode.appendChild(myWidget.domNode);
        }
        this.setShouldRender();
    };
    ViewContentWidgets.prototype.setWidgetPosition = function (widget, position, range, preference) {
        var myWidget = this._widgets[widget.getId()];
        myWidget.setPosition(position, range, preference);
        this.setShouldRender();
    };
    ViewContentWidgets.prototype.removeWidget = function (widget) {
        var widgetId = widget.getId();
        if (this._widgets.hasOwnProperty(widgetId)) {
            var myWidget = this._widgets[widgetId];
            delete this._widgets[widgetId];
            var domNode = myWidget.domNode.domNode;
            domNode.parentNode.removeChild(domNode);
            domNode.removeAttribute('monaco-visible-content-widget');
            this.setShouldRender();
        }
    };
    ViewContentWidgets.prototype.shouldSuppressMouseDownOnWidget = function (widgetId) {
        if (this._widgets.hasOwnProperty(widgetId)) {
            return this._widgets[widgetId].suppressMouseDown;
        }
        return false;
    };
    ViewContentWidgets.prototype.onBeforeRender = function (viewportData) {
        var keys = Object.keys(this._widgets);
        for (var _i = 0, keys_3 = keys; _i < keys_3.length; _i++) {
            var widgetId = keys_3[_i];
            this._widgets[widgetId].onBeforeRender(viewportData);
        }
    };
    ViewContentWidgets.prototype.prepareRender = function (ctx) {
        var keys = Object.keys(this._widgets);
        for (var _i = 0, keys_4 = keys; _i < keys_4.length; _i++) {
            var widgetId = keys_4[_i];
            this._widgets[widgetId].prepareRender(ctx);
        }
    };
    ViewContentWidgets.prototype.render = function (ctx) {
        var keys = Object.keys(this._widgets);
        for (var _i = 0, keys_5 = keys; _i < keys_5.length; _i++) {
            var widgetId = keys_5[_i];
            this._widgets[widgetId].render(ctx);
        }
    };
    return ViewContentWidgets;
}(ViewPart));
export { ViewContentWidgets };
var Widget = /** @class */ (function () {
    function Widget(context, viewDomNode, actual) {
        this._context = context;
        this._viewDomNode = viewDomNode;
        this._actual = actual;
        this.domNode = createFastDomNode(this._actual.getDomNode());
        this.id = this._actual.getId();
        this.allowEditorOverflow = this._actual.allowEditorOverflow || false;
        this.suppressMouseDown = this._actual.suppressMouseDown || false;
        this._fixedOverflowWidgets = this._context.configuration.editor.viewInfo.fixedOverflowWidgets;
        this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
        this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
        this._lineHeight = this._context.configuration.editor.lineHeight;
        this._setPosition(null, null);
        this._preference = [];
        this._cachedDomNodeClientWidth = -1;
        this._cachedDomNodeClientHeight = -1;
        this._maxWidth = this._getMaxWidth();
        this._isVisible = false;
        this._renderData = null;
        this.domNode.setPosition((this._fixedOverflowWidgets && this.allowEditorOverflow) ? 'fixed' : 'absolute');
        this.domNode.setVisibility('hidden');
        this.domNode.setAttribute('widgetId', this.id);
        this.domNode.setMaxWidth(this._maxWidth);
    }
    Widget.prototype.onConfigurationChanged = function (e) {
        if (e.lineHeight) {
            this._lineHeight = this._context.configuration.editor.lineHeight;
        }
        if (e.layoutInfo) {
            this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
            this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
            this._maxWidth = this._getMaxWidth();
        }
    };
    Widget.prototype.onLineMappingChanged = function (e) {
        this._setPosition(this._position, this._range);
    };
    Widget.prototype._setPosition = function (position, range) {
        this._position = withUndefinedAsNull(position);
        this._range = withUndefinedAsNull(range);
        this._viewPosition = null;
        this._viewRange = null;
        if (this._position) {
            // Do not trust that widgets give a valid position
            var validModelPosition = this._context.model.validateModelPosition(this._position);
            if (this._context.model.coordinatesConverter.modelPositionIsVisible(validModelPosition)) {
                this._viewPosition = this._context.model.coordinatesConverter.convertModelPositionToViewPosition(validModelPosition);
            }
        }
        if (this._range) {
            // Do not trust that widgets give a valid position
            var validModelRange = this._context.model.validateModelRange(this._range);
            this._viewRange = this._context.model.coordinatesConverter.convertModelRangeToViewRange(validModelRange);
        }
    };
    Widget.prototype._getMaxWidth = function () {
        return (this.allowEditorOverflow
            ? window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
            : this._contentWidth);
    };
    Widget.prototype.setPosition = function (position, range, preference) {
        this._setPosition(position, range);
        this._preference = withUndefinedAsNull(preference);
        this._cachedDomNodeClientWidth = -1;
        this._cachedDomNodeClientHeight = -1;
    };
    Widget.prototype._layoutBoxInViewport = function (topLeft, bottomLeft, width, height, ctx) {
        // Our visible box is split horizontally by the current line => 2 boxes
        // a) the box above the line
        var aboveLineTop = topLeft.top;
        var heightAboveLine = aboveLineTop;
        // b) the box under the line
        var underLineTop = bottomLeft.top + this._lineHeight;
        var heightUnderLine = ctx.viewportHeight - underLineTop;
        var aboveTop = aboveLineTop - height;
        var fitsAbove = (heightAboveLine >= height);
        var belowTop = underLineTop;
        var fitsBelow = (heightUnderLine >= height);
        // And its left
        var actualAboveLeft = topLeft.left;
        var actualBelowLeft = bottomLeft.left;
        if (actualAboveLeft + width > ctx.scrollLeft + ctx.viewportWidth) {
            actualAboveLeft = ctx.scrollLeft + ctx.viewportWidth - width;
        }
        if (actualBelowLeft + width > ctx.scrollLeft + ctx.viewportWidth) {
            actualBelowLeft = ctx.scrollLeft + ctx.viewportWidth - width;
        }
        if (actualAboveLeft < ctx.scrollLeft) {
            actualAboveLeft = ctx.scrollLeft;
        }
        if (actualBelowLeft < ctx.scrollLeft) {
            actualBelowLeft = ctx.scrollLeft;
        }
        return {
            fitsAbove: fitsAbove,
            aboveTop: aboveTop,
            aboveLeft: actualAboveLeft,
            fitsBelow: fitsBelow,
            belowTop: belowTop,
            belowLeft: actualBelowLeft,
        };
    };
    Widget.prototype._layoutBoxInPage = function (topLeft, bottomLeft, width, height, ctx) {
        var aboveLeft0 = topLeft.left - ctx.scrollLeft;
        var belowLeft0 = bottomLeft.left - ctx.scrollLeft;
        if (aboveLeft0 < 0 || aboveLeft0 > this._contentWidth) {
            // Don't render if position is scrolled outside viewport
            return null;
        }
        var aboveTop = topLeft.top - height;
        var belowTop = bottomLeft.top + this._lineHeight;
        var aboveLeft = aboveLeft0 + this._contentLeft;
        var belowLeft = belowLeft0 + this._contentLeft;
        var domNodePosition = dom.getDomNodePagePosition(this._viewDomNode.domNode);
        var absoluteAboveTop = domNodePosition.top + aboveTop - dom.StandardWindow.scrollY;
        var absoluteBelowTop = domNodePosition.top + belowTop - dom.StandardWindow.scrollY;
        var absoluteAboveLeft = domNodePosition.left + aboveLeft - dom.StandardWindow.scrollX;
        var absoluteBelowLeft = domNodePosition.left + belowLeft - dom.StandardWindow.scrollX;
        var INNER_WIDTH = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
        var INNER_HEIGHT = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
        // Leave some clearance to the bottom
        var TOP_PADDING = 22;
        var BOTTOM_PADDING = 22;
        var fitsAbove = (absoluteAboveTop >= TOP_PADDING), fitsBelow = (absoluteBelowTop + height <= INNER_HEIGHT - BOTTOM_PADDING);
        if (absoluteAboveLeft + width + 20 > INNER_WIDTH) {
            var delta = absoluteAboveLeft - (INNER_WIDTH - width - 20);
            absoluteAboveLeft -= delta;
            aboveLeft -= delta;
        }
        if (absoluteBelowLeft + width + 20 > INNER_WIDTH) {
            var delta = absoluteBelowLeft - (INNER_WIDTH - width - 20);
            absoluteBelowLeft -= delta;
            belowLeft -= delta;
        }
        if (absoluteAboveLeft < 0) {
            var delta = absoluteAboveLeft;
            absoluteAboveLeft -= delta;
            aboveLeft -= delta;
        }
        if (absoluteBelowLeft < 0) {
            var delta = absoluteBelowLeft;
            absoluteBelowLeft -= delta;
            belowLeft -= delta;
        }
        if (this._fixedOverflowWidgets) {
            aboveTop = absoluteAboveTop;
            belowTop = absoluteBelowTop;
            aboveLeft = absoluteAboveLeft;
            belowLeft = absoluteBelowLeft;
        }
        return { fitsAbove: fitsAbove, aboveTop: aboveTop, aboveLeft: aboveLeft, fitsBelow: fitsBelow, belowTop: belowTop, belowLeft: belowLeft };
    };
    Widget.prototype._prepareRenderWidgetAtExactPositionOverflowing = function (topLeft) {
        return new Coordinate(topLeft.top, topLeft.left + this._contentLeft);
    };
    /**
     * Compute `this._topLeft`
     */
    Widget.prototype._getTopAndBottomLeft = function (ctx) {
        if (!this._viewPosition) {
            return [null, null];
        }
        var visibleRangeForPosition = ctx.visibleRangeForPosition(this._viewPosition);
        if (!visibleRangeForPosition) {
            return [null, null];
        }
        var topForPosition = ctx.getVerticalOffsetForLineNumber(this._viewPosition.lineNumber) - ctx.scrollTop;
        var topLeft = new Coordinate(topForPosition, visibleRangeForPosition.left);
        var largestLineNumber = this._viewPosition.lineNumber;
        var smallestLeft = visibleRangeForPosition.left;
        if (this._viewRange) {
            var visibleRangesForRange = ctx.linesVisibleRangesForRange(this._viewRange, false);
            if (visibleRangesForRange && visibleRangesForRange.length > 0) {
                for (var i = visibleRangesForRange.length - 1; i >= 0; i--) {
                    var visibleRangesForLine = visibleRangesForRange[i];
                    if (visibleRangesForLine.lineNumber >= largestLineNumber) {
                        if (visibleRangesForLine.lineNumber > largestLineNumber) {
                            largestLineNumber = visibleRangesForLine.lineNumber;
                            smallestLeft = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;
                        }
                        for (var j = 0, lenJ = visibleRangesForLine.ranges.length; j < lenJ; j++) {
                            var visibleRange = visibleRangesForLine.ranges[j];
                            if (visibleRange.left < smallestLeft) {
                                smallestLeft = visibleRange.left;
                            }
                        }
                    }
                }
            }
        }
        var topForBottomLine = ctx.getVerticalOffsetForLineNumber(largestLineNumber) - ctx.scrollTop;
        var bottomLeft = new Coordinate(topForBottomLine, smallestLeft);
        return [topLeft, bottomLeft];
    };
    Widget.prototype._prepareRenderWidget = function (ctx) {
        var _a = this._getTopAndBottomLeft(ctx), topLeft = _a[0], bottomLeft = _a[1];
        if (!topLeft || !bottomLeft) {
            return null;
        }
        if (this._cachedDomNodeClientWidth === -1 || this._cachedDomNodeClientHeight === -1) {
            var domNode = this.domNode.domNode;
            this._cachedDomNodeClientWidth = domNode.clientWidth;
            this._cachedDomNodeClientHeight = domNode.clientHeight;
        }
        var placement;
        if (this.allowEditorOverflow) {
            placement = this._layoutBoxInPage(topLeft, bottomLeft, this._cachedDomNodeClientWidth, this._cachedDomNodeClientHeight, ctx);
        }
        else {
            placement = this._layoutBoxInViewport(topLeft, bottomLeft, this._cachedDomNodeClientWidth, this._cachedDomNodeClientHeight, ctx);
        }
        // Do two passes, first for perfect fit, second picks first option
        if (this._preference) {
            for (var pass = 1; pass <= 2; pass++) {
                for (var _i = 0, _b = this._preference; _i < _b.length; _i++) {
                    var pref = _b[_i];
                    // placement
                    if (pref === 1 /* ABOVE */) {
                        if (!placement) {
                            // Widget outside of viewport
                            return null;
                        }
                        if (pass === 2 || placement.fitsAbove) {
                            return new Coordinate(placement.aboveTop, placement.aboveLeft);
                        }
                    }
                    else if (pref === 2 /* BELOW */) {
                        if (!placement) {
                            // Widget outside of viewport
                            return null;
                        }
                        if (pass === 2 || placement.fitsBelow) {
                            return new Coordinate(placement.belowTop, placement.belowLeft);
                        }
                    }
                    else {
                        if (this.allowEditorOverflow) {
                            return this._prepareRenderWidgetAtExactPositionOverflowing(topLeft);
                        }
                        else {
                            return topLeft;
                        }
                    }
                }
            }
        }
        return null;
    };
    /**
     * On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly.
     */
    Widget.prototype.onBeforeRender = function (viewportData) {
        if (!this._viewPosition || !this._preference) {
            return;
        }
        if (this._viewPosition.lineNumber < viewportData.startLineNumber || this._viewPosition.lineNumber > viewportData.endLineNumber) {
            // Outside of viewport
            return;
        }
        this.domNode.setMaxWidth(this._maxWidth);
    };
    Widget.prototype.prepareRender = function (ctx) {
        this._renderData = this._prepareRenderWidget(ctx);
    };
    Widget.prototype.render = function (ctx) {
        if (!this._renderData) {
            // This widget should be invisible
            if (this._isVisible) {
                this.domNode.removeAttribute('monaco-visible-content-widget');
                this._isVisible = false;
                this.domNode.setVisibility('hidden');
            }
            return;
        }
        // This widget should be visible
        if (this.allowEditorOverflow) {
            this.domNode.setTop(this._renderData.top);
            this.domNode.setLeft(this._renderData.left);
        }
        else {
            this.domNode.setTop(this._renderData.top + ctx.scrollTop - ctx.bigNumbersDelta);
            this.domNode.setLeft(this._renderData.left);
        }
        if (!this._isVisible) {
            this.domNode.setVisibility('inherit');
            this.domNode.setAttribute('monaco-visible-content-widget', 'true');
            this._isVisible = true;
        }
    };
    return Widget;
}());

redpajama_set_name: RedPajamaGithub


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

final class Business extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
    }
    public function index(){
        $user=$this->session->userdata("user");
        $data=$this->bm->get(["user"=>$user->uid]);
        $this->dashboard($data);
    }

    public function all_business(){

        if($this->session->userdata("user")->type==ADMIN_USER){
            $data=$this->bm->get(null);
            $this->dashboard($data);
        }else{
            redirect($this->agent->referer);
        }
    }

    public function register(){
        if($this->input->is_ajax_request()){
            //Le asignamos las reglas de validacion
            $this->form_validation->set_rules("cif","cif","required|min_length[2]|max_length[50]|xss_clean|is_unique[business.cif]");
            $this->form_validation->set_rules("name","name","min_length[2]|max_length[100]|xss_clean");
            $this->form_validation->set_rules("ip","ip","min_length[2]|max_length[20]|xss_clean");
            //Le asignamos los mensajes para las reglas
            $this->form_validation->set_message("required","El campo %s es obligatorio");
            $this->form_validation->set_message("is_unique","El cif proporcionado ya esta registrado en nuestro sistema");
            $this->form_validation->set_message("min_length","El campo %s debe tener al menos %s caracteres");
            $this->form_validation->set_message("max_length","El campo %s no debe tener mas de %s caracteres");
            if(!$this->form_validation->run()){
                output_json(['status'=>0,'message'=>validation_errors()]);
            }else{
                $post=$this->input->post();
                $post["user"]=$this->session->userdata("user")->uid;
                if($this->bm->insert($post)){
                    $business=$this->bm->get(['cif'=>$post['cif']]);
                    output_json(['status'=>1,'message'=>'Se ha registrado con exito',"url"=>base_url('business')]);
                }else{
                    output_error_json(['status'=>0,'message'=>'Error interno al insertar'],400);
                }
            }
        }else{
            redirect($this->agent->referer);
        }
    }

    public function detail($id){
        if($this->input->get() && !empty($id)) {
            //Le asignamos las reglas de validacion
            if($data=$this->bm->get($id)){
                $this->load->view('commons/header');
                $this->load->view('business/details',$data);
                $this->load->view('commons/footer');
            }else{
                show_error("No se ha encontrado la empresa solicitada",404);
            }
        }else{
            redirect($this->agent->referer);
        }
    }
    public function update($cif){
        if($this->input->is_ajax_request()){
            $data=$this->input->post();
            if($this->bm->update($data,["cif"=>$cif])){
                output_json(['status'=>1,'message'=>"Actualizado con exito", "url"=>base_url('business')]);
            }else{
                output_error_json(['status'=>0,'message'=>"No se acualizó ningun elemento"],400);
            }
        }else{
            redirect($this->agent->referer);
        }
    }
    public function delete($cif=null){
        if($this->input->is_ajax_request()){
            if(is_null($cif)&& $this->session->userdata("user")->type==ADMIN_USER){
                if($this->bm->delete()){
                    output_json(['status'=>1,'message'=>"Se eliminaron todas las con exito"]);
                }else{
                    output_error_json(['status'=>0,'message'=>"Ningun elemento ha sido eliminado"],400);
                }
            }else if(!is_null($cif)){
                if($this->bm->delete(["cif"=>$cif])){
                    output_json(['status'=>1,'message'=>"Eliminado con exito"]);
                }else{
                    output_error_json(['status'=>0,'message'=>"Ningun elemento ha sido eliminado"],400);
                }
            }else{
                output_error_json(['status'=>0,'message'=>"No estas autorizado"],401);
            }
        }else{
            redirect($this->agent->referer);
        }
    }

    private function dashboard($data)
    {
        $this->load->view('commons/header');
        $this->load->view('dashboard/business',["data"=>$data]);
        $this->load->view('commons/footer');
    }

}
//End of file applications/controller/Hello.php


text:
include(ans.env)
include(ans.parse_arguments)

# doxygen_support([TARGET target_name] [TEMPLATE template_name])
# http://goo.gl/kKWx0
macro(doxygen_support)
    parse_arguments(
        DOXYGEN_SUPPORT
        "TARGET;TEMPLATE"
        ""
        ${ARGN}
        )
    list(APPEND DOXYGEN_SUPPORT_TARGET docs)
    car(DOXYGEN_SUPPORT_TARGET_ ${DOXYGEN_SUPPORT_TARGET})
    list(APPEND DOXYGEN_SUPPORT_TEMPLATE ${ANS_TEMPLATE_DIR}/Doxyfile.in)
    car(DOXYGEN_SUPPORT_TEMPLATE_ ${DOXYGEN_SUPPORT_TEMPLATE})
    find_package(Doxygen REQUIRED)
    configure_file(${DOXYGEN_SUPPORT_TEMPLATE_} ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE)
    add_custom_target(
        ${DOXYGEN_SUPPORT_TARGET_}
        #ALL
        COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
        SOURCES ${PROJECT_BINARY_DIR}/Doxyfile
        )
    # IF you do NOT want the documentation to be generated EVERY time you build the project
    # then leave out the 'ALL' keyword from the above command.
endmacro()


text:
<manifest
    package="net.ebt.muzei.miyazaki"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-feature android:name="android.hardware.type.watch"/>

    <application tools:ignore="GoogleAppIndexingWarning">

        <activity
            android:name=".SettingsActivity"
            android:exported="true"
            android:theme="@style/AppTheme">
        </activity>

        <meta-data
            android:name="com.google.android.wearable.standalone"
            android:value="true"/>
    </application>
</manifest>


text:
import * as React from 'react';
import { makeStyles } from '@material-ui/styles';
import { Theme, createTheme } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';
import AdapterDateFns from '@material-ui/lab/AdapterDateFns';
import LocalizationProvider from '@material-ui/lab/LocalizationProvider';
import StaticDatePicker from '@material-ui/lab/StaticDatePicker';
import PickersDay, { PickersDayProps } from '@material-ui/lab/PickersDay';
import clsx from 'clsx';
import endOfWeek from 'date-fns/endOfWeek';
import isSameDay from 'date-fns/isSameDay';
import isWithinInterval from 'date-fns/isWithinInterval';
import startOfWeek from 'date-fns/startOfWeek';

const defaultTheme = createTheme();

const useStyles = makeStyles(
  (theme: Theme) => ({
    highlight: {
      borderRadius: 0,
      backgroundColor: theme.palette.primary.main,
      color: theme.palette.common.white,
      '&:hover, &:focus': {
        backgroundColor: theme.palette.primary.dark,
      },
    },
    firstHighlight: {
      borderTopLeftRadius: '50%',
      borderBottomLeftRadius: '50%',
    },
    endHighlight: {
      borderTopRightRadius: '50%',
      borderBottomRightRadius: '50%',
    },
  }),
  { defaultTheme },
);

export default function CustomDay() {
  const classes = useStyles();
  const [value, setValue] = React.useState<Date | null>(new Date());

  const renderWeekPickerDay = (
    date: Date,
    selectedDates: Array<Date | null>,
    pickersDayProps: PickersDayProps<Date>,
  ) => {
    if (!value) {
      return <PickersDay {...pickersDayProps} />;
    }

    const start = startOfWeek(value);
    const end = endOfWeek(value);

    const dayIsBetween = isWithinInterval(date, { start, end });
    const isFirstDay = isSameDay(date, start);
    const isLastDay = isSameDay(date, end);

    return (
      <PickersDay
        {...pickersDayProps}
        disableMargin
        className={clsx({
          [classes.highlight]: dayIsBetween,
          [classes.firstHighlight]: isFirstDay,
          [classes.endHighlight]: isLastDay,
        })}
      />
    );
  };

  return (
    <LocalizationProvider dateAdapter={AdapterDateFns}>
      <StaticDatePicker
        displayStaticWrapperAs="desktop"
        label="Week picker"
        value={value}
        onChange={(newValue) => {
          setValue(newValue);
        }}
        renderDay={renderWeekPickerDay}
        renderInput={(params) => <TextField {...params} />}
        inputFormat="'Week of' MMM d"
      />
    </LocalizationProvider>
  );
}


text:
"""
    colorful
    ~~~~~~~~

    Terminal string styling done right, in Python.

    :copyright: (c) 2017 by Timo Furrer <tuxtimo@gmail.com>
    :license: MIT, see LICENSE for more details.
"""

import sys

import colorful

colorful.use_true_colors()

def show():
    """
    Show the modifiers and colors
    """
    with colorful.with_style('monokai') as c:
        # modifiers
        sys.stdout.write(c.bold('bold') + ' ')
        sys.stdout.write(c.dimmed('dimmed') + ' ')
        sys.stdout.write(c.italic('italic') + ' ')
        sys.stdout.write(c.underlined('underlined') + ' ')
        sys.stdout.write(c.inversed('inversed') + ' ')
        sys.stdout.write(c.concealed('concealed') + ' ')
        sys.stdout.write(c.struckthrough('struckthrough') + '\n')

        # foreground colors
        sys.stdout.write(c.orange('orange') + ' ')
        sys.stdout.write(c.magenta('magenta') + ' ')
        sys.stdout.write(c.purple('purple') + ' ')
        sys.stdout.write(c.blue('blue') + ' ')
        sys.stdout.write(c.seaGreen('sea green') + ' ')
        sys.stdout.write(c.green('green') + ' ')
        sys.stdout.write(c.yellow('yellow') + '\n')

        # background colors
        sys.stdout.write(c.on_orange('orange') + ' ')
        sys.stdout.write(c.on_magenta('magenta') + ' ')
        sys.stdout.write(c.on_purple('purple') + ' ')
        sys.stdout.write(c.on_blue('blue') + ' ')
        sys.stdout.write(c.on_seaGreen('sea green') + ' ')
        sys.stdout.write(c.gray_on_green('green') + ' ')
        sys.stdout.write(c.gray_on_yellow('yellow') + '\n')

if __name__ == '__main__':
    show()


text:
package com.obidea.semantika.database.base;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ForeignKey extends DatabaseObject implements IForeignKey
{
   private static final long serialVersionUID = 629451L;

   private ITable mTableObject;

   private List<IColumnReference> mReferences;

   public ForeignKey(final ITable table, final String name)
   {
      super(name);
      mTableObject = table;
      mReferences = new ArrayList<IColumnReference>();
   }

   /**
    * Returns the associated table of this foreign key object.
    */
   @Override
   public ITable getParentObject()
   {
      return mTableObject;
   }

   public void addReference(int keySequence, IColumn pkColumn, IColumn fkColumn)
   {
      final ColumnReference cr = new ColumnReference();
      cr.setPrimaryKeyColumn(pkColumn);
      cr.setForeignKeyColumn(fkColumn);

      preventOutOfBoundException(keySequence);
      mReferences.set(keySequence, cr); // use set to replace any existing null value.
   }

   /*
    * The insertion through keySequence may go right to the middle of the
    * list and therefore IndexOutOfBoundException can occur because index >
    * size. This method is used to prevent such exception by inserting
    * first null values until reaching the keySequence index.
    */
   private void preventOutOfBoundException(int keySequence)
   {
      int size = mReferences.size();
      if (keySequence >= size) {
         for (int i = size; i <= keySequence; i++) {
            mReferences.add(i, null);
         }
      }
   }

   @Override
   public List<IColumnReference> getReferences()
   {
      return Collections.unmodifiableList(mReferences);
   }
}


text:
// Copyright 2021 Gravitational, Inc
//
// 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 dynamo implements DynamoDB storage backend
for Teleport auth service, similar to etcd backend.

dynamo package implements the DynamoDB storage back-end for the
auth server. Originally contributed by https://github.com/apestel

limitations:

  - Paging is not implemented, hence all range operations are limited
    to 1MB result set
*/
package dynamo


text:
namespace SevenNintySix {

double getQuote(Parameters& params, bool isBid) {
	json_t* root = getJsonFromUrl(params, "http://api.796.com/v3/futures/ticker.html?type=weekly", "");
	const char* quote;
	double quoteValue;
	if (isBid) {
	  quote = json_string_value(json_object_get(json_object_get(root, "ticker"), "buy"));
	} else {
	  quote = json_string_value(json_object_get(json_object_get(root, "ticker"), "sell"));
	}
	if (quote != NULL) {
		quoteValue = atof(quote);
	} else {
		quoteValue = 0.0;
	}
	json_decref(root);
	return quoteValue;
}

double getAvail(Parameters& params, std::string currency){
	  json_t* root= authRequest(params,"https://796.com/v2/user/get_balance","balances","");
	  while (json_object_get(root, "message") != NULL) {
	    sleep(1.0);
	    *params.logFile << "<SevenNintySix> Error with JSON in getAvail: " << json_dumps(root, 0) << ". Retrying..." << std::endl;
	    root = authRequest(params,"https://796.com/v2/user/get_balance","balances","");
	  }

	  double availability = 0.0;
	  if (currency.compare("btc") == 0) {
	    availability = atof(json_string_value(json_object_get(root, "btc_balance")));
	  }
	  else if (currency.compare("mri") == 0) {
	    availability = atof(json_string_value(json_object_get(root, "mri_balance")));
	  }
	  else if (currency.compare("asicminer") == 0) {
	 	    availability = atof(json_string_value(json_object_get(root, "asicminer_balance")));
	  }
	  json_decref(root);
	  return availability;
}

int sendOrder(Parameters& params, std::string direction, double quantity, double price){
	double limPrice;  // define limit price to be sure to be executed
	if (direction.compare("buy") == 0) {
		limPrice = getLimitPrice(params, quantity, false);
	}
	else if (direction.compare("sell") == 0) {
	  limPrice = getLimitPrice(params, quantity, true);
	}

	*params.logFile << "<SevenNintySix> Trying to send a \"" << direction << "\" limit order: " << quantity << "@$" << limPrice << "..." << std::endl;
	std::ostringstream oss;
	oss << "\"symbol\":\"btcusd\", \"amount\":\"" << quantity << "\", \"price\":\"" << limPrice << "\", \"exchange\":\"bitfinex\", \"side\":\"" << direction << "\", \"type\":\"limit\"";
	std::string options = oss.str();

	json_t* root= authRequest(params, "https://796.com/v2/weeklyfutures/orders", "order/new", options);
	int orderId = json_integer_value(json_object_get(root, "id"));
	*params.logFile << "<SevenNintySix> Done (order ID: " << orderId << ")\n" << std::endl;

	json_decref(root);
	return orderId;
}

// check the status of the order
bool isOrderComplete(Parameters& params, int orderId){
	if (orderId == 0) {
	    return true;
	}
	std::ostringstream oss;
	oss << "\"order_id\":" << orderId;
	std::string options = oss.str();

	json_t* root= authRequest(params, "https://796.com/v2/weeklyfutures/orders", "order/status", options);

	bool isComplete = false;
	std::string _str=json_string_value(json_object_get((json_object_get(root, "data")),"state"));
	if(0 == strcmp(_str.c_str(),"done"))
	{
		isComplete = true;
	}
	else if((0 == strcmp(_str.c_str(),"wait"))||(0 == strcmp(_str.c_str(),"not")))
	{
		isComplete = false;
	}
	json_decref(root);
	return isComplete;
}

// get the Bitcoin exposition
double getActivePos(Parameters& params){
	return getAvail(params, "btc");
}

// get the limit price according to the requested volume
double getLimitPrice(Parameters& params, double volume, bool isBid){
	json_t* root;
	  if (isBid) {
	    root = json_object_get(getJsonFromUrl(params, "http://api.796.com/v3/futures/depth.html?type=weekly", ""), "bids");
	  } else {
	    root = json_object_get(getJsonFromUrl(params, "http://api.796.com/v3/futures/depth.html?type=weekly", ""), "asks");
	  }
	  // loop on volume
	  *params.logFile << "<SevenNintySix> Looking for a limit price to fill " << volume << "BTC..." << std::endl;
	  double tmpVol = 0.0;
	  int i = 0;
	  while (tmpVol < volume) {
	    // volumes are added up until the requested volume is reached
	      double p = json_real_value(json_array_get(json_array_get(root, i), 0));
	      double v = json_real_value(json_array_get(json_array_get(root, i), 1));

	    *params.logFile << "<SevenNintySix> order book: " << v << "@$" << p << std::endl;
	    tmpVol += v;
	    i++;
	  }
	  // return the next offer
	  double limPrice = 0.0;
	  if (params.aggressiveVolume) {
	    limPrice = atof(json_string_value(json_array_get(json_array_get(root, i), 0)));
	  } else {
	    limPrice = atof(json_string_value(json_array_get(json_array_get(root, i+1), 0)));
	  }
	  json_decref(root);
	  return limPrice;
}

// send a request to the exchange and return a JSON object
json_t* authRequest(Parameters& params, std::string url, std::string signature, std::string content){

	  unsigned char digest[MD5_DIGEST_LENGTH];

	  MD5((unsigned char*)signature.c_str(), strlen(signature.c_str()), (unsigned char*)&digest);

	  char mdString[33];
	  for (int i = 0; i < 16; i++) {
	    sprintf(&mdString[i*2], "%02X", (unsigned int)digest[i]);
	  }

	  std::ostringstream oss;
	  oss << content << "&sign=" << mdString;

	  std::string postParameters = oss.str().c_str();

	  // cURL headers
	  struct curl_slist* headers = NULL;
	  headers = curl_slist_append(headers, "contentType: application/x-www-form-urlencoded");

	  // cURL request
	  CURLcode resCurl;
	  // curl = curl_easy_init();
	  if (params.curl) {
	    curl_easy_setopt(params.curl, CURLOPT_POST,1L);
	    // curl_easy_setopt(params.curl, CURLOPT_VERBOSE, 1L);
	    curl_easy_setopt(params.curl, CURLOPT_HTTPHEADER, headers);
	    curl_easy_setopt(params.curl, CURLOPT_POSTFIELDS, postParameters.c_str());
	    curl_easy_setopt(params.curl, CURLOPT_SSL_VERIFYPEER, 0L);
	    curl_easy_setopt(params.curl, CURLOPT_WRITEFUNCTION, WriteCallback);
	    std::string readBuffer;
	    curl_easy_setopt(params.curl, CURLOPT_WRITEDATA, &readBuffer);
	    curl_easy_setopt(params.curl, CURLOPT_URL, url.c_str());
	    curl_easy_setopt(params.curl, CURLOPT_CONNECTTIMEOUT, 10L);
	    resCurl = curl_easy_perform(params.curl);
	    json_t* root;
	    json_error_t error;

	    while (resCurl != CURLE_OK) {
	      *params.logFile << "<SevenNintySix> Error with cURL. Retry in 2 sec..." << std::endl;
	      sleep(2.0);
	      resCurl = curl_easy_perform(params.curl);
	    }
	    root = json_loads(readBuffer.c_str(), 0, &error);

	    while (!root) {
	      *params.logFile << "<SevenNintySix> Error with JSON:\n" << error.text << ". Retrying..." << std::endl;
	      readBuffer = "";
	      resCurl = curl_easy_perform(params.curl);
	      while (resCurl != CURLE_OK) {
	        *params.logFile << "<SevenNintySix> Error with cURL. Retry in 2 sec..." << std::endl;
	        sleep(2.0);
	        readBuffer = "";
	        resCurl = curl_easy_perform(params.curl);
	      }
	      root = json_loads(readBuffer.c_str(), 0, &error);
	    }
	    curl_slist_free_all(headers);
	    curl_easy_reset(params.curl);
	    return root;
	  }
	  else {
	    *params.logFile << "<SevenNintySix> Error with cURL init." << std::endl;
	    return NULL;
	  }

	}
}


text:
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

/**
 * Created by Bajtas on 27.11.2016.
 */

public class FileChecker {
    private static final Logger LOG = Logger.getLogger(FileChecker.class);

    private static Properties config = new Properties();
    private static String directoryPath;
    private static List<String> files = new ArrayList<>();
    private static ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();

    public FileChecker(String[] args) {
        LOG.info("Checking if directory exist.");

        directoryPath = args[0]; // path to directory
        files.addAll(Arrays.asList(args).subList(1, args.length));
    }

    public void prepare() {
        try {
            config.load(new FileInputStream("./" + Globals.CONFIG_FILENAME));
        } catch (IOException e) {
            e.printStackTrace();
            config = null;
        }
    }

    public boolean isArgsValid() {
        if (!Util.isStringValid(directoryPath) || !Files.isDirectory(Paths.get(directoryPath)) || config == null) {
            LOG.error("Specified directory not exist!");
            return false;
        }

        return true;
    }

    public void start() {
        for (String file : files) {
            String filePath = directoryPath + '\\' + file;
            exec.scheduleAtFixedRate(new Checker(filePath, config), 0, 5, TimeUnit.SECONDS);
        }
    }

    public static synchronized boolean isLastFileToCheck() {
        if (files.isEmpty())
            return true;
        return false;
    }

    public static void stopAll() {
        exec.shutdown();
    }

    public static void removeFromList(String filePath) {
        Path path = Paths.get(filePath);
        files.remove(path.getFileName().toString());
    }

    public static Properties getConfig() {
        return config;
    }

    public static void setConfig(Properties config) {
        FileChecker.config = config;
    }

    public static String getDirectoryPath() {
        return directoryPath;
    }

    public static void setDirectoryPath(String directoryPath) {
        FileChecker.directoryPath = directoryPath;
    }

    public static List<String> getFiles() {
        return files;
    }

    public static void setFiles(List<String> files) {
        FileChecker.files = files;
    }
}


text:
The most straightforward way to customize the Safety Outlier Explorer is by using a configuration object whose properties describe the behavior and appearance of the chart. Since the Safety Outlier Explorer is a Webcharts `chart` object, many default Webcharts settings are set in the [defaultSettings.js file](https://github.com/RhoInc/safety-outlier-explorer/blob/master/src/defaultSettings.js) as [described below](#webcharts-settings). Refer to the [Webcharts documentation](https://github.com/RhoInc/Webcharts/wiki/Chart-Configuration) for more details on these settings.

In addition to the standard Webcharts settings several custom settings not available in the base Webcharts library have been added to the Safety Outlier Explorer to facilitate data mapping and other custom functionality. These custom settings are described in detail below. All defaults can be overwritten by users.

# Renderer-specific settings
The sections below describe each safety-outlier-explorer setting as of version 2.7.0.

## settings.id_col
`string`

variable: participant identifier

**default:** `"USUBJID"`

## settings.time_cols
`array`

visit metadata

**default:**
```
[
  {
    "type": "ordinal",
    "value_col": "VISIT",
    "label": "Visit",
    "order_col": "VISITNUM",
    "order": null,
    "rotate_tick_labels": true,
    "vertical_space": 100
  },
  {
    "type": "linear",
    "value_col": "DY",
    "label": "Study Day",
    "order_col": "DY",
    "order": null,
    "rotate_tick_labels": false,
    "vertical_space": 0
  }
]
```

### settings.time_cols[].type
`string`

Visit variable data type

**default:** `"ordinal"`

### settings.time_cols[].value_col
`string`

Visit variable name

**default:** `"VISIT"`

### settings.time_cols[].label
`string`

Visit variable label

**default:** `"Visit"`

### settings.time_cols[].order_col
`string`

Visit ordering variable name

**default:** `"VISITNUM"`

### settings.time_cols[].order
`array`

Visit order

**default:** none

### settings.time_cols[].rotate_tick_labels
`boolean`

Rotate tick labels 45 degrees?

**default:** `true`

### settings.time_cols[].vertical_space
`number`

Rotated tick label spacing

**default:** `100`

## settings.measure_col
`string`

variable: measure

**default:** `"TEST"`

## settings.measure_order_col
`string`

variable: measure order

**default:** `"TESTN"`

## settings.unit_col
`string`

variable: units of measurement

**default:** `"STRESU"`

## settings.value_col
`string`

variable: result

**default:** `"STRESN"`

## settings.normal_col_low
`string`

variable: lower limit of normal

**default:** `"STNRLO"`

## settings.normal_col_high
`string`

variable: upper limit of normal

**default:** `"STNRHI"`

## settings.start_value
`string`

value of measure to display initially

**default:** none

## settings.filters
`array`

an array of filter variables and associated metadata

**default:** none

### settings.filters[].value_col
`string`

Variable name

**default:** none

### settings.filters[].label
`string`

Variable label

**default:** none

## settings.groups
`array`

an array of grouping variables and associated metadata

**default:** none

### settings.groups[].value_col
`string`

Variable name

**default:** none

### settings.groups[].label
`string`

Variable label

**default:** none

## settings.details
`array`

an array of participant-level variables and associated metadata

**default:**
```
[
  {
    "value_col": "AGE",
    "label": "Age"
  },
  {
    "value_col": "SEX",
    "label": "Sex"
  },
  {
    "value_col": "RACE",
    "label": "Race"
  }
]
```

### settings.details[].value_col
`string`

Variable name

**default:** `"AGE"`

### settings.details[].label
`string`

Variable label

**default:** `"Age"`

## settings.multiples_sizing
`object`

width and height of small multiples

### settings.multiples_sizing.width
`number`

Width

**default:** `300`

### settings.multiples_sizing.height
`number`

Height

**default:** `100`

## settings.normal_range_method
`string`

method for identifying the normal range

**default:** `"LLN-ULN"`

## settings.normal_range_sd
`number`

the number of standard deviations from the mean with which to define the normal range

**default:** `1.96`

## settings.normal_range_quantile_low
`number`

this quantile defines the lower bound of the normal range

**default:** `0.05`

## settings.normal_range_quantile_high
`number`

this quantile defines the upper bound of the normal range

**default:** `0.95`

## settings.visits_without_data
`boolean`

controls display of visits without data for the current measure

**default:** `false`

## settings.unscheduled_visits
`boolean`

controls display of unscheduled visits

**default:** `false`

## settings.unscheduled_visit_pattern
`string`

a regular expression that identifies unscheduled visits

**default:** `"/unscheduled|early termination/i"`

## settings.unscheduled_visit_values
`array`

an array of strings that identify unscheduled visits; overrides unscheduled_visit_pattern

**default:** none

## settings.line_attributes
`object`

an object that defines the line color, thickness, and opacity

### settings.line_attributes.stroke
`string`

the color of the line

**default:** `"black"`

### settings.line_attributes.stroke-width
`number`

the thickness of the line

**default:** `0.5`

### settings.line_attributes.stroke-opacity
`number`

the opacity of the line

**default:** `0.75`

## settings.point_attributes
`object`

an object that defines the point color, radius, and opacity and its outline color, thickness, and opacity

### settings.point_attributes.stroke
`string`

the color of the outline of the point

**default:** `"#1f78b4"`

### settings.point_attributes.stroke-width
`number`

the thickness of the outline of the point

**default:** `0.5`

### settings.point_attributes.stroke-opacity
`number`

the opacity of the outline of the point

**default:** `1`

### settings.point_attributes.fill
`string`

the color of the point

**default:** `"#1f78b4"`

### settings.point_attributes.radius
`number`

the radius of the point

**default:** `3`

### settings.point_attributes.fill-opacity
`number`

the opacity of the point

**default:** `0.2`

## settings.custom_marks
`array`

an array of Webcharts mark definitions

**default:** none

## settings.tooltip_cols
`array`

an array of tooltip variables and associated metadata

**default:** none

### settings.tooltip_cols[].value_col
`string`

Variable name

**default:** none

### settings.tooltip_cols[].label
`string`

Variable label

**default:** none

# Webcharts settings
The object below contains Webcharts settings as of version 2.7.0 of the Safety Outlier Explorer.

```
{
    "x": {
        "column": null,
        "type": null,
        "behavior": "raw"
    },
    "y": {
        "column": null,
        "stat": "mean",
        "type": "linear",
        "label": "Value",
        "behavior": "raw"
    },
    "marks": [
        {
            "per": null,
            "type": "line",
            "attributes": {
                "clip-path": null
            },
            "tooltip": null,
            "default": true
        },
        {
            "per": null,
            "type": "circle",
            "attributes": {
                "clip-path": null
            },
            "tooltip": null,
            "default": true
        }
    ],
    "legend": {
        "mark": "line"
    },
    "resizable": true,
    "margin": {
        "right": 30,
        "left": 60
    },
    "gridlines": "y",
    "aspect": 3
}
```


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

      </button>
      CoffeeCoder

Lessons

Practise

Leaderboard

Help

Account

Manage Subscriptions

Create a Lesson

My Profile

Logout

          <button type="button" id="dropdownMenu1" data-toggle="dropdown" class="btn btn-info navbar-btn dropdown-toggle"> Login

          </button>

              <form class="navbar-form form" role="form" ng-submit="users.login()">

                    <input id="emailInput" placeholder="email address" class="form-control" type="email" ng-model="users.user.email" required>

                    <input id="passwordInput" placeholder="password" class="form-control" type="password" ng-model="users.user.password" required>

                  <button type="submit" class="btn btn-primary form-control">Login</button>

              </form>

          <button type="button" id="dropdownMenu2" data-toggle="dropdown" class="btn btn-success navbar-btn dropdown-toggle"> Register

          </button>

              <form class="navbar-form form" role="form" ng-submit="users.register()">

                    <input id="emailInput" placeholder="email address" class="form-control" type="email" ng-model="users.user.email" required>

                    <input id="passwordInput" placeholder="password" class="form-control" type="password" ng-model="users.user.password" required>

                  <button type="submit" class="btn btn-primary form-control">Register</button>

              </form>

Create a Lesson

  <form class="form-horizontal" ng-submit="lessons.createLesson()">

        <input type="text" name='lesson-title' class="form-control" id="lesson-title" ng-model="lessons.newLesson.title" placeholder="Lesson Title">

        <input type="text" name='lesson-summary' class="form-control" id="lesson-summary" ng-model="lessons.newLesson.summary" placeholder="Lesson Summary (A brief overview of the lesson)">

        <textarea name='lesson-content' class="form-control" id="lesson-content" ng-model="lessons.newLesson.content" placeholder="Lesson Content" rows="5"></textarea>

        <input type="text" name='lesson-expectedResult' class="form-control" id="lesson-expectedResult" ng-model="lessons.newLesson.expectedResult" placeholder="Expected Result (from user input)">

        <select name='lesson-difficulty' class="form-control" id="lesson-difficulty" ng-model="lessons.newLesson.difficulty">
          <option selected disabled>Lesson Difficulty</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8</option>
          <option>9</option>
          <option>10</option>
        </select>

        <button type="submit" class="btn btn-default">Create</button>

  </form>


text:
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/user_oauth_shared_examples')

describe "User with oauth submodule" do
  before(:all) do
    ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/external")
  end

  after(:all) do
    ActiveRecord::Migrator.rollback("#{Rails.root}/db/migrate/external")
  end

  it_behaves_like "rails_3_oauth_model"

end


text:
#include <spv_utils.h>
#include <array>
#include <catch.hpp>
#include <cstdint>
#include <fstream>
#include <iostream>

#define STR_EXPAND(str) #str
#define STR(str) STR_EXPAND(str)

TEST_CASE("spv utils is tested with correct spir-v binary",
          "[spv-utils-correct-spvbin]") {
  // Read spv binary module from a file
  std::ifstream spv_file(STR(SPV_ASSETS_FOLDER) "/test.frag.spv",
                         std::ios::binary | std::ios::ate | std::ios::in);
  REQUIRE(spv_file.is_open() == true);
  std::streampos size = spv_file.tellg();
  CHECK(size > 0);

  spv_file.seekg(0, std::ios::beg);
  char *data = new char[size];
  spv_file.read(data, size);
  spv_file.close();

  SECTION("Passing a null ptr for the data throws an exception") {
    REQUIRE_THROWS_AS(sut::OpcodeStream(nullptr, size), sut::InvalidParameter);
  }
  SECTION("Passing size zero for the size throws an exception") {
    REQUIRE_THROWS_AS(sut::OpcodeStream(data, 0), sut::InvalidParameter);
  }
  SECTION("Passing size zero for the size and nullptr throws an exception") {
    REQUIRE_THROWS_AS(sut::OpcodeStream(nullptr, 0), sut::InvalidParameter);
  }
  SECTION("Passing correct data ptr and size creates the object") {
    REQUIRE_NOTHROW(sut::OpcodeStream(data, size));

    sut::OpcodeHeader header_0 = {1U, static_cast<uint16_t>(spv::Op::OpNop)};
    sut::OpcodeHeader header_1 = {4U, static_cast<uint16_t>(spv::Op::OpNop)};

    uint32_t instruction_0 = MergeSpvOpCode(header_0);
    uint32_t instruction_1 = MergeSpvOpCode(header_1);

    std::array<uint32_t, 4U> longer_instruction = {instruction_1, 0xDEADBEEF,
                                                   0xDEADBEEF, 0xDEADBEEF};
    std::array<uint32_t, 4U> longer_instruction_2 = {instruction_1, 0x1EADBEEF,
                                                     0x1EADBEEF, 0x1EADBEEF};

    SECTION(
        "Inserting before, after and removing produces an output of the right "
        "size") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.InsertBefore(longer_instruction.data(), longer_instruction.size());
          i.InsertAfter(&instruction_0, 1U);
          i.InsertAfter(longer_instruction.data(), longer_instruction.size());
          i.InsertAfter(longer_instruction.data(), longer_instruction.size());
          i.InsertBefore(longer_instruction_2.data(),
                         longer_instruction_2.size());
          i.Remove();
        }
      }

      sut::OpcodeStream new_stream = stream.EmitFilteredStream();
      std::vector<uint32_t> new_module = new_stream.GetWordsStream();

      // -1 is due to removing the instruction OpCapability which is 2 words
      // long
      // and adding one instruction one word long.
      REQUIRE(new_module.size() ==
              ((size / 4) + (longer_instruction.size() * 3) +
               longer_instruction_2.size() - 1));
    }

    SECTION("Replacing produces an output of the right size") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.Replace(longer_instruction.data(), longer_instruction.size());
        }
      }

      sut::OpcodeStream new_stream = stream.EmitFilteredStream();
      std::vector<uint32_t> new_module = new_stream.GetWordsStream();

      // -2 is due to removing the instruction OpCapability which is 2 words
      // long
      REQUIRE(new_module.size() ==
              ((size / 4) + longer_instruction.size() - 2));
    }

    SECTION("Inserting does not alter the size of the original raw module") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.InsertAfter(longer_instruction.data(), longer_instruction.size());
        }
      }

      std::vector<uint32_t> old_module = stream.GetWordsStream();

      // -2 is due to removing the instruction OpCapability which is 2 words
      // long
      REQUIRE(old_module.size() == static_cast<size_t>(size / 4));
    }

    SECTION("Using the new stream does not produce errors") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.InsertAfter(longer_instruction.data(), longer_instruction.size());
        }
      }

      sut::OpcodeStream new_stream = stream.EmitFilteredStream();
      std::vector<uint32_t> new_module = new_stream.GetWordsStream();

      REQUIRE(new_module.size() == ((size / 4) + longer_instruction.size()));

      for (auto &i : new_stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.InsertAfter(longer_instruction.data(), longer_instruction.size());
        }
      }

      sut::OpcodeStream new_stream_2 = new_stream.EmitFilteredStream();
      std::vector<uint32_t> new_module_2 = new_stream_2.GetWordsStream();

      REQUIRE(new_module_2.size() ==
              ((size / 4) + (longer_instruction.size() * 2)));
    }

    SECTION("Removing more than once throws") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.Remove();
          REQUIRE_THROWS_AS(i.Remove(), sut::InvalidOperation);
        }
      }
    }

    SECTION("Replacing more than once throws") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.Replace(longer_instruction.data(), longer_instruction.size());
          REQUIRE_THROWS_AS(
              i.Replace(longer_instruction.data(), longer_instruction.size()),
              sut::InvalidOperation);
        }
      }
    }

    SECTION("Replacing after removing throws") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.Remove();
          REQUIRE_THROWS_AS(
              i.Replace(longer_instruction.data(), longer_instruction.size()),
              sut::InvalidOperation);
        }
      }
    }

    SECTION("Removing after replacing throws") {
      sut::OpcodeStream stream(data, size);
      for (auto &i : stream) {
        if (i.GetOpcode() == spv::Op::OpCapability) {
          i.Replace(longer_instruction.data(), longer_instruction.size());
          REQUIRE_THROWS_AS(i.Remove(), sut::InvalidOperation);
        }
      }
    }
  }
}


text:
import { escapeRegExpCharacters } from 'vs/base/common/strings';
import { ResolvedLanguageConfiguration } from 'vs/editor/common/languages/languageConfigurationRegistry';
import { BracketKind } from 'vs/editor/common/languages/supports/languageBracketsConfiguration';
import { BracketAstNode } from './ast';
import { toLength } from './length';
import { DenseKeyProvider, identityKeyProvider, SmallImmutableSet } from './smallImmutableSet';
import { OpeningBracketId, Token, TokenKind } from './tokenizer';

export class BracketTokens {
	static createFromLanguage(configuration: ResolvedLanguageConfiguration, denseKeyProvider: DenseKeyProvider<string>): BracketTokens {
		function getId(bracketInfo: BracketKind): OpeningBracketId {
			return denseKeyProvider.getKey(`${bracketInfo.languageId}:::${bracketInfo.bracketText}`);
		}

		const map = new Map<string, Token>();
		for (const openingBracket of configuration.bracketsNew.openingBrackets) {
			const length = toLength(0, openingBracket.bracketText.length);
			const openingTextId = getId(openingBracket);
			const bracketIds = SmallImmutableSet.getEmpty().add(openingTextId, identityKeyProvider);
			map.set(openingBracket.bracketText, new Token(
				length,
				TokenKind.OpeningBracket,
				openingTextId,
				bracketIds,
				BracketAstNode.create(length, openingBracket, bracketIds)
			));
		}

		for (const closingBracket of configuration.bracketsNew.closingBrackets) {
			const length = toLength(0, closingBracket.bracketText.length);
			let bracketIds = SmallImmutableSet.getEmpty();
			const closingBrackets = closingBracket.getClosedBrackets();
			for (const bracket of closingBrackets) {
				bracketIds = bracketIds.add(getId(bracket), identityKeyProvider);
			}
			map.set(closingBracket.bracketText, new Token(
				length,
				TokenKind.ClosingBracket,
				getId(closingBrackets[0]),
				bracketIds,
				BracketAstNode.create(length, closingBracket, bracketIds)
			));
		}

		return new BracketTokens(map);
	}

	private hasRegExp = false;
	private _regExpGlobal: RegExp | null = null;

	constructor(
		private readonly map: Map<string, Token>
	) { }

	getRegExpStr(): string | null {
		if (this.isEmpty) {
			return null;
		} else {
			const keys = [...this.map.keys()];
			keys.sort();
			keys.reverse();
			return keys.map(k => prepareBracketForRegExp(k)).join('|');
		}
	}

	/**
	 * Returns null if there is no such regexp (because there are no brackets).
	*/
	get regExpGlobal(): RegExp | null {
		if (!this.hasRegExp) {
			const regExpStr = this.getRegExpStr();
			this._regExpGlobal = regExpStr ? new RegExp(regExpStr, 'gi') : null;
			this.hasRegExp = true;
		}
		return this._regExpGlobal;
	}

	getToken(value: string): Token | undefined {
		return this.map.get(value.toLowerCase());
	}

	findClosingTokenText(openingBracketIds: SmallImmutableSet<OpeningBracketId>): string | undefined {
		for (const [closingText, info] of this.map) {
			if (info.kind === TokenKind.ClosingBracket && info.bracketIds.intersects(openingBracketIds)) {
				return closingText;
			}
		}
		return undefined;
	}

	get isEmpty(): boolean {
		return this.map.size === 0;
	}
}

function prepareBracketForRegExp(str: string): string {
	let escaped = escapeRegExpCharacters(str);
	// These bracket pair delimiters start or end with letters
	// see https://github.com/microsoft/vscode/issues/132162 https://github.com/microsoft/vscode/issues/150440
	if (/^[\w ]+/.test(str)) {
		escaped = `\\b${escaped}`;
	}
	if (/[\w ]+$/.test(str)) {
		escaped = `${escaped}\\b`;
	}
	return escaped;
}

export class LanguageAgnosticBracketTokens {
	private readonly languageIdToBracketTokens = new Map<string, BracketTokens>();

	constructor(
		private readonly denseKeyProvider: DenseKeyProvider<string>,
		private readonly getLanguageConfiguration: (languageId: string) => ResolvedLanguageConfiguration,
	) {
	}

	public didLanguageChange(languageId: string): boolean {
		// Report a change whenever the language configuration updates.
		return this.languageIdToBracketTokens.has(languageId);
	}

	getSingleLanguageBracketTokens(languageId: string): BracketTokens {
		let singleLanguageBracketTokens = this.languageIdToBracketTokens.get(languageId);
		if (!singleLanguageBracketTokens) {
			singleLanguageBracketTokens = BracketTokens.createFromLanguage(this.getLanguageConfiguration(languageId), this.denseKeyProvider);
			this.languageIdToBracketTokens.set(languageId, singleLanguageBracketTokens);
		}
		return singleLanguageBracketTokens;
	}

	getToken(value: string, languageId: string): Token | undefined {
		const singleLanguageBracketTokens = this.getSingleLanguageBracketTokens(languageId);
		return singleLanguageBracketTokens.getToken(value);
	}
}


text:
import mock
import pytest

@pytest.fixture(scope="module", autouse=True)
def fix_module():
    print("setup module")
    yield fix_module  # provide the fixture value
    print("teardown module")

@pytest.fixture(autouse=True)
def fix_fkt():
    print("setup fkt")
    yield fix_module  # provide the fixture value
    print("teardown fkt")

def test_1():
    print("test 1")

def test_2():
    print("test 2")

def test_3():
    print("test 3")


text:
import koaRouter from 'koa-router'
import users from './users'
import articles from './articles'
import auth from './auth'

let router = koaRouter()

router.use('/users', users.routes())
router.use('/authenticate', auth.routes())
router.use('/articles', articles.routes())

export default router


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Bad Philophobia: Game.java Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Bad Philophobia

Main Page

Packages

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

 All Classes Namespaces Files Functions Variables

Game.java

Go to the documentation of this file.

    1 import pkg_game.GameEngine;

    2 import pkg_game.UserInterface;

    3

    9 public class Game

   10 {

   15     public static void main(String[] args) {

   16         Game game = new Game();

   17     }

   18

   22     private UserInterface gui;

   23

   27     private GameEngine engine;

   28

   32     public Game () {

   33         engine = new GameEngine();

   34         gui = new UserInterface(engine);

   35         engine.setGUI(gui);

   36     }

   37 }

Game.Game

Game()

Game class constructor.

Definition: Game.java:32

Game.gui

UserInterface gui

The game's user interface.

Definition: Game.java:22

pkg_game.UserInterface

Class handling the game's user interface.

Definition: UserInterface.java:15

Game

Main class used to instantiate other objects.

Definition: Game.java:9

pkg_game.GameEngine

Class handling the gameplay for the game.

Definition: GameEngine.java:37

Game.main

static void main(String[] args)

Main function.

Definition: Game.java:15

Game.engine

GameEngine engine

The gameplay manager.

Definition: Game.java:27

<address class="footer">
Generated on Mon Jun 9 2014 21:28:27 for Bad Philophobia by

 1.8.6
</address>


text:
using System;
using System.Threading.Tasks;

namespace EE.Internal {
    using Processor = Func<Task<bool>>;

    internal interface IRetrier {
        Task Process(Processor processor);
        void Stop();
    }
}


text:
<Record>
<Term>Cholebrine</Term>
<SemanticType>Pharmacologic Substance</SemanticType>
<SemanticType>Organic Chemical</SemanticType>
<PrimarySemanticType>Pharmacologic Substance</PrimarySemanticType>
<Synonym>Iocetamic acid</Synonym>
<Source>FDA Registry</Source>
</Record>


text:
namespace webcrypto {

class GenerateKeyResult;
class JwkReader;
class Status;

// Generates a random secret key of the given bit length. If the bit length is
// not a multiple of 8, then the resulting key will have ceil(keylen_bits / 8)
// bytes, and the "unused" bits will be set to zero. This function does not do
// any validation checks on the provided parameters.
Status GenerateWebCryptoSecretKey(const blink::WebCryptoKeyAlgorithm& algorithm,
                                  bool extractable,
                                  blink::WebCryptoKeyUsageMask usages,
                                  unsigned int keylen_bits,
                                  GenerateKeyResult* result);

// Creates a WebCrypto secret key given the raw data. The provided |key_data|
// will be copied into the new key. This function does not do any validation
// checks for the provided parameters.
Status CreateWebCryptoSecretKey(base::span<const uint8_t> key_data,
                                const blink::WebCryptoKeyAlgorithm& algorithm,
                                bool extractable,
                                blink::WebCryptoKeyUsageMask usages,
                                blink::WebCryptoKey* key);

// Writes a JWK-formatted symmetric key to |jwk_key_data|.
//  * raw_key_data: The actual key data
//  * algorithm: The JWK algorithm name (i.e. "alg")
//  * extractable: The JWK extractability (i.e. "ext")
//  * usages: The JWK usages (i.e. "key_ops")
void WriteSecretKeyJwk(base::span<const uint8_t> raw_key_data,
                       base::StringPiece algorithm,
                       bool extractable,
                       blink::WebCryptoKeyUsageMask usages,
                       std::vector<uint8_t>* jwk_key_data);

// Parses a UTF-8 encoded JWK (key_data), and extracts the key material to
// |*raw_key_data|. Returns Status::Success() on success, otherwise an error.
// In order for this to succeed:
//   * expected_extractable must be consistent with the JWK's "ext", if
//     present.
//   * expected_usages must be a subset of the JWK's "key_ops" if present.
Status ReadSecretKeyNoExpectedAlgJwk(
    base::span<const uint8_t> key_data,
    bool expected_extractable,
    blink::WebCryptoKeyUsageMask expected_usages,
    std::vector<uint8_t>* raw_key_data,
    JwkReader* jwk);

}  // namespace webcrypto

#endif  // COMPONENTS_WEBCRYPTO_ALGORITHMS_SECRET_KEY_UTIL_H_


text:
import { GmtPipe } from './gmt.pipe';

describe('Pipe: Default', () => {
    let pipe: GmtPipe;

    beforeEach(() => {
        pipe = new GmtPipe();
    });

    it('providing null returns "-"', () => {
        expect(pipe.transform(null)).toEqual('-');
    });

    it('providing "-" returns "-"', () => {
        expect(pipe.transform('-')).toEqual('-');
    });

    it('providing a MongoDB date object returns a valid GMT date', () => {
        const input = { $date: 1439843678000 };
        const expected = 'August 17, 2015 8:34 PM GMT';

        expect(pipe.transform(input)).toEqual(expected);
    });

    it('providing a MongoDB date object returns a valid GMT date', () => {
        const input = { $date: 1439843678 };
        const expected = 'August 17, 2015 8:34 PM GMT';

        expect(pipe.transform(input)).toEqual(expected);
    });

    it('providing a MongoDB date object with format returns a formatted GMT date', () => {
        const input = { $date: 1439843678000 };
        const expected = '2015-08-17';

        expect(pipe.transform(input, 'YYYY-MM-DD')).toEqual(expected);
    });

    it('providing a MongoDB date object with format returns a formatted GMT date', () => {
        const input = { $date: 1439843678 };
        const expected = '2015-08-17';

        expect(pipe.transform(input, 'YYYY-MM-DD')).toEqual(expected);
    });

    it('providing a UTC date returns a GMT date', () => {
        const input = '2013-08-30T19:52:28.226Z';
        const expected = 'August 30, 2013 7:52 PM GMT';

        expect(pipe.transform(input)).toEqual(expected);
    });

    it('providing a UTC date with format returns a formatted GMT date', () => {
        const input = '2013-08-30T19:52:28.226Z';
        const expected = '2013-08-30';

        expect(pipe.transform(input, 'YYYY-MM-DD')).toEqual(expected);
    });

    it('providing a UNIX epoch date returns a valid GMT date', () => {
        const input = 1440086779000;
        const expected = 'August 20, 2015 4:06 PM GMT';

        expect(pipe.transform(input)).toEqual(expected);
    });

    it('providing a UNIX epoch date returns a valid GMT date', () => {
        const input = 1440086779;
        const expected = 'August 20, 2015 4:06 PM GMT';

        expect(pipe.transform(input)).toEqual(expected);
    });

    it('providing "NA" returns "NA"', () => {
        expect(pipe.transform('NA')).toEqual('NA');
    });

    it('providing "N/A" returns "N/A"', () => {
        expect(pipe.transform('N/A')).toEqual('N/A');
    });
});


text:
<settings>

  <servers>
    <server>
      <id>tomcat-server</id>
      <username>[tomcat-username]</username>
      <password>[tomcat-password]</password>
    </server>
  </servers>

  <profiles>

    <profile>
      <id>profile-clover</id>
      <activation>
        <property>
          <name>profile</name>
          <value>clover</value>
        </property>
      </activation>
      <properties>
        <cloverLicense>[location-of-clover.license]</cloverLicense>
      </properties>
    </profile>

    <profile>
      <id>always</id>
      <properties>
        <duracloud.home>[location-of-writable-duracloud-directory]</duracloud.home>
        <unit.database.home.default>[location-of-unit-test-db]</unit.database.home.default>
        <unit.database.password.default>[boot-password]</unit.database.password.default>
      </properties>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>always</activeProfile>
  </activeProfiles>

</settings>


text:
module Azure::DataMigration::Mgmt::V2018_07_15_preview
  module Models
    #
    # Describes the progress of the overall migration
    #
    class MongoDbMigrationProgress < MongoDbProgress

      include MsRestAzure

      # @return [Hash{String => MongoDbDatabaseProgress}] The progress of the
      # databases in the migration. The keys are the names of the databases
      attr_accessor :databases

      #
      # Mapper for MongoDbMigrationProgress class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'Migration',
          type: {
            name: 'Composite',
            class_name: 'MongoDbMigrationProgress',
            model_properties: {
              bytes_copied: {
                client_side_validation: true,
                required: true,
                serialized_name: 'bytesCopied',
                type: {
                  name: 'Number'
                }
              },
              documents_copied: {
                client_side_validation: true,
                required: true,
                serialized_name: 'documentsCopied',
                type: {
                  name: 'Number'
                }
              },
              elapsed_time: {
                client_side_validation: true,
                required: true,
                serialized_name: 'elapsedTime',
                type: {
                  name: 'String'
                }
              },
              errors: {
                client_side_validation: true,
                required: true,
                serialized_name: 'errors',
                type: {
                  name: 'Dictionary',
                  value: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'MongoDbErrorElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'MongoDbError'
                      }
                  }
                }
              },
              events_pending: {
                client_side_validation: true,
                required: true,
                serialized_name: 'eventsPending',
                type: {
                  name: 'Number'
                }
              },
              events_replayed: {
                client_side_validation: true,
                required: true,
                serialized_name: 'eventsReplayed',
                type: {
                  name: 'Number'
                }
              },
              last_event_time: {
                client_side_validation: true,
                required: false,
                serialized_name: 'lastEventTime',
                type: {
                  name: 'DateTime'
                }
              },
              last_replay_time: {
                client_side_validation: true,
                required: false,
                serialized_name: 'lastReplayTime',
                type: {
                  name: 'DateTime'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              },
              qualified_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'qualifiedName',
                type: {
                  name: 'String'
                }
              },
              result_type: {
                client_side_validation: true,
                required: true,
                serialized_name: 'resultType',
                type: {
                  name: 'String'
                }
              },
              state: {
                client_side_validation: true,
                required: true,
                serialized_name: 'state',
                type: {
                  name: 'String'
                }
              },
              total_bytes: {
                client_side_validation: true,
                required: true,
                serialized_name: 'totalBytes',
                type: {
                  name: 'Number'
                }
              },
              total_documents: {
                client_side_validation: true,
                required: true,
                serialized_name: 'totalDocuments',
                type: {
                  name: 'Number'
                }
              },
              databases: {
                client_side_validation: true,
                required: false,
                serialized_name: 'databases',
                type: {
                  name: 'Dictionary',
                  value: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'MongoDbDatabaseProgressElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'MongoDbDatabaseProgress'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
class Filebeat < Formula
  desc "File harvester to ship log files to Elasticsearch or Logstash"
  homepage "https://www.elastic.co/products/beats/filebeat"
  url "https://github.com/elastic/beats/archive/v6.2.2.tar.gz"
  sha256 "0866c3e26fcbd55f191e746b3bf925b450badd13fb72ea9f712481559932c878"
  head "https://github.com/elastic/beats.git"

  bottle do
    cellar :any_skip_relocation
    sha256 "452dfc74f6fb8bc0db672a9f0aeac875f133f74428460ff5e90c83e9b784bd74" => :high_sierra
    sha256 "18f6a3dcee99bb27938b0ceff3ede0f1a11cbcb0c123fdb229142caf983b18ea" => :sierra
    sha256 "efa963c66bfd69ee503b9f0011b5e733a93b7fcac7e1971ac18ee4fdd3b33894" => :el_capitan
  end

  depends_on "go" => :build

  def install
    gopath = buildpath/"gopath"
    (gopath/"src/github.com/elastic/beats").install Dir["{*,.git,.gitignore}"]

    ENV["GOPATH"] = gopath

    cd gopath/"src/github.com/elastic/beats/filebeat" do
      system "make"
      system "make", "modules"
      libexec.install "filebeat"
      (prefix/"module").install Dir["_meta/module.generated/*"]
      (etc/"filebeat").install Dir["filebeat.*"]
    end

    prefix.install_metafiles gopath/"src/github.com/elastic/beats"

    (bin/"filebeat").write <<~EOS
      #!/bin/sh
      exec #{libexec}/filebeat -path.config #{etc}/filebeat -path.home #{prefix} -path.logs #{var}/log/filebeat -path.data #{var}/filebeat $@
    EOS
  end

  plist_options :manual => "filebeat"

  def plist; <<~EOS
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>#{plist_name}</string>
        <key>Program</key>
        <string>#{opt_bin}/filebeat</string>
        <key>RunAtLoad</key>
        <true/>
      </dict>
    </plist>
  EOS
  end

  test do
    log_file = testpath/"test.log"
    touch log_file

    (testpath/"filebeat.yml").write <<~EOS
      filebeat:
        prospectors:
          -
            paths:
              - #{log_file}
            scan_frequency: 0.1s
      output:
        file:
          path: #{testpath}
    EOS

    (testpath/"log").mkpath
    (testpath/"data").mkpath

    filebeat_pid = fork { exec "#{bin}/filebeat -c #{testpath}/filebeat.yml -path.config #{testpath}/filebeat -path.home=#{testpath} -path.logs #{testpath}/log -path.data #{testpath}" }
    begin
      sleep 1
      log_file.append_lines "foo bar baz"
      sleep 5

      assert_predicate testpath/"filebeat", :exist?
    ensure
      Process.kill("TERM", filebeat_pid)
    end
  end
end


text:
layout: relation
title: 'compound'
shortdef: 'compound'
udver: '2'
---

The `compound` relation is one of three relations for multiword expressions (MWEs) (the other two being fixed and flat). It is used for
any kind of X0 compounding: noun compounds (e.g., *стресс менеджмент* "stress management", *Жар птица* "Fire bird"), but also
adjective compounds (e.g., *бэд блоки* "bad blocks", *мини колонка* "mini speaker", *Гранд отель* "Grand hotel") and some other types (*+ 1*, *№ 1*).
Compounds are not typical for the literary Russian language but are widely used in electronic communication. Note that some clitics can divide two parts of the composite word that would otherwise be written as one word: in this case, the first part is attached as `compound`.

~~~ sdparse
на минус втором этаже \n on-the minus second floor
compound(втором, минус)
compound(second, minus)
~~~

~~~ sdparse
в бизнес же центре \n in the business , well , center
compound(центре, бизнес)
compound(center, business)
~~~

In Russian `compound` is regulary used in compound numerals. The rightmost numeral is the head, the other numerals are attached as its modifiers.
Note that in Russian the words *тысяча* "thousand", *миллион* "million", *миллиард* "billion", etc. change case depending the numeral of a smaller number to their left, so this relation cannot be considered compound (the numeral of a smaller number is attached to *тысяча* etc. as nummod).

~~~ sdparse
Это будет стоить максимум 5 тысяч 500 рублей . \n It will cost at-most 5 thousand 500 rubles .
nummod:gov(рублей, 500-7)
nummod:gov(rubles, 500-17)
nummod:gov(тысяч, 5-5)
nummod:gov(thousand, 5-15)
compound(500-7, тысяч)
compound(500-17, thousand)
~~~

~~~ sdparse
Это будет стоить пятьдесят пять тысяч рублей . \n It will cost fifty five thousand rubles .
nummod:gov(рублей, тысяч)
nummod:gov(rubles, thousand)
compound(тысяч, пятьдесят)
compound(thousand, fifty)
nummod:gov(тысяч, пять)
nummod:gov(thousand, five)
~~~

~~~ sdparse
в двадцать первом веке . \n in-the twenty first century .
compound(первом, двадцать)
compound(first, twenty)
~~~

### Note

The `compound` relation (nor any subtype thereof) is not used in the Russian serial verb constructions such as *сижу смотрю* "I'm just sitting here watching", *сходи купи (мороженое)* "go get (an ice cream)". The second verb is attached to the first one using the `flat` relation.


text:
package com.study.mli.dobe.customview;

/**
 * Created by crown on 2016/9/12.
 */
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Movie;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;

import com.study.mli.dobe.R;

import java.lang.ref.WeakReference;

/**
 * Created by Cuneyt on 4.10.2015.
 * Gifview
 */
public class GifImageView extends ImageView {

	private static final int DEFAULT_MOVIE_VIEW_DURATION = 1000;

	private int mMovieResourceId;
//	private Movie movie;
	private Movie movie;

	private long mMovieStart;
	private int mCurrentAnimationTime;

	private String mUrl;

	/**
	 * Position for drawing animation frames in the center of the view.
	 */
	private float mLeft;
	private float mTop;

	/**
	 * Scaling factor to fit the animation within view bounds.
	 */
	private float mScale;

	/**
	 * Scaled movie frames width and height.
	 */
	private int mMeasuredMovieWidth;
	private int mMeasuredMovieHeight;

	private volatile boolean mPaused;
	private boolean mVisible = true;
	private byte[] bytes;

	public GifImageView(Context context) {
		this(context, null);
	}

	public GifImageView(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public GifImageView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		setViewAttributes(context, attrs, defStyle);
	}

	public void setUrl(String url) {
		this.mUrl = url;
	}

	@SuppressLint("NewApi")
	private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {

		/**
		 * Starting from HONEYCOMB(Api Level:11) have to turn off HW acceleration to draw
		 * Movie on Canvas.
		 */
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			setLayerType(View.LAYER_TYPE_SOFTWARE, null);
		}

		final TypedArray array = context.obtainStyledAttributes(attrs,
			R.styleable.GifView, defStyle, R.style.Widget_GifView);

		//-1 is default value
		mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
		mPaused = array.getBoolean(R.styleable.GifView_paused, false);

		array.recycle();

		if (mMovieResourceId != -1) {
			movie =Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
		}
	}

	public void release() {
		Drawable drawable = getDrawable();
		if(drawable instanceof BitmapDrawable) {
			BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
			Bitmap bitmap = bitmapDrawable.getBitmap();
			if(bitmap != null && !bitmap.isRecycled()) {
				bitmap.recycle();
			}
		}
	}

	public boolean setBytes(byte[] bytes) {
//		if(bytes != null) {
//			bytes = null;
//		}
		this.movie = null;
		this.bytes = bytes;
		if(bytes != null) {
			Movie movie = getMovie(bytes);
			if(movie != null) {
				setMovie(movie);
				return true;
			}else {
				setImageview(bytes);
				return false;
			}
		}
		return false;
	}

	//if showing gif or not when showing
	public boolean showGif() {
		if(movie != null) {
			return true;
		}
		return false;
	}

	public byte[] getBytes() {
		return bytes;
	}

	public Movie getMovie(byte[] bytes) {
		return Movie.decodeByteArray(bytes, 0, bytes.length);
	}

	public void setMovie(Movie movie) {
		release();
		if(movie == null || !movie.equals(this.movie)) {
			this.movie= movie;
			requestLayout();
		}
	}

	public void setImageview(byte[] bytes) {
		release();
		Bitmap bm = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
		if(bm != null) {
			setImageBitmap(bm);
		}
	}

	public Movie getMovie() {
		return this.movie;
	}

	@Override
	public void setImageBitmap(Bitmap bm) {
		if(movie != null) {
			setMovie(null);
		}
		super.setImageBitmap(bm);
	}

	public void setGifResource(int movieResourceId) {
		this.mMovieResourceId = movieResourceId;
		movie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
		requestLayout();
	}

	public int getGifResource() {

		return this.mMovieResourceId;
	}

	public void play() {
		if (this.mPaused) {
			this.mPaused = false;

			/**
			 * Calculate new movie start time, so that it resumes from the same
			 * frame.
			 */
			mMovieStart = android.os.SystemClock.uptimeMillis() - mCurrentAnimationTime;

			invalidate();
		}
	}

	public void pause() {
		if (!this.mPaused) {
			this.mPaused = true;

			invalidate();
		}

	}

	public boolean isPaused() {
		return this.mPaused;
	}

	public boolean isPlaying() {
		return !this.mPaused;
	}

	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
		if (movie != null) {
			int movieWidth = movie.width();
			int movieHeight = movie.height();

			/*
             * Calculate horizontal scaling
			 */
			float scaleH = 1f;
			int measureModeWidth = MeasureSpec.getMode(widthMeasureSpec);

			if (measureModeWidth != MeasureSpec.UNSPECIFIED) {
				int maximumWidth = MeasureSpec.getSize(widthMeasureSpec);
				if (movieWidth > maximumWidth) {
					scaleH = (float) movieWidth / (float) maximumWidth;
				}
			}

			/*
             * calculate vertical scaling
			 */
			float scaleW = 1f;
			int measureModeHeight = MeasureSpec.getMode(heightMeasureSpec);

			if (measureModeHeight != MeasureSpec.UNSPECIFIED) {
				int maximumHeight = MeasureSpec.getSize(heightMeasureSpec);
				if (movieHeight > maximumHeight) {
					scaleW = (float) movieHeight / (float) maximumHeight;
				}
			}

			/*
             * calculate overall scale
			 */
			mScale = 1f / Math.max(scaleH, scaleW);

			mMeasuredMovieWidth = (int) (movieWidth * mScale);
			mMeasuredMovieHeight = (int) (movieHeight * mScale);

			setMeasuredDimension(mMeasuredMovieWidth, mMeasuredMovieHeight);

		} else {
			/*
			 * No movie set, just set minimum available size.
			 */
//			setMeasuredDimension(getSuggestedMinimumWidth(), getSuggestedMinimumHeight());
		}
	}

	@Override
	protected void onLayout(boolean changed, int l, int t, int r, int b) {
		super.onLayout(changed, l, t, r, b);
		if(movie != null) {
		/*
		 * Calculate mLeft / mTop for drawing in center
		 */
			mLeft = (getWidth() - mMeasuredMovieWidth) / 2f;
			mTop = (getHeight() - mMeasuredMovieHeight) / 2f;

			mVisible = getVisibility() == View.VISIBLE;
		}
	}

	@Override
	protected void onDraw(Canvas canvas) {
		if (movie != null) {
			if (!mPaused) {
				updateAnimationTime();
				drawMovieFrame(canvas);
				invalidateView();
			} else {
				drawMovieFrame(canvas);
			}
		}else {
			super.onDraw(canvas);
		}
	}

	/**
	 * Invalidates view only if it is mVisible.
	 * <br>
	 * {@link #postInvalidateOnAnimation()} is used for Jelly Bean and higher.
	 */
	@SuppressLint("NewApi")
	private void invalidateView() {
		if (mVisible) {
			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
				postInvalidateOnAnimation();
			} else {
				invalidate();
			}
		}
	}

	/**
	 * Calculate current animation time
	 */
	private void updateAnimationTime() {
		long now = android.os.SystemClock.uptimeMillis();

		if (mMovieStart == 0) {
			mMovieStart = now;
		}

		int dur = movie.duration();

		if (dur == 0) {
			dur = DEFAULT_MOVIE_VIEW_DURATION;
		}

		mCurrentAnimationTime = (int) ((now - mMovieStart) % dur);
	}

	/**
	 * Draw current GIF frame
	 */
	private void drawMovieFrame(Canvas canvas) {
		movie.setTime(mCurrentAnimationTime);

		canvas.save(Canvas.MATRIX_SAVE_FLAG);
		canvas.scale(mScale, mScale);
		movie.draw(canvas, mLeft / mScale, mTop / mScale);
		canvas.restore();
	}

	@SuppressLint("NewApi")
	@Override
	public void onScreenStateChanged(int screenState) {
		super.onScreenStateChanged(screenState);
		if(movie != null) {
			mVisible = screenState == SCREEN_STATE_ON;
			invalidateView();
		}
	}

	@SuppressLint("NewApi")
	@Override
	protected void onVisibilityChanged(View changedView, int visibility) {
		super.onVisibilityChanged(changedView, visibility);
		if(movie != null) {
			mVisible = visibility == View.VISIBLE;
			invalidateView();
		}
	}

	@Override
	protected void onWindowVisibilityChanged(int visibility) {
		super.onWindowVisibilityChanged(visibility);
		if(movie != null) {
			mVisible = visibility == View.VISIBLE;
			invalidateView();
		}
	}

	private boolean canShowInternalGif() {
		return mUrl != null && mUrl.equals(getTag());
	}

	//取消了所有可点击事件,使其不能获取焦点
	@Override
	public boolean dispatchTouchEvent(MotionEvent event) {
//		return super.dispatchTouchEvent(event);
		return false;
	}
}