text:
require 'spec_helper'

describe Bosh::Director::Api::CpiConfigManager do
  subject(:manager) { Bosh::Director::Api::CpiConfigManager.new }
  let(:valid_cpi_manifest) { Bosh::Spec::Deployments.multi_cpi_config }
  let(:dumped_valid_cpi_manifest)  { YAML.dump(valid_cpi_manifest) }
  let(:user) {'username-1'}

  describe '#update' do
    it 'saves the cpi config' do
      expect {
        manager.update(dumped_valid_cpi_manifest)
      }.to change(Bosh::Director::Models::Config, :count).from(0).to(1)

      cpi_config = Bosh::Director::Models::Config.first
      expect(cpi_config.created_at).to_not be_nil
      expect(cpi_config.type).to eq('cpi')
      expect(cpi_config.name).to eq('default')
      expect(cpi_config.content).to eq(dumped_valid_cpi_manifest)
      expect(cpi_config.raw_manifest).to eq(valid_cpi_manifest)
    end

    context 'when cpi config is failing to parse' do
      it 'returns an error' do
        cpi_config_yaml = 'invalid cpi config'
        expect {
          manager.update(cpi_config_yaml)
        }.to raise_error Bosh::Director::ValidationInvalidType
        expect(Bosh::Director::Models::Config.count).to eq(0)
      end
    end
  end

  describe '#list' do
    before(:each) do
      days = 24*60*60

      @oldest_cpi_config = Bosh::Director::Models::Config.make(:cpi,
                                          content: 'config_from_time_immortal',
                                          created_at: Time.now - 3*days,
                                          )
      @older_cpi_config = Bosh::Director::Models::Config.make(:cpi,
                                                             content: 'config_from_last_year',
                                                             created_at: Time.now - 2*days,
                                                             )
      @newer_cpi_config = Bosh::Director::Models::Config.make(:cpi,
                                                             content: "---\nsuper_shiny: new_config",
                                                             created_at: Time.now - 1*days,
                                                             )
    end

    it 'returns the specified number of cpi configs (most recent first)' do
      cpi_configs = manager.list(2)

      expect(cpi_configs.count).to eq(2)
      expect(cpi_configs[0]).to eq(@newer_cpi_config)
      expect(cpi_configs[1]).to eq(@older_cpi_config)
    end

    it 'returns only configs of type `cpi` and name `default`' do
      Bosh::Director::Models::Config.make(:cpi, name: 'non-default')
      Bosh::Director::Models::Config.make(:cloud)

      cpi_configs = manager.list(4)

      expect(cpi_configs.count).to eq(3)
      expect(cpi_configs[0]).to eq(@newer_cpi_config)
      expect(cpi_configs[1]).to eq(@older_cpi_config)
      expect(cpi_configs[2]).to eq(@oldest_cpi_config)
    end

    context 'when there are deleted cpi configs' do
      before(:each) do
        @older_cpi_config.update(deleted: true)
      end

      it 'ignores the deleted configs from the result' do
        runtime_configs = manager.list(2)

        expect(runtime_configs).to eq([@newer_cpi_config, @oldest_cpi_config])
      end
    end
  end

  describe '#latest' do
    it 'returns the latest' do
      days = 24*60*60

      Bosh::Director::Models::Config.make(:cpi,
          content: 'config_from_last_year',
          created_at: Time.now - 2*days,
      ).save
      newer_cpi_config = Bosh::Director::Models::Config.make(:cpi,
          content: "---\nsuper_shiny: new_config",
          created_at: Time.now - 1*days,
      ).save

      cpi_config = manager.latest

      expect(cpi_config).to eq(newer_cpi_config)
    end

    it 'returns nil if there are no cpi configs' do
      cpi_config = manager.latest

      expect(cpi_config).to be_nil
    end
  end
end


text:
(function() {

var sidebar = document.getElementById('gc-sidebar');
var scrollToTop = document.getElementById('scroll-to-top');
var offsetTop = sidebar.offsetTop;

function relayout() {
  // Obviously, this code executes every time the window scrolls, so avoid
  // putting things in here.
  var isFloatingSidebar = sidebar.classList.contains('floating');
  var isShowingScrollToTop = !scrollToTop.classList.contains('hidden');

  var floatSidebar = false;
  var showScrollToTop = false;

  if (window.scrollY > offsetTop) {
    // Scrolled past the top of the sidebar.
    if (window.innerHeight >= sidebar.scrollHeight) {
      // The whole sidebar fits in the window. Make it always visible.
      floatSidebar = true;
    } else {
      // Whole sidebar doesn't fit, so show the scroll-to-top button instead.
      showScrollToTop = true;
    }
  }

  if (floatSidebar != isFloatingSidebar)
    sidebar.classList.toggle('floating', floatSidebar);
  if (isShowingScrollToTop != showScrollToTop)
    scrollToTop.classList.toggle('hidden', !showScrollToTop);
}

window.addEventListener('scroll', relayout);
setTimeout(relayout, 0);

scrollToTop.addEventListener('click', function() {
  window.scrollTo(0, 0);
});

}());

redpajama_set_name: RedPajamaGithub


text:
namespace NArchive {
namespace N7z {

#ifndef __7Z_SET_PROPERTIES

#ifdef EXTRACT_ONLY
  #if !defined(_7ZIP_ST) && !defined(_SFX)
    #define __7Z_SET_PROPERTIES
  #endif
#else
  #define __7Z_SET_PROPERTIES
#endif

#endif

#ifndef EXTRACT_ONLY

class COutHandler: public CMultiMethodProps
{
  HRESULT SetSolidFromString(const UString &s);
  HRESULT SetSolidFromPROPVARIANT(const PROPVARIANT &value);
public:
  bool _removeSfxBlock;

  UInt64 _numSolidFiles;
  UInt64 _numSolidBytes;
  bool _numSolidBytesDefined;
  bool _solidExtension;
  bool _useTypeSorting;

  bool _compressHeaders;
  bool _encryptHeadersSpecified;
  bool _encryptHeaders;
  // bool _useParents; 9.26

  CBoolPair Write_CTime;
  CBoolPair Write_ATime;
  CBoolPair Write_MTime;

  bool _useMultiThreadMixer;

  // bool _volumeMode;

  void InitSolidFiles() { _numSolidFiles = (UInt64)(Int64)(-1); }
  void InitSolidSize()  { _numSolidBytes = (UInt64)(Int64)(-1); }
  void InitSolid()
  {
    InitSolidFiles();
    InitSolidSize();
    _solidExtension = false;
    _numSolidBytesDefined = false;
  }

  void InitProps();

  COutHandler() { InitProps(); }

  HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &value);
};

#endif

class CHandler:
  public IInArchive,
  public IArchiveGetRawProps,
  #ifdef __7Z_SET_PROPERTIES
  public ISetProperties,
  #endif
  #ifndef EXTRACT_ONLY
  public IOutArchive,
  #endif
  PUBLIC_ISetCompressCodecsInfo
  public CMyUnknownImp
  #ifndef EXTRACT_ONLY
  , public COutHandler
  #endif
{
public:
  MY_QUERYINTERFACE_BEGIN2(IInArchive)
  MY_QUERYINTERFACE_ENTRY(IArchiveGetRawProps)
  #ifdef __7Z_SET_PROPERTIES
  MY_QUERYINTERFACE_ENTRY(ISetProperties)
  #endif
  #ifndef EXTRACT_ONLY
  MY_QUERYINTERFACE_ENTRY(IOutArchive)
  #endif
  QUERY_ENTRY_ISetCompressCodecsInfo
  MY_QUERYINTERFACE_END
  MY_ADDREF_RELEASE

  INTERFACE_IInArchive(;)
  INTERFACE_IArchiveGetRawProps(;)

  #ifdef __7Z_SET_PROPERTIES
  STDMETHOD(SetProperties)(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps);
  #endif

  #ifndef EXTRACT_ONLY
  INTERFACE_IOutArchive(;)
  #endif

  DECL_ISetCompressCodecsInfo

  CHandler();

private:
  CMyComPtr<IInStream> _inStream;
  NArchive::N7z::CDbEx _db;

  #ifndef _NO_CRYPTO
  bool _isEncrypted;
  bool _passwordIsDefined;
  UString _password;
  #endif

  #ifdef EXTRACT_ONLY

  #ifdef __7Z_SET_PROPERTIES
  UInt32 _numThreads;
  bool _useMultiThreadMixer;
  #endif

  UInt32 _crcSize;

  #else

  CRecordVector<CBond2> _bonds;

  HRESULT PropsMethod_To_FullMethod(CMethodFull &dest, const COneMethodInfo &m);
  HRESULT SetHeaderMethod(CCompressionMethodMode &headerMethod);
  HRESULT SetMainMethod(CCompressionMethodMode &method
      #ifndef _7ZIP_ST
      , UInt32 numThreads
      #endif
      );

  #endif

  bool IsFolderEncrypted(CNum folderIndex) const;
  #ifndef _SFX

  CRecordVector<UInt64> _fileInfoPopIDs;
  void FillPopIDs();
  void AddMethodName(AString &s, UInt64 id);
  HRESULT SetMethodToProp(CNum folderIndex, PROPVARIANT *prop) const;

  #endif

  DECL_EXTERNAL_CODECS_VARS
};

}}

#endif


text:
<!DOCTYPE html>

<link href="../generic.css" rel="stylesheet"/>

before[]after


text:
typedef NS_ENUM(NSUInteger, SMTableRefreshingStatus) {
    SMTableRefreshingStatusRefresh, //下拉刷新
    SMTableRefreshingStatusLoadMore //加载更多
};
//请求状态
typedef NS_ENUM(NSUInteger, SMTableRequestStatus) {
    SMTableRequestStatusRefreshSuccess,  //下拉刷新成功
    SMTableRequestStatusRefreshFailed,   //下拉刷新失败
    SMTableRequestStatusLoadMoreSuccess, //加载更多成功
    SMTableRequestStatusLoadMoreFailed   //加载更多失败
};

@interface SMTableViewModel : NSObject
//---------------------------
//            通用
//---------------------------
@property (nonatomic, assign) NSUInteger type;

//---------------------------
//         建议Store里设置
//---------------------------
@property (nonatomic, strong) NSMutableArray *dataSourceArray;  //数据

//---------------------------
//      建议视图tableview里设置
//---------------------------
@property (nonatomic, strong) UIColor *backgroundColor;         //背景颜色
@property (nonatomic, strong) UIColor *cellBackgroundColor;     //cell的背景颜色

//自定义附加视图
@property (nonatomic, strong) UIView *headerView;               //可随拖动消失的视图
@property (nonatomic, assign) CGFloat headerViewHeight;         //可随拖动消失的视图的高
@property (nonatomic, strong) UIView *fixedView;                //固定不动的视图
@property (nonatomic, assign) CGFloat fixedViewHeight;          //固定不动的视图高
@property (nonatomic, strong) UIView *hintView;                 //提示视图
@property (nonatomic, assign) CGFloat hintViewHeight;           //提示视图的高
@property (nonatomic, strong) UIView *guideView;                //覆盖在tableView上方的引导说明视图

