text:
title: Avatars
path: components/avatars
status: Stable
source: 'https://github.com/primer/css/tree/main/src/avatars'
bundle: avatars
---

Avatars are images that users can set as their profile picture. On GitHub, they're always going to be rounded squares. They can be custom photos, uploaded by users, or generated as Identicons as a placeholder.

## Basic example

Add `.avatar` to any `<img>` element to make it an avatar. This resets some key styles for alignment, address a Firefox image placeholder bug, and rounds the corners.

Be sure to set `width` and `height` attributes for maximum browser performance.

```html live
<img class="avatar" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=96" width="48" height="48" />
```

### Small avatars

We occasionally use smaller avatars. Anything less than `24px` wide should include the `.avatar-small` modifier class to reset the `border-radius` to a more appropriate level.

```html live
<img class="avatar avatar-small" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=40" width="20" height="20" />
```

### Avatar sizes

Instead of using the `width` and `height` attribute, you can also use a class like `.avatar-[1-8]`. The sizes go from `16px` up to `64px`. Note: Avatar stacks are only supported for the `20px` avatar size.

```html live
<img class="avatar avatar-1 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=32" />
<img class="avatar avatar-2 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=40" />
<img class="avatar avatar-3 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=48" />
<img class="avatar avatar-4 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=56" />
<img class="avatar avatar-5 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=64" />
<img class="avatar avatar-6 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=80" />
<img class="avatar avatar-7 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=96" />
<img class="avatar avatar-8 mr-2" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=128" />
```

### Parent-child avatars

When you need a larger parent avatar, and a smaller child one, overlaid slightly, use the parent-child classes.

```html live
<div class="avatar-parent-child d-inline-flex">
  <img class="avatar" alt="jonrohan" src="https://github.com/jonrohan.png?v=3&s=96" width="48" height="48" />
  <img class="avatar avatar-child" alt="josh" src="https://github.com/josh.png?v=3&s=40" width="20" height="20" />
</div>
```

### Avatar stack

Stacked avatars can be used to show multiple collaborators or participants when there is limited space available. When you hover over the stack, the avatars will reveal themselves.

```html live
<div class="AvatarStack AvatarStack--three-plus">
  <div
    class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1"
    aria-label="octocat, octocat, and octocat"
  >
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
  </div>
</div>
```

Based on the number of avatars in the stack, add these modifier classes:

- `AvatarStack--two` for 2 avatars.
- `AvatarStack--three-plus` for 3 or more avatars.

If you have more than three avatars, add a div with the classes `avatar avatar-more` as the third avatar in the stack, as such:

```html live
<div class="AvatarStack AvatarStack--three-plus">
  <div
    class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1"
    aria-label="octocat, octocat, octocat, octocat, and octocat"
  >
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <div class="avatar avatar-more"></div>
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
  </div>
</div>
```

You can also link individual avatars. To do this shift the `avatar` class over to the anchor:

```html live
<div class="AvatarStack AvatarStack--two">
  <div class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1" aria-label="octocat and octocat">
    <a href="#" class="avatar">
      <img
        height="20"
        alt="@octocat"
        src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
        width="20"
      />
    </a>
    <a href="#" class="avatar">
      <img
        height="20"
        alt="@octocat"
        src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
        width="20"
      />
    </a>
  </div>
</div>
```

Use `AvatarStack--right` to right-align the avatar stack. Remember to switch the alignment of tooltips when making this change.

```html live
<div class="AvatarStack AvatarStack--three-plus AvatarStack--right">
  <div
    class="AvatarStack-body tooltipped tooltipped-sw tooltipped-align-right-1"
    aria-label="octocat, octocat, and octocat"
  >
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
    <img
      class="avatar"
      height="20"
      alt="@octocat"
      src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png"
      width="20"
    />
  </div>
</div>
```

## Circle badge

`.CircleBadge` allows for the display of badge-like icons or logos. They are used mostly with Octicons or partner integration icons.

`.CircleBadge` should have an `aria-label`, `title` (for a link), or an `alt` (for child `img` elements) attribute specified if there is no text-based alternative to describe it. If there is a text-based alternative or the icon has no semantic value, `aria-hidden="true"` or an empty `alt` attribute may be used.

### Small

```html live
<a class="CircleBadge CircleBadge--small float-left mr-2" href="#small">
  <img src="https://github.com/travis-ci.png"  class="CircleBadge-icon" alt="">
</a>
<a class="CircleBadge CircleBadge--small color-bg-done-muted" href="#small">
  <!-- <%= octicon "zap",  class: "CircleBadge-icon color-fg-default" %> -->
  <svg class="CircleBadge-icon color-fg-default octicon octicon-zap" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 7H6l3-7-9 9h4l-3 7 9-9z"></path></svg>
</a>
```

### Medium

```html live
<div class="CircleBadge CircleBadge--medium color-bg-subtle">
  <img src="https://github.com/travis-ci.png" alt="Travis CI" class="CircleBadge-icon" />
</div>
```

### Large

```html live
<div class="CircleBadge CircleBadge--large">
  <img src="https://github.com/travis-ci.png" alt="Travis CI" class="CircleBadge-icon" />
</div>
```

### Dashed connection

For specific cases where two badges or more need to be shown as related or connected (such as integrations or specific product workflows), a `DashedConnection` class was created. Use utility classes to ensure badges are spaced correctly.

```html live
<div class="DashedConnection">
  <ul class="d-flex list-style-none flex-justify-between" aria-label="A sample GitHub workflow">
    <li class="CircleBadge CircleBadge--small" aria-label="GitHub">
      <!-- <%= octicon "mark-github", class: "width-full height-full" %> -->
      <svg class="octicon octicon-mark-github width-full height-full" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
    </li>

    <li class="CircleBadge CircleBadge--small" aria-label="Slack">
        <img src="https://github.com/slackhq.png"  alt="" class="CircleBadge-icon">
    </li>

    <li class="CircleBadge CircleBadge--small" aria-label="Travis CI">
        <img src="https://github.com/travis-ci.png"  alt="" class="CircleBadge-icon">
    </li>
  </ul>
</div>
```


text:
package org.apache.geode.internal.cache.persistence;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Inspects a completed backup and parses the operation log file data from the restore script
 * produced by a previous backup.
 */
public abstract class BackupInspector {
  /**
   * Maps operation log file names to script lines that copy previously backed up operation log
   * files. These lines will be added to future restore scripts if the operation logs are still
   * relevant to the member.
   */
  protected Map<String, String> oplogLineMap = new HashMap<String, String>();

  /**
   * Contains the unique set of operation log file names contained in the restore script.
   */
  protected Set<String> oplogFileNames = new HashSet<String>();

  /**
   * Root directory for a member's backup.
   */
  protected File backupDir = null;

  /**
   * Returns a BackupInspector for a member's backup directory.
   *
   * @param backupDir a member's backup directory.
   * @return a new BackupInspector.
   * @throws IOException the backup directory was malformed.
   */
  public static BackupInspector createInspector(File backupDir) throws IOException {
    if (isWindows()) {
      return new WindowsBackupInspector(backupDir);
    }

    return new UnixBackupInspector(backupDir);
  }

  /**
   * Creates a new BackupInspector.
   *
   * @param backupDir a a previous backup for a member.
   * @throws IOException an error occurred while parsing the restore script.
   */
  public BackupInspector(File backupDir) throws IOException {
    this.backupDir = backupDir;

    if (!backupDir.exists()) {
      throw new IOException("Backup directory " + backupDir.getAbsolutePath() + " does not exist.");
    }

    File restoreFile = getRestoreFile(backupDir);

    if (!restoreFile.exists()) {
      throw new IOException("Restore file " + restoreFile.getName() + " does not exist.");
    }

    BufferedReader reader = null;

    try {
      reader = new BufferedReader(new FileReader(restoreFile));
      parseRestoreFile(reader);
    } finally {
      if (null != reader) {
        reader.close();
      }
    }
  }

  /**
   * Searches for the incremental backup marker.
   *
   * @param reader restore file reader.
   * @throws IOException
   */
  private void parseRestoreFile(BufferedReader reader) throws IOException {
    boolean markerFound = false;
    String line = null;
    String incrementalMarker = getIncrementalMarker();

    while (!markerFound && (null != (line = reader.readLine()))) {
      markerFound = line.startsWith(incrementalMarker);
    }

    if (markerFound) {
      parseOplogLines(reader);
    }
  }

  /**
   * @return true if the host operating system is windows.
   */
  public static boolean isWindows() {
    return (System.getProperty("os.name").indexOf("Windows") != -1);
  }

  /**
   * Returns true if the restore script is incremental.
   */
  public boolean isIncremental() {
    return !this.oplogFileNames.isEmpty();
  }

  /**
   * @return the backup directory being inspected.
   */
  public File getBackupDir() {
    return this.backupDir;
  }

