text:
import { Component, Children, cloneElement } from 'react';
import cx from 'classnames';

import { WindowResizeHandler } from '../utils/component/WindowResizeHandler';
import Icon from '../icon';
import SwiperDots, { IDotsType, IDotsTheme } from './SwiperDots';

function setStyle(target: any, styles: any) {
  const { style } = target;

  Object.keys(styles).forEach(attribute => {
    style[attribute] = styles[attribute];
  });
}

export interface ISwiperProps {
  className?: string;
  transitionDuration?: number;
  autoplay?: boolean;
  autoplayInterval?: number;
  dots?: boolean | IDotsType;
  dotsColor?: string;
  dotsSize?: 'normal' | 'small' | 'large';
  dotsTheme?: IDotsTheme;
  arrows?: boolean | 'hover';
  arrowsDisabled?: {
    left?: boolean;
    right?: boolean;
  };
  arrowsSize: 'normal' | 'large';
  arrowsType?: 'dark' | 'light';
  onChange?: (current: number, prev: number | null) => void;
  children?: React.ReactNode;
  renderPrevArrow?: (onPrev: () => void, disabled: boolean) => React.ReactNode;
  renderNextArrow?: (onNext: () => void, disabled: boolean) => React.ReactNode;
}

export interface ISwiperState {
  currentIndex: number;
  prevProps?: ISwiperProps;
}

const defaultRenderPrevArrow: ISwiperProps['renderPrevArrow'] = (
  onPrev,
  disabled
) => {
  return (
    <div
      className={cx('zent-swiper__arrow', 'zent-swiper__arrow-left', {
        'zent-swiper__arrow--disabled': disabled,
      })}
      onClick={!disabled ? onPrev : undefined}
    >
      <Icon type="right-circle" className="zent-swiper__arrow-icon" />
    </div>
  );
};

const defaultRenderNextArrow: ISwiperProps['renderNextArrow'] = (
  onNext,
  disabled
) => {
  return (
    <div
      className={cx('zent-swiper__arrow', 'zent-swiper__arrow-right', {
        'zent-swiper__arrow--disabled': disabled,
      })}
      onClick={!disabled ? onNext : undefined}
    >
      <Icon type="right-circle" className="zent-swiper__arrow-icon" />
    </div>
  );
};

export class Swiper extends Component<ISwiperProps, ISwiperState> {
  static defaultProps = {
    className: '',
    transitionDuration: 300,
    autoplay: false,
    autoplayInterval: 3000,
    dots: true,
    dotsTheme: 'dark',
    dotsSize: 'normal',
    arrows: false,
    arrowsSize: 'normal',
    arrowsType: 'dark',
    arrowsDisabled: {
      left: false,
      right: false,
    },
    renderPrevArrow: defaultRenderPrevArrow,
    renderNextArrow: defaultRenderNextArrow,
  };

  swiper!: HTMLDivElement;
  swiperContainer!: HTMLDivElement;
  swiperWidth!: number;
  autoplayTimer?: number;
  isSwiping!: boolean;
  isMouseEnter!: boolean;

  state = {
    currentIndex: 0,
  };

  init = (isResetToOrigin = false) => {
    const { autoplay, children } = this.props;
    const { currentIndex } = this.state;
    const childrenCount = Children.count(children);
    const innerElements = this.swiperContainer.children;

    this.clearAutoplay();
    this.setSwiperWidth();
    setStyle(this.swiperContainer, {
      width: `${this.swiperWidth * innerElements.length}px`,
    });

    for (let i = 0; i < innerElements.length; i++) {
      const item = innerElements[i];
      setStyle(item, {
        width: `${100 / innerElements.length}%`,
      });
    }

    isResetToOrigin && this.translate(-1, null, true);

    if (childrenCount > 1) {
      autoplay && this.startAutoplay();
      this.translate(currentIndex, null, true);
    }
  };

  getSwiper = (swiper: HTMLDivElement) => {
    this.swiper = swiper;
  };

  getSwiperContainer = (swiperContainer: HTMLDivElement) => {
    this.swiperContainer = swiperContainer;
  };

  setSwiperWidth = () => {
    this.swiperWidth = this.swiper.getBoundingClientRect().width;
  };

  startAutoplay = () => {
    const { autoplayInterval } = this.props;
    this.autoplayTimer = setTimeout(this.next, Number(autoplayInterval)) as any;
  };

  clearAutoplay = () => {
    clearTimeout(this.autoplayTimer);
    this.autoplayTimer = undefined;
  };

  next = () => {
    const { currentIndex } = this.state;
    if (Children.count(this.props.children) === 1) {
      return;
    }
    this.swipeTo(currentIndex + 1);
  };

  prev = () => {
    const { currentIndex } = this.state;
    this.swipeTo(currentIndex - 1);
  };

  swipeTo = (index: number) => {
    /** 当index与当前index相同时,则不处理 */
    /** 当动画进行时禁用用户的切换操作 */
    if (index === this.state.currentIndex || this.isSwiping) {
      return;
    }
    this.isSwiping = true;
    this.setState({ currentIndex: index });
  };

  translate = (
    currentIndex: number,
    prevIndex: number | null,
    isSilent?: boolean
  ) => {
    const { autoplay, autoplayInterval, transitionDuration, onChange } =
      this.props;
    const { length } = this.props.children as any;
    const initIndex = -1;
    const itemWidth = this.swiperWidth;
    const translateDistance = itemWidth * (initIndex - currentIndex);
    const realDuration = isSilent ? 0 : transitionDuration;

    if (autoplay && !this.isMouseEnter) {
      clearTimeout(this.autoplayTimer);
      this.autoplayTimer = setTimeout(
        this.next,
        Number(autoplayInterval)
      ) as any;
    }

    setStyle(this.swiperContainer, {
      transform: `translateX(${translateDistance}px)`,
      'transition-duration': `${realDuration}ms`,
    });

    if (currentIndex > length - 1 || currentIndex < 0) {
      // 如果当前元素为复制元素,则做一次复位操作,再次移动到真实元素,在此之前,不会将isSwiping的状态更改为false
      return this.resetPosition(currentIndex);
    }

    // 等待动画结束之后将isSwiping置为false
    setTimeout(() => {
      this.isSwiping = false;
    }, realDuration);

    onChange && onChange(currentIndex, this.getRealPrevIndex(prevIndex));
  };

  resetPosition = (currentIndex: number) => {
    const { transitionDuration } = this.props;
    const { length } = this.props.children as any;

    if (currentIndex < 0) {
      setTimeout(
        () =>
          this.setState({
            currentIndex: length - 1,
          }),
        transitionDuration
      );
    } else {
      setTimeout(
        () =>
          this.setState({
            currentIndex: 0,
          }),
        transitionDuration
      );
    }
  };

  getRealPrevIndex = (index: number | null) => {
    const { length } = this.props.children as any;

    if (index === null) {
      return null;
    }

    if (index > length - 1) {
      return length - 1;
    }

    if (index < 0) {
      return 0;
    }

    return index;
  };

  cloneChildren = (children?: React.ReactNode) => {
    const length = Children.count(children);

    if (length <= 1) {
      return children;
    }

    const clonedChildren = new Array(length + 2);
    Children.forEach(children, (child, index) => {
      clonedChildren[index + 1] = child;
      if (index === 0) {
        clonedChildren[length + 1] = child;
      } else if (index === length - 1) {
        clonedChildren[0] = child;
      }
    });

    return clonedChildren;
  };

  handleMouseEnter = () => {
    const { autoplay } = this.props;
    this.isMouseEnter = true;
    autoplay && this.clearAutoplay();
  };

  handleMouseLeave = () => {
    const { autoplay } = this.props;
    this.isMouseEnter = false;
    autoplay && this.startAutoplay();
  };

  handleDotsClick = (index: number) => {
    this.setState({ currentIndex: index });
  };

  handleResize = () => this.init();

  static getDerivedStateFromProps(
    props: ISwiperProps,
    state: ISwiperState
  ): Partial<ISwiperState> | null {
    if (!state.prevProps) {
      return {
        prevProps: props,
      };
    }

    const { children: newChildren } = props;
    const { children } = state.prevProps;
    if (Children.count(children) !== Children.count(newChildren)) {
      return {
        currentIndex: 0,
        prevProps: props,
      };
    }

    return null;
  }

  componentDidMount() {
    this.init();
  }

  componentDidUpdate(prevProps: ISwiperProps, prevState: ISwiperState) {
    const { length } = this.props.children as any;
    const { currentIndex } = this.state;
    const prevIndex = prevState.currentIndex;
    // isSilent表示静默地做一次位移动画,在用户无感知的情况下从复制元素translate到真实元素
    const isSilent = prevIndex > length - 1 || prevIndex < 0;

    if (prevIndex !== currentIndex) {
      this.translate(currentIndex, prevIndex, isSilent);
    }

    // 当从两个子元素删除到一个时特殊处理位移动画
    if (
      Children.count(prevProps.children) !== Children.count(this.props.children)
    ) {
      const isTwoToOneCase =
        Children.count(prevProps.children) === 2 &&
        Children.count(this.props.children) === 1;
      this.init(isTwoToOneCase);
    }
  }

  componentWillUnmount() {
    this.clearAutoplay();
  }

  render() {
    const {
      className,
      dots,
      dotsColor,
      dotsSize,
      dotsTheme,
      arrows,
      arrowsSize,
      arrowsType,
      arrowsDisabled,
      children,
      renderNextArrow,
      renderPrevArrow,
    } = this.props;
    const { currentIndex } = this.state;

    const showDots = !!dots;
    const dotsType = dots === 'round' ? 'round' : 'line';

    const classString = cx('zent-swiper', className, {
      'zent-swiper-light': arrows && arrowsType === 'light',
      'zent-swiper--hover-show-arrow': arrows === 'hover',
      'zent-swiper--arrow-large': arrowsSize === 'large',
    });
    const childrenCount = Children.count(children);
    const clonedChildren = this.cloneChildren(children);

    return (
      <div
        ref={this.getSwiper}
        className={classString}
        onMouseEnter={this.handleMouseEnter}
        onMouseLeave={this.handleMouseLeave}
      >
        {arrows &&
          childrenCount > 1 &&
          renderPrevArrow(this.prev, arrowsDisabled.left)}
        {arrows &&
          childrenCount > 1 &&
          renderNextArrow(this.next, arrowsDisabled.right)}
        <div ref={this.getSwiperContainer} className="zent-swiper__container">
          {Children.map(clonedChildren, (child: any, index: number) => {
            return cloneElement(child, {
              key: index - 1,
              style: { float: 'left', height: '100%' },
            });
          })}
        </div>
        {showDots && childrenCount > 1 && (
          <SwiperDots
            dotsType={dotsType}
            dotsColor={dotsColor}
            dotsTheme={dotsTheme}
            dotsSize={dotsSize}
            items={children}
            currentIndex={currentIndex}
            onDotsClick={this.handleDotsClick}
          />
        )}
        <WindowResizeHandler onResize={this.handleResize} />
      </div>
    );
  }
}

export default Swiper;


text:
/**
 * @author Alexander T. Simbirtsev
 */
package javax.swing.text;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import javax.swing.Action;
import javax.swing.BasicSwingTestCase;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JViewport;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;

public class DefaultEditorKitRTest extends BasicSwingTestCase {
    protected DefaultEditorKit kit = null;

