text:
namespace net {

class HttpAuthController;
class HttpResponseInfo;
class NetworkQualityEstimator;
class SocketTag;
class ProxyClientSocket;
class SpdyStreamRequest;
class SSLSocketParams;
class TransportSocketParams;
class QuicStreamRequest;

// HttpProxySocketParams only needs the socket params for one of the proxy
// types.  The other param must be NULL.  When using an HTTP proxy,
// |transport_params| must be set.  When using an HTTPS proxy or QUIC proxy,
// |ssl_params| must be set.
class NET_EXPORT_PRIVATE HttpProxySocketParams
    : public base::RefCounted<HttpProxySocketParams> {
 public:
  HttpProxySocketParams(scoped_refptr<TransportSocketParams> transport_params,
                        scoped_refptr<SSLSocketParams> ssl_params,
                        bool is_quic,
                        const HostPortPair& endpoint,
                        bool tunnel,
                        const NetworkTrafficAnnotationTag traffic_annotation,
                        const NetworkIsolationKey& network_isolation_key);

  HttpProxySocketParams(const HttpProxySocketParams&) = delete;
  HttpProxySocketParams& operator=(const HttpProxySocketParams&) = delete;

  const scoped_refptr<TransportSocketParams>& transport_params() const {
    return transport_params_;
  }
  const scoped_refptr<SSLSocketParams>& ssl_params() const {
    return ssl_params_;
  }
  bool is_quic() const { return is_quic_; }
  const HostPortPair& endpoint() const { return endpoint_; }
  bool tunnel() const { return tunnel_; }
  const NetworkIsolationKey& network_isolation_key() const {
    return network_isolation_key_;
  }
  const NetworkTrafficAnnotationTag traffic_annotation() const {
    return traffic_annotation_;
  }

 private:
  friend class base::RefCounted<HttpProxySocketParams>;
  ~HttpProxySocketParams();

  const scoped_refptr<TransportSocketParams> transport_params_;
  const scoped_refptr<SSLSocketParams> ssl_params_;
  bool is_quic_;
  const HostPortPair endpoint_;
  const bool tunnel_;
  const NetworkIsolationKey network_isolation_key_;
  const NetworkTrafficAnnotationTag traffic_annotation_;
};

// HttpProxyConnectJob optionally establishes a tunnel through the proxy
// server after connecting the underlying transport socket.
class NET_EXPORT_PRIVATE HttpProxyConnectJob : public ConnectJob,
                                               public ConnectJob::Delegate {
 public:
  class NET_EXPORT_PRIVATE Factory {
   public:
    Factory() = default;
    virtual ~Factory() = default;

    virtual std::unique_ptr<HttpProxyConnectJob> Create(
        RequestPriority priority,
        const SocketTag& socket_tag,
        const CommonConnectJobParams* common_connect_job_params,
        scoped_refptr<HttpProxySocketParams> params,
        ConnectJob::Delegate* delegate,
        const NetLogWithSource* net_log);
  };

  HttpProxyConnectJob(RequestPriority priority,
                      const SocketTag& socket_tag,
                      const CommonConnectJobParams* common_connect_job_params,
                      scoped_refptr<HttpProxySocketParams> params,
                      ConnectJob::Delegate* delegate,
                      const NetLogWithSource* net_log);

  HttpProxyConnectJob(const HttpProxyConnectJob&) = delete;
  HttpProxyConnectJob& operator=(const HttpProxyConnectJob&) = delete;

  ~HttpProxyConnectJob() override;

  // A single priority is used for tunnels over H2 and QUIC, which can be shared
  // by multiple requests of different priorities either in series (tunnels for
  // HTTP/1.x requests) or simultaneously (tunnels for H2 requests). Changing
  // the priority of the tunnel based on the current request also potentially
  // leaks private data to the proxy.
  static const RequestPriority kH2QuicTunnelPriority;

  // ConnectJob methods.
  LoadState GetLoadState() const override;
  bool HasEstablishedConnection() const override;
  ResolveErrorInfo GetResolveErrorInfo() const override;
  bool IsSSLError() const override;
  scoped_refptr<SSLCertRequestInfo> GetCertRequestInfo() override;

  // ConnectJob::Delegate implementation.
  void OnConnectJobComplete(int result, ConnectJob* job) override;
  void OnNeedsProxyAuth(const HttpResponseInfo& response,
                        HttpAuthController* auth_controller,
                        base::OnceClosure restart_with_auth_callback,
                        ConnectJob* job) override;

  // In some cases, a timeout that's stricter than the TCP (+SSL, if applicable)
  // is used for HTTP proxies during connection establishment and SSL
  // negotiation for the connection to the proxy itself. In those cases, returns
  // the connection timeout that will be used by a HttpProxyConnectJob created
  // with the specified parameters, given current network conditions. Otherwise,
  // returns base::TimeDelta().
  static base::TimeDelta AlternateNestedConnectionTimeout(
      const HttpProxySocketParams& params,
      const NetworkQualityEstimator* network_quality_estimator);

  // Returns the timeout for establishing a tunnel after a connection has been
  // established.
  static base::TimeDelta TunnelTimeoutForTesting();

  // Updates the field trial parameters used in calculating timeouts.
  static void UpdateFieldTrialParametersForTesting();

 private:
  enum State {
    STATE_BEGIN_CONNECT,
    STATE_TRANSPORT_CONNECT,
    STATE_TRANSPORT_CONNECT_COMPLETE,
    STATE_HTTP_PROXY_CONNECT,
    STATE_HTTP_PROXY_CONNECT_COMPLETE,
    STATE_SPDY_PROXY_CREATE_STREAM,
    STATE_SPDY_PROXY_CREATE_STREAM_COMPLETE,
    STATE_QUIC_PROXY_CREATE_SESSION,
    STATE_QUIC_PROXY_CREATE_STREAM,
    STATE_QUIC_PROXY_CREATE_STREAM_COMPLETE,
    STATE_RESTART_WITH_AUTH,
    STATE_RESTART_WITH_AUTH_COMPLETE,
    STATE_NONE,
  };

  // Begins the tcp connection and the optional Http proxy tunnel.  If the
  // request is not immediately serviceable (likely), the request will return
  // ERR_IO_PENDING. An OK return from this function or the callback means
  // that the connection is established; ERR_PROXY_AUTH_REQUESTED means
  // that the tunnel needs authentication credentials, the socket will be
  // returned in this case, and must be released back to the pool; or
  // a standard net error code will be returned.
  int ConnectInternal() override;

  ProxyServer::Scheme GetProxyServerScheme() const;

  void OnIOComplete(int result);

  void RestartWithAuthCredentials();

  // Runs the state transition loop.
  int DoLoop(int result);

  // Determine if need to go through TCP or SSL path.
  int DoBeginConnect();
  // Connecting to HTTP or HTTPS Proxy
  int DoTransportConnect();
  int DoTransportConnectComplete(int result);

  int DoHttpProxyConnect();
  int DoHttpProxyConnectComplete(int result);

  int DoSpdyProxyCreateStream();
  int DoSpdyProxyCreateStreamComplete(int result);

  int DoQuicProxyCreateSession();
  int DoQuicProxyCreateStream(int result);
  int DoQuicProxyCreateStreamComplete(int result);

  int DoRestartWithAuth();
  int DoRestartWithAuthComplete(int result);

  // ConnectJob implementation.
  void ChangePriorityInternal(RequestPriority priority) override;
  void OnTimedOutInternal() override;

  void OnAuthChallenge();

  const HostPortPair& GetDestination() const;

  std::string GetUserAgent() const;

  SpdySessionKey CreateSpdySessionKey() const;

  scoped_refptr<HttpProxySocketParams> params_;

  scoped_refptr<SSLCertRequestInfo> ssl_cert_request_info_;

  State next_state_;

  bool has_restarted_;

  // Set to true once a connection has been successfully established. Remains
  // true even if a new socket is being connected to retry with auth.
  bool has_established_connection_;

  ResolveErrorInfo resolve_error_info_;

  std::unique_ptr<ConnectJob> nested_connect_job_;
  std::unique_ptr<ProxyClientSocket> transport_socket_;

  std::unique_ptr<SpdyStreamRequest> spdy_stream_request_;

  std::unique_ptr<QuicStreamRequest> quic_stream_request_;
  std::unique_ptr<QuicChromiumClientSession::Handle> quic_session_;

  scoped_refptr<HttpAuthController> http_auth_controller_;

  NetErrorDetails quic_net_error_details_;

  // Time when the connection to the proxy was started.
  base::TimeTicks connect_start_time_;

  base::WeakPtrFactory<HttpProxyConnectJob> weak_ptr_factory_{this};
};

}  // namespace net

#endif  // NET_HTTP_HTTP_PROXY_CONNECT_JOB_H_


text:
import nativeMethods from '../../native-methods';
import * as htmlUtils from '../../../utils/html';
import { getTagName, isCommentNode, isStyleElement, isScriptElement } from '../../../utils/dom';
import { isFirefox, isIE } from '../../../utils/browser';
import { processScript } from '../../../../processing/script';
import styleProcessor from '../../../../processing/style';
import { getProxyUrl, convertToProxyUrl } from '../../../utils/url';
import SELF_REMOVING_SCRIPTS from '../../../../utils/self-removing-scripts';

const BEGIN_MARKER_TAG_NAME = 'hammerhead_write_marker_begin';
const END_MARKER_TAG_NAME   = 'hammerhead_write_marker_end';
const BEGIN_MARKER_MARKUP   = `<${ BEGIN_MARKER_TAG_NAME }></${ BEGIN_MARKER_TAG_NAME }>`;
const END_MARKER_MARKUP     = `<${ END_MARKER_TAG_NAME }></${ END_MARKER_TAG_NAME }>`;
const BEGIN_REMOVE_RE       = new RegExp(`^[\\S\\s]*${ BEGIN_MARKER_MARKUP }`, 'g');
const END_REMOVE_RE         = new RegExp(`${ END_MARKER_MARKUP }[\\S\\s]*$`, 'g');
const REMOVE_OPENING_TAG_RE = /^<[^>]+>/g;
const REMOVE_CLOSING_TAG_RE = /<\/[^<>]+>$/g;
const PENDING_RE            = /<\/?(?:[A-Za-z][^>]*)?$/g;
const UNCLOSED_ELEMENT_FLAG = 'hammerhead|unclosed-element-flag';

export default class DocumentWriter {
    window: any;
    document: any;
    pending: string;
    parentTagChain: any[];
    isBeginMarkerInDOM: boolean;
    isEndMarkerInDOM: boolean;
    isClosingContentEl: boolean;
    isNonClosedComment: boolean;
    isAddContentToEl: boolean;
    contentForProcessing: string;
    nonClosedEl: any;
    cachedStartsWithClosingTagRegExps: any;

    constructor (window, document) {
        this.window               = window;
        this.document             = document;
        this.pending              = '';
        this.parentTagChain       = [];
        this.isBeginMarkerInDOM   = false;
        this.isEndMarkerInDOM     = false;
        this.isClosingContentEl   = false;
        this.isNonClosedComment   = false;
        this.isAddContentToEl     = false;
        this.contentForProcessing = '';
        this.nonClosedEl          = null;

        this.cachedStartsWithClosingTagRegExps = {};
    }

    _cutPending (htmlChunk) {
        const match = htmlChunk.match(PENDING_RE);

        this.pending = match ? match[0] : '';

        return this.pending ? htmlChunk.substring(0, htmlChunk.length - this.pending.length) : htmlChunk;
    }

    _wrapHtmlChunk (htmlChunk) {
        let parentTagChainMarkup = this.parentTagChain.length ? '<' + this.parentTagChain.join('><') + '>' : '';

        if (this.isNonClosedComment)
            parentTagChainMarkup += '<!--';

        return parentTagChainMarkup + BEGIN_MARKER_MARKUP + htmlChunk + END_MARKER_MARKUP;
    }