  /**
   * Returns the restore script line that restores a particular operation log file.
   *
   * @param oplogFileName an operation log file.
   */
  public String getScriptLineForOplogFile(String oplogFileName) {
    return this.oplogLineMap.get(oplogFileName);
  }

  /**
   * Returns the set of operation log files copied in the incremental backup section of the restore
   * script.
   */
  public Set<String> getIncrementalOplogFileNames() {
    return Collections.unmodifiableSet(this.oplogFileNames);
  }

  /**
   * @return the incremental marke contained in the backup restore script.
   */
  protected abstract String getIncrementalMarker();

  /**
   * Returns the restore script for the backup.
   *
   * @param backupDir a member's backup directory.
   */
  protected abstract File getRestoreFile(final File backupDir);

  /**
   * Returns the copyTo operation log file path for an operation log file name.
   *
   * @param oplogFileName an operation log file.
   */
  public abstract String getCopyToForOplogFile(String oplogFileName);

  /**
   * Returns the copy from operation log file path for an operation log file name.
   *
   * @param oplogFileName an operation log file.
   */
  public abstract String getCopyFromForOplogFile(String oplogFileName);

  /**
   * Parses out operation log data from the incremental backup portion of the restore script.
   *
   * @param reader restore file reader.
   * @throws IOException
   */
  protected abstract void parseOplogLines(BufferedReader reader) throws IOException;
}

/**
 * A BackupInspector for the Windows platform(s).
 *
 */
class WindowsBackupInspector extends BackupInspector {
  /**
   * When found indicates that the restore script was produced from an incremental backup.
   */
  private static final String INCREMENTAL_MARKER = "rem Incremental backup";

  /**
   * Restore file for windows platform.
   */
  static final String RESTORE_FILE = "restore.bat";

  WindowsBackupInspector(File backupDir) throws IOException {
    super(backupDir);
  }

  @Override
  public String getCopyFromForOplogFile(String oplogFileName) {
    String copyFrom = null;
    String line = this.oplogLineMap.get(oplogFileName);

    if (null != line) {
      String[] parts = line.split("\\s");
      copyFrom = parts[1].substring(1, parts[1].length() - 1) + File.separator + parts[3];
    }

    return copyFrom;
  }

  @Override
  public String getCopyToForOplogFile(String oplogFileName) {
    String copyTo = null;
    String line = this.oplogLineMap.get(oplogFileName);

    if (null != line) {
      String[] parts = line.split("\\s");
      copyTo = parts[2].substring(1, parts[2].length() - 1) + File.separator + parts[3];
    }

    return copyTo;
  }

  @Override
  /**
   * Parses out operation log data from the incremental backup portion of the restore script.
   *
   * @param reader restore file reader.
   * @throws IOException
   */
  protected void parseOplogLines(BufferedReader reader) throws IOException {
    String line = null;

    int beginIndex, endIndex;
    String oplogName = "";
    while (null != (line = reader.readLine())) {

      if (line.startsWith("robocopy")) {
        beginIndex = line.lastIndexOf("\"") + 2;
        endIndex = line.indexOf("/njh", beginIndex) - 1;
        oplogName = line.substring(beginIndex, endIndex);
        this.oplogFileNames.add(oplogName);
        this.oplogLineMap.put(oplogName, line);
      } else if (line.startsWith("IF")) {
        continue;
      } else if (line.contains(RestoreScript.EXIT_MARKER)) {
        break;
      }
    }
  }

  @Override
  protected String getIncrementalMarker() {
    return INCREMENTAL_MARKER;
  }

  @Override
  protected File getRestoreFile(final File backupDir) {
    return new File(backupDir, RESTORE_FILE);
  }
}

/**
 * A BackupInspector for Unix platforms.
 */
class UnixBackupInspector extends BackupInspector {
  /**
   * When found indicates that the restore script was produced from an incremental backup.
   */
  private static final String INCREMENTAL_MARKER = "#Incremental backup";

  /**
   * Restore file for windows platform.
   */
  static final String RESTORE_FILE = "restore.sh";

  UnixBackupInspector(File backupDir) throws IOException {
    super(backupDir);
  }

  @Override
  public String getCopyFromForOplogFile(String oplogFileName) {
    String copyFrom = null;
    String line = this.oplogLineMap.get(oplogFileName);

    if (null != line) {
      String[] parts = line.split("\\s");
      copyFrom = parts[2].substring(1, parts[2].length() - 1);
    }

    return copyFrom;
  }

  @Override
  public String getCopyToForOplogFile(String oplogFileName) {
    String copyTo = null;
    String line = this.oplogLineMap.get(oplogFileName);

    if (null != line) {
      String[] parts = line.split("\\s");
      copyTo = parts[3].substring(1, parts[3].length() - 1);
    }

    return copyTo;
  }

  @Override
  /**
   * Parses out operation log data from the incremental backup portion of the restore script.
   *
   * @param reader restore file reader.
   * @throws IOException
   */
  protected void parseOplogLines(BufferedReader reader) throws IOException {
    String line = null;

    while (null != (line = reader.readLine())) {
      int beginIndex = line.lastIndexOf(File.separator) + 1;
      int endIndex = line.length() - 1;
      String oplogName = line.substring(beginIndex, endIndex);
      this.oplogFileNames.add(oplogName);
      this.oplogLineMap.put(oplogName, line);
    }
  }

  @Override
  protected String getIncrementalMarker() {
    return INCREMENTAL_MARKER;
  }

  @Override
  protected File getRestoreFile(final File backupDir) {
    return new File(backupDir, RESTORE_FILE);
  }
}

redpajama_set_name: RedPajamaGithub


text:
  <title>Spring Transactions | Ebean</title>
  <meta name="layout" content="_layout2/base-docs.html"/>
  <meta name="bread1" content="Transactions" href="/docs/transactions"/>
  <meta name="bread2" content="Spring" href="/docs/transactions/spring"/>
  <#assign n0_docs="active">
  <#assign n1_transactions="active">
  <#assign n2_spring="active">

Spring transactions

  The recommendation is to use Ebean's own transaction management but we can also use
  spring transactions.

  To do so include the dependency:

<dependency>
  <groupId>io.ebean</groupId>
  <artifactId>ebean-spring-txn</artifactId>
  <version>12.1.1</version>
</dependency>

  Set SpringJdbcTransactionManager as an external transaction by:

DatabaseConfig config = new DatabaseConfig();

config.setExternalTransactionManager(new SpringJdbcTransactionManager());

<@next_edit "JTA Transactions" "/docs/transactions/jta" "/docs/transactions/spring.html"/>


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

import static io.netty.handler.codec.http2.Http2TestUtil.runInChannel;
import static io.netty.util.CharsetUtil.UTF_8;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelPromise;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http2.Http2TestUtil.Http2Runnable;
import io.netty.util.NetUtil;

import java.net.InetSocketAddress;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

/**
 * Tests the full HTTP/2 framing stack including the connection and preface handlers.
 */
public class Http2ConnectionRoundtripTest {

    private static final int NUM_STREAMS = 1000;
    private final byte[] DATA_TEXT = "hello world".getBytes(UTF_8);

    @Mock
    private Http2FrameListener clientListener;

    @Mock
    private Http2FrameListener serverListener;

    private DelegatingHttp2ConnectionHandler http2Client;
    private ServerBootstrap sb;
    private Bootstrap cb;
    private Channel serverChannel;
    private Channel clientChannel;
    private final CountDownLatch requestLatch = new CountDownLatch(NUM_STREAMS * 3);
    private CountDownLatch dataLatch = new CountDownLatch(NUM_STREAMS * DATA_TEXT.length);