    protected JFrame frame;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        kit = new DefaultEditorKit();
    }

    @Override
    protected void tearDown() throws Exception {
        kit = null;
        if (frame != null) {
            frame.dispose();
            frame = null;
        }
        super.tearDown();
    }

    protected Action getAction(final String actionName) {
        Action[] actions = kit.getActions();
        for (int i = 0; i < actions.length; i++) {
            if (actionName.equals(actions[i].getValue(Action.NAME))) {
                return actions[i];
            }
        }
        return null;
    }

    protected void performAction(final Object source, final Action action, final String command)
            throws InterruptedException, InvocationTargetException {
        final ActionEvent actionEvent = new ActionEvent(source, ActionEvent.ACTION_PERFORMED,
                command);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                action.actionPerformed(actionEvent);
            }
        });
    }

    protected JTextArea getInitedComponent(final int startPos, final int endPos,
            final String text) throws InterruptedException, InvocationTargetException {
        JTextArea c = new JTextArea();
        return initComponent(c, startPos, endPos, text);
    }

    private JTextArea initComponent(final JTextArea c, final int startPos, final int endPos,
            final String text) throws InterruptedException, InvocationTargetException {
        if (frame != null) {
            frame.dispose();
        }
        c.setText(text);
        frame = new JFrame();
        JScrollPane scroll = new JScrollPane(c);
        ((JViewport) c.getParent()).setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
        int strHeight = c.getFontMetrics(c.getFont()).getHeight();
        scroll.setPreferredSize(new Dimension(300, strHeight * 5));
        scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        frame.getContentPane().add(scroll);
        frame.pack();
        java.awt.EventQueue.invokeAndWait(new Runnable() {
            public void run() {
                c.setCaretPosition(startPos);
                if (endPos >= 0) {
                    c.moveCaretPosition(endPos);
                }
            }
        });
        return c;
    }

    public void testInsertContentActionPerformed() throws Exception {
        Action action = getAction(DefaultEditorKit.insertContentAction);
        JTextArea c = getInitedComponent(2, 7, "0123456789");
        performAction(new JTextArea(), action, "command\ncontent");
        assertEquals("resulted string", "0123456789", c.getText());
        c = getInitedComponent(2, 7, "0123456789");
        c.setEditable(false);
        performAction(c, action, "command\ncontent");
        assertEquals("resulted string", "0123456789", c.getText());
        c = getInitedComponent(2, 7, "0123456789");
        performAction(c, action, null);
        assertEquals("resulted string", "0123456789", c.getText());
    }

    public void testReadInputStreamDocumentint() throws Exception {
        final Marker readerMarker = new Marker();
        DefaultEditorKit kit = new DefaultEditorKit() {
            private static final long serialVersionUID = 1L;

            @Override
            public void read(Reader in, Document doc, int pos) throws IOException,
                    BadLocationException {
                readerMarker.setOccurred();
            }
        };
        kit.read(new ByteArrayInputStream(new byte[10]), new DefaultStyledDocument(), 0);
        assertTrue(readerMarker.isOccurred());
    }

    public void testWriteOutputStreamDocumentintint() throws Exception {
        final Marker writeMarker = new Marker();
        DefaultEditorKit kit = new DefaultEditorKit() {
            private static final long serialVersionUID = 1L;

            @Override
            public void write(Writer out, Document doc, int pos, int len) throws IOException,
                    BadLocationException {
                writeMarker.setOccurred();
            }
        };
        kit.write(new ByteArrayOutputStream(), new DefaultStyledDocument(), 0, 1);
        assertTrue(writeMarker.isOccurred());
    }

    public void testInsertContentActionPerformed_NullEvent() throws Exception {
        final TextAction action = (TextAction) getAction(DefaultEditorKit.insertContentAction);
        final JTextArea c = getInitedComponent(2, 7, "0123456789");
        assertNotNull(c);
        frame.setVisible(true);
        final Marker thrown = new Marker();
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                try {
                    action.actionPerformed(null);
                    thrown.setOccurred();
                } catch (NullPointerException e) {
                }
            }
        });
        assertTrue(thrown.isOccurred());
    }

    public void testRead() throws Exception {
        String str1 = "Windows line-end\r\nUnix-style\nMacOS\rUnknown\n\r";
        String str2 = "Windows line-end\nUnix-style\nMacOS\nUnknown\n\n";
        InputStream reader = new ByteArrayInputStream(str1.getBytes());
        Document doc = new PlainDocument();
        kit.read(reader, doc, 0);
        assertEquals(str2, doc.getText(0, doc.getLength()));
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * @author Niko van Meurs <nikovanmeurs@gmail.com>
 * @author Sid Mijnders
 */
module.exports = function (Nodium, $, undefined) {

'use strict';

    var ui          = Nodium.ui;

    /**
     * @constructor
     */
    ui.UIPanel = Nodium.createClass(ui.UIElement, {

        destroy: function () {
            this.view.remove();
        },

        hide: function () {

            this.isVisible = false;
            this.view.removeClass('active');
        },

        show: function () {
            this.isVisible = true;
            this.view.addClass('active');
        },

        super: Nodium.util.super,

        /**
         * Event handlers
         */
        handleMenuCollapse: function (event) {

            if (this.isVisible) {
                this.hide();
            }
        }
    });
};


text:
ALTER TABLE IF EXISTS project RENAME CONSTRAINT fk_project_contact TO project_pi_contact;

--changeset venice.juanillas:alterConstraint_dataset_fk1  context:general splitStatements:false
ALTER TABLE IF EXISTS dataset RENAME CONSTRAINT dataset_fk1 TO dataset_experiment_id_fkey;

--changeset venice.juanillas:alterConstraint_dataset_fk2  context:general splitStatements:false
ALTER TABLE IF EXISTS dataset RENAME CONSTRAINT	dataset_fk2 TO dataset_callinganalysis_id_fkey;

--changeset venice.juanillas:alterConstraint_dnarun_fk1  context:general splitStatements:false
ALTER TABLE IF EXISTS dnarun RENAME CONSTRAINT dnarun_fk1  TO dnarun_experiment_id_fkey;

--changeset venice.juanillas:alterConstraint_dnarun_fk2  context:general splitStatements:false
ALTER TABLE IF EXISTS dnarun RENAME CONSTRAINT	dnarun_fk2 TO dnarun_dnasample_id_fkey;

--changeset venice.juanillas:alterConstraint_dnasample_fk1  context:general splitStatements:false
ALTER TABLE IF EXISTS dnasample RENAME CONSTRAINT dnasample_fk1 TO dnasample_project_id_fkey;

--changeset venice.juanillas:alterConstraint_dnasample_fk2  context:general splitStatements:false
ALTER TABLE IF EXISTS dnasample RENAME CONSTRAINT dnasample_fk2 TO dnasample_germplasm_id_fkey;

--changeset venice.juanillas:alterConstraint_dnasample_prop_fk1  context:general splitStatements:false
ALTER TABLE IF EXISTS dnasample_prop RENAME CONSTRAINT	dnasample_prop_fk1 TO dnasample_prop_dnasample_id_fkey;

--changeset venice.juanillas:alterConstraint_experiment_fk1  context:general splitStatements:false
ALTER TABLE IF EXISTS experiment RENAME CONSTRAINT experiment_fk1 TO experiment_project_id_fkey;

--changeset venice.juanillas:alterConstraint_experiment_fk2  context:general splitStatements:false
ALTER TABLE IF EXISTS experiment RENAME CONSTRAINT experiment_fk2 TO experiment_platform_id_fkey;

--changeset venice.juanillas:alterConstraint_experiment_fk3  context:general splitStatements:false
ALTER TABLE IF EXISTS experiment RENAME CONSTRAINT experiment_fk3 TO experiment_manifest_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_germplasm_species_id_cv  context:general splitStatements:false
ALTER TABLE IF EXISTS germplasm RENAME CONSTRAINT fk_germplasm_species_id_cv TO germplasm_species_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_linkage_group_map  context:general splitStatements:false
ALTER TABLE IF EXISTS linkage_group RENAME CONSTRAINT fk_linkage_group_map TO linkage_group_map_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_marker_cv  context:general splitStatements:false
ALTER TABLE IF EXISTS marker RENAME CONSTRAINT fk_marker_cv TO marker_strand_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_marker_linkage_group  context:general splitStatements:false
ALTER TABLE IF EXISTS marker_linkage_group RENAME CONSTRAINT fk_marker_linkage_group TO marker_linkage_group_linkage_group_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_marker_reference  context:general splitStatements:false
ALTER TABLE IF EXISTS marker RENAME CONSTRAINT fk_marker_reference TO marker_reference_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_organization_contact  context:general splitStatements:false
ALTER TABLE IF EXISTS contact RENAME CONSTRAINT fk_organization_contact TO contact_organization_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_platform_contact  context:general splitStatements:false
ALTER TABLE IF EXISTS platform RENAME CONSTRAINT fk_platform_contact TO platform_vendor_id_fkey;

--changeset venice.juanillas:alterConstraint_fk_platform_cv  context:general splitStatements:false
ALTER TABLE IF EXISTS platform RENAME CONSTRAINT fk_platform_cv TO platform_type_id_fkey;

--changeset venice.juanillas:alterConstraint_project_prop_fk1  context:general splitStatements:false
ALTER TABLE IF EXISTS project_prop RENAME CONSTRAINT project_prop_fk1 TO project_prop_project_id_fkey;

--changeset venice.juanillas:alterConstraint_marker_fk2 context:general splitStatements:false
ALTER TABLE IF EXISTS marker RENAME CONSTRAINT marker_fk2 TO marker_variant_id_fkey;

--changeset venice.juanillas:alterConstraint_marker_fk1 context:general splitStatements:false
ALTER TABLE IF EXISTS marker RENAME CONSTRAINT marker_fk1 TO marker_platform_id_fkey;


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>EyeLikeServlet</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>MainServlet</display-name>
    <servlet-name>MainServlet</servlet-name>
    <servlet-class>com.sap.krp.MainServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>MainServlet</servlet-name>
    <url-pattern>/MainServlet</url-pattern>
  </servlet-mapping>
</web-app>


text:
A HTML page that computes an OAuth 1.0 signature, showing all the workings so you can debug your own implementation.

[http://7digital.github.com/oauth-reference-page](http://7digital.github.com/oauth-reference-page)

## POST Support

It supports POSTs in the form of `application/x-www-form-urlencoded`, as well as POSTs of `application/xml` and `application/json` using the `Authorization` header - just put the XML or JSON into the 'body' field and set the 'body encoding' accordingly.

If you're using POST or PUT, it's best to copy the curl command output into a terminal window


text:
import { Observable } from 'rxjs/Observable';
export interface InAppBrowserEvent extends Event {
    /** the eventname, either loadstart, loadstop, loaderror, or exit. */
    type: string;
    /** the URL that was loaded. */
    url: string;
    /** the error code, only in the case of loaderror. */
    code: number;
    /** the error message, only in the case of loaderror. */
    message: string;
}
/**
 * @name InAppBrowser
 * @description Launches in app Browser
 * @usage
 * ```typescript
 * import {InAppBrowser} from 'ionic-native';
 *
 *
 * ...
 *
 *
 * let browser = new InAppBrowser('https://ionic.io', '_system');
 * browser.executeScript(...);
 * browser.insertCSS(...);
 * browser.close();
 * ```
 */
export declare class InAppBrowser {
    /**
     * @private
     */
    static open(url: string, target?: string, options?: string): void;
    private _objectInstance;
    /**
     * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
     * @param  url     The URL to load.
     * @param  target  The target in which to load the URL, an optional parameter that defaults to _self.
     * @param  options Options for the InAppBrowser. Optional, defaulting to: location=yes.
     *                 The options string must not contain any blank space, and each feature's
     *                 name/value pairs must be separated by a comma. Feature names are case insensitive.
     */
    constructor(url: string, target?: string, options?: string);
    /**
     * Displays an InAppBrowser window that was opened hidden. Calling this has no effect
     * if the InAppBrowser was already visible.
     */
    show(): void;
    /**
     * Closes the InAppBrowser window.
     */
    close(): void;
    /**
     * Injects JavaScript code into the InAppBrowser window.
     * @param script    Details of the script to run, specifying either a file or code key.
     * @returns {Promise<any>}
     */
    executeScript(script: {
        file?: string;
        code?: string;
    }): Promise<any>;
    /**
     * Injects CSS into the InAppBrowser window.
     * @param {Object}       Details of the script to run, specifying either a file or code key.
     * @returns {Promise<any>}
     */
    insertCss(css: {
        file?: string;
        code?: string;
    }): Promise<any>;
    /**
     * A method that allows you to listen to events happening in the browser.
     * @param {string} name of the event
     * @returns {Observable<InAppBrowserEvent>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
     */
    on(event: string): Observable<InAppBrowserEvent>;
}


text:
/*
 * 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 org.jdbi.v3.core.extension;

import org.jdbi.v3.core.config.ConfigRegistry;

/**
 * Accepted by a handle when executing extension code. This temporarily reconfigures the handle to execute
 * extension code. Reconfigurations are e.g. annotations from the sql objects that define mappers or bindings.
 */
public final class ExtensionContext {
    private final ConfigRegistry config;
    private final ExtensionMethod extensionMethod;

    public static ExtensionContext forConfig(ConfigRegistry config) {
        return new ExtensionContext(config, null);
    }

    public ExtensionContext(ConfigRegistry config, ExtensionMethod extensionMethod) {
        this.config = config;
        this.extensionMethod = extensionMethod;
    }

    public ConfigRegistry getConfig() {
        return config;
    }

    public ExtensionMethod getExtensionMethod() {
        return extensionMethod;
    }
}


text:
module Fog
  module DNS
    class Zerigo
      class Real

        require 'fog/zerigo/parsers/dns/count_hosts'

        # total number of hosts available for the specified zone. It is the same value as provided
        # in the X-Query-Count header in the list_hosts API method
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>
        #     * 'count'<~Integer>
        #   * 'status'<~Integer> - 200 indicates success
        def count_hosts(zone_id)
          request(
            :expects  => 200,
            :method   => 'GET',
            :parser   => Fog::Parsers::DNS::Zerigo::CountHosts.new,
            :path     => "/api/1.1/zones/#{zone_id}/hosts/count.xml"
          )
        end

      end

      class Mock # :nodoc:all
        def count_hosts(zone_id)
          zone = find_by_zone_id(zone_id)

          response = Excon::Response.new

          if zone
            response.status = 200
            response.body = {
              'count' => zone['hosts'].size
            }
          else
            response.status = 404
          end

          response
        end
      end
    end
  end
end


text:
FROM centos:6.6
MAINTAINER marthjod@gmail.com

RUN yum upgrade -y
RUN yum install -y tar rpm-build git

WORKDIR /data

RUN curl -s https://pypi.python.org/packages/source/s/setuptools/setuptools-14.3.1.tar.gz > /data/setuptools-14.3.1.tar.gz
# COPY resources/setuptools-14.3.1.tar.gz /data/
RUN curl -s https://pypi.python.org/packages/source/a/argparse/argparse-1.3.0.tar.gz > /data/argparse-1.3.0.tar.gz
# COPY resources/argparse-1.3.0.tar.gz /data/
RUN curl -s https://pypi.python.org/packages/source/n/nagiosplugin/nagiosplugin-1.2.2.tar.gz > /data/nagiosplugin-1.2.2.tar.gz
# COPY resources/nagiosplugin-1.2.2.tar.gz /data/
RUN curl -s https://pypi.python.org/packages/source/r/requesocks/requesocks-0.10.8.tar.gz > /data/requesocks-0.10.8.tar.gz
# COPY resources/requesocks-0.10.8.tar.gz /data/
RUN curl -s https://pypi.python.org/packages/source/c/certifi/certifi-14.05.14.tar.gz > /data/certifi-14.05.14.tar.gz

RUN tar xfz argparse-1.3.0.tar.gz
RUN tar xfz nagiosplugin-1.2.2.tar.gz
RUN tar xfz setuptools-14.3.1.tar.gz
RUN tar xfz requesocks-0.10.8.tar.gz
RUN tar xfz certifi-14.05.14.tar.gz
RUN git clone https://github.com/marthjod/keynoteapi.git

RUN cd setuptools-14.3.1 && python setup.py install
RUN cd argparse-1.3.0 && python setup.py bdist --format=rpm
RUN cd nagiosplugin-1.2.2 && python setup.py bdist --format=rpm
RUN cd requesocks-0.10.8 && python setup.py bdist --format=rpm
RUN cd certifi-14.05.14 && python setup.py bdist --format=rpm
RUN cd keynoteapi && python setup.py bdist --format=rpm

RUN mkdir /dists
RUN find -name '*.noarch.rpm' -exec cp {} /dists \;

RUN rpm -i /dists/argparse*.noarch.rpm
RUN rpm -i /dists/nagiosplugin*.noarch.rpm
RUN rpm -i /dists/requesocks*.noarch.rpm
RUN rpm -i /dists/certifi*.noarch.rpm
RUN rpm -i /dists/keynoteapi*.noarch.rpm

# RUN check_keynote

VOLUME /data


text:
@interface WaitViewController : UIViewController

@property (nonatomic) int idGuardianJSON;
@property (nonatomic) int idGuardedJSON;
@property (copy, nonatomic) NSString *guardianMail;

@end


text:
{- PiForall language, OPLSS, Summer 2013 -}

{-# LANGUAGE FlexibleInstances, FlexibleContexts, TupleSections,
  ExplicitForAll #-}
{-# OPTIONS_GHC -Wall -fno-warn-unused-matches -fno-warn-orphans #-}

-- | A parsec-based parser for the concrete syntax.
module Parser
  (
   parseModuleFile,
   parseModuleImports,
   parseExpr
  )
  where

import Syntax hiding (moduleImports)

import Unbound.LocallyNameless hiding (Data,Refl,Infix,join,name)
import Unbound.LocallyNameless.Ops (unsafeUnbind)

import Text.Parsec hiding (State,Empty)
import Text.Parsec.Expr(Operator(..),Assoc(..),buildExpressionParser)
import qualified LayoutToken as Token

import Control.Monad.State.Lazy hiding (join)
import Control.Applicative ((<$>), (<*>), (<*), (*>), (<$))
import Control.Monad.Error hiding (join)

import Data.List
import qualified Data.Set as S

{-

Concrete syntax for the language:
Optional components in this BNF are marked with < >

  levels:
     l ::= natural numbers

  terms:
    a,b,A,B ::=
      Type <l>                 Universes
    | x                        Variables   (start with lowercase)
    | \ x . a                  Function definition
    | a b                      Application
    | (x : A) -> B             Pi type

    | A / R                    Quotient type
    | <x:Q>                    Quotient introduction
    | expose x P p rsp         Quotient elimination

        expose : (P : A / R -> Type i) (s : (a : A) -> P <a>) (rsp : (x : A) (y : A) -> R x y -> (s x = s y)) (x : A / R) -> P x

    | (a : A)                  Annotations
    | (a)                      Parens
    | TRUSTME                  An axiom 'TRUSTME', inhabits all types
    | {?x}                     A hole named x

    | let x = a in b           Let expression

    | Zero                     Empty type
    | One                      Unit type
    | tt                       Unit value

    | { x : A | B }            Dependent pair type
    | (a, b)                   Prod introduction
    | pcase a of (x,y) -> b    Prod elimination

    | a = b                    Equality type
    | subst a by b <at x.c>    Type conversion
    | contra a                 Contra
    | refl p                   Equality proof with evidence

    | trivial                  Trivial tactic
    | induction [x,...y]       Induction tactic

    | C a ...                  Type / Term constructors
    | case a [y] of            Pattern matching
        C1 [x] y z -> b1
        C2 x [y]   -> b2
    | ind f x = a              Induction
    | ( x : A | C) -> B        Constrained type
    | a < b                    Ordering constrant

  declarations:

      foo : A
      foo = a

      axiom foo : A

      data T D : Type <l> where
         C1 of D1
         ...
         Cn of Dn

  telescopes:
    D ::=
                               Empty
     | (x : A) D               cons
     | (A) D

  Syntax sugar:

   - You can collapse lambdas, like:

         \ x [y] z . a

     This gets parsed as \ x . \ [y] . \ z . a

   - You can make a top level declaration an ind:

     foo : (n : Nat) -> A
     ind foo x = ...

-}

liftError :: (MonadError e m) => Either e a -> m a
liftError (Left e) = throwError e
liftError (Right a) = return a

-- | Parse a module declaration from the given filepath.
parseModuleFile :: (MonadError ParseError m, MonadIO m) => ConstructorNames -> String -> m Module
parseModuleFile cnames name = do
  liftIO $ putStrLn $ "Parsing File " ++ show name
  contents <- liftIO $ readFile name
  liftError $ runFreshM $
    flip evalStateT cnames $
     runParserT (whiteSpace *> moduleDef <* eof) [] name contents

-- | Parse only the imports part of a module from the given filepath.
parseModuleImports :: (MonadError ParseError m, MonadIO m) => String -> m Module
parseModuleImports name = do
  contents <- liftIO $ readFile name
  liftError $ runFreshM $
    flip evalStateT emptyConstructorNames $
     runParserT (whiteSpace *> moduleImports) [] name contents

-- | Test an 'LParser' on a String.
--
-- E.g., do
--
-- > testParser decl "axiom fix : (aTy : Type 0) -> (f : ((a:aTy) -> aTy)) -> aTy"
--
-- to parse an axiom declaration of a logical fixpoint combinator.
testParser :: LParser t -> String -> Either ParseError t
testParser parser str = runFreshM $
   flip evalStateT emptyConstructorNames $
     runParserT (do { whiteSpace; v <- parser; eof; return v}) [] "<interactive>" str

-- | Parse an expression.
parseExpr :: String -> Either ParseError Term
parseExpr = testParser expr

-- * Lexer definitions
type LParser a = ParsecT
                    String                      -- The input is a sequence of Char
                    [Column]                    -- The internal state for Layout tabs
                    (StateT ConstructorNames
                       FreshM)                   -- The internal state for generating fresh names,
                                                -- and for remembering which names are constructors.
                    a                           -- the type of the object being parsed

instance Fresh (ParsecT s u (StateT ConstructorNames FreshM))  where
  fresh = lift . lift . fresh

-- Based on Parsec's haskellStyle (which we can not use directly since
-- Parsec gives it a too specific type).
trellysStyle :: (Stream s m Char, Monad m) => Token.GenLanguageDef s u m
trellysStyle = Token.LanguageDef
                { Token.commentStart   = "{-"
                , Token.commentEnd     = "-}"
                , Token.commentLine    = "--"
                , Token.nestedComments = True
                , Token.identStart     = letter <|> oneOf "~"
                , Token.identLetter    = alphaNum <|> oneOf "_'⁺~"
                , Token.opStart	       = oneOf ":!#$%&*+.,/<=>?@\\^|-"
                , Token.opLetter       = oneOf ":!#$%&*+.,/<=>?@\\^|-"
                , Token.caseSensitive  = True
                , Token.reservedNames =
                  ["refl"
                  ,"ind"
                  ,"Type"
                  ,"data"
                  ,"where"
                  ,"case"
                  ,"of"
                  ,"with"
                  ,"under"
                  ,"by"
                  ,"contra"
                  ,"subst", "by", "at"
                  ,"let", "in"
                  ,"axiom"
                  ,"TRUSTME"
                  ,"ord"
                  ,"pcase"
                  ,"expose"
                  ,"trivial"
                  ,"induction"
                  ,"Zero","One", "tt"
                  ]
               , Token.reservedOpNames =
                 ["!","?","\\",":",".",",","<", "=", "+", "-", "^", "()", "_", "[|", "|]", "|", "{", "}"]
                }

tokenizer :: Token.GenTokenParser String [Column] (StateT ConstructorNames FreshM)
layout :: forall a t. LParser a -> LParser t -> LParser [a]
(tokenizer, layout) =
  let (t, Token.LayFun l) = Token.makeTokenParser trellysStyle "{" ";" "}"
      in (t, l)

identifier :: LParser String
identifier = Token.identifier tokenizer

whiteSpace :: LParser ()
whiteSpace = Token.whiteSpace tokenizer

variable :: LParser TName
variable =
  do i <- identifier
     cnames <- get
     if string2Name i `S.member` tconNames cnames || i `S.member` dconNames cnames
       then fail "Expected a variable, but a constructor was found"
       else return $ string2Name i

wildcard :: LParser TName
wildcard = reservedOp "_" >> return wildcardName

varOrWildcard :: LParser TName
varOrWildcard = try wildcard <|> variable

dconstructor :: LParser DCName
dconstructor =
  do i <- identifier
     cnames <- get
     if i `S.member` dconNames cnames
       then return i
       else fail $ if string2Name i `S.member` tconNames cnames
             then "Expected a data constructor, but a type constructor was found."
             else "Expected a constructor, but a variable was found"

tconstructor :: LParser TCName
tconstructor =
  do i <- identifier
     cnames <- get
     if string2Name i `S.member` tconNames cnames
       then return $ string2Name i
       else fail $ if i `S.member` dconNames cnames
             then "Expected a type constructor, but a data constructor was found."
             else "Expected a constructor, but a variable was found"

-- variables or zero-argument constructors
varOrCon :: LParser Term
varOrCon = do i <- identifier
              cnames <- get
              return $ if i `S.member` dconNames cnames
                then DCon i [] $ Annot Nothing
                else if string2Name i `S.member` tconNames cnames
                       then TCon (string2Name i) []
                       else Var $ string2Name i

colon, dot, comma :: LParser ()
colon = () <$ Token.colon tokenizer
dot = () <$ Token.dot tokenizer
comma = () <$ Token.comma tokenizer

reserved,reservedOp :: String -> LParser ()
reserved = Token.reserved tokenizer
reservedOp = Token.reservedOp tokenizer

parens,brackets,braces :: LParser a -> LParser a
parens = Token.parens tokenizer
brackets = Token.brackets tokenizer
braces = Token.braces tokenizer

natural :: LParser Int
natural = fromInteger <$> Token.natural tokenizer

natenc :: LParser Term
natenc =
  do n <- natural
     return $ encode n
   where encode 0 = DCon "zero" [] natty
         encode n = DCon "succ" [encode (n-1)] natty
         natty    = Annot $ Just (TCon (string2Name "ℕ") [])

moduleImports :: LParser Module
moduleImports = do
  reserved "module"
  modName <- identifier
  reserved "where"
  imports <- layout importDef (return ())
  return $ Module (string2Name modName) imports [] emptyConstructorNames

moduleDef :: LParser Module
moduleDef = do
  reserved "module"
  modName <- identifier
  reserved "where"
  imports <- layout importDef (return ())
  decls <- layout decl (return ())
  cnames <- get
  return $ Module (string2Name modName) imports decls cnames

importDef :: LParser ModuleImport
importDef = reserved "import" >> ModuleImport <$> importName
  where importName = liftM string2Name identifier

telescope :: LParser Telescope
telescope = do
  bindings <- telebindings
  return $ foldr g Empty bindings where
    g (n, t) rst = Cons (rebind (n, embed t) rst)

telebindings :: LParser [(TName, Term)]
telebindings = many teleBinding
  where
    annot :: LParser (TName, Term)
    annot = do
      (x,ty) <-    try ((,) <$> varOrWildcard      <*> (colon >> expr))
                <|>    ((,) <$> fresh wildcardName <*> expr)
      return (x,ty)
    teleBinding :: LParser (TName, Term)
    teleBinding =
      (    parens annot
       <|> brackets annot) <?> "binding"

---
--- Top level declarations
---

decl,dataDef,sigDef,valDef,indDef :: LParser Decl
decl = try dataDef <|> sigDef <|> valDef <|> indDef

-- datatype declarations.
dataDef = do
  reserved "data"
  name <- identifier
  params <- telescope
  colon
  Type level <- typen
  modify (\cnames ->
           cnames{ tconNames = S.insert (string2Name name)
                               (tconNames cnames) })
  reserved "where"
  cs <- layout constructorDef (return ())
  forM_ cs
    (\(ConstructorDef _ cname _) ->
       modify (\cnames -> cnames{ dconNames = S.insert cname (dconNames cnames)}))
  return $ Data (string2Name name) params level cs

constructorDef :: LParser ConstructorDef
constructorDef = (ConstructorDef <$> getPosition <*> identifier <*> option Empty (reserved "of" *> telescope))
             <?> "Constructor"

sigDef = do
  axOrSig <- option Sig $ reserved "axiom" >> return Axiom
  axOrSig <$> try (variable <* colon) <*> expr

valDef = Def <$> try (variable <* reservedOp "=") <*> expr

indDef = do
  r@(Ind b _) <- ind
  let ((n,_),_) = unsafeUnbind b
  return $ Def n r

------------------------
------------------------
-- Terms
------------------------
------------------------

trustme :: LParser Term
trustme = TrustMe (Annot Nothing) <$ reserved "TRUSTME"

hole :: LParser Term
hole = Hole <$> name <*> return (Annot Nothing)
  where
    name = braces $ string2Name <$> (reservedOp "?" *> many (noneOf "{}"))

trivialTactic :: LParser Term
trivialTactic = Trivial (Annot Nothing) <$ (reserved "trivial" <|> reservedOp "_")

inductionTactic :: LParser Term
inductionTactic = reserved "induction" *> (Induction (Annot Nothing) <$> brackets scrutinees)
  where
    scrutinees = expr `sepBy1` comma

refl :: LParser Term
refl = do
  reserved "refl"
  evidence <- option LitUnit expr
  annot <- optionMaybe (colon >> expr)
  return $ Refl (Annot annot) evidence

-- Expressions

expr,term,factor :: LParser Term

-- expr is the toplevel expression grammar
expr = Pos <$> getPosition <*> buildExpressionParser table term
  where table = [[ifix  AssocLeft "<" Smaller],
                 [ifix  AssocLeft "=" mkEq],
                 [ifix  AssocLeft "//" Quotient],
                 [ifixM AssocRight "->" mkArrow]
                ]
        ifix  assoc op f = Infix (reservedOp op >> return f) assoc
        ifixM assoc op f = Infix (reservedOp op >> f) assoc
        mkEq a b = TyEq a b (Annot Nothing) (Annot Nothing)
        mkArrow  =
          do n <- fresh wildcardName
             return $ \tyA tyB ->
               Pi (bind (n,embed tyA) tyB)

-- A "term" is either a function application or a constructor
-- application.  Breaking it out as a seperate category both
-- eliminates left-recursion in (<expr> := <expr> <expr>) and
-- allows us to keep constructors fully applied in the abstract syntax.
term = try dconapp <|> try tconapp <|> funapp

arg :: LParser Term
arg = brackets expr <|> factor

dconapp :: LParser Term
dconapp = DCon <$> dconstructor <*> many arg <*> return (Annot Nothing)

tconapp :: LParser Term
tconapp = TCon <$> tconstructor <*> many factor

funapp :: LParser Term
funapp = do
  f <- factor
  foldl' App f <$> many factor

factor = choice [ varOrCon   <?> "a variable or nullary data constructor"
                , typen      <?> "Type n"
                , natenc     <?> "a literal"
                , lambda     <?> "a lambda"
                , ind        <?> "ind"
                , letExpr    <?> "a let"
                , contra     <?> "a contra"
                , caseExpr   <?> "a case"
                , pcaseExpr  <?> "a pcase"
                , exposeExpr <?> "an expose"
                , sigmaTy    <?> "a sigma type"
                , squashTy   <?> "a squash type"
                , qboxExpr   <?> "a quotient box"
                , substExpr  <?> "a subst"
                , refl       <?> "refl"
                , trivialTactic <?> "the trivial tactic"
                , inductionTactic <?> "the induction tactic"
                , trustme    <?> "TRUSTME"
                , hole       <?> "hole"
                , impProd    <?> "an implicit function type"
                , bconst     <?> "a constant"
                , expProdOrAnnotOrParens
                    <?> "an explicit function type or annotated expression"
                ]

typen :: LParser Term
typen = Type <$> (reserved "Type" *> (try natural <|> return 0))

-- Lambda abstractions have the syntax '\x . e'
lambda :: LParser Term
lambda = do reservedOp "\\"
            binds <- many1 variable
            dot
            body <- expr
            return $ foldr lam body binds where
    lam x m = Lam (bind (x, embed $ Annot Nothing) m)

-- recursive abstractions, with the syntax 'ind f x = e', no type annotation.
ind :: LParser Term
ind = do
  reserved "ind"
  f <- variable
  x <- variable
  reservedOp "="
  body <- expr
  return $ Ind (bind (f,x) body) $ Annot Nothing

bconst  :: LParser Term
bconst = choice [TyEmpty <$ reserved "Zero",
                 TyUnit <$ reserved "One",
                 LitUnit <$ reserved "tt"]
--
letExpr :: LParser Term
letExpr =
  do reserved "let"
     x <- variable
     reservedOp "="
     boundExp <- expr
     reserved "in"
     body <- expr
     return $ Let $ bind (x,embed boundExp) body

-- impProd - implicit dependent products
-- These have the syntax [x:a] -> b or [a] -> b .
impProd :: LParser Term
impProd =
  do (x,tyA, mc) <- brackets
       (try ((,,) <$> variable <*> (colon >> expr) <*> return Nothing)
        <|> ((,,) <$> fresh wildcardName <*> expr) <*> return Nothing)
     optional (reservedOp "->")
     tyB <- expr
     return $ case mc of
       Just c  -> PiC (bind (x,embed tyA) (c,tyB))
       Nothing -> Pi (bind (x,embed tyA) tyB)

qboxExpr :: LParser Term
qboxExpr = do
  reservedOp "<"
  x <- expr
  mty <- optionMaybe (reservedOp ":" *> expr)
  reservedOp ">"
  return $ QBox x (Annot $ mty)

exposeExpr :: LParser Term
exposeExpr = do
  reserved "expose"
  q <- expr
  reserved "under"
  p <- expr
  reserved "with"
  s <- expr
  reserved "by"
  rsp <- expr
  return $ QElim p s rsp q

-- Function types have the syntax '(x:A) -> B'.  This production deals
-- with the ambiguity caused because these types, annotations and
-- regular old parens all start with parens.

data InParens = Colon Term Term | Comma Term Term | Nope Term

expProdOrAnnotOrParens :: LParser Term
expProdOrAnnotOrParens =
  let
    -- afterBinder picks up the return type of a pi
    afterBinder :: LParser Term
    afterBinder = optional (reservedOp "->") *> expr

    -- before binder parses an expression in parens
    -- If it doesn't involve a colon, you get (Right tm)
    -- If it does, you get (Left tm1 tm2).  tm1 might be a variable,
    --    in which case you might be looking at an explicit pi type.
    beforeBinder :: LParser InParens
    beforeBinder = parens $
      choice [ Colon <$> try (term <* colon) <*> expr
             , Comma <$> try (term <* comma) <*> expr
             , Nope <$> expr]
  in
    do bd <- beforeBinder
       case bd of
         Colon (Var x) a ->
           option (Ann (Var x) a)
                  (Pi <$> (bind (x, embed a) <$> afterBinder))
         Colon a b -> return $ Ann a b
         Comma a b -> return $ Prod a b (Annot Nothing)
         Nope a    -> return $ a

pattern :: LParser Pattern
-- Note that 'dconstructor' and 'variable' overlaps, annoyingly.
pattern =  try (PatCon <$> dconstructor <*> many atomic_pattern)
       <|> atomic_pattern
  where
    atomic_pattern =  parens pattern
                  <|> (PatVar <$> wildcard)
                  <|> do t <- varOrCon
                         case t of
                           (Var x) -> return $ PatVar x
                           (DCon c [] _) -> return $ PatCon c []
                           (TCon c []) -> fail "expected a data constructor but a type constructor was found"
                           _ -> error "internal error in atomic_pattern"

match :: LParser Match
match = Match <$> (bind <$> pattern <* reservedOp "->" <*> term)

caseExpr :: LParser Term
caseExpr = Case
       <$> (reserved "case" *> factor)
       <*> (reserved "of" *> layout match (return ()))
       <*> return (Annot Nothing)

pcaseExpr :: LParser Term
pcaseExpr = do
    reserved "pcase"
    scrut <- expr
    reserved "of"
    reservedOp "("
    x <- variable
    reservedOp ","
    y <- variable
    reservedOp ")"
    reservedOp "->"
    a <- expr
    return $ Pcase scrut (bind (x,y) a) (Annot Nothing)

-- subst e0 by e1 { at [x.t] }
substExpr :: LParser Term
substExpr = do
  reserved "subst"
  a <- expr
  reserved "by"
  b <- expr
  ctx <- option Nothing (try (do
     reserved "at"
     x <- variable
     dot
     c <- expr
     return (Just (bind x c))))
  return $ Subst a b ctx

contra :: LParser Term
contra = Contra <$> (reserved "contra" *> expr) <*> return (Annot Nothing)

squashTy :: LParser Term
squashTy = do
  x <- between (reservedOp "[|") (reservedOp "|]") expr
  return (TySquash x) <?> "Squash"

sigmaTy :: LParser Term
sigmaTy = do
  reservedOp "{"
  x <- variable
  colon
  a <- expr
  reservedOp "&"
  b <- expr
  reservedOp "}"
  return (Sigma (bind (x, embed a) b))


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

global $CFG;

require_once($CFG->dirroot . '/webservice/tests/helpers.php');

/**
 * Guest enrolment external functions tests
 *
 * @package    enrol_guest
 * @category   external
 * @copyright  2015 Juan Leyva <juan@moodle.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @since      Moodle 3.1
 */
class enrol_guest_external_testcase extends externallib_advanced_testcase {

    /**
     * Test get_instance_info
     */
    public function test_get_instance_info() {
        global $DB;

        $this->resetAfterTest(true);

        // Check if guest enrolment plugin is enabled.
        $guestplugin = enrol_get_plugin('guest');
        $this->assertNotEmpty($guestplugin);

        $studentrole = $DB->get_record('role', array('shortname' => 'student'));

        $coursedata = new stdClass();
        $coursedata->visible = 0;
        $course = self::getDataGenerator()->create_course($coursedata);

        $student = self::getDataGenerator()->create_user();
        $this->getDataGenerator()->enrol_user($student->id, $course->id, $studentrole->id, 'manual');

        // Add enrolment methods for course.
        $instance = $guestplugin->add_instance($course, array('status' => ENROL_INSTANCE_ENABLED,
                                                                'name' => 'Test instance',
                                                                'customint6' => 1,
                                                                'roleid' => $studentrole->id));

        $this->setAdminUser();
        $result = enrol_guest_external::get_instance_info($instance);
        $result = external_api::clean_returnvalue(enrol_guest_external::get_instance_info_returns(), $result);

        $this->assertEquals($instance, $result['instanceinfo']['id']);
        $this->assertEquals($course->id, $result['instanceinfo']['courseid']);
        $this->assertEquals('guest', $result['instanceinfo']['type']);
        $this->assertEquals('Test instance', $result['instanceinfo']['name']);
        $this->assertTrue($result['instanceinfo']['status']);
        $this->assertFalse($result['instanceinfo']['passwordrequired']);

        $DB->set_field('enrol', 'status', ENROL_INSTANCE_DISABLED, array('id' => $instance));

        $result = enrol_guest_external::get_instance_info($instance);
        $result = external_api::clean_returnvalue(enrol_guest_external::get_instance_info_returns(), $result);
        $this->assertEquals($instance, $result['instanceinfo']['id']);
        $this->assertEquals($course->id, $result['instanceinfo']['courseid']);
        $this->assertEquals('guest', $result['instanceinfo']['type']);
        $this->assertEquals('Test instance', $result['instanceinfo']['name']);
        $this->assertFalse($result['instanceinfo']['status']);
        $this->assertFalse($result['instanceinfo']['passwordrequired']);

        $DB->set_field('enrol', 'status', ENROL_INSTANCE_ENABLED, array('id' => $instance));

        // Try to retrieve information using a normal user for a hidden course.
        $user = self::getDataGenerator()->create_user();
        $this->setUser($user);
        try {
            enrol_guest_external::get_instance_info($instance);
        } catch (moodle_exception $e) {
            $this->assertEquals('coursehidden', $e->errorcode);
        }

        // Student user.
        $DB->set_field('course', 'visible', 1, array('id' => $course->id));
        $this->setUser($student);
        $result = enrol_guest_external::get_instance_info($instance);
        $result = external_api::clean_returnvalue(enrol_guest_external::get_instance_info_returns(), $result);

        $this->assertEquals($instance, $result['instanceinfo']['id']);
        $this->assertEquals($course->id, $result['instanceinfo']['courseid']);
        $this->assertEquals('guest', $result['instanceinfo']['type']);
        $this->assertEquals('Test instance', $result['instanceinfo']['name']);
        $this->assertTrue($result['instanceinfo']['status']);
        $this->assertFalse($result['instanceinfo']['passwordrequired']);
    }
}


text: export { default } from 'ember-fhir/models/procedure-focal-device';


text:
<?php

namespace MyBB\Core\Twig\Extensions;

use Illuminate\Http\Request;
use Twig_Extension;
use Twig_SimpleFunction;

class CurrentPath extends Twig_Extension
{
    /**
     * @var string
     */
    protected $currentPath;

    /**
     * @var Request
     */
    protected $request;

    /**
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        $this->request = $request;
    }

    /**
     * {@inheritDoc}
     */
    public function getName()
    {
        return 'MyBB_Twig_Extensions_CurrentPath';
    }

    /**
     * {@inheritDoc}
     */
    public function getFunctions()
    {
        return [
            new Twig_SimpleFunction('current_path', [$this, 'currentPath']),
        ];
    }

    /**
     * @return string
     */
    public function currentPath()
    {
        if ($this->currentPath == null) {
            $path = $this->request->path();

            if ($path == '/') {
                $path = '';
            }

            $this->currentPath = $path;
        }

        return $this->currentPath;
    }
}


text:
shared_examples_for 'an options class method' do
  context 'with no argument' do
    subject { object.send(method) }

    it { should be(default) }
  end

  context 'with a default value' do
    subject { object.send(method, value) }

    let(:value) { double('value') }

    it { should equal(object) }

    it 'sets the default value for the class method' do
      expect { subject }.to change { object.send(method) }.from(default).to(value)
    end
  end
end


text:
module ActiveRecord
  module ConnectionAdapters
    module OracleEnhanced
      module DatabaseStatements
        # DATABASE STATEMENTS ======================================
        #
        # see: abstract/database_statements.rb

        # Executes a SQL statement
        def execute(sql, name = nil, async: false)
          sql = transform_query(sql)

          log(sql, name, async: async) { @raw_connection.exec(sql) }
        end

        def exec_query(sql, name = "SQL", binds = [], prepare: false, async: false)
          sql = transform_query(sql)

          type_casted_binds = type_casted_binds(binds)

          log(sql, name, binds, type_casted_binds, async: async) do
            cursor = nil
            cached = false
            with_retry do
              if without_prepared_statement?(binds)
                cursor = @raw_connection.prepare(sql)
              else
                unless @statements.key? sql
                  @statements[sql] = @raw_connection.prepare(sql)
                end

                cursor = @statements[sql]

                cursor.bind_params(type_casted_binds)

                cached = true
              end

              cursor.exec
            end

            if (name == "EXPLAIN") && sql.start_with?("EXPLAIN")
              res = true
            else
              columns = cursor.get_col_names.map do |col_name|
                oracle_downcase(col_name)
              end
              rows = []
              fetch_options = { get_lob_value: (name != "Writable Large Object") }
              while row = cursor.fetch(fetch_options)
                rows << row
              end
              res = build_result(columns: columns, rows: rows)
            end

            cursor.close unless cached
            res
          end
        end

        def supports_explain?
          true
        end

        def explain(arel, binds = [])
          sql = "EXPLAIN PLAN FOR #{to_sql(arel, binds)}"
          return if /FROM all_/.match?(sql)
          if ORACLE_ENHANCED_CONNECTION == :jdbc
            exec_query(sql, "EXPLAIN", binds)
          else
            exec_query(sql, "EXPLAIN")
          end
          select_values("SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY)", "EXPLAIN").join("\n")
        end

        # New method in ActiveRecord 3.1
        # Will add RETURNING clause in case of trigger generated primary keys
        def sql_for_insert(sql, pk, binds)
          unless pk == false || pk.nil? || pk.is_a?(Array) || pk.is_a?(String)
            sql = "#{sql} RETURNING #{quote_column_name(pk)} INTO :returning_id"
            (binds = binds.dup) << ActiveRecord::Relation::QueryAttribute.new("returning_id", nil, Type::OracleEnhanced::Integer.new)
          end
          super
        end

        def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
          pk = nil if id_value
          super
        end

        # New method in ActiveRecord 3.1
        def exec_insert(sql, name = nil, binds = [], pk = nil, sequence_name = nil)
          sql, binds = sql_for_insert(sql, pk, binds)
          type_casted_binds = type_casted_binds(binds)

          log(sql, name, binds, type_casted_binds) do
            cached = false
            cursor = nil
            returning_id_col = returning_id_index = nil
            with_retry do
              if without_prepared_statement?(binds)
                cursor = @raw_connection.prepare(sql)
              else
                unless @statements.key?(sql)
                  @statements[sql] = @raw_connection.prepare(sql)
                end

                cursor = @statements[sql]

                cursor.bind_params(type_casted_binds)

                if /:returning_id/.match?(sql)
                  # it currently expects that returning_id comes last part of binds
                  returning_id_index = binds.size
                  cursor.bind_returning_param(returning_id_index, Integer)
                end

                cached = true
              end

              cursor.exec_update
            end

            rows = []
            if returning_id_index
              returning_id = cursor.get_returning_param(returning_id_index, Integer).to_i
              rows << [returning_id]
            end
            cursor.close unless cached
            build_result(columns: returning_id_col || [], rows: rows)
          end
        end

        # New method in ActiveRecord 3.1
        def exec_update(sql, name = nil, binds = [])
          type_casted_binds = type_casted_binds(binds)

          log(sql, name, binds, type_casted_binds) do
            with_retry do
              cached = false
              if without_prepared_statement?(binds)
                cursor = @raw_connection.prepare(sql)
              else
                if @statements.key?(sql)
                  cursor = @statements[sql]
                else
                  cursor = @statements[sql] = @raw_connection.prepare(sql)
                end

                cursor.bind_params(type_casted_binds)

                cached = true
              end

              res = cursor.exec_update
              cursor.close unless cached
              res
            end
          end
        end

        alias :exec_delete :exec_update

        def begin_db_transaction # :nodoc:
          @raw_connection.autocommit = false
        end

        def transaction_isolation_levels
          # Oracle database supports `READ COMMITTED` and `SERIALIZABLE`
          # No read uncommitted nor repeatable read supppoted
          # http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10005.htm#SQLRF55422
          {
            read_committed:   "READ COMMITTED",
            serializable:     "SERIALIZABLE"
          }
        end

        def begin_isolated_db_transaction(isolation)
          begin_db_transaction
          execute "SET TRANSACTION ISOLATION LEVEL  #{transaction_isolation_levels.fetch(isolation)}"
        end

        def commit_db_transaction # :nodoc:
          @raw_connection.commit
        ensure
          @raw_connection.autocommit = true
        end

        def exec_rollback_db_transaction # :nodoc:
          @raw_connection.rollback
        ensure
          @raw_connection.autocommit = true
        end

        def create_savepoint(name = current_savepoint_name) # :nodoc:
          execute("SAVEPOINT #{name}", "TRANSACTION")
        end

        def exec_rollback_to_savepoint(name = current_savepoint_name) # :nodoc:
          execute("ROLLBACK TO #{name}", "TRANSACTION")
        end

        def release_savepoint(name = current_savepoint_name) # :nodoc:
          # there is no RELEASE SAVEPOINT statement in Oracle
        end

        # Returns default sequence name for table.
        # Will take all or first 26 characters of table name and append _seq suffix
        def default_sequence_name(table_name, primary_key = nil)
          table_name.to_s.gsub((/(^|\.)([\w$-]{1,#{sequence_name_length - 4}})([\w$-]*)$/), '\1\2_seq')
        end

        # Inserts the given fixture into the table. Overridden to properly handle lobs.
        def insert_fixture(fixture, table_name) # :nodoc:
          super

          if ActiveRecord::Base.pluralize_table_names
            klass = table_name.to_s.singularize.camelize
          else
            klass = table_name.to_s.camelize
          end

          klass = klass.constantize rescue nil
          if klass.respond_to?(:ancestors) && klass.ancestors.include?(ActiveRecord::Base)
            write_lobs(table_name, klass, fixture, klass.lob_columns)
          end
        end

        def insert_fixtures_set(fixture_set, tables_to_delete = [])
          disable_referential_integrity do
            transaction(requires_new: true) do
              tables_to_delete.each { |table| delete "DELETE FROM #{quote_table_name(table)}", "Fixture Delete" }

              fixture_set.each do |table_name, rows|
                rows.each { |row| insert_fixture(row, table_name) }
              end
            end
          end
        end

        # Oracle Database does not support this feature
        # Refer https://community.oracle.com/ideas/13845 and consider to vote
        # if you need this feature.
        def empty_insert_statement_value
          raise NotImplementedError
        end

        # Writes LOB values from attributes for specified columns
        def write_lobs(table_name, klass, attributes, columns) # :nodoc:
          id = quote(attributes[klass.primary_key])
          columns.each do |col|
            value = attributes[col.name]
            # changed sequence of next two lines - should check if value is nil before converting to yaml
            next unless value
            value = klass.attribute_types[col.name].serialize(value)
            # value can be nil after serialization because ActiveRecord serializes [] and {} as nil
            next unless value
            uncached do
              unless lob_record = select_one(sql = <<~SQL.squish, "Writable Large Object")
                SELECT #{quote_column_name(col.name)} FROM #{quote_table_name(table_name)}
                WHERE #{quote_column_name(klass.primary_key)} = #{id} FOR UPDATE
              SQL
                raise ActiveRecord::RecordNotFound, "statement #{sql} returned no rows"
              end
              lob = lob_record[col.name]
              @raw_connection.write_lob(lob, value.to_s, col.type == :binary)
            end
          end
        end

        private
          def with_retry
            @raw_connection.with_retry do
              yield
            rescue
              @statements.clear
              raise
            end
          end
      end
    end
  end
end


text:
'use strict'

var ParameterizedType = require('./ParameterizedType.js')
  , TypeParameter = require('./TypeParameter.js')
  , Type = require('./Type.js')
  , util = require('../util.js')

function ArgumentsArrayType(typeParams) {
  typeParams = typeParams || [new TypeParameter('a')]
  if(typeParams.length !== 1)
    throw new Error(
      'Wrong number of type params passed to ArgumentsArrayType')
  ParameterizedType.call(this, typeParams, 'Arguments')
  this.habitationTemplate = [
    '(function(candidate) {',
    '  return candidate instanceof Object && ' +
      '"callee" in candidate && "length" in candidate && ',
      'candidate.constructor === Object',
    '})(@candidate)'
  ].join('\n')
}

ArgumentsArrayType.prototype = Object.create(ParameterizedType.prototype)

ArgumentsArrayType.prototype.validateInstance = function(obj, typeFilters) {
  if(!obj) return util.failInstance(obj)
  if(!(obj instanceof Object)) return util.failInstance(obj)
  if(!('callee' in obj)) return util.failInstance(obj)
  if(!('length' in obj)) return util.failInstance(obj)
  if(obj.constructor !== Object) return util.failInstance(obj)
  var childType = this.typeParameters[0]
  for(var i = 0; i < obj.length; i++) {
    var childError = childType.validateInstance(obj[i], typeFilters)
    if(childError.length)
      return util.failInstance(obj, childError)
  }
  return []
}

module.exports = ArgumentsArrayType


text:
import { ModuleWithProviders }   from '@angular/core';
import { Routes, RouterModule }  from '@angular/router';

import { AdminComponent }           from './admin.component';
import { AdminDashboardComponent }  from './admin-dashboard.component';
import { ManageCrisesComponent }    from './manage-crises.component';
import { ManageHeroesComponent }    from './manage-heroes.component';

// #docregion admin-route, can-activate-child
import { AuthGuard }                from '../auth-guard.service';

const adminRoutes: Routes = [
  {
    path: 'admin',
    component: AdminComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: '',
        children: [
          { path: 'crises', component: ManageCrisesComponent },
          { path: 'heroes', component: ManageHeroesComponent },
          { path: '', component: AdminDashboardComponent }
        ],
        // #enddocregion admin-route
        // #docregion can-activate-child
        canActivateChild: [AuthGuard]
        // #docregion admin-route
      }
    ]
  }
];

export const adminRouting: ModuleWithProviders = RouterModule.forChild(adminRoutes);
// #enddocregion


text:
package io.github.gongshw.chisu.biz.handler.impl;

import io.github.gongshw.chisu.biz.handler.RequestParam;
import io.github.gongshw.chisu.biz.handler.Response;

/**
 * Created by gongshw on 14-8-9.
 */
public class RegisterHandler extends BaseHandler {

	private boolean openRegister = false;

	@Override
	public void receive(RequestParam requestParam, Response response) {
		if (openRegister) {
			//TODO
			assert false;
		} else {
			response.write("暂不开放注册!");
		}
	}

	public void setOpenRegister(boolean openRegister) {
		this.openRegister = openRegister;
	}
}


text:
module Vcloud
  module Item
    class User < SimpleType
      def to_s
        "#{@name}"
      end
    end
  end
end


text:
<% if (editable) { %>
<label <% if (description) {%> title="<%= description %>"<% } %>
    class="shift-checkbox role-capability__item-label<% if (isAccessLevelChanged) {%> role-capability__item-label_changed<% } %>"
    ><input type="checkbox" value="<%= selected_access_level %>"
        <% if (access_level === selected_access_level) { %> checked<% } %>><%= label %>
<% } else { %>
<div<% if (description) {%> title="<%= description %>"<% } %> class="role-capability__item-label<% if (noAccess) { %> role-capability__item-label--no-access<% } %>"><%= label %>

<% } %>


text:
namespace CallrApi.Enums
{
    /// <summary>
    /// This class defines all Media Library/Recording Statuses.
    /// </summary>
    public static class MediaStatuses
    {
        /// <summary>
        /// Media ready.
        /// </summary>
        public static readonly string READY = "READY";

        /// <summary>
        /// Media is empty, pending content.
        /// </summary>
        public static readonly string PENDING_CONTENT = "PENDING_CONTENT";

        /// <summary>
        /// Content is set, pending conversion.
        /// </summary>
        public static readonly string PENDING_CONVERSION = "PENDING_CONVERSION";

        /// <summary>
        /// An error occured while processing the media.
        /// </summary>
        public static readonly string ERROR = "ERROR";

        /// <summary>
        /// Processing the media into internal formats.
        /// </summary>
        public static readonly string PROCESSING = "PROCESSING";
    }
}


text:
\section{Problem E}
\textit{Perform time reversal in a MISO context for each set of 2 channel realizations (one from A and one from D). Calculate the average power delay profile of the equivalent channel and from that the delay spread. How does it compare to the delay spread calculated in B and C?}\\

Applying time reversal in a MISO fashion means to sum the autocorrelation functions (convolutions) of each of the received antenas (see last slide in page 4 of mm1).

\code{language=Matlab,caption = Time reversal in MISO fashion,label=cl:imp_resp_code,linerange={189-212},firstnumber=189}{code/mm1/mm1_pretty_solution_pretty_coments_Labels_and_DB.m}

The time reversed signal in a MISO fashion is shown in \figref{fig:ex_e_miso_2channels}

\begin{figure}
\centering
\includegraphics[width=11cm]{ex_e_miso_2channels.eps}
\caption{Impulse Response and PDP}\label{fig:ex_e_miso_2channels}
\end{figure}

As an extra, we decided to do the time reversal of the signal in a MISO fashion using 16 antennas instead of 2. The resulted time reversed signal is shown in \figref{fig:ex_e_miso_16channels}

\begin{figure}
\centering
\includegraphics[width=11cm]{ex_e_miso_16channels.eps}
\caption{Impulse Response and PDP}\label{fig:ex_e_miso_16channels}
\end{figure}

In these cases the delay spread was similar to that calculated for one antenna.\\

In \tref{tab:power_del_spread} the power delay spread of all the calculated cases are reported.

\ptable{| p{10cm} | p{8cm} |}{ %
Case 							&	Delay spread [\SI{}{\micro\second}] 												\\ \hline
Taps from table 		        &	$1.026$											        \\ \hline
Several realizations of the channel 	        &	$1.024$										            \\ \hline
Time reversed signal							&	$1.753$	    							\\ \hline
Time reversed signal (MISO) 2 antennas			& 	$1.678$                           \\ \hline
Time reversed signal (MISO) 16 antennas			        &	$1.753$ 	                        \\ \hline
}{Power delay spread for the different cases}{tab:power_del_spread}


text:
module nullstone.markup {
    export interface INsPrefixResolver {
        lookupNamespaceURI(prefix: string): string;
    }
    export interface IMarkupExtensionParser {
        setNamespaces (defaultXmlns: string, xXmlns: string): IMarkupExtensionParser;
        onResolveType (cb?: events.IResolveType): IMarkupExtensionParser;
        onResolveObject (cb?: events.IResolveObject): IMarkupExtensionParser;
        onResolvePrimitive (cb?: events.IResolvePrimitive): IMarkupExtensionParser;
        onError (cb?: events.IError): IMarkupExtensionParser;
        parse(val: string, resolver: INsPrefixResolver, os: any[]):any;
    }
}


text:
/*

 Features page CSS
--------------------------------------------- */
.feature {
	margin: -1px 0 2em 0;
	padding: 0;
	background: #fbf8ea;
	border-top: 2px solid #e7dac4;
	border-bottom: 2px solid #e7dac4;
	*margin-right: 30px;
}
#feature-section .feature:nth-child(2n-2) {
	background: #faeefe;
}
.feature h3 {
	margin: 0;
	margin-left: 1.5em;
	margin-top: 1em;
	color: #bcaf99;
	font-size: 150%;
	line-height: 1.5em;
}
#feature-section .feature:nth-child(2n-2) h3 {
	color: #b3acb6;
}
.feature p {
	padding: 1em 3em 1em 1em;
}
.feature>.grid>.col>p.f-about {
	margin: 0 0 1em 0;
	padding-top: 1em;
}
.feature #feature-blog p.f-about {
	margin-bottom: -2em;
}
.feature>.grid>.span6 {
	background: #fffef9;
}
.feature>.grid>.span6 {
	border-right: 4px solid #FFF;
	border-left: 4px solid #FFF;
}
.feature .col,
.feature p {
	padding-top: 0;
	margin-top: 0;
}
.feature p.sub {
	margin: 0;
	font-weight: bold;
	color: #000;
}
.feature .grid .grid {
	margin: 2em 0 0 0;
}
.feature .about {
	padding: 1em 2em;
}
.feature h4 {
	margin: 2em 0 1em 1em;
}
.feature ul {
	margin: 0 2em 2em 2em;
	padding: 0;
}
.feature ul.f-updates {
	list-style: none;
	margin-left: 1em;
}
.feature ul.f-updates li {
	background-position: 0 2px;
	margin-left: 0;
}
.feature .suggest {
	margin-top: 0.5em;
	display: block;
	width: auto;
}
.feature .suggest a {
	border: 3px solid #ede1cf;
	padding: 0.2em 1em 0.3em 1em;
	background: #FFF;
	color: #e28c0c;
}
.feature .suggest a:hover {
	color: #FFF;
	background: #e28c0c;
}
.feature p.ima {
	border: 3px solid #ede1cf;
	padding: 1em 1em 1em 1em;
	margin-left: 3em;
	margin-top: 1em;
	width: 32px;
	height: 32px;
	text-align: center;
	background: #FFFFFF;
	-webkit-border-radius: 10px;
	-moz-border-radius: 10px;
	-ms-border-radius: 10px;
	-o-border-radius: 10px;
	border-radius: 10px;
}
.feature p.wip {
	margin: 0;
	margin-left: 2em;
	font-size: 110%;
	font-weight: bold;
	padding: 0;
}
.feature p.ima:before {
	content: "";
	width: 40px;
	height: 40px;
	font-size: 40px;
	font-family: 'Fontcons';
	color: #CCC;
	position: absolute;
	margin: 0;
	margin-left: -0.5em;
	margin-top: 0.1em;
}
.feature #feature-todo {
	background: url("../img/screenshots/todo.jpg") right top no-repeat;
}
.feature #feature-blog {
	background: url("../img/screenshots/blog.jpg") right top no-repeat;
}
.feature #feature-notes {
	background: url("../img/screenshots/notes.jpg") right top no-repeat;
}
.feature #feature-team {
	background: url("../img/screenshots/team.jpg") right top no-repeat;
}
.feature #feature-files {
	background: url("../img/screenshots/files.jpg") right top no-repeat;
}
.feature #feature-app, .feature #feature-tool {
	background: url("../img/screenshots/apps.jpg") right top no-repeat;
}
.feature #feature-publications {
	background: url("../img/screenshots/publications.jpg") right top no-repeat;
}
.feature #feature-activity {
	background: url("../img/screenshots/activity.jpg") right top no-repeat;
}
.feature #feature-more {
	background: url("../img/screenshots/other.jpg") right top no-repeat;
}