//---------------------------
//           KVO View Side
//---------------------------
@property (nonatomic, assign) BOOL isHideGuideView;             //是否显示guide view
@property (nonatomic, assign) BOOL isHideHintView;              //是否显示hint view
//下拉刷新上拉加载更多
@property (nonatomic, assign) SMTableRequestStatus requestStatus; //刷新状态
//TableView Delegate
//通用
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSString *tableViewIdentifier;
//Cell
@property (nonatomic, strong) NSIndexPath *cellIndexPath;
@property (nonatomic, strong) UITableViewCell *cell;
//CellHeight
@property (nonatomic, strong) NSIndexPath *cellHeightIndexPath;
@property (nonatomic, assign) CGFloat cellHeight;

//---------------------------
//          KVO Data Side
//---------------------------
@property (nonatomic, assign) SMTableRefreshingStatus dataSourceRefreshingStatus; //请求状态

//---------------------------
//           开关
//---------------------------
@property (nonatomic, assign) BOOL isCloseRefresh;              //是否关闭下拉刷新,上拉加载更多
@property (nonatomic, assign) BOOL isAutoRefreshing;            //是否自动刷新

//---------------------------
//      下拉刷新上拉加载更多样式
//---------------------------
@property (nonatomic, strong) UIFont *refreshingHeaderStateLabelFont;         //刷新组件下拉刷新文本字体
@property (nonatomic, strong) UIColor *refreshingHeaderStateLabelColor;       //刷新组件下拉刷新文本颜色
@property (nonatomic, copy) NSString *refreshingHeaderTitleIdleText;          //刷新组件下拉静态文字
@property (nonatomic, copy) NSString *refreshingHeaderTitlePullingText;       //刷新组件下拉时的文字
@property (nonatomic, copy) NSString *refreshingHeaderTitleRefreshingText;    //刷新组件下拉刷新时显示文字

@property (nonatomic, strong) UIFont *refreshingFooterStateLabelFont;         //刷新组件加载更多文本字体
@property (nonatomic, strong) UIColor *refreshingFooterStateLabelColor;       //刷新组件加载更多文本颜色
@property (nonatomic, copy) NSString *refreshingFooterTitleIdleText;          //刷新组件加载更多静态文字
@property (nonatomic, copy) NSString *refreshingFooterTitleRefreshingText;    //刷新组件加载更多刷新时的文字
@property (nonatomic, copy) NSString *refreshingFooterTitleNoMoreDataText;    //刷新组件加载更多没有数据的文字

- (instancetype)initWithDefaultValue;

@end


text:
package com.inclutec.louis.interfaces;

import android.content.Context;
import android.hardware.usb.UsbManager;
import android.util.Log;

import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.driver.UsbSerialProber;
import com.hoho.android.usbserial.util.SerialInputOutputManager;

import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by martin on 9/12/15.
 */
public interface ArduinoDeviceConnector {

    public int connect();

    public int disconnect();

    public void initialize();

    public void setContext(Context aContext);

    public int write(String data);

    public int stopIoManager();

    public int startIoManager();
}


text:
package org.zstack.sdk;

public class UpdateEcsInstanceResult {
    public EcsInstanceInventory inventory;
    public void setInventory(EcsInstanceInventory inventory) {
        this.inventory = inventory;
    }
    public EcsInstanceInventory getInventory() {
        return this.inventory;
    }

}


text:
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
package org.openqa.selenium.devtools.target;

import com.google.common.collect.ImmutableMap;
import com.google.common.reflect.TypeToken;
import org.openqa.selenium.Beta;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.ConverterFunctions;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.target.model.AttachToTarget;
import org.openqa.selenium.devtools.target.model.BrowserContextID;
import org.openqa.selenium.devtools.target.model.DetachedFromTarget;
import org.openqa.selenium.devtools.target.model.ReceivedMessageFromTarget;
import org.openqa.selenium.devtools.target.model.RemoteLocation;
import org.openqa.selenium.devtools.target.model.SessionId;
import org.openqa.selenium.devtools.target.model.TargetCrashed;
import org.openqa.selenium.devtools.target.model.TargetId;
import org.openqa.selenium.devtools.target.model.TargetInfo;

import java.util.List;
import java.util.Objects;
import java.util.Optional;

import static org.openqa.selenium.devtools.ConverterFunctions.map;

public class Target {

  /**
   * Activates (focuses) the target.
   */
  public static Command<Void> activateTarget(TargetId targetId) {
    Objects.requireNonNull(targetId, "Target ID must be set.");
    return new Command<>("Target.activateTarget", ImmutableMap.of("targetId", targetId));
  }

  /**
   * Attaches to the browser target, only uses flat sessionId mode.EXPERIMENTAL
   *
   * @return {@link SessionId}
   */
  @Beta
  public static Command<SessionId> attachToBrowserTarget() {
    return new Command<>(
        "Target.attachToBrowserTarget",
        ImmutableMap.of(),
        ConverterFunctions.map("sessionId", SessionId.class));
  }

  /**
   * Closes the target. If the target is a page that gets closed too.
   */
  public static Command<Boolean> closeTarget(TargetId targetId) {
    Objects.requireNonNull(targetId, "Target ID must be set.");
    return new Command<>(
        "Target.closeTarget",
        ImmutableMap.of("targetId", targetId),
        ConverterFunctions.map("success", Boolean.class));
  }

  /**
   * nject object to the target's main frame that provides a communication channel with browser
   * target. Injected object will be available as window[bindingName]. The object has the follwing
   * API: binding.send(json) - a method to send messages over the remote debugging protocol
   * binding.onmessage = json => handleMessage(json) - a callback that will be called for the
   * protocol notifications and command responses.
   */
  @Beta
  public static Command<Void> exposeDevToolsProtocol(
      TargetId targetId, Optional<String> bindingName) {
    Objects.requireNonNull(targetId, "Target ID must be set.");
    String bindingNameValue = (bindingName.isPresent()) ? bindingName.get() : "cdp";
    return new Command<>(
        "Target.exposeDevToolsProtocol",
        ImmutableMap.of("targetId", targetId, "bindingName", bindingNameValue));
  }

  /**
   * Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than
   * one.EXPERIMENTAL
   */
  @Beta
  public static Command<BrowserContextID> createBrowserContext() {
    return new Command<>(
        "Target.createBrowserContext",
        ImmutableMap.of(),
        ConverterFunctions.map("browserContextId", BrowserContextID.class));
  }

  /**
   * Returns all browser contexts created with Target.createBrowserContext method.EXPERIMENTAL
   */
  @Beta
  public static Command<List<BrowserContextID>> getBrowserContexts() {
    return new Command<>(
        "Target.getBrowserContexts",
        ImmutableMap.of(),
        ConverterFunctions.map(
            "browserContextIds", new TypeToken<List<BrowserContextID>>() {
            }.getType()));
  }

  /**
   * Creates a new page.
   */
  public static Command<TargetId> createTarget(
      String url,
      Optional<Integer> width,
      Optional<Integer> height,
      Optional<BrowserContextID> browserContextID,
      Optional<Boolean> enableBeginFrameControl,
      Optional<Boolean> newWindow,
      Optional<Boolean> background) {
    Objects.requireNonNull(url, "Url is required");
    final ImmutableMap.Builder<String, Object> params = ImmutableMap.builder();
    params.put("url", url);
    width.ifPresent(integer -> params.put("width", integer));
    height.ifPresent(integer -> params.put("height", integer));
    browserContextID.ifPresent(
        browserContextId -> params.put("browserContextId", browserContextId));
    enableBeginFrameControl.ifPresent(aBoolean -> params.put("enableBeginFrameControl", aBoolean));
    newWindow.ifPresent(aBoolean -> params.put("newWindow", aBoolean));
    background.ifPresent(aBoolean -> params.put("background", aBoolean));
    return new Command<>(
        "Target.createTarget", params.build(), ConverterFunctions.map("targetId", TargetId.class));
  }

  /**
   * Detaches session with given id.
   */
  public static Command<Void> detachFromTarget(
      Optional<SessionId> sessionId, Optional<TargetId> targetId) {
    final ImmutableMap.Builder<String, Object> params = ImmutableMap.builder();
    sessionId.ifPresent(sessionID -> params.put("sessionId", sessionID));
    targetId.ifPresent(targetID -> params.put("targetId", targetID));
    return new Command<>("Target.detachFromTarget", params.build());
  }

  /**
   * Deletes a BrowserContext. All the belonging pages will be closed without calling their
   * beforeunload hooks.EXPERIMENTAL
   */
  @Beta
  public static Command<Void> disposeBrowserContext(BrowserContextID browserContextID) {
    Objects.requireNonNull(browserContextID, "browserContextId is required");
    return new Command<>(
        "Target.disposeBrowserContext", ImmutableMap.of("browserContextId", browserContextID));
  }

  /**
   * Returns information about a target.EXPERIMENTAL
   */
  @Beta
  public static Command<TargetInfo> getTargetInfo(Optional<TargetId> targetId) {
    final ImmutableMap.Builder<String, Object> params = ImmutableMap.builder();
    targetId.ifPresent(targetID -> params.put("targetId", targetID));
    return new Command<>(
        "Target.getTargetInfo",
        params.build(),
        ConverterFunctions.map("targetInfo", TargetInfo.class));
  }

  /**
   * Retrieves a list of available targets.
   */
  public static Command<List<TargetInfo>> getTargets() {
    return new Command<>(
        "Target.getTargets",
        ImmutableMap.of(),
        ConverterFunctions.map("targetInfos", new TypeToken<List<TargetInfo>>() {
        }.getType()));
  }

  /**
   * Controls whether to discover available targets and notify via
   * targetCreated/targetInfoChanged/targetDestroyed events.
   */
  public static Command<Void> sendMessageToTarget(
      String message, Optional<SessionId> sessionID, @Deprecated Optional<TargetId> targetID) {
    Objects.requireNonNull(message, "message is required");
    final ImmutableMap.Builder<String, Object> params = ImmutableMap.builder();
    params.put("message", message);
    sessionID.ifPresent(sessionId -> params.put("sessionId", sessionId));
    targetID.ifPresent(targetId -> params.put("targetId", targetId));
    return new Command<>("Target.sendMessageToTarget", params.build());
  }

  /**
   * Attaches to the target with given id.
   *
   * @return {@link SessionId}
   */
  public static Command<SessionId> attachToTarget(TargetId targetId, Optional<Boolean> flatten) {
    Objects.requireNonNull(targetId, "Target ID must be set.");
    final ImmutableMap.Builder<String, Object> params = ImmutableMap.builder();
    params.put("targetId", targetId);
    params.put("flatten", flatten.orElse(true));
//    flatten.ifPresent(aBoolean -> params.put("flatten", aBoolean));
    return new Command<>(
        "Target.attachToTarget",
        params.build(),
        ConverterFunctions.map("sessionId", SessionId.class));
  }