    @Before
    public void setup() throws Exception {
        MockitoAnnotations.initMocks(this);

        sb = new ServerBootstrap();
        cb = new Bootstrap();

        sb.group(new NioEventLoopGroup(), new NioEventLoopGroup());
        sb.channel(NioServerSocketChannel.class);
        sb.childHandler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                p.addLast(new DelegatingHttp2ConnectionHandler(true, new FrameCountDown()));
                p.addLast(Http2CodecUtil.ignoreSettingsHandler());
            }
        });

        cb.group(new NioEventLoopGroup());
        cb.channel(NioSocketChannel.class);
        cb.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                p.addLast(new DelegatingHttp2ConnectionHandler(false, clientListener));
                p.addLast(Http2CodecUtil.ignoreSettingsHandler());
            }
        });

        serverChannel = sb.bind(new InetSocketAddress(0)).sync().channel();
        int port = ((InetSocketAddress) serverChannel.localAddress()).getPort();

        ChannelFuture ccf = cb.connect(new InetSocketAddress(NetUtil.LOCALHOST, port));
        assertTrue(ccf.awaitUninterruptibly().isSuccess());
        clientChannel = ccf.channel();
        http2Client = clientChannel.pipeline().get(DelegatingHttp2ConnectionHandler.class);
    }

    @After
    public void teardown() throws Exception {
        serverChannel.close().sync();
        sb.group().shutdownGracefully();
        sb.childGroup().shutdownGracefully();
        cb.group().shutdownGracefully();
    }

    @Test
    public void flowControlProperlyChunksLargeMessage() throws Exception {
        final Http2Headers headers =
                new DefaultHttp2Headers.Builder().method("GET").scheme("https")
                        .authority("example.org").path("/some/path/resource2").build();

        // Create a large message to send.
        int length = 10485760; // 10MB

        // Create a buffer filled with random bytes.
        byte[] bytes = new byte[length];
        new Random().nextBytes(bytes);
        final ByteBuf data = Unpooled.wrappedBuffer(bytes);

        // Prepare a receive buffer and populate it as DATA frames are received by the server.
        final ByteBuf receivedData = Unpooled.buffer(length);
        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
                ByteBuf buf = (ByteBuf) invocation.getArguments()[2];
                receivedData.writeBytes(buf);
                return null;
            }
        }).when(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3),
                any(ByteBuf.class), eq(0), anyBoolean());

        // Initialize the data latch based on the number of bytes expected.
        dataLatch = new CountDownLatch(length);

        // Create the stream and send all of the data at once.
        runInChannel(clientChannel, new Http2Runnable() {
            @Override
            public void run() {
                http2Client.writeHeaders(ctx(), 3, headers, 0, (short) 16, false, 0, false,
                        newPromise());
                http2Client.writeData(ctx(), 3, data.copy(), 0, true, newPromise());
            }
        });

        // Wait for all DATA frames to be received at the server.
        assertTrue(dataLatch.await(5, TimeUnit.SECONDS));

        // Verify that headers were received and only one DATA frame was received with endStream set.
        verify(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(3), eq(headers),
                eq(0), eq((short) 16), eq(false), eq(0), eq(false));
        verify(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3),
                any(ByteBuf.class), eq(0), eq(true));

        // Verify we received all the bytes.
        assertEquals(data, receivedData);
    }

    @Test
    public void stressTest() throws Exception {
        final Http2Headers headers =
                new DefaultHttp2Headers.Builder().method("GET").scheme("https")
                        .authority("example.org").path("/some/path/resource2").build();
        final String text = "hello world";
        final String pingMsg = "12345678";
        runInChannel(clientChannel, new Http2Runnable() {
            @Override
            public void run() {
                for (int i = 0, nextStream = 3; i < NUM_STREAMS; ++i, nextStream += 2) {
                    http2Client.writeHeaders(ctx(), nextStream, headers, 0, (short) 16, false, 0,
                            false, newPromise());
                    http2Client.writePing(ctx(), Unpooled.copiedBuffer(pingMsg.getBytes()),
                            newPromise());
                    http2Client.writeData(ctx(), nextStream,
                            Unpooled.copiedBuffer(text.getBytes()), 0, true, newPromise());
                }
            }
        });
        // Wait for all frames to be received.
        assertTrue(requestLatch.await(5, SECONDS));
        verify(serverListener, times(NUM_STREAMS)).onHeadersRead(any(ChannelHandlerContext.class),
                anyInt(), eq(headers), eq(0), eq((short) 16), eq(false), eq(0), eq(false));
        verify(serverListener, times(NUM_STREAMS)).onPingRead(any(ChannelHandlerContext.class),
                eq(Unpooled.copiedBuffer(pingMsg.getBytes())));
        verify(serverListener, times(NUM_STREAMS)).onDataRead(any(ChannelHandlerContext.class),
                anyInt(), eq(Unpooled.copiedBuffer(text.getBytes())), eq(0), eq(true));
    }

    private ChannelHandlerContext ctx() {
        return clientChannel.pipeline().firstContext();
    }

    private ChannelPromise newPromise() {
        return ctx().newPromise();
    }

    /**
     * A decorator around the serverObserver that counts down the latch so that we can await the
     * completion of the request.
     */
    private final class FrameCountDown implements Http2FrameListener {

        @Override
        public void onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding,
                               boolean endOfStream)
                throws Http2Exception {
            serverListener.onDataRead(ctx, streamId, copy(data), padding, endOfStream);
            requestLatch.countDown();
            for (int i = 0; i < data.readableBytes(); ++i) {
                dataLatch.countDown();
            }
        }

        @Override
        public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers,
                                  int padding, boolean endStream) throws Http2Exception {
            serverListener.onHeadersRead(ctx, streamId, headers, padding, endStream);
            requestLatch.countDown();
        }

        @Override
        public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers,
                                  int streamDependency, short weight, boolean exclusive, int padding,
                                  boolean endStream) throws Http2Exception {
            serverListener.onHeadersRead(ctx, streamId, headers, streamDependency, weight,
                    exclusive, padding, endStream);
            requestLatch.countDown();
        }

        @Override
        public void onPriorityRead(ChannelHandlerContext ctx, int streamId, int streamDependency,
                                   short weight, boolean exclusive) throws Http2Exception {
            serverListener.onPriorityRead(ctx, streamId, streamDependency, weight, exclusive);
            requestLatch.countDown();
        }

        @Override
        public void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode)
                throws Http2Exception {
            serverListener.onRstStreamRead(ctx, streamId, errorCode);
            requestLatch.countDown();
        }

        @Override
        public void onSettingsAckRead(ChannelHandlerContext ctx) throws Http2Exception {
            serverListener.onSettingsAckRead(ctx);
            requestLatch.countDown();
        }

        @Override
        public void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings) throws Http2Exception {
            serverListener.onSettingsRead(ctx, settings);
            requestLatch.countDown();
        }

        @Override
        public void onPingRead(ChannelHandlerContext ctx, ByteBuf data) throws Http2Exception {
            serverListener.onPingRead(ctx, copy(data));
            requestLatch.countDown();
        }

        @Override
        public void onPingAckRead(ChannelHandlerContext ctx, ByteBuf data) throws Http2Exception {
            serverListener.onPingAckRead(ctx, copy(data));
            requestLatch.countDown();
        }

        @Override
        public void onPushPromiseRead(ChannelHandlerContext ctx, int streamId,
                                      int promisedStreamId, Http2Headers headers, int padding) throws Http2Exception {
            serverListener.onPushPromiseRead(ctx, streamId, promisedStreamId, headers, padding);
            requestLatch.countDown();
        }

        @Override
        public void onGoAwayRead(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData)
                throws Http2Exception {
            serverListener.onGoAwayRead(ctx, lastStreamId, errorCode, copy(debugData));
            requestLatch.countDown();
        }

        @Override
        public void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId,
                                       int windowSizeIncrement) throws Http2Exception {
            serverListener.onWindowUpdateRead(ctx, streamId, windowSizeIncrement);
            requestLatch.countDown();
        }

        @Override
        public void onUnknownFrame(ChannelHandlerContext ctx, byte frameType, int streamId,
                Http2Flags flags, ByteBuf payload) {
            serverListener.onUnknownFrame(ctx, frameType, streamId, flags, payload);
            requestLatch.countDown();
        }

        ByteBuf copy(ByteBuf buffer) {
            return Unpooled.copiedBuffer(buffer);
        }
    }
}


text:
namespace Hangfire.Mongo.MongoUtils
{
    /// <summary>
    /// Represents ID generator for Mongo database (long)
    /// </summary>
    public class AutoIncrementLongIdGenerator : AutoIncrementIdGenerator
    {
        /// <summary>
        /// Converts sequence number into appropriate format
        /// </summary>
        /// <param name="input">Number</param>
        /// <returns>Converted number</returns>
        protected override object FormatNumber(long input)
        {
            return input;
        }
    }
}


text:
class LogViewApp : public BApplication {
	public:
						LogViewApp(void);
						~LogViewApp(void);

		virtual void 	MessageReceived(BMessage *msg);
		virtual void 	RefsReceived(BMessage *msg);
};

#endif


text:
var lineResize,
    lineChart;
function lineChartOperaHack(){
    //lineChart is somehow not rendered correctly after updates. Need to reupdate
    if ($.browser.opera){
        clearTimeout(lineResize);
        lineResize = setTimeout(lineChart.update, 300);
    }
}
nv.addGraph(function() {
    var chart = nv.models.lineChart()
        .margin({top: 0, bottom: 25, left: 25, right: 0})
        //.showLegend(false)
        .color([
            $orange, '#cf6d51'
            //'#618fb0', '#61b082'
        ]);

    chart.legend.margin({top: 3});

    chart.yAxis
        .showMaxMin(false)
        .tickFormat(d3.format(',.f'));

    chart.xAxis
        .showMaxMin(false)
        .tickFormat(function(d) { return d3.time.format('%b %d')(new Date(d)) });
    var data = testData(['Unique', 'Visits'], 30);
    data[0].area = true;
    d3.select('#visits-chart svg')
        .datum(data)
        .transition().duration(500)
        .call(chart);

    nv.utils.windowResize(chart.update);

    chart.legend.dispatch.on('legendClick.updateExamples', function() {
        lineChartOperaHack();
    });

    lineChart = chart;

    lineChartOperaHack();

    return chart;
});