text:
Run this [Nginx][] image with:

    $ docker run -d --name nginx-0 -v /var/www/nginx-0/htdocs:/var/www/localhost -p 80:80 -p 443:443 gentoobb/nginx

Default SSL certificates are expected at:

    /etc/nginx/ssl/localhost/nginx.{crt,key}

If missing a self signed certificate is created on container start.

In the lights of the recent [POODLE][] exploit SSL3 is disabled per default.

To enable [forward-secrecy][] set NGINX_FORWARD_SECRECY on container start:

    $ docker run -d --name nginx-0 -v /var/www/nginx-0/htdocs:/var/www/localhost -p 80:80  -p 443:443 \
        -e NGINX_FORWARD_SECRECY=true
        gentoobb/nginx

The nginx main config sources *.conf files in /etc/nginx/conf.d/ and /etc/nginx/sites-enabled/

Default server{} config is in:

    /etc/nginx/sites-enabled/default.conf

For dev setups you can specify the UID/GID of the nginx worker process:

    $ docker run -d --name nginx-0 -v /var/www/nginx-0/htdocs:/var/www/localhost -p 80:80  -p 443:443 \
        -e NGINX_UID=$(id -u $(whoami)) \
        -e NGINX_GID=$(id -g $(whoami)) \
        gentoobb/nginx