    _unwrapHtmlChunk (htmlChunk) {
        if (!htmlChunk)
            return htmlChunk;

        htmlChunk = htmlChunk
            .replace(BEGIN_REMOVE_RE, '')
            .replace(END_REMOVE_RE, '');

        if (!this.isBeginMarkerInDOM)
            htmlChunk = this.isNonClosedComment ? htmlChunk.slice(4) : htmlChunk.replace(REMOVE_OPENING_TAG_RE, '');

        if (!this.isEndMarkerInDOM)
            htmlChunk = this.isNonClosedComment ? htmlChunk.slice(0, -3) : htmlChunk.replace(REMOVE_CLOSING_TAG_RE, '');

        if (!this.isBeginMarkerInDOM && this.isEndMarkerInDOM)
            this.isNonClosedComment = false;

        return htmlChunk;
    }

    static _setUnclosedElementFlag (el) {
        if (isScriptElement(el) || isStyleElement(el))
            el[UNCLOSED_ELEMENT_FLAG] = true;
    }

    static hasUnclosedElementFlag (el) {
        return !!el[UNCLOSED_ELEMENT_FLAG];
    }

    static _searchBeginMarker (container) {
        let beginMarker = nativeMethods.elementQuerySelector.call(container, BEGIN_MARKER_TAG_NAME);

        if (beginMarker)
            return beginMarker;

        beginMarker = container;

        while (nativeMethods.elementFirstElementChildGetter.call(beginMarker))
            beginMarker = nativeMethods.elementFirstElementChildGetter.call(beginMarker);

        const beginMarkerParent = nativeMethods.nodeParentNodeGetter.call(beginMarker);

        if (nativeMethods.nodeFirstChildGetter.call(beginMarkerParent) !== beginMarker)
            beginMarker = nativeMethods.nodeFirstChildGetter.call(beginMarkerParent);
        else if (isCommentNode(nativeMethods.nodeFirstChildGetter.call(beginMarker)))
            beginMarker = nativeMethods.nodeFirstChildGetter.call(beginMarker);

        return beginMarker;
    }

    static _searchEndMarker (container) {
        let endMarker = nativeMethods.elementQuerySelector.call(container, END_MARKER_TAG_NAME);

        if (endMarker)
            return endMarker;

        endMarker = container;

        while (nativeMethods.elementLastElementChildGetter.call(endMarker))
            endMarker = nativeMethods.elementLastElementChildGetter.call(endMarker);

        const endMarkerParent = nativeMethods.nodeParentNodeGetter.call(endMarker);

        if (nativeMethods.nodeLastChildGetter.call(endMarkerParent) !== endMarker)
            endMarker = nativeMethods.nodeLastChildGetter.call(endMarkerParent);
        else if (isCommentNode(nativeMethods.nodeLastChildGetter.call(endMarker)))
            endMarker = nativeMethods.nodeLastChildGetter.call(endMarker);

        return endMarker;
    }

    _updateParentTagChain (container, endMarker) {
        let endMarkerParent = getTagName(endMarker) !== END_MARKER_TAG_NAME ? endMarker : nativeMethods.nodeParentNodeGetter.call(endMarker);

        if (isCommentNode(endMarker)) {
            this.isNonClosedComment = true;
            endMarkerParent         = nativeMethods.nodeParentNodeGetter.call(endMarker);
        }

        this.parentTagChain = [];

        while (endMarkerParent !== container) {
            this.parentTagChain.unshift(getTagName(endMarkerParent));
            endMarkerParent = nativeMethods.nodeParentNodeGetter.call(endMarkerParent);
        }
    }

    _processBeginMarkerInContent (beginMarker) {
        const elWithContent = beginMarker;

        DocumentWriter._setUnclosedElementFlag(elWithContent);

        if (this.isClosingContentEl && (isScriptElement(elWithContent) || isStyleElement(elWithContent))) {
            this.contentForProcessing = nativeMethods.nodeTextContentGetter.call(this.nonClosedEl) +
                                        nativeMethods.nodeTextContentGetter.call(elWithContent).replace(BEGIN_REMOVE_RE, '');

            nativeMethods.nodeTextContentSetter.call(elWithContent, '');
        }
        else {
            const textContent = nativeMethods.nodeTextContentGetter.call(elWithContent);

            nativeMethods.nodeTextContentSetter.call(elWithContent, textContent.replace(BEGIN_REMOVE_RE, ''));
        }

        beginMarker = nativeMethods.createElement.call(document, BEGIN_MARKER_TAG_NAME);

        const elWithContentParent = nativeMethods.nodeParentNodeGetter.call(elWithContent);

        nativeMethods.insertBefore.call(elWithContentParent, beginMarker, elWithContent);
    }

    static _createStartsWithClosingTagRegExp (tagName) {
        const regExpStrParts = [tagName.charAt(tagName.length - 1), '?'];

        for (let i = tagName.length - 2; i > -1; i--) {
            regExpStrParts.unshift('(?:', tagName.charAt(i));
            regExpStrParts.push(')?');
        }

        regExpStrParts.unshift('^</');
        regExpStrParts.push('$');

        return new RegExp(regExpStrParts.join(''), 'i');
    }

    _getStartsWithClosingTagRegExp (tagName) {
        tagName = tagName.toLowerCase();

        if (!this.cachedStartsWithClosingTagRegExps[tagName])
            this.cachedStartsWithClosingTagRegExps[tagName] = DocumentWriter._createStartsWithClosingTagRegExp(tagName);

        return this.cachedStartsWithClosingTagRegExps[tagName];
    }

    _processEndMarkerInContent (endMarker) {
        const elWithContent = endMarker;
        const textContent   = nativeMethods.nodeTextContentGetter.call(elWithContent);

        DocumentWriter._setUnclosedElementFlag(elWithContent);

        nativeMethods.nodeTextContentSetter.call(elWithContent, textContent.replace(END_REMOVE_RE, ''));

        endMarker = nativeMethods.createElement.call(document, END_MARKER_TAG_NAME);

        if (this.pending) {
            const startsWithClosingTagRegExp        = this._getStartsWithClosingTagRegExp(elWithContent.tagName);
            const isPendingStartsWithClosingTagPart = startsWithClosingTagRegExp.test(this.pending);

            if (!isPendingStartsWithClosingTagPart) {
                const newContent = nativeMethods.nodeTextContentGetter.call(elWithContent) + this.pending;

                nativeMethods.nodeTextContentSetter.call(elWithContent, newContent);

                this.pending = '';
            }
        }

        const elWithContentParent = nativeMethods.nodeParentNodeGetter.call(elWithContent);

        nativeMethods.appendChild.call(elWithContentParent, endMarker);
    }

    static _addOnDocumentRecreationScript (endMarker) {
        const span            = nativeMethods.createElement.call(endMarker.ownerDocument, 'span');
        const endMarkerParent = nativeMethods.nodeParentNodeGetter.call(endMarker);

        nativeMethods.insertBefore.call(endMarkerParent, span, endMarker);
        nativeMethods.elementOuterHTMLSetter.call(span, SELF_REMOVING_SCRIPTS.onWindowRecreation);
    }

    _prepareDom (container, isDocumentCleaned) {
        const beginMarker = DocumentWriter._searchBeginMarker(container);
        const endMarker   = DocumentWriter._searchEndMarker(container);

        this.isBeginMarkerInDOM = getTagName(beginMarker) === BEGIN_MARKER_TAG_NAME;
        this.isEndMarkerInDOM   = getTagName(endMarker) === END_MARKER_TAG_NAME;
        this.isAddContentToEl   = beginMarker === endMarker;
        this.isClosingContentEl = !this.isBeginMarkerInDOM && !this.isAddContentToEl;

        if (!this.isAddContentToEl) {
            this._updateParentTagChain(container, endMarker);

            if (isDocumentCleaned)
                DocumentWriter._addOnDocumentRecreationScript(endMarker);
        }

        if (!this.isBeginMarkerInDOM && !this.isEndMarkerInDOM) {
            this._processBeginMarkerInContent(beginMarker);
            this._processEndMarkerInContent(endMarker);
        }
        else if (this.isBeginMarkerInDOM && !this.isEndMarkerInDOM)
            this._processEndMarkerInContent(endMarker);
        else if (!this.isBeginMarkerInDOM && this.isEndMarkerInDOM)
            this._processBeginMarkerInContent(beginMarker);
    }

    _processHtmlChunk (htmlChunk, isDocumentCleaned) {
        htmlChunk = this._cutPending(this.pending + htmlChunk);
        htmlChunk = this._wrapHtmlChunk(htmlChunk);
        htmlChunk = htmlUtils.processHtml(htmlChunk, {
            prepareDom:       container => this._prepareDom(container, isDocumentCleaned),
            processedContext: this.window
        });
        htmlChunk = this._unwrapHtmlChunk(htmlChunk);

        // NOTE: Firefox and IE recreate a window instance during the document.write function execution (T213930).
        if (htmlChunk && this.isBeginMarkerInDOM && (isFirefox || isIE) && !htmlUtils.isPageHtml(htmlChunk))
            htmlChunk = SELF_REMOVING_SCRIPTS.iframeInit + htmlChunk;

        return htmlChunk;
    }

