text:
NintendoSpy
======

#### This project is not being actively developed by the owner, however PRs are more than welcome!

#### [Download the latest NintendoSpy release here.](https://github.com/jaburns/NintendoSpy/releases/latest) (x64 and experimental x86 Windows binary)

This project provides a general solution for live-streaming your controller inputs while speedrunning, or recording inputs for tutorials on how to perform tricks.  It supports tying in to NES, SNES, Nintendo 64, and GameCube controller signals to get a live view of them, as well as any gamepad connected to your PC for use with emulators.  XBox 360 controllers are supported with a skin out of the box, but other gamepads will require creating a skin.

NintendoSpy supports custom skins using a straight-forward XML-based skin format.  You can also bind controller input combinations to trigger keypresses for hitting checkpoints on your splits.  If you create your own skins, feel free to submit them as pull requests to this repository.

Some extra skins for NES and SNES [can be found here](http://proximitysound.com/skins).

There's also a [fork available here](https://github.com/zoggins/RetroSpy) which supports Atari/Commodore joysticks, Sega Genesis controllers, SMS controllers and the Atari 2600 Omega Race Booster Grip.

## Documentation

### Wiring and hardware

The general design of NintendoSpy involves splicing the controller wire, and attaching the appropriate signal wires to an Arduino.  Then you just need to install the Arduino firmware packaged in the NintendoSpy release, and run the viewer software.  For more in-depth tutorials on how to do this, check out some of the links below.

![](https://github.com/jeremyaburns/NintendoSpy/raw/master/docs/tutorial-images/wiring-all.png)

[EvilAsh25's SNES hardware building guide](https://github.com/jaburns/NintendoSpy/blob/master/docs/guide-evilash25.md)

[Gamecube hardware tutorial](https://github.com/jaburns/NintendoSpy/blob/master/docs/tutorial-gamecube.md)

[N64 hardware tutorial](https://github.com/jaburns/NintendoSpy/blob/master/docs/tutorial-n64.md)

### Using the viewer software

Once you've unzipped the NintendoSpy release, run NintendoSpy.exe to open the controller viewer.  You'll be greeted by the input source configuration screen, which is fairly straightforward to configure.  First select the console your NintendoSpy hardware is set up to view, "PC 360", or "Generic PC Gamepad".  For the latter 2 choices, COM port is irrelevant since the device is expected to simply interface over standard USB.  If you select a Nintendo console however, you'll have to select the COM port the Arduino is communicating over.  Honestly, the easiest way to figure this out is to just try each port.  There are never many in the list, and it does no harm to pick the wrong one other than you won't see any inputs.

![](https://github.com/jeremyaburns/NintendoSpy/raw/master/docs/tutorial-images/interface.png)

Once you've selected the input source, you'll have to pick a skin.  Each skin can have multiple backgrounds, which are generally used to provide various colors for the controller itself.  After picked a skin, hit ``Go!`` and you should see the viewer screen.

### Creating your own skins

Each skin consists of a subfolder in the "skins" directory, which is expected to contain a file called ``skin.xml`` along with all the PNG image assets required by the skin.  The easiest way to create a skin for your target console is probably just to copy+paste the default skin and modify it according to your needs.  What follows is a thorough documentation of the skin.xml format for reference if you'd like to create more complex skins.

The root node of the ``skin.xml`` file must define the following 3 attributes:
```
<skin
    name="Default PC 360" # This is the name of the skin as it will appear in the selection list.
    author="jaburns"      # Your name or handle.
    type="pc360">         # The input type this skin is used for.
```
Valid values for the ``type`` attribute are as follows: ``nes``, ``snes``, ``n64``, ``gamecube``, ``pc360``, ``generic``.

Each skin must define at least one ``<background>`` element.  Each background entry will be listed in the skin selector as a separate entry.  Every background for your skin must have the same dimensions.
```
<background
    name="Default"     # The name which will appear in the selection list.
    image="pad.png"    # Optional PNG file to use for this background selection.
    color="red"        # Optional Color to use as background, either a text or a hex (#123DEF) style
    />
```
The rest of the ``skin.xml`` file defines how to render button and analog inputs.  Each type exposes a variety of buttons and analog values.  Button inputs are mapped to images at specific locations using the ``<button>`` tag, and there is a small variety of possible ways to map analog inputs.

```
<detail
    name="Static Image"                  # Name of the source input button to map this image to.
    image="Dropshadow.png"               # Image file to display when this input is pressed.
    x="101" y="71"                       # Location in pixels where the top/left corner of the image should sit.
    width="16"                           # Width and height specification can OPTIONALLY be used to scale
    height="16"
    target="Background A;Background C"   # Optional. Only show for this background. Available for all elements.
    ignore="Background B"                # Optional. Do not show for this background (not required when target is defined)
    />     #   an image to a specific size.  The default size is the orignal image size.
```
A static image to show, works great with ignore and targets to add more variety with ease to skins.

```
<button
    name="up"          # Name of the source input button to map this image to.
    image="circle.png" # Image file to display when this input is pressed.
    x="101" y="71"     # Location in pixels where the top/left corner of the image should sit.
    width="16"         # Width and height specification can OPTIONALLY be used to scale
    height="16" />     #   an image to a specific size.  The default size is the orignal image size.
```
Analog values can be mapping as sticks, ranges, or range-based buttons.  Ranges are used for things like analog shoulder buttons and render by filling an image by the amount the range is pressed.  Range buttons are useful for creating a button-like display when an analog value is in a certain ranage.  An example of this use case is if you are streaming a SNES game, but playing using a 360 controller, you can bind the analog stick to appear as if you are pressing the d-pad buttons.
```
<stick
    xname="lstick_x"  # Analogs values to bind the image's x
    yname="lstick_y"  #   and y displacements to.
    image="stick.png" # Image file to use for the stick.
    x="53" y="31"     # Location in pixels where the top/left corner of the image should sit.
    width="34"        # Width and height specification can OPTIONALLY be used to scale
    height="35"       #   an image to a specific size.  The default size is the orignal image size.
    xrange="9"        # xrange and yrange specify how much to move the stick image in either axis
    yrange="9"        #   when the stick is deplaced.
    xreverse="false"  # Settings xreverse or yreverse to true will reverse the direction
    yreverse="true"   #   that the stick moves along that axis
    />
```
```
<analog
    name="trig_l"      # Analog value to bind the display to.
    image="trig-l.png" # Image file to mask over the background as the input changes.
    x="15" y="18"      # Location in pixels where the top/left corner of the image should sit.
    direction="up"     # The direction to sweep the image.
                         Valid options are 'up', 'down', 'left', 'right'.
    reverse="true"     # 'true' or 'false'. Setting to true will cause the image to clear instead
                         of fill as the analog value is further engaged.
    usenegative="true" # 'true' or 'false'. If set to true, then the image will change when the analog
                         value ranges from 0 to -1 instead of 0 to 1.  Useful for generic gamepad skins
                         who use a single axis for analog L/R buttons.
    />
```
```
<rangebutton
    name="lstick_x"    # Analog value to bind the display to.
    image="d-left.png" # Image file to mask over the background as the input changes.
    x="15" y="18"      # Location in pixels where the top/left corner of the image should sit.
    from="-1.0"        # From and to attributes specify the range which the specified analog
    to="-0.5"          #   input must be in to display the image.
/>
```

### Binding controller inputs to keyboard key presses

Binding controller inputs to keyboard key presses is achieved by placing ``<binding>`` definitions
in the ``keybindings.xml`` file.  The ``output-key`` attribute on the binding specifies which keyboard key to press when the provided gamepad buttons are pressed.  Values of ``output-key`` can simply be letters, or [see here other for valid key bindings (the text in red are the acceptable values for ``output-key``)](https://github.com/jaburns/NintendoSpy/blob/master/Keybindings.cs#L110).  Each binding must contain at least one child ``<input>`` element.  The input elements specify which buttons on the controller must be depressed in order to send the key press signal.  See below for an example ``keybindings.xml`` file which makes pressing L and R together trigger a ``home`` key press on the keyboard.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<keybindings>
    <binding output-key="home">
        <input button="r" />
        <input button="l" />
    </binding>
</keybindings>


text:
       A2DS

       Angular2Dashboard Starter

         Toggle navigation

               10

You have 10 notifications

                        5 new members joined today

View all

               {{loginData.fullName}}

                   {{loginData.fullName}}
                   Member since Nov. 2012

                   Profile

                   Sign out

{{loginData.fullName}}

            Online

       <form action="#" method="get" class="sidebar-form">

           <input type="text" name="q" class="form-control" placeholder="Search...">

                 <button type="submit" name="search" id="search-btn" class="btn btn-flat">
                 </button>

       </form>

HEADER

 Link

 Another Link

            Multilevel

Link in level 2

Link in level 2

         {{pageTitle}}
         {{pageSubtitle}}

        <ng-content></ng-content>

       Anything you want

     Copyright © 2015 Company. All rights reserved.

redpajama_set_name: RedPajamaGithub


text:
#ifndef _BBITSET_H
#define _BBITSET_H

#include "libiberty.h"

#include <stdbool.h>
#include <limits.h>
#include <stddef.h>

/* Currently we support five flavours of bitsets:
   BITSET_ARRAY:  Array of bits (fixed size, fast for dense bitsets).
                  Memory for bit array and bitset structure allocated
                  contiguously.
   BITSET_LIST:   Linked list of arrays of bits (variable size, least storage
		  for large very sparse sets).
   BITSET_TABLE:  Expandable table of pointers to arrays of bits
		  (variable size, less storage for large sparse sets).
                  Faster than BITSET_LIST for random access.
   BITSET_VARRAY: Variable array of bits (variable size, fast for
                  dense bitsets).
   BITSET_STATS:  Wrapper bitset for internal use only.  Used for gathering
                  statistics and/or better run-time checking.
*/
enum bitset_type {BITSET_ARRAY, BITSET_LIST, BITSET_TABLE, BITSET_VARRAY,
		  BITSET_TYPE_NUM, BITSET_STATS};
#define BITSET_TYPE_NAMES {"abitset", "lbitset", "ebitset", "vbitset"}

extern const char * const bitset_type_names[];

enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};

/* Data type used to store a word of bits.  */
typedef unsigned long int bitset_word;
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))

/* Bit index.  In theory we might need a type wider than size_t, but
   in practice we lose at most a factor of CHAR_BIT by going with
   size_t, and that is good enough.  If this type is changed to be
   wider than size_t, the code needs to be modified to check for
   overflow when converting bit counts to byte or word counts.
   The bit and word index types must be unsigned.  */
typedef size_t bitset_bindex;

/* Word index.  */
typedef size_t bitset_windex;

/* Maximum values for commonly-used unsigned types.  BITSET_SIZE_MAX
   always equals SIZE_MAX, but some older systems lack SIZE_MAX.  */
#define BITSET_BINDEX_MAX ((bitset_bindex) -1)

/* Limit max word index to the maximum value of a signed integer
   to simplify cache disabling.  */
#define BITSET_WINDEX_MAX (((bitset_windex) -1) >> 1)
#define BITSET_SIZE_MAX ((size_t) -1)

#define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1))

#define BITSET_LIST_SIZE 1024

enum bitset_ops {BITSET_OP_ZERO, BITSET_OP_ONES,
		 BITSET_OP_COPY, BITSET_OP_NOT,
		 BITSET_OP_EMPTY_P, BITSET_OP_EQUAL_P,
		 BITSET_OP_SUBSET_P, BITSET_OP_DISJOINT_P,
		 BITSET_OP_AND, BITSET_OP_OR, BITSET_OP_XOR, BITSET_OP_ANDN,
		 BITSET_OP_OR_AND, BITSET_OP_AND_OR, BITSET_OP_ANDN_OR};

struct bbitset_struct
{
  const struct bitset_vtable *vtable;
  bitset_windex cindex;		/* Cache word index.  */
  bitset_windex csize;		/* Cache size in words.  */
  bitset_word *cdata;		/* Cache data pointer.  */
  bitset_bindex n_bits;		/* Number of bits.  */
  /* Perhaps we could sacrifice another word to indicate
     that the bitset is known to be zero, that a bit has been set
     in the cache, and that a bit has been cleared in the cache.
     This would speed up some of the searches but slightly slow down
     bit set/reset operations of cached bits.  */
};

typedef union bitset_union *bitset;

/* Private accessor macros to bitset structure.  */
#define BITSET_VTABLE_(SRC) (SRC)->b.vtable
#define BITSET_CINDEX_(SRC) (SRC)->b.cindex
#define BITSET_CDATA_(SRC) (SRC)->b.cdata
#define BITSET_CSIZE_(SRC) (SRC)->b.csize
#define BITSET_NBITS_(SRC) (SRC)->b.n_bits

/* The contents of this structure should be considered private.  */
struct bitset_vtable
{
  void (*set) (bitset, bitset_bindex);
  void (*reset) (bitset, bitset_bindex);
  bool (*toggle) (bitset, bitset_bindex);
  bool (*test) (bitset, bitset_bindex);
  bitset_bindex (*resize) (bitset, bitset_bindex);
  bitset_bindex (*size) (bitset);
  bitset_bindex (*count) (bitset);

  bool (*empty_p) (bitset);
  void (*ones) (bitset);
  void (*zero) (bitset);

  void (*copy) (bitset, bitset);
  bool (*disjoint_p) (bitset, bitset);
  bool (*equal_p) (bitset, bitset);
  void (*not_) (bitset, bitset);
  bool (*subset_p) (bitset, bitset);

  void (*and_) (bitset, bitset, bitset);
  bool (*and_cmp) (bitset, bitset, bitset);
  void (*andn) (bitset, bitset, bitset);
  bool (*andn_cmp) (bitset, bitset, bitset);
  void (*or_) (bitset, bitset, bitset);
  bool (*or_cmp) (bitset, bitset, bitset);
  void (*xor_) (bitset, bitset, bitset);
  bool (*xor_cmp) (bitset, bitset, bitset);

  void (*and_or) (bitset, bitset, bitset, bitset);
  bool (*and_or_cmp) (bitset, bitset, bitset, bitset);
  void (*andn_or) (bitset, bitset, bitset, bitset);
  bool (*andn_or_cmp) (bitset, bitset, bitset, bitset);
  void (*or_and) (bitset, bitset, bitset, bitset);
  bool (*or_and_cmp) (bitset, bitset, bitset, bitset);

  bitset_bindex (*list) (bitset, bitset_bindex *, bitset_bindex,
			 bitset_bindex *);
  bitset_bindex (*list_reverse) (bitset, bitset_bindex *, bitset_bindex,
				 bitset_bindex *);
  void (*free) (bitset);
  enum bitset_type type;
};

#define BITSET_COMPATIBLE_(BSET1, BSET2) \
((BSET1)->b.vtable == (BSET2)->b.vtable)

#define BITSET_CHECK2_(DST, SRC) \
if (!BITSET_COMPATIBLE_ (DST, SRC)) abort ();

#define BITSET_CHECK3_(DST, SRC1, SRC2) \
if (!BITSET_COMPATIBLE_ (DST, SRC1) \
    || !BITSET_COMPATIBLE_ (DST, SRC2)) abort ();

#define BITSET_CHECK4_(DST, SRC1, SRC2, SRC3) \
if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
    || !BITSET_COMPATIBLE_ (DST, SRC3)) abort ();

/* Redefine number of bits in bitset DST.  */
#define BITSET_RESIZE_(DST, SIZE) (DST)->b.vtable->resize (DST, SIZE)

/* Return size in bits of bitset SRC.  */
#define BITSET_SIZE_(SRC) (SRC)->b.vtable->size (SRC)

/* Return number of bits set in bitset SRC.  */
#define BITSET_COUNT_(SRC) (SRC)->b.vtable->count (SRC)

/* Return type of bitset SRC.  */
#define BITSET_TYPE_(DST) (DST)->b.vtable->type

/* Set bit BITNO in bitset DST.  */
#define BITSET_SET_(DST, BITNO) (DST)->b.vtable->set (DST, BITNO)

/* Reset bit BITNO in bitset DST.  */
#define BITSET_RESET_(DST, BITNO) (DST)->b.vtable->reset (DST, BITNO)

/* Toggle bit BITNO in bitset DST.  */
#define BITSET_TOGGLE_(DST, BITNO) (DST)->b.vtable->toggle (DST, BITNO)

/* Return non-zero if bit BITNO in bitset SRC is set.  */
#define BITSET_TEST_(SRC, BITNO) (SRC)->b.vtable->test (SRC, BITNO)

/* Free bitset SRC.  */
#define BITSET_FREE_(SRC)\
 ((SRC)->b.vtable->free ? (SRC)->b.vtable->free (SRC) :(void)0)

/* Return SRC == 0.  */
#define BITSET_EMPTY_P_(SRC) (SRC)->b.vtable->empty_p (SRC)

/* DST = ~0.  */
#define BITSET_ONES_(DST) (DST)->b.vtable->ones (DST)

/* DST = 0.  */
#define BITSET_ZERO_(DST) (DST)->b.vtable->zero (DST)

/* DST = SRC.  */
#define BITSET_COPY_(DST, SRC) (SRC)->b.vtable->copy (DST, SRC)

/* Return DST & SRC == 0.  */
#define BITSET_DISJOINT_P_(DST, SRC) (SRC)->b.vtable->disjoint_p (DST, SRC)

/* Return DST == SRC.  */
#define BITSET_EQUAL_P_(DST, SRC) (SRC)->b.vtable->equal_p (DST, SRC)

/* DST = ~SRC.  */
#define BITSET_NOT_(DST, SRC) (SRC)->b.vtable->not_ (DST, SRC)

/* Return DST == DST | SRC.  */
#define BITSET_SUBSET_P_(DST, SRC) (SRC)->b.vtable->subset_p (DST, SRC)

/* DST = SRC1 & SRC2.  */
#define BITSET_AND_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_ (DST, SRC1, SRC2)
#define BITSET_AND_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->and_cmp (DST, SRC1, SRC2)

/* DST = SRC1 & ~SRC2.  */
#define BITSET_ANDN_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn (DST, SRC1, SRC2)
#define BITSET_ANDN_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->andn_cmp (DST, SRC1, SRC2)

/* DST = SRC1 | SRC2.  */
#define BITSET_OR_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_ (DST, SRC1, SRC2)
#define BITSET_OR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->or_cmp (DST, SRC1, SRC2)

/* DST = SRC1 ^ SRC2.  */
#define BITSET_XOR_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_ (DST, SRC1, SRC2)
#define BITSET_XOR_CMP_(DST, SRC1, SRC2) (SRC1)->b.vtable->xor_cmp (DST, SRC1, SRC2)

/* DST = (SRC1 & SRC2) | SRC3.  Return non-zero if
   DST != (SRC1 & SRC2) | SRC3.  */
#define BITSET_AND_OR_(DST, SRC1, SRC2, SRC3) \
 (SRC1)->b.vtable->and_or (DST, SRC1, SRC2, SRC3)
#define BITSET_AND_OR_CMP_(DST, SRC1, SRC2, SRC3) \
 (SRC1)->b.vtable->and_or_cmp (DST, SRC1, SRC2, SRC3)

/* DST = (SRC1 & ~SRC2) | SRC3.  Return non-zero if
   DST != (SRC1 & ~SRC2) | SRC3.  */
#define BITSET_ANDN_OR_(DST, SRC1, SRC2, SRC3) \
 (SRC1)->b.vtable->andn_or (DST, SRC1, SRC2, SRC3)
#define BITSET_ANDN_OR_CMP_(DST, SRC1, SRC2, SRC3) \
 (SRC1)->b.vtable->andn_or_cmp (DST, SRC1, SRC2, SRC3)

/* DST = (SRC1 | SRC2) & SRC3.  Return non-zero if
   DST != (SRC1 | SRC2) & SRC3.  */
#define BITSET_OR_AND_(DST, SRC1, SRC2, SRC3) \
 (SRC1)->b.vtable->or_and (DST, SRC1, SRC2, SRC3)
#define BITSET_OR_AND_CMP_(DST, SRC1, SRC2, SRC3) \
 (SRC1)->b.vtable->or_and_cmp (DST, SRC1, SRC2, SRC3)

/* Find list of up to NUM bits set in BSET starting from and including
   *NEXT.  Return with actual number of bits found and with *NEXT
   indicating where search stopped.  */
#define BITSET_LIST_(BSET, LIST, NUM, NEXT) \
 (BSET)->b.vtable->list (BSET, LIST, NUM, NEXT)

/* Find reverse list of up to NUM bits set in BSET starting from and
   including NEXT.  Return with actual number of bits found and with
   *NEXT indicating where search stopped.  */
#define BITSET_LIST_REVERSE_(BSET, LIST, NUM, NEXT) \
 (BSET)->b.vtable->list_reverse (BSET, LIST, NUM, NEXT)

/* Private functions for bitset implementations.  */

extern bool bitset_toggle_ (bitset, bitset_bindex);

extern bitset_bindex bitset_count_ (bitset);

extern bitset_bindex bitset_size_ (bitset);

extern bool bitset_copy_ (bitset, bitset);

extern void bitset_and_or_ (bitset, bitset, bitset, bitset);

extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);

extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);

extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);