  /**
   * Controls whether to automatically attach to new targets which are considered to be related to
   * this one. When turned on, attaches to all existing related targets as well. When turned off,
   * automatically detaches from all currently attached targets.EXPERIMENTAL
   */
  public static Command<Void> setAutoAttach(
      Boolean autoAttach, Boolean waitForDebuggerOnStart, Optional<Boolean> flatten) {
    Objects.requireNonNull(autoAttach, "autoAttach is required");
    Objects.requireNonNull(waitForDebuggerOnStart, "waitForDebuggerOnStart is required");
    final ImmutableMap.Builder<String, Object> params = ImmutableMap.builder();
    params.put("autoAttach", autoAttach);
    params.put("waitForDebuggerOnStart", waitForDebuggerOnStart);
    flatten.ifPresent(aBoolean -> params.put("flatten", aBoolean));
    return new Command<>("Target.setAutoAttach", params.build());
  }

  /**
   * Controls whether to discover available targets and notify via
   * targetCreated/targetInfoChanged/targetDestroyed events.
   */
  public static Command<Void> setDiscoverTargets(boolean discover) {
    return new Command(
        "Target.setDiscoverTargets",
        ImmutableMap.of("discover", discover));
  }

  /**
   * Enables target discovery for the specified locations, when setDiscoverTargets was set to
   * true.EXPERIMENTAL
   */
  @Beta
  public static Command<Void> setRemoteLocations(List<RemoteLocation> locations) {
    return new Command(
        "Target.setRemoteLocations",
        ImmutableMap.of("locations", locations));
  }

  /**
   * Issued when attached to target because of auto-attach or attachToTarget command.EXPERIMENTAL
   */
  @Beta
  public static Event<AttachToTarget> attachedToTarget() {
    return new Event<>("Target.attachedToTarget", map("sessionId", AttachToTarget.class));
  }

  /**
   * Issued when detached from target for any reason (including detachFromTarget command). Can be
   * issued multiple times per target if multiple sessions have been attached to it.EXPERIMENTAL
   */
  @Beta
  public static Event<DetachedFromTarget> detachedFromTarget() {
    return new Event<>("Target.detachedFromTarget", input -> input.read(DetachedFromTarget.class));
  }

  /**
   * Notifies about a new protocol message received from the session (as reported in
   * attachedToTarget event).
   */
  public static Event<ReceivedMessageFromTarget> receivedMessageFromTarget() {
    return new Event<>(
        "Target.receivedMessageFromTarget", map("sessionId", ReceivedMessageFromTarget.class));
  }

  /**
   * Issued when a possible inspection target is created.
   */
  public static Event<TargetInfo> targetCreated() {
    return new Event<>("Target.targetDestroyed", map("targetInfo", TargetInfo.class));
  }

  /**
   * Issued when a target is destroyed.
   */
  public static Event<TargetId> targetDestroyed() {
    return new Event<>("Target.targetDestroyed", map("targetId", TargetId.class));
  }

  /**
   * Issued when a target has crashed.
   */
  public static Event<TargetCrashed> targetCrashed() {
    return new Event<>("Target.targetCrashed", map("targetId", TargetCrashed.class));
  }

  /**
   * Issued when some information about a target has changed. This only happens between
   * targetCreated and targetDestroyed.
   */
  public static Event<TargetInfo> targetInfoChanged() {
    return new Event<>("Target.targetInfoChanged", map("targetInfo", TargetInfo.class));
  }
}


text:
/* Licensed under Apache-2.0 */
package com.rabidgremlin.mutters.bot.ink;

import com.bladecoder.ink.runtime.Story;
import com.bladecoder.ink.runtime.StoryState;
import com.rabidgremlin.mutters.core.session.Session;

/**
 * Utility class for InkBot's interactions with a Session.
 *
 * @author rabidgremlin
 *
 */
public class InkBotSessionUtils extends com.rabidgremlin.mutters.core.util.SessionUtils
{
  private static final String STORY_LENGTH_SUFFIX = "0987654321STORYJSONLENGTH1234567890";
  private static final String STORY_STATE_SUFFIX = "0987654321STORYSTATE1234567890";
  private static final String FAILED_COUNT_SUFFIX = "0987654321FAILEDCOUNT1234567890";

  protected InkBotSessionUtils()
  {
    // utility class
  }

  /**
   * Stores the failed to understand count for the bot.
   *
   * @param session The session.
   * @param count   The count.
   */
  public static void setFailedToUnderstandCount(Session session, int count)
  {
    session.setAttribute(SLOT_PREFIX + FAILED_COUNT_SUFFIX, Integer.valueOf(count));
  }

  /**
   * Gets the failed to understand count for the bot.
   *
   * @param session The session.
   * @return The count.
   */
  public static int getFailedToUnderstandCount(Session session)
  {
    Integer failedToUnderstandCount = (Integer) session.getAttribute(SLOT_PREFIX + FAILED_COUNT_SUFFIX);

    if (failedToUnderstandCount == null)
    {
      return 0;
    }
    else
    {
      return failedToUnderstandCount;
    }
  }

  /**
   * Stores the current Ink story state for the user into the session.
   *
   * @param session   The session.
   * @param story     The story.
   * @param storyJson The JSON string for the story. Used to temporary story
   *                  version check hack. See TestSessionRestore.
   */
  public static void saveInkStoryState(Session session, Story story, String storyJson)
  {
    StoryState storyState = story.getState();

    if (storyState == null)
    {
      throw new BadInkStoryState("storyState should not be null");
    }

    try
    {
      session.setAttribute(SLOT_PREFIX + STORY_STATE_SUFFIX, storyState.toJson());
      // save length of story JSON and use as a crude version check
      session.setAttribute(SLOT_PREFIX + STORY_LENGTH_SUFFIX, Integer.valueOf(storyJson.length()));
    }
    catch (Exception e)
    {
      throw new RuntimeException("Unexpected error. Failed to save story state", e);
    }
  }

  /**
   * Gets the user's current Ink story state from the session.
   *
   * @param session   The session.
   * @param story     The story.
   * @param storyJson The JSON string for the story. Used to temporary story
   *                  version check hack. See TestSessionRestore.
   */
  public static void loadInkStoryState(Session session, Story story, String storyJson)
  {
    StoryState storyState = story.getState();

    try
    {
      Integer storyJsonLength = (Integer) session.getAttribute(SLOT_PREFIX + STORY_LENGTH_SUFFIX);
      String stateJson = (String) session.getAttribute(SLOT_PREFIX + STORY_STATE_SUFFIX);

      if (stateJson != null)
      {
        // have state to restore so check that we have a story length and then check for
        // size mismatch
        if (storyJsonLength == null || storyJsonLength != storyJson.length())
        {
          throw new Exception("Story size mismatch. Assume new story has been loaded. Cannot restore session.");
        }

        storyState.loadJson(stateJson);
      }
    }
    catch (Exception e)
    {
      throw new BadInkStoryState("Unexpected error. Failed to load story state", e);
    }
  }

}


text:
<!DOCTYPE html>

<title>[Edit Instances Modal]</title>

						<button type="button" class="close" data-dismiss="modal">×</button>

[Modal Title]

						<form class="form-horizontal" method="post" action="#" th:action="@{/entities/productInstance}" th:object="${instanceDto}" id="editInstanceForm">
							<fieldset>

									[Operation]

											<input type="radio" id="operationRadioAdd" th:field="*{operation}" value="ADD_INSTANCES" />
											[Add instances]

											<input type="radio" id="operationRadioRemove" th:field="*{operation}" value="REMOVE_INSTANCES" />
											[Remove instances]

											<input type="radio" id="operationRadioAddDefected" th:field="*{operation}" value="ADD_DEFECTED_INSTANCES" />
											[Add defected instances]

									[Amount]
									<input type="number" class="form-control" id="productAmount" placeholder="Amount" min="1" th:field="*{newAmount}" />

									[Expiration Date]

										<input type="text" class="form-control" th:field="*{expirationDate}"/>

									<input type="hidden" id="productId" th:field="*{productId}" />

							</fieldset>
						</form>

						<button type="submit" form="editInstanceForm" class="btn btn-primary" th:text="#{base.save}" name="save">[Save]</button>
						<button type="button" class="btn btn-default" data-dismiss="modal" th:text="#{base.cancel}">[Cancel]</button>


text:
USE domotica;

DROP TABLE IF EXISTS ds18;

