text:
namespace pmr = std::experimental::fundamentals_v2::pmr;

namespace experimental
{
    template <typename StatisticsHandler>
    class MemoryResourceStatistics : public pmr::memory_resource
    {
    public:
        explicit MemoryResourceStatistics(StatisticsHandler& iStatisticsHandler, pmr::memory_resource* iDefaultResource = pmr::get_default_resource());

    protected:
        void* do_allocate(std::size_t iBytes, std::size_t iAlignment) override;
        void do_deallocate(void* iPointer, std::size_t iBytes, std::size_t iAlignment) override;
        bool do_is_equal(const pmr::memory_resource& iMemoryResourceStatistics) const noexcept override;

    private:
        StatisticsHandler& m_StatisticsHandler;
        pmr::memory_resource* m_DefaultResource;
    };
}

#include <allocators/memory_resource_statistics.hxx>


text:
package org.scalamock.handlers

import org.scalamock.context.Call

private[scalamock] class UnorderedHandlers extends Handlers {

  def handle(call: Call): Option[Any] = this.synchronized {
    for (handler <- handlers) {
      val r = handler.handle(call)
      if (r.isDefined)
        return r
    }
    None
  }

  def verify(call: Call): Boolean = this.synchronized {
    for (handler <- handlers) {
      if (handler.verify(call))
        return true
    }
    false
  }

  protected val prefix = "inAnyOrder"
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

var Log = function () {
  this._console = console;
  this._muted = false;
};

Log.prototype.log = function (str) {
  if (!this._muted) {
    this._console.log((new Date()) + ': ' + str);
  }
};

Log.prototype.mute = function (muted) {
  if (typeof muted === 'undefined') {
    muted = true;
  }
  this._muted = muted;
};

module.exports = new Log();


text:
import Ember from 'ember';
import layout from '../templates/components/ons-page';

const { Component, get, K } = Ember;

export default Component.extend({
  layout,
  tagName: 'ons-page',
  attributeBindings: ['modifier'],

  didInsertElement() {
    this._super(...arguments);
    let el = get(this, 'element');
    el.onInfiniteScroll = get(this, 'onInfiniteScroll') || K;
    el.onDeviceBackButton = get(this, 'onDeviceBackButton') || K;
  },

  willRemoveElement() {
    this._super(...arguments);
    let el = get(this, 'element');
    el.onInfiniteScroll = K;
    el.onDeviceBackButton = K;
  }
});


text:
module Emails
  module PagesDomains
    def pages_domain_enabled_email(domain, recipient)
      @domain = domain
      @project = domain.project

      mail(
        to: recipient.notification_email,
        subject: subject("GitLab Pages domain '#{domain.domain}' has been enabled")
      )
    end

    def pages_domain_disabled_email(domain, recipient)
      @domain = domain
      @project = domain.project

      mail(
        to: recipient.notification_email,
        subject: subject("GitLab Pages domain '#{domain.domain}' has been disabled")
      )
    end

    def pages_domain_verification_succeeded_email(domain, recipient)
      @domain = domain
      @project = domain.project

      mail(
        to: recipient.notification_email,
        subject: subject("Verification succeeded for GitLab Pages domain '#{domain.domain}'")
      )
    end

    def pages_domain_verification_failed_email(domain, recipient)
      @domain = domain
      @project = domain.project

      mail(
        to: recipient.notification_email,
        subject: subject("ACTION REQUIRED: Verification failed for GitLab Pages domain '#{domain.domain}'")
      )
    end
  end
end


text:
module Swaggard
  module Swagger
    class Tag
      attr_accessor :name, :description

      attr_reader :controller_class, :controller_name, :route

      def initialize(yard_object, tag)
        controller_name = "#{yard_object.namespace}::#{yard_object.name}"

        @yard_name = yard_object.name
        @controller_class = controller_name.constantize
        @controller_name = controller_class.controller_path

        @name =  tag ? tag.text : "#{@controller_class.controller_path}"
        @name, @route = @name.split(' ')

        @description = yard_object.docstring || ''
      end

      def to_doc
        {
          'name'        => @name,
          'description' => @description
        }
      end
    end
  end
end


text:
layout: default
title: <Fill in Title>
categories: docs
parent: Docs
nav_order: 4
published: false
---

<!--- Remove published when the page is ready  --->

# Title

stuff here

## More Detail

## Examples


text:
package com.example.butterknife.functional;

import android.content.Context;
import android.view.View;
import androidx.test.InstrumentationRegistry;
import butterknife.BindBool;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import com.example.butterknife.test.R;
import org.junit.Test;

import static com.google.common.truth.Truth.assertThat;

public final class BindBoolTest {
  private final Context context = InstrumentationRegistry.getContext();
  private final View tree = ViewTree.create(1);

  static class Target {
    @BindBool(R.bool.just_true) boolean actual;
  }

  @Test public void asBoolean() {
    Target target = new Target();
    boolean expected = context.getResources().getBoolean(R.bool.just_true);

    Unbinder unbinder = ButterKnife.bind(target, tree);
    assertThat(target.actual).isEqualTo(expected);

    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
  }
}


text:
/**
 * Install CSS, Furasta.Org
 *
 * Contains all the style information for the installer.
 *
 * @todo       this is a direct copy of _inc/css/admin.css
 *             should remove un-nessecary code from here
 *
 * @author     Conor Mac Aoidh <conormacaoidh@gmail.com>
 * @license    http://furasta.org/licence.txt The BSD License
 * @version    1.0
 */

*{ margin:0;padding:0;font:14px Myriad Pro,Arial,San Serif;color:#333 }
ul,ol{ margin-left:40px }
.left{ float:left }
.right{ float:right }
.both{ clear:both }
.link{ cursor:pointer }
a{ color:blue;text-decoration:underline }
a img{ border:none }

/* table style */

table{ width:100%;border-spacing:0;margin-top:15px }
table tr td{ padding:6px }
table tr td.first{ min-width:30% }
table tr th{ height:30px;text-align:left;padding:2px 6px;color:#fff;font-size:13px;background:url(../_inc/img/th.png) repeat-x !important }
.even{ background:#ded }
.odd{ background:#fff }
.half-table{ width:50% }

/* admin template style */

body{ text-align:center;background:#eee }
#dialog{ display:none }
#wrapper{ width:100% }
#top{ height:80px;background: url("../_inc/img/top-bg.png") repeat-x #20B220 }
#top-wrapper{ width:95%;margin:0 auto }
#top #title{ margin:24px 0 0 3px;float:left;font-family:'Times New Roman' }
#top #title a{ font-size:22px;color:#eee }
#title #subtitle{ font-size:12px;float:left;color:#eee;font-style:italic }
#system-error{ margin:0 auto 15px;text-align:left;padding:5px;width:50%;border:1px solid #900;color:#900;background:#ffc }
#system-error img{ width:30px;height:30px }
#system-error .runtime-errors{ font-weight:bold;font-size:14px;color:#a33 }
#top #right{ width:100%;height:80px;margin:0 auto;background:url(../_inc/img/top-right.png) no-repeat right }
#top #right-error{ width:95%;height:80px;margin:0 auto;background:url(../_inc/img/top-right.png) no-repeat right }
#header{ background:#2a2a2a url(../_inc/img/header.png) no-repeat right;border:1px solid transparent;height:40px }
#header #logout{ float:right;background:url(../_inc/img/logout.png) no-repeat;width:29px;height:29px;margin-top:4px }
#header #menu{ color:#fff;font-size:16px;margin:0 auto;text-align:left;width:95%;border:1px solid transparent }
#container{ width:99%;background:#fff url(../_inc/img/bg-left.png) repeat-y left;margin:0 auto }
#container #container-right{ background:url(../_inc/img/bg-right.png) repeat-y right;border-top:1px solid transparent;border-bottom:1px solid transparent }
#main{ text-align:left;margin:25px auto;width:94%;border-top:1px solid transparent }
#footer{ text-align:left;height:27px;width:100%;background:#fff url(../_inc/img/footer-mid.png) repeat-x bottom }
#bottom{ width:95%;margin:-11px auto 0 auto;text-align:left;color:#050;font-size:13px }
#bottom a{ color:#050;font-size:13px }
#bottom p{ color:#050;font-size:13px }

.small{ font-size:13px;font-style:italic }
.checkbox{ width:20px;margin:0 10px }
.grey-link{ text-decoration:none;padding:4px 10px;background:#ccc;color:#fff;font-size:20px }
.grey-submit{ text-decoration:none;background:#eee;color:#333;border:1px solid #666;font-weight:normal;padding:4px 25px }
.php-error, #form-error{ color:red }
.input{ width:230px;padding:3px 8px;border:1px solid #666;color:#444 }
.red{ color:red }
.green { color:green }
.top_bar{ height:30px;background:url(../_inc/img/top_bar.png) repeat-x }
.list-link{ display:inline-block;text-decoration:none;color:#333 }
.image-left{ display:inline;margin-left:8px;font-size:23px }
.error{ border:1px solid #600;background:#f99 }
.help{ width:18px;height:18px;display:inline-block;background:url( ../_inc/img/icons.png ) no-repeat -46px -155px }

/* page contents */

h1{ color:#050;font-size:26px }
h2{ color:#050;font-size:18px;margin:0.5% }
h3{ color:#050;font-size:16px }
p{ margin:.5% }
a{ text-decoration:none }
b, strong{ font-weight:bold }
i, em{ font-style:italic }

#install-center{ text-align:center;width:65%;margin:0pt auto }

.header-img{ width:29px;height:29px;float:left }
#header-Login{ background: url( ../_inc/img/icons.png ) no-repeat -1px -53px }
#header-New-Page{ background: url( ../_inc/img/icons.png ) no-repeat -1px -87px }
#header-Edit-Pages{ background: url( ../_inc/img/icons.png ) no-repeat -65px -87px }
#header-Trash{ background: url( ../_inc/img/icons.png ) no-repeat -165px -92px }
#header-Users{ background: url( ../_inc/img/icons.png ) no-repeat -130px -56px }
#header-New-User{ background: url( ../_inc/img/icons.png ) no-repeat -30px -87px }
#header-Groups{ background: url( ../_inc/img/icons.png ) no-repeat -96px -56px }
#header-New-Group{ background: url( ../_inc/img/icons.png ) no-repeat -165px -56px }
#header-Configuration{ background: url( ../_inc/img/icons.png ) no-repeat -65px -56px }
#header-Template{ background: url( ../_inc/img/icons.png ) no-repeat -131px -92px }
#header-Plugins{ background: url( ../_inc/img/icons.png ) no-repeat -99px -92px }
#header-Auto-Update{ background: url( ../_inc/img/icons.png ) no-repeat -35px -124px }
#header-Manual-Update{ background: url( ../_inc/img/icons.png ) no-repeat -30px -100px }
#header-Add{ background: url( ../_inc/img/icons.png ) no-repeat -35px -53px }
#delete-img{ background: url( ../_inc/img/icons.png ) no-repeat -24px -156px }
.delete-small-img{ background:url(../_inc/img/icons.png) no-repeat -90px -184px;width:10px;height:10px;background-position:bottom }
/* menu styles */

#header #menu ul{ list-style-type:none;margin-top:16px;margin-left:0px }
#header #menu ul li a{ color:#fff;text-decoration:none;padding:8px 9px }
#header #menu ul li a:hover{ background:#666 }
#header #menu ul li a.parent-hover{ background:#666 }
#header #menu ul li a#title{ background:url(../_inc/img/icons.png) no-repeat -64px -151px;padding:6px 12px;margin-right:8px }
#header #menu ul li a#logout{ background:url(../_inc/img/icons.png) no-repeat -90px -149px;float:right;padding:0;margin-top:-9px }
#header #menu ul li a.current{ background:#fff;color:#000;border-top:6px solid #1a1 }
#header #menu ul li{ float:left }
#header #menu ul > li ul{ display:none;list-style:none;position:absolute;margin:6px 0 0 -1px;z-index:90;background:#fff;border-bottom:1px solid #000;border-left:1px solid #000;border-right:1px solid #000 }
#header #menu ul > li ul li{ float:none }
#header #menu ul > li ul li a:hover{ background:#ded }
#header #menu ul > li ul li a.parent-hover{ background:#ded }
#header #menu ul > li ul a{ display:block;width:152px;color:#000;padding:6px 8px }
#header #menu ul > li ul li ul{ margin:-35px 0 0 170px;position: absolute;border-top:1px solid #000 }
#header #menu ul p{ padding:0;margin-left:5px }
.admin-menu-img{ width:18px;height:18px;float:left;margin-right:10px }

#right-item{ float:right!important }

#menu_edit_pages-img{ background:url(../_inc/img/icons.png) no-repeat -140px -156px  }
#menu_new_page-img{ background:url(../_inc/img/icons.png) no-repeat -119px -155px }
#menu_trash-img{ background:url(../_inc/img/icons.png) no-repeat -1px -178px }
#menu_edit_users-img{ background:url(../_inc/img/icons.png) no-repeat -44px -178px }
#menu_edit_groups-img{ background:url(../_inc/img/icons.png) no-repeat -68px -178px }
#menu_configuration-img{ background:url(../_inc/img/icons.png) no-repeat -2px -156px }
#menu_template-img{ background:url(../_inc/img/icons.png) no-repeat -181px -156px }
#menu_plugins-img{ background:url(../_inc/img/icons.png) no-repeat -161px -156px }
#menu_update-img{ background:url(../_inc/img/icons.png) no-repeat -22px -178px }

/* login form */

#login-wrapper{ text-align:center;width:50%;margin:0 auto }
#login-header{ font-size:23px;text-align:left;margin-left:35px }
#login-table{ margin-top:0 }

/* Admin Area Overview */

.sort-container{ border-top:1px solid transparent;margin:0;padding:0;list-style-type:none;margin:0 1%;width:47.5% }
.sort-container .overview-preview{ margin:7px 1.25% }
.sort-container .overview-preview .collapse-content{ border-style:solid;border-color:#999;border-width:0 1px 1px 1px }
.overview-preview table{ margin-top:0  }
.overview-preview p.th{ padding:0 6px;cursor:move }
.overview-preview p a{ color:#fff;font-size:13px;padding:8px 4px 0 0;cursor:pointer;float:right }
.overview-preview table td span{ float:right;font-style:italic;font-size:12px }
.overview-preview table td p{ font-size:13px }
.ui-draggable-dragging{ opacity: .7;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";filter:alpha(opacity=70)  }
#drag-container{ width:600px;height:300px;border:1px solid #000 }
.ui-state-highlight{ height:100px;background:#ddeedd;border:1px dashed #aaa }
.column{ width: 170px; float: left; padding-bottom: 100px; }
.th{ margin:0;height:30px;text-align:left;color:#fff;font-size:13px;background:url(../_inc/img/th.png) repeat-x;border-width:1px 1px 0 1px;border-style:solid;border-color:#666 }
p.th span{ float:left;color:#fff;font-size:13px;padding:8px 0 0 4px }
.closed, .hidden{ display:none }

/* Admin Area Pages */

table tr td.half{ width:50% }
table tr td.small{ width:5% }
table tr td.medium{ width:12%;font-size:14px;font-style:italic }
table tr td.options{ width:14% }
table tr td.options-show{ background:#eee }
table tr td#slug-url a{ color:#050;font-style:italic }
table#add-user{ width:60%;text-align:left;margin:0 auto }
table#perm{ width:50%;text-align:left;margin:0 auto }
#pages{ margin-top:0; background: #89a }
#options-bar-left{ height: 26px; border-top: 1px solid transparent;margin-bottom:8px }
#options-bar-left a:focus{ outline:none }
#list-pages-dropbox{ display:none;position:absolute }

.pages-table-left{ padding:6px 15px 6px 6px;width:25px }
#pages tr td .expander{ background-position:left center;background-repeat:no-repeat;cursor:pointer;padding:6px 19px 4px 0!important;zoom:1 }
#pages tr.collapsed td .expander{ background-image:url(../_i../_inc/img/toggle-expand-dark.png) }
#pages tr.expanded td .expander{ background-image:url(../_i../_inc/img/toggle-collapse-dark.png) }
#pages tr.selected, .treeTable tr.accept{ background-color:#3875d7;color:#fff }

.holder{ background: #89a; height:4px }
.hovered{ background: #89a  }
.ui-sortable-helper{ opacity:0.6;filter:alpha(opacity=60); }

select{ border:1px solid #666;padding:3px;width:100% }
textarea{ border:1px solid #666; padding: 3px; width:100%; overflow-y: scroll }
input{ border:1px solid #666;padding:3px;width:100% }
input.checkbox{ width:auto }
.green{ color:green }
.trash-select{ width:160px }
.submit{ width:auto; padding: 3px 14px }
#edit-delete{ float:right;margin-top:10px }
#edit-save{ margin-top:10px }

#options{ padding:.5%;border:1px solid #666;width:99%;margin:5px 0 14px;display:none }
#options h2{ padding:5px;margin-top:5px }
#options table{ margin-top:2px };
#options table tr td.border-left{ margin-left:5%;border-left:1px solid #666 }
#options-link{ display:block;padding:3px;cursor:pointer }
#options-link:active,#options-link:focus{ outline:0 }

ul#pages{ list-style-type:none;margin-top:0 }
ul#pages li{ width:100%;padding:0 5px }
ul#pages li.top_bar{ color:#fff }
ul#pages li span{ padding:0 10px }

/* Admin Area Files */
#directory-list{ list-style-type:none }
#directory-list li{ float:left;margin:10px }

/* Admin Area Settings */

#config-table{ border-width:1px 1px 1px 0;border-color:#999;border-style:solid;padding:0;width:80%;margin:25px 10%;border-spacing:0 }
#config-table > td{ border-left:1px solid #999;padding:7px 9px }
#perms-table{ border:1px solid #999;padding:0;width:95%;margin:10px 2.5% }
#perms-table tr{ border-bottom: 1px solid #999 }
.opacity{ opacity: 0.6; filter: alpha( opacity=60 ); }
#template{ list-style-type:none }
#template li{ padding: 0;margin-top:10px;display:inline-block;vertical-align:top }
.template-selectable{ width:314px;border-color:#999;border-style:solid;border-width:0 1px 1px 1px;margin-left:20px }
.temp-cont{ margin:0 6px 6px }
#temp-screenshot{ border:1px solid #999;margin-top:5px }
#temp-screenshot p{ margin:3px;font-style:italic }
p.th span.status{ float:right;margin-right:5px }
.activated{ background:#ded }

/* Prompt */

#dialog-logo{ background:url(../_inc/img/logo.png) no-repeat;height:50px }
#dialog-content{ float:left;margin-left:70px;margin-top:5px }
#dialog-alert-logo{ background:url(../_inc/img/icons.png) no-repeat 0 0;width:50px;height:50px }
#dialog-help-logo{ background:url(../_inc/img/icons.png) no-repeat -98px 0;width:50px;height:50px }
#dialog-confirm-logo{ background:url(../_inc/img/icons.png) no-repeat -49px 0;width:49px;height:50px }
.ui-dialog{ position:relative;padding:.2em;top:-301px }
.ui-dialog .ui-dialog-titlebar{ padding:2px 6px;position:relative;height:25px;color:#fff }
.ui-dialog .ui-dialog-title{ float:left;margin:4px;color:#fff }
.ui-dialog .ui-dialog-titlebar-close{ float:right;margin:6px 0 0 0 }
.ui-dialog .ui-dialog-titlebar-close span{ display:block;margin:1px }
.ui-dialog .ui-dialog-content{ border:0;padding:.5em 1em;background:none;overflow:auto;zoom:1;text-align:left }
.ui-dialog .ui-dialog-buttonpane{ text-align:left;border-width:1px 0 0 0;background-image:none;margin:5px 0 0;padding:5px 0 6px 4px;height:25px }
.ui-dialog .ui-dialog-buttonpane button{ background:#333;float:right;margin:1.5px 3px 0 0;cursor:pointer;padding:3px 4px 2px;line-height:1.4em;width:auto;overflow:visible;border:1px solid #666 }
.ui-dialog .ui-dialog-buttonpane button span{ color:#fff }
.ui-draggable .ui-dialog-titlebar { cursor:move }
.ui-widget-content .ui-icon-closethick{ background:url(../_inc/img/icons.png) no-repeat -90px -184px;width:10px;height:10px; margin:5px;text-indent:-10000px }
.ui-widget-overlay{  opacity: .4;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);background:#333;left:0;top:0;height:100%;width:100%;position:absolute }
.ui-widget-content { border: 1px solid #cccccc; background: #f9f9f9; color: #222222; }
.ui-widget-header { background:#333333 url(../_inc/img/th.png) repeat-x;font-weight:bold;color:#fff }

#fdialog table{ border-width:1px 1px 1px 0;border-color:#999;border-style:solid;padding:0;border-spacing:0 }
#fdialog table td{ border-left:1px solid #999;padding:7px 9px }

.x-img{ background:url(../_inc/img/icons.png) no-repeat -90px -184px;width:10px;height:10px }

/* Tabs */

#tabs{ margin:20px 0 0 }
.ui-tabs-nav{ list-style-type:none;margin-left:0;height:30px }
.ui-tabs-nav li{ float:left;margin-top:8px }
.ui-tabs-nav li a{ color:#fff;padding:6px 10px }
.ui-tabs-nav li a:active,.ui-tabs-nav li a:focus{ outline:0 }
.ui-tabs-nav li a:hover{ background:#666 }
.ui-tabs .ui-tabs-hide{ display:none }
li.ui-tabs-selected a{ color:#000;background:#fff;border-top:4px solid #11AA11 }
li.ui-tabs-selected a:hover{ background:#fff }
#tabs .ui-widget-content{ border-top:none }
#tabs #tabs-content, #tabs .tabs-content{ margin:1.5% 1%; width: 98% }

/* Progressbar */
#progress{ margin:20px 30px 0 0 }
#progress .ui-widget-content{ }
#progress .ui-progressbar-value{ background:url(../_inc/img/progress.png) repeat-x #F6A828;height:25px }

/* Installer Specific */
#show-hide{ color:#fff }
.hide-row{ display:none }


text:
// .NAME vtkImageWrapPad - Makes an image larger by wrapping existing data.
// .SECTION Description
// vtkImageWrapPad performs a modulo operation on the output pixel index
// to determine the source input index.  The new image extent of the
// output has to be specified.  Input has to be the same scalar type as
// output.

#ifndef vtkImageWrapPad_h
#define vtkImageWrapPad_h

#include "vtkImagingCoreModule.h" // For export macro
#include "vtkImagePadFilter.h"

class vtkInformation;
class vtkInformationVector;

class VTKIMAGINGCORE_EXPORT vtkImageWrapPad : public vtkImagePadFilter
{
public:
  static vtkImageWrapPad *New();
  vtkTypeMacro(vtkImageWrapPad,vtkImagePadFilter);

protected:
  vtkImageWrapPad() {}
  ~vtkImageWrapPad() {}

  void ComputeInputUpdateExtent (int inExt[6], int outExt[6], int wExt[6]);
  void ThreadedRequestData (vtkInformation* request,
                            vtkInformationVector** inputVector,
                            vtkInformationVector* outputVector,
                            vtkImageData ***inData, vtkImageData **outData,
                            int ext[6], int id);
private:
  vtkImageWrapPad(const vtkImageWrapPad&);  // Not implemented.
  void operator=(const vtkImageWrapPad&);  // Not implemented.
};

#endif

// VTK-HeaderTest-Exclude: vtkImageWrapPad.h


text:
package org.apache.servicecomb.demo.springmvc.server;

import javax.ws.rs.core.MediaType;

import org.apache.servicecomb.demo.controller.Person;
import org.apache.servicecomb.provider.rest.common.RestSchema;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiParam;

@RestSchema(schemaId = "annotations")
@RequestMapping(path = "/springmvc/annotations", produces = MediaType.APPLICATION_JSON)
public class AnnotationsTest {
  @GetMapping(path = "/add")
  public int add(@RequestParam(name = "a", defaultValue = "10") int a,
      @RequestParam(name = "b", defaultValue = "10") int b) {
    return a + b;
  }

  @RequestMapping(path = "/sayhei", method = RequestMethod.GET)
  public String sayHei(@RequestHeader(name = "name", defaultValue = "test") String name) {
    return "hei " + name;
  }

  @GetMapping(path = "/sayhi")
  @ApiImplicitParams({
      @ApiImplicitParam(name = "name", paramType = "query", dataType = "string", defaultValue = "test"),
      @ApiImplicitParam(name = "age", paramType = "query", dataType = "integer", defaultValue = "20")
  })
  public String sayHi(String name, int age) {
    return "hi " + name + " your age is : " + age;
  }

  @RequestMapping(path = "/saysomething", method = RequestMethod.POST)
  public String saySomething(String prefix, @RequestBody(required = false) @ApiParam(required = false) Person user) {
    if (user == null || user.getName() == null || user.getName().isEmpty()) {
      return "No user data found";
    }
    return prefix + " " + user.getName();
  }

  @RequestMapping(path = "/say", method = RequestMethod.POST)
  public String say(@RequestBody(required = false) String user) {
    if (user == null || user.isEmpty()) {
      return "No user name found";
    }
    return user;
  }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Tornado Chat Demo</title>
    <link rel="stylesheet" href="{{ static_url("chat.css") }}" type="text/css">

        {% for message in messages %}
          {% include "message.html" %}
        {% end %}

        <form action="/a/message/new" method="post" id="messageform">

              <input type="text" name="body" id="message" style="width:500px">

                <input type="submit" value="{{ _("Post") }}">
                <input type="hidden" name="next" value="{{ request.path }}">
                {% module xsrf_form_html() %}

        </form>


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ifree.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="15"/>

    <application
        android:allowBackup="true"
        android:label="@string/app_name" >
        <activity
            android:name="com.ifree.test.TestActivity"
            android:label="@string/title_activity_test" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
from __future__ import absolute_import, division, print_function

import json
import os.path as op

import six
import numpy as np
import scipy.signal as sig
import scipy.io.wavfile as sciwav

MAXINT16 = 2**15 - 1
FS = 44100
COEFF_DIR = op.join(op.dirname(op.abspath(__file__)), 'coeffs')

def normalize(data, maxamp=1):
    data *= maxamp / max(abs(data))

def load_coeffs(fname):
    with open(op.join(COEFF_DIR, fname)) as f:
        return json.load(f)

POTS_COEFFS = load_coeffs('pots.json')

def pots(data, snr=30, seed=None):
    if seed is not None:
        np.random.seed(seed)

    # ensure mono
    if data.ndim != 1:
        data = data[:,0]

    # convert to float, but simulate 16-bit quantization if needed
    orig_dtype = data.dtype
    data = data.astype('float')
    if orig_dtype != 'int16':
        normalize(data, maxamp=MAXINT16)
        np.around(data, out=data)
    normalize(data)

    # pad start and end
    #leader_len = np.random.randint(0.1 * FS, 0.4 * FS)
    #trailer_len = 0.5 * FS - leader_len
    #data = np.concatenate([np.zeros(leader_len), data, np.zeros(trailer_len)])

    # do filtering
    for b, a in POTS_COEFFS['signal']:
        data = sig.lfilter(b, a, data)

    # add band-limited noise (filtered white noise)
    #np.random.seed(0)
    noise = 10**(-snr/20) * ((np.random.random(size=data.shape) * 2) - 1)
    for b, a in POTS_COEFFS['noiseband']:
        noise = sig.lfilter(b, a, noise)
    data += noise

    # renormalize and convert to 16-bit integers
    normalize(data, maxamp=MAXINT16)
    data = data.astype('int16')

    return data

class DigitalStreamFilter(object):
    mimes = {
        'wav': 'audio/vnd.wave',
        'txt': 'text/plain',
        'json': 'application/json',
    }
    output_suffix = 'filtered'

    def __init__(self, data=None, stream=None, filename=None, dtype=None):
        if dtype is None and filename is None:
            try:
                # werkzeug.FileStorage has 'filename', python files have 'name'
                filename = getattr(stream, 'filename', getattr(stream, 'name'))
            except AttributeError:
                raise ValueError("Can't determine type from stream. "
                        "Provide dtype or filename to infer type.")

        if dtype is None:
            dtype = filename.split('.')[-1]

        self.dtype = dtype
        self.filename = filename
        self.json_extra = {}

        if data is not None:
            self.data = np.array(data)
        elif stream is not None:
            self.load(stream)
        else:
            with open(filename, 'rb') as stream:
                self.load(stream)

    def load(self, stream):
        dispatcher = {
            'wav': self._load_wave,
            'txt': self._load_text,
            'json': self._load_json,
        }
        try:
            data = dispatcher[self.dtype](stream)
        except KeyError:
            raise TypeError('Unsupported input type: {} (accepts {})'.format(
                            self.dtype, ', '.join(dispatcher.keys())))

        self.data = np.array(data)

    def process(self, *args, **kwargs):
        raise NotImplementedError('abstract method')

    def dump(self, stream, dtype=None):
        if dtype is None:
            dtype = self.dtype

        {'wav': self._dump_wave,
         'txt': self._dump_text,
         'json': self._dump_json,
        }[dtype](stream)

    def suggested_name(self):
        parts = self.filename.split('.')[:-1]
        parts.extend([self.output_suffix, self.dtype])
        return '.'.join(parts)

    def mimetype(self):
        return self.mimes[self.dtype]

    def _load_wave(self, stream):
        rate, data = sciwav.read(stream)
        return data

    def _load_text(self, stream):
        return np.loadtxt(stream, dtype='int16')

    def _load_json(self, stream):
        return np.array(json.load(stream))

    def _dump_wave(self, stream):
        sciwav.write(stream, FS, self.data)

    def _dump_text(self, stream):
        np.savetxt(stream, self.data, fmt='%d')

    def _dump_json(self, stream):
        json.dump({'data': self.data.tolist(), 'rate': FS}, stream)

class POTSFilter(DigitalStreamFilter):
    output_suffix = 'pots-filtered'

    def process(self, *args, **kwargs):
        self.data = pots(self.data, *args, **kwargs)


text:
package org.keycloak.testsuite.webauthn.registration;

import org.hamcrest.Matchers;
import org.junit.Test;
import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.testsuite.webauthn.AbstractWebAuthnVirtualTest;
import org.keycloak.testsuite.webauthn.pages.WebAuthnAuthenticatorsList;
import org.keycloak.testsuite.webauthn.updaters.AbstractWebAuthnRealmUpdater;
import org.keycloak.testsuite.webauthn.utils.WebAuthnRealmData;
import org.keycloak.utils.StringUtil;

import java.io.Closeable;
import java.io.IOException;
import java.util.function.Consumer;
import java.util.function.Function;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Verify JS attack in WebAuthn Policy
 *
 * @author Martin Bartos
 */
public class PolicyJsInjectionTest extends AbstractWebAuthnVirtualTest {
    // If there's an unexpected alert, the test fails -> we verified here that the script is not executed
    protected final String PROMPT_SCRIPT = "required\"; window.prompt('Injection'); \" ";

    // The page is redirect, if the script is executed
    protected final String REDIRECT_SCRIPT = "required\"; window.location.href = \"http://www.keycloak.org\";\"";

    @Test
    public void relyingPartyEntityName() {
        verifyInjection((updater) -> updater.setWebAuthnPolicyRpEntityName(REDIRECT_SCRIPT),
                WebAuthnRealmData::getRpEntityName,
                REDIRECT_SCRIPT);
    }

    @Test
    public void relyingPartyId() throws IOException {
        try (Closeable u = getWebAuthnRealmUpdater()
                .setWebAuthnPolicyRpId(PROMPT_SCRIPT)
                .update()) {

            WebAuthnRealmData data = new WebAuthnRealmData(testRealm().toRepresentation(), isPasswordless());
            assertThat(data.getRpId(), is(PROMPT_SCRIPT));

            registerDefaultUser(false);

            webAuthnErrorPage.assertCurrent();

            final String expectedMessage = getExpectedMessageByDriver(
                    "SecurityError: The operation is insecure.",
                    "The relying party ID is not a registrable domain suffix of, nor equal to the current domain.");

            assertThat(webAuthnErrorPage.getError(), containsString(expectedMessage));
        }
    }

    @Test
    public void attestationConveyancePreference() {
        final String expectedMessage = getExpectedMessageByDriver(
                "(value of 'attestation' member of PublicKeyCredentialCreationOptions) is not a valid value for enumeration AttestationConveyancePreference.",
                "The provided value 'required\"; window.location.href = \"http://www.keycloak.org\";\"' is not a valid enum value of type AttestationConveyancePreference.");

        verifyInjection((updater) -> updater.setWebAuthnPolicyAttestationConveyancePreference(REDIRECT_SCRIPT),
                WebAuthnRealmData::getAttestationConveyancePreference,
                REDIRECT_SCRIPT,
                expectedMessage);
    }

    @Test
    public void authenticatorAttachment() {
        final String expectedMessage = getExpectedMessageByDriver(
                "(value of 'authenticatorAttachment' member of AuthenticatorSelectionCriteria) is not a valid value for enumeration AuthenticatorAttachment.",
                "The provided value 'required\"; window.location.href = \"http://www.keycloak.org\";\"' is not a valid enum value of type AuthenticatorAttachment.");

        verifyInjection((updater) -> updater.setWebAuthnPolicyAuthenticatorAttachment(REDIRECT_SCRIPT),
                WebAuthnRealmData::getAuthenticatorAttachment,
                REDIRECT_SCRIPT,
                expectedMessage);
    }

    @Test
    public void requireResidentKey() {
        // requireResidentKey is set to 'false' and the value is ignored -> success
        verifyInjection((updater) -> updater.setWebAuthnPolicyRequireResidentKey(PROMPT_SCRIPT),
                WebAuthnRealmData::getRequireResidentKey,
                PROMPT_SCRIPT);
    }

    @Test
    public void userVerificationRequirement() {
        String expectedMessage = getExpectedMessageByDriver(
                "(value of 'userVerification' member of AuthenticatorSelectionCriteria) is not a valid value for enumeration UserVerificationRequirement.",
                "The provided value 'required\"; window.prompt('Injection'); \" ' is not a valid enum value of type UserVerificationRequirement.");

        verifyInjection((updater) -> updater.setWebAuthnPolicyUserVerificationRequirement(PROMPT_SCRIPT),
                WebAuthnRealmData::getUserVerificationRequirement,
                PROMPT_SCRIPT,
                expectedMessage);
    }

    @Test
    public void injectUserLabel() {
        final String originalLabel = "label'`;window.prompt(\"another\");'";

        registerDefaultUser(originalLabel);

        appPage.assertCurrent();

        final CredentialRepresentation credential = userResource().credentials()
                .stream()
                .filter(f -> f.getType().equals(getCredentialType()))
                .findFirst()
                .orElse(null);

        assertThat(credential, notNullValue());
        assertThat(credential.getUserLabel(), is(originalLabel));

        if (!isPasswordless()) {
            logout();

            loginPage.open();
            loginPage.assertCurrent(TEST_REALM_NAME);
            loginPage.login(USERNAME, PASSWORD);

            webAuthnLoginPage.assertCurrent();
            WebAuthnAuthenticatorsList authenticators = webAuthnLoginPage.getAuthenticators();
            assertThat(authenticators, notNullValue());
            assertThat(authenticators.getItems(), not(Matchers.empty()));

            assertThat(authenticators.getLabels().get(0), is("label`;window.prompt(\"another\");"));
        }
    }

    private void verifyInjection(Consumer<AbstractWebAuthnRealmUpdater<?>> realmSetter, Function<WebAuthnRealmData, String> realmGetter, String requiredValue) {
        verifyInjection(realmSetter, realmGetter, requiredValue, "");
    }

    /**
     * Verify the possibility of executing the JS injection in WebAuthn Policy settings
     *
     * @param realmSetter   set Realm WebAuthn policy
     * @param realmGetter   get Realm WebAuthn policy
     * @param expectedValue expected value save in realm
     * @param errorMessage  expected message if it's present
     */
    private void verifyInjection(Consumer<AbstractWebAuthnRealmUpdater<?>> realmSetter, Function<WebAuthnRealmData, String> realmGetter, String expectedValue, String errorMessage) {
        AbstractWebAuthnRealmUpdater<?> updater = getWebAuthnRealmUpdater();
        realmSetter.accept(updater);

        try (Closeable u = updater.update()) {

            WebAuthnRealmData data = new WebAuthnRealmData(testRealm().toRepresentation(), isPasswordless());
            assertThat(realmGetter.apply(data), is(expectedValue));

            boolean shouldSuccess = StringUtil.isBlank(errorMessage);

            registerDefaultUser(shouldSuccess);

            if (shouldSuccess) {
                appPage.assertCurrent();
            } else {
                webAuthnErrorPage.assertCurrent();
                assertThat(webAuthnErrorPage.getError(), containsString(errorMessage));
            }
        } catch (IOException e) {
            throw new RuntimeException("Cannot verify test scenarios for WebAuthn Policy JS Injection", e);
        }
    }
}


text:
angular.module('myApp').directive('editPost', function ($location, $cookieStore, Post) {
    return {

        restrict: 'E',
        scope: {
            data: '='
        },
        templateUrl: 'modules/posts/views/editPost.html',
        link: function (scope, elem, attrs) {

            scope.update = function (data, textNow) {
                var dataOld = data.text;
                var id = data.id;

                var text;
                if (textNow) {
                    text = textNow;
                } else {
                    text = dataOld;
                }
                var author = $cookieStore.get('user');

                var dateObj = new Date(), locale = "en-us";
                var month = dateObj.toLocaleString(locale, {month: "short"});
                var day = dateObj.getUTCDate();
                var year = dateObj.getUTCFullYear();

                var newDate = day + " " + month + " " + year;

                var arr = {
                    'id': id,
                    'author': author,
                    'text': text,
                    'date': newDate
                };

                Post.all().then(function (data) {
                    data.splice(id, 1, arr);

                    $location.path("/posts");
                });

            };
        }

    };
});


text:
class JITTypeHandler
{
public:
    JITTypeHandler(TypeHandlerIDL * data);

    bool IsObjectHeaderInlinedTypeHandler() const;
    bool IsLocked() const;

    uint16 GetInlineSlotCapacity() const;
    uint16 GetOffsetOfInlineSlots() const;

    int GetSlotCapacity() const;

    static bool IsTypeHandlerCompatibleForObjectHeaderInlining(const JITTypeHandler * oldTypeHandler, const JITTypeHandler * newTypeHandler);
private:
    TypeHandlerIDL m_data;
};


text:
package com.google.zxing.client.android.camera;

import android.content.Context;
import android.graphics.Point;
import android.hardware.Camera;
import android.os.Build;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;

import java.util.regex.Pattern;

final class CameraConfigurationManager {

  private static final String TAG = CameraConfigurationManager.class.getSimpleName();

  private static final int TEN_DESIRED_ZOOM = 27;
  private static final int DESIRED_SHARPNESS = 30;

  private static final Pattern COMMA_PATTERN = Pattern.compile(",");

  private final Context context;
  private Point screenResolution;
  private Point cameraResolution;
  private int previewFormat;
  private String previewFormatString;

  CameraConfigurationManager(Context context) {
    this.context = context;
  }

  /**
   * Reads, one time, values from the camera that are needed by the app.
   */
  void initFromCameraParameters(Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    previewFormat = parameters.getPreviewFormat();
    previewFormatString = parameters.get("preview-format");
    Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);
    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    screenResolution = new Point(display.getWidth(), display.getHeight());
    Log.d(TAG, "Screen resolution: " + screenResolution);
    cameraResolution = getCameraResolution(parameters, screenResolution);
    Log.d(TAG, "Camera resolution: " + screenResolution);
  }

  /**
   * Sets the camera up to take preview images which are used for both preview and decoding.
   * We detect the preview format here so that buildLuminanceSource() can build an appropriate
   * LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest,
   * and the planar Y can be used for barcode scanning without a copy in some cases.
   */
  void setDesiredCameraParameters(Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Log.d(TAG, "Setting preview size: " + cameraResolution);
    parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
    setFlash(parameters);
    setZoom(parameters);
    //setSharpness(parameters);
    camera.setParameters(parameters);
  }

  Point getCameraResolution() {
    return cameraResolution;
  }

  Point getScreenResolution() {
    return screenResolution;
  }

  int getPreviewFormat() {
    return previewFormat;
  }

  String getPreviewFormatString() {
    return previewFormatString;
  }

  private static Point getCameraResolution(Camera.Parameters parameters, Point screenResolution) {

    String previewSizeValueString = parameters.get("preview-size-values");
    // saw this on Xperia
    if (previewSizeValueString == null) {
      previewSizeValueString = parameters.get("preview-size-value");
    }

    Point cameraResolution = null;

    if (previewSizeValueString != null) {
      Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString);
      cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolution);
    }

    if (cameraResolution == null) {
      // Ensure that the camera resolution is a multiple of 8, as the screen may not be.
      cameraResolution = new Point(
          (screenResolution.x >> 3) << 3,
          (screenResolution.y >> 3) << 3);
    }

    return cameraResolution;
  }

  private static Point findBestPreviewSizeValue(String previewSizeValueString,
      Point screenResolution) {
    int bestX = 0;
    int bestY = 0;
    int diff = Integer.MAX_VALUE;
    for (String previewSize : COMMA_PATTERN.split(previewSizeValueString)) {

      previewSize = previewSize.trim();
      int dimPosition = previewSize.indexOf('x');
      if (dimPosition < 0) {
        Log.w(TAG, "Bad preview-size: " + previewSize);
        continue;
      }

      int newX;
      int newY;
      try {
        newX = Integer.parseInt(previewSize.substring(0, dimPosition));
        newY = Integer.parseInt(previewSize.substring(dimPosition + 1));
      } catch (NumberFormatException nfe) {
        Log.w(TAG, "Bad preview-size: " + previewSize);
        continue;
      }

      int newDiff = Math.abs(newX - screenResolution.x) + Math.abs(newY - screenResolution.y);
      if (newDiff == 0) {
        bestX = newX;
        bestY = newY;
        break;
      } else if (newDiff < diff) {
        bestX = newX;
        bestY = newY;
        diff = newDiff;
      }

    }

    if (bestX > 0 && bestY > 0) {
      return new Point(bestX, bestY);
    }
    return null;
  }

  private static int findBestMotZoomValue(CharSequence stringValues, int tenDesiredZoom) {
    int tenBestValue = 0;
    for (String stringValue : COMMA_PATTERN.split(stringValues)) {
      stringValue = stringValue.trim();
      double value;
      try {
        value = Double.parseDouble(stringValue);
      } catch (NumberFormatException nfe) {
        return tenDesiredZoom;
      }
      int tenValue = (int) (10.0 * value);
      if (Math.abs(tenDesiredZoom - value) < Math.abs(tenDesiredZoom - tenBestValue)) {
        tenBestValue = tenValue;
      }
    }
    return tenBestValue;
  }

  private void setFlash(Camera.Parameters parameters) {
    // FIXME: This is a hack to turn the flash off on the Samsung Galaxy.
    // And this is a hack-hack to work around a different value on the Behold II
    // Restrict Behold II check to Cupcake, per Samsung's advice
    if (Build.MODEL.contains("Behold II") &&
        CameraManager.SDK_INT == Build.VERSION_CODES.CUPCAKE) {
      parameters.set("flash-value", 1);
    } else {
      parameters.set("flash-value", 2);
    }
    // This is the standard setting to turn the flash off that all devices should honor.
    parameters.set("flash-mode", "off");
  }

  private void setZoom(Camera.Parameters parameters) {

    String zoomSupportedString = parameters.get("zoom-supported");
    if (zoomSupportedString != null && !Boolean.parseBoolean(zoomSupportedString)) {
      return;
    }

    int tenDesiredZoom = TEN_DESIRED_ZOOM;

    String maxZoomString = parameters.get("max-zoom");
    if (maxZoomString != null) {
      try {
        int tenMaxZoom = (int) (10.0 * Double.parseDouble(maxZoomString));
        if (tenDesiredZoom > tenMaxZoom) {
          tenDesiredZoom = tenMaxZoom;
        }
      } catch (NumberFormatException nfe) {
        Log.w(TAG, "Bad max-zoom: " + maxZoomString);
      }
    }

    String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max");
    if (takingPictureZoomMaxString != null) {
      try {
        int tenMaxZoom = Integer.parseInt(takingPictureZoomMaxString);
        if (tenDesiredZoom > tenMaxZoom) {
          tenDesiredZoom = tenMaxZoom;
        }
      } catch (NumberFormatException nfe) {
        Log.w(TAG, "Bad taking-picture-zoom-max: " + takingPictureZoomMaxString);
      }
    }

    String motZoomValuesString = parameters.get("mot-zoom-values");
    if (motZoomValuesString != null) {
      tenDesiredZoom = findBestMotZoomValue(motZoomValuesString, tenDesiredZoom);
    }

    String motZoomStepString = parameters.get("mot-zoom-step");
    if (motZoomStepString != null) {
      try {
        double motZoomStep = Double.parseDouble(motZoomStepString.trim());
        int tenZoomStep = (int) (10.0 * motZoomStep);
        if (tenZoomStep > 1) {
          tenDesiredZoom -= tenDesiredZoom % tenZoomStep;
        }
      } catch (NumberFormatException nfe) {
        // continue
      }
    }

    // Set zoom. This helps encourage the user to pull back.
    // Some devices like the Behold have a zoom parameter
    if (maxZoomString != null || motZoomValuesString != null) {
      parameters.set("zoom", String.valueOf(tenDesiredZoom / 10.0));
    }

    // Most devices, like the Hero, appear to expose this zoom parameter.
    // It takes on values like "27" which appears to mean 2.7x zoom
    if (takingPictureZoomMaxString != null) {
      parameters.set("taking-picture-zoom", tenDesiredZoom);
    }
  }

  /*
  private void setSharpness(Camera.Parameters parameters) {

    int desiredSharpness = DESIRED_SHARPNESS;

    String maxSharpnessString = parameters.get("sharpness-max");
    if (maxSharpnessString != null) {
      try {
        int maxSharpness = Integer.parseInt(maxSharpnessString);
        if (desiredSharpness > maxSharpness) {
          desiredSharpness = maxSharpness;
        }
      } catch (NumberFormatException nfe) {
        Log.w(TAG, "Bad sharpness-max: " + maxSharpnessString);
      }
    }

    parameters.set("sharpness", desiredSharpness);
  }
   */
}


text:
using System;
using System.Collections.Generic;

namespace TeamCityTheatre.Core.Models {
  public class Build : IDetailedBuild {
    public string Id { get; set; }
    public string BuildConfigurationId { get; set; }
    public double? PercentageComplete { get; set; }
    public double? ElapsedSeconds { get; set; }
    public double? EstimatedTotalSeconds { get; set; }
    public string CurrentStageText { get; set; }
    public string Number { get; set; }
    public BuildStatus Status { get; set; }
    public string State { get; set; }
    public string BranchName { get; set; }
    public bool IsDefaultBranch { get; set; }
    public string Href { get; set; }
    public string WebUrl { get; set; }
    public string StatusText { get; set; }
    public IBasicBuildConfiguration BuildConfiguration { get; set; }
    public DateTime QueuedDate { get; set; }
    public DateTime StartDate { get; set; }
    public DateTime FinishDate { get; set; }
    public IReadOnlyCollection<IDetailedBuildChange> LastChanges { get; set; }
    public IBasicAgent Agent { get; set; }
    public IReadOnlyCollection<Property> Properties { get; set; }
    public IReadOnlyCollection<IBasicBuild> SnapshotDependencies { get; set; }
    public IReadOnlyCollection<IBasicBuild> ArtifactDependencies { get; set; }

    public override string ToString() {
      return string.Format("Id: {0}, BuildConfigurationId: {1}, Number: {2}, Status: {3}, State: {4}", Id,
        BuildConfigurationId, Number, Status, State);
    }
  }
}


text:
'use strict'

const bugsnag = require('@bugsnag/js')
const bugsnagExpress = require('@bugsnag/plugin-express')

const processVars = require('../processVars')
const useBugsnag = require('../secrets').bugsnag_use

let bugsnagClient = {}

if (useBugsnag) {
  bugsnagClient = bugsnag.start({
    apiKey: require('../secrets').bugsnag_token,
    enabledReleaseStages: ['development', 'production'],
    plugins: [bugsnagExpress],
    appVersion: processVars.version
  })
}

function bugsnagCaller(err, metaData, logToConsole = true) {
  if (useBugsnag) {
    bugsnagClient.notify(err, event => {
      event.addMetadata('Custom', metaData);
    });
  }
  if (logToConsole) {
    console.log(err);
  }
}

let bugsnagWrapper = {
  bugsnagCaller,
  bugsnagClient
}

module.exports = bugsnagWrapper;


text:
/***********************************************************************/
/*                                                                     */
/*                           Objective Caml                            */
/*                                                                     */
/*  Xavier Leroy and Pascal Cuoq, projet Cristal, INRIA Rocquencourt   */
/*                                                                     */
/*  Copyright 1996 Institut National de Recherche en Informatique et   */
/*  en Automatique.  All rights reserved.  This file is distributed    */
/*  under the terms of the GNU Library General Public License, with    */
/*  the special exception on linking described in file ../../LICENSE.  */
/*                                                                     */
/***********************************************************************/

/* $Id: getpeername.c,v 1.10 2005/03/24 17:20:53 doligez Exp $ */

#include <mlvalues.h>
#include "unixsupport.h"
#include "socketaddr.h"

CAMLprim value unix_getpeername(sock)
     value sock;
{
  int retcode;
  union sock_addr_union addr;
  socklen_param_type addr_len;

  addr_len = sizeof(sock_addr);
  retcode = getpeername(Socket_val(sock),
                        &addr.s_gen, &addr_len);
  if (retcode == -1) {
    win32_maperr(WSAGetLastError());
    uerror("getpeername", Nothing);
  }
  return alloc_sockaddr(&addr, addr_len, -1);
}


text:
package com.github.angads25.filepicker.view;

import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.github.angads25.filepicker.R;
import com.github.angads25.filepicker.controller.DialogSelectionListener;
import com.github.angads25.filepicker.controller.NotifyItemChecked;
import com.github.angads25.filepicker.controller.adapters.FileListAdapter;
import com.github.angads25.filepicker.model.DialogConfigs;
import com.github.angads25.filepicker.model.DialogProperties;
import com.github.angads25.filepicker.model.FileListItem;
import com.github.angads25.filepicker.model.MarkedItemList;
import com.github.angads25.filepicker.utils.ExtensionFilter;
import com.github.angads25.filepicker.utils.Utility;
import com.github.angads25.filepicker.widget.MaterialCheckbox;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * Created by Angad Singh on 09-07-2016.
 * </p>
 */

public class FilePickerDialog extends Dialog implements AdapterView.OnItemClickListener {
    private Context context;
    private ListView listView;
    private TextView dname, dir_path, title;
    private DialogProperties properties;
    private DialogSelectionListener callbacks;
    private ArrayList<FileListItem> internalList;
    private ExtensionFilter filter;
    private FileListAdapter mFileListAdapter;
    private Button select;
    private String titleStr = null;
    private String positiveBtnNameStr = null;
    private String negativeBtnNameStr = null;

    public static final int EXTERNAL_READ_PERMISSION_GRANT = 112;

    public FilePickerDialog(Context context) {
        super(context);
        this.context = context;
        properties = new DialogProperties();
        filter = new ExtensionFilter(properties);
        internalList = new ArrayList<>();
    }

    public FilePickerDialog(Context context, DialogProperties properties) {
        super(context);
        this.context = context;
        this.properties = properties;
        filter = new ExtensionFilter(properties);
        internalList = new ArrayList<>();
    }

    public FilePickerDialog(Context context, DialogProperties properties, int themeResId) {
        super(context, themeResId);
        this.context = context;
        this.properties = properties;
        filter = new ExtensionFilter(properties);
        internalList = new ArrayList<>();
    }

    @Override
    @SuppressWarnings("deprecation")
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.dialog_main);
        listView = (ListView) findViewById(R.id.fileList);
        select = (Button) findViewById(R.id.select);
        int size = MarkedItemList.getFileCount();
        if (size == 0) {
            select.setEnabled(false);
            int color;
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
                color = context.getResources().getColor(R.color.colorAccent, context.getTheme());
            } else {
                color = context.getResources().getColor(R.color.colorAccent);
            }
            select.setTextColor(Color.argb(128, Color.red(color), Color.green(color), Color.blue(color)));
        }
        dname = (TextView) findViewById(R.id.dname);
        title = (TextView) findViewById(R.id.title);
        dir_path = (TextView) findViewById(R.id.dir_path);
        Button cancel = (Button) findViewById(R.id.cancel);
        if (negativeBtnNameStr != null) {
            cancel.setText(negativeBtnNameStr);
        }
        select.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                /*  Select Button is clicked. Get the array of all selected items
                 *  from MarkedItemList singleton.
                 */
                String paths[] = MarkedItemList.getSelectedPaths();
                //NullPointerException fixed in v1.0.2
                if (callbacks != null) {
                    callbacks.onSelectedFilePaths(paths);
                }
                dismiss();
            }
        });
        cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                cancel();
            }
        });
        mFileListAdapter = new FileListAdapter(internalList, context, properties);
        mFileListAdapter.setNotifyItemCheckedListener(new NotifyItemChecked() {
            @Override
            public void notifyCheckBoxIsClicked() {
                /*  Handler function, called when a checkbox is checked ie. a file is
                 *  selected.
                 */
                positiveBtnNameStr = positiveBtnNameStr == null ?
                        context.getResources().getString(R.string.choose_button_label) : positiveBtnNameStr;
                int size = MarkedItemList.getFileCount();
                if (size == 0) {
                    select.setEnabled(false);
                    int color;
                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
                        color = context.getResources().getColor(R.color.colorAccent, context.getTheme());
                    }
                    else {
                        color = context.getResources().getColor(R.color.colorAccent);
                    }
                    select.setTextColor(Color.argb(128, Color.red(color), Color.green(color), Color.blue(color)));
                    select.setText(positiveBtnNameStr);
                } else {
                    select.setEnabled(true);
                    int color;
                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
                        color = context.getResources().getColor(R.color.colorAccent, context.getTheme());
                    }
                    else {
                        color = context.getResources().getColor(R.color.colorAccent);
                    }
                    select.setTextColor(color);
                    String button_label = positiveBtnNameStr + " (" + size + ") ";
                    select.setText(button_label);
                }
                if (properties.selection_mode == DialogConfigs.SINGLE_MODE) {
                    /*  If a single file has to be selected, clear the previously checked
                     *  checkbox from the list.
                     */
                    mFileListAdapter.notifyDataSetChanged();
                }
            }
        });
        listView.setAdapter(mFileListAdapter);

        //Title method added in version 1.0.5
        setTitle();
    }

    private void setTitle() {
        if (title == null || dname == null) {
            return;
        }
        if (titleStr != null) {
            if (title.getVisibility() == View.INVISIBLE) {
                title.setVisibility(View.VISIBLE);
            }
            title.setText(titleStr);
            if (dname.getVisibility() == View.VISIBLE) {
                dname.setVisibility(View.INVISIBLE);
            }
        } else {
            if (title.getVisibility() == View.VISIBLE) {
                title.setVisibility(View.INVISIBLE);
            }
            if (dname.getVisibility() == View.INVISIBLE) {
                dname.setVisibility(View.VISIBLE);
            }
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        positiveBtnNameStr = (
                positiveBtnNameStr == null ?
                context.getResources().getString(R.string.choose_button_label) :
                positiveBtnNameStr
        );
        select.setText(positiveBtnNameStr);
        if (Utility.checkStorageAccessPermissions(context)) {
            File currLoc;
            internalList.clear();
            if (properties.offset.isDirectory() && validateOffsetPath()) {
                currLoc = new File(properties.offset.getAbsolutePath());
                FileListItem parent = new FileListItem();
                parent.setFilename(context.getString(R.string.label_parent_dir));
                parent.setDirectory(true);
                parent.setLocation(currLoc.getParentFile().getAbsolutePath());
                parent.setTime(currLoc.lastModified());
                internalList.add(parent);
            } else if (properties.root.exists() && properties.root.isDirectory()) {
                currLoc = new File(properties.root.getAbsolutePath());
            } else {
                currLoc = new File(properties.error_dir.getAbsolutePath());
            }
            dname.setText(currLoc.getName());
            dir_path.setText(currLoc.getAbsolutePath());
            setTitle();
            internalList = Utility.prepareFileListEntries(internalList, currLoc, filter);
            mFileListAdapter.notifyDataSetChanged();
            listView.setOnItemClickListener(this);
        }
    }

    private boolean validateOffsetPath() {
        String offset_path = properties.offset.getAbsolutePath();
        String root_path = properties.root.getAbsolutePath();
        return !offset_path.equals(root_path) && offset_path.contains(root_path);
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        if (internalList.size() > i) {
            FileListItem fitem = internalList.get(i);
            if (fitem.isDirectory()) {
                if (new File(fitem.getLocation()).canRead()) {
                    File currLoc = new File(fitem.getLocation());
                    dname.setText(currLoc.getName());
                    setTitle();
                    dir_path.setText(currLoc.getAbsolutePath());
                    internalList.clear();
                    if (!currLoc.getName().equals(properties.root.getName())) {
                        FileListItem parent = new FileListItem();
                        parent.setFilename(context.getString(R.string.label_parent_dir));
                        parent.setDirectory(true);
                        parent.setLocation(currLoc.getParentFile().getAbsolutePath());
                        parent.setTime(currLoc.lastModified());
                        internalList.add(parent);
                    }
                    internalList = Utility.prepareFileListEntries(internalList, currLoc, filter);
                    mFileListAdapter.notifyDataSetChanged();
                } else {
                    Toast.makeText(context, R.string.error_dir_access, Toast.LENGTH_SHORT).show();
                }
            } else {
                MaterialCheckbox fmark = (MaterialCheckbox) view.findViewById(R.id.file_mark);
                fmark.performClick();
            }
        }
    }

    public DialogProperties getProperties() {
        return properties;
    }

    public void setProperties(DialogProperties properties) {
        this.properties = properties;
        filter = new ExtensionFilter(properties);
    }

    public void setDialogSelectionListener(DialogSelectionListener callbacks) {
        this.callbacks = callbacks;
    }

    @Override
    public void setTitle(CharSequence titleStr) {
        if (titleStr != null) {
            this.titleStr = titleStr.toString();
        } else {
            this.titleStr = null;
        }
        setTitle();
    }

    public void setPositiveBtnName(CharSequence positiveBtnNameStr) {
        if (positiveBtnNameStr != null) {
            this.positiveBtnNameStr = positiveBtnNameStr.toString();
        } else {
            this.positiveBtnNameStr = null;
        }
    }

    public void setNegativeBtnName(CharSequence negativeBtnNameStr) {
        if (negativeBtnNameStr != null) {
            this.negativeBtnNameStr = negativeBtnNameStr.toString();
        } else {
            this.negativeBtnNameStr = null;
        }
    }

    public void markFiles(List<String> paths) {
        if (paths != null && paths.size() > 0) {
            if (properties.selection_mode == DialogConfigs.SINGLE_MODE) {
                File temp = new File(paths.get(0));
                switch (properties.selection_type) {
                    case DialogConfigs.DIR_SELECT:
                        if (temp.exists() && temp.isDirectory()) {
                            FileListItem item = new FileListItem();
                            item.setFilename(temp.getName());
                            item.setDirectory(temp.isDirectory());
                            item.setMarked(true);
                            item.setTime(temp.lastModified());
                            item.setLocation(temp.getAbsolutePath());
                            MarkedItemList.addSelectedItem(item);
                        }
                        break;

                    case DialogConfigs.FILE_SELECT:
                        if (temp.exists() && temp.isFile()) {
                            FileListItem item = new FileListItem();
                            item.setFilename(temp.getName());
                            item.setDirectory(temp.isDirectory());
                            item.setMarked(true);
                            item.setTime(temp.lastModified());
                            item.setLocation(temp.getAbsolutePath());
                            MarkedItemList.addSelectedItem(item);
                        }
                        break;

                    case DialogConfigs.FILE_AND_DIR_SELECT:
                        if (temp.exists()) {
                            FileListItem item = new FileListItem();
                            item.setFilename(temp.getName());
                            item.setDirectory(temp.isDirectory());
                            item.setMarked(true);
                            item.setTime(temp.lastModified());
                            item.setLocation(temp.getAbsolutePath());
                            MarkedItemList.addSelectedItem(item);
                        }
                        break;
                }
            } else {
                for (String path : paths) {
                    switch (properties.selection_type) {
                        case DialogConfigs.DIR_SELECT:
                            File temp = new File(path);
                            if (temp.exists() && temp.isDirectory()) {
                                FileListItem item = new FileListItem();
                                item.setFilename(temp.getName());
                                item.setDirectory(temp.isDirectory());
                                item.setMarked(true);
                                item.setTime(temp.lastModified());
                                item.setLocation(temp.getAbsolutePath());
                                MarkedItemList.addSelectedItem(item);
                            }
                            break;

                        case DialogConfigs.FILE_SELECT:
                            temp = new File(path);
                            if (temp.exists() && temp.isFile()) {
                                FileListItem item = new FileListItem();
                                item.setFilename(temp.getName());
                                item.setDirectory(temp.isDirectory());
                                item.setMarked(true);
                                item.setTime(temp.lastModified());
                                item.setLocation(temp.getAbsolutePath());
                                MarkedItemList.addSelectedItem(item);
                            }
                            break;

                        case DialogConfigs.FILE_AND_DIR_SELECT:
                            temp = new File(path);
                            if (temp.exists() && (temp.isFile() || temp.isDirectory())) {
                                FileListItem item = new FileListItem();
                                item.setFilename(temp.getName());
                                item.setDirectory(temp.isDirectory());
                                item.setMarked(true);
                                item.setTime(temp.lastModified());
                                item.setLocation(temp.getAbsolutePath());
                                MarkedItemList.addSelectedItem(item);
                            }
                            break;
                    }
                }
            }
        }
    }

    @Override
    public void show() {
        if (!Utility.checkStorageAccessPermissions(context)) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                ((Activity) context).requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, EXTERNAL_READ_PERMISSION_GRANT);
            }
        } else {
            super.show();
            positiveBtnNameStr = positiveBtnNameStr == null ?
                    context.getResources().getString(R.string.choose_button_label) : positiveBtnNameStr;
            select.setText(positiveBtnNameStr);
            int size = MarkedItemList.getFileCount();
            if (size == 0) {
                select.setText(positiveBtnNameStr);
            } else {
                String button_label = positiveBtnNameStr + " (" + size + ") ";
                select.setText(button_label);
            }
        }
    }

    @Override
    public void onBackPressed() {
        //currentDirName is dependent on dname
        String currentDirName = dname.getText().toString();
        if (internalList.size() > 0) {
            FileListItem fitem = internalList.get(0);
            File currLoc = new File(fitem.getLocation());
            if (currentDirName.equals(properties.root.getName()) ||
                    !currLoc.canRead()) {
                super.onBackPressed();
            } else {
                dname.setText(currLoc.getName());
                dir_path.setText(currLoc.getAbsolutePath());
                internalList.clear();
                if (!currLoc.getName().equals(properties.root.getName())) {
                    FileListItem parent = new FileListItem();
                    parent.setFilename(context.getString(R.string.label_parent_dir));
                    parent.setDirectory(true);
                    parent.setLocation(currLoc.getParentFile().getAbsolutePath());
                    parent.setTime(currLoc.lastModified());
                    internalList.add(parent);
                }
                internalList = Utility.prepareFileListEntries(internalList, currLoc, filter);
                mFileListAdapter.notifyDataSetChanged();
            }
            setTitle();
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public void dismiss() {
        MarkedItemList.clearSelectionList();
        internalList.clear();
        super.dismiss();
    }
}


text:
package underscore

import (
	"github.com/markmontymark/asserts"
	"fmt"
	"math"
	"testing"
)

// TODO: missing Underscore ctor tests
// TODO: missing Identity tests

func TestRandom(t *testing.T) {
	array := Range(1000)
	min := math.Pow(2, 31)
	max := math.Pow(2, 62)

	asserts.True(t, "should produce a random number greater than or equal to the minimum number",
		Every(array, func(a, b, c T) bool {
			r := RandomFloat64(min, max)
			return r >= min && r <= max
		}))

	asserts.True(t, "should produce a random number when passed `Number.MAX_VALUE`",
		Some(array, func(a, b, c T) bool {
			r := RandomFloat64(math.MaxFloat64)
			return r > 0.0
		}))
}

// TODO: missing UniqueId tests

func TestTimes(t *testing.T) {
	vals := []T{}
	Times(3, func(i ...T) T {
		vals = append(vals, i...)
		return nil
	})
	asserts.Equals(t, "is 0 indexed", fmt.Sprint(vals), "[0 1 2]")

	vals2 := []T{}
	New(3).Times(func(i ...T) T {
		vals2 = append(vals2, i...)
		return i[0]
	})
	asserts.Equals(t, "works as a wrapper", fmt.Sprint(vals2), "[0 1 2]")

	// collects return values
	asserts.Equals(t, "collects return values",
		fmt.Sprint(New(3).Times(func(i ...T) T { return i[0] })), "[0 1 2]")

	asserts.Equals(t, "zero times retval is empty array",
		fmt.Sprint(Times(0, New(nil).Identity)), "[]")
	asserts.Equals(t, " -1 times retval is empty array",
		fmt.Sprint(Times(-1, New(nil).Identity)), "[]")
	asserts.Equals(t, " -Infinity times retval is empty array",
		fmt.Sprint(Times(int(math.Inf(-1)), New(nil).Identity)),
		"[]")
}

// XXX: missing mixin tests -- might not do...no prototype to add to in Go
// XXX: missing escape,unescape tests -- might not do...Go and encoding/ package
// XXX: missing template tests -- might not do...Go has its own template package

// TODO: missing result tests


text:
{-# LANGUAGE BangPatterns #-}

module Yellow.Drivers.Arduino
(
  sendCommand,
  performRead
)
where

import Prelude as P
import Data.ByteString as B
import System.RaspberryPi.GPIO
import Data.Bits
import Data.Word (Word8)
import Control.Concurrent
import Control.Monad.Except

sendCommand :: Address -> ByteString -> I2C ()
sendCommand adr msg = do
                        let msg' = addCrc msg
                        writeI2CE adr msg'

performRead :: Address -> Word8 -> Int -> I2C ByteString
performRead adr hdr n = do
                          let msg = addCrc . B.pack $ [hdr]
                          writeI2CE adr msg
                          -- lift $ P.putStrLn . show . unpack $ msg
                          lift $ threadDelay 10000
                          res <- readI2CE adr (n + 1)
                          -- lift $ P.putStrLn . show . unpack $ res
                          if validateCrc res
                            then return $ (B.take (B.length res - 1) res)
                            else throwError ChecksumInvalid

validateCrc :: ByteString -> Bool
validateCrc bs | B.length bs < 2 = False
               | otherwise = B.last bs == crc8 (B.take (B.length bs - 1) bs)

addCrc :: ByteString -> ByteString
addCrc bs = snoc bs (crc8 bs)

crc8 :: ByteString -> Word8
crc8 = B.foldl crc8Byte 0

crc8Byte :: Word8 -> Word8 -> Word8
crc8Byte a b = go a b 8
  where
    go :: Word8 -> Word8 -> Int -> Word8
    go !x _ 0 = x
    go !x !y !bit = go x' y' (bit - 1)
      where
        x' | testBit (x `xor` y) 7 = (x `unsafeShiftL` 1) `xor` 0x07
           | otherwise             = x `unsafeShiftL` 1
        y' = y `unsafeShiftL` 1


text:
<?php
namespace Elastica\Test\Query;

use Elastica\Document;
use Elastica\Index;
use Elastica\Query\BoolQuery;
use Elastica\Query\Ids;
use Elastica\Query\Term;
use Elastica\Test\Base as BaseTest;
use Elastica\Type;

class BoolQueryTest extends BaseTest
{
    /**
     * @group unit
     */
    public function testToArray()
    {
        $query = new BoolQuery();

        $idsQuery1 = new Ids();
        $idsQuery1->setIds(1);

        $idsQuery2 = new Ids();
        $idsQuery2->setIds(2);

        $idsQuery3 = new Ids();
        $idsQuery3->setIds(3);

        $boost = 1.2;
        $minMatch = 2;

        $query->setBoost($boost);
        $query->setMinimumNumberShouldMatch($minMatch);
        $query->addMust($idsQuery1);
        $query->addMustNot($idsQuery2);
        $query->addShould($idsQuery3->toArray());

        $expectedArray = array(
            'bool' => array(
                'must' => array($idsQuery1->toArray()),
                'should' => array($idsQuery3->toArray()),
                'minimum_number_should_match' => $minMatch,
                'must_not' => array($idsQuery2->toArray()),
                'boost' => $boost,
            ),
        );

        $this->assertEquals($expectedArray, $query->toArray());
    }

    /**
     * Test to resolve the following issue.
     *
     * @link https://groups.google.com/forum/?fromgroups#!topic/elastica-php-client/zK_W_hClfvU
     *
     * @group unit
     */
    public function testToArrayStructure()
    {
        $boolQuery = new BoolQuery();

        $term1 = new Term();
        $term1->setParam('interests', 84);

        $term2 = new Term();
        $term2->setParam('interests', 92);

        $boolQuery->addShould($term1)->addShould($term2);

        $jsonString = '{"bool":{"should":[{"term":{"interests":84}},{"term":{"interests":92}}]}}';
        $this->assertEquals($jsonString, json_encode($boolQuery->toArray()));
    }

    /**
     * @group functional
     */
    public function testSearch()
    {
        $client = $this->_getClient();
        $index = new Index($client, 'test');
        $index->create(array(), true);

        $type = new Type($index, 'helloworld');

        $doc = new Document(1, array('id' => 1, 'email' => 'hans@test.com', 'username' => 'hans', 'test' => array('2', '3', '5')));
        $type->addDocument($doc);
        $doc = new Document(2, array('id' => 2, 'email' => 'emil@test.com', 'username' => 'emil', 'test' => array('1', '3', '6')));
        $type->addDocument($doc);
        $doc = new Document(3, array('id' => 3, 'email' => 'ruth@test.com', 'username' => 'ruth', 'test' => array('2', '3', '7')));
        $type->addDocument($doc);

        // Refresh index
        $index->refresh();

        $boolQuery = new BoolQuery();
        $termQuery1 = new Term(array('test' => '2'));
        $boolQuery->addMust($termQuery1);
        $resultSet = $type->search($boolQuery);

        $this->assertEquals(2, $resultSet->count());

        $termQuery2 = new Term(array('test' => '5'));
        $boolQuery->addMust($termQuery2);
        $resultSet = $type->search($boolQuery);

        $this->assertEquals(1, $resultSet->count());

        $termQuery3 = new Term(array('username' => 'hans'));
        $boolQuery->addMust($termQuery3);
        $resultSet = $type->search($boolQuery);

        $this->assertEquals(1, $resultSet->count());

        $termQuery4 = new Term(array('username' => 'emil'));
        $boolQuery->addMust($termQuery4);
        $resultSet = $type->search($boolQuery);

        $this->assertEquals(0, $resultSet->count());
    }

    /**
     * @group functional
     */
    public function testEmptyBoolQuery()
    {
        $index = $this->_createIndex();
        $type = new Type($index, 'test');

        $docNumber = 3;
        for ($i = 0; $i < $docNumber; ++$i) {
            $doc = new Document($i, array('email' => 'test@test.com'));
            $type->addDocument($doc);
        }

        $index->refresh();

        $boolQuery = new BoolQuery();

        $resultSet = $type->search($boolQuery);

        $this->assertEquals($resultSet->count(), $docNumber);
    }

    /**
     * @group functional
     */
    public function testOldObject()
    {
        if (version_compare(phpversion(), 7, '>=')) {
            self::markTestSkipped('These objects are not supported in PHP 7');
        }

        $index = $this->_createIndex();
        $type = new Type($index, 'test');

        $docNumber = 3;
        for ($i = 0; $i < $docNumber; ++$i) {
            $doc = new Document($i, array('email' => 'test@test.com'));
            $type->addDocument($doc);
        }

        $index->refresh();

        $err = array();

        set_error_handler(function () use (&$err) {
            $err[] = func_get_args();
        });

        $boolQuery = new \Elastica\Query\Bool();

        restore_error_handler();

        $this->assertCount(1, $err);
        $this->assertEquals(E_USER_DEPRECATED, $err[0][0]);

        $resultSet = $type->search($boolQuery);

        $this->assertEquals($resultSet->count(), $docNumber);
    }
}


text:
These style guidelines are intended to ensure the SDK documentation is consistent in form and style across all SDK interfaces.
These guidelines intentionally mimic the style of Apple's API documentation.

The documentation for the CSync iOS SDK is generated using [jazzy][].
A good introduction to jazzy markup and operation is available at the
NSHipster article [Swift Documentation][swiftdoc].

[jazzy]: https://github.com/Realm/jazzy
[swiftdoc]: http://nshipster.com/swift-documentation/

## Class Overview

Every class should have a class overview that contains one or more paragraphs that describe the basic purpose and function of the class.

A common subsection in the class overview is "Subclassing Notes".  Include this subsection to describe any special considerations when subclassing the class.  Such special considerations may include:

- Methods to Override (e.g. UIView)
- Methods You Must Not Override (e.g. NSManagedObject)
- Methods you Are Discouraged From Overriding (e.g. NSManagedObject)
- Custom Accessor Methods (e.g. NSManagedObject)
- Alternatives to Subclassing

## Tasks

Task titles should be gerunds (verb with -ing ending).  E.g., Creating, Configuring, Managing.

## Properties

- The description (first line) of a property should be a noun phrase that describes the property.

	Examples:
	- The bounds rectangle, which describes the view's location and size in its own coordinate system. (bounds property of UIView)
	- The object that acts as the delegate of the receiving table view. (delegate property of UITableView)

- The description for a read/write Boolean property should start with "A Boolean value that determines whether".

	Example:
	- A Boolean value that determines whether the view is hidden. (hidden property of UIView)
	- A Boolean value that determines whether the receiver is in editing mode. (editing property in UITableView)

- The description for a read-only Boolean property should start with "A Boolean value that indicates whether".

	Example:
	- A Boolean value that indicates whether the receiver is the key window for the application. (read-only) (keyWindow property of UIWindow)

- Read only methods should include "(read-only)" at the end of their description.

- Include a section titled "Availability" in the description body that indicates when this property was introduced.

## Class Methods

- The description (first line) of a class method should be a verb phrase that describes the action performed by the method.
(Do NOT include "This method" at the beginning of the description.)

	Example:
	- Resizes and moves the receiver view so it just encloses its subviews. (sizeToFit method of UIView)

## Instance Methods

- The description (first line) of an instance method should be a verb phrase that describes the action performed by the method.
(Do NOT include "This method" at the beginning of the description.)
For methods with a return value, the description should start with "Returns".

	Example (void return):
	- Resizes and moves the receiver view so it just encloses its subviews. (sizeToFit method of UIView)

	Example (non-void return):
	- Returns the natural size for the receiving view, considering only properties of the view itself. (intrinsicSize method of UIView)
	- Returns the footer view associated with the specified section. (footerViewForSection method of UIView)

### Delegate protocols

Instance methods for delegates have a special documentation style.

- The description (first line) of a delegate protocol method should begin with either "Tells the delegate that" (for void methods) or "Asks the delegate for" (for methods with return values).

	Example (void return):
	- Tells the delegate that the specified row is now selected. (tableView:didSelectRowAtIndexPath: in UITableViewDelegate Protocol)

	Example (non-void return):
	- Asks the delegate for the height to use for the header of a particular section. (tableView:heightForHeaderInSection: in UITableViewDelegate Protocol)

## Constants

TODO: Investigate whether/how jazzy handles doc for constants.

## Notifications

Some Apple classes document notifications sent by the class (e.g. UITableView documents the UITableViewSelectionDidChangeNotification).

TODO: Investigate whether/how jazzy handles doc for notification ids.


text:
{% extends "base.html" %}

{% block title %} | Subsets{% endblock %}

{% block main %}

{{project.name}}

Project home

Categories

User groups

Subsets

Geographic extent

Settings

            {% include 'snippets/messages.html' %}

                <form role="form" class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2" method="POST" action="{% url 'admin:subset_create' project.id %}" novalidate>

Create new subset

                    {% csrf_token %}

                        Name (required)
                        <input type="text" class="form-control input-lg" id="name" name="name" maxlength="100" required>

                        Description
                        <textarea class="form-control input-lg" rows="5" name="description" id="description"></textarea>

                        <button type="submit" class="btn btn-primary">Save</button>
                        Cancel

                </form>

{% endblock %}

{% block libraries %}

{% endblock %}


text:
require 'spec_helper'

module Stats::Writers
  describe ReferrerWriter do
    describe "#write" do
      let(:document) { DailyStats.create }
      let(:visit) do
        double('visit', hit: Hash[:rf => 'host'], has_hit?: true)
      end

      it "implements the write interface" do
        expect(subject.respond_to?(:write)).to be_true
      end

      context "with a new host" do
        it "adds the how" do
          subject.write(document, visit)
          expect(DailyStats.first.referrers.first).to include({ 'host' => 'host' })
        end

        it "adds an initial total count of 1" do
          subject.write(document, visit)
          expect(DailyStats.first.referrers.first).to include({ 'count' => 1 })
        end
      end

      context "with an existing host" do
        before do
          document.add_to_set(:referrers, {'host' => 'host', 'count' => 4})
        end

        it "adds 1 to the existing host count" do
          subject.write(document, visit)
          expect(DailyStats.first.referrers.first).to include({ 'count' => 5 })
        end
      end

      context "with no hit" do
        before { visit.stub(has_hit?: false) }

        it "does nothing" do
          subject.write(document, visit)
          expect(document.has_attribute?(:referrers)).to be_false
        end
      end
    end
  end
end


text:
const DrawCard = require('../../drawcard.js');

class TogashiInitiate extends DrawCard {
    setupCardAbilities(ability) {
        this.action({
            title: 'Honor this character',
            condition: context => context.source.isAttacking(),
            cost: ability.costs.payFateToRing(1),
            gameAction: ability.actions.honor()
        });
    }
}

TogashiInitiate.id = 'togashi-initiate';

module.exports = TogashiInitiate;


text:
<?php
/**
 * Created by PhpStorm.
 * User: kritarth
 * Date: 25/05/17
 * Time: 4:02 PM
 */

namespace Plivo\Resources\Conference;

use Plivo\Exceptions\PlivoValidationException;
use Plivo\Exceptions\PlivoResponseException;
use Plivo\BaseClient;
use Plivo\Resources\ResourceInterface;
use Plivo\Resources\ResponseDelete;
use Plivo\Resources\ResponseUpdate;
use Plivo\Util\ArrayOperations;

/**
 * Class ConferenceInterface
 * @package Plivo\Resources\Conference
 * @property array list Lists the conferences going on
 */
class ConferenceInterface extends ResourceInterface
{
    /**
     * @var
     */
    protected $memberUri;

    /**
     * ConferenceInterface constructor.
     * @param BaseClient $plivoClient
     * @param $authId
     */
    function __construct(BaseClient $plivoClient , $authId)
    {
        parent::__construct($plivoClient);
        $this->pathParams = [
            'authId' => $authId
        ];
        $this->uri = "Account/" . $authId . "/Conference/";
    }

    /**
     * @param string $conferenceName
     * @return Conference
     * @throws PlivoValidationException
     */
    public function get($conferenceName)
    {
        if (ArrayOperations::checkNull([$conferenceName])) {
            throw
            new PlivoValidationException(
                'conference name is mandatory');
        }

        $response = $this->client->fetch(
            $this->uri . $conferenceName . '/',
            []
        );

        return new Conference(
            $this->client,
            $response->getContent(),
            $this->pathParams['authId'],
            $conferenceName);
    }

    /**
     * @return mixed
     */
    public function getList()
    {
        $response = $this->client->fetch(
            $this->uri,
            []
        );

        $conferenceNames = $response->getContent()['conferences'];

        return $conferenceNames;
    }

    /**
     * @param null $conferenceName
     * @return ResponseDelete
     */
    public function delete($conferenceName)
    {
        $response = $this->client->delete(
            $this->uri . $conferenceName . '/',
            []
        );

        return new ResponseDelete();
    }

    /**
     * @return ResponseDelete
     */
    public function deleteAll()
    {
        $response = $this->client->delete(
            $this->uri,
            []
        );

        return new ResponseDelete();
    }

    /**
     * @param $conferenceName
     * @param $memberId
     * @return ResponseDelete
     */
    public function hangUpMember($conferenceName, $memberId)
    {
        $response = $this->client->delete(
            $this->uri . $conferenceName . '/Member/' . $memberId . '/',
            []
        );

        return new ResponseDelete();
    }

    /**
     * @param $conferenceName
     * @param $memberId
     * @return ResponseUpdate
     */
    public function kickMember($conferenceName, $memberId)
    {
        $response = $this->client->update(
            $this->uri .
            $conferenceName .
            '/Member/' .
            $memberId .
            '/Kick/',
            []
        );

        $responseContents = $response->getContent();

        if(!array_key_exists("error",$responseContents)){
            return new ResponseUpdate(
                $responseContents['api_id'],
                $responseContents['message'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }

    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @return ResponseUpdate
     */
    public function muteMember($conferenceName, array $memberId)
    {
        $response = $this->client->update(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Mute/',
            []
        );

        $responseContents = $response->getContent();

        if(!array_key_exists("error",$responseContents)){
            return new ResponseUpdate(
                $responseContents['api_id'],
                $responseContents['message'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @return ResponseDelete
     */
    public function unMuteMember($conferenceName, array $memberId)
    {
        $response = $this->client->delete(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Mute/',
            []
        );

        return new ResponseDelete();
    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @param $url
     * @return ResponseUpdate
     */
    public function startPlaying($conferenceName, array $memberId, $url)
    {
        $response = $this->client->update(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Play/',
            ['url' => $url]
        );

        $responseContents = $response->getContent();

        if(!array_key_exists("error",$responseContents)){
            return new ResponseUpdate(
                $responseContents['api_id'],
                $responseContents['message'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @return ResponseDelete
     */
    public function stopPlaying($conferenceName, array $memberId)
    {
        $response = $this->client->delete(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Play/',
            []
        );

        return new ResponseDelete();
    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @param $text
     * @param array $optionalArgs
     *   + Valid arguments
     *   + [string] voice - The voice to be used. Can be MAN or WOMAN. Defaults to WOMAN.
     *   + [string] language - The language to be used, see Supported voices and languages {https://www.plivo.com/docs/api/conference/member/#supported-voice-and-languages}. Defaults to en-US .
     * @return ResponseUpdate
     */
    public function startSpeaking($conferenceName, array $memberId, $text, array $optionalArgs = [])
    {
        $response = $this->client->update(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Speak/',
            array_merge(['text'=>$text], $optionalArgs)
        );

        $responseContents = $response->getContent();
        if(!array_key_exists("error",$responseContents)){
            return new ResponseUpdate(
                $responseContents['api_id'],
                $responseContents['message'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @return ResponseDelete
     */
    public function stopSpeaking($conferenceName, array $memberId)
    {
        $response = $this->client->delete(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Speak/',
            []
        );

        return new ResponseDelete();
    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @return ResponseUpdate
     */
    public function makeDeaf($conferenceName, array $memberId)
    {
        $response = $this->client->update(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Deaf/',
            []
        );

        $responseContents = $response->getContent();
        if(!array_key_exists("error",$responseContents)){
            return new ResponseUpdate(
                $responseContents['api_id'],
                $responseContents['message'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }

    /**
     * @param $conferenceName
     * @param array $memberId
     * @return ResponseDelete
     */
    public function enableHearing($conferenceName, array $memberId)
    {
        $response = $this->client->delete(
            $this->uri .
            $conferenceName .
            '/Member/' .
            join(',', $memberId) .
            '/Deaf/',
            []
        );

        return new ResponseDelete();
    }

    /**
     * @param $conferenceName
     * @param $optionalArgs
     *   + Valid arguments
     *   + [string] file_format - The file format of the record can be of mp3 or wav format. Defaults to mp3 format.
     *   + [string] transcription_type - The type of transcription required. The following values are allowed:
     *
 auto - This is the default value. Transcription is completely automated; turnaround time is about 5 minutes.
     *
 hybrid - Transcription is a combination of automated and human verification processes; turnaround time is about 10-15 minutes.
     *   + [string] transcription_url - The URL where the transcription is available.
     *   + [string] transcription_method - The method used to invoke the transcription_url. Defaults to POST.
     *   + [string] callback_url - The URL invoked by the API when the recording ends. The following parameters are sent to the callback_url:
     *
 api_id - the same API ID returned by the conference record API.
     *
 record_url - the URL to access the recorded file.
     *
 recording_id - recording ID of the recorded file.
     *
 conference_name - the conference name recorded.
     *
 recording_duration - duration in seconds of the recording.
     *
 recording_duration_ms - duration in milliseconds of the recording.
     *
 recording_start_ms - when the recording started (epoch time UTC) in milliseconds.
     *
 recording_end_ms - when the recording ended (epoch time UTC) in milliseconds.
     *   + [string] callback_method - The method which is used to invoke the callback_url URL. Defaults to POST.

     * @return ConferenceRecording
     */
    public function startRecording($conferenceName, $optionalArgs = [])
    {
        $response = $this->client->update(
            $this->uri .
            $conferenceName .
            '/Record/',
            $optionalArgs
        );

        $responseContents = $response->getContent();

        if(!array_key_exists("error",$responseContents)){
            return new ConferenceRecording(
                $responseContents['api_id'],
                $responseContents['message'],
                $responseContents['recording_id'],
                $responseContents['url'],
                $response->getStatusCode()
                );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }

    }

    /**
     * @param $conferenceName
     * @return ResponseDelete
     */
    public function stopRecording($conferenceName)
    {
        $response = $this->client->delete(
            $this->uri .
            $conferenceName .
            '/Record/',
            []
        );

        return new ResponseDelete();
    }

}