$(function(){
    /* Sparklines can also take their values from the first argument
     passed to the sparkline() function */
    function randomValue(){
        return Math.floor( Math.random() * 40 );
    }
    var values = [[],[],[],[],[]],
        options = {
            width: '150px',
            height: '30px',
            lineColor: $white,
            lineWidth: '2',
            spotRadius: '2',
            highlightLineColor: $gray,
            highlightSpotColor: $gray,
            spotColor: false,
            minSpotColor: false,
            maxSpotColor: false
        };
    for (var i = 0; i < values.length; i++){
        values[i] = [10 + randomValue(), 15 + randomValue(), 20 + randomValue(), 15 + randomValue(), 25 + randomValue(),
            25 + randomValue(), 30 + randomValue(), 30 + randomValue(), 40 + randomValue()]
    }

    function drawSparkLines(){
        options.lineColor = $green;
        options.fillColor = 'rgba(86, 188, 118, 0.1)';
        $('#direct-trend').sparkline(values[0], options );
        options.lineColor = $orange;
        options.fillColor = 'rgba(234, 200, 94, 0.1)';
        $('#refer-trend').sparkline(values[1], options );
        options.lineColor = $blue;
        options.fillColor = 'rgba(106, 141, 167, 0.1)';
        $('#social-trend').sparkline(values[2], options );
        options.lineColor = $red;
        options.fillColor = 'rgba(229, 96, 59, 0.1)';
        $('#search-trend').sparkline(values[3], options );
        options.lineColor = $white;
        options.fillColor = 'rgba(255, 255, 255, 0.1)';
        $('#internal-trend').sparkline(values[4], options );
    }
    var sparkResize;

    $(window).resize(function(e) {
        clearTimeout(sparkResize);
        sparkResize = setTimeout(drawSparkLines, 200);
    });
    drawSparkLines();

    // Notification link click handler.
    // JUST FOR DEMO.
    // Can be removed.

    function close(e){
        var $settings = $("#settings"),
            $popover = $settings.siblings(".popover");
        if(!$.contains($popover[0], e.target)){
            $settings.popover('hide');
            $(document).off("click", close);
        }
    }
    $("#notification-link").click(function(){
        if ( $(window).width() > 767){
            $("#settings").popover('show');
            $(document).on("click", close);
            return false;
        }
    });

    $("#feed").slimscroll({
        height: 'auto',
        size: '5px',
        alwaysVisible: true,
        railVisible: true
    });

    $("#chat-messages").slimscroll({
        height: '240px',
        size: '5px',
        alwaysVisible: true,
        railVisible: true
    });
});


text:
package org.nd4j.linalg.util;

import org.junit.Test;
import org.nd4j.linalg.BaseNd4jTest;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.factory.Nd4j;

/**
 * @author Adam Gibson
 */
public class ShapeTestC extends BaseNd4jTest {

    @Test
    public void testToOffsetZero() {
        INDArray matrix  =  Nd4j.rand(3,5);
        INDArray rowOne = matrix.getRow(1);
        INDArray row1Copy = Shape.toOffsetZero(rowOne);
        assertEquals(rowOne,row1Copy);
        INDArray rows =  matrix.getRows(1, 2);
        INDArray rowsOffsetZero = Shape.toOffsetZero(rows);
        assertEquals(rows,rowsOffsetZero);

        INDArray tensor = Nd4j.rand(new int[]{3,3,3});
        INDArray getTensor = tensor.slice(1).slice(1);
        INDArray getTensorZero = Shape.toOffsetZero(getTensor);
        assertEquals(getTensor,getTensorZero);

    }

    @Override
    public char ordering() {
        return 'c';
    }
}


text:
package net.dirtyfilthy.bouncycastle.asn1.esf;

import net.dirtyfilthy.bouncycastle.asn1.*;

public class SigPolicyQualifierInfo
    extends ASN1Encodable
{
    private DERObjectIdentifier  sigPolicyQualifierId;
    private DEREncodable         sigQualifier;

    public SigPolicyQualifierInfo(
        DERObjectIdentifier   sigPolicyQualifierId,
        DEREncodable          sigQualifier)
    {
        this.sigPolicyQualifierId = sigPolicyQualifierId;
        this.sigQualifier = sigQualifier;
    }

    public SigPolicyQualifierInfo(
        ASN1Sequence seq)
    {
        sigPolicyQualifierId = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
        sigQualifier = seq.getObjectAt(1);
    }

    public static SigPolicyQualifierInfo getInstance(
        Object obj)
    {
        if (obj == null || obj instanceof SigPolicyQualifierInfo)
        {
            return (SigPolicyQualifierInfo) obj;
        }
        else if (obj instanceof ASN1Sequence)
        {
            return new SigPolicyQualifierInfo((ASN1Sequence) obj);
        }

        throw new IllegalArgumentException(
                "unknown object in 'SigPolicyQualifierInfo' factory: "
                        + obj.getClass().getName() + ".");
    }

    public DERObjectIdentifier getSigPolicyQualifierId()
    {
        return sigPolicyQualifierId;
    }

    public DEREncodable getSigQualifier()
    {
        return sigQualifier;
    }

    /**
     * <pre>
     * SigPolicyQualifierInfo ::= SEQUENCE {
     *    sigPolicyQualifierId SigPolicyQualifierId,
     *    sigQualifier ANY DEFINED BY sigPolicyQualifierId }
     *
     * SigPolicyQualifierId ::= OBJECT IDENTIFIER
     * </pre>
     */
    public DERObject toASN1Object()
    {
        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(sigPolicyQualifierId);
        v.add(sigQualifier);

        return new DERSequence(v);
    }
}


text:
/*jslint node: true */

/**
 * @brief This function defines the handler for the /ttt 'status' command.
 *
 * @return object 'status' handler object containing the following methods:
 *                - parseArgs
 *                - handle
 */
function initializeCommand() {
    'use strict';

    const util = require('util');

    // Access the 'Game' model.
    const Game = require('../models/game');
    // Acces mongodb utility.
    const db = require('../lib/db');

    const drawer = require('../lib/drawer');
    // Access the application constants object.
    const constants = require('../lib/constants');
    // Access Slack utility object to format the message response.
    const slackUtil = require('../lib/slackutil');
    // Access bunyan logger.
    const logger = require('../lib/logger.js').create();
    // Get current configuration.
    const config = require('../config');
    // Setup locales config
    const locale = require('../locales').get(config.locale);
    const labels = locale[constants.commands.STATUS];

    /**
     * @brief This function checks the request body to see if all the valid
     *        parameters are present. Since the 'status' command does not need
     *        data, it does not need to validate the request body.
     *
     * @return boolean indicating the request validity
     */
    function parseArgs() {
        return true;
    }

    function handle(req, res) {
        console.log(req.body);

        let channelId = req.body.channel_id;
        let teamId = req.body.team_id;

        /**
         * @brief This function is invoked when the database lookup operation to
         *        find the channel's ongoing game is complete. If a valid game
         *        is found, its attributes are returned in the response.
         *
         * @param error db lookup error
         * @param game valid game from the db
         *
         * @return none
         */
        function dbLookupCallback(error, game) {

            if (error !== undefined && error !== null) {
                // No ongling game found in this channel.
                logger.error(error);
                return res.json(
                    slackUtil.createResponse({
                        text: labels.DB_ERROR,
                        response_type: "ephemeral"
                    })
                );
            }

            if (game === undefined || game === null) {
                // No ongling game found in this channel.
                return res.json(
                    slackUtil.createResponse({
                        text: labels.GAME_NOT_FOUND_ERROR,
                        response_type: "ephemeral"
                    })
                );
            }

            let index = 0;
            if (game.players[1].name === game.currentPlayer) {
                index = 1;
            }

            let status = util.format(
                labels.CMD_STATUS_TEXT,
                slackUtil.getUserDisplay(game.players[0]),
                slackUtil.getUserDisplay(game.players[1]),
                slackUtil.getUserDisplay(game.players[index])
            );

            res.json(
                slackUtil.createResponse({
                    text: labels.CMD_TEXT,
                    response_type: "ephemeral",
                    attachments: [{
                        text: status + "\n"
                                + drawer.draw(game.board),
                        color: "#36a64f",
                        mrkdwn_in: [
                            "text"
                        ]
                    }]
                })
            );
        }

        // Find a valid game being played in this channel.
        db.lookup(
            Game,
            {
                teamId,
                channelId,
                state: constants.gameState.STARTED
            },
            dbLookupCallback
        );
    }

    return Object.freeze({
        parseArgs,
        handle
    });
}

// Call the above function to create the 'status' command handler.
module.exports = initializeCommand();


text:
<?php

declare(strict_types=1);

namespace ZendTest\Expressive\Tooling\Factory;