The nginx startup script also provides a simple templating mechanism for site config files:

    $ docker run -d --name nginx-0 -v /var/www/nginx-0/htdocs:/var/www/localhost -p 80:80 -p 443:443 \
        -e NG_TMPL_MY_VAR=my_value \
        gentoobb/nginx

This would replace the marker named ##_NG_TMPL_MY_VAR_## with the provided value in all .conf files in /etc/nginx/sites-enabled.
Template variable names must start with NG_TMPL_.

[Nginx]: http://nginx.org/
[forward-secrecy]: http://en.wikipedia.org/wiki/Forward_secrecy
[POODLE]: http://en.wikipedia.org/wiki/POODLE


text:
layout: page
title: Contact
image: 7.jpg
---
{% if site.contact-subtitle %}

{{ site.contact-subtitle }}

{% else %}
{% endif %}
<form action="https://formspree.io/{{ site.contact-form }}" method="POST" class="form">

    Your Name (Required)
    <input class="form-input" type="text" name="name" id="form-name" required>

    Your Email (Required)
    <input class="form-input" type="email" name="_replyto" id="form-email" required>

    Subject
    <input class="form-input" type="text" name="subject" id="form-subject">

    Your Message (Required)
    <textarea class="form-textarea" name="text" rows="12" id="form-text" required></textarea>

    <button type="submit" class="form-btn btn btn-big">Send</button>