    write (args, ln, isDocumentCleaned) {
        const htmlChunk = this._processHtmlChunk(nativeMethods.arrayJoin.call(args, ''), isDocumentCleaned);

        if (this.nonClosedEl && this.contentForProcessing) {
            let processedContent = this.contentForProcessing;

            if (isScriptElement(this.nonClosedEl))
                processedContent = processScript(this.contentForProcessing, true, false, convertToProxyUrl);
            else if (isStyleElement(this.nonClosedEl))
                processedContent = styleProcessor.process(this.contentForProcessing, getProxyUrl, true);

            nativeMethods.nodeTextContentSetter.call(this.nonClosedEl, processedContent);

            this.contentForProcessing = '';
        }

        const nativeWriteMethod = ln ? nativeMethods.documentWriteLn : nativeMethods.documentWrite;
        const result            = nativeWriteMethod.call(this.document, htmlChunk);

        if (isDocumentCleaned && isIE)
            return result;

        if (!this.isEndMarkerInDOM && !this.isAddContentToEl) {
            let el = this.document.documentElement;

            while (nativeMethods.elementLastElementChildGetter.call(el))
                el = nativeMethods.elementLastElementChildGetter.call(el);

            this.nonClosedEl = el;
        }

        return result;
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace urde {

static const CCameraShakeData skHardShake = {
    0.3f, 100.f, 0, zeus::skZero3f, {}, {1, {0, 0.f, 0.f, 0.3f, -2.f}, {1, 0.f, 0.f, 0.05f, 0.5f}}, {}};

CAuxWeapon::CAuxWeapon(TUniqueId playerId)
: x0_missile(g_SimplePool->GetObj("Missile"))
, xc_flameMuzzle(g_SimplePool->GetObj("FlameMuzzle"))
, x18_busterMuzzle(g_SimplePool->GetObj("BusterMuzzle"))
, x6c_playerId(playerId) {
  x0_missile.GetObj();
  xc_flameMuzzle.GetObj();
  x18_busterMuzzle.GetObj();
  x80_24_isLoaded = false;
  InitComboData();
}

static const char* skComboNames[] = {"SuperMissile", "IceCombo", "WaveBuster", "FlameThrower", "SuperMissile"};

void CAuxWeapon::InitComboData() {
  for (int i = 0; i < 5; ++i)
    x28_combos.push_back(g_SimplePool->GetObj(skComboNames[i]));
}

void CAuxWeapon::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
  if (msg == EScriptObjectMessage::Deleted) {
    DeleteFlameThrower(mgr);
    DeleteWaveBusterBeam(mgr);
  }
}

bool CAuxWeapon::IsComboFxActive(const CStateManager& mgr) const {
  switch (x74_firingBeamId) {
  case CPlayerState::EBeamId::Wave:
    if (const CEntity* ent = mgr.GetObjectById(x70_waveBusterId))
      return static_cast<const CWaveBuster*>(ent)->IsFiring();
    break;
  case CPlayerState::EBeamId::Plasma:
    if (const CEntity* ent = mgr.GetObjectById(x6e_flameThrowerId))
      return static_cast<const CNewFlameThrower*>(ent)->IsFiring();
    break;
  default:
    break;
  }
  return false;
}

void CAuxWeapon::Load(CPlayerState::EBeamId curBeam, CStateManager& mgr) {
  x80_24_isLoaded = false;
  switch (x78_loadBeamId) {
  case CPlayerState::EBeamId::Wave:
    DeleteWaveBusterBeam(mgr);
    break;
  case CPlayerState::EBeamId::Plasma:
    DeleteFlameThrower(mgr);
    break;
  default:
    break;
  }
  x28_combos[int(x78_loadBeamId)].Unlock();
  x28_combos[int(curBeam)].Lock();
  x78_loadBeamId = curBeam;
  LoadIdle();
}

void CAuxWeapon::StopComboFx(CStateManager& mgr, bool deactivate) {
  switch (x74_firingBeamId) {
  case CPlayerState::EBeamId::Wave: {
    auto* wb = static_cast<CWaveBuster*>(mgr.ObjectById(x70_waveBusterId));
    if (wb) {
      wb->ResetBeam(deactivate);
      DeleteWaveBusterBeam(mgr);
    }
    break;
  }
  case CPlayerState::EBeamId::Plasma: {
    auto* ft = static_cast<CNewFlameThrower*>(mgr.ObjectById(x6e_flameThrowerId));
    if (ft) {
      mgr.GetPlayerState()->SetFiringComboBeam(false);
      if (ft->IsFiring()) {
        ft->Reset(mgr, deactivate);
        FreeComboVoiceId();
      } else if (ft->GetActive() && deactivate) {
        ft->Reset(mgr, deactivate);
      }
    }
    break;
  }
  default:
    break;
  }

  if (deactivate) {
    x74_firingBeamId = CPlayerState::EBeamId::Invalid;
    x68_ammoConsumeTimer = 0.f;
  }
}

bool CAuxWeapon::UpdateComboFx(float dt, const zeus::CVector3f& scale, const zeus::CVector3f& pos,
                               const zeus::CTransform& xf, CStateManager& mgr) {
  if (!x80_24_isLoaded || x74_firingBeamId == CPlayerState::EBeamId::Invalid)
    return false;

  bool firing = false;
  if (x7c_comboSfx && !CSfxManager::IsPlaying(x7c_comboSfx))
    FreeComboVoiceId();

  switch (x74_firingBeamId) {
  case CPlayerState::EBeamId::Wave:
  case CPlayerState::EBeamId::Plasma: {
    bool firingFx = false;
    if (x74_firingBeamId == CPlayerState::EBeamId::Wave) {
      auto* wb = static_cast<CWaveBuster*>(mgr.ObjectById(x70_waveBusterId));
      if (wb && wb->IsFiring()) {
        wb->UpdateFx(xf, dt, mgr);
        firing = true;
        firingFx = true;
      } else {
        DeleteWaveBusterBeam(mgr);
        mgr.GetPlayerState()->SetFiringComboBeam(false);
      }
    } else {
      auto* ft = static_cast<CNewFlameThrower*>(mgr.ObjectById(x6e_flameThrowerId));
      bool needsDelete = true;
      if (ft) {
        firingFx = ft->CanRenderAuxEffects();
        if (ft->GetActive()) {
          ft->UpdateFx(xf, dt, mgr);
          firing = ft->IsFiring();
        }
        if (x6e_flameThrowerId != kInvalidUniqueId)
          needsDelete = ft->AreEffectsFinished();
      }
      if (needsDelete) {
        DeleteFlameThrower(mgr);
        mgr.GetPlayerState()->SetFiringComboBeam(false);
      }
    }

    if (firingFx) {
      x68_ammoConsumeTimer += dt;
      if (mgr.GetPlayerState()->GetItemAmount(CPlayerState::EItemType::Missiles) > 0) {
        if (x68_ammoConsumeTimer >= mgr.GetPlayerState()->GetComboFireAmmoPeriod()) {
          mgr.GetPlayerState()->DecrPickup(CPlayerState::EItemType::Missiles, 1);
          x68_ammoConsumeTimer = 0.f;
        }
      }
    }

    if (mgr.GetPlayerState()->GetItemAmount(CPlayerState::EItemType::Missiles) == 0)
      StopComboFx(mgr, false);

    x24_muzzleFxGen->SetGlobalTranslation(pos);
    x24_muzzleFxGen->SetGlobalScale(scale);
    x24_muzzleFxGen->SetParticleEmission(firingFx);
    x24_muzzleFxGen->Update(dt);
    break;
  }
  default:
    break;
  }

  return firing;
}

void CAuxWeapon::FreeComboVoiceId() {
  CSfxManager::SfxStop(x7c_comboSfx);
  x7c_comboSfx.reset();
}

void CAuxWeapon::DeleteFlameThrower(CStateManager& mgr) {
  FreeComboVoiceId();
  if (x6e_flameThrowerId != kInvalidUniqueId) {
    mgr.FreeScriptObject(x6e_flameThrowerId);
    x6e_flameThrowerId = kInvalidUniqueId;
    x74_firingBeamId = CPlayerState::EBeamId::Invalid;
    mgr.GetPlayerState()->SetFiringComboBeam(false);
  }
}

void CAuxWeapon::CreateFlameThrower(const zeus::CTransform& xf, CStateManager& mgr, float dt) {
  DeleteFlameThrower(mgr);
  if (x6e_flameThrowerId != kInvalidUniqueId)
    return;

  CAssetId resInfo[] = {NWeaponTypes::get_asset_id_from_name("NFTMainFire"),
                        NWeaponTypes::get_asset_id_from_name("NFTMainSmoke"),
                        NWeaponTypes::get_asset_id_from_name("NFTSwooshCenter"),
                        NWeaponTypes::get_asset_id_from_name("NFTSwooshFire"),
                        NWeaponTypes::get_asset_id_from_name("NFTSecondarySmoke"),
                        NWeaponTypes::get_asset_id_from_name("NFTSecondaryFire"),
                        NWeaponTypes::get_asset_id_from_name("NFTSecondarySparks"),
                        {}};
  x6e_flameThrowerId = mgr.AllocateUniqueId();
  CNewFlameThrower* ft = new CNewFlameThrower(
      x28_combos[3], "Player_FlameThrower", EWeaponType::Plasma, resInfo, xf, EMaterialTypes::Player,
      CGunWeapon::GetShotDamageInfo(g_tweakPlayerGun->GetComboShotInfo(3), mgr), x6e_flameThrowerId, kInvalidAreaId,
      x6c_playerId, EProjectileAttrib::None);
  mgr.AddObject(ft);
  ft->Think(dt, mgr);
  ft->StartFiring(xf, mgr);
  x24_muzzleFxGen = std::make_unique<CElementGen>(xc_flameMuzzle);
  x7c_comboSfx = NWeaponTypes::play_sfx(SFXwpn_combo_flamethrower, false, true, 0.165f);
  mgr.GetCameraManager()->AddCameraShaker(skHardShake, false);
  mgr.GetPlayerState()->SetFiringComboBeam(true);
  x74_firingBeamId = CPlayerState::EBeamId::Plasma;
}

void CAuxWeapon::DeleteWaveBusterBeam(CStateManager& mgr) {
  FreeComboVoiceId();
  if (x70_waveBusterId != kInvalidUniqueId) {
    mgr.FreeScriptObject(x70_waveBusterId);
    x70_waveBusterId = kInvalidUniqueId;
    x74_firingBeamId = CPlayerState::EBeamId::Invalid;
    mgr.GetPlayerState()->SetFiringComboBeam(false);
  }
}

void CAuxWeapon::CreateWaveBusterBeam(EProjectileAttrib attribs, TUniqueId homingTarget, const zeus::CTransform& xf,
                                      CStateManager& mgr) {
  DeleteFlameThrower(mgr);
  if (x70_waveBusterId != kInvalidUniqueId)
    return;

  x70_waveBusterId = mgr.AllocateUniqueId();
  CWaveBuster* wb = new CWaveBuster(x28_combos[2], EWeaponType::Wave, xf, EMaterialTypes::Player,
                                    CGunWeapon::GetShotDamageInfo(g_tweakPlayerGun->GetComboShotInfo(2), mgr),
                                    x70_waveBusterId, kInvalidAreaId, x6c_playerId, homingTarget, attribs);
  mgr.AddObject(wb);
  x24_muzzleFxGen = std::make_unique<CElementGen>(x18_busterMuzzle);
  x7c_comboSfx = NWeaponTypes::play_sfx(SFXwpn_combo_wavebuster, false, true, 0.165f);
  mgr.GetCameraManager()->AddCameraShaker(CCameraShakeData::skChargedShotCameraShakeData, false);
  mgr.GetPlayerState()->SetFiringComboBeam(true);
  x74_firingBeamId = CPlayerState::EBeamId::Wave;
}

static const u16 skSoundId[] = {1810, 1837, 1847, 1842, 1810};

void CAuxWeapon::LaunchMissile(float dt, bool underwater, bool charged, CPlayerState::EBeamId currentBeam,
                               EProjectileAttrib attrib, const zeus::CTransform& xf, TUniqueId homingId,
                               CStateManager& mgr) {
  const SShotParam& info =
      charged ? g_tweakPlayerGun->GetComboShotInfo(int(currentBeam)) : g_tweakPlayerGun->GetMissileInfo();
  u16 sfxId = charged ? skSoundId[int(currentBeam)] : u16(SFXwpn_fire_missile);
  CEnergyProjectile* proj = new CEnergyProjectile(
      true, charged ? x28_combos[int(currentBeam)] : x0_missile, charged ? EWeaponType::Power : EWeaponType::Missile,
      xf, EMaterialTypes::Player, CGunWeapon::GetShotDamageInfo(info, mgr), mgr.AllocateUniqueId(), kInvalidAreaId,
      x6c_playerId, homingId, attrib | EProjectileAttrib::ArmCannon, underwater, zeus::skOne3f, {}, -1, false);
  mgr.AddObject(proj);
  proj->Think(dt, mgr);
  if (charged) {
    proj->SetCameraShake(CCameraShakeData::BuildMissileCameraShake(0.25f, 0.75f, 50.f, proj->GetTranslation()));
    mgr.GetCameraManager()->AddCameraShaker(skHardShake, false);
  } else {
    mgr.GetRumbleManager().Rumble(mgr, ERumbleFxId::PlayerMissileFire, 0.5f, ERumblePriority::One);
  }
  x7c_comboSfx = NWeaponTypes::play_sfx(sfxId, underwater, false, 0.165f);
}

void CAuxWeapon::Fire(float dt, bool underwater, CPlayerState::EBeamId currentBeam, EChargeState chargeState,
                      const zeus::CTransform& xf, CStateManager& mgr, EWeaponType type, TUniqueId homingId) {
  if (!x80_24_isLoaded)
    return;

  EProjectileAttrib attrib = EProjectileAttrib::None;
  if (chargeState == EChargeState::Charged)
    attrib = CGameProjectile::GetBeamAttribType(type) | EProjectileAttrib::ComboShot;

  if (chargeState == EChargeState::Normal) {
    LaunchMissile(dt, underwater, chargeState == EChargeState::Charged, currentBeam, attrib, xf, homingId, mgr);
  } else {
    switch (currentBeam) {
    case CPlayerState::EBeamId::Power:
    case CPlayerState::EBeamId::Ice:
      LaunchMissile(dt, underwater, chargeState == EChargeState::Charged, currentBeam, attrib, xf, homingId, mgr);
      break;
    case CPlayerState::EBeamId::Wave:
      CreateWaveBusterBeam(attrib, homingId, xf, mgr);
      break;
    case CPlayerState::EBeamId::Plasma:
      CreateFlameThrower(xf, mgr, dt);
      break;
    default:
      break;
    }
  }
}

void CAuxWeapon::LoadIdle() { x80_24_isLoaded = x28_combos[int(x78_loadBeamId)].IsLoaded(); }

void CAuxWeapon::RenderMuzzleFx() const {
  switch (x74_firingBeamId) {
  case CPlayerState::EBeamId::Wave:
  case CPlayerState::EBeamId::Plasma:
    x24_muzzleFxGen->Render();
    break;
  default:
    break;
  }
}

TUniqueId CAuxWeapon::HasTarget(const CStateManager& mgr) const {
  if (x74_firingBeamId == CPlayerState::EBeamId::Wave)
    if (auto* wb = static_cast<const CWaveBuster*>(mgr.GetObjectById(x70_waveBusterId)))
      return wb->GetHomingTargetId();
  return kInvalidUniqueId;
}

void CAuxWeapon::SetNewTarget(TUniqueId targetId, CStateManager& mgr) {
  if (x74_firingBeamId == CPlayerState::EBeamId::Wave)
    if (auto* wb = static_cast<CWaveBuster*>(mgr.ObjectById(x70_waveBusterId)))
      wb->SetNewTarget(targetId);
}

} // namespace urde


text:
from flask import Flask

from rapid.client import ClientCommunicator
from rapid.client.executor import Executor
from rapid.lib.work_request import WorkRequest
from rapid.client.client_configuration import ClientConfiguration

class ActionInstanceRunner(object):