extern void bitset_or_and_ (bitset, bitset, bitset, bitset);

extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);

#endif /* _BBITSET_H  */


text:
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/accessapproval/v1/accessapproval.proto

#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_ACCESSAPPROVAL_MOCKS_MOCK_ACCESS_APPROVAL_CONNECTION_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_ACCESSAPPROVAL_MOCKS_MOCK_ACCESS_APPROVAL_CONNECTION_H

#include "google/cloud/accessapproval/access_approval_connection.h"
#include <gmock/gmock.h>

namespace google {
namespace cloud {
namespace accessapproval_mocks {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/**
 * A class to mock `AccessApprovalConnection`.
 *
 * Application developers may want to test their code with simulated responses,
 * including errors, from an object of type `AccessApprovalClient`. To do so,
 * construct an object of type `AccessApprovalClient` with an instance of this
 * class. Then use the Google Test framework functions to program the behavior
 * of this mock.
 *
 * @see [This example][bq-mock] for how to test your application with
 * GoogleTest. While the example showcases types from the BigQuery library, the
 * underlying principles apply for any pair of `*Client` and `*Connection`.
 *
 * [bq-mock]: @googleapis_dev_link{bigquery,bigquery-read-mock.html}
 */
class MockAccessApprovalConnection
    : public accessapproval::AccessApprovalConnection {
 public:
  MOCK_METHOD(Options, options, (), (override));

  MOCK_METHOD(
      StreamRange<google::cloud::accessapproval::v1::ApprovalRequest>,
      ListApprovalRequests,
      (google::cloud::accessapproval::v1::ListApprovalRequestsMessage request),
      (override));

  MOCK_METHOD(
      StatusOr<google::cloud::accessapproval::v1::ApprovalRequest>,
      GetApprovalRequest,
      (google::cloud::accessapproval::v1::GetApprovalRequestMessage const&
           request),
      (override));

  MOCK_METHOD(
      StatusOr<google::cloud::accessapproval::v1::ApprovalRequest>,
      ApproveApprovalRequest,
      (google::cloud::accessapproval::v1::ApproveApprovalRequestMessage const&
           request),
      (override));

  MOCK_METHOD(
      StatusOr<google::cloud::accessapproval::v1::ApprovalRequest>,
      DismissApprovalRequest,
      (google::cloud::accessapproval::v1::DismissApprovalRequestMessage const&
           request),
      (override));

  MOCK_METHOD(StatusOr<google::cloud::accessapproval::v1::ApprovalRequest>,
              InvalidateApprovalRequest,
              (google::cloud::accessapproval::v1::
                   InvalidateApprovalRequestMessage const& request),
              (override));

  MOCK_METHOD(
      StatusOr<google::cloud::accessapproval::v1::AccessApprovalSettings>,
      GetAccessApprovalSettings,
      (google::cloud::accessapproval::v1::
           GetAccessApprovalSettingsMessage const& request),
      (override));

  MOCK_METHOD(
      StatusOr<google::cloud::accessapproval::v1::AccessApprovalSettings>,
      UpdateAccessApprovalSettings,
      (google::cloud::accessapproval::v1::
           UpdateAccessApprovalSettingsMessage const& request),
      (override));

  MOCK_METHOD(Status, DeleteAccessApprovalSettings,
              (google::cloud::accessapproval::v1::
                   DeleteAccessApprovalSettingsMessage const& request),
              (override));

  MOCK_METHOD(
      StatusOr<google::cloud::accessapproval::v1::AccessApprovalServiceAccount>,
      GetAccessApprovalServiceAccount,
      (google::cloud::accessapproval::v1::
           GetAccessApprovalServiceAccountMessage const& request),
      (override));
};

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace accessapproval_mocks
}  // namespace cloud
}  // namespace google

#endif  // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_ACCESSAPPROVAL_MOCKS_MOCK_ACCESS_APPROVAL_CONNECTION_H


text:
%%
%% This is file `selinput-test4.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% selinput.dtx  (with options: `test,test4')
%%
%% This is a generated file.
%%
%% Project: selinput
%% Version: 2007/09/09 v1.2
%%
%% Copyright (C) 2007 by
%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Heiko Oberdiek.
%%
%% This work consists of the main source file selinput.dtx
%% and the derived files
%%    selinput.sty, selinput.pdf, selinput.ins, selinput.drv,
%%    selinput-test1.tex, selinput-test2.tex, selinput-test3.tex,
%%    selinput-test4.tex, selinput-test5.tex.
%%
\NeedsTeXFormat{LaTeX2e}
\documentclass{minimal}
\usepackage{textcomp}
\usepackage{qstest}
\usepackage[warning,ucs]{selinput}
\SelectInputMappings{%
    adieresis=^^c3^^a4,%
    germandbls=^^c3^^9f,%
    Euro=^^e2^^82^^ac,%
}
\begin{qstest}{encoding}{}
  \Expect*{\inputencodingname}{utf8x}%
\end{qstest}
\begin{document}
  adieresis=^^c3^^a4, %
  germandbls=^^c3^^9f, %
  Euro=^^e2^^82^^ac%
\end{document}
\endinput
%%
%% End of file `selinput-test4.tex'.


text:
  <uib-accordion close-others="oneAtATime">

      <uib-accordion-heading>
        Total $556,000.00
      </uib-accordion-heading>

            Description
            Amount
            Months left
            Total

            {{row.description}}
            {{row.amount | currency}}
            {{row.monthsLeft}}
            {{row.total | currency}}

  </uib-accordion>


text:
import {
  setTarget,
  setCurrentTarget
} from '../src/EventHandler';

Event.prototype.preventDefault = function () {
  this.returnValue = false;
};
Event.prototype.stopPropagation = function () {
  this.cancelBubble = true;
};

let div;
let count;
const handlers = {};

function removeHandler(type) {
  div.off(type, handlers[type]);
  delete handlers[type];
}

function addHandler(type, handler) {
  handlers[type] = handler;
  div.on(type, handler);
}

function addClickHandler() {
  addHandler('click', () => {
    count++;
  });
}

function addClickListener() {
  addHandler('click', {
    handleEvent: () => {
      count++;
    }
  });
}

function addMouseoverHandler() {
  addHandler('mouseover', () => {
    count = -1000;
  });
}

function removeMouseoverHandler() {
  removeHandler('mouseover');
}

function clickOnDiv() {
  const eventClick = document.createEvent('MouseEvents');
  eventClick.initEvent('click', true, true);
  div.dispatchEvent(eventClick);
}

function assertCountValue(value) {
  return () => {
    expect(count).to.equal(value);
  };
}

function removeDiv() {
  document.body.removeChild(div);
}

function createDivForWebkit() {
  count = 0;
  div = document.createElement('div');
  div.on = window.Element.prototype.on;
  div.off = window.Element.prototype.off;
  document.body.appendChild(div);
}

function createDivForInternetExplorer() {
  count = 0;
  div = document.createElement('div');
  div.on = window.Element.prototype.on;
  div.off = window.Element.prototype.off;
  div.$addEventListener = div.addEventListener;
  div.$removeEventListener = div.removeEventListener;
  div.attachEvent = (type, arg) => {
    div.$addEventListener(type.slice(2), arg);
  };
  div.detachEvent = (type, arg) => {
    div.$removeEventListener(type.slice(2), arg);
  };
  div.addEventListener = null;
  div.removeEventListener = null;
  document.body.appendChild(div);
}

describe('document', () => {
  describe('document methods', () => {
    it('Then should have on method defined', () => {
      expect(document.on).to.not.be.undefined;
    });
    it('And off method defined', () => {
      expect(document.off).to.not.be.undefined;
    });
  });
});

describe('Event', () => {
  let event;
  function buildEvent() {
    event = new Event();
  }

  describe('setTarget should assign value', () => {
    let obj;
    it('Given assignable object', () => obj = {});
    it('When set target to true', () => setTarget(obj, true));
    it('Then the target value should be true',() => {
      expect(obj.target).to.be.true;
    });
  });

  describe('setCurrentTarget should assign value', () => {
    let obj;
    it('Given assignable object', () => obj = Object.freeze({}));
    it('When set current target to true', () => setCurrentTarget(obj, true));
    it('Then the target value should be true',() => {
      expect(obj.currentTarget).to.be.undefined;
    });
  });

  describe('preventDefault should set the returnValue to false', () => {
    it('Given an event has been created', buildEvent);
    it('When preventDefault is performed', () => event.preventDefault());
    it('Then returnValue should be false',() => {
      expect(event.returnValue).to.be.false;
    });
  });

  describe('stopPropagation should set the cancelBubble to true', () => {
    it('Given an event has been created', buildEvent);
    it('When stopPropagation is performed', () => event.stopPropagation());
    it('Then cancelBubble should be true',() => {
      expect(event.cancelBubble).to.be.true;
    });
  });

});

describe(`Element testing event handlers for attachEvent present - for Internet Explorer`, () => {

  describe('Element click event should increment count on Internet Explorer', () => {
    it('Given a div element has been created with click handler for Internet Explorer', () => {
      createDivForInternetExplorer();
      addClickHandler();
    });
    it('When div is clicked', clickOnDiv);
    it('Then count should have value 1', assertCountValue(1));

    after(removeDiv);
  });

  describe('Element click handler listener should increment count on Internet Explorer', () => {
    it('Given a div element has been created with click listener for Internet Explorer', () => {
      createDivForInternetExplorer();
      addClickListener();
    });
    it('When div is clicked', clickOnDiv);
    it('Then count should have value 1', assertCountValue(1));

    after(removeDiv);
  });

  describe('Element active handlers should remain after removing on specific handler on Internet Explorer', () => {
    it('Given a div element has been created with click and mouseover handlers for Internet Explorer', () => {
      createDivForInternetExplorer();
      addMouseoverHandler();
      addClickHandler();
    });
    it('When div is clicked', clickOnDiv);
    it('And mouseover handler is removed', removeMouseoverHandler);
    it('And div is clicked again', clickOnDiv);
    it('Then count should have value 2', assertCountValue(2));

    after(removeDiv);
  });
});

describe(`Element testing event handlers for addEventListener present`, () => {
  describe('Element click event should increment count on a Webkit Browser', () => {
    it('Given a div element has been created with click handler for a Webkit Browser', () => {
      createDivForWebkit();
      addClickHandler();
    });
    it('When div is clicked', clickOnDiv);
    it('Then count should have value 1', assertCountValue(1));

    after(removeDiv);
  });

  describe('Element click handler listener should increment count on a Webkit Browser', () => {
    it('Given a div element has been created with click listener for a Webkit Browser', () => {
      createDivForWebkit();
      addClickListener();
    });
    it('When div is clicked', clickOnDiv);
    it('Then count should have value 1', assertCountValue(1));

    after(removeDiv);
  });

  describe('Element active handlers should remain after removing on specific handler on a Webkit Browser', () => {
    it('Given a div element has been created with click and mouseover handlers for a Webkit Browser', () => {
      createDivForWebkit();
      addMouseoverHandler();
      addClickHandler();
    });
    it('When div is clicked', clickOnDiv);
    it('And mouseover handler is removed', removeMouseoverHandler);
    it('And div is clicked again', clickOnDiv);
    it('Then count should have value 2', assertCountValue(2));

    after(removeDiv);
  });
});


text:
using namespace jam;

// *****************************************************************************
// Constants
// *****************************************************************************

// *****************************************************************************
// Public Methods
// *****************************************************************************

CCamera3DPtr CCamera3D::Create(float _fov, float _near, float _far)
{
    CCamera3DPtr camera(new CCamera3D(_fov, _near, _far));

    CTransformationComponentPtr transformComponent(new CTransformationComponent());

    CTransform3Df transform = transformComponent->Transform(CTransformationComponent::Local);
    transform.Position(glm::vec3(0.0f, 0.0f, -10.0f));
    transformComponent->AddTransform(CTransformationComponent::Local, transform);

    camera->Initialize("camera3d", { transformComponent });

    return camera;
}

CCamera3D::CCamera3D(float _fov, float _near, float _far)
    : ICamera()
    , m_FOV(_fov)
    , m_Near(std::max(0.01f, _near))
    , m_Far(_far)
    , m_ProjectionMatrix()
    , m_FrameBuffer()
{
}

CCamera3D::~CCamera3D()
{
}

glm::mat4x4 CCamera3D::ProjectionMatrix(uint64_t frameBufferIndex)
{
    CTransform3Df resultTransform;
    Get<CTransformationComponent>([&](CTransformationComponentPtr transformComponent) {
        transformComponent->UpdateAbsoluteTransform();
        resultTransform = transformComponent->AbsoluteTransformation();
    });

    frameBufferIndex = std::min<uint64_t>(frameBufferIndex, m_FrameBuffer.size());
    if (frameBufferIndex >= m_FrameBuffer.size()) {
        return glm::mat4(1.0);
    }
    return m_ProjectionMatrix[frameBufferIndex] * resultTransform();
}

IFrameBufferPtr CCamera3D::FrameBuffer(uint64_t frameBufferIndex) const
{
    frameBufferIndex = std::min<uint64_t>(frameBufferIndex, m_FrameBuffer.size());
    if (frameBufferIndex >= m_FrameBuffer.size()) {
        return nullptr;
    }
    return m_FrameBuffer[frameBufferIndex];
}

void CCamera3D::FrameBuffer(IFrameBufferPtr frameBuffer, uint64_t frameBufferIndex)
{
    assert("Framebuffer's dimensions cannot be zero" && frameBuffer->Width() > 0 &&  frameBuffer->Height() > 0);

    if (!frameBuffer) {
        if (frameBufferIndex < m_FrameBuffer.size()) {
            m_FrameBuffer.erase(m_FrameBuffer.begin() + frameBufferIndex);
            m_ProjectionMatrix.erase(m_ProjectionMatrix.begin() + frameBufferIndex);
        }
        return;
    }

    float koeff = static_cast<float>(frameBuffer->Width()) / static_cast<float>(frameBuffer->Height());
    glm::mat4 perspective = glm::perspective(glm::radians(m_FOV),
                                             koeff,
                                             m_Near, m_Far);
    frameBufferIndex = std::min<uint64_t>(frameBufferIndex, m_FrameBuffer.size());
    if (frameBufferIndex >= m_FrameBuffer.size()) {
        m_FrameBuffer.push_back(frameBuffer);
        m_ProjectionMatrix.push_back(perspective);
    } else {
        m_FrameBuffer[frameBufferIndex] = frameBuffer;
        m_ProjectionMatrix[frameBufferIndex] = perspective;
    }
}

uint64_t CCamera3D::FrameBufferCount() const
{
    return m_FrameBuffer.size();
}

void CCamera3D::FlipY()
{
    // TODO:
}

void CCamera3D::FlipX()
{
    // TODO:
}

// *****************************************************************************
// Protected Methods
// *****************************************************************************

// *****************************************************************************
// Private Methods
// *****************************************************************************


text:
package skiis2

import java.util.concurrent.Executors
import org.scalatest.WordSpec
import org.scalatest.matchers.ShouldMatchers
import scala.collection._
import java.util.concurrent.atomic.AtomicInteger

@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class ParFlatMapSuite extends WordSpec with ShouldMatchers {
  import Skiis._

  val r = new scala.util.Random // thread-safe

  "Skiis" should {
    val context = Skiis.newContext("ParMapSuite", parallelism = 4, queue = 100, batch = 1)

    def randomInt(x: Int): Int = {
      math.abs(r.nextInt % x)
    }

    val tortureLevel = Option(System.getenv("TORTURE")) map (_.toInt) getOrElse 1

    for (loop <- 1 to tortureLevel) {
      s"parFlatMap followed by grouped - loop $loop" in {
      val acc = new java.util.concurrent.atomic.AtomicInteger()
      val ctx2 = Skiis.newContext("ParMapSuite2", parallelism = 3, queue = 10, batch = 2)
      Skiis(1 to 999)
         .parFlatMap { x =>
           if (randomInt(10) % 5 == 0) {
             Thread.sleep(randomInt(3));
             Skiis(Seq.fill(10)(x))
           } else {
             Skiis.empty
           }
         }(context)
         .grouped(7)
         .parForeach { xs => xs foreach { x => acc.addAndGet(x) }; Thread.sleep(randomInt(3))   }(ctx2)
      }
    }
  }
}


text:
package com.palantir.atlasdb.persister;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Throwables;
import com.palantir.atlasdb.persist.api.Persister;
import java.io.IOException;

/**
 * A {@link Persister} that uses an {@link ObjectMapper} to serialize and deserialize objects
 * of type {@code T}.
 */
public abstract class JacksonPersister<T> implements Persister<T> {

    private final Class<T> typeRef;
    private final ObjectMapper mapper;

    public JacksonPersister(Class<T> typeRef, ObjectMapper mapper) {
        this.typeRef = typeRef;
        this.mapper = mapper;
    }

    @Override
    public final T hydrateFromBytes(byte[] input) {
        try {
            return mapper.readValue(input, typeRef);
        } catch (IOException e) {
            throw Throwables.propagate(e);
        }
    }

    @Override
    public final byte[] persistToBytes(T value) {
        try {
            return mapper.writeValueAsBytes(value);
        } catch (JsonProcessingException e) {
            throw Throwables.propagate(e);
        }
    }

    @Override
    public final Class<T> getPersistingClassType() {
        return typeRef;
    }
}


text:
package ruby;

import hudson.model.Hudson;
import hudson.model.Items;
import hudson.util.XStream2;
import jenkins.model.Jenkins;
import org.jenkinsci.jruby.JRubyMapper;
import org.jenkinsci.jruby.JRubyXStream;
import org.jruby.CompatVersion;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.ScriptingContainer;

/**
 * Builds and holds on to {@link ScriptingContainer}.
 *
 *

 * This is so that we can relatively painlessly switch to multi-scriptingcontainer implementation.
 *
 * @author Kohsuke Kawaguchi
 */
public class ScriptingContainerHolder {
    /**
     * The unique JRuby environment used by this plugin and all the objects
     * and classes that it contains.
     */
    public final ScriptingContainer ruby;

    /**
     * Initializes this plugin by setting up the JRuby scripting container
     * and then loading up the ruby side of the plugin by creating an
     * instance of the Ruby class Jenkins::Plugin which will serve as
     * its agent in the Ruby world.
     *

     * We also register xstream mappers for JRuby objects so that they
     * can be persisted along with other objects in Jenkins.
     */
    public ScriptingContainerHolder() {
        this.ruby = new ScriptingContainer(LocalContextScope.SINGLETHREAD);
        this.ruby.setCompatVersion(CompatVersion.RUBY1_9);
        this.ruby.setClassLoader(Jenkins.getInstance().pluginManager.uberClassLoader);
    }

    private void register(XStream2 xs, ScriptingContainer ruby) {
        JRubyXStream.register(xs, ruby);
        synchronized (xs) {
            xs.setMapper(new JRubyMapper(xs.getMapperInjectionPoint()));
        }
    }
}


text:
package im.actor.messenger.app.view;

import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;

import im.actor.messenger.app.util.Screen;

/**
 * Created by ex3ndr on 25.03.14.
 */
public class TypingDrawable extends Drawable {

    private static final int DURATION = 600;
    private static final int ANIMATION_DELTA = 800;
    private static final int ANIMATION_OFFSET = DURATION / 3;

    private static final int OFFSET = 1;
    private static final int RADIUS = 3;
    private static final int DIAMETER = RADIUS * 2;
    private static final int PADDING = 3;

    private Paint paint;

    private int height;

    public TypingDrawable() {
        height = Screen.dp(DIAMETER);
        paint = new Paint();
        paint.setColor(0xffdae1ea);
        paint.setStyle(Paint.Style.FILL);
        paint.setAntiAlias(true);
    }

    @Override
    public int getIntrinsicWidth() {
        return Screen.dp(((DIAMETER + OFFSET) * 3 + PADDING));
    }

    @Override
    public int getIntrinsicHeight() {
        return height;
    }

    private float process(int offset) {
        long time = (System.currentTimeMillis() + offset) % (DURATION + ANIMATION_DELTA);
        if (time > DURATION) {
            return 0;
        }
        float p = time / (float) (DURATION);
        return (float) Math.abs(Math.sin(Math.PI * p));
    }

    @Override
    public void draw(Canvas canvas) {
        float size1 = 0.7f + (0.3f * process(ANIMATION_OFFSET * 2));
        float size2 = 0.7f + (0.3f * process(ANIMATION_OFFSET));
        float size3 = 0.7f + (0.3f * process(0));
        Rect bounds = getBounds();
        int top = ((getBounds().height() - Screen.dp(DIAMETER)) / 2) + bounds.top;
        canvas.drawCircle(Screen.dp(RADIUS), Screen.dp(RADIUS) + top, size1 * Screen.dp(RADIUS), paint);
        canvas.drawCircle(Screen.dp(RADIUS + DIAMETER + OFFSET), Screen.dp(RADIUS) + top, size2 * Screen.dp(RADIUS), paint);
        canvas.drawCircle(Screen.dp(RADIUS + (DIAMETER + OFFSET) * 2), Screen.dp(RADIUS) + top, size3 * Screen.dp(RADIUS), paint);
        invalidateSelf();
    }

    @Override
    public void setAlpha(int alpha) {

    }

    @Override
    public void setColorFilter(ColorFilter cf) {

    }

    @Override
    public int getOpacity() {
        return 0;
    }
}


text:
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.

#include <boost/algorithm/string.hpp>
#include <boost/interprocess/ipc/message_queue.hpp>
#include <boost/tokenizer.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

using namespace boost::interprocess;
using namespace boost::posix_time;
using namespace boost;
using namespace std;

#include <coin/util.h>

void ipcShutdown()
{
//    message_queue::remove("BitcoinURL");
}

void ipcThread(void* parg)
{/*
    message_queue* mq = (message_queue*)parg;
    char strBuf[257];
    size_t nSize;
    unsigned int nPriority;
    loop
    {
        ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100);
        if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d))
        {
            ThreadSafeHandleURL(std::string(strBuf, nSize));
            Sleep(1000);
        }
        if (fShutdown)
        {
            ipcShutdown();
            break;
        }
    }
    ipcShutdown();
*/}

void ipcInit()
{/*
    message_queue* mq;
    char strBuf[257];
    size_t nSize;
    unsigned int nPriority;
    try {
        mq = new message_queue(open_or_create, "BitcoinURL", 2, 256);

        // Make sure we don't lose any bitcoin: URIs
        for (int i = 0; i < 2; i++)
        {
            ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1);
            if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d))
            {
                ThreadSafeHandleURL(std::string(strBuf, nSize));
            }
            else
                break;
        }

        // Make sure only one bitcoin instance is listening
        message_queue::remove("BitcoinURL");
        mq = new message_queue(open_or_create, "BitcoinURL", 2, 256);
    }
    catch (interprocess_exception &ex) {
        return;
    }
    if (!CreateThread(ipcThread, mq))
    {
        delete mq;
    }
*/}


text:
/*
  Handles functions related to community api.
*/
(function() {
  'use strict';

  angular
    .module('vtPortal')
    .factory('CommunityService', CommunityService);

  CommunityService.$inject = ['$location', '$q', '$http', '$rootScope', 'APIService'];

  function CommunityService($location, $q, $http, $rootScope, APIService) {
    var service = {};

    service.getFirstTopicByLabel = getFirstTopicByLabel;
    service.getFirstTopicByLabels = getFirstTopicByLabels;
    service.getFirstPostByLabel = getFirstPostByLabel;
    service.getFirstPostByLabels = getFirstPostByLabels;
    service.isMember = isMember;
    service.getMemberId = getMemberId;
    service.isAdmin = isAdmin;
    service.addGravatarProfileInfoToPosts = addGravatarProfileInfoToPosts;
    service.addGravatarProfileInfoToPost = addGravatarProfileInfoToPost;
    service.setHasVotedToPost = setHasVotedToPost;
    service.setHasVotedToPosts = setHasVotedToPosts;
    service.redirectToTopic = redirectToTopic;

    return service;

    function getFirstTopicByLabel(label, forumId, categoryId) {
      return getFirstByLabel(label, forumId, categoryId, false);
    }

    function getFirstTopicByLabels(labels, forumId, categoryId) {
      return getFirstByLabels(labels, forumId, categoryId, false);
    }

    function getFirstPostByLabel(label, forumId, categoryId) {
      return getFirstByLabel(label, forumId, categoryId, true);
    }

    function getFirstPostByLabels(labels, forumId, categoryId) {
      return getFirstByLabels(labels, forumId, categoryId, true);
    }

    /* Retrieve the first topic or post with a specific label */
    function getFirstByLabel(label, forumId, categoryId, isPost) {
      var deferred = $q.defer();

      APIService.communityCall(isPost ? 'postsGet' : 'topicsGet', [label, null, null, 100])
        .then(function topicsGetResponse(response) {
          if (response.status === 200) {

            for (var i = 0; i < response.data.length; i++) {

              if (!forumId && !categoryId) {
                break;
              } else if (response.data[i].forumId === parseInt(forumId) || response.data[i].categoryId === parseInt(categoryId)) {
                break;
              }

            }
            deferred.resolve({
              label: label,
              data: (i < response.data.length) ? response.data[i] : {}
            });
          } else {
            errorResponse(response.status, 'Problem att hämta topic', deferred);
          }
        })
        .catch(function(err) {
          errorResponse(err.status, 'Problem att hämta topic', deferred);
        });

      return deferred.promise;
    }

    /* Retrieves the first post for a list of labels
     * The result is a combined object with all labels as keys
     */
    function getFirstByLabels(labels, forumId, categoryId, isPosts) {
      var deferred = $q.defer();

      var combinedResponse = {};
      var numberOfErrors = 0;

      for (var i = 0; i < labels.length; i++) {
        getFirstByLabel(labels[i], forumId, categoryId, isPosts)
          .then(getFirstByLabelResponse)
          .catch(function(err) {
            numberOfErrors++;

            /* Check if all promises failed or if all are done */
            if (numberOfErrors === labels.length) {
              errorResponse(404, 'Inga topics funna för labels ' + labels + ' och forumId ' + forumId + ' eller categoryId ' + categoryId, deferred);
            } else if (Object.keys(combinedResponse).length + numberOfErrors === labels.length) {
              deferred.resolve(combinedResponse);
            }
          });
      }

      function getFirstByLabelResponse(response) {
        combinedResponse[response.label] = response.data;

        /* Check if all promises has completed */
        if (Object.keys(combinedResponse).length + numberOfErrors === labels.length) {
          deferred.resolve(combinedResponse);
        }
      }

      return deferred.promise;
    }

    function isMember() {
      try {
        return $rootScope.globals.currentUser.memberId && $rootScope.user.loggedIn ? true : false;
      } catch (err) {
        return false;
      }
    }

    function isAdmin() {
      try {
        return $rootScope.globals.currentUser.role === 'community-admin' ? true : false;
      } catch (err) {
        return false;
      }
    }

    function getMemberId() {
      try {
        return $rootScope.globals.currentUser.memberId;
      } catch (err) {
        return -1;
      }
    }

    function errorResponse(status, message, deferred) {

      var response = {
        status: status,
        message: message
      };

      deferred.reject(response);
    }

    function addGravatarProfileInfoToPost(post) {

      post.createdBy.gravatarProfileInfo = {};

      if (post.createdBy.useGravatar) {
        var profileUrl = 'https://www.gravatar.com/' + post.createdBy.gravatarEmailHash + '.json?callback=JSON_CALLBACK';
        $http.jsonp(profileUrl).then(function(success) {
            if (Array.isArray(success.data.entry) && success.data.entry.length > 0) {
              post.createdBy.gravatarProfileInfo.name = success.data.entry[0].name.formatted;
              post.createdBy.gravatarProfileInfo.bioHTML = '';

              if (success.data.entry[0].aboutMe != null) {
                post.createdBy.gravatarProfileInfo.bioHTML = success.data.entry[0].aboutMe + '
';
              }

              if (success.data.entry[0].currentLocation != null) {
                post.createdBy.gravatarProfileInfo.bioHTML = post.createdBy.gravatarProfileInfo.bioHTML + success.data.entry[0].currentLocation + '
';
              }

              post.createdBy.gravatarProfileInfo.bioHTML = post.createdBy.gravatarProfileInfo.bioHTML + '
';

            }
          })
          .catch(function(error) {
            post.createdBy.gravatarProfileInfo.name = post.createdBy.signature;
            post.createdBy.gravatarProfileInfo.bioHTML = '';
          });
      } else {
        post.createdBy.gravatarProfileInfo.name = post.createdBy.signature;
        post.createdBy.gravatarProfileInfo.bioHTML = '';
      }

    }

    /* Cycles through all users and retrieves their gravatar profile info if available. Info is added to json object for createdBy */
    function addGravatarProfileInfoToPosts(posts) {

      angular.forEach(posts, function(value, key) {
        addGravatarProfileInfoToPost(value);
      });

    }

    function setHasVotedToPost(post) {

      if ($rootScope.user.loggedIn) {
        post.hasVoted = false;

        for (var i = 0; i < post.votes.length; i++) {
          if (post.votes[i].memberId === $rootScope.globals.currentUser.memberId) {
            post.hasVoted = true;
            break;
          }
        }
      }

    }

    function setHasVotedToPosts(posts) {

      angular.forEach(posts, function(value, key) {
        setHasVotedToPost(value);
      });
    }

    function redirectToTopic(topicId) {
      $location.path('/community/topic/' + topicId);
    }

  }

})();


text:
package auth_test

import (
	"testing"

	"golang.org/x/crypto/bcrypt"
)

var password = []byte("sorta long password")

func Benchmark_Bcrypt_Cost_Min(b *testing.B) {
	// NOTE: Min == 4
	for i := 0; i < b.N; i++ {
		bcrypt.GenerateFromPassword(password, bcrypt.MinCost)
	}
}
func Benchmark_Bcrypt_Cost_Default(b *testing.B) {
	// NOTE: Default == 10
	for i := 0; i < b.N; i++ {
		bcrypt.GenerateFromPassword(password, bcrypt.DefaultCost)
	}
}
func Benchmark_Bcrypt_Cost_11(b *testing.B) {
	for i := 0; i < b.N; i++ {
		bcrypt.GenerateFromPassword(password, 11)
	}
}
func Benchmark_Bcrypt_Cost_12(b *testing.B) {
	for i := 0; i < b.N; i++ {
		bcrypt.GenerateFromPassword(password, 12)
	}
}
func Benchmark_Bcrypt_Cost_13(b *testing.B) {
	for i := 0; i < b.N; i++ {
		bcrypt.GenerateFromPassword(password, 13)
	}
}
func Benchmark_Bcrypt_Cost_14(b *testing.B) {
	for i := 0; i < b.N; i++ {
		bcrypt.GenerateFromPassword(password, 14)
	}
}


text:
#include <aws/fms/model/ListProtocolsListsRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::FMS::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

ListProtocolsListsRequest::ListProtocolsListsRequest() :
    m_defaultLists(false),
    m_defaultListsHasBeenSet(false),
    m_nextTokenHasBeenSet(false),
    m_maxResults(0),
    m_maxResultsHasBeenSet(false)
{
}

Aws::String ListProtocolsListsRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_defaultListsHasBeenSet)
  {
   payload.WithBool("DefaultLists", m_defaultLists);

  }

  if(m_nextTokenHasBeenSet)
  {
   payload.WithString("NextToken", m_nextToken);

  }

  if(m_maxResultsHasBeenSet)
  {
   payload.WithInteger("MaxResults", m_maxResults);

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection ListProtocolsListsRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSFMS_20180101.ListProtocolsLists"));
  return headers;

}


text:
package com.cmu.scout.ui;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import com.cmu.scout.R;
import com.cmu.scout.fragment.DisplayAutoFragment;
import com.cmu.scout.fragment.DisplayMainFragment;
import com.cmu.scout.fragment.DisplayScoutOneFragment;
import com.cmu.scout.fragment.DisplayScoutTwoFragment;
import com.cmu.scout.fragment.DisplayTeleOpFragment;
import com.viewpagerindicator.PageIndicator;
import com.viewpagerindicator.TabPageIndicator;
import com.viewpagerindicator.TitleProvider;

public class DisplayPagerActivity extends SherlockFragmentActivity
		implements OnTeamSelectedListener {

//	private static final String TAG = "DisplayPagerActivity";
//	private static final boolean DEBUG = true;

	private DisplayFragmentAdapter mAdapter;
	private ViewPager mPager;
	private PageIndicator mIndicator;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
//		if (DEBUG) Log.v(TAG, "+++ ON CREATE +++");
		setContentView(R.layout.display_teams_pager);

	    // enable "up" navigation
		final ActionBar actionBar = getSupportActionBar();
		if (actionBar != null) {
			actionBar.setDisplayHomeAsUpEnabled(true);
			actionBar.setTitle(R.string.display_title);
		}

		mAdapter = new DisplayFragmentAdapter(getSupportFragmentManager());

		mPager = (ViewPager)findViewById(R.id.display_pager);
		mPager.setAdapter(mAdapter);

		mIndicator = (TabPageIndicator)findViewById(R.id.display_indicator);
		mIndicator.setViewPager(mPager);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch(item.getItemId()) {
		case android.R.id.home:
			// go to home screen when app icon in action bar is clicked
			Intent intent = new Intent(this, DashboardActivity.class);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        	startActivity(intent);
        	return true;
		}
		return super.onOptionsItemSelected(item);
	}

	public void onTeamEdit(Uri uri) {
		final Intent data = new Intent(this, HoneyCombTeamInputActivity.class);
		data.setData(uri);
		startActivity(data);
	}

	@Override
	public void onTeamSelected(Uri uri) {
		final Intent i = new Intent(this, DisplayPagerMatchesActivity.class);
		i.setData(uri);
		startActivity(i);
	}

	public static class DisplayFragmentAdapter extends FragmentPagerAdapter
			implements TitleProvider {

//		private static final String TAG = "DisplayFragmentAdapter";
//		private static final boolean DEBUG = false;

		public static final int POSITION_MAIN = 0;
		public static final int POSITION_AUTO = 1;
		public static final int POSITION_TELEOP = 2;
		public static final int POSITION_SCOUT_ONE = 3;
		public static final int POSITION_SCOUT_TWO = 4;

		private static final String[] TITLES = new String[] {
			"Main",
			"Autonomous",
			"TeleOp",
			"Team-scout (1)",
			"Team-scout (2)"
		};

		private int mCount = TITLES.length;

		public DisplayFragmentAdapter(FragmentManager fm) {
			super(fm);
//			if (DEBUG) Log.v(TAG, "DisplayFragmentAdapter()");
		}

		@Override
		public Fragment getItem(int position) {
//			if (DEBUG) Log.v(TAG, "getItem()");
			switch (position) {
			case POSITION_MAIN: return DisplayMainFragment.newInstance();
			case POSITION_AUTO: return DisplayAutoFragment.newInstance();
			case POSITION_TELEOP: return DisplayTeleOpFragment.newInstance();
			case POSITION_SCOUT_ONE: return DisplayScoutOneFragment.newInstance();
			case POSITION_SCOUT_TWO: return DisplayScoutTwoFragment.newInstance();
			}
			return null;
		}

		@Override
		public int getCount() {
//			if (DEBUG) Log.v(TAG, "getCount()");
			return mCount;
		}

		@Override
		public String getTitle(int position) {
//			if (DEBUG) Log.v(TAG, "getTitle()");
			return TITLES[position % TITLES.length].toUpperCase();
		}
	}
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="http://getbootstrap.com/favicon.ico">

    <title>{% block title %}Welcome to STU fleamarket!{% endblock %}</title>

    <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="http://getbootstrap.com/examples/dashboard/dashboard.css" rel="stylesheet">

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

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

          </button>
          STU Flea Market

Home

                    {% if user.is_authenticated %}

About

Logout

{{ user_profile.user.username }}

                    {% else %}

Register Here

Login

                    {% endif %}

            {% for message in messages %}

发送者:{{ message.sender }}

发送内容:{{ message.content }}

发送时间:{{ message.send_time }}

            {% endfor %}


text:
module Azure::Compute::Mgmt::V2019_03_01
  module Models
    #
    # Information about the number of virtual machine instances in each upgrade
    # state.
    #
    class RollingUpgradeProgressInfo

      include MsRestAzure

      # @return [Integer] The number of instances that have been successfully
      # upgraded.
      attr_accessor :successful_instance_count

      # @return [Integer] The number of instances that have failed to be
      # upgraded successfully.
      attr_accessor :failed_instance_count

      # @return [Integer] The number of instances that are currently being
      # upgraded.
      attr_accessor :in_progress_instance_count

      # @return [Integer] The number of instances that have not yet begun to be
      # upgraded.
      attr_accessor :pending_instance_count

      #
      # Mapper for RollingUpgradeProgressInfo class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'RollingUpgradeProgressInfo',
          type: {
            name: 'Composite',
            class_name: 'RollingUpgradeProgressInfo',
            model_properties: {
              successful_instance_count: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'successfulInstanceCount',
                type: {
                  name: 'Number'
                }
              },
              failed_instance_count: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'failedInstanceCount',
                type: {
                  name: 'Number'
                }
              },
              in_progress_instance_count: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'inProgressInstanceCount',
                type: {
                  name: 'Number'
                }
              },
              pending_instance_count: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'pendingInstanceCount',
                type: {
                  name: 'Number'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
package io.netty.handler.codec.mqtt;

/**
 * See MQTTV3.1/connect
 */
public final class MqttConnectMessage extends MqttMessage {

    public MqttConnectMessage(
            MqttFixedHeader mqttFixedHeader,
            MqttConnectVariableHeader variableHeader,
            MqttConnectPayload payload) {
        super(mqttFixedHeader, variableHeader, payload);
    }

    @Override
    public MqttConnectVariableHeader variableHeader() {
        return (MqttConnectVariableHeader) super.variableHeader();
    }

    @Override
    public MqttConnectPayload payload() {
        return (MqttConnectPayload) super.payload();
    }
}


text:
HRESULT Library_corlib_native_System_Array::System_Collections_IList_get_Item___OBJECT__I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    CLR_RT_HeapBlock& thisRef = stack.ThisRef();
    int               index   = stack.Arg1().NumericByRef().s4;

    CLR_RT_HeapBlock  ref; NANOCLR_CHECK_HRESULT(ref.InitializeArrayReference( thisRef, index ));

    {
        CLR_RT_HeapBlock& top = stack.PushValueAndClear();

        NANOCLR_CHECK_HRESULT(top.LoadFromReference    ( ref ));
        NANOCLR_CHECK_HRESULT(top.PerformBoxingIfNeeded(     ));
    }

    NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_Array::System_Collections_IList_set_Item___VOID__I4__OBJECT( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    CLR_RT_HeapBlock& thisRef = stack.ThisRef();
    int               index   = stack.Arg1().NumericByRef().s4;

    CLR_RT_HeapBlock  ref; NANOCLR_CHECK_HRESULT(ref.InitializeArrayReference( thisRef, index ));

    NANOCLR_SET_AND_LEAVE(stack.Arg2().StoreToReference( ref, 0 ));

    NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_Array::get_Length___I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    NANOCLR_CHECK_HRESULT(CLR_Checks::VerifyArrayReference( stack.Arg0() ));

    stack.SetResult_I4( stack.Arg0().DereferenceArray()->m_numOfElements );

    NANOCLR_NOCLEANUP();
}

#if (NANOCLR_REFLECTION == TRUE)

HRESULT Library_corlib_native_System_Array::CreateInstance___STATIC__SystemArray__SystemType__I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    CLR_RT_TypeDef_Instance td;
    CLR_RT_HeapBlock* hbType = stack.Arg0().Dereference();

    NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor( *hbType, td ));

    NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( stack.PushValue(), stack.Arg1().NumericByRefConst().s4, td ));

    NANOCLR_NOCLEANUP();
}

#endif // NANOCLR_REFLECTION

HRESULT Library_corlib_native_System_Array::Copy___STATIC__VOID__SystemArray__I4__SystemArray__I4__I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    NANOCLR_SET_AND_LEAVE(Copy( stack, stack.Arg0(), stack.Arg1().NumericByRef().s4, stack.Arg2(), stack.Arg3().NumericByRef().s4, stack.Arg4().NumericByRef().s4 ));

    NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_Array::Clear___STATIC__VOID__SystemArray__I4__I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    NANOCLR_SET_AND_LEAVE(Clear( stack, stack.Arg0(), stack.Arg1().NumericByRef().s4, stack.Arg2().NumericByRef().s4 ));

    NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_Array::TrySzIndexOf___STATIC__BOOLEAN__SystemArray__I4__I4__OBJECT__BYREF_I4( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    CLR_INT32 start = stack.Arg1().NumericByRefConst().s4;
    CLR_INT32 count = stack.Arg2().NumericByRefConst().s4;
    CLR_INT32 stop  = start + count;

    NANOCLR_SET_AND_LEAVE(TrySzIndexOf( stack, stack.Arg0(), stack.Arg3(), start, stop, true, stack.Arg4() ));

    NANOCLR_NOCLEANUP();
}

//--//

HRESULT Library_corlib_native_System_Array::Clear( CLR_RT_StackFrame& stack, CLR_RT_HeapBlock& arg, int index, int length )
{
    (void)stack;

    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    CLR_RT_HeapBlock_Array* array;
    int                     numElem;

    NANOCLR_CHECK_HRESULT(CLR_Checks::VerifyArrayReference( arg ));

    array    = arg.DereferenceArray();
    numElem  = array->m_numOfElements;

    if(length == -1) length = numElem;

    if(length         < 0       ||
       index          < 0       ||
       length + index > numElem  )
    {
        NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
    }

    NANOCLR_SET_AND_LEAVE(array->ClearElements( index, length ));

    NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_Array::Copy( CLR_RT_StackFrame& stack, CLR_RT_HeapBlock& argSrc, int indexSrc, CLR_RT_HeapBlock& argDst, int indexDst, int length )
{
    (void)stack;

    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    if(length)
    {
        NANOCLR_CHECK_HRESULT(CLR_Checks::VerifyArrayReference( argSrc ));
        NANOCLR_CHECK_HRESULT(CLR_Checks::VerifyArrayReference( argDst ));

        NANOCLR_SET_AND_LEAVE(CLR_RT_HeapBlock_Array::Copy( argSrc.DereferenceArray(), indexSrc, argDst.DereferenceArray(), indexDst, length ));
    }

    NANOCLR_NOCLEANUP();
}

HRESULT Library_corlib_native_System_Array::TrySzIndexOf( CLR_RT_StackFrame& stack, CLR_RT_HeapBlock& argSrc, CLR_RT_HeapBlock& match, int start, int stop, bool fForward, CLR_RT_HeapBlock& retValue )
{
    NATIVE_PROFILE_CLR_CORE();
    NANOCLR_HEADER();

    int index;
    bool fRet;
    CLR_RT_HeapBlock_Array* array = argSrc.DereferenceArray();

    NANOCLR_CHECK_HRESULT(CLR_Checks::VerifyArrayReference( argSrc ));

    NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::IndexOf( array, match, start, stop, fForward, index ));

    _ASSERTE(retValue.DataType() == DATATYPE_BYREF);

    retValue.Dereference()->SetInteger( index );

    fRet = (index >= 0);

    if(array->m_typeOfElement <= DATATYPE_LAST_PRIMITIVE)
    {
        //Primitives do not override Equals, so this check is good enough.
        //If match is not found, index == -1, so the managed Array.IndexOf will
        //skip the more expensive Object.Equals call.

        _ASSERTE(FIMPLIES(!fRet, index == -1));
        fRet = true;
    }

    stack.SetResult_Boolean( fRet );

    NANOCLR_NOCLEANUP();
}


text:
order: 0
title:
  zh-CN: Success
  en-US: Success
---

## zh-CN

成功的结果。

## en-US

Show successful results.

```tsx
import { Button, Result } from 'antd';
import React from 'react';

const App: React.FC = () => (
  <Result
    status="success"
    title="Successfully Purchased Cloud Server ECS!"
    subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
    extra={[
      <Button type="primary" key="console">
        Go Console
      </Button>,
      <Button key="buy">Buy Again</Button>,
    ]}
  />
);

export default App;
```


text:
<?php

namespace BabiPHP\Negotiation\Exception;

class InvalidMediaType extends \RuntimeException implements Exception
{
}


text:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Xlibint.h"

/* precompute the maximum size of batching request allowed */

#define wsize (SIZEOF(xPolyRectangleReq) + WRCTSPERBATCH * SIZEOF(xRectangle))
#define zsize (SIZEOF(xPolyRectangleReq) + ZRCTSPERBATCH * SIZEOF(xRectangle))

int
XDrawRectangle(
    register Display *dpy,
    Drawable d,
    GC gc,
    int x,
    int y, /* INT16 */
    unsigned int width,
    unsigned int height) /* CARD16 */
{
    xRectangle *rect;

    LockDisplay(dpy);
    FlushGC(dpy, gc);

    {
    register xPolyRectangleReq *req = (xPolyRectangleReq *) dpy->last_req;

    /* if same as previous request, with same drawable, batch requests */
    if (
          (req->reqType == X_PolyRectangle)
       && (req->drawable == d)
       && (req->gc == gc->gid)
       && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax)
       && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ?
						  wsize : zsize)) ) {
	 req->length += SIZEOF(xRectangle) >> 2;
         rect = (xRectangle *) dpy->bufptr;
	 dpy->bufptr += SIZEOF(xRectangle);
	 }

    else {
	GetReqExtra(PolyRectangle, SIZEOF(xRectangle), req);
	req->drawable = d;
	req->gc = gc->gid;
	rect = (xRectangle *) NEXTPTR(req,xPolyRectangleReq);
	}

    rect->x = x;
    rect->y = y;
    rect->width = width;
    rect->height = height;

    }
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}


text:
<template name='entrySignUp'>

      {{#if logo}}

      {{/if}}

{{t9n "createAccount"}}

        {{#if otherLoginServices}}

{{t9n "ifYouAlreadyHaveAnAccount"}} {{t9n "signIn"}}.

            {{#each loginServices}}
              {{> entrySocial}}
            {{/each}}
            {{#if passwordLoginService}}

                OR

                  {{t9n "signUpWithYourEmailAddress"}}

            {{/if}}

        {{else}}

{{t9n "ifYouAlreadyHaveAnAccount"}} {{t9n "signIn"}}.

        {{/if}}

        {{> entryError}}

        {{#if passwordLoginService}}
          <form class="ui form segment {{signupClass}}" id="signUp">

            {{#if showUsername}}

                {{t9n "username"}}

                  <input autofocus name="username" type="string" value='' placeholder="">

            {{/if}}

            {{#if showEmail}}

                {{t9n "emailAddress"}}

                {{#if showUsername}}
                  <input type="email" value='{{emailAddress}}'>
                {{else}}
                  <input autofocus type="email" value='{{emailAddress}}'>
                {{/if}}

            {{/if}}

              {{t9n "password"}}

                <input name="password" type="password" value='{{password}}' placeholder="{{t9n 'password'}}">

            {{#if showSignupCode}}

                {{t9n "signupCode"}}
                <input name="signupCode" type="string" value=''>

            {{/if}}

We noticed some issues

            <button type="submit" class="fluid ui secondary submit button">{{t9n "signUp"}}</button>
          </form>
        {{/if}}

        {{#if both}}

{{t9n "clickAgree"}}
            {{t9n "privacyPolicy"}} {{t9n "and"}}
            {{t9n "terms"}}.

        {{else}}
          {{#unless neither}}

{{t9n "clickAgree"}}
              {{#if privacyUrl}}{{t9n "privacyPolicy"}}.{{/if}}
              {{#if termsUrl}}{{t9n "terms"}}.{{/if}}

          {{/unless}}
        {{/if}}

</template>


text:
// @flow
import React from 'react'
import styled from 'styled-components'

import { Super } from '../../typography'

import { myTheme, themedTextColor, themedTextColorRgb } from '../../../styles'
import { addRef, addHash } from './endnotes.service'

type Props = {
  id: string,
  index: number,
}

const { borderRadii, fontSize, space } = myTheme

const StyledSuperLink = styled.a`
  background-color: rgba(${themedTextColorRgb}, 0.1);
  border-radius: ${borderRadii.one};
  color: ${themedTextColor};
  display: inline-block;
  font-size: ${fontSize.eight};
  line-height: 0;
  margin-left: calc(${space.half} / 2);
  position: relative;
  top: -0.5em;

  /*
    Theme Exception:

    Because of how small the footnotes I needed to work at a smaller scale than
    my space scale would allow.
  */
  padding: calc(${space.one} - 0.1rem) calc(${space.half} - 0.05rem);
`

const EndnoteSuperLink = ({ id, index }: Props) => (
  <StyledSuperLink
    aria-describedby="footnote-label"
    href={addHash(id)}
    id={addRef(id)}
  >
    <Super>{index}</Super>
  </StyledSuperLink>
)

export default EndnoteSuperLink


text:
anyenv
===

インストール
---

```
git clone https://github.com/riywo/anyenv ~/.anyenv
echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(anyenv init -)"' >> ~/.bash_profile
```

### pyenv

```
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
```

参考サイト
---

* [https://dev.classmethod.jp/tool/tool-anyenv/](https://dev.classmethod.jp/tool/tool-anyenv/)