</form>


text:
<?php

namespace common\models\lianlian;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\lianlian\payLL;

/**
 * payLLSearch represents the model behind the search form about `common\models\lianlian\payLL`.
 */
class payLLSearch extends payLL
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'uid', 'status', 'create_at', 'update_at'], 'integer'],
            [['idcard', 'real_name', 'user_id', 'busi_partne', 'no_order', 'name_goods', 'money_order', 'card_no', 'from_ip', 'bank_code', 'remark', 'sign_type', 'sign', 'oid_paybill', 'money_lianlian', 'settle_date', 'pay_type'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = payLL::find()->orderBy('id DESC');

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pageSize' => 10,
            ],
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'uid' => $this->uid,
            'status' => $this->status,
            'create_at' => $this->create_at,
            'update_at' => $this->update_at,
        ]);

        $query->andFilterWhere(['like', 'idcard', $this->idcard])
            ->andFilterWhere(['like', 'real_name', $this->real_name])
            ->andFilterWhere(['like', 'user_id', $this->user_id])
            ->andFilterWhere(['like', 'busi_partne', $this->busi_partne])
            ->andFilterWhere(['like', 'no_order', $this->no_order])
            ->andFilterWhere(['like', 'name_goods', $this->name_goods])
            ->andFilterWhere(['like', 'money_order', $this->money_order])
            ->andFilterWhere(['like', 'card_no', $this->card_no])
            ->andFilterWhere(['like', 'from_ip', $this->from_ip])
            ->andFilterWhere(['like', 'bank_code', $this->bank_code])
            ->andFilterWhere(['like', 'remark', $this->remark])
            ->andFilterWhere(['like', 'sign_type', $this->sign_type])
            ->andFilterWhere(['like', 'sign', $this->sign])
            ->andFilterWhere(['like', 'oid_paybill', $this->oid_paybill])
            ->andFilterWhere(['like', 'money_lianlian', $this->money_lianlian])
            ->andFilterWhere(['like', 'settle_date', $this->settle_date])
            ->andFilterWhere(['like', 'pay_type', $this->pay_type]);

        return $dataProvider;
    }
}