use PHPUnit\Framework\TestCase;
use Zend\Expressive\Tooling\Factory\FactoryAlreadyExistsException;

class FactoryAlreadyExistsExceptionTest extends TestCase
{
    public function testForClassUsingFileGeneratesExpectedException()
    {
        $e = FactoryAlreadyExistsException::forClassUsingFile(__CLASS__, __FILE__);
        $this->assertInstanceOf(FactoryAlreadyExistsException::class, $e);
        $this->assertStringContainsString(sprintf('class "%s"', __CLASS__), $e->getMessage());
        $this->assertStringContainsString(sprintf('file "%s"', __FILE__), $e->getMessage());
    }
}


text:
<?php

 // TODO: change your connection string here
 $connectionString = "host=localhost port=9999 dbname=LOCALDB user=sa password=";

 // open connection to the server
 $connection = pg_connect($connectionString) or die ("Unable to connect to PG2LucidDB: " . pg_last_error($connection));

 echo("Established connection to PG2LucidDB\n");

 // create schema:
 pg_query("CREATE SCHEMA PG2LUCIDDBTEST");
 // set current schema:
 pg_query("SET SCHEMA 'PG2LUCIDDBTEST'");

 echo("PG2LUCIDDBTEST schema has been successfully created\n");

 // create table Location:

 $SQL = "CREATE TABLE LOCATION ( " .
  "Id integer not null primary key, " .
  "Name varchar(255) not null, " .
  "Manager varchar(128), " .
  "Square float not null, " .
  "IsFastFood boolean not null, " .
  "IsClosed boolean not null, " .
  "DateAdded timestamp not null, " .
  "DateOpened date not null " .
 ")";

 pg_query($SQL);

 // append sample data:
 $SQL = "INSERT INTO LOCATION VALUES (1, 'Location #1', 'Manager for Location #1', 251.8, false, false, current_timestamp, APPLIB.CHAR_TO_DATE('yyyy-M-d', '2009-07-14'))";
 $count = 0;
 $result = pg_query($SQL);
 $count = $count + pg_affected_rows($result);

 // unicode test:
 $SQL = "INSERT INTO LOCATION VALUES (2, 'Ресторан #2', NULL, 58.4, true, false, current_timestamp, APPLIB.CHAR_TO_DATE('yyyy-M-d', '2008-02-01'))";
 $result = pg_query($SQL);
 $count = $count + pg_affected_rows($result);

 echo("Table LOCATION has been successfully created, $count rows added\n");

 // create table SKU:

 $SQL = "CREATE TABLE SKU ( " .
   "Id smallint not null primary key, " .
   "Name varchar(128) not null, " .
   "Price numeric(6, 2) not null, " .
   "Currency char(3) not null " .
 ")";

 pg_query($SQL);

 // insert data using prepared statement:
 $SQL = "INSERT INTO SKU VALUES ($1, $2, $3, $4)";
 $result = pg_prepare($connection, "my_query", $SQL);

 // append data:
 $count = 0;
 $result = pg_execute($connection, "my_query", array(1, "Espresso Dopio", 185, "RUR"));
 $count = $count + pg_affected_rows($result);

 $result = pg_execute($connection, "my_query", array(2, "Latte Medio", 175.50, "RUR"));
 $count = $count + pg_affected_rows($result);

 $result = pg_execute($connection, "my_query", array(3, "Hamburger", 3.75, "USD"));
 $count = $count + pg_affected_rows($result);

 $result = pg_execute($connection, "my_query", array(4, "Coca-cola", 0.8, "EUR"));
 $count = $count + pg_affected_rows($result);

 echo("Table SKU has been successfully created, $count rows added\n");

 // create table SALES:

 $SQL = "CREATE TABLE SALES_FACT ( " .
   "TransactionId bigint not null primary key, " .
   "LocationId integer not null, " .
   "SKUId smallint not null, " .
   "TransactionTime time not null, " .
   "TransactionDate date not null, " .
   "Comments varchar(128) " .
 ")";

 pg_query($SQL);

 // append sample data:
 $count = 0;
 $result = pg_query("INSERT INTO SALES_FACT VALUES (1, 1, 1, APPLIB.CHAR_TO_TIME('kk:mm', '08:10'), APPLIB.CHAR_TO_DATE('yyyy-M-d', '2009-09-23'), NULL)");
 $count = $count + pg_affected_rows($result);

 $result = pg_query("INSERT INTO SALES_FACT VALUES (2, 1, 3, APPLIB.CHAR_TO_TIME('kk:mm', '08:10'), APPLIB.CHAR_TO_DATE('yyyy-M-d', '2009-09-23'), NULL)");
 $count = $count + pg_affected_rows($result);

 $result = pg_query("INSERT INTO SALES_FACT VALUES (3, 2, 4, APPLIB.CHAR_TO_TIME('kk:mm', '13:15'), APPLIB.CHAR_TO_DATE('yyyy-M-d', '2009-09-24'), 'Promo')");
 $count = $count + pg_affected_rows($result);

 echo("Table SALES_FACT has been successfully created, $count rows added\n");

 // close connection:
 pg_close($connection);

?>


text:
let directions =
Navigate to: Menu Bar > Tools > Options


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

#ifndef PHERIALIZE_UNSERIALIZE_HPP_INCLUDED
#define PHERIALIZE_UNSERIALIZE_HPP_INCLUDED

#include "pherialize/types.hpp"
#include "pherialize/export.hpp"

#include "pherialize/Mixed.hpp"
#include "pherialize/MixedArray.hpp"

#include <string>
#include <cstddef>

namespace pherialize {

/** Unserializes a PHP-serialize()d string to a mixed value.
  */
class PHERIALIZE_EXPORT Unserializer {

public:

	/** Constructs a new unserializer from a character string.
	  *
	  * @param data string containing serialized data
	  */
	Unserializer(const std::string &data);

	/** Unserializes the next object from this data stream.
	  *
	  * @throw std::runtime_error if a parsing error occurs
	  * @return a Mixed object, or NULL if no object can be
	  * read from the stream
	  */
	shared_ptr <Mixed> unserializeObject();

private:

	shared_ptr <Mixed> unserializeNull();
	shared_ptr <Mixed> unserializeInt();
	shared_ptr <Mixed> unserializeBool();
	shared_ptr <Mixed> unserializeDouble();
	shared_ptr <Mixed> unserializeString();
	shared_ptr <Mixed> unserializeArray();
	shared_ptr <Mixed> unserializeObjectToArray();

	std::string m_data;
	std::size_t m_pos;
	std::size_t m_length;
};

/** Unserializes an object directly from a character string.
  *
  * @throw std::runtime_error if a parsing error occurs
  * @return a Mixed object, or NULL if no object can be read
  * from the stream
  */
PHERIALIZE_EXPORT shared_ptr <Mixed> unserialize(const std::string &str);

} // namespace pherialize

#endif // PHERIALIZE_UNSERIALIZE_HPP_INCLUDED


text:
class ReplaceComplexAwardModelWithSimpleOne < ActiveRecord::Migration[4.2]
  def up
    change_table :award_labels do |t|
      t.remove :first_name
      t.remove :last_name
      t.remove :partner_first_name
      t.remove :partner_last_name
      t.remove :age_group
      t.remove :gender

      t.string :competitor_name
      t.string :category
    end
  end

  def down
    change_table :award_labels do |t|
      t.string :first_name
      t.string :last_name
      t.string :partner_first_name
      t.string :partner_last_name
      t.string :age_group
      t.string :gender

      t.remove :competitor_name
      t.remove :category
    end
  end
end


text:
import {Layout} from '../../../src/layout';
import {Services} from '../../../src/services';
import {StateProperty, getStoreService} from './amp-story-store-service';
import {copyChildren, removeChildren} from '../../../src/dom';
import {dev} from '../../../src/log';
import {dict} from './../../../src/utils/object';
import {isArray, isObject} from '../../../src/types';
import {parseJson} from '../../../src/json';
import {renderAsElement} from './simple-template';
import {throttle} from '../../../src/utils/rate-limit';

/**
 * Story access template.
 * @const {!./simple-template.ElementDef}
 */
const TEMPLATE = {
  tag: 'div',
  attrs: dict({'class': 'i-amphtml-story-access-overflow'}),
  children: [
    {
      tag: 'div',
      attrs: dict({'class': 'i-amphtml-story-access-container'}),
      children: [
        {
          tag: 'div',
          attrs: dict({'class': 'i-amphtml-story-access-content'}),
        },
      ],
    },
  ],
};

/**
 * The <amp-story-access> custom element.
 */
export class AmpStoryAccess extends AMP.BaseElement {
  /** @param {!AmpElement} element */
  constructor(element) {
    super(element);

    /** @const @private {!../../../src/service/action-impl.ActionService} */
    this.actions_ = Services.actionServiceForDoc(this.element);

    /** @private {?Element} */
    this.scrollableEl_ = null;

    /** @private @const {!./amp-story-store-service.AmpStoryStoreService} */
    this.storeService_ = getStoreService(this.win);
  }