CREATE TABLE `ds18` (
  `sample_time`  datetime,
  `sample_epoch` int(11) unsigned,
  `temperature`  decimal(5,2),
  PRIMARY KEY (`sample_time`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;

# example to retrieve data:
-- mysql -h sql.lan --skip-column-names -e "USE domotica; SELECT * FROM bmp183 where (sample_time) >=NOW() - INTERVAL 6 HOUR;" | sed 's/\t/;/g;s/\n//g' > /tmp/sql.csv


text:
module Resque
  module Plugins
    module JobTemplate
      class ResqueJobWithStatus < Resque::JobWithStatus
        extend Resque::Plugins::Logged

        # Need to override the JobWithStatus instance logger.
        # We are not really going to use it because a) it just gets logged to Redis, and b) it's not easy to get at in resque-web
        #   without creating views. Hoptoad and our logging structure for Resque should be sufficient. None of resque-status seems
        #   to rely on the logger.
        def logger
          Rails.logger
        end
        alias_method :job_with_status_logger, :logger

        # N.B. When trying to update resque-web and alter the Resque::Status object that comes back, keep the following in mind.
        #   The Resque::Status object is essentially a hash.
        #     :message is set by (see the docs): at, tick, and set_status. At and tick check also whether the job should get killed.
        #       the message string is only set if a string is passed as one of the elements. If multiple strings are passed, then the last one wins.
        #       the message string also is overwritten by the job's failure with resque-status's default messaging.
        #    Passing hashes during tick, at, or set_status will cause any hashes to become part of the Status.
        #    Passing the same key later will cause it to get overwritten.
        #  Resque::Plugins::Status.status which is usually queued, working, failed, or completed is also hard to overwrite. You have to play within Resque::Plugins::Status boundaries.
        #    You can alter this so it displays in the resque-web, but when the job fails or completes, it will force it to completed or failed.
        #    If you call failed('Super awesome failure') but the job completes without an error during the perform, it will show completed and the default messaging from resque-status.
        #    Only if you do completed('spectacularly') will you get your own custom message but the job must complete successfully. Otherwise, it goes to failed and gets a message related to the exception.
        #
        #  So, in general, simple strings passed to tick, set_status, and at cannot be relied upon to stick around for the final Resque::Status.message hash value. They can be consumed by UIs.
        #    Use your own hash keys to communicate important messages or values.

        @num_steps = 0       # declare the number of steps in the subclass
        @current_step = 0    # the current step being processed in the job

        # Updates the status of the job to the next step
        def next_step(status)
          @current_step = 0 unless @current_step
          logger.info status
          at(@current_step+=1, @num_steps, status)
        end
      end
    end
  end
end


text:
var Component = new Brick.Component();
Component.requires = {
    mod: [
        {name: 'sys', files: ['appModel.js']}
    ]
};
Component.entryPoint = function(NS){

	var Y = Brick.YUI,
        SYS = Brick.mod.sys;

    NS.FieldItem = Y.Base.create('fieldItem', SYS.AppModel, [], {
        structureName: 'FieldItem'
    });

    NS.FieldList = Y.Base.create('fieldList', SYS.AppModelList, [], {
        appItem: NS.FieldItem
    });

    NS.SubjectItem = Y.Base.create('subjectItem', SYS.AppModel, [], {
        structureName: 'SubjectItem'
    });

    NS.SubjectList = Y.Base.create('subjectList', SYS.AppModelList, [], {
        appItem: NS.SubjectItem
    });

    NS.GroupItem = Y.Base.create('groupItem', SYS.AppModel, [], {
        structureName: 'GroupItem'
    });

    NS.GroupList = Y.Base.create('groupList', SYS.AppModelList, [], {
        appItem: NS.GroupItem
    });

    NS.StudItem = Y.Base.create('studItem', SYS.AppModel, [], {
        structureName: 'StudItem'
    });

    NS.StudList = Y.Base.create('studList', SYS.AppModelList, [], {
        appItem: NS.StudItem
    });

    NS.SheetItem = Y.Base.create('sheetItem', SYS.AppModel, [], {
        structureName: 'SheetItem'
    });

    NS.SheetList = Y.Base.create('sheetList', SYS.AppModelList, [], {
        appItem: NS.SheetItem
    });

    NS.MarkItem = Y.Base.create('markItem', SYS.AppModel, [], {
        structureName: 'MarkItem'
    });

    NS.MarkList = Y.Base.create('markList', SYS.AppModelList, [], {
        appItem: NS.MarkItem
    });

    NS.MarkItemStat = Y.Base.create('markItemStat', SYS.AppModel, [], {
        structureName: 'MarkItemStat'
    });

    NS.MarkListStat = Y.Base.create('markListStat', SYS.AppModelList, [], {
        appItem: NS.MarkItemStat
    });

    NS.GroupModalItem = Y.Base.create('groupModalItem', SYS.AppModel, [], {
        structureName: 'GroupModalItem'
    });

    NS.GroupModalList = Y.Base.create('groupModalList', SYS.AppModelList, [], {
        appItem: NS.GroupModalItem
    });

    NS.ReportItem = Y.Base.create('reportItem', SYS.AppModel, [], {
        structureName: 'ReportItem'
    });

    NS.ProgramItem = Y.Base.create('programItem', SYS.AppModel, [], {
        structureName: 'ProgramItem'
    });

    NS.ProgramList = Y.Base.create('programList', SYS.AppModelList, [], {
        appItem: NS.ProgramItem
    });

    NS.DepartItem = Y.Base.create('departItem', SYS.AppModel, [], {
        structureName: 'DepartItem'
    });

    NS.DepartList = Y.Base.create('departList', SYS.AppModelList, [], {
        appItem: NS.DepartItem
    });

    NS.TeacherItem = Y.Base.create('teacherItem', SYS.AppModel, [], {
        structureName: 'TeacherItem'
    });

    NS.TeacherList = Y.Base.create('teacherList', SYS.AppModelList, [], {
        appItem: NS.TeacherItem
    });

};


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2015 Hippo B.V. (http://www.onehippo.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.
  -->
<!DOCTYPE Repository
  PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
  "http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
<Repository>

  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>

  <Security appName="Jackrabbit">
    <SecurityManager class="org.hippoecm.repository.security.SecurityManager"/>
    <AccessManager class="org.hippoecm.repository.security.HippoAccessManager"/>
    <LoginModule class="org.hippoecm.repository.security.HippoLoginModule"/>
  </Security>

  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>

  <Workspace name="${wsp.name}">

    <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>

    <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager">
      <param name="persistent" value="false"/>
    </PersistenceManager>

    <SearchIndex class="org.hippoecm.repository.FacetedNavigationEngineImpl">
      <param name="directoryManagerClass" value="org.apache.jackrabbit.core.query.lucene.directory.RAMDirectoryManager"/>
      <param name="indexingConfiguration" value="indexing_configuration.xml"/>
      <param name="indexingConfigurationClass" value="org.hippoecm.repository.query.lucene.ServicingIndexingConfigurationImpl"/>
      <param name="path" value="${wsp.home}/index"/>
      <param name="useCompoundFile" value="true"/>
      <param name="minMergeDocs" value="1000"/>
      <param name="volatileIdleTime" value="10"/>
      <param name="maxMergeDocs" value="1000000000"/>
      <param name="mergeFactor" value="5"/>
      <param name="maxFieldLength" value="10000"/>
      <param name="bufferSize" value="1000"/>
      <param name="cacheSize" value="1000"/>
      <param name="forceConsistencyCheck" value="false"/>
      <param name="enableConsistencyCheck" value="false"/>
      <param name="autoRepair" value="true"/>
      <param name="analyzer" value="org.hippoecm.repository.query.lucene.StandardHippoAnalyzer"/>
      <param name="queryClass" value="org.apache.jackrabbit.core.query.QueryImpl"/>
      <param name="respectDocumentOrder" value="false"/>
      <param name="resultFetchSize" value="2147483647"/>
      <param name="extractorPoolSize" value="0"/>
      <param name="extractorTimeout" value="100"/>
      <param name="extractorBackLogSize" value="100"/>
      <param name="excerptProviderClass" value="org.apache.jackrabbit.core.query.lucene.DefaultHTMLExcerpt"/>
      <param name="supportHighlighting" value="true"/>
      <!-- optional cache parameters for faceted engine. The default size when not configured is 1000 for both parameters -->
      <!-- param name="docIdSetCacheSize" value="1000"/>
      <param name="facetValueCountMapCacheSize" value="1000"/-->
    </SearchIndex>

    <ISMLocking class="org.apache.jackrabbit.core.state.FineGrainedISMLocking"/>
  </Workspace>

  <Versioning rootPath="${rep.home}/version">
    <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>

    <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemBundlePersistenceManager">
      <param name="persistent" value="false"/>
    </PersistenceManager>

    <ISMLocking class="org.apache.jackrabbit.core.state.FineGrainedISMLocking"/>
  </Versioning>

  <Cluster id="_HIPPO_EXTERNAL_REPO_SYNC_node">
    <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
      <param name="driver" value="org.h2.Driver" />
      <param name="url" value="jdbc:h2:${rep.home}/repository/db"/>
      <param name="schemaObjectPrefix" value="journal_"/>
      <param name="databaseType" value="h2"/>
      <param name="user" value="sa"/>
      <param name="password" value="sa"/>
    </Journal>
  </Cluster>

</Repository>


text:
<xi:include href="master.html" />

  <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
  <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/pagination.css')}" />
  <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/form.css')}" />
  <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/details.css')}" />
  <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/tabs.css')}" />
    <link rel="stylesheet" type="text/css" href="${tg.url('/css/jqcontextmenu.css')}" />

  <title>Requests ${pname}</title>

    ${sidebar()}

Show all

Show requested

History of changes

                ${pcompound.mol.name}${pcompound.gid}

                    <py:for each="item in pcompound.mol.names">
                      <py:if test="item.name != pcompound.mol.name">
                             ${item.name}
                        </py:if>
                      </py:for>

                    atoms
                    rings
                    molecular weight
                    logP
                    hba
                    hbd
                    tpsa
                    qed

                        ${pcompound.mol.num_hvy_atoms}/${pcompound.mol.num_atoms}
                        ${pcompound.mol.num_rings}
                        500 and 'red' or 'black'}">${pcompound.mol.mw}
                        5 and 'red' or 'black'}">${round(pcompound.mol.logp,2)}
                        10 and 'red' or 'black'}">${pcompound.mol.hba}
                        5 and 'red' or 'black'}">${pcompound.mol.hbd}
                        ${pcompound.mol.tpsa}
                        ${pcompound.mol.qed}

            show

Formula:	${formula}

InChI:
${pcompound.mol.inchi}

SMILES:
${pcompound.mol.structure}

            Tags:

${tag.name}

Details

Edit

Edit structure

Edit request

Accept request

Reject

Requests (${len(pcompounds)})

Synthesis (${len(scompounds)})

${scomp.gid}-${scomp.seq}

Library (${len(lcompounds)})

${lcomp.gid}-${lcomp.seq}

Ctoxicity (${sum(len(lc.ctoxicity) for lc in lcompounds)})

${lcomp.gid}-${lcomp.seq}

${pcom.gid}-${pcom.seq}

Details of Synthesis request

Request ID:	${pcompound.id}

Creator:	${pcompound.owner}

Recipient:	${pcompound.principal}

Status:	${pcompound.status.name}

Priority:

Create date:	${pcompound.create_date}

 Notes:

${pcompound.notes}

History of changes.

                        User
                        Status
                        Data
                        Changes

                        ${history.user}
                        ${history.status}
                        ${history.date}
                        ${history.changes}


text:
<?php

namespace SoftUniBlogBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ArticleType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('title', TextType::class)
            ->add('content', TextType::class);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'SoftUniBlogBundle\Entity\Article',
        ));
    }

}


text:
.helperMenuColumn {
  float: left;
  margin-right: 5px;
  width: 180px;
}
.helperMenuSectionHeader {
  background: #e0e0e0;
  font: bold 13px Arial, Helvetica, sans-serif;
  margin: 4px 0 2px 0;
  text-align: center;
}
.helperMenuDiv {
  border:3px solid #ccbb77;
  border-radius: 5px;
  color: black;
  cursor: default;
  font-size: 12px;
  opacity: 0;
  position: absolute;
  text-align: center;
  text-decoration: none;
  transition: opacity 100ms linear, visibility 0s linear 100ms;
  visibility: hidden;
}
.helperMenuShow {
  opacity: 1;
  transition: opacity 100ms linear, visibility 0s linear;
  visibility: visible;
}
.helperMenuReply {
  cursor: pointer;
  text-decoration: underline;
}
.helperMenu {
  color: yellow;
  cursor: pointer;
  font-weight: bold;
  left: 0;
  position: absolute;
  text-align: center;
  text-decoration: underline;
  white-space: nowrap;
  z-index: 75;
}
.helperMenuFixed {position: fixed;}
.helperMenuMove {cursor: move;}
.helperDevBtn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  margin: 0;
  padding: 0;
  text-decoration: underline;
  user-select: text;
}


text:
class Deck < ActiveRecord::Base
  has_many :cards
  has_many :rounds
end


text:
#ifndef AERON_SYSTEMCOUNTERDESCRIPTOR_H
#define AERON_SYSTEMCOUNTERDESCRIPTOR_H

#include <cstdint>

namespace aeron { namespace driver { namespace status {

using namespace aeron::concurrent;

class SystemCounterDescriptor {

public:
    static const std::int32_t VALUES_SIZE = 25;
    typedef std::array<SystemCounterDescriptor, VALUES_SIZE> values_t;

    static const std::int32_t COUNT = 1;