text:
package org.elasticsearch.action.vectorize;

import org.elasticsearch.test.ESIntegTestCase;

public class ShardVectorizeResponseTests extends ESIntegTestCase {

}


text:
using System.Composition;
using System.Diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace Microsoft.ApiDesignGuidelines.Analyzers
{
    /// <summary>
    /// CA1052: Static holder types should be sealed
    /// </summary>
    [ExportCodeFixProvider(LanguageNames.CSharp), Shared]
    public class CSharpStaticHolderTypesShouldBeSealedFixer : StaticHolderTypesShouldBeSealedFixer
    {

    }
}


text:
/**
 *
 */
package com.uphyca.testing.junit.internal.builders;

import org.junit.internal.builders.JUnit3Builder;
import org.junit.runner.Runner;

import com.uphyca.testing.junit.internal.runners.AndroidJUnit38ClassRunner;

/**
 * Modified version of org.junit.internal.builders.JUnit3Builder.
 */
public class AndroidJUnit3Builder extends JUnit3Builder {
	@Override
	public Runner runnerForClass(Class<?> testClass) throws Throwable {
		if (isPre4Test(testClass)) {
		    //For Android
			return new AndroidJUnit38ClassRunner(testClass);
		}
		return null;
	}

	boolean isPre4Test(Class<?> testClass) {
		return junit.framework.TestCase.class.isAssignableFrom(testClass);
	}
}


