text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jrt;

import java.util.concurrent.atomic.AtomicLong;
import java.util.function.ToLongFunction;

/**
 * Metric values produced by {@link Transport}.
 *
 * @author bjorncs
 */
public class TransportMetrics {

    private static final TransportMetrics instance = new TransportMetrics();

    private final AtomicLong tlsCertificateVerificationFailures = new AtomicLong(0);
    private final AtomicLong peerAuthorizationFailures = new AtomicLong(0);
    private final AtomicLong serverTlsConnectionsEstablished = new AtomicLong(0);
    private final AtomicLong clientTlsConnectionsEstablished = new AtomicLong(0);
    private final AtomicLong serverUnencryptedConnectionsEstablished = new AtomicLong(0);
    private final AtomicLong clientUnencryptedConnectionsEstablished = new AtomicLong(0);

    private TransportMetrics() {}

    public static TransportMetrics getInstance() { return instance; }

    public long tlsCertificateVerificationFailures() {
        return tlsCertificateVerificationFailures.get();
    }

    public long peerAuthorizationFailures() {
        return peerAuthorizationFailures.get();
    }

    public long serverTlsConnectionsEstablished() {
        return serverTlsConnectionsEstablished.get();
    }

    public long clientTlsConnectionsEstablished() {
        return clientTlsConnectionsEstablished.get();
    }

    public long serverUnencryptedConnectionsEstablished() {
        return serverUnencryptedConnectionsEstablished.get();
    }

    public long clientUnencryptedConnectionsEstablished() {
        return clientUnencryptedConnectionsEstablished.get();
    }

    public Snapshot snapshot() { return new Snapshot(this); }

    void incrementTlsCertificateVerificationFailures() {
        tlsCertificateVerificationFailures.incrementAndGet();
    }

    void incrementPeerAuthorizationFailures() {
        peerAuthorizationFailures.incrementAndGet();
    }

    void incrementServerTlsConnectionsEstablished() {
        serverTlsConnectionsEstablished.incrementAndGet();
    }

    void incrementClientTlsConnectionsEstablished() {
        clientTlsConnectionsEstablished.incrementAndGet();
    }

    void incrementServerUnencryptedConnectionsEstablished() {
        serverUnencryptedConnectionsEstablished.incrementAndGet();
    }

    void incrementClientUnencryptedConnectionsEstablished() {
        clientUnencryptedConnectionsEstablished.incrementAndGet();
    }

    @Override
    public String toString() {
        return "TransportMetrics{" +
                "tlsCertificateVerificationFailures=" + tlsCertificateVerificationFailures +
                ", peerAuthorizationFailures=" + peerAuthorizationFailures +
                ", serverTlsConnectionsEstablished=" + serverTlsConnectionsEstablished +
                ", clientTlsConnectionsEstablished=" + clientTlsConnectionsEstablished +
                ", serverUnencryptedConnectionsEstablished=" + serverUnencryptedConnectionsEstablished +
                ", clientUnencryptedConnectionsEstablished=" + clientUnencryptedConnectionsEstablished +
                '}';
    }

    public static class Snapshot {
        public static final Snapshot EMPTY = new Snapshot(0, 0, 0, 0, 0, 0);

        private final long tlsCertificateVerificationFailures;
        private final long peerAuthorizationFailures;
        private final long serverTlsConnectionsEstablished;
        private final long clientTlsConnectionsEstablished;
        private final long serverUnencryptedConnectionsEstablished;
        private final long clientUnencryptedConnectionsEstablished;

        private Snapshot(TransportMetrics metrics) {
            this(metrics.tlsCertificateVerificationFailures.get(),
                 metrics.peerAuthorizationFailures.get(),
                 metrics.serverTlsConnectionsEstablished.get(),
                 metrics.clientTlsConnectionsEstablished.get(),
                 metrics.serverUnencryptedConnectionsEstablished.get(),
                 metrics.clientUnencryptedConnectionsEstablished.get());
        }