    static const SystemCounterDescriptor BYTES_SENT;
    static const SystemCounterDescriptor BYTES_RECEIVED;
    static const SystemCounterDescriptor RECEIVER_PROXY_FAILS;
    static const SystemCounterDescriptor SENDER_PROXY_FAILS;
    static const SystemCounterDescriptor CONDUCTOR_PROXY_FAILS;
    static const SystemCounterDescriptor NAK_MESSAGES_SENT;
    static const SystemCounterDescriptor NAK_MESSAGES_RECEIVED;
    static const SystemCounterDescriptor STATUS_MESSAGES_SENT;
    static const SystemCounterDescriptor STATUS_MESSAGES_RECEIVED;
    static const SystemCounterDescriptor HEARTBEATS_SENT;
    static const SystemCounterDescriptor HEARTBEATS_RECEIVED;
    static const SystemCounterDescriptor RETRANSMITS_SENT;
    static const SystemCounterDescriptor FLOW_CONTROL_UNDER_RUNS;
    static const SystemCounterDescriptor FLOW_CONTROL_OVER_RUNS;
    static const SystemCounterDescriptor INVALID_PACKETS;
    static const SystemCounterDescriptor ERRORS;
    static const SystemCounterDescriptor DATA_PACKET_SHORT_SENDS;
    static const SystemCounterDescriptor SETUP_MESSAGE_SHORT_SENDS;
    static const SystemCounterDescriptor STATUS_MESSAGE_SHORT_SENDS;
    static const SystemCounterDescriptor NAK_MESSAGE_SHORT_SENDS;
    static const SystemCounterDescriptor CLIENT_KEEP_ALIVES;
    static const SystemCounterDescriptor SENDER_FLOW_CONTROL_LIMITS;
    static const SystemCounterDescriptor UNBLOCKED_PUBLICATIONS;
    static const SystemCounterDescriptor UNBLOCKED_COMMANDS;
    static const SystemCounterDescriptor POSSIBLE_TTL_ASYMMETRY;

    static const values_t VALUES;

    static inline const SystemCounterDescriptor getById(std::int32_t id)
    {
        return BYTES_SENT;
    }

    AtomicCounter* newCounter(CountersManager& countersManager)
    {
        std::int32_t counterId = countersManager.allocate(m_label, m_id, [&](AtomicBuffer &buffer)
        {
            buffer.putInt32(0, m_id);
        });

        return new AtomicCounter(countersManager.valuesBuffer(), counterId, countersManager);
    }

    inline std::int32_t id() const
    {
        return m_id;
    }

    inline const char* label() const
    {
        return m_label;
    }

private:
    SystemCounterDescriptor(std::int32_t id, const char* label)
    : m_id(id), m_label(label)
    {
    }

    const std::int32_t m_id;
    const char* m_label;
};

const SystemCounterDescriptor SystemCounterDescriptor::BYTES_SENT = SystemCounterDescriptor{0, "Bytes Sent"};
const SystemCounterDescriptor SystemCounterDescriptor::BYTES_RECEIVED = SystemCounterDescriptor(1, "Bytes received");
const SystemCounterDescriptor SystemCounterDescriptor::RECEIVER_PROXY_FAILS = SystemCounterDescriptor(2, "Failed offers to ReceiverProxy");
const SystemCounterDescriptor SystemCounterDescriptor::SENDER_PROXY_FAILS = SystemCounterDescriptor(3, "Failed offers to SenderProxy");
const SystemCounterDescriptor SystemCounterDescriptor::CONDUCTOR_PROXY_FAILS = SystemCounterDescriptor(4, "Failed offers to DriverConductorProxy");
const SystemCounterDescriptor SystemCounterDescriptor::NAK_MESSAGES_SENT = SystemCounterDescriptor(5, "NAKs sent");
const SystemCounterDescriptor SystemCounterDescriptor::NAK_MESSAGES_RECEIVED = SystemCounterDescriptor(6, "NAKs received");
const SystemCounterDescriptor SystemCounterDescriptor::STATUS_MESSAGES_SENT = SystemCounterDescriptor(7, "Status Messages sent");
const SystemCounterDescriptor SystemCounterDescriptor::STATUS_MESSAGES_RECEIVED = SystemCounterDescriptor(8, "Status Messages received");
const SystemCounterDescriptor SystemCounterDescriptor::HEARTBEATS_SENT = SystemCounterDescriptor(9, "Heartbeats sent");
const SystemCounterDescriptor SystemCounterDescriptor::HEARTBEATS_RECEIVED = SystemCounterDescriptor(10, "Heartbeats received");
const SystemCounterDescriptor SystemCounterDescriptor::RETRANSMITS_SENT = SystemCounterDescriptor(11, "Retransmits sent");
const SystemCounterDescriptor SystemCounterDescriptor::FLOW_CONTROL_UNDER_RUNS = SystemCounterDescriptor(12, "Flow control under runs");
const SystemCounterDescriptor SystemCounterDescriptor::FLOW_CONTROL_OVER_RUNS = SystemCounterDescriptor(13, "Flow control over runs");
const SystemCounterDescriptor SystemCounterDescriptor::INVALID_PACKETS = SystemCounterDescriptor(14, "Invalid packets");
const SystemCounterDescriptor SystemCounterDescriptor::ERRORS = SystemCounterDescriptor(15, "Errors");
const SystemCounterDescriptor SystemCounterDescriptor::DATA_PACKET_SHORT_SENDS = SystemCounterDescriptor(16, "Data Packet short sends");
const SystemCounterDescriptor SystemCounterDescriptor::SETUP_MESSAGE_SHORT_SENDS = SystemCounterDescriptor(17, "Setup Message short sends");
const SystemCounterDescriptor SystemCounterDescriptor::STATUS_MESSAGE_SHORT_SENDS = SystemCounterDescriptor(18, "Status Message short sends");
const SystemCounterDescriptor SystemCounterDescriptor::NAK_MESSAGE_SHORT_SENDS = SystemCounterDescriptor(19, "NAK Message short sends");
const SystemCounterDescriptor SystemCounterDescriptor::CLIENT_KEEP_ALIVES = SystemCounterDescriptor(20, "Client keep-alives");
const SystemCounterDescriptor SystemCounterDescriptor::SENDER_FLOW_CONTROL_LIMITS = SystemCounterDescriptor(21, "Sender flow control limits applied");
const SystemCounterDescriptor SystemCounterDescriptor::UNBLOCKED_PUBLICATIONS = SystemCounterDescriptor(22, "Unblocked Publications");
const SystemCounterDescriptor SystemCounterDescriptor::UNBLOCKED_COMMANDS = SystemCounterDescriptor(23, "Unblocked Control Commands");
const SystemCounterDescriptor SystemCounterDescriptor::POSSIBLE_TTL_ASYMMETRY = SystemCounterDescriptor(24, "Possible TTL Asymmetry");

const SystemCounterDescriptor::values_t SystemCounterDescriptor::VALUES = {
    SystemCounterDescriptor::BYTES_SENT,
    SystemCounterDescriptor::BYTES_RECEIVED,
    SystemCounterDescriptor::RECEIVER_PROXY_FAILS,
    SystemCounterDescriptor::SENDER_PROXY_FAILS,
    SystemCounterDescriptor::CONDUCTOR_PROXY_FAILS,
    SystemCounterDescriptor::NAK_MESSAGES_SENT,
    SystemCounterDescriptor::NAK_MESSAGES_RECEIVED,
    SystemCounterDescriptor::STATUS_MESSAGES_SENT,
    SystemCounterDescriptor::STATUS_MESSAGES_RECEIVED,
    SystemCounterDescriptor::HEARTBEATS_SENT,
    SystemCounterDescriptor::HEARTBEATS_RECEIVED,
    SystemCounterDescriptor::RETRANSMITS_SENT,
    SystemCounterDescriptor::FLOW_CONTROL_UNDER_RUNS,
    SystemCounterDescriptor::FLOW_CONTROL_OVER_RUNS,
    SystemCounterDescriptor::INVALID_PACKETS,
    SystemCounterDescriptor::ERRORS,
    SystemCounterDescriptor::DATA_PACKET_SHORT_SENDS,
    SystemCounterDescriptor::SETUP_MESSAGE_SHORT_SENDS,
    SystemCounterDescriptor::STATUS_MESSAGE_SHORT_SENDS,
    SystemCounterDescriptor::NAK_MESSAGE_SHORT_SENDS,
    SystemCounterDescriptor::CLIENT_KEEP_ALIVES,
    SystemCounterDescriptor::SENDER_FLOW_CONTROL_LIMITS,
    SystemCounterDescriptor::UNBLOCKED_PUBLICATIONS,
    SystemCounterDescriptor::UNBLOCKED_COMMANDS,
    SystemCounterDescriptor::POSSIBLE_TTL_ASYMMETRY
};

}}}

#endif


text:
package org.TexasTorque.TexasTorque2013.autonomous.drive;

import edu.wpi.first.wpilibj.Timer;
import org.TexasTorque.TexasTorque2013.autonomous.AutonomousCommand;
import org.TexasTorque.TorqueLib.controlLoop.TorquePID;

public class AutonomousTurn extends AutonomousCommand
{
    private TorquePID gyroPID;
    private Timer timeoutTimer;
    private double timeoutSecs;
    private boolean firstCycle;
    private double goal;
    private double cee;
    private double dr;

    public AutonomousTurn(double degrees, double timeout, double doneRange)
    {
        super();

        goal = degrees;
        firstCycle = true;
        dr = doneRange;

        gyroPID = new TorquePID();

        timeoutSecs = timeout;
        timeoutTimer = new Timer();
    }

    public void reset()
    {
        double p = params.getAsDouble("D_TurnGyroP", 0.0);
        double i = params.getAsDouble("D_TurnGyroI", 0.0);
        double d = params.getAsDouble("D_TurnGyroD", 0.0);
        double c = params.getAsDouble("D_TurnGyroAdditive", 0.0);
        double e = params.getAsDouble("D_TurnGyroEpsilon", 0.0);

        gyroPID.setPIDGains(p, i, d);
        gyroPID.setEpsilon(e);
        gyroPID.setDoneRange(dr);
        gyroPID.setMinDoneCycles(10);
        gyroPID.reset();

        cee = c;

        timeoutTimer.reset();
        timeoutTimer.start();
    }

    public boolean run()
    {
        if(firstCycle)
        {
            firstCycle = false;
            gyroPID.setSetpoint(this.sensorInput.getGyroAngle() + goal);
        }

        double xVal = gyroPID.calculate(sensorInput.getGyroAngle());
        xVal += cee * ((xVal < 0.0) ? -1.0 : 1.0);
        double yVal = 0.0;

        double leftDrive = yVal + xVal;
        double rightDrive = yVal - xVal;

        drivebase.setDriveSpeeds(-leftDrive, -rightDrive);

        if(timeoutTimer.get() > timeoutSecs)
        {
            System.err.println("Turn timed out");
            return true;
        }

        if(gyroPID.isDone())
        {
            return true;
        }
        else
        {
            return false;
        }
    }

}


text:
@echo off
setlocal enabledelayedexpansion

set sourcetreepath=SourceTree\SourceTree.exe
if exist "%programfiles%\Atlassian\%sourcetreepath%" (
    set sourcetreepath=%programfiles%\Atlassian\%sourcetreepath%
) else if exist "%programfiles(x86)%\Atlassian\%sourcetreepath%" (
    set "sourcetreepath=%programfiles(x86)%\Atlassian\%sourcetreepath%"
) else if exist "%localappdata%\%sourcetreepath%" (
    set sourcetreepath=%localappdata%\%sourcetreepath%
) else (
    echo [Error]: Could not find SourceTree.exe - is it installed? 1>&2
    goto :eof
)