  /** @override */
  buildCallback() {
    const drawerEl = renderAsElement(this.win.document, TEMPLATE);
    const contentEl = dev().assertElement(
        drawerEl.querySelector('.i-amphtml-story-access-content'));

    copyChildren(this.element, contentEl);
    removeChildren(this.element);

    this.element.appendChild(drawerEl);

    this.whitelistActions_();

    this.initializeListeners_();
  }

  /** @override */
  isLayoutSupported(layout) {
    return layout == Layout.CONTAINER;
  }

  /** @override */
  prerenderAllowed() {
    return false;
  }

  /**
   * @private
   */
  initializeListeners_() {
    this.storeService_.subscribe(StateProperty.ACCESS_STATE, isAccess => {
      this.onAccessStateChange_(isAccess);
    });

    this.scrollableEl_ =
        this.element.querySelector('.i-amphtml-story-access-overflow');
    this.scrollableEl_.addEventListener(
        'scroll', throttle(this.win, () => this.onScroll_(), 100));
  }

  /**
   * Reacts to access state updates, and shows/hides the UI accordingly.
   * @param {boolean} isAccess
   * @private
   */
  onAccessStateChange_(isAccess) {
    this.mutateElement(() => {
      this.element.classList.toggle('i-amphtml-story-access-visible', isAccess);
    });
  }

  /**
   * Toggles the fullbleed UI on scroll.
   * @private
   */
  onScroll_() {
    let isFullBleed;

    // Toggles the fullbleed UI as soon as the scrollable container, which has a
    // 88px margin top, reaches the top of the screen.
    const measurer =
        () => isFullBleed = this.scrollableEl_./*OK*/scrollTop > 88;
    const mutator = () => {
      this.element
          .classList.toggle('i-amphtml-story-access-fullbleed', isFullBleed);
    };

    this.element.getResources()
        .measureMutateElement(this.element, measurer, mutator);
  }

  /**
   * Whitelists the <amp-access> actions.
   * Depending on the publisher configuration, actions can be:
   *   - login
   *   - login-<namespace>
   *   - login-<namespace>-<type>
   *
   * Publishers can provide one (object) or multiple (array) configurations,
   * identified by their "namespace" property.
   * Each configuration can have one or multiple login URLs, called "type".
   * All the namespace/type pairs have to be whitelisted.
   * @private
   */
  whitelistActions_() {
    const accessEl =
        dev().assertElement(
            this.win.document.getElementById('amp-access'),
            'Cannot find the amp-access configuration');

    // Configuration validation is handled by the amp-access extension.
    let accessConfig =
    /** @type {!Array|!Object} */ (parseJson(accessEl.textContent));

    if (!isArray(accessConfig)) {
      accessConfig = [accessConfig];

      // If there is only one configuration and the publisher provided a
      // namespace, we want to allow actions with or without namespace.
      if (accessConfig[0].namespace) {
        accessConfig.push(
            Object.assign({}, accessConfig[0], {namespace: undefined}));
      }
    }

    accessConfig.forEach(config => {
      const {login, namespace} = /** @type {{login, namespace}} */ (config);

      if (isObject(login)) {
        const types = Object.keys(login);
        types.forEach(type => this.whitelistAction_(namespace, type));
      } else {
        this.whitelistAction_(namespace);
      }
    });
  }

  /**
   * Whitelists an action for the given namespace / type pair.
   * @param {string=} namespace
   * @param {string=} type
   * @private
   */
  whitelistAction_(namespace = undefined, type = undefined) {
    const action = ['login', namespace, type].filter(s => !!s).join('-');
    this.actions_.addToWhitelist(`SCRIPT.${action}`);
  }
}


text:
if [[ $target_platform =~ linux.* ]] || [[ $target_platform == win-32 ]] || [[ $target_platform == win-64 ]] || [[ $target_platform == osx-64 ]]; then
  export DISABLE_AUTOBREW=1
  $R CMD INSTALL --build .
else
  mkdir -p $PREFIX/lib/R/library/HTSSIP
  mv * $PREFIX/lib/R/library/HTSSIP
fi