        private Snapshot(long tlsCertificateVerificationFailures,
                        long peerAuthorizationFailures,
                        long serverTlsConnectionsEstablished,
                        long clientTlsConnectionsEstablished,
                        long serverUnencryptedConnectionsEstablished,
                        long clientUnencryptedConnectionsEstablished) {
            this.tlsCertificateVerificationFailures = tlsCertificateVerificationFailures;
            this.peerAuthorizationFailures = peerAuthorizationFailures;
            this.serverTlsConnectionsEstablished = serverTlsConnectionsEstablished;
            this.clientTlsConnectionsEstablished = clientTlsConnectionsEstablished;
            this.serverUnencryptedConnectionsEstablished = serverUnencryptedConnectionsEstablished;
            this.clientUnencryptedConnectionsEstablished = clientUnencryptedConnectionsEstablished;
        }

        public long tlsCertificateVerificationFailures() { return tlsCertificateVerificationFailures; }
        public long peerAuthorizationFailures() { return peerAuthorizationFailures; }
        public long serverTlsConnectionsEstablished() { return serverTlsConnectionsEstablished; }
        public long clientTlsConnectionsEstablished() { return clientTlsConnectionsEstablished; }
        public long serverUnencryptedConnectionsEstablished() { return serverUnencryptedConnectionsEstablished; }
        public long clientUnencryptedConnectionsEstablished() { return clientUnencryptedConnectionsEstablished; }

        public Snapshot changesSince(Snapshot base) {
            return new Snapshot(
                changesSince(base, Snapshot::tlsCertificateVerificationFailures),
                changesSince(base, Snapshot::peerAuthorizationFailures),
                changesSince(base, Snapshot::serverTlsConnectionsEstablished),
                changesSince(base, Snapshot::clientTlsConnectionsEstablished),
                changesSince(base, Snapshot::serverUnencryptedConnectionsEstablished),
                changesSince(base, Snapshot::clientUnencryptedConnectionsEstablished));
        }

        private long changesSince(Snapshot base, ToLongFunction<Snapshot> metricProperty) {
            return metricProperty.applyAsLong(this) - metricProperty.applyAsLong(base);
        }

        @Override
        public String toString() {
            return "Snapshot{" +
                    "tlsCertificateVerificationFailures=" + tlsCertificateVerificationFailures +
                    ", peerAuthorizationFailures=" + peerAuthorizationFailures +
                    ", serverTlsConnectionsEstablished=" + serverTlsConnectionsEstablished +
                    ", clientTlsConnectionsEstablished=" + clientTlsConnectionsEstablished +
                    ", serverUnencryptedConnectionsEstablished=" + serverUnencryptedConnectionsEstablished +
                    ", clientUnencryptedConnectionsEstablished=" + clientUnencryptedConnectionsEstablished +
                    '}';
        }
    }
}


text:
package controllers

import play.api.mvc._
import play.api.libs.concurrent.Execution.Implicits._
import scala.concurrent.Future

/**
 *
 * @author ponkotuy
 * Date: 14/02/25
 */
object Common extends Controller {
  type Req = Map[String, Seq[String]]

  def reqHead(request: Req)(key: String): Option[String] = {
    for {
      results <- request.get(key)
      one <- results.headOption
    } yield one
  }

  def returnString[A](f: => A) = actionAsync { Ok(f.toString) }

  def actionAsync(f: => Result) = Action.async { request =>
    Future {
      try {
        f
      } catch {
        case e: IllegalArgumentException => BadRequest(e.getMessage)
      }
    }
  }

  def actionAsync(f: (Request[AnyContent]) => Result) = Action.async { request =>
    Future {
      try {
        f(request)
      } catch {
        case e: IllegalArgumentException => BadRequest(e.getMessage)
      }
    }
  }