    def __init__(self, rapid_config):
        # type: (ClientConfiguration) -> None
        self.client_config = rapid_config

    def run_action_instance(self, app, action_instance_id):
        # type: (Flask, int) -> None
        communicator = ClientCommunicator(self.client_config.master_uri, self.client_config.quarantine_directory, app, self.client_config.verify_certs)
        self.client_config.is_single_use = True

        communicator.register(self.client_config)
        request_json = communicator.get_work_request_by_action_instance_id(action_instance_id)
        executor = Executor(WorkRequest(request_json),
                            self.client_config.master_uri,
                            workspace=self.client_config.workspace,
                            quarantine=self.client_config.quarantine_directory,
                            verify_certs=self.client_config.verify_certs,
                            rapid_config=self.client_config)
        executor.verify_work_request()
        executor.start(False)


text:
    {% for item in carousel %}

{{ item.title }}

{{ item.text }}

    {% endfor %}

Funders

    {% for item in funders -%}

    {% endfor %}

Supporting institutions

    {% for inst in institutions -%}

    {% endfor %}


text:
package com.kagrana.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertyFileManager {
	Properties properties = null;

	public PropertyFileManager() throws IOException {
		this("config.properties");
	}

	public PropertyFileManager(String fileName) throws IOException {
		this.properties = new Properties();
		File inputFile = new File(fileName);
		if (!inputFile.exists())
			throw new IOException("File does not exist");
		InputStream is = new FileInputStream(inputFile.getAbsolutePath());
		this.properties.load(is);
		is.close();
	}

	public String getProperty(String propName) {
		if (this.properties == null)
			throw new NullPointerException("Properties is null");
		return this.properties.getProperty(propName);
	}

	public void setProperty(String propName, String propValue) throws Exception {
		properties.setProperty(propName, propName);
		throw new Exception("Yet to be implemented");
	}
}


text:
/* global CollectionsApi, Consoles, EventNotifications, $timeout */
describe('Service: ConsolesFactory', function () {
  beforeEach(function () {
    module('app.services')
    bard.inject('Consoles', '$http', 'CollectionsApi', 'EventNotifications', '$timeout', '$window')
  })
  const successResponse = {
    'success': true,
    'message': 'launching console',
    'task_id': '1'
  }

  it('should try and open up a console', (done) => {
    const collectionsApiSpy = sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const requestOptions = {action: 'request_console', resource: {protocol: 'html5'}}
    Consoles.open('12345')
    done()

    expect(collectionsApiSpy).to.have.been.calledWith('vms', '12345', {}, requestOptions)
  })

  it('should give an error if it failed but has a 200 status code', (done) => {
    const failureResponse = {
      'message': 'failed'
    }
    const eventNotificationsFailureSpy = sinon.spy(EventNotifications, 'error')
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(failureResponse))
    Consoles.open('12345').then((data) => {
      done()

      expect(eventNotificationsFailureSpy).to.have.been.calledWith('There was an error opening the console. failed')
    })
  })
  it('should give a success notification if it was called and was successful', (done) => {
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const eventNotificationsSpy = sinon.spy(EventNotifications, 'info')
    Consoles.open('12345').then((data) => {
      done()

      expect(eventNotificationsSpy).to.have.been.calledWith('Waiting for the console to become ready. ', 'launching console')
    })
  })

  it('should successfully start a spice session', function (done) {
    const taskResponse = {
      'state': 'Finished',
      'status': 'Ok',
      'task_results': {
        'proto': 'spice',
        'url': 'blah',
        'secret': 'blah'
      }
    }
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const collectionsApiGetSpy = sinon.stub(CollectionsApi, 'get').returns(Promise.resolve(taskResponse))
    Consoles.open('12345').then((data) => {
      $timeout.flush()
      done()

      expect(collectionsApiGetSpy).to.have.been.calledWith('tasks', '1', {attributes: 'task_results'})
    })
  })
  it('should successfully start a vnc session', function (done) {
    const taskResponse = {
      'state': 'Finished',
      'status': 'Ok',
      'task_results': {
        'proto': 'vnc',
        'url': 'blah',
        'secret': 'blah'
      }
    }
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const collectionsApiGetSpy = sinon.stub(CollectionsApi, 'get').returns(Promise.resolve(taskResponse))
    Consoles.open('12345').then((data) => {
      $timeout.flush()
      done()

      expect(collectionsApiGetSpy).to.have.been.calledWith('tasks', '1', {attributes: 'task_results'})
    })
  })
  it('should successfully start a remote session', function (done) {
    const taskResponse = {
      'state': 'Finished',
      'status': 'Ok',
      'task_results': {
        'proto': 'remote',
        'remote_url': 'blah'
      }
    }
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const collectionsApiGetSpy = sinon.stub(CollectionsApi, 'get').returns(Promise.resolve(taskResponse))
    Consoles.open('12345').then((data) => {
      $timeout.flush()
      done()

      expect(collectionsApiGetSpy).to.have.been.calledWith('tasks', '1', {attributes: 'task_results'})
    })
  })
  it('should fail if a unknown protocol is sent', function (done) {
    const taskResponse = {
      'state': 'Finished',
      'status': 'Ok',
      'task_results': {
        'proto': 'fds',
        'remote_url': 'blah'
      }
    }
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const collectionsApiGetSpy = sinon.stub(CollectionsApi, 'get').returns(Promise.resolve(taskResponse))
    sinon.spy(EventNotifications, 'error')
    Consoles.open('12345').then((data) => {
      $timeout.flush()
      done()

      expect(collectionsApiGetSpy).to.have.been.calledWith('tasks', '1', {attributes: 'task_results'})
    })
  })
  it('should rerun if state is queued', function (done) {
    const taskResponse = {
      'id': '1',
      'state': 'Queued',
      'status': 'Ok',
      'task_results': {
        'proto': 'fds',
        'remote_url': 'blah'
      }
    }
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const collectionsApiGetSpy = sinon.stub(CollectionsApi, 'get').returns(Promise.resolve(taskResponse))
    sinon.spy(EventNotifications, 'error')
    Consoles.open('12345').then((data) => {
      $timeout.flush()
      done()

      expect(collectionsApiGetSpy).to.have.been.calledWith('tasks', '1', {attributes: 'task_results'})
    })
  })
  it('should throw an error if task fails', function (done) {
    const taskResponse = {
      'id': '1',
      'state': 'Queued',
      'status': 'failed',
      'task_results': {
        'proto': 'fds',
        'remote_url': 'blah'
      }
    }
    sinon.stub(CollectionsApi, 'post').returns(Promise.resolve(successResponse))
    const collectionsApiGetSpy = sinon.stub(CollectionsApi, 'get').returns(Promise.resolve(taskResponse))
    sinon.spy(EventNotifications, 'error')
    Consoles.open('12345').then((data) => {
      $timeout.flush()
      done()
      expect(collectionsApiGetSpy).to.have.been.calledWith('tasks', '1', {attributes: 'task_results'})
    })
  })
})


text:
<!DOCTYPE html >

          <title>PrometheusExtension - com.monsanto.arch.kamon.prometheus.PrometheusExtension</title>
          <meta name="description" content="PrometheusExtension - com.monsanto.arch.kamon.prometheus.PrometheusExtension" />
          <meta name="keywords" content="PrometheusExtension com.monsanto.arch.kamon.prometheus.PrometheusExtension" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../../../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../../../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />

com.monsanto.arch.kamon.prometheus

PrometheusExtension

            Related Docs:
            class PrometheusExtension
            | package prometheus

        object

        PrometheusExtension

          Linear Supertypes

AnyRef, Any

<input id="mbrsel-input" type="text" accesskey="/" />

              Ordering

Alphabetic

By Inheritance

                Inherited

PrometheusExtension

AnyRef

Any

Hide All

Show All

            Visibility

Public

All

Type Members

        sealed
        trait

        Command extends AnyRef

All messages that may be sent to PrometheusExtension.ref
are subtypes of this trait.

        case class

        Snapshot(snapshot: Seq[MetricFamily]) extends SnapshotMessage with Product with Serializable

Contains a metrics snapshot, which may occur either as a reply to GetCurrentSnapshot or as a message
to a subscriber indicating there is a new snapshot.

        sealed
        trait

        SnapshotMessage extends AnyRef

Parent type for all messages indicating information about the current snapshot.