text:
package uk.co.exemel.disco.baseline;

import java.util.LinkedHashMap;
import java.util.Map;

import com.betfair.baseline.v2.to.ComplexMapOperationResponseObjectDelegate;
import com.betfair.baseline.v2.to.SomeComplexObject;
import com.betfair.baseline.v2.to.SomeComplexObjectDelegate;

public class ComplexMapOperationResponseObjectDelegateImpl implements ComplexMapOperationResponseObjectDelegate {

	public Map<String, SomeComplexObject> getResponseMap() {

		SomeComplexObjectDelegate delegate1 = new SomeComplexObjectDelegateImpl("delegate1");
		SomeComplexObjectDelegate delegate2 = new SomeComplexObjectDelegateImpl("delegate2");
		SomeComplexObjectDelegate delegate3 = new SomeComplexObjectDelegateImpl("delegate3");

		SomeComplexObject complex1 = new SomeComplexObject(delegate1);
		SomeComplexObject complex2 = new SomeComplexObject(delegate2);
		SomeComplexObject complex3 = new SomeComplexObject(delegate3);

		Map<String , SomeComplexObject> responseMap = new LinkedHashMap<String, SomeComplexObject>();
		responseMap.put("object1", complex1);
		responseMap.put("object2", complex2);
		responseMap.put("object3", complex3);

		return responseMap;

	}