  def formAsync(f: Request[Map[String, Seq[String]]] => Result) = Action.async(parse.urlFormEncoded) { request =>
    Future {
      try {
        f(request)
      } catch {
        case e: IllegalArgumentException => BadRequest(e.getMessage)
      }
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
import angular from 'angular';
import firebase from 'firebase';
import uiRouter from 'angular-ui-router';
import userComponent from './user.component';
import userService from './user.service';

window['firebase'] = firebase;

let userModule = angular.module('user', [
  uiRouter
])

.component('user', userComponent)

.service('userService', userService)

.name;

export default userModule;


text:
package net.acira.bexprp.visitors

import net.acira.bexprp.core._

trait Visitor[R] {

	def visit(expression: Expression): Visitor[R] = expression match {
		case e: Not => {
			visitUnary(e)
			visitNot(e)
		}
		case e: And => {
			visitBinary(e)
			visitAnd(e)
		}
		case e: Or => {
			visitBinary(e)
			visitOr(e)
		}
		case e: Implication => {
			visitBinary(e)
			visitImplication(e)
		}
		case e: LeftImplication => {
			visitBinary(e)
			visitLeftImplication(e)
		}
		case e: Equivalence => {
			visitBinary(e)
			visitEquivalence(e)
		}
		case e: Constant => {
			visitLiteral(e)
			visitConstant(e)
		}
		case e: FreeVariable => {
			visitLiteral(e)
			visitVariable(e)
			visitFreeVariable(e)
		}
		case e: BoundVariable => {
			visitLiteral(e)
			visitVariable(e)
			visitBoundVariable(e)
		}
	}

	def visitUnary(expression: UnaryOperation) = this
	def visitNot(expression: Not) = this
	def visitBinary(expression: BinaryOperation) = this
	def visitAnd(expression: And) = this
	def visitOr(expression: Or) = this
	def visitImplication(expression: Implication) = this
	def visitLeftImplication(expression: LeftImplication) = this
	def visitEquivalence(expression: Equivalence) = this
	def visitLiteral(expression: Literal) = this
	def visitVariable(expression: Variable) = this
	def visitFreeVariable(expression: FreeVariable) = this
	def visitBoundVariable(expression: BoundVariable) = this
	def visitConstant(expression: Constant) = this

	def result: R

}

trait TraversingVisitor[R] {

	protected def defaultUnaryOperation: (UnaryOperation => R) = ???
	protected def defaultBinaryOperation: (BinaryOperation => R) = ???
	protected def defaultLiteralOperation: (Literal => R) = ???

	def visit(expression: Expression): R = expression match {
		case e: Not => visitNot(e)
		case e: And => visitAnd(e)
		case e: Or => visitOr(e)
		case e: Implication => visitImplication(e)
		case e: LeftImplication => visitLeftImplication(e)
		case e: Equivalence => visitEquivalence(e)
		case e: FreeVariable => visitFreeVariable(e)
		case e: BoundVariable => visitBoundVariable(e)
		case e: Constant => visitConstant(e)
	}

	def visitNot(expression: Not): R = defaultUnaryOperation(expression)
	def visitAnd(expression: And): R = defaultBinaryOperation(expression)
	def visitOr(expression: Or): R = defaultBinaryOperation(expression)
	def visitImplication(expression: Implication): R = defaultBinaryOperation(expression)
	def visitLeftImplication(expression: LeftImplication): R = defaultBinaryOperation(expression)
	def visitEquivalence(expression: Equivalence): R = defaultBinaryOperation(expression)
	def visitFreeVariable(expression: FreeVariable): R = defaultLiteralOperation(expression)
	def visitBoundVariable(expression: BoundVariable): R = defaultLiteralOperation(expression)
	def visitConstant(expression: Constant): R = defaultLiteralOperation(expression)

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Class edu.wpi.first.wpilibj.communication.ModulePresence.ModuleType (2013 FRC Java API)
</TITLE>

<META NAME="date" CONTENT="2014-01-01">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

"
2013 FRC Java API
"

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
edu.wpi.first.wpilibj.communication.ModulePresence.ModuleType

Packages that use ModulePresence.ModuleType

edu.wpi.first.wpilibj
The WPI Robotics library (WPILibJ) is a set of Java classes that interfaces to the hardware in the FRC
control system and your robot.

edu.wpi.first.wpilibj.communication
Provides classes for communicating with the driver station and synchronizing with C/C++ code.

Uses of ModulePresence.ModuleType in edu.wpi.first.wpilibj

Fields in edu.wpi.first.wpilibj declared as ModulePresence.ModuleType

protected  ModulePresence.ModuleType
Module.m_moduleType

Methods in edu.wpi.first.wpilibj that return ModulePresence.ModuleType

 ModulePresence.ModuleType
Module.getModuleType()

          Gets the module type associated with a module.

Methods in edu.wpi.first.wpilibj with parameters of type ModulePresence.ModuleType

static Module
Module.getModule(ModulePresence.ModuleType moduleType,
          int moduleNumber)

          Static module singleton factory.

Constructors in edu.wpi.first.wpilibj with parameters of type ModulePresence.ModuleType

Module(ModulePresence.ModuleType moduleType,
       int moduleNumber)

          Constructor.

Uses of ModulePresence.ModuleType in edu.wpi.first.wpilibj.communication

Fields in edu.wpi.first.wpilibj.communication declared as ModulePresence.ModuleType

static ModulePresence.ModuleType
ModulePresence.ModuleType.kAnalog

static ModulePresence.ModuleType
ModulePresence.ModuleType.kDigital

static ModulePresence.ModuleType
ModulePresence.ModuleType.kSolenoid

static ModulePresence.ModuleType
ModulePresence.ModuleType.kUnknown

Methods in edu.wpi.first.wpilibj.communication with parameters of type ModulePresence.ModuleType

static boolean
ModulePresence.getModulePresence(ModulePresence.ModuleType moduleType,
                  int moduleNumber)

          Determines whether the module of the given type and number is present.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

"
2013 FRC Java API
"

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

"For updated information see the Java FRC site"


text: oneself = require('..');


text:
namespace llvm {

  template <class T>
  class IntrusiveRefCntPtr;

//===----------------------------------------------------------------------===//
/// RefCountedBase - A generic base class for objects that wish to
///  have their lifetimes managed using reference counts. Classes
///  subclass RefCountedBase to obtain such functionality, and are
///  typically handled with IntrusivePtr "smart pointers" (see below)
///  which automatically handle the management of reference counts.
///  Objects that subclass RefCountedBase should not be allocated on
///  the stack, as invoking "delete" (which is called when the
///  reference count hits 0) on such objects is an error.
//===----------------------------------------------------------------------===//
  template <class Derived>
  class RefCountedBase {
    mutable unsigned ref_cnt;

  public:
    RefCountedBase() : ref_cnt(0) {}
    RefCountedBase(const RefCountedBase &) : ref_cnt(0) {}

    void Retain() const { ++ref_cnt; }
    void Release() const {
      assert (ref_cnt > 0 && "Reference count is already zero.");
      if (--ref_cnt == 0) delete static_cast<const Derived*>(this);
    }
  };

//===----------------------------------------------------------------------===//
/// RefCountedBaseVPTR - A class that has the same function as
///  RefCountedBase, but with a virtual destructor. Should be used
///  instead of RefCountedBase for classes that already have virtual
///  methods to enforce dynamic allocation via 'new'. Classes that
///  inherit from RefCountedBaseVPTR can't be allocated on stack -
///  attempting to do this will produce a compile error.
//===----------------------------------------------------------------------===//
  class RefCountedBaseVPTR {
    mutable unsigned ref_cnt;
    virtual void anchor();

  protected:
    RefCountedBaseVPTR() : ref_cnt(0) {}
    RefCountedBaseVPTR(const RefCountedBaseVPTR &) : ref_cnt(0) {}

    virtual ~RefCountedBaseVPTR() {}

    void Retain() const { ++ref_cnt; }
    void Release() const {
      assert (ref_cnt > 0 && "Reference count is already zero.");
      if (--ref_cnt == 0) delete this;
    }

    template <typename T>
    friend struct IntrusiveRefCntPtrInfo;
  };

  template <typename T> struct IntrusiveRefCntPtrInfo {
    static void retain(T *obj) { obj->Retain(); }
    static void release(T *obj) { obj->Release(); }
  };

//===----------------------------------------------------------------------===//
/// IntrusiveRefCntPtr - A template class that implements a "smart pointer"
///  that assumes the wrapped object has a reference count associated
///  with it that can be managed via calls to
///  IntrusivePtrAddRef/IntrusivePtrRelease.  The smart pointers
///  manage reference counts via the RAII idiom: upon creation of
///  smart pointer the reference count of the wrapped object is
///  incremented and upon destruction of the smart pointer the
///  reference count is decremented.  This class also safely handles
///  wrapping NULL pointers.
///
/// Reference counting is implemented via calls to
///  Obj->Retain()/Obj->Release(). Release() is required to destroy
///  the object when the reference count reaches zero. Inheriting from
///  RefCountedBase/RefCountedBaseVPTR takes care of this
///  automatically.
//===----------------------------------------------------------------------===//
  template <typename T>
  class IntrusiveRefCntPtr {
    T* Obj;
    typedef IntrusiveRefCntPtr this_type;
  public:
    typedef T element_type;

    explicit IntrusiveRefCntPtr() : Obj(0) {}

    IntrusiveRefCntPtr(T* obj) : Obj(obj) {
      retain();
    }

    IntrusiveRefCntPtr(const IntrusiveRefCntPtr& S) : Obj(S.Obj) {
      retain();
    }

    template <class X>
    IntrusiveRefCntPtr(const IntrusiveRefCntPtr<X>& S)
      : Obj(S.getPtr()) {
      retain();
    }

    IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr& S) {
      replace(S.getPtr());
      return *this;
    }

    template <class X>
    IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr<X>& S) {
      replace(S.getPtr());
      return *this;
    }

    IntrusiveRefCntPtr& operator=(T * S) {
      replace(S);
      return *this;
    }

    ~IntrusiveRefCntPtr() { release(); }

    T& operator*() const { return *Obj; }

    T* operator->() const { return Obj; }

    T* getPtr() const { return Obj; }

    typedef T* (IntrusiveRefCntPtr::*unspecified_bool_type) () const;
    operator unspecified_bool_type() const {
      return Obj == 0 ? 0 : &IntrusiveRefCntPtr::getPtr;
    }

    void swap(IntrusiveRefCntPtr& other) {
      T* tmp = other.Obj;
      other.Obj = Obj;
      Obj = tmp;
    }

    void reset() {
      release();
      Obj = 0;
    }

    void resetWithoutRelease() {
      Obj = 0;
    }

  private:
    void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
    void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }

    void replace(T* S) {
      this_type(S).swap(*this);
    }
  };

  template<class T, class U>
  inline bool operator==(const IntrusiveRefCntPtr<T>& A,
                         const IntrusiveRefCntPtr<U>& B)
  {
    return A.getPtr() == B.getPtr();
  }

  template<class T, class U>
  inline bool operator!=(const IntrusiveRefCntPtr<T>& A,
                         const IntrusiveRefCntPtr<U>& B)
  {
    return A.getPtr() != B.getPtr();
  }

  template<class T, class U>
  inline bool operator==(const IntrusiveRefCntPtr<T>& A,
                         U* B)
  {
    return A.getPtr() == B;
  }

  template<class T, class U>
  inline bool operator!=(const IntrusiveRefCntPtr<T>& A,
                         U* B)
  {
    return A.getPtr() != B;
  }

  template<class T, class U>
  inline bool operator==(T* A,
                         const IntrusiveRefCntPtr<U>& B)
  {
    return A == B.getPtr();
  }

  template<class T, class U>
  inline bool operator!=(T* A,
                         const IntrusiveRefCntPtr<U>& B)
  {
    return A != B.getPtr();
  }

//===----------------------------------------------------------------------===//
// LLVM-style downcasting support for IntrusiveRefCntPtr objects
//===----------------------------------------------------------------------===//

  template<class T> struct simplify_type<IntrusiveRefCntPtr<T> > {
    typedef T* SimpleType;
    static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr<T>& Val) {
      return Val.getPtr();
    }
  };