REM Convert the first argument to a full path
set directory=%~f1
REM If the first argument is empty use the current directory
if "%directory%" == "" set directory=%CD%

REM If the first argument is not a directory (e.g. a file) remove the filename
if not exist "%directory%\*" (
    set directory=%~dp1
)

REM go to the target directory
pushd "%directory%"

REM get the root of the repository
for /f "delims=" %%i in ('git rev-parse --show-toplevel') do set directory=%%i
git rev-parse --show-toplevel 1> nul 2> nul

if %errorlevel% EQU 0 (
    start "" "%sourcetreepath%" -f "%directory:/=\%"
)

popd
endlocal


text:
using System;
using System.Collections.Generic;
using MVCForum.Domain.DomainModel;
using MVCForum.Domain.DomainModel.Activity;

namespace MVCForum.Domain.Interfaces.Services
{
    public interface IPollVoteService
    {
        List<PollVote> GetAllPollVotes();
        PollVote Add(PollVote pollVote);
        bool HasUserVotedAlready(Guid answerId, Guid userId);
        PollVote Get(Guid id);
        void Delete(PollVote pollVote);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Records;
using OrchardCore.Lists.Indexes;
using YesSql;

namespace OrchardCore.Lists.Helpers
{
    internal static class ListQueryHelpers
    {
        internal static Task<int> QueryListItemsCountAsync(ISession session, string listContentItemId, Expression<Func<ContentItemIndex, bool>> itemPredicate = null)
        {
            return session.Query<ContentItem>()
                    .With<ContainedPartIndex>(x => x.ListContentItemId == listContentItemId)
                    .With<ContentItemIndex>(itemPredicate ?? (x => x.Published))
                    .CountAsync();
        }

        internal static Task<IEnumerable<ContentItem>> QueryListItemsAsync(ISession session, string listContentItemId, Expression<Func<ContentItemIndex, bool>> itemPredicate = null)
        {
            return session.Query<ContentItem>()
                    .With<ContainedPartIndex>(x => x.ListContentItemId == listContentItemId)
                    .With<ContentItemIndex>(itemPredicate ?? (x => x.Published))
                    .ListAsync();
        }
    }
}


text:
Returns host name from `hostname:port` string

Example usage:
```
connection_string: 127.0.0.1:5432
host: "{{ connection_string | address }}" # host=127.0.0.1
```

See also [port](#port).

## byattr ##
Returns dict from list of dicts by attribute.

Example usage:
```
users:
  - { name: john, uid: 1000, comment: John Doe }
  - { name: bob,  uid: 1001, comment: Bob Smith }

john: "{{ users | byattr('name', 'john') }}"
john_uid:  "{{ john.uid }}"
```

## defined ##
Raises error when variable is not defined or empty
Optional argument is name of the variable to display in error message

Example usage:
```
  - debug: msg="User id is {{ uid | defined }}"
  - debug: msg="User id is {{ uid | defined('uid') }}"

  Result1: FAILED! => {"failed": true, "msg": "Variable not defined"}
  Result2: FAILED! => {"failed": true, "msg": "Variable not defined: uid"}
```

## filename ##
Returns filename from path and trims `.j2` extension if available.

Example usage:
```
- name: Copy all template files at once
  template:
    src={{ item }}
    dest=/etc/service/conf.d/{{ item | filename }}
    owner=root
    group=root
    mode=0600
  with_fileglob: ../templates/service/*.j2
```

## merge ##

Merges dict keys with defaults key __all__ recursively with merge lists support and excludes. See sample usage for details.

See `README` file in plugin directory for more details.

## port ##
Returns port number from `hostname:port` string

Example usage:
```
connection_string: 127.0.0.1:5432
port: "{{ connection_string | port }}" # port=5432
```

## todict ##
Returns list of dicts from list or list of lists

Example usage:
```
users:
  - [ 'user1', 'pwd1' ]
  - [ 'user2', 'pwd2' ]
users_dict: "{{ users | todict('name', 'password') }}"
```

Result is:
```
users_dict:
  - { name: user1, password: pwd1 }
  - { name: user2, password: pwd2 }
```

## tolist ##
Returns list from string or list

Example usage:

```
backup_templates: duplicity
backup_templates: ['duplicity', 'lvm']
- name: Copy backup templates
  template:
    src={{ item }}.j2
    dest=/etc/backup.d/{{ item }}
    owner=root
    group=root
    mode=0600
  with_items: "{{ backup_templates | tolist }}"
```

## vault ##

Returns decrypted text from cipher text using secret key file. Allows to get rid of plain text passwords in ansible repository without using ansible-vault nor encrypting whole files.

See `README` file in plugin directory for more details.

## zip ##

Aggregates matching elements from lists or lists of dicts.

See `README` file in filter directory


text:
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m") throw new TypeError("Private method is not writable");
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var _FlvMedia_player, _FlvMedia_events, _FlvMedia_options;
import { HAS_MSE } from '../utils/constants';
import { addEvent, loadScript } from '../utils/general';
import { isFlvSource } from '../utils/media';
import Native from './native';
class FlvMedia extends Native {
    constructor(element, mediaSource, options) {
        super(element, mediaSource);
        _FlvMedia_player.set(this, void 0);
        _FlvMedia_events.set(this, {});
        _FlvMedia_options.set(this, {});
        __classPrivateFieldSet(this, _FlvMedia_options, options, "f");
        this.element = element;
        this.media = mediaSource;
        this._create = this._create.bind(this);
        this._assign = this._assign.bind(this);
        this.promise =
            typeof flvjs === 'undefined'
                ?
                    loadScript('https://cdn.jsdelivr.net/npm/flv.js@latest/dist/flv.min.js')
                : new Promise((resolve) => {
                    resolve({});
                });
        this.promise.then(this._create);
        return this;
    }
    canPlayType(mimeType) {
        return HAS_MSE && (mimeType === 'video/x-flv' || mimeType === 'video/flv');
    }
    load() {
        __classPrivateFieldGet(this, _FlvMedia_player, "f").unload();
        __classPrivateFieldGet(this, _FlvMedia_player, "f").detachMediaElement();
        __classPrivateFieldGet(this, _FlvMedia_player, "f").attachMediaElement(this.element);
        __classPrivateFieldGet(this, _FlvMedia_player, "f").load();
        const e = addEvent('loadedmetadata');
        this.element.dispatchEvent(e);
        if (!__classPrivateFieldGet(this, _FlvMedia_events, "f")) {
            __classPrivateFieldSet(this, _FlvMedia_events, flvjs.Events, "f");
            Object.keys(__classPrivateFieldGet(this, _FlvMedia_events, "f")).forEach((event) => {
                __classPrivateFieldGet(this, _FlvMedia_player, "f").on(__classPrivateFieldGet(this, _FlvMedia_events, "f")[event], (...args) => this._assign(__classPrivateFieldGet(this, _FlvMedia_events, "f")[event], args));
            });
        }
    }
    destroy() {
        __classPrivateFieldGet(this, _FlvMedia_player, "f").destroy();
        __classPrivateFieldSet(this, _FlvMedia_player, null, "f");
    }
    set src(media) {
        if (isFlvSource(media)) {
            this.destroy();
            this._create();
        }
    }
    get levels() {
        const levels = [];
        if (__classPrivateFieldGet(this, _FlvMedia_player, "f") && __classPrivateFieldGet(this, _FlvMedia_player, "f").levels && __classPrivateFieldGet(this, _FlvMedia_player, "f").levels.length) {
            Object.keys(__classPrivateFieldGet(this, _FlvMedia_player, "f").levels).forEach((item) => {
                const { height, name } = __classPrivateFieldGet(this, _FlvMedia_player, "f").levels[item];
                const level = {
                    height,
                    id: item,
                    label: name || null,
                };
                levels.push(level);
            });
        }
        return levels;
    }
    set level(level) {
        __classPrivateFieldGet(this, _FlvMedia_player, "f").currentLevel = level;
    }
    get level() {
        return __classPrivateFieldGet(this, _FlvMedia_player, "f") ? __classPrivateFieldGet(this, _FlvMedia_player, "f").currentLevel : -1;
    }
    _create() {
        const _a = __classPrivateFieldGet(this, _FlvMedia_options, "f") || {}, { configs } = _a, rest = __rest(_a, ["configs"]);
        flvjs.LoggingControl.enableDebug = (rest === null || rest === void 0 ? void 0 : rest.debug) || false;
        flvjs.LoggingControl.enableVerbose = (rest === null || rest === void 0 ? void 0 : rest.debug) || false;
        const options = Object.assign(Object.assign({}, rest), { type: 'flv', url: this.media.src });
        __classPrivateFieldSet(this, _FlvMedia_player, flvjs.createPlayer(options, configs || {}), "f");
        this.instance = __classPrivateFieldGet(this, _FlvMedia_player, "f");
        if (!__classPrivateFieldGet(this, _FlvMedia_events, "f")) {
            __classPrivateFieldSet(this, _FlvMedia_events, flvjs.Events, "f");
            Object.keys(__classPrivateFieldGet(this, _FlvMedia_events, "f")).forEach((event) => {
                __classPrivateFieldGet(this, _FlvMedia_player, "f").on(__classPrivateFieldGet(this, _FlvMedia_events, "f")[event], (...args) => this._assign(__classPrivateFieldGet(this, _FlvMedia_events, "f")[event], args));
            });
        }
    }
    _assign(event, data) {
        if (event === 'error') {
            const errorDetails = {
                detail: {
                    data,
                    message: `${data[0]}: ${data[1]} ${data[2].msg}`,
                    type: 'FLV',
                },
            };
            const errorEvent = addEvent('playererror', errorDetails);
            this.element.dispatchEvent(errorEvent);
        }
        else {
            const e = addEvent(event, { detail: { data } });
            this.element.dispatchEvent(e);
        }
    }
}
_FlvMedia_player = new WeakMap(), _FlvMedia_events = new WeakMap(), _FlvMedia_options = new WeakMap();
export default FlvMedia;


text:
<?php

namespace DoctrineModuleTest\Form\Element;

use Doctrine\Common\Collections\ArrayCollection;
use DoctrineModule\Form\Element\Proxy;
use DoctrineModuleTest\Form\Element\TestAsset\FormObject;
use PHPUnit\Framework\TestCase;

/**
 * Tests for the Collection pagination adapter
 *
 * @license MIT
 * @link    http://www.doctrine-project.org/
 * @author  Kyle Spraggs <theman@spiffyjr.me>
 * @covers  \DoctrineModule\Form\Element\Proxy
 */
class ProxyTest extends TestCase
{
    /**
     * @var \Doctrine\Common\Persistence\Mapping\ClassMetadata
     */
    protected $metadata;

    /**
     * @var \DoctrineModule\Form\Element\Proxy
     */
    protected $proxy;

    /**
     * {@inheritDoc}.
     */
    protected function setUp()
    {
        parent::setUp();
        $this->proxy = new Proxy;
    }

    public function testExceptionThrownForMissingObjectManager()
    {
        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage('No object manager was set');

        $this->proxy->setOptions(['target_class' => 'DoctrineModuleTest\Form\Element\TestAsset\FormObject']);
        $this->proxy->getValueOptions();
    }

    public function testExceptionThrownForMissingTargetClass()
    {
        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage('No target class was set');

        $this->proxy->setOptions([
            'object_manager' => $this->createMock('Doctrine\Common\Persistence\ObjectManager'),
        ]);
        $this->proxy->getValueOptions();
    }

    public function testExceptionThrownForMissingFindMethodName()
    {
        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage('No method name was set');

        $objectClass = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $metadata    = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->once())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
            'find_method'    => ['no_name'],
        ]);