	public void setResponseMap(Map<String, SomeComplexObject> responseMap) {
		// DO Nothing
	}
}


text:
.select2-container .select2-choice {
  height: 30px;
  line-height: 28px;
  border-color: #d9d9d9;
  border-radius: 2px;
  -webkit-box-shadow: none;
  box-shadow: none;
  background: #fff;
}
.select2-container .select2-choice .select2-arrow {
  background-color: transparent;
  background-image: none;
  border-left: none;
}
.select2-container .select2-choice .select2-arrow b {
  background: none;
  position: relative;
}
.select2-container .select2-choice .select2-arrow b:after {
  content: "\f0d7";
  font-family: FontAwesome;
  color: #aaa;
}
.select2-container.select2-container-active .select2-choice {
  border-color: #5897fb;
}
.select2-container.select2-dropdown-open .select2-choice .select2-arrow b:after {
  content: "\f0d8";
}
.select2-container abbr {
  background: transparent;
}
.select2-container abbr:after {
  content: "\f00d";
  font-family: FontAwesome;
  position: absolute;
  top: -7px;
  font-size: 11px;
  color: #aaa;
}
.select2-search {
  position: relative;
  padding: 0 6px;
}
.select2-search:after {
  position: absolute;
  content: "\f002";
  font-family: FontAwesome;
  color: #aaa;
  right: 10px;
  top: 4px;
  width: 18px;
}
.select2-drop.select2-drop-above .select2-search:after {
  top: 8px;
}
.select2-search input {
  border-color: #d9d9d9;
  background: #fff;
}
.select2-results .select2-highlighted {
  background-color: #4cc0c1;
}
.select2-container-multi .select2-choices {
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  padding-top: 2px;
}
.select2-container-multi .select2-choices .select2-search-choice {
  border: 1px solid #d9d9d9;
  background-color: #fff;
  -webkit-box-shadow: none;
  box-shadow: none;
}
.select2-search-choice-close {
  background: transparent;
}
.select2-search-choice-close:after {
  content: "\f00d";
  font-family: FontAwesome;
  font-size: 11px;
  color: #aaa;
  position: absolute;
  left: 2px;
  top: -1px;
}


text:
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib', 'engine')

require 'test/unit'
require 'file_definitions'

class File_definitions < Test::Unit::TestCase

  def setup
  end

  def test_fields_string
    klass = Object.const_set('B', Class.new)

    klass.module_eval do
      include FileDefinitions
      create_field_definition 'a_string'

      create_field_attr_accessors
    end

    x = B.new '33'
    assert_equal '33', x.a_string

  end

  def test_fields_symbols
    klass = Object.const_set('SymClass', Class.new)
    klass.module_eval do
      include FileDefinitions
      create_field_definition [:a_symbol, :b_symbol]

      create_field_attr_accessors
    end

    assert SymClass.new.respond_to? :a_symbol
    assert SymClass.new.respond_to? :b_symbol
  end

  def test_fields_strings
    klass = Object.const_set('A', Class.new)
    klass.module_eval do
      include FileDefinitions
      create_field_definition %w(abc def  ghi jkl)

      create_field_attr_accessors
    end

    x = A.new

    assert_equal %w(abc def ghi jkl), A.field_definition.sort

    A.add_field( 'xyz' )

    line = '1,2,3,4, 5'
    x = A.new(line)

    assert x.respond_to? 'abc'
    assert x.respond_to? 'abc='
    assert x.respond_to? :jkl
    assert_equal x.current_line, line
    assert_equal '1', x.abc
    assert_equal 1.0, x.abc.to_f
    assert_equal 1,   x.abc.to_i
    assert_equal '4', x.jkl
    assert_equal ' 5', x.xyz

  end

  def test_fixed_strings

    klass = Object.const_set('AFixed', Class.new)

    klass.module_eval do
      include FileDefinitions

      create_fixed_definition( 'value' => (0..7), 'date' => (8..15), :ccy => (16..18) )

      create_field_attr_accessors
    end

    assert AFixed.respond_to?('fixed_definition')
    assert AFixed.respond_to?('field_definition')
    assert AFixed.respond_to?('add_field')
    assert AFixed.respond_to?('file_set_field_by_map')
    assert AFixed.respond_to?('split_on')
    assert AFixed.respond_to?('split_on_write')

    x = AFixed.new('0123456719990113EUR')

    assert x.respond_to?('value')
    assert x.respond_to?(:date)
    assert x.respond_to?('ccy')

    assert AFixed.field_definition.include?('ccy')

    assert_equal 3,  AFixed.field_definition.size
    assert_equal 3,  AFixed.fixed_definition.keys.size

    assert_equal %w(ccy date value), AFixed.field_definition.sort

    assert_equal AFixed.field_definition.sort, AFixed.fixed_definition.keys.sort

    assert_instance_of Range, AFixed.fixed_definition.values[0]

    assert_equal x.current_line, '0123456719990113EUR'
    assert_equal x.value, '01234567'
    assert_equal x.date, '19990113'
    assert_equal x.ccy, 'EUR'

    assert x.respond_to?(:parse)

    x.parse('9876543220100630USD')

    assert_equal x.current_line, '9876543220100630USD'
    assert_equal x.value, '98765432'
    assert_equal x.date, '20100630'
    assert_equal x.ccy, 'USD'

  end

  def test_bad_setup
    klass = Object.const_set('ABadClass', Class.new)
    begin
      klass.module_eval do
        include FileDefinitions

        create_fixed_definition( 'abc' )

        create_field_attr_accessors
      end
      flunk # We should never get here
    rescue => e
      assert e
    end
  end
end


text:
---
uid: SolidEdgePart.WeldHole.FromPlane
summary:
remarks: This property works only for those feature objects that are created by the AddFromTo method.
---


text:
package datastructures;

import java.io.*;
/*
1. The union and find operations can be optimized to O(Log n) in worst case.
The idea is to always attach smaller depth tree under the root of the deeper tree.
This technique is called union by rank.
The term rank is preferred instead of height because if path compression technique is used,
then rank is not always equal to height.

The above example with union by rank
Initially all elements are single element subsets.
0 1 2 3

Do Union(0, 1)
   1   2   3
  /
 0

Do Union(1, 2)
   1    3
 /  \
0    2

Do Union(2, 3)
    1
 /  |  \
0   2   3

2. The second optimization to naive method is Path Compression.
The idea is to flatten the tree when find() is called.
When find() is called for an element x, root of the tree is returned.
The find() operation traverses up from x to find root.
The idea of path compression is to make the found root as parent of x
so that we don't have to traverse all intermediate nodes again.
If x is root of a subtree, then path (to root) from all nodes under x also compresses.

Let the subset {0, 1, .. 9} be represented as below and find() is called
for element 3.
              9
         /    |    \
        4     5      6
     /     \        /  \
    0        3     7    8
            /  \
           1    2

When find() is called for 3, we traverse up and find 9 as representative
of this subset. With path compression, we also make 3 as child of 9 so
that when find() is called next time for 1, 2 or 3, the path to root is
reduced.

               9
         /    /  \    \
        4    5    6     3
     /           /  \   /  \
    0           7    8  1   2

The two techniques complement each other.
The time complexity of each operations becomes even smaller than O(Logn).
In fact, amortized time complexity effectively becomes small constant.

Help Links - http://algs4.cs.princeton.edu/15uf/UF.java.html
            http://www.geeksforgeeks.org/union-find-algorithm-set-2-union-by-rank/
*/

public class DisjointSet2 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        while (t-- > 0) {
            String s1[] = br.readLine().split(" ");
            int n = Integer.parseInt(s1[0]);
            int m = Integer.parseInt(s1[1]);
            int parent[] = new int[n + 1];
            int rank[] = new int[n+1];
            for (int i = 0; i < n + 1; i++) {
                parent[i] = i;
            }
            while (m-- > 0) {
                String s2[] = br.readLine().split(" ");
                if (s2[0].equals("F")) {
                    System.out.println(find(parent, Integer.parseInt(s2[1])));
                } else {
                    union(parent, rank, Integer.parseInt(s2[1]), Integer.parseInt(s2[2]));
                }
            }
        }
    }

    public static int find(int parent[], int i) {
        if(parent[i] == i) { // then this is the root node.
            return i;
        } else {
            parent[i] = find(parent, parent[i]); // find representative for each element and update it(path compression)
            return parent[i];
        }
    }

    public static void union(int parent[], int rank[], int x, int y) {
        int xrep = find(parent, x);
        int yrep = find(parent, y);

        if(xrep == yrep)
            return;

        if(rank[xrep] < rank[yrep])
            parent[xrep] = yrep;
        else if(rank[yrep] < rank[xrep])
            parent[yrep] = xrep;
        else {
            parent[yrep] = xrep;
            rank[xrep]++;
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License (MIT)

Copyright (c) 2014 Sebastian Rothbucher

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
	<!--
     Uncomment the following to compile the widgetset for one browser only.
     This can reduce the GWT compilation time significantly when debugging.
     The line should be commented out before deployment to production
     environments.

     Multiple browsers can be specified for GWT 1.7 as a comma separated
     list. The supported user agents at the moment of writing were:
     ie6,ie8,gecko,gecko1_8,safari,opera

     The value gecko1_8 is used for Firefox 3 and later and safari is used for
     webkit based browsers including Google Chrome.
    -->
	<inherits name="com.vaadin.DefaultWidgetSet" />
    <source path="widgetset/client" />
</module>


text:
#region Foreign-License

#endregion
using System;
namespace Tcl.Lang
{

    /// <summary> This class implements the built-in "for" command in Tcl.</summary>

    class ForCmd : ICommand
    {
        /*
        * This procedure is invoked to process the "for" Tcl command.
        * See the user documentation for details on what it does.
        *
        * @param interp the current interpreter.
        * @param argv command arguments.
        * @exception TclException if script causes error.
        */

        public TCL.CompletionCode CmdProc(Interp interp, TclObject[] argv)
        {
            if (argv.Length != 5)
            {
                throw new TclNumArgsException(interp, 1, argv, "start test next command");
            }

            TclObject start = argv[1];

            string test = argv[2].ToString();
            TclObject next = argv[3];
            TclObject command = argv[4];

            bool done = false;
            try
            {
                interp.Eval(start, 0);
            }
            catch (TclException e)
            {
                interp.AddErrorInfo("\n    (\"for\" initial command)");
                throw;
            }

            while (!done)
            {
                if (!interp._expr.EvalBoolean(interp, test))
                {
                    break;
                }

                try
                {
                    interp.Eval(command, 0);
                }
                catch (TclException e)
                {
                    switch (e.GetCompletionCode())
                    {

                        case TCL.CompletionCode.BREAK:
                            done = true;
                            break;

                        case TCL.CompletionCode.CONTINUE:
                            break;

                        case TCL.CompletionCode.ERROR:
                            interp.AddErrorInfo("\n    (\"for\" body line " + interp._errorLine + ")");
                            throw;

                        default:
                            throw;

                    }
                }

                if (!done)
                {
                    try
                    {
                        interp.Eval(next, 0);
                    }
                    catch (TclException e)
                    {
                        switch (e.GetCompletionCode())
                        {

                            case TCL.CompletionCode.BREAK:
                                done = true;
                                break;

                            case TCL.CompletionCode.CONTINUE:
                                break;

                            default:
                                interp.AddErrorInfo("\n    (\"for\" loop-end command)");
                                throw;

                        }
                    }
                }
            }

            interp.ResetResult();
            return TCL.CompletionCode.RETURN;
        }
    }
}