  template<class T> struct simplify_type<const IntrusiveRefCntPtr<T> > {
    typedef T* SimpleType;
    static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr<T>& Val) {
      return Val.getPtr();
    }
  };

} // end namespace llvm

#endif // LLVM_ADT_INTRUSIVE_REF_CNT_PTR


text:
{-# LANGUAGE QuasiQuotes, ScopedTypeVariables, OverloadedStrings #-}
module PostgREST.Auth where

import Data.Aeson
import Control.Monad (mzero)
import Control.Applicative
import Crypto.BCrypt
import Data.Text
import Data.Monoid
import Data.Map
import qualified Data.Vector as V
import qualified Hasql as H
import qualified Hasql.Backend as B
import qualified Hasql.Postgres as P
import qualified Web.JWT as JWT
import Data.String.Conversions (cs)
import PostgREST.PgQuery (pgFmtLit)

import Prelude

import System.IO.Unsafe

data AuthUser = AuthUser {
    userId :: String
  , userPass :: String
  , userRole :: Maybe String
  } deriving (Show)

instance FromJSON AuthUser where
  parseJSON (Object v) = AuthUser <$>
                         v .: "id" <*>
                         v .: "pass" <*>
                         v .:? "role"
  parseJSON _ = mzero

instance ToJSON AuthUser where
  toJSON u = object [
      "id" .= userId u
    , "pass" .= userPass u
    , "role" .= userRole u ]

type DbRole = Text
type UserId = Text

data LoginAttempt =
    NoCredentials
  | MalformedAuth
  | LoginFailed
  | LoginSuccess DbRole UserId
  deriving (Eq, Show)

checkPass :: Text -> Text -> Bool
checkPass = (. cs) . validatePassword . cs

setRole :: Text -> H.Tx P.Postgres s ()
setRole role = H.unitEx $ B.Stmt ("set local role " <> cs (pgFmtLit role)) V.empty True

setUserId :: Text -> H.Tx P.Postgres s ()
setUserId uid =
  if uid /= ""
    then H.unitEx $ B.Stmt ("set local user_vars.user_id = " <> cs (pgFmtLit uid)) V.empty True
    else resetUserId

resetUserId :: H.Tx P.Postgres s ()
resetUserId = H.unitEx [H.stmt|reset user_vars.user_id|]

addUser :: Text -> Text -> Maybe Text -> H.Tx P.Postgres s ()
addUser identity pass role = do
  let Just hashed = unsafePerformIO $ hashPasswordUsingPolicy fastBcryptHashingPolicy (cs pass)
  H.unitEx $
    [H.stmt|insert into postgrest.auth (id, pass, rolname) values (?, ?, ?)|]
      identity (cs hashed :: Text) role

signInRole :: Text -> Text -> H.Tx P.Postgres s LoginAttempt
signInRole user pass = do
  u <- H.maybeEx $ [H.stmt|select id, pass, rolname from postgrest.auth where id = ?|] user
  return $ maybe LoginFailed (\r ->
      let (uid, hashed, role) = r in
      if checkPass hashed pass
         then LoginSuccess role uid
         else LoginFailed
    ) u

signInWithJWT :: Text -> Text -> LoginAttempt
signInWithJWT secret input = case maybeRole of
    Just (Just (String role)) -> case maybeUserId of
      Just (Just (String uid)) -> LoginSuccess (cs role) (cs uid)
      _   -> LoginFailed
    _   -> LoginFailed
  where
    maybeRole = (Data.Map.lookup "role" <$> claims) ::Maybe (Maybe Value)
    maybeUserId = (Data.Map.lookup "id" <$> claims) ::Maybe (Maybe Value)
    claims = JWT.unregisteredClaims <$> JWT.claims <$> decoded
    decoded = JWT.decodeAndVerifySignature (JWT.secret secret) input

tokenJWT :: Text -> Text -> Text -> Text
tokenJWT secret uid role = JWT.encodeSigned JWT.HS256 (JWT.secret secret) claimsSet
  where
    claimsSet = JWT.def {
      JWT.unregisteredClaims = Data.Map.fromList [("id", String uid), ("role", String role)]
    }


text:
<script type="text/javascript">
/* <![CDATA[ */
if (pollperiod != ${pollperiod}) {
	pollperiod = ${pollperiod};
	##if (!window.ActiveXObject) console.log("new pollinterval:"+pollperiod);
}
/* ]]> */
</script>


text:
package org.apache.batik.anim.values;

import java.util.Arrays;

import org.apache.batik.anim.dom.AnimationTarget;

/**
 * An SVG path value in the animation system.
 *
 * @author Cameron McCormack
 * @version $Id$
 */
public class AnimatablePathDataValue extends AnimatableValue {

    /**
     * The path commands.  These must be one of the PATHSEG_*
     * constants defined in {@link org.w3c.dom.svg.SVGPathSeg}.
     */
    protected short[] commands;

    /**
     * The path parameters.  Also includes the booleans.
     */
    protected float[] parameters;

    /**
     * Creates a new, uninitialized AnimatablePathDataValue.
     */
    protected AnimatablePathDataValue(AnimationTarget target) {
        super(target);
    }

    /**
     * Creates a new AnimatablePathDataValue.
     */
    public AnimatablePathDataValue(AnimationTarget target, short[] commands,
                                   float[] parameters) {
        super(target);
        this.commands = commands;
        this.parameters = parameters;
    }

    /**
     * Performs interpolation to the given value.
     */
    public AnimatableValue interpolate(AnimatableValue result,
                                       AnimatableValue to, float interpolation,
                                       AnimatableValue accumulation,
                                       int multiplier) {
        AnimatablePathDataValue toValue = (AnimatablePathDataValue) to;
        AnimatablePathDataValue accValue =
            (AnimatablePathDataValue) accumulation;

        boolean hasTo = to != null;
        boolean hasAcc = accumulation != null;
        boolean canInterpolate = hasTo
            && toValue.parameters.length == parameters.length
            && Arrays.equals(toValue.commands, commands);
        boolean canAccumulate = hasAcc
            && accValue.parameters.length == parameters.length
            && Arrays.equals(accValue.commands, commands);

        AnimatablePathDataValue base;
        if (!canInterpolate && hasTo && interpolation >= 0.5) {
            base = toValue;
        } else {
            base = this;
        }
        int cmdCount = base.commands.length;
        int paramCount = base.parameters.length;

        AnimatablePathDataValue res;
        if (result == null) {
            res = new AnimatablePathDataValue(target);
            res.commands = new short[cmdCount];
            res.parameters = new float[paramCount];
            System.arraycopy(base.commands, 0, res.commands, 0, cmdCount);
        } else {
            res = (AnimatablePathDataValue) result;
            if (res.commands == null || res.commands.length != cmdCount) {
                res.commands = new short[cmdCount];
                System.arraycopy(base.commands, 0, res.commands, 0, cmdCount);
                res.hasChanged = true;
            } else {
                if (!Arrays.equals(base.commands, res.commands)) {
                    System.arraycopy(base.commands, 0, res.commands, 0,
                                     cmdCount);
                    res.hasChanged = true;
                }
            }
        }

        for (int i = 0; i < paramCount; i++) {
            float newValue = base.parameters[i];
            if (canInterpolate) {
                newValue += interpolation * (toValue.parameters[i] - newValue);
            }
            if (canAccumulate) {
                newValue += multiplier * accValue.parameters[i];
            }
            if (res.parameters[i] != newValue) {
                res.parameters[i] = newValue;
                res.hasChanged = true;
            }
        }

        return res;
    }

    /**
     * Returns the array of path data commands.
     */
    public short[] getCommands() {
        return commands;
    }

    /**
     * Returns the array of path data parameters.
     */
    public float[] getParameters() {
        return parameters;
    }

    /**
     * Returns whether two values of this type can have their distance
     * computed, as needed by paced animation.
     */
    public boolean canPace() {
        return false;
    }

    /**
     * Returns the absolute distance between this value and the specified other
     * value.
     */
    public float distanceTo(AnimatableValue other) {
        return 0f;
    }

    /**
     * Returns a zero value of this AnimatableValue's type.
     */
    public AnimatableValue getZeroValue() {
        short[] cmds = new short[commands.length];
        System.arraycopy(commands, 0, cmds, 0, commands.length);
        float[] params = new float[parameters.length];
        return new AnimatablePathDataValue(target, cmds, params);
    }

    /**
     * The path data commands.
     */
    protected static final char[] PATH_COMMANDS = {
        ' ', 'z', 'M', 'm', 'L', 'l', 'C', 'c', 'Q', 'q', 'A', 'a', 'H', 'h',
        'V', 'v', 'S', 's', 'T', 't'
    };

    /**
     * The number of parameters for each path command.
     */
    protected static final int[] PATH_PARAMS = {
        0, 0, 2, 2, 2, 2, 6, 6, 4, 4, 7, 7, 1, 1, 1, 1, 4, 4, 2, 2
    };

    /**
     * Returns a string representation of this object.
     */
    public String toStringRep() {
        StringBuffer sb = new StringBuffer();
        int k = 0;
        for (short command : commands) {
            sb.append(PATH_COMMANDS[command]);
            for (int j = 0; j < PATH_PARAMS[command]; j++) {
                sb.append(' ');
                sb.append(parameters[k++]);
            }
        }
        return sb.toString();
    }
}


text:
/**
 * Setup the sidebar DOM element to be affixed to the top of the viewport
 * using Bootstrap's affix plugin.
 *
 * @param {DOMElement} element
 * @param {Boolean} isInitialized
 */
export default function affixSidebar(element, isInitialized) {
  if (isInitialized) return;

  const $sidebar = $(element);
  const $header = $('#header');
  const $footer = $('#footer');

  // Don't affix the sidebar if it is taller than the viewport (otherwise
  // there would be no way to scroll through its content).
  if ($sidebar.outerHeight(true) > $(window).height() - $header.outerHeight(true)) return;

  $sidebar.find('> ul').affix({
    offset: {
      top: () => $sidebar.offset().top - $header.outerHeight(true) - parseInt($sidebar.css('margin-top'), 10),
      bottom: () => this.bottom = $footer.outerHeight(true)
    }
  });
}


text:
<?php

namespace Unisharp\Unifly\Console\Commands;

class TestMakeCommand extends UsGeneratorCommand
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'make:us-test {name} {entity_name} {--for=backend}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description.';
    protected $type = 'Test';

    public function getStub()
    {
        return __DIR__ . '/stubs/test/testRepo.stub';
    }

    protected function getDefaultNamespace($rootNamespace)
    {
        return $rootNamespace . '\..\test\php\Repository';
    }
}