text:
(function(){
    var action = actions.NONE;

    var DEBUG = false;

    function Player(id, index) {
        this._id = id;
        this._index = index;
        this.ammo = MAX_AMMO;
        this.bombs = MAX_BOMBS;
        this.treasure = false;
        this.swamp = false;
    }

    Player.prototype = {
        get index() {
            return this._index;
        },
        set index(index) {
            this._index = index;
        },
        get id() {
            return this._id;
        },
        hasAmmo : function() {
            return this.ammo > 0;
        },
        decreaseAmmo : function() {
            this.ammo--;
        },
        hasBomb : function() {
            return this.bombs > 0;
        },
        decreaseBombs : function() {
            this.bombs--;
        },
        hasTreasure : function() {
            return this.treasure;
        },
        stuckInSwamp : function() {
            return this.swamp;
        },
        fellIntoSwamp : function(){
            this.swamp = true;
        },
        outOfTheSwamp : function(){
            this.swamp = false;
        },
        pickUpTreasure : function() {
            this.treasure = true;
        },
        replenishAmmo : function() {
            this.ammo = MAX_AMMO;
            this.bombs = MAX_BOMBS;
        }
    };

    function Cell(index, type) {
        this.index = index;
        this.players = [];
        this.objects = [ type ];
        if (type == OBJECT.PLAYER || type == OBJECT.TREASURE || type == OBJECT.WALL) {
            this.objects.push(OBJECT.EMPTY);
        }
    }

    Cell.prototype = {
        addObject : function(object) {
            if (typeof object == "string") {
                this.objects.push(object);
            } else {
                this.players.push(object);
            }
        },
        removeObject : function(object) {
            if (typeof object == "string") {
                var index = this.objects.indexOf(object);
                if (index != -1) {
                    this.objects.splice(index, 1);
                }
            } else {
                this.players.splice(this.players.indexOf(object), 1);
            }
        },
        contains: function(toFind) {
            if (toFind == OBJECT.PLAYER) {
                return this.players.length > 0;
            }
            var found = false;
            this.objects.forEach(function(object) {
                if (object == toFind) found = true;
            });
            return found;
        },
        listPlayers : function() {
            return this.players;
        },
        getValue : function() {
            if (this.players.length > 0) return OBJECT.PLAYER;
            var value = { cell: OBJECT.UNKNOWN, priority : getPriority(OBJECT.UNKNOWN)};
            this.objects.forEach(function(object) {
                if (value.priority < getPriority(object)) {
                    value = { cell : object, priority : getPriority(object)};
                }
            });
            return value.cell;
        },
        toString: function() {
            return this.getValue();
        },
        constructor : Cell
    };

    /**
     * Maze map.
     *
     * . - Empty cell
     * ^ - Inner wall
     * * - Outer (Non-breakable) wall
     * E - Exit
     * A - Arsenal
     * H - Hospital
     * P - Player
     * @ - Out of bounds
     * ~ - Bullet
     * T - Treasure
     * S - Swamp
     */

    window.OBJECT = {
        UNKNOWN : '?',
        EMPTY : '.',
        WALL : '^',
        OUTER_WALL : '*',
        EXIT : 'E',
        ARSENAL : 'A',
        HOSPITAL : 'H',
        PLAYER : 'P',
        OUT_OF_BOUNDS : '@',
        BULLET: '~',
        TREASURE: 'T',
        PORTAL: 'O',
        SWAMP: 'S'
    };

    function getPriority(object) {
        switch (object) {
            case OBJECT.OUT_OF_BOUNDS: return 6;
            case OBJECT.PLAYER: return 5;
            case OBJECT.BULLET: return 4;
            case OBJECT.ARSENAL:
            case OBJECT.HOSPITAL:
            case OBJECT.TREASURE:
            case OBJECT.SWAMP:
            case OBJECT.EXIT: return 3;
            case OBJECT.OUTER_WALL: return 2;
            case OBJECT.WALL:
            case OBJECT.PORTAL: return 1;
            case OBJECT.EMPTY: return 0;
            case OBJECT.UNKNOWN: return -1;
        }
    }

    function createLevel(level) {
        map = [];
        players = [];
        currentPlayer = 0;
        for (var i = 0; i < level.length; i++) {
            if (level[i] == OBJECT.PLAYER) {
                var player = new Player(currentPlayer++, i);
                players.push(player);
                var cell = new Cell(i, OBJECT.EMPTY);
                cell.addObject(player);
                map.push(cell);
            } else {
                map.push(new Cell(i, level[i]));
            }
        }
        currentPlayer = 0;
        return map;
    }

    var map = [];
    var players = [];

    var currentPlayer = 0;

    function getMapSide() {
        return Math.sqrt(map.length);
    }

    window.init = function() {
        restart();
        input.onPressed(turn);
    };
    window.processCommand = processCommand;
    window.getColor = function() {
        if (players.length > 1) {
            return PLAYERS_COLORS[currentPlayer];
        } else {
            return DEFAULT_COLOR;
        }
    };

    function proceedToNextLevel() {
        startLevel(getNextLevel());
    }

    function restart() {
        startLevel(getCurrentLevel());
    }

    function startLevel(level) {
        map = createLevel(level);
        printMapToHTML();
        printInventoryToHTML();
    }

    var modifier = null;

    function turn(key) {
        switch (getMode()) {
            case GAME_MODE.KEYBOARD: return processKeyboard(key);
            case GAME_MODE.TEXT: return mazeConsole.input(key);
            case GAME_MODE.MOUSE: console.log("Mouse mode not supported yet"); break;
            default: console.log("Unknown game mode: " + getMode());
        }
    }

    function processKeyboard(key) {
        action = processInput(key);
        if (action == actions.NONE) return;
        var result = processAction(action);
        if (DEBUG) console.log(result);
        if (modifier == null) {
            currentPlayer = currentPlayer < players.length - 1 ? currentPlayer + 1 : 0;
        }
        mazeConsole.print(result);
        printMapToHTML();
        printInventoryToHTML();
    }

    function processCommand(command) {
        var result = processAction(command);
        if (DEBUG) console.log(result);
        if (modifier == null) {
            currentPlayer = currentPlayer < players.length - 1 ? currentPlayer + 1 : 0;
        }
        mazeConsole.print(result);
        printMapToHTML();
        printInventoryToHTML();
    }

    function processInput(key) {
        if (modifier != null) {
            var modifiedAction = actions.CANCEL;
            if (key == 'UP' || key == 'W') {
                modifiedAction = modifier + actions.MOVE_UP;
            } else if (key == 'DOWN' || key == 'S') {
                modifiedAction = modifier + actions.MOVE_DOWN;
            } else if (key == 'RIGHT' || key == 'D') {
                modifiedAction = modifier + actions.MOVE_RIGHT;
            } else if (key == 'LEFT' || key == 'A') {
                modifiedAction = modifier + actions.MOVE_LEFT;
            }
            modifier = null;
            return modifiedAction;
        }
        if (key == 'UP' || key == 'W') {
            return actions.MOVE_UP;
        } else if (key == 'DOWN' || key == 'S') {
            return actions.MOVE_DOWN;
        } else if (key == 'RIGHT' || key == 'D') {
            return actions.MOVE_RIGHT;
        } else if (key == 'LEFT' || key == 'A') {
            return actions.MOVE_LEFT;
        } else if (key == 'R') {
            restart();
            return actions.NONE;
        } else if (key == 'SPACE') {
            return actions.SHOOT_MODIFIER;
        } else if (key == 'B') {
            return actions.BOMB_MODIFIER;
        } else if (key == 'J') {
            return actions.JUMP;
        } else if (key == 'H') {
            return actions.HOLD;
/*        } else if (key == 'F1') {
            return actions.SET_MODE_KEYBOARD;*/
        } else if (key == 'F2') {
            return actions.SET_MODE_TEXT;
        }

        return actions.NONE;
    }

    function checkCell(){
        if (map[getPlayerIndex()].contains(OBJECT.SWAMP)) {
            getPlayer().fellIntoSwamp();
            return RESULT.FELL_INTO_SWAMP;
        }

        if (map[getPlayerIndex()].contains(OBJECT.ARSENAL)){
            getPlayer().replenishAmmo();
            return RESULT.ARSENAL;
        }

        if (map[getPlayerIndex()].contains(OBJECT.TREASURE)) {
            getPlayer().pickUpTreasure();
            remove(getPlayerIndex(), OBJECT.TREASURE);
            return RESULT.PICKUP_TREASURE;
        }

        if (map[getPlayerIndex()].contains(OBJECT.EXIT)) {
            proceedToNextLevel();
            return RESULT.EXIT;
        }

        if (map[getPlayerIndex()].contains(OBJECT.HOSPITAL)) {
            // HP restoration
            return RESULT.HOSPITAL;
        }

        return RESULT.EMPTY;
    }

    function processShoot(direction) {
        if (!getPlayer().hasAmmo()){
            return RESULT.NO_AMMO;
        }

        getPlayer().decreaseAmmo();
        var next = getNeighbour(getPlayerIndex(), direction);
        while (!map[next].contains(OBJECT.WALL)
            && !map[next].contains(OBJECT.OUTER_WALL)
            && !map[next].contains(OBJECT.PLAYER)) {
            next = getNeighbour(next, direction);
        }
        if (map[next].contains(OBJECT.PLAYER)) {
            var eliminated = false;
            map[next].listPlayers().forEach(function(player) {
                if (getHospitalIndex() != -1) {
                    movePlayer(player, getHospitalIndex());
                } else {
                    //remove player completely
                    remove(player.index, player);
                    players.splice(players.indexOf(player), 1);
                    eliminated = true;
                }
            });
            return eliminated ? RESULT.SHOOT_ELIMINATED : RESULT.SHOOT_SUCCESS;
        } else {
            return RESULT.SHOOT_WALL;
        }
    }

    function processBomb(direction) {
        if (!getPlayer().hasBomb()){
            return RESULT.NO_BOMB;
        }
        getPlayer().decreaseBombs();
        var target = getNeighbour(getPlayerIndex(), direction);
        if (map[target].contains(OBJECT.WALL)) {
            remove(target, OBJECT.WALL);
            return RESULT.BOMB_SUCCESS;
        }
        return RESULT.BOMB_NO_WALL;
    }

    function getNeighbour(index, direction) {
        switch (direction) {
            case DIRECTION.UP: return index - getMapSide();
            case DIRECTION.DOWN: return index + getMapSide();
            case DIRECTION.LEFT: return index - 1;
            case DIRECTION.RIGHT: return index + 1;
            default: {
                console.log("Unknown direction: " + direction);
            }
        }
    }

    function processAction(action) {
        if (DEBUG) {
            console.log("Process action: " + action);
        }

        switch (action) {
            case actions.CANCEL: {
                return RESULT.CANCEL;
            }
            case actions.MOVE_UP: {
                return processMovement(DIRECTION.UP);
            }
            case actions.MOVE_DOWN: {
                return processMovement(DIRECTION.DOWN);
            }
            case actions.MOVE_LEFT: {
                return processMovement(DIRECTION.LEFT);
            }
            case actions.MOVE_RIGHT: {
                return processMovement(DIRECTION.RIGHT);
            }
            case actions.HOLD: {
                return RESULT.OK;
            }
            case actions.SHOOT_MODIFIER: {
                modifier = actions.SHOOT + "_";
                return RESULT.SHOOT_MODIFIER;
            }
            case actions.BOMB_MODIFIER: {
                modifier = actions.BOMB + "_";
                return RESULT.BOMB_MODIFIER;
            }
            case actions.SHOOT_UP: return processShoot(DIRECTION.UP);
            case actions.SHOOT_DOWN: return processShoot(DIRECTION.DOWN);
            case actions.SHOOT_LEFT: return processShoot(DIRECTION.LEFT);
            case actions.SHOOT_RIGHT: return processShoot(DIRECTION.RIGHT);
            case actions.SHOOT: {
                console.log("actions.SHOOT no longer supported");
                return RESULT.UNKNOWN_ACTION;
            }

            case actions.BOMB_UP: return processBomb(DIRECTION.UP);
            case actions.BOMB_DOWN: return processBomb(DIRECTION.DOWN);
            case actions.BOMB_LEFT: return processBomb(DIRECTION.LEFT);
            case actions.BOMB_RIGHT: return processBomb(DIRECTION.RIGHT);
            case actions.BOMB: {
                console.log("actions.BOMB no longer supported");
                return RESULT.UNKNOWN_ACTION;
            }

            case actions.JUMP: {
                return processJump();
            }
            case actions.SET_MODE_KEYBOARD: {
                setMode(GAME_MODE.KEYBOARD);
                return RESULT.MODE_KEYBOARD;
            }
            case actions.SET_MODE_TEXT: {
                setMode(GAME_MODE.TEXT);
                return RESULT.MODE_TEXT;
            }
            default: {
                console.log("Unknown action: " + action);
                return RESULT.UNKNOWN_ACTION;
            }
        }
    }

    function processJump() {
        if (map[getPlayerIndex()].contains(OBJECT.PORTAL)) {
            var target = getDestinationPortal(getPlayerIndex());
            if (target != -1) {
                movePlayer(getPlayer(), target);
                return RESULT.JUMP;
            } else {
                return RESULT.NO_PORTAL;
            }

        }
        return RESULT.NO_PORTAL;
    }

    function getDestinationPortal(current) {
        var candidates = [];
        for (var i = 0; i < map.length; i++) {
            if (map[i].contains(OBJECT.PORTAL) && i != current) {
                candidates.push(i);
            }
        }

        if (candidates.length > 0) {
            return candidates[Math.round(Math.random() * (candidates.length - 1))];
        }

        var pos = getXY(current);
        console.log("Could not find destination portal for (" + pos.x + "," + pos.y + ") in " + getLevelName());
        return -1;
    }

    function processMovement(direction) {
        if (getPlayer().stuckInSwamp()) {
            getPlayer().outOfTheSwamp();
            return RESULT.STUCK_IN_SWAMP;
        }
        var target = getNeighbour(getPlayerIndex(), direction);
        if (DEBUG) console.log("process move: " + getPlayerIndex() + " -> " + target);
        var targetCell = cellAt(target);
        if (!getPlayer().hasTreasure() && targetCell.contains(OBJECT.EXIT)) return RESULT.CANT_EXIT;
        if (targetCell.contains(OBJECT.WALL) || targetCell.contains(OBJECT.OUTER_WALL)) return RESULT.WALL;

        movePlayer(getPlayer(), target);

        return checkCell();
    }

    function remove(index, value) {
        map[index].removeObject(value);
    }

    function add(index, value) {
        map[index].addObject(value);
    }

    function movePlayer(player, to) {
        remove(player.index, player);
        add(to, player);
        player.index = to;
    }

    function getXY(index) {
        return {x: index % getMapSide(), y: Math.floor(index / getMapSide())};
    }

    function getIndex(x, y) {
        return y * getMapSide() + x;
    }

    function cellAt(indexOrX, y) {
        var index = (y == undefined ? indexOrX : getIndex(indexOrX, y));
        if (index < 0 || index > getMapSide() * getMapSide() - 1) {
            return OBJECT.OUT_OF_BOUNDS;
        }
        return map[index];
    }

    function getPlayerIndex() {
        return getPlayer().index;
    }

    function getPlayer() {
        return players[currentPlayer];
    }

    function getHospitalIndex() {
        //If there is no hospital in map, killed player will be eliminated
        for (var i = 0; i < map.length; i++) {
            if (map[i].contains(OBJECT.HOSPITAL)) return i;
        }
        return -1;
    }

    function printMapToHTML() {
        var mapDiv = document.getElementById('mapDiv');
        mapDiv.style.width = "0";
        mapDiv.style.color = getColor();
        mapDiv.innerHTML = "";
        for (var i = 0; i < map.length; i++) {
            mapDiv.innerHTML += map[i].getValue();
            if ((i + 1) % getMapSide() == 0) {
                mapDiv.innerHTML += '\n';
            }
        }
    }

    function printInventoryToHTML() {
        var inventoryDiv = document.getElementById ('inventoryDiv');
        inventoryDiv.style.width = "0";
        inventoryDiv.style.color = getColor();
        inventoryDiv.innerHTML = '</p>';
        inventoryDiv.innerHTML += "Ammo:" + getPlayer().ammo + "\n";
        inventoryDiv.innerHTML += "Bomb:" + getPlayer().bombs + "\n";
        if (getPlayer().hasTreasure()) {
            inventoryDiv.innerHTML += "Treasure";
        }
    }

}());