Value Members

        final
        def

        !=(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        final
        def

        ##(): Int

Definition Classes

AnyRef → Any

        final
        def

        ==(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        object

        GetCurrentSnapshot extends Command with Product with Serializable

The Command to request the current snapshot.

The Command to request the current snapshot.  The extension will
reply to the sender with a SnapshotMessage.

        object

        NoCurrentSnapshot extends SnapshotMessage with Product with Serializable

Used as a reply to GetCurrentSnapshot indicate that there is no current snapshot.

        object

        Subscribe extends Command with Product with Serializable

The Command to subscribe to snapshot notifications from the extension.

The Command to subscribe to snapshot notifications from the extension.
Until an Unsubscribe is sent from the same sender (or the sender dies),
the extension will send Snapshot messages each time a new tick arrives.

        object

        Unsubscribe extends Command with Product with Serializable

Notifies the module that the sender no longer wishes to get notifications
of new snapshots.

        final
        def

        asInstanceOf[T0]: T0

Definition Classes

Any

        def

        clone(): AnyRef

Attributes

protected[java.lang]

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        eq(arg0: AnyRef): Boolean

Definition Classes

AnyRef

        def

        equals(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        def

        finalize(): Unit

Attributes

protected[java.lang]

Definition Classes

AnyRef

Annotations

                @throws(

      classOf[java.lang.Throwable]
    )

        final
        def

        getClass(): Class[_]

Definition Classes

AnyRef → Any

        def

        hashCode(): Int

Definition Classes

AnyRef → Any

        final
        def

        isInstanceOf[T0]: Boolean

Definition Classes

Any

        final
        def

        ne(arg0: AnyRef): Boolean

Definition Classes

AnyRef

        final
        def

        notify(): Unit

Definition Classes

AnyRef

        final
        def

        notifyAll(): Unit

Definition Classes

AnyRef

        final
        def

        synchronized[T0](arg0: ⇒ T0): T0

Definition Classes

AnyRef

        def

        toString(): String

Definition Classes

AnyRef → Any

        final
        def

        wait(): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        wait(arg0: Long, arg1: Int): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        wait(arg0: Long): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

Inherited from AnyRef

Inherited from Any

Ungrouped


text:
SOFORT Überweisung Omnipay gateway
==============

[![Build Status](https://travis-ci.org/ismailasci/omnipay-sofort.png?branch=master)](https://travis-ci.org/ismailasci/omnipay-sofort)
[![Latest Stable Version](https://poser.pugx.org/asci/omnipay-sofort/v/stable.png)](https://packagist.org/packages/asci/omnipay-sofort)
[![Total Downloads](https://poser.pugx.org/asci/omnipay-sofort/downloads.png)](https://packagist.org/packages/asci/omnipay-sofort)

[SOFORT Überweisung](https://www.sofort.com/eng-INT/) gateway for awesome [Omnipay](https://github.com/adrianmacneil/omnipay) library.

**Important Note: Omnipay 1.x Users**

If you are using Omnipay 1.x versions please use [1.x](https://github.com/ismailasci/omnipay-sofort/tree/1.x) tree.
For detailed information you can check Omnipay's 2.0 [release notes](https://github.com/omnipay/omnipay/releases/tag/v2.0.0).

#### API Notes

This gateway only provides 2 methods to place a successful transaction. The first one is `authorize` which initializes an authorization and returns a redirect url.

The second one is `completeAuthorize`. This method doesn't actually complete anything. Since SOFORT Überweisung doesn't have a `capture` functionality, the only way to know about a transaction is checking that transaction details. According to official docs, if there is no any successful or failed transactions, the API will return empty `transactions` XML object.

#### Installation

To install, simply add it to your composer.json file:

```json
{
    "require": {
        "asci/omnipay-sofort": "~2.0"
    }
}
```

and run `composer update`

#### Usage

For general usage instructions, please see the main [Omnipay](https://github.com/omnipay/omnipay) repository.

**1. Authorize**

```php
$gateway = Omnipay::create('Sofort');
$gateway->initialize(array(
    'username' => 'your_account_id',
    'password' => 'password',
    'projectId' => 'sofort_project_id',
    'testMode' => true
));

$response = $gateway->authorize(array(
    'amount' => 199.00,
    'description' => 'Google Nexus 4',
))->send();

$transactionReference = $response->getTransactionReference();

if ($response->isRedirect()) {
    // redirect to offsite payment gateway
    $response->redirect();
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}

```

**2. Complete Authorize**

```php
$gateway = Omnipay::create('Sofort');
$gateway->initialize(array(
    'username' => 'your_account_id',
    'password' => 'password',
    'projectId' => 'sofort_project_id',
    'testMode' => true
));

$response = $gateway->completeAuthorize(array(
    'transactionId' => $transactionReference,
))->send();

if ($response->isSuccessful()) {
    // payment was successful
    print_r($response);
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}

```


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.10
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package elkm1api;

public class ArmStatus {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected ArmStatus(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(ArmStatus obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        ElkM1APIJNI.delete_ArmStatus(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setMode(ArmMode value) {
    ElkM1APIJNI.ArmStatus_mode_set(swigCPtr, this, value.swigValue());
  }

  public ArmMode getMode() {
    return ArmMode.swigToEnum(ElkM1APIJNI.ArmStatus_mode_get(swigCPtr, this));
  }

  public void setIsReady(ArmUpMode value) {
    ElkM1APIJNI.ArmStatus_isReady_set(swigCPtr, this, value.swigValue());
  }

  public ArmUpMode getIsReady() {
    return ArmUpMode.swigToEnum(ElkM1APIJNI.ArmStatus_isReady_get(swigCPtr, this));
  }

  public void setAlarm(AlarmState value) {
    ElkM1APIJNI.ArmStatus_alarm_set(swigCPtr, this, value.swigValue());
  }

  public AlarmState getAlarm() {
    return AlarmState.swigToEnum(ElkM1APIJNI.ArmStatus_alarm_get(swigCPtr, this));
  }

  public ArmStatus() {
    this(ElkM1APIJNI.new_ArmStatus(), true);
  }

}


text:
package org.wso2.carbon.uuf.internal.io;

import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.uuf.core.App;
import org.wso2.carbon.uuf.core.Component;
import org.wso2.carbon.uuf.core.Theme;
import org.wso2.carbon.uuf.internal.UUFServer;
import org.wso2.carbon.uuf.internal.exception.FileOperationException;
import org.wso2.carbon.uuf.internal.exception.ResourceNotFoundException;
import org.wso2.carbon.uuf.internal.io.util.MimeMapper;
import org.wso2.carbon.uuf.spi.HttpRequest;
import org.wso2.carbon.uuf.spi.HttpResponse;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.time.Duration;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.AbstractMap;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import static org.wso2.carbon.uuf.api.reference.ComponentReference.DIR_NAME_FRAGMENTS;
import static org.wso2.carbon.uuf.spi.HttpResponse.CONTENT_TYPE_IMAGE_PNG;
import static org.wso2.carbon.uuf.spi.HttpResponse.CONTENT_TYPE_WILDCARD;
import static org.wso2.carbon.uuf.spi.HttpResponse.HEADER_CACHE_CONTROL;
import static org.wso2.carbon.uuf.spi.HttpResponse.HEADER_LAST_MODIFIED;
import static org.wso2.carbon.uuf.spi.HttpResponse.STATUS_BAD_REQUEST;
import static org.wso2.carbon.uuf.spi.HttpResponse.STATUS_INTERNAL_SERVER_ERROR;
import static org.wso2.carbon.uuf.spi.HttpResponse.STATUS_NOT_FOUND;
import static org.wso2.carbon.uuf.spi.HttpResponse.STATUS_NOT_MODIFIED;
import static org.wso2.carbon.uuf.spi.HttpResponse.STATUS_OK;

public class StaticResolver {

    public static final String DIR_NAME_COMPONENT_RESOURCES = "base";
    public static final String DIR_NAME_PUBLIC_RESOURCES = "public";
    private static final DateTimeFormatter HTTP_DATE_FORMATTER;
    private static final ZoneId GMT_TIME_ZONE;
    private static final Logger LOGGER = LoggerFactory.getLogger(StaticResolver.class);

    private final Map<Path, ZonedDateTime> resourcesLastModifiedDates;

    static {
        // See https://tools.ietf.org/html/rfc7231#section-7.1.1.1
        HTTP_DATE_FORMATTER = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz");
        GMT_TIME_ZONE = ZoneId.of("GMT");
    }

    /**
     * The constructor of StaticResolver class
     */
    public StaticResolver() {
        if (UUFServer.isDevModeEnabled()) {
            /*
             * When the dev mode is enabled, we do not cache last modified dates of serving static resources. This is
             * achieved by setting a dummy map to the 'resourcesLastModifiedDates' field. Dummy map does not store any
             * values and it size is always zero.
             */
            this.resourcesLastModifiedDates = new AbstractMap<Path, ZonedDateTime>() {
                @Override
                public Set<Entry<Path, ZonedDateTime>> entrySet() {
                    return Collections.emptySet(); // No entries in this dummy map.
                }

                @Override
                public ZonedDateTime put(Path key, ZonedDateTime value) {
                    return value; // Do not store in this is dummy Map.
                }
            };
        } else {
            this.resourcesLastModifiedDates = new ConcurrentHashMap<>();
        }
    }

    public void serveDefaultFavicon(HttpRequest request, HttpResponse response) {
        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("/favicon.png");
        if (inputStream == null) {
            LOGGER.error("Cannot find default favicon 'favicon.png' in classpath.");
            response.setStatus(STATUS_NOT_FOUND);
        } else {
            response.setStatus(STATUS_OK);
            response.setContent(inputStream, CONTENT_TYPE_IMAGE_PNG);
        }
    }

    public void serve(App app, HttpRequest request, HttpResponse response) {
        Path resourcePath;
        ZonedDateTime lastModifiedDate;
        setResponseSecurityHeaders(app, response);
        try {
            if (request.isComponentStaticResourceRequest()) {
                // /public/components/...
                resourcePath = resolveResourceInComponent(app, request.getUriWithoutContextPath());
            } else if (request.isThemeStaticResourceRequest()) {
                // /public/themes/...
                resourcePath = resolveResourceInTheme(app, request.getUriWithoutContextPath());
            } else {
                // /public/...
                response.setContent(STATUS_BAD_REQUEST, "Invalid static resource URI '" + request.getUri() + "'.");
                return;
            }
            lastModifiedDate = resourcesLastModifiedDates.computeIfAbsent(resourcePath, this::getLastModifiedDate);
        } catch (IllegalArgumentException e) {
            // Invalid/incorrect static resource URI.
            response.setContent(STATUS_BAD_REQUEST, e.getMessage());
            return;
        } catch (ResourceNotFoundException e) {
            // Static resource file does not exists.
            response.setContent(STATUS_NOT_FOUND, "Requested resource '" + request.getUri() + "' does not exists.");
            return;
        } catch (Exception e) {
            // FileOperationException, IOException or any other Exception that might occur.
            LOGGER.error("An error occurred when manipulating paths for static resource request '{}'.", request, e);
            response.setContent(STATUS_INTERNAL_SERVER_ERROR,
                                "A server occurred while serving for static resource request '" + request + "'.");
            return;
        }

        if (lastModifiedDate == null) {
            /* Since we failed to read last modified date of 'resourcePath' file, we cannot set cache headers.
            Therefore just serve the file without any cache headers. */
            response.setStatus(STATUS_OK);
            response.setContent(resourcePath, getContentType(request, resourcePath));
            return;
        }
        ZonedDateTime ifModifiedSinceDate = getIfModifiedSinceDate(request);
        if ((ifModifiedSinceDate != null) && Duration.between(ifModifiedSinceDate, lastModifiedDate).isZero()) {
            // Resource is NOT modified since the last serve.
            response.setStatus(STATUS_NOT_MODIFIED);
            return;
        }

        setCacheHeaders(lastModifiedDate, response);
        response.setStatus(STATUS_OK);
        response.setContent(resourcePath, getContentType(request, resourcePath));
    }

    private Path resolveResourceInComponent(App app, String uriWithoutContextPath) {
        /* Correct 'uriWithoutContextPath' value must be in
         * "/public/components/{component-context-path}/{fragment-simple-name}/{sub-directory}/{rest-of-the-path}"
         * format or in
         * "/public/components/{component-context-path}/base/{sub-directory}/{rest-of-the-path}" format.
         * So there should be at least 6 slashes. Don't worry about multiple consecutive slashes. They  are covered in
         * HttpRequest.isValid() method which is called before this method.
         */

        int slashesCount = 0, thirdSlashIndex = -1, fourthSlashIndex = -1, fifthSlashIndex = -1;
        for (int i = 0; i < uriWithoutContextPath.length(); i++) {
            if (uriWithoutContextPath.charAt(i) == '/') {
                slashesCount++;
                if (slashesCount == 3) {
                    thirdSlashIndex = i;
                } else if (slashesCount == 4) {
                    fourthSlashIndex = i;
                } else if (slashesCount == 5) {
                    fifthSlashIndex = i;
                } else if (slashesCount == 6) {
                    break;
                }
            }
        }
        if (slashesCount != 6) {
            throw new IllegalArgumentException("Invalid static resource URI '" + uriWithoutContextPath + "'.");
        }
        String componentContextPath = uriWithoutContextPath.substring(thirdSlashIndex, fourthSlashIndex);
        Component component = app.getComponents().get(componentContextPath);
        if (component == null) {
            throw new ResourceNotFoundException(
                    "Component for context path '" + componentContextPath + "' found in URI '" + uriWithoutContextPath +
                            "' does not exists in app '" + app.getName() + "'.");
        }

        // {fragment-simple-name} OR 'base'
        String fragmentSimpleName = uriWithoutContextPath.substring(fourthSlashIndex + 1, fifthSlashIndex);
        // {sub-directory}/{rest-of-the-path}
        String relativePathString = uriWithoutContextPath.substring(fifthSlashIndex + 1,
                                                                    uriWithoutContextPath.length());
        if (DIR_NAME_COMPONENT_RESOURCES.equals(fragmentSimpleName)) {
            // Resource is inside the 'public' directory of the 'component'
            return Paths.get(component.getPath(), DIR_NAME_PUBLIC_RESOURCES, relativePathString);
        } else {
            // Resource is inside the 'public' directory of fragment 'fragmentSimpleName' of the 'component'
            return Paths.get(component.getPath(), DIR_NAME_FRAGMENTS, fragmentSimpleName, DIR_NAME_PUBLIC_RESOURCES,
                             relativePathString);
        }
    }

    private Path resolveResourceInTheme(App app, String uriWithoutContextPath) {
        /* Correct 'uriWithoutContextPath' value must be in
         * "/public/themes/{theme-name}/{sub-directory}/{rest-of-the-path}" format.
         * So there should be at least 5 slashes. Don't worry about multiple consecutive slashes. They  are covered
         * in HttpRequest.isValid() method which is called before this method.
         */

        int slashesCount = 0, thirdSlashIndex = -1, fourthSlashIndex = -1;
        for (int i = 0; i < uriWithoutContextPath.length(); i++) {
            if (uriWithoutContextPath.charAt(i) == '/') {
                slashesCount++;
                if (slashesCount == 3) {
                    thirdSlashIndex = i;
                } else if (slashesCount == 4) {
                    fourthSlashIndex = i;
                } else if (slashesCount == 5) {
                    break;
                }
            }
        }
        if (slashesCount != 5) {
            throw new IllegalArgumentException("Invalid static resource URI '" + uriWithoutContextPath + "'.");
        }
        String themeName = uriWithoutContextPath.substring(thirdSlashIndex + 1, fourthSlashIndex);
        Theme theme = app.getThemes().get(themeName);
        if (theme == null) {
            throw new ResourceNotFoundException("Theme '" + themeName + "' found in URI '" + uriWithoutContextPath +
                                                        "' does not exists in app '" + app.getName() + "'.");
        }

        // {sub-directory}/{rest-of-the-path}
        String relativePathString = uriWithoutContextPath.substring(fourthSlashIndex + 1,
                                                                    uriWithoutContextPath.length());
        return Paths.get(theme.getPath(), DIR_NAME_PUBLIC_RESOURCES, relativePathString);
    }

    private ZonedDateTime getLastModifiedDate(Path resourcePath) {
        if (!Files.isReadable(resourcePath)) {
            throw new ResourceNotFoundException("Static resource file '" + resourcePath + "' is not readable.");
        }

        BasicFileAttributes fileAttributes;
        try {
            fileAttributes = Files.readAttributes(resourcePath, BasicFileAttributes.class);
        } catch (NoSuchFileException | FileNotFoundException e) {
            // This shouldn't be happening because we checked the file's readability before. But just in case.
            throw new ResourceNotFoundException("Static resource file '" + resourcePath + "' does not exists.", e);
        } catch (Exception e) {
            // UnsupportedOperationException, IOException or any other Exception that might occur.
            throw new FileOperationException(
                    "Cannot read file attributes from static resource file '" + resourcePath + "'.", e);
        }
        if (fileAttributes.isRegularFile()) {
            return ZonedDateTime.ofInstant(fileAttributes.lastModifiedTime().toInstant(), GMT_TIME_ZONE);
        } else {
            /*
             * From book "OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide" page 478:
             *      Java defines a regular file as one that contains content, as opposed to a symbolic link,
             *      directory, resource (e.g. port, pipe), or other non-regular files that may be present in some
             *      operating systems. [...] It is possible for isRegularFile() to return true for a symbolic link,
             *      as long as the link resolves to a regular file.
             * Hence, checking 'isRegularFile' of a file is enough to determine its existence and not being a directory.
             */
            throw new ResourceNotFoundException("Static resource file '" + resourcePath + "' is not a regular file.");
        }
    }

    private ZonedDateTime getIfModifiedSinceDate(HttpRequest request) {
        // If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
        String ifModifiedSinceHeader = request.getHeaders().get("If-Modified-Since");
        if (ifModifiedSinceHeader == null) {
            return null; // 'If-Modified-Since' does not exists in HTTP headres.
        }
        try {
            return ZonedDateTime.parse(ifModifiedSinceHeader, HTTP_DATE_FORMATTER);
        } catch (DateTimeParseException e) {
            LOGGER.warn("Cannot parse 'If-Modified-Since' HTTP header value '{}'.", ifModifiedSinceHeader, e);
            return null;
        }
    }

    private void setResponseSecurityHeaders(App app, HttpResponse response) {
        app.getConfiguration().getResponseHeaders().getStaticResources().forEach(response::setHeader);
    }

    private void setCacheHeaders(ZonedDateTime lastModifiedDate, HttpResponse response) {
        response.setHeader(HEADER_LAST_MODIFIED, HTTP_DATE_FORMATTER.format(lastModifiedDate));
        response.setHeader(HEADER_CACHE_CONTROL, "public,max-age=2592000");
    }

    private String getContentType(HttpRequest request, Path resource) {
        String extensionFromUri = FilenameUtils.getExtension(request.getUriWithoutContextPath());
        Optional<String> contentType = MimeMapper.getMimeType(extensionFromUri);
        if (contentType.isPresent()) {
            return contentType.get();
        }
        // Here 'resource' never null, thus 'FilenameUtils.getExtension(...)' never return null.
        String extensionFromPath = FilenameUtils.getExtension(resource.getFileName().toString());
        return MimeMapper.getMimeType(extensionFromPath).orElse(CONTENT_TYPE_WILDCARD);
    }
}


text:
/*
 * formats.js: Default formats supported by nconf
 *
 * (C) 2011, Charlie Robbins and the Contributors.
 *
 */

var ini = require('ini');

var formats = exports;

//
// ### @json
// Standard JSON format which pretty prints `.stringify()`.
//
formats.json = {
  stringify: function (obj, replacer, spacing) {
    return JSON.stringify(obj, replacer || null, spacing || 2)
  },
  parse: JSON.parse
};

//
// ### @ini
// Standard INI format supplied from the `ini` module
// http://en.wikipedia.org/wiki/INI_file
//
formats.ini = ini;


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        <title><?php echo $context->calendar->name; ?></title>
        <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $context->uri; ?>templates/vanilla/screen.css" />
        <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $context->uri; ?>templates/vanilla/css/fullcalendar.css" />
        <?php
        if (!isset($context->calendar->theme)) {
            $context->calendar->theme = "base";
        }
        ?>

<?php echo $context->calendar->name; ?>

            <a href="<?php echo $context->manageruri; ?>">Event Publishing Manager

        <?php echo $savvy->render($context->output); ?>

Yeah, It's Open Source

                The UNL Events System is an open source project
                built by the University of Nebraska–Lincoln
                which implements the UC Berkeley Calendar Network specifications.

UNL Events on Github


text:
package edu.upenn.cis.ppod.imodel;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.Nullable;

/**
 * A child of something.
 *
 * @author Sam Donnelly
 */
public interface IChild<P> extends IPPodEntity {

	/**
	 * Get the parent. Will be {@code null} when this object is not attached to
	 * a parent.
	 *
	 * @return the parent
	 */
	@Nullable
	P getParent();

	/**
	 * Set or unset the parent.
	 * <p>
	 * Generally, there is no reason for client code to call this method as the
	 * parent-child relationships are managed by the parents' adder/setters.
	 */
	void setParent(@CheckForNull P parent);

}


text:
<?php
/**
 * VendorAdapterInterface.php
 *
 * @author dbojdo - Daniel Bojdo <daniel.bojdo@web-it.eu>
 * Created on Nov 20, 2014, 15:38
 */

namespace Webit\Shipment\Manager;

use Doctrine\Common\Collections\ArrayCollection;
use Webit\Shipment\Consignment\DispatchConfirmationInterface;
use Webit\Shipment\Consignment\ConsignmentInterface;
use Webit\Shipment\Parcel\ParcelInterface;
use Webit\Shipment\Vendor\VendorFactoryInterface;
use Webit\Shipment\Vendor\VendorInterface;
use Webit\Shipment\Vendor\VendorOptionInterface;
use Webit\Tools\Data\FilterCollection;
use Webit\Tools\Data\SorterCollection;

/**
 * Interface VendorAdapterInterface
 * @package Webit\Shipment\Manager
 */
interface VendorAdapterInterface extends VendorFactoryInterface
{

    /**
     * Returns consignments
     * @param FilterCollection $filters
     * @param SorterCollection $sorters
     * @param int $limit
     * @param int $offset
     * @return ArrayCollection
     */
    public function getConsignments(
        FilterCollection $filters = null,
        SorterCollection $sorters = null,
        $limit = 50,
        $offset = 0
    );

    /**
     * @param DispatchConfirmationInterface $dispatchConfirmation
     */
    public function dispatch(DispatchConfirmationInterface $dispatchConfirmation);

    /**
     * Update consignment data with vendor's one
     * @param ConsignmentInterface $consignment
     * @return mixed
     */
    public function synchronizeConsignment(ConsignmentInterface $consignment);

    /**
     * @param ParcelInterface $parcel
     * @return string
     */
    public function synchronizeParcelStatus(ParcelInterface $parcel);

    /**
     * Save consignment to vendor
     * @param ConsignmentInterface $consignment
     */
    public function saveConsignment(ConsignmentInterface $consignment);

    /**
     * Remove consignment from vendor
     * @param ConsignmentInterface $consignment
     */
    public function removeConsignment(ConsignmentInterface $consignment);

    /**
     * Cancel consignment from vendor
     * @param ConsignmentInterface $consignment
     */
    public function cancelConsignment(ConsignmentInterface $consignment);

    /**
     * @param ConsignmentInterface $consignment
     * @param string $mode
     * @return string
     */
    public function getConsignmentLabel(ConsignmentInterface $consignment, $mode = null);

    /**
     * @param DispatchConfirmationInterface $dispatchConfirmation
     * @param string $mode
     * @return string
     */
    public function getConsignmentDispatchConfirmationLabel(
        DispatchConfirmationInterface $dispatchConfirmation,
        $mode = null
    );

    /**
     * @param DispatchConfirmationInterface $dispatchConfirmation
     * @param string $mode
     * @return string
     */
    public function getConsignmentDispatchConfirmationReceipt(
        DispatchConfirmationInterface $dispatchConfirmation,
        $mode = null
    );

    /**
     * @param ConsignmentInterface $consignment
     * @return string
     */
    public function getConsignmentTrackingUrl(ConsignmentInterface $consignment);
}


text:
  <title>d3-line-graph</title>

Welcome to Meteor!

  {{> input}}
  {{> table_transformation}}
  {{> chart}}

<template name="input">

Let's look inside the database

    data = {{pointsAsJSON}};

</template>

<template name="table_transformation">

Now let's see the data as a table

City	Date	Temperature

    {{#each points}}
      {{#each values}}

{{../series}}	{{timestamp.toLocaleDateString}}	{{temperature}}℉

      {{/each}}
    {{/each}}

</template>

<template name="chart">

Finally, let's see the data graphically

</template>


text:
import { fromURL, popup } from "./sandbox";
import { rest, setupWorker } from "msw";
import classic from "./templates/classic";
import MintGA from "./templates/MintGA";
import VanillaGA from "./templates/VanillaGA";
import { getQueryStringParams } from "./util";
import QuirksVanillaGA from "./templates/QuirksVanillaGA";
import QuirksMintGA from "./templates/QuirksMintGA";
import MintGAContainer from "./templates/MintGAContainer";
import VanillaGANoContainer from "./templates/VanillaGANoContainer";
import MintGAContainerDisplayBlock from "./templates/MintGAContainerDisplayBlock";
import QuirksMintGAContainerDisplayBlock from "./templates/QuirksMintGAContainerDisplayBlock";
import QuirksMintGAContainer from "./templates/QuirksMintGAContainer";

export const widgets = {
  classic,
  MintGA,
  VanillaGA,
  QuirksVanillaGA,
  QuirksMintGA,
  MintGAContainer,
  MintGAContainerDisplayBlock,
  QuirksMintGAContainerDisplayBlock,
  QuirksMintGAContainer,
  VanillaGANoContainer,
};

export const handlers = window["mockWidget"] && [
  rest.put("https://staging.referralsaasquatch.com/api/*", (req, res, ctx) => {
    return res(
      ctx.status(202, "Mocked status"),
      ctx.json(widgets[window["mockWidget"]])
    );
  }),
];
// Setup requests interception using the given handlers.

export const worker = setupWorker(...handlers);
window["sandbox"] = fromURL();


text:
var arrayEachRight = require('./_arrayEachRight'),
    baseEachRight = require('./_baseEachRight'),
    castFunction = require('./_castFunction'),
    isArray = require('./isArray');

/**
 * This method is like `_.forEach` except that it iterates over elements of
 * `collection` from right to left.
 *
 * @static
 * @memberOf _
 * @since 2.0.0
 * @alias eachRight
 * @category Collection
 * @param {Array|Object} collection The collection to iterate over.
 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
 * @returns {Array|Object} Returns `collection`.
 * @see _.forEach
 * @example
 *
 * _.forEachRight([1, 2], function(value) {
 *   console.log(value);
 * });
 * // => Logs `2` then `1`.
 */
function forEachRight(collection, iteratee) {
  var func = isArray(collection) ? arrayEachRight : baseEachRight;
  return func(collection, castFunction(iteratee));
}

module.exports = forEachRight;


text:
FROM debian:jessie

# Maintainer
MAINTAINER Alban Montaigu <alban.montaigu@gmail.com>

# Environment configuration
ENV DEBIAN_FRONTEND="noninteractive"

# System preparation
RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y sudo git wget ruby ruby-dev openssl supervisor build-essential redis-server \
    && mkdir -p /var/log/supervisor

# RabbitMQ
RUN apt-get install -y rabbitmq-server \
    && git clone git://github.com/joemiller/joemiller.me-intro-to-sensu.git \
    && cd joemiller.me-intro-to-sensu \
    && ./ssl_certs.sh clean \
    && ./ssl_certs.sh generate \
    && mkdir /etc/rabbitmq/ssl \
    && cp /joemiller.me-intro-to-sensu/server_cert.pem /etc/rabbitmq/ssl/cert.pem \
    && cp /joemiller.me-intro-to-sensu/server_key.pem /etc/rabbitmq/ssl/key.pem \
    && cp /joemiller.me-intro-to-sensu/testca/cacert.pem /etc/rabbitmq/ssl/
ADD ./sensu/rabbitmq.config /etc/rabbitmq/
RUN rabbitmq-plugins enable rabbitmq_management

# Sensu server
RUN wget -q http://repositories.sensuapp.org/apt/pubkey.gpg -O- | sudo apt-key add - \
    && echo "deb     http://repositories.sensuapp.org/apt sensu main" | sudo tee /etc/apt/sources.list.d/sensu.list \
    && apt-get update \
    && apt-get install -y sensu
ADD ./sensu/config.json /etc/sensu/
RUN mkdir -p /etc/sensu/ssl \
    && cp /joemiller.me-intro-to-sensu/client_cert.pem /etc/sensu/ssl/cert.pem \
    && cp /joemiller.me-intro-to-sensu/client_key.pem /etc/sensu/ssl/key.pem \
    && gem install sensu-plugin \
    && gem install sensu-plugins-mailer

# uchiwa
RUN apt-get install -y uchiwa \
    && rm -r /var/lib/apt/lists/*
ADD ./sensu/uchiwa.json /etc/sensu/

# supervisord
ADD ./supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

EXPOSE 3000 4567 5671 15672

# Main process
CMD ["/usr/bin/supervisord"]


text:
package com.emc.rest.smart.ecs;

import org.junit.Assert;
import org.junit.Test;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.StringReader;
import java.io.StringWriter;

public class ListDataNodeTest {
    @Test
    public void testMarshalling() throws Exception {
        JAXBContext context = JAXBContext.newInstance(ListDataNode.class);

        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
                "<ListDataNode xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">" +
                "<DataNodes>10.241.48.51</DataNodes>" +
                "<DataNodes>10.241.48.52</DataNodes>" +
                "<DataNodes>10.241.48.53</DataNodes>" +
                "<DataNodes>10.241.48.54</DataNodes>" +
                "<VersionInfo>1.2.0.0.60152.d32b519</VersionInfo>" +
                "</ListDataNode>";

        ListDataNode listDataNode = new ListDataNode();
        listDataNode.getDataNodes().add("10.241.48.51");
        listDataNode.getDataNodes().add("10.241.48.52");
        listDataNode.getDataNodes().add("10.241.48.53");
        listDataNode.getDataNodes().add("10.241.48.54");
        listDataNode.setVersionInfo("1.2.0.0.60152.d32b519");

        // unmarshall and compare to object
        Unmarshaller unmarshaller = context.createUnmarshaller();
        ListDataNode unmarshalledObject = (ListDataNode) unmarshaller.unmarshal(new StringReader(xml));

        Assert.assertEquals(listDataNode.getDataNodes(), unmarshalledObject.getDataNodes());
        Assert.assertEquals(listDataNode.getVersionInfo(), unmarshalledObject.getVersionInfo());

        // marshall and compare XML
        Marshaller marshaller = context.createMarshaller();
        StringWriter writer = new StringWriter();
        marshaller.marshal(listDataNode, writer);

        Assert.assertEquals(xml, writer.toString());
    }
}


text:
'use strict';

/**
 * this is an action for the microservice
 */

var model = require('../models/model');
const ASQ = require('asynquence-contrib');

module.exports = function (options) {
  options = options || {};
  const seneca = options.seneca;
  const log = seneca && seneca.log || console;
  const dbConfig = options.dbconfig;
  // mocking purposes
  model = options.model || model;

  return function (args, done) {
    log.info(options.srvname, options.actname);

    var defaultResponse = {
      content: 'Document not found',
      statusCode: 404
    };

    args = args || {};
    if (args.id && args.body) {

      ASQ((stepdone)=> {
        model.updateById(args.id, args.body, dbConfig, stepdone.errfcb);
      }).then((stepdone, results)=> {
        model.getById(args.id, dbConfig, stepdone.errfcb);
      }).then((stepdone, data)=> {
        done(null, data ? {
          content: data,
          statusCode: 200
        } : defaultResponse);
        stepdone();
      }).or((error)=> {
        log.error(error);
        done(error);
      });

    } else {
      done(null, defaultResponse);
    }

  };
};


text:
<?php

namespace noFlash\CherryHttp\IO\Network;

/**
 * - Listeners cannot contain remote IP sine they're not connected (so, protected $networkRemoteIp = null)
 * - Listener cannot contain remote port since they're not connected (so, protected $networkRemotePort = null)
 * - Again... listeners cannot be connected ;) (so, protected $networkIsConnected = false)
 */
abstract class AbstractNetworkListenerNode extends AbstractNetworkStreamNode implements NetworkListenerNodeInterface
{
    /**
     * Closes listener.
     * Note: clients connected using this listener will be leaved untouched. If you want to disconnect them get clients
     * list and than call disconnect() on each of them.
     *
     * @return void
     */
    public function disconnect()
    {
        if (is_resource($this->stream)) {
            fclose($this->stream); //Perhaps this still can throw E_WARNING but I rather not use @
        }
    }

    /**
     * Sets listening address.
     *
     * @param string $address Any valid IPv4 or IPv6 address, NetworkNodeInterface::UNDETERMINED_IPV4 or
     *                        NetworkNodeInterface::UNDETERMINED_IPV6.
     *
     * @return void
     *
     * @throws \InvalidArgumentException
     */
    public function setLocalIpAddress($address)
    {
        if (!filter_var($address, FILTER_VALIDATE_IP)) {
            throw new \InvalidArgumentException('Invalid ip address');
        }

        $this->networkIpVersion = (strpos($address, ':') ===
                                   false) ? NetworkNodeInterface::IP_V4 : NetworkNodeInterface::IP_V6;
        $this->networkLocalIp = $address;
    }

    /**
     * Sets listening port.
     *
     * @param int $port Any valid port number, or self::RANDOM_LISTEN_PORT
     *
     * @return void
     *
     * @throws \InvalidArgumentException
     */
    public function setLocalPort($port)
    {
        if ($port < 0 || $port > 65535 || !is_integer($port)) {
            throw new \InvalidArgumentException('Invalid port');
        }

        $this->networkLocalPort = $port;
    }

    /**
     * Prepares listening stream and starts listening.
     * It's equivalent of using socket(), bind(), and listen() system calls.
     *
     * @return resource Listening socket.
     *
     * @throws \LogicException It already listens
     * @throws \RuntimeException Something went bad during SOCKET/BIND/LISTEN
     */
    public function startListening()
    {
        if ($this->stream !== null) {
            throw new \LogicException(
                'Listener is already listening, you cannot listen while listening because listening while listening ' .
                'will break that listening which now listens.... but for real, call disconnect() fist'
            );
        }

        $address = ($this->networkIpVersion ===
                    NetworkNodeInterface::IP_V4) ? $this->networkLocalIp : "[{$this->networkLocalIp}]";

        /** @noinspection PhpUsageOfSilenceOperatorInspection It's checked below, but it will throw warn. anyway */
        $this->stream = @stream_socket_server("tcp://$address:{$this->networkLocalPort}");

        if ($this->stream === false) {
            $error = error_get_last();
            $error = (isset($error['message'])) ? $error['message'] : 'Unknown stream_socket_server() error';
            $this->stream = null;

            throw new \RuntimeException($error);
        }
        stream_set_blocking($this->stream, 0);

        $address = stream_socket_get_name($this->stream, false);
        $dividerPosition = strrpos($address, ':');

        $this->networkLocalIp = substr($address, 0, $dividerPosition);
        $this->networkLocalPort = (int)substr($address, $dividerPosition + 1);
    }

    /**
     * In case of listener node this always returns that it's not write ready.
     *
     * @return bool
     */
    public function isWriteReady()
    {
        return false;
    }

    /**
     * In case of listener node it's just a dummy method.
     *
     * @throws \LogicException
     */
    public function doWrite()
    {
        throw new \LogicException('You cannot perform write on listener node');
    }

    /**
     * In case of listener node it's just a dummy method.
     *
     * @param mixed $data It will be ignored
     *
     * @throws \LogicException You cannot append to listener buffer.
     *
     * @todo This method likely shouldn't be here - it needs investigation
     */
    public function writeBufferAppend($data)
    {
        throw new \LogicException('You cannot add data to buffer on listener node (because there\'s no any)');
    }
}


text:
import React from 'react'
import {Link} from 'react-router-dom'

import TimeAgo from 'react-timeago'

import './styles.styl'

const DemoInfo = ({demoInfo, serverInfo}) => {
  const {url, deleted, expired, recording, requested} = demoInfo
  let demoStatus
  if (url) {
    demoStatus = 'Uploaded'
  }
  else if (deleted || expired) {
    demoStatus = 'Deleted'
  }
  else if (recording) {
    if (requested) {
      demoStatus = 'Recording (upload queued)'
    }
    else {
      demoStatus = 'Recording'
    }
  }
  else if (requested) {
    demoStatus = 'Uploading'
  }
  else {
    demoStatus = 'Not uploaded'
  }
  return (

          Filename
          {demoInfo.filename}.dem

          Server

            <Link to={`/servers/${serverInfo.id}`}>{serverInfo.name}</Link>

          Map

            <Link to={`/maps/${demoInfo.mapname}`}>
              {demoInfo.mapname}
            </Link>

          Status
          {demoStatus}

          Date
          <TimeAgo date={demoInfo.date * 1000} />

  )
}

export default DemoInfo


text:
#include <QtTest>

#define private public
#include "qlcfixturedefcache.h"
#undef private

#include "qlcfixturedefcache_test.h"
#include "qlcfixturedef.h"
#include "qlcconfig.h"
#include "qlcfile.h"

#include "../common/resource_paths.h"

void QLCFixtureDefCache_Test::init()
{
    QDir dir(INTERNAL_FIXTUREDIR);
    dir.setFilter(QDir::Files);
    dir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
    QVERIFY(cache.load(QDir("/just/kidding/stoopid")) == false);
    QVERIFY(cache.load(dir) == true);
}

void QLCFixtureDefCache_Test::cleanup()
{
    cache.clear();
}

void QLCFixtureDefCache_Test::duplicates()
{
    // Check that duplicates are discarded
    int num = cache.m_defs.size();
    QDir dir(INTERNAL_FIXTUREDIR);
    dir.setFilter(QDir::Files);
    dir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
    cache.load(dir);
    QCOMPARE(cache.m_defs.size(), num);
}

void QLCFixtureDefCache_Test::add()
{
    QVERIFY(cache.addFixtureDef(NULL) == false);

    QVERIFY(cache.manufacturers().count() != 0);
    cache.clear();
    QVERIFY(cache.manufacturers().count() == 0);

    /* Add the first fixtureDef */
    QLCFixtureDef* def = new QLCFixtureDef();
    def->setManufacturer("Martin");
    def->setModel("MAC250");

    QVERIFY(cache.addFixtureDef(def) == true);
    QVERIFY(cache.manufacturers().count() == 1);
    QVERIFY(cache.manufacturers().contains("Martin") == true);
    QVERIFY(cache.manufacturers().contains("MAC250") == false);

    QVERIFY(cache.models("Martin").count() == 1);
    QVERIFY(cache.models("Martin").contains("MAC250") == true);
    QVERIFY(cache.models("Foo").count() == 0);

    /* Another fixtureDef, same manufacturer & model. Should be ignored. */
    QLCFixtureDef* def2 = new QLCFixtureDef();
    def2->setManufacturer("Martin");
    def2->setModel("MAC250");

    QVERIFY(cache.addFixtureDef(def2) == false);
    QVERIFY(cache.manufacturers().count() == 1);
    QVERIFY(cache.manufacturers().contains("Martin") == true);

    delete def2;
    def2 = NULL;

    /* Another fixtureDef, same manufacturer, different model */
    def2 = new QLCFixtureDef();
    def2->setManufacturer("Martin");
    def2->setModel("MAC500");

    QVERIFY(cache.addFixtureDef(def2) == true);
    QVERIFY(cache.manufacturers().count() == 1);
    QVERIFY(cache.manufacturers().contains("Martin") == true);
    QVERIFY(cache.manufacturers().contains("MAC500") == false);

    QVERIFY(cache.models("Martin").count() == 2);
    QVERIFY(cache.models("Martin").contains("MAC250") == true);
    QVERIFY(cache.models("Martin").contains("MAC500") == true);

    /* Another fixtureDef, different manufacturer, different model */
    QLCFixtureDef* def3 = new QLCFixtureDef();
    def3->setManufacturer("Futurelight");
    def3->setModel("PHS700");

    QVERIFY(cache.addFixtureDef(def3) == true);
    QVERIFY(cache.manufacturers().count() == 2);
    QVERIFY(cache.manufacturers().contains("Martin") == true);
    QVERIFY(cache.manufacturers().contains("Futurelight") == true);
    QVERIFY(cache.manufacturers().contains("PHS700") == false);

    /* Another fixtureDef, different manufacturer, same model */
    QLCFixtureDef* def4 = new QLCFixtureDef();
    def4->setManufacturer("Yoyodyne");
    def4->setModel("MAC250");

    QVERIFY(cache.addFixtureDef(def4) == true);
    QVERIFY(cache.manufacturers().count() == 3);
    QVERIFY(cache.manufacturers().contains("Martin") == true);
    QVERIFY(cache.manufacturers().contains("Futurelight") == true);
    QVERIFY(cache.manufacturers().contains("Yoyodyne") == true);
    QVERIFY(cache.manufacturers().contains("MAC250") == false);

    QVERIFY(cache.models("Yoyodyne").count() == 1);
    QVERIFY(cache.models("Yoyodyne").contains("MAC250") == true);
}

void QLCFixtureDefCache_Test::fixtureDef()
{
    cache.clear();

    QLCFixtureDef* def1 = new QLCFixtureDef();
    def1->setManufacturer("Martin");
    def1->setModel("MAC250");
    cache.addFixtureDef(def1);

    QLCFixtureDef* def2 = new QLCFixtureDef();
    def2->setManufacturer("Martin");
    def2->setModel("MAC500");
    cache.addFixtureDef(def2);

    QLCFixtureDef* def3 = new QLCFixtureDef();
    def3->setManufacturer("Robe");
    def3->setModel("WL250");
    cache.addFixtureDef(def3);

    QLCFixtureDef* def4 = new QLCFixtureDef();
    def4->setManufacturer("Futurelight");
    def4->setModel("DJ Scan 250");
    cache.addFixtureDef(def4);

    QVERIFY(cache.fixtureDef("Martin", "MAC250") == def1);
    QVERIFY(cache.fixtureDef("Martin", "MAC500") == def2);
    QVERIFY(cache.fixtureDef("Robe", "WL250") == def3);
    QVERIFY(cache.fixtureDef("Futurelight", "DJ Scan 250") == def4);
    QVERIFY(cache.fixtureDef("Martin", "MAC 250") == NULL);
    QVERIFY(cache.fixtureDef("Mar tin", "MAC250") == NULL);
    QVERIFY(cache.fixtureDef("Foobar", "Foobar") == NULL);
    QVERIFY(cache.fixtureDef("", "") == NULL);
}

void QLCFixtureDefCache_Test::load()
{
    /* At least these should be available */
    QVERIFY(cache.manufacturers().contains("Elation") == true);
    QVERIFY(cache.manufacturers().contains("Eurolite") == true);
    QVERIFY(cache.manufacturers().contains("Futurelight") == true);
    QVERIFY(cache.manufacturers().contains("GLP") == true);
    QVERIFY(cache.manufacturers().contains("JB-Lighting") == true);
    QVERIFY(cache.manufacturers().contains("Lite-Works") == true);
    QVERIFY(cache.manufacturers().contains("Martin") == true);
    QVERIFY(cache.manufacturers().contains("Robe") == true);
    QVERIFY(cache.manufacturers().contains("SGM") == true);
}

void QLCFixtureDefCache_Test::defDirectories()
{
    QDir dir = QLCFixtureDefCache::systemDefinitionDirectory();
    QVERIFY(dir.filter() & QDir::Files);
    QVERIFY(dir.nameFilters().contains(QString("*%1").arg(KExtFixture)));
    QVERIFY(dir.absolutePath().contains(FIXTUREDIR));

    dir = QLCFixtureDefCache::userDefinitionDirectory();
#ifndef SKIP_TEST
    QVERIFY(dir.exists() == true);
#endif
    QVERIFY(dir.filter() & QDir::Files);
    QVERIFY(dir.nameFilters().contains(QString("*%1").arg(KExtFixture)));
    QVERIFY(dir.absolutePath().contains(USERFIXTUREDIR));

}

QTEST_APPLESS_MAIN(QLCFixtureDefCache_Test)


text:
package ru.job4j.profession;

/**
 * Класс Учитель наследуется от Профессий.
 * @author - Egor K.
 * @since - 29.08.17
 */

public class Teacher extends Profession {
    /**
     * специализация учителей.
     */
    private String teacherSpecialization;

    /**
     * геттр специализаций.
     * @return специализацию.
     */
    public String getTeacherSpecialization() {
        return teacherSpecialization;
    }

    /**
     * сеттр специализаций.
     * @param teacherSpecialization специализацию.
     */
    public void setTeacherSpecialization(String teacherSpecialization) {
        this.teacherSpecialization = teacherSpecialization;
    }

    /**
     * Метод может ли учитель учить даннго ребенка.
     * @param person ученик.
     * @param colege ВУЗ
     * @return строку может или нет.
     */
    public String canTeachCildren(Person person, String colege) {
        if (person.getAge() < 16 && colege.equals("АГПУ")) {
            return "Учитель " + this.getName() + " может учить ребенка " + person.getName();
        } else if (person.getAge() > 16) {
            return "Ребенок " + person.getName() + " старше 16 лет";
        } else if (!colege.equals("АГПУ")) {
            return "Учитель " + this.getName() + " закончил " + colege + " а не АГПУ";
        } else {
            return "тут что-то не то";
        }

    }

    /**
     * Может ли учитель обучать математике.
     * @param colege ВУЗ
     * @param teacherSpecialization Специализация.
     * @return тру ор фолс.
     */

    public Boolean canTeachMathematics(String colege, String teacherSpecialization) {
       return colege.equals("АГПУ") && teacherSpecialization.equals("учитель математики") ? true : false;

    }
}


text:
package com.azure.resourcemanager.hybridcontainerservice.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hybridcontainerservice.models.OrchestratorProfile;
import org.junit.jupiter.api.Test;

public final class OrchestratorProfileTests {
    @Test
    public void testDeserialize() {
        OrchestratorProfile model =
            BinaryData
                .fromString(
                    "{\"isPreview\":true,\"orchestratorType\":\"ph\",\"orchestratorVersion\":\"pxodlqiyntorzih\"}")
                .toObject(OrchestratorProfile.class);
    }

    @Test
    public void testSerialize() {
        OrchestratorProfile model = new OrchestratorProfile();
        model = BinaryData.fromObject(model).toObject(OrchestratorProfile.class);
    }
}


text:
  The prediction module receives obstacles from the perception module with
  their basic perception information including positions, headings, velocities,
  accelerations, and generates predicted trajectories with probabilities for
  those obstacles.

## Input
  * Obstacles from the perception module
  * Localizaton from the localization module

## Output
  * Obstacles annotated with predicted trajectories

## Functionalities
  * Container

      Container stores input data from subscribed channels. Current supported
      inputs are **_perception obstacles_**, **_vehicle localization_** and **_vehicle planning_**.

  * Evaluator

      The Evaluator predicts path and speed separately for any given obstacle.
      An evaluator evaluates a path by outputing a probability for it (lane
      sequence) using the given model stored in _prediction/data/_.

      Three types of evaluators will be provided including:

      * Cost evaluator: probability is calculated by a set of cost functions

      * MLP evaluator: probability is calculated with an MLP model

      * RNN evaluator: probability is calculated with an RNN model

  * Predictor

      Predictor generates predicted trajectories for obstacles. Currently
      supported predictors include:

      * Empty: obstacles have no predicted trajectories
      * Single lane: Obstacles move along a single lane in highway navigation mode. Obstacles not on lane will be ignored.
      * Lane sequence: obstacle moves along the lanes
      * Move sequence: obstacle moves along the lanes by following its kinetic pattern
      * Free movement: obstacle moves freely
      * Regional movement: obstacle moves in a possible region


text:
<?php

namespace config\staticmanifest;

class NamespaceTest implements \TestOnly {
	static private $db = array(
		'Name' => 'Varchar',
		'Description' => 'Text',
	);
}


text:
package charge

import (
	"go-common/library/time"
)

// Archive archive detail
type Archive struct {
	ID        int64
	IncCharge int64
	TagID     int64
	Date      time.Time
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.scidef</groupId>
    <artifactId>betfair-horses</artifactId>
    <version>1.0-SNAPSHOT</version>

    <!-- Shared version number properties -->
    <properties>
        <cxf.version>2.7.2</cxf.version>
    </properties>

    <dependencies>

        <!-- Logging -->
        <dependency>
        	<groupId>org.slf4j</groupId>
        	<artifactId>slf4j-log4j12</artifactId>
        	<version>1.7.2</version>
        </dependency>

        <!-- AOP -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.7.1</version>
        </dependency>

        <!-- RSS reading -->
        <dependency>
        	<groupId>rome</groupId>
        	<artifactId>rome</artifactId>
        	<version>1.0</version>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.5</version>
        </dependency>

    </dependencies>

    <build>

        <plugins>

            <!-- This will generate all the Betfair POJOs from their WSDL -->
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>https://api.betfair.com/exchange/v5/BFExchangeService.wsdl</wsdl>
                                </wsdlOption>
                                <wsdlOption>
                                    <wsdl>https://api.betfair.com/global/v3/BFGlobalService.wsdl</wsdl>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>

</project>