        $this->proxy->getValueOptions();
    }

    public function testExceptionFindMethodNameNotExistentInRepository()
    {
        $objectClass = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $metadata    = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');

        $objectRepository = $this->createMock('Doctrine\Common\Persistence\ObjectRepository');

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->once())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $objectManager->expects($this->once())
            ->method('getRepository')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($objectRepository));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
            'find_method'    => ['name' => 'NotExistent'],
        ]);

        $this->expectException(
            'RuntimeException'
        );
        $this->expectExceptionMessage(
            'Method "NotExistent" could not be found in repository "' . get_class($objectRepository) . '"'
        );

        $this->proxy->getValueOptions();
    }

    public function testExceptionThrownForMissingRequiredParameter()
    {
        $objectClass = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $metadata    = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');

        $objectRepository = $this->createMock('Doctrine\Common\Persistence\ObjectRepository');

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->once())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $objectManager->expects($this->once())
            ->method('getRepository')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($objectRepository));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
            'find_method'    => [
                'name' => 'findBy',
                'params' => [],
            ],
        ]);

        $this->expectException(
            'RuntimeException'
        );
        $this->expectExceptionMessage(
            'Required parameter "criteria" with no default value for method "findBy" in repository "'
            . \get_class($objectRepository) . '" was not provided'
        );

        $this->proxy->getValueOptions();
    }

    public function testToStringIsUsedForGetValueOptions()
    {
        $this->prepareProxy();

        $result = $this->proxy->getValueOptions();
        $this->assertEquals($result[0]['label'], 'object one username');
        $this->assertEquals($result[1]['label'], 'object two username');
        $this->assertEquals($result[0]['value'], 1);
        $this->assertEquals($result[1]['value'], 2);
    }

    public function testPropertyGetterUsedForGetValueOptions()
    {
        $this->prepareProxy();

        $this->proxy->setOptions(['property' => 'password']);

        $this->metadata->expects($this->exactly(2))
            ->method('hasField')
            ->with($this->equalTo('password'))
            ->will($this->returnValue(true));

        $result = $this->proxy->getValueOptions();
        $this->assertEquals($result[0]['label'], 'object one password');
        $this->assertEquals($result[1]['label'], 'object two password');
        $this->assertEquals($result[0]['value'], 1);
        $this->assertEquals($result[1]['value'], 2);
    }

    public function testPublicPropertyUsedForGetValueOptions()
    {
        $this->prepareProxy();

        $this->proxy->setOptions(['property' => 'email']);

        $this
            ->metadata
            ->expects($this->exactly(2))
            ->method('hasField')
            ->with($this->equalTo('email'))
            ->will($this->returnValue(true));

        $result = $this->proxy->getValueOptions();
        $this->assertEquals($result[0]['label'], 'object one email');
        $this->assertEquals($result[1]['label'], 'object two email');
        $this->assertEquals($result[0]['value'], 1);
        $this->assertEquals($result[1]['value'], 2);
    }

    public function testIsMethodOptionUsedForGetValueOptions()
    {
        $this->prepareProxy();

        $this->proxy->setOptions([
            'property'  => 'name',
            'is_method' => true,
        ]);

        $this->metadata->expects($this->never())
            ->method('hasField');

        $result = $this->proxy->getValueOptions();
        $this->assertEquals($result[0]['label'], 'object one firstname object one surname');
        $this->assertEquals($result[1]['label'], 'object two firstname object two surname');
        $this->assertEquals($result[0]['value'], 1);
        $this->assertEquals($result[1]['value'], 2);
    }

    public function testDisplayEmptyItemAndEmptyItemLabelOptionsUsedForGetValueOptions()
    {
        $this->prepareProxy();

        $this->proxy->setOptions([
            'display_empty_item' => true,
            'empty_item_label'   => '---',
        ]);

        $result = $this->proxy->getValueOptions();
        $this->assertArrayHasKey('', $result);
        $this->assertEquals($result[''], '---');
    }

    public function testLabelGeneratorUsedForGetValueOptions()
    {
        $this->prepareProxy();

        $this->proxy->setOptions([
            'label_generator' => function ($targetEntity) {
                return $targetEntity->getEmail();
            },
        ]);

        $this->metadata->expects($this->never())
            ->method('hasField');

        $result = $this->proxy->getvalueOptions();
        $this->assertEquals($result[0]['label'], 'object one email');
        $this->assertEquals($result[1]['label'], 'object two email');
        $this->assertEquals($result[0]['value'], 1);
        $this->assertEquals($result[1]['value'], 2);
    }

    public function testExceptionThrownForNonCallableLabelGenerator()
    {
        $this->prepareProxy();

        $this->expectException(
            'InvalidArgumentException'
        );
        $this->expectExceptionMessage(
            'Property "label_generator" needs to be a callable function or a \Closure'
        );

        $this->proxy->setOptions(['label_generator' => 'I throw an InvalidArgumentException']);
    }

    public function testUsingOptionAttributesOfTypeString()
    {
        $this->prepareProxy();

        $this->proxy->setOptions([
            'option_attributes' => [
                'class' => 'foo',
                'lang' => 'en',
            ],
        ]);

        $options = $this->proxy->getValueOptions();

        $expectedAttributes = [
            'class' => 'foo',
            'lang' => 'en',
        ];

        $this->assertCount(2, $options);

        $this->assertArrayHasKey('attributes', $options[0]);
        $this->assertArrayHasKey('attributes', $options[1]);

        $this->assertEquals($expectedAttributes, $options[0]['attributes']);
        $this->assertEquals($expectedAttributes, $options[1]['attributes']);
    }

    public function testUsingOptionAttributesOfTypeCallableReturningString()
    {
        $this->prepareProxy();

        $this->proxy->setOptions([
            'option_attributes' => [
                'data-id' => function ($object) {
                    return $object->getId();
                },
            ],
        ]);

        $options = $this->proxy->getValueOptions();

        $this->assertCount(2, $options);

        $this->assertArrayHasKey('attributes', $options[0]);
        $this->assertArrayHasKey('attributes', $options[1]);

        $this->assertEquals(['data-id' => 1], $options[0]['attributes']);
        $this->assertEquals(['data-id' => 2], $options[1]['attributes']);
    }

    public function testRuntimeExceptionOnWrongOptionAttributesValue()
    {
        $this->prepareProxy();

        $this->proxy->setOptions([
            'option_attributes' => [
                'data-id' => new \stdClass(['id' => 1]),
            ],
        ]);

        $this->expectException('RuntimeException');

        $this->proxy->getValueOptions();
    }

    public function testCanWorkWithEmptyTables()
    {
        $this->prepareEmptyProxy();

        $result = $this->proxy->getValueOptions();
        $this->assertEquals([], $result);
    }

    public function testCanWorkWithEmptyDataReturnedAsArray()
    {
        $this->prepareEmptyProxy([]);

        $result = $this->proxy->getValueOptions();
        $this->assertEquals([], $result);
    }

    public function testExceptionThrownForNonTraversableResults()
    {
        $this->prepareEmptyProxy(new \stdClass());

        $this->expectException(
            'DoctrineModule\Form\Element\Exception\InvalidRepositoryResultException'
        );
        $this->expectExceptionMessage(
            'return value must be an array or Traversable'
        );

        $this->proxy->getValueOptions();
    }

    public function testUsingFindMethod()
    {
        $this->prepareFilteredProxy();

        $this->proxy->getValueOptions();
    }

    /**
     * A \RuntimeException should be thrown when the optgroup_identifier option does not reflect an existing method
     * within the target object
     */
    public function testExceptionThrownWhenOptgroupIdentifiesNotCallable()
    {
        $this->prepareProxyWithOptgroupPreset();

        $this->proxy->setOptions([
            'optgroup_identifier' => 'NonExistantFunctionName',
        ]);

        $this->expectException('RuntimeException');

        $this->proxy->getValueOptions();
    }

    /**
     * Tests the following case:
     *
     * An optgroup identifier has been given.
     * Two entries have the optgroup value "Group One".
     * One entry has the optgroup value "Group Two".
     *
     * Entries should be grouped accordingly under the respective keys.
     */
    public function testValueOptionsGeneratedProperlyWithOptgroups()
    {
        $this->prepareProxyWithOptgroupPreset();

        $this->proxy->setOptions([
            'optgroup_identifier' => 'optgroup',
        ]);

        $valueOptions = $this->proxy->getValueOptions();

        $expectedOutput = [
            'Group One' => [
                'label' => 'Group One',
                'options' => [
                    0 => [
                        'label' => 'object one username',
                        'value' => 1,
                        'attributes' => [],
                    ],
                    1 => [
                        'label' => 'object two username',
                        'value' => 2,
                        'attributes' => [],
                    ],
                ],
            ],
            'Group Two' => [
                'label' => 'Group Two',
                'options' => [
                    0 => [
                        'label' => 'object three username',
                        'value' => 3,
                        'attributes' => [],
                    ],
                ],
            ],
        ];

        $this->assertEquals($expectedOutput, $valueOptions);
    }

    /**
     * Tests the following case:
     *
     * An optgroup identifier has been given.
     * Both entries do not have an optgroup value.
     * optgroup_default has been configured.
     *
     * Both entries should be grouped under the optgroup_default key.
     */
    public function testEmptyOptgroupValueBelongsToOptgroupDefaultIfConfigured()
    {
        $this->prepareProxy();

        $this->proxy->setOptions([
            'optgroup_identifier' => 'optgroup',
            'optgroup_default'    => 'Others',
        ]);

        $valueOptions = $this->proxy->getValueOptions();

        $expectedOutput = [
            'Others' => [
                'label' => 'Others',
                'options' => [
                    0 => [
                        'label' => 'object one username',
                        'value' => 1,
                        'attributes' => [],
                    ],
                    1 => [
                        'label' => 'object two username',
                        'value' => 2,
                        'attributes' => [],
                    ],
                ],
            ],
        ];

        $this->assertEquals($expectedOutput, $valueOptions);
    }

    /**
     * Tests the following case:
     *
     * An optgroup identifier has been given.
     * One entry has a valid value.
     * A second entry has a null value.
     * No optgroup_default has been configured.
     *
     * Entry one should be grouped, entry two shouldn't be.
     */
    public function testEmptyOptgroupValueBelongsToNoOptgroupIfNotConfigured()
    {
        $this->prepareProxyWithOptgroupPresetThatHasPartiallyEmptyOptgroupValues();

        $this->proxy->setOptions([
            'optgroup_identifier' => 'optgroup',
        ]);

        $valueOptions = $this->proxy->getValueOptions();

        $expectedOutput = [
            'Group One' => [
                'label' => 'Group One',
                'options' => [
                    0 => [
                        'label' => 'object one username',
                        'value' => 1,
                        'attributes' => [],
                    ],
                ],
            ],
            0 => [
                'label' => 'object two username',
                'value' => 2,
                'attributes' => [],
            ],
        ];

        $this->assertEquals($expectedOutput, $valueOptions);
    }

    protected function prepareProxy()
    {
        $objectClass = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $objectOne   = new FormObject;
        $objectTwo   = new FormObject;

        $objectOne->setId(1)
            ->setUsername('object one username')
            ->setPassword('object one password')
            ->setEmail('object one email')
            ->setFirstname('object one firstname')
            ->setSurname('object one surname');

        $objectTwo->setId(2)
            ->setUsername('object two username')
            ->setPassword('object two password')
            ->setEmail('object two email')
            ->setFirstname('object two firstname')
            ->setSurname('object two surname');

        $result = new ArrayCollection([$objectOne, $objectTwo]);

        $metadata = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $metadata
            ->expects($this->any())
            ->method('getIdentifierValues')
            ->will(
                $this->returnCallback(
                    function () use ($objectOne, $objectTwo) {
                        $input = func_get_args();
                        $input = array_shift($input);

                        if ($input == $objectOne) {
                            return ['id' => 1];
                        } elseif ($input == $objectTwo) {
                            return ['id' => 2];
                        }

                        return [];
                    }
                )
            );

        $objectRepository = $this->createMock('Doctrine\Common\Persistence\ObjectRepository');
        $objectRepository->expects($this->any())
            ->method('findAll')
            ->will($this->returnValue($result));

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $objectManager
            ->expects($this->any())
            ->method('getRepository')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($objectRepository));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
        ]);

        $this->metadata = $metadata;
    }

    protected function prepareProxyWithOptgroupPreset()
    {
        $objectClass = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $objectOne   = new FormObject;
        $objectTwo   = new FormObject;
        $objectThree = new FormObject;

        $objectOne->setId(1)
            ->setUsername('object one username')
            ->setPassword('object one password')
            ->setEmail('object one email')
            ->setFirstname('object one firstname')
            ->setSurname('object one surname')
            ->setOptgroup('Group One');

        $objectTwo->setId(2)
            ->setUsername('object two username')
            ->setPassword('object two password')
            ->setEmail('object two email')
            ->setFirstname('object two firstname')
            ->setSurname('object two surname')
            ->setOptgroup('Group One');

        $objectThree->setId(3)
            ->setUsername('object three username')
            ->setPassword('object three password')
            ->setEmail('object three email')
            ->setFirstname('object three firstname')
            ->setSurname('object three surname')
            ->setOptgroup('Group Two');

        $result = new ArrayCollection([$objectOne, $objectTwo, $objectThree]);

        $metadata = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $metadata
            ->expects($this->any())
            ->method('getIdentifierValues')
            ->will(
                $this->returnCallback(
                    function () use ($objectOne, $objectTwo, $objectThree) {
                        $input = func_get_args();
                        $input = array_shift($input);

                        if ($input == $objectOne) {
                            return ['id' => 1];
                        } elseif ($input == $objectTwo) {
                            return ['id' => 2];
                        } elseif ($input == $objectThree) {
                            return ['id' => 3];
                        }

                        return [];
                    }
                )
            );

        $objectRepository = $this->createMock('Doctrine\Common\Persistence\ObjectRepository');
        $objectRepository->expects($this->any())
            ->method('findAll')
            ->will($this->returnValue($result));

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $objectManager
            ->expects($this->any())
            ->method('getRepository')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($objectRepository));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
        ]);

        $this->metadata = $metadata;
    }

    protected function prepareProxyWithOptgroupPresetThatHasPartiallyEmptyOptgroupValues()
    {
        $objectClass = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $objectOne   = new FormObject;
        $objectTwo   = new FormObject;

        $objectOne->setId(1)
            ->setUsername('object one username')
            ->setPassword('object one password')
            ->setEmail('object one email')
            ->setFirstname('object one firstname')
            ->setSurname('object one surname')
            ->setOptgroup('Group One');

        $objectTwo->setId(2)
            ->setUsername('object two username')
            ->setPassword('object two password')
            ->setEmail('object two email')
            ->setFirstname('object two firstname')
            ->setSurname('object two surname');

        $result = new ArrayCollection([$objectOne, $objectTwo]);

        $metadata = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $metadata
            ->expects($this->any())
            ->method('getIdentifierValues')
            ->will(
                $this->returnCallback(
                    function () use ($objectOne, $objectTwo) {
                        $input = func_get_args();
                        $input = array_shift($input);

                        if ($input == $objectOne) {
                            return ['id' => 1];
                        } elseif ($input == $objectTwo) {
                            return ['id' => 2];
                        }

                        return [];
                    }
                )
            );

        $objectRepository = $this->createMock('Doctrine\Common\Persistence\ObjectRepository');
        $objectRepository->expects($this->any())
            ->method('findAll')
            ->will($this->returnValue($result));

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $objectManager
            ->expects($this->any())
            ->method('getRepository')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($objectRepository));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
        ]);

        $this->metadata = $metadata;
    }

    protected function prepareFilteredProxy()
    {
        $objectClass = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $objectOne   = new FormObject;
        $objectTwo   = new FormObject;

        $objectOne->setId(1)
            ->setUsername('object one username')
            ->setPassword('object one password')
            ->setEmail('object one email')
            ->setFirstname('object one firstname')
            ->setSurname('object one surname');

        $objectTwo->setId(2)
            ->setUsername('object two username')
            ->setPassword('object two password')
            ->setEmail('object two email')
            ->setFirstname('object two firstname')
            ->setSurname('object two surname');

        $result = new ArrayCollection([$objectOne, $objectTwo]);

        $metadata = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $metadata
            ->expects($this->exactly(2))
            ->method('getIdentifierValues')
            ->will(
                $this->returnCallback(
                    function () use ($objectOne, $objectTwo) {
                        $input = func_get_args();
                        $input = array_shift($input);
                        if ($input == $objectOne) {
                            return ['id' => 1];
                        } elseif ($input == $objectTwo) {
                            return ['id' => 2];
                        }

                        return [];
                    }
                )
            );

        $objectRepository = $this->createMock('Doctrine\Common\Persistence\ObjectRepository');
        $objectRepository
            ->expects($this->once())
            ->method('findBy')
            ->will($this->returnValue($result));

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager
            ->expects($this->once())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $objectManager
            ->expects($this->once())
            ->method('getRepository')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($objectRepository));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
            'find_method' => [
                'name' => 'findBy',
                'params' => [
                    'criteria' => ['email' => 'object one email'],
                ],
            ],
        ]);

        $this->metadata = $metadata;
    }

    public function prepareEmptyProxy($result = null)
    {
        if ($result === null) {
            $result = new ArrayCollection();
        }

        $objectClass      = 'DoctrineModuleTest\Form\Element\TestAsset\FormObject';
        $metadata         = $this->createMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $objectRepository = $this->createMock('Doctrine\Common\Persistence\ObjectRepository');

        $objectRepository
            ->expects($this->once())
            ->method('findAll')
            ->will($this->returnValue($result));

        $objectManager = $this->createMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager
            ->expects($this->once())
            ->method('getClassMetadata')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($metadata));

        $objectManager
            ->expects($this->once())
            ->method('getRepository')
            ->with($this->equalTo($objectClass))
            ->will($this->returnValue($objectRepository));

        $this->proxy->setOptions([
            'object_manager' => $objectManager,
            'target_class'   => $objectClass,
        ]);

        $this->metadata = $metadata;
    }
}