text:
<?php

namespace PabloLovera\ModulesLaravel\Commands;

use Illuminate\Console\Command;
use PabloLovera\ModulesLaravel\Traits\CommandTrait;

class ModuleModel extends Command
{
    use CommandTrait;

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'module:make-model {name} {module}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create a new Model extending of Core module';

    /**
     * The stub name
     *
     * @var string
     * */
    protected $stub = 'model';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $moduleDirectory    = config('module.modules_directory');
        $module             = $this->argument('module');
        $name               = $this->argument('name');
        $toDirectory        = $moduleDirectory . $module . '/Models';

        $content            = $this->getContents($this->stub);

        $content            = $this->replaceName($name, $content);
        $content            = $this->replaceModuleName($module, $content);
        $content            = $this->replaceTableName($module, $content);

        $this->doDirectory($toDirectory);

        $this->writeFile($content, $toDirectory, $name);

        $this->info('The Module ' . $module .' has been received a new entity: ' . $name . '. Be happy!');
    }
}


text:
package net.maisica.time.interval;

import java.io.Serializable;
import java.time.Duration;
import java.time.Year;
import java.time.format.DateTimeParseException;
import java.util.Objects;
import net.maisica.time.span.YearSpan;

public final class YearInterval extends AbstractInterval<Year, YearInterval> implements TemporalInterval<Year>, Serializable {

    public static YearInterval parse(final CharSequence text) {
        Objects.requireNonNull(text, "text");
        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) == '/') {
                final Year start = Year.parse(text.subSequence(0, i++).toString());
                final Year end = Year.parse(text.subSequence(i, text.length()).toString());
                return of(start, end);
            }
        }
        throw new DateTimeParseException("Interval cannot be parsed, no forward slash found", text, 0);
    }

    public static YearInterval of(final Interval<Year> interval) {
        Objects.requireNonNull(interval, "interval");
        if (interval instanceof YearInterval) {
            return (YearInterval) interval;
        }
        return of(interval.getStart(), interval.getEnd());
    }

    public static YearInterval of(final Year start, final Duration duration) {
        Objects.requireNonNull(start, "start");
        Objects.requireNonNull(duration, "duration");
        return of(start, start.plus(duration));
    }

    public static YearInterval of(final Year start, final Year end) {
        Objects.requireNonNull(start, "start");
        Objects.requireNonNull(end, "end");
        if (end.compareTo(start) < 0) {
            throw new IllegalArgumentException("end is before start");
        }
        return new YearInterval(start, end);
    }

    private YearInterval(final Year start, final Year end) {
        super(start, end);
    }

    @Override
    protected IntervalFactory<Year, YearInterval> getFactory() {
        return YearInterval::new;
    }

    @Override
    public YearSpan toSpan() {
        return YearSpan.of(getStart(), toDuration());
    }

}


text:
package org.apache.nifi.registry.diff;

import io.swagger.annotations.ApiModelProperty;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

/**
 * Represents a group of differences related to a specific component in a flow.
 */
public class ComponentDifferenceGroup {
    private String componentId;
    private String componentName;
    private String componentType;
    private String processGroupId;
    private Set<ComponentDifference> differences = new HashSet<>();

    @ApiModelProperty("The id of the component whose changes are grouped together.")
    public String getComponentId() {
        return componentId;
    }

    public void setComponentId(String componentId) {
        this.componentId = componentId;
    }

    @ApiModelProperty("The name of the component whose changes are grouped together.")
    public String getComponentName() {
        return componentName;
    }

    public void setComponentName(String componentName) {
        this.componentName = componentName;
    }

    @ApiModelProperty("The type of component these changes relate to.")
    public String getComponentType() {
        return componentType;
    }

    public void setComponentType(String componentType) {
        this.componentType = componentType;
    }

    @ApiModelProperty("The process group id for this component.")
    public String getProcessGroupId() {
        return processGroupId;
    }

    public void setProcessGroupId(String processGroupId) {
        this.processGroupId = processGroupId;
    }

    @ApiModelProperty("The list of changes related to this component between the 2 versions.")
    public Set<ComponentDifference> getDifferences() {
        return differences;
    }

    public void setDifferences(Set<ComponentDifference> differences) {
        this.differences = differences;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ComponentDifferenceGroup that = (ComponentDifferenceGroup) o;
        return Objects.equals(componentId, that.componentId)
                && Objects.equals(componentName, that.componentName)
                && Objects.equals(componentType, that.componentType)
                && Objects.equals(processGroupId, that.processGroupId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(componentId, componentName, componentType, processGroupId);
    }
}


text:
using HarmonyLib;
using LmpClient.Localization;
using LmpClient.Systems.Revert;
using LmpClient.VesselUtilities;
using LmpCommon.Enums;
using System.Collections.Generic;

// ReSharper disable All

namespace LmpClient.Harmony
{
    /// <summary>
    /// This harmony patch is intended to disable the revert after switching vessels
    /// </summary>
    [HarmonyPatch(typeof(PauseMenu))]
    [HarmonyPatch("drawStockRevertOptions")]
    public class PauseMenu_DrawRevertOptions
    {
        [HarmonyPostfix]
        private static void PostfixDrawStockRevertOptions(PopupDialog dialog, List<DialogGUIBase> options)
        {
            if (MainSystem.NetworkState < ClientState.Connected) return;

            if (FlightGlobals.ActiveVessel && FlightGlobals.ActiveVessel.id == RevertSystem.Singleton.StartingVesselId && !VesselCommon.IsSpectating)
                return;

            foreach (var guiComponent in options)
            {
                if (guiComponent is DialogGUILabel guiLabel)
                {
                    guiLabel.OptionText = LocalizationContainer.RevertDialogText.CannotRevertText;
                }

                if (guiComponent is DialogGUIButton guiButton)
                {
                    guiButton.OptionInteractableCondition = () => false;
                }
            }
        }
    }
}