text:
package org.breizhcamp.video.uploader.services;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.breizhcamp.video.uploader.CamaalothUploaderProps;
import org.breizhcamp.video.uploader.dto.Event;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;

import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toMap;

@Service
public class EventSrv {

	@Autowired
	private ObjectMapper mapper;

	@Autowired
	private CamaalothUploaderProps props;

	/**
	 * List all events in schedule
	 * @return Event list
	 */
	public List<Event> list() throws IOException {
		return mapper.readValue(Paths.get(props.getAssetsDir(), "schedule.json").toFile(), new TypeReference<List<Event>>(){});
	}

	/**
	 * Retrieve all events group by id
	 * @return Event list
	 */
	public Map<Integer, Event> listById() throws IOException {
		return list().stream()
				.collect(toMap(Event::getId, identity()));
	}

	/**
	 * Retrieve an event with his id
	 * @param id Id of the event to retrieve
	 * @return Event
	 * @throws IOException If we cannot read schedule json file
	 * @throws FileNotFoundException If the event is not found in schedule
	 */
	public Event getFromId(Integer id) throws IOException {
		return list().stream()
				.filter(e -> e.getId().equals(id))
				.findFirst()
				.orElseThrow(() -> new FileNotFoundException("Event [" + id + "] not found in schedule"));
	}
}


text:
namespace client {

// Represents a singleton hidden window that acts at temporary parent for
// popup browsers.
class TempWindowMac {
 public:
  // Returns the singleton window handle.
  static CefWindowHandle GetWindowHandle();

 private:
  // A single instance will be created/owned by RootWindowManager.
  friend class RootWindowManager;

  TempWindowMac();
  ~TempWindowMac();

  NSWindow* window_;

  DISALLOW_COPY_AND_ASSIGN(TempWindowMac);
};

}  // namespace client

#endif  // CEF_TESTS_CEFCLIENT_BROWSER_TEMP_WINDOW_MAC_H_