text:
require 'ec2/amitools/fileutil'
require 'ec2/platform/linux/rsync'
module EC2
  module Platform
    module Solaris
      class Rsync < EC2::Platform::Linux::Rsync
        EXECUTABLE = 'rsync'
        def initialize(e=EXECUTABLE)
          super e
        end
      end
    end
  end
end


text:
import { QueryParametersConfiguration } from './editors/QueryParametersEditor';
import { CodeTemplateEditorConfiguration } from './editors/TemplateEditor';

export interface TablePanelOptions {
  url: string;
  queryParameters: QueryParametersConfiguration;
  jsonDataPath: string;
  headerTemplate: CodeTemplateEditorConfiguration;
  useProxy: boolean;
  headers: string;
}


text:
package org.apache.causeway.testdomain.jpa;

import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import org.apache.causeway.testdomain.jpa.entities.JpaBook;

@Configuration
@ComponentScan(
        basePackageClasses= {
                JpaTestDomainModule.class
        })
@EntityScan(basePackageClasses = JpaBook.class)
public class JpaTestDomainModule {

}


text:
import React, {Component} from 'react';

import '../semantic/dist/components/icon.css';
import '../semantic/dist/components/header.css';

export default class NotFound extends Component {
  render() {
    return (

        Not found

The page you're looking for isn't here.

      <button className="large ui button">
         Go to main screen
      </button>

);
  }
}


text:
angular.module( 'ngBoilerplate')

    .config(['$stateProvider', function config( $stateProvider ) {
        $stateProvider.state( 'users_list', {
            url: '/users/list',
            views: {
                'main': {
                    controller: 'UsersListCtrl',
                    templateUrl: 'users/list.tpl.html'
                }
            },
            data:{ pageTitle: 'List users' }
        });
    }])

    .controller('UsersListCtrl', ['$scope', 'User', function ( $scope, User ) {
        $scope.users = User.query();
    }])

;


text:
content = {}
function game.load()
    content.bed = love.graphics.newImage("res/levels/bed_drawer_open.jpg")
end
function game.update()
    if gui.Button{text="left-leave", pos=game.shared.leftButtonPos, size=game.shared.sideButtonSize} then
        game.switchLevelFade("ClosetBin")
    end
    if gui.Button{text="right-leave", pos=game.shared.rightButtonPos, size=game.shared.sideButtonSize} then
        game.switchLevelFade("ClosetBin")
    end
    if gui.Button{text="shapea", pos={0.43 * love.graphics.getWidth(), 0.4 * love.graphics.getHeight()}, size={ 0.16 *love.graphics.getWidth(), 0.34 * love.graphics.getHeight()}} then
    	inventory.addItem("cyanIco")
    	inventory.addItem("crowbar")
        messageManager.setMessage("Took a glowing cyan Icosahedron and a Crowbar.")
        game.state.pickedIcos = game.state.pickedIcos + 1
        game.state.bedDrawersPicked = true
        if game.state.pickedIcos == 4 then
            game.switchLevelFade("End")
            return
        end
    	game.switchLevelFade("Bed")
    end
end
function game.draw()
    love.graphics.draw(content.bed, game.shared.xOffset, game.shared.yOffset, 0,
        game.shared.scale,
        game.shared.scale)
end