text:
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/${CI_BRANCH}/k8s/openebs-operator.yaml

function waitForDeployment() {
  DEPLOY=$1
  NS=$2

  for i in $(seq 1 50) ; do
    kubectl get deployment -n ${NS} ${DEPLOY}
    replicas=$(kubectl get deployment -n ${NS} ${DEPLOY} -o json | jq ".status.readyReplicas")
    if [ "$replicas" == "1" ]; then
      break
    else
      echo "Waiting for ${DEPLOY} to be ready"
      if [ ${DEPLOY} != "maya-apiserver" ] && [ ${DEPLOY} != "openebs-provisioner" ]; then
        dumpMayaAPIServerLogs 10
      fi
      sleep 10
    fi
  done
}

function checkApi() {
    printf "\n"
    echo $1
    printf "\n"
    for i in `seq 1 100`; do
        sleep 2
        responseCode=$($1)
        echo "Response Code from ApiServer: $responseCode"
        if [ $responseCode -ne 200 ]; then
            echo "Retrying.... $i"
            printf "Logs of api-server: \n\n"
            kubectl logs --tail=20 $MAPIPOD -n openebs
            printf "\n\n"
        else
            break
        fi
    done
}

function dumpMayaAPIServerLogs() {
  LC=$1
  MAPIPOD=$(kubectl get pods -o jsonpath='{.items[?(@.spec.containers[0].name=="maya-apiserver")].metadata.name}' -n openebs)
  kubectl logs --tail=${LC} $MAPIPOD -n openebs
  printf "\n\n"
}

waitForDeployment maya-apiserver openebs
waitForDeployment openebs-provisioner openebs
waitForDeployment openebs-ndm-operator openebs
dumpMayaAPIServerLogs 200

kubectl get pods --all-namespaces

#Print the default cstor pools Created
kubectl get csp

#Print the default StoragePoolClaim Created
kubectl get spc

#Print the default StorageClasses Created
kubectl get sc

sleep 10
#echo "------------------ Deploy Pre-release features ---------------------------"
#kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-pre-release-features.yaml

echo "------------------------ Create block device sparse storagepoolclaim --------------- "
# delete the storagepoolclaim created earlier and create new spc with min/max pool
# count 1
kubectl delete spc --all
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/sample-pv-yamls/spc-sparse-single.yaml
sleep 10

echo "--------------- Maya apiserver later logs -----------------------------"
dumpMayaAPIServerLogs 200

echo "--------------- Create Cstor and Jiva PersistentVolume ------------------"
#kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/sample-pv-yamls/pvc-jiva-sc-1r.yaml
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/demo/pvc-single-replica-jiva.yaml
sleep 10
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/sample-pv-yamls/pvc-sparse-claim-cstor.yaml

sleep 30
echo "--------------------- List SC,PVC,PV and pods ---------------------------"
kubectl get sc,pvc,pv
kubectl get pods --all-namespaces

kubectl get deploy -l openebs.io/controller=jiva-controller
JIVACTRL=$(kubectl get deploy -l openebs.io/controller=jiva-controller --no-headers | awk {'print $1'})
waitForDeployment ${JIVACTRL} default

kubectl get deploy -l openebs.io/replica=jiva-replica
JIVAREP=$(kubectl get deploy -l openebs.io/replica=jiva-replica --no-headers | awk {'print $1'})
waitForDeployment ${JIVAREP} default

kubectl get deploy -n openebs -l openebs.io/target=cstor-target
CSTORTARGET=$(kubectl get deploy -n openebs -l openebs.io/target=cstor-target --no-headers | awk {'print $1'})
waitForDeployment ${CSTORTARGET} openebs

echo "---------------Testing deployment in pvc namespace---------------"
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/volume/cstor/service-account.yaml

kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/volume/cstor/sc_app_ns.yaml

echo "---------------Creating in pvc---------------"
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/volume/cstor/pvc_app_ns.yaml

sleep 10

kubectl get deploy -n openebs -l openebs.io/target=cstor-target
kubectl get cstorvolume
kubectl get service

## To fix intermittent travis failure
sleep 20
CSTORTARGET=$(kubectl get deploy -l openebs.io/persistent-volume-claim=openebs-pvc-in-custom-ns --no-headers | awk {'print $1'})
echo $CSTORTARGET
waitForDeployment ${CSTORTARGET} default

MAPI_SVC_ADDR=`kubectl get service -n openebs maya-apiserver-service -o json | grep clusterIP | awk -F\" '{print $4}'`
export MAPI_ADDR="http://${MAPI_SVC_ADDR}:5656"
export KUBERNETES_SERVICE_HOST="127.0.0.1"
export KUBECONFIG=$HOME/.kube/config

export MAPIPOD=$(kubectl get pods -o jsonpath='{.items[?(@.spec.containers[0].name=="maya-apiserver")].metadata.name}' -n openebs)
export CSTORVOL=$(kubectl get pv -o jsonpath='{.items[?(@.spec.claimRef.name=="cstor-vol1-1r-claim")].metadata.name}')
export CSTORVOLNS=$(kubectl get pv -o jsonpath='{.items[?(@.spec.claimRef.name=="openebs-pvc-in-custom-ns")].metadata.name}')
export JIVAVOL=$(kubectl get pv -o jsonpath='{.items[?(@.metadata.annotations.openebs\.io/cas-type=="jiva")].metadata.name}')
export POOLNAME=$(kubectl get csp -o jsonpath='{.items[?(@.metadata.labels.openebs\.io/storage-pool-claim=="sparse-claim-auto")].metadata.name}')

echo "------------------Extracted Pod names---------------------"
echo MAPIPOD: $MAPIPOD
echo CSTORVOL: $CSTORVOL
echo CSTORVOLNS: $CSTORVOLNS
echo JIVAVOL: $JIVAVOL

echo "++++++++++++++++ Waiting for MAYA API's to get ready ++++++++++++++++++++++"

printf "\n\n"
echo "---------------- Checking Volume list API -------------------"

checkApi "curl -X GET --write-out %{http_code} --silent --output /dev/null $MAPI_ADDR/latest/volumes/"

printf "\n\n"

echo "---------------- Checking Volume API for jiva volume -------------------"

checkApi "curl -X GET --write-out %{http_code} --silent --output /dev/null $MAPI_ADDR/latest/volumes/$JIVAVOL -H namespace:default"

printf "\n\n"

echo "---------------- Checking Volume API for cstor volume -------------------"

checkApi "curl -X GET --write-out %{http_code} --silent --output /dev/null $MAPI_ADDR/latest/volumes/$CSTORVOL -H namespace:openebs"

printf "\n\n"

echo "------------ Checking Volume STATS API for cstor volume -----------------"

checkApi "curl -X GET --write-out %{http_code} --silent --output /dev/null $MAPI_ADDR/latest/volumes/stats/$CSTORVOL -H namespace:openebs"

printf "\n\n"

echo "------------ Checking Volume STATS API for jiva volume -----------------"

checkApi "curl -X GET --write-out %{http_code} --silent --output /dev/null $MAPI_ADDR/latest/volumes/stats/$JIVAVOL -H namespace:default"

printf "\n\n"

echo "+++++++++++++++++++++ MAYA API's are ready ++++++++++++++++++++++++++++++++"

printf "\n\n"

echo "************** Snapshot and Clone related tests***************************"
# Create jiva volume for snapshot clone test ( cstor volume already exists)
#kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/demo/pvc-single-replica-jiva.yaml

kubectl get pods --all-namespaces
kubectl get sc

sleep 30

echo "******************* Describe disks **************************"
kubectl describe disks

echo "******************* Describe spc,sp,csp **************************"
kubectl describe spc,sp,csp

echo "******************* List all pods **************************"
kubectl get po --all-namespaces

echo "******************* List PVC,PV and pods **************************"
kubectl get pvc,pv

# Create the application
echo "Creating busybox-jiva and busybox-cstor application pod"
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/jiva/busybox.yaml
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/busybox.yaml
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/busybox_ns.yaml

for i in $(seq 1 100) ; do
    phaseJiva=$(kubectl get pods busybox-jiva --output="jsonpath={.status.phase}")
    phaseCstor=$(kubectl get pods busybox-cstor --output="jsonpath={.status.phase}")
    phaseCstorNs=$(kubectl get pods busybox-cstor-ns --output="jsonpath={.status.phase}")
    if [ "$phaseJiva" == "Running" ] && [ "$phaseCstor" == "Running" ] && [ "$phaseCstorNs" == "Running" ]; then
        break
	else
        echo "busybox-jiva pod is in:" $phaseJiva
        echo "busybox-cstor pod is in:" $phaseCstor
        echo "busybox-cstor-ns pod is in:" $phaseCstorNs

        if [ "$phaseJiva" != "Running" ]; then
           kubectl describe pods busybox-jiva
        fi
        if [ "$phaseCstor" != "Running" ]; then
           kubectl describe pods busybox-cstor
        fi
        if [ "$phaseCstorNs" != "Running" ]; then
           kubectl describe pods busybox-cstor-ns
        fi
        sleep 10
    fi
done

dumpMayaAPIServerLogs 100

echo "********************Creating volume snapshot*****************************"
kubectl create -f  https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/jiva/snapshot.yaml
kubectl create -f  https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/snapshot.yaml
kubectl create -f  https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/snapshot_ns.yaml
kubectl logs --tail=20 -n openebs deployment/openebs-snapshot-operator -c snapshot-controller

# It might take some time for cstor snapshot to get created. Wait for snapshot to get created
for i in $(seq 1 100) ; do
    kubectl get volumesnapshotdata
    count=$(kubectl get volumesnapshotdata | wc -l)
    # count should be 3 as one header line would also be present
    if [ "$count" == "4" ]; then
        break
    else
        echo "snapshot/(s) not created yet"
        kubectl get volumesnapshot,volumesnapshotdata
        sleep 10
    fi
done

kubectl logs --tail=20 -n openebs deployment/openebs-snapshot-operator -c snapshot-controller

# Promote/restore snapshot as persistent volume
sleep 30
echo "*****************Promoting snapshot as new PVC***************************"
kubectl create -f  https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/jiva/snapshot_claim.yaml
kubectl logs --tail=20 -n openebs deployment/openebs-snapshot-operator -c snapshot-provisioner
kubectl create -f  https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/snapshot_claim.yaml
kubectl logs --tail=20 -n openebs deployment/openebs-snapshot-operator -c snapshot-provisioner
kubectl create -f  https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/snapshot_claim_ns.yaml
kubectl logs --tail=20 -n openebs deployment/openebs-snapshot-operator -c snapshot-provisioner

sleep 30
# get clone replica pod IP to make a curl request to get the clone status
cloned_replica_ip=$(kubectl get pods -owide -l openebs.io/persistent-volume-claim=demo-snap-vol-claim-jiva --no-headers | grep -v ctrl | awk {'print $6'})
echo "***************** checking clone status *********************************"
for i in $(seq 1 5) ; do
		clonestatus=`curl http://$cloned_replica_ip:9502/v1/replicas/1 | jq '.clonestatus' | tr -d '"'`
		if [ "$clonestatus" == "completed" ]; then
            break
		else
            echo "Clone process in not completed ${clonestatus}"
            sleep 60
        fi
done

# Clone is in Alpha state, and kind of flaky sometimes, comment this integration test below for time being,
# util its stable in backend storage engine
echo "***************Creating busybox-clone-jiva application pod********************"
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/jiva/busybox_clone.yaml
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/busybox_clone.yaml
kubectl create -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/ci/maya/snapshot/cstor/busybox_clone_ns.yaml

kubectl get pods --all-namespaces
kubectl get pvc --all-namespaces

for i in $(seq 1 15) ; do
    phaseJiva=$(kubectl get pods busybox-clone-jiva --output="jsonpath={.status.phase}")
    phaseCstor=$(kubectl get pods busybox-clone-cstor --output="jsonpath={.status.phase}")
    phaseCstorNs=$(kubectl get pods busybox-clone-cstor-ns --output="jsonpath={.status.phase}")
    if [ "$phaseJiva" == "Running" ] && [ "$phaseCstor" == "Running" ] && [ "$phaseCstorNs" == "Running" ]; then
        break
    else
        echo "busybox-clone-jiva pod is in:" $phaseJiva
        echo "busybox-clone-cstor pod is in:" $phaseCstor
        echo "busybox-clone-cstor-ns pod is in:" $phaseCstorNs

        if [ "$phaseJiva" != "Running" ]; then
            kubectl describe pods busybox-clone-jiva
        fi
        if [ "$phaseCstor" != "Running" ]; then
            kubectl describe pods busybox-clone-cstor
        fi
        if [ "$phaseCstorNs" != "Running" ]; then
            kubectl describe pods busybox-clone-cstor-ns
        fi
		sleep 30
        fi
done

echo "********************** cvr status *************************"
kubectl get cvr -n openebs -o yaml

dumpMayaAPIServerLogs 100

kubectl get pods
kubectl get pvc

echo "*************Verifying data validity and Md5Sum Check********************"
hashjiva1=$(kubectl exec busybox-jiva -- md5sum /mnt/store1/date.txt | awk '{print $1}')
hashjiva2=$(kubectl exec busybox-clone-jiva -- md5sum /mnt/store2/date.txt | awk '{print $1}')

hashcstor1=$(kubectl exec busybox-cstor -- md5sum /mnt/store1/date.txt | awk '{print $1}')
hashcstor2=$(kubectl exec busybox-clone-cstor -- md5sum /mnt/store2/date.txt | awk '{print $1}')

hashcstorns1=$(kubectl exec busybox-cstor-ns -- md5sum /mnt/store1/date.txt | awk '{print $1}')
hashcstorns2=$(kubectl exec busybox-clone-cstor-ns -- md5sum /mnt/store2/date.txt | awk '{print $1}')

echo "busybox jiva hash: $hashjiva1"
echo "busybox-clone-jiva hash: $hashjiva2"
echo "busybox cstor hash: $hashcstor1"
echo "busybox-clone-cstor hash: $hashcstor2"
echo "busybox cstor ns hash: $hashcstorns1"
echo "busybox-clone-cstor-ns hash: $hashcstorns2"

if [ "$hashjiva1" != "" ] && [ "$hashcstor1" != "" ] && [ "$hashjiva1" == "$hashjiva2" ] && [ "$hashcstor1" == "$hashcstor2" ] && [ "$hashcstorns1" == "$hashcstorns2" ]; then
	echo "Md5Sum Check: PASSED"
else
    echo "Md5Sum Check: FAILED"; exit 1
fi


text:
#include "include/core/SkColorSpace.h"
#include "include/core/SkData.h"
#include "include/third_party/skcms/skcms.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkOpts.h"

bool SkColorSpacePrimaries::toXYZD50(skcms_Matrix3x3* toXYZ_D50) const {
    return skcms_PrimariesToXYZD50(fRX, fRY, fGX, fGY, fBX, fBY, fWX, fWY, toXYZ_D50);
}

SkColorSpace::SkColorSpace(const skcms_TransferFunction& transferFn,
                           const skcms_Matrix3x3& toXYZD50)
        : fTransferFn(transferFn)
        , fToXYZD50(toXYZD50) {
    fTransferFnHash = SkOpts::hash_fn(&fTransferFn, 7*sizeof(float), 0);
    fToXYZD50Hash = SkOpts::hash_fn(&fToXYZD50, 9*sizeof(float), 0);
}

static bool xyz_almost_equal(const skcms_Matrix3x3& mA, const skcms_Matrix3x3& mB) {
    for (int r = 0; r < 3; ++r) {
        for (int c = 0; c < 3; ++c) {
            if (!color_space_almost_equal(mA.vals[r][c], mB.vals[r][c])) {
                return false;
            }
        }
    }

    return true;
}

sk_sp<SkColorSpace> SkColorSpace::MakeRGB(const skcms_TransferFunction& transferFn,
                                          const skcms_Matrix3x3& toXYZ) {
    if (classify_transfer_fn(transferFn) == Bad_TF) {
        return nullptr;
    }

    const skcms_TransferFunction* tf = &transferFn;

    if (is_almost_srgb(transferFn)) {
        if (xyz_almost_equal(toXYZ, SkNamedGamut::kSRGB)) {
            return SkColorSpace::MakeSRGB();
        }
        tf = &SkNamedTransferFn::kSRGB;
    } else if (is_almost_2dot2(transferFn)) {
        tf = &SkNamedTransferFn::k2Dot2;
    } else if (is_almost_linear(transferFn)) {
        if (xyz_almost_equal(toXYZ, SkNamedGamut::kSRGB)) {
            return SkColorSpace::MakeSRGBLinear();
        }
        tf = &SkNamedTransferFn::kLinear;
    }

    return sk_sp<SkColorSpace>(new SkColorSpace(*tf, toXYZ));
}

class SkColorSpaceSingletonFactory {
public:
    static SkColorSpace* Make(const skcms_TransferFunction& transferFn,
                              const skcms_Matrix3x3& to_xyz) {
        return new SkColorSpace(transferFn, to_xyz);
    }
};

SkColorSpace* sk_srgb_singleton() {
    static SkColorSpace* cs = SkColorSpaceSingletonFactory::Make(SkNamedTransferFn::kSRGB,
                                                                 SkNamedGamut::kSRGB);
    return cs;
}

SkColorSpace* sk_srgb_linear_singleton() {
    static SkColorSpace* cs = SkColorSpaceSingletonFactory::Make(SkNamedTransferFn::kLinear,
                                                                 SkNamedGamut::kSRGB);
    return cs;
}

sk_sp<SkColorSpace> SkColorSpace::MakeSRGB() {
    return sk_ref_sp(sk_srgb_singleton());
}

sk_sp<SkColorSpace> SkColorSpace::MakeSRGBLinear() {
    return sk_ref_sp(sk_srgb_linear_singleton());
}

void SkColorSpace::computeLazyDstFields() const {
    fLazyDstFieldsOnce([this] {

        // Invert 3x3 gamut, defaulting to sRGB if we can't.
        {
            if (!skcms_Matrix3x3_invert(&fToXYZD50, &fFromXYZD50)) {
                SkAssertResult(skcms_Matrix3x3_invert(&skcms_sRGB_profile()->toXYZD50,
                                                      &fFromXYZD50));
            }
        }

        // Invert transfer function, defaulting to sRGB if we can't.
        {
            if (!skcms_TransferFunction_invert(&fTransferFn, &fInvTransferFn)) {
                fInvTransferFn = *skcms_sRGB_Inverse_TransferFunction();
            }
        }

    });
}

bool SkColorSpace::isNumericalTransferFn(skcms_TransferFunction* coeffs) const {
    // TODO: Change transferFn/invTransferFn to just operate on skcms_TransferFunction (all callers
    // already pass pointers to an skcms struct). Then remove this function, and update the two
    // remaining callers to do the right thing with transferFn and classify.
    this->transferFn(coeffs);
    return classify_transfer_fn(*coeffs) == sRGBish_TF;
}

void SkColorSpace::transferFn(float gabcdef[7]) const {
    memcpy(gabcdef, &fTransferFn, 7*sizeof(float));
}

void SkColorSpace::transferFn(skcms_TransferFunction* fn) const {
    *fn = fTransferFn;
}

void SkColorSpace::invTransferFn(skcms_TransferFunction* fn) const {
    this->computeLazyDstFields();
    *fn = fInvTransferFn;
}

bool SkColorSpace::toXYZD50(skcms_Matrix3x3* toXYZD50) const {
    *toXYZD50 = fToXYZD50;
    return true;
}

void SkColorSpace::gamutTransformTo(const SkColorSpace* dst, skcms_Matrix3x3* src_to_dst) const {
    dst->computeLazyDstFields();
    *src_to_dst = skcms_Matrix3x3_concat(&dst->fFromXYZD50, &fToXYZD50);
}

bool SkColorSpace::isSRGB() const {
    return sk_srgb_singleton() == this;
}

bool SkColorSpace::gammaCloseToSRGB() const {
    // Nearly-equal transfer functions were snapped at construction time, so just do an exact test
    return memcmp(&fTransferFn, &SkNamedTransferFn::kSRGB, 7*sizeof(float)) == 0;
}

bool SkColorSpace::gammaIsLinear() const {
    // Nearly-equal transfer functions were snapped at construction time, so just do an exact test
    return memcmp(&fTransferFn, &SkNamedTransferFn::kLinear, 7*sizeof(float)) == 0;
}

sk_sp<SkColorSpace> SkColorSpace::makeLinearGamma() const {
    if (this->gammaIsLinear()) {
        return sk_ref_sp(const_cast<SkColorSpace*>(this));
    }
    return SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, fToXYZD50);
}

sk_sp<SkColorSpace> SkColorSpace::makeSRGBGamma() const {
    if (this->gammaCloseToSRGB()) {
        return sk_ref_sp(const_cast<SkColorSpace*>(this));
    }
    return SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, fToXYZD50);
}

sk_sp<SkColorSpace> SkColorSpace::makeColorSpin() const {
    skcms_Matrix3x3 spin = {{
        { 0, 0, 1 },
        { 1, 0, 0 },
        { 0, 1, 0 },
    }};

    skcms_Matrix3x3 spun = skcms_Matrix3x3_concat(&fToXYZD50, &spin);

    return sk_sp<SkColorSpace>(new SkColorSpace(fTransferFn, spun));
}

void SkColorSpace::toProfile(skcms_ICCProfile* profile) const {
    skcms_Init               (profile);
    skcms_SetTransferFunction(profile, &fTransferFn);
    skcms_SetXYZD50          (profile, &fToXYZD50);
}

sk_sp<SkColorSpace> SkColorSpace::Make(const skcms_ICCProfile& profile) {
    // TODO: move below ≈sRGB test?
    if (!profile.has_toXYZD50 || !profile.has_trc) {
        return nullptr;
    }

    if (skcms_ApproximatelyEqualProfiles(&profile, skcms_sRGB_profile())) {
        return SkColorSpace::MakeSRGB();
    }

    // TODO: can we save this work and skip lazily inverting the matrix later?
    skcms_Matrix3x3 inv;
    if (!skcms_Matrix3x3_invert(&profile.toXYZD50, &inv)) {
        return nullptr;
    }

    // We can't work with tables or mismatched parametric curves,
    // but if they all look close enough to sRGB, that's fine.
    // TODO: should we maybe do this unconditionally to snap near-sRGB parametrics to sRGB?
    const skcms_Curve* trc = profile.trc;
    if (trc[0].table_entries != 0 ||
        trc[1].table_entries != 0 ||
        trc[2].table_entries != 0 ||
        0 != memcmp(&trc[0].parametric, &trc[1].parametric, sizeof(trc[0].parametric)) ||
        0 != memcmp(&trc[0].parametric, &trc[2].parametric, sizeof(trc[0].parametric)))
    {
        if (skcms_TRCs_AreApproximateInverse(&profile, skcms_sRGB_Inverse_TransferFunction())) {
            return SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, profile.toXYZD50);
        }
        return nullptr;
    }

    return SkColorSpace::MakeRGB(profile.trc[0].parametric, profile.toXYZD50);
}

///////////////////////////////////////////////////////////////////////////////////////////////////

enum Version {
    k0_Version, // Initial version, header + flags for matrix and profile
    k1_Version, // Simple header (version tag) + 16 floats

    kCurrent_Version = k1_Version,
};

enum NamedColorSpace {
    kSRGB_NamedColorSpace,
    kAdobeRGB_NamedColorSpace,
    kSRGBLinear_NamedColorSpace,
};

enum NamedGamma {
    kLinear_NamedGamma,
    kSRGB_NamedGamma,
    k2Dot2_NamedGamma,
};

struct ColorSpaceHeader {
    // Flag values, only used by old (k0_Version) serialization
    static constexpr uint8_t kMatrix_Flag     = 1 << 0;
    static constexpr uint8_t kICC_Flag        = 1 << 1;
    static constexpr uint8_t kTransferFn_Flag = 1 << 3;

    uint8_t fVersion = kCurrent_Version;

    // Other fields are only used by k0_Version. Could be re-purposed in future versions.
    uint8_t fNamed      = 0;
    uint8_t fGammaNamed = 0;
    uint8_t fFlags      = 0;
};

size_t SkColorSpace::writeToMemory(void* memory) const {
    if (memory) {
        *((ColorSpaceHeader*) memory) = ColorSpaceHeader();
        memory = SkTAddOffset<void>(memory, sizeof(ColorSpaceHeader));

        memcpy(memory, &fTransferFn, 7 * sizeof(float));
        memory = SkTAddOffset<void>(memory, 7 * sizeof(float));

        memcpy(memory, &fToXYZD50, 9 * sizeof(float));
    }

    return sizeof(ColorSpaceHeader) + 16 * sizeof(float);
}

sk_sp<SkData> SkColorSpace::serialize() const {
    sk_sp<SkData> data = SkData::MakeUninitialized(this->writeToMemory(nullptr));
    this->writeToMemory(data->writable_data());
    return data;
}

sk_sp<SkColorSpace> SkColorSpace::Deserialize(const void* data, size_t length) {
    if (length < sizeof(ColorSpaceHeader)) {
        return nullptr;
    }

    ColorSpaceHeader header = *((const ColorSpaceHeader*) data);
    data = SkTAddOffset<const void>(data, sizeof(ColorSpaceHeader));
    length -= sizeof(ColorSpaceHeader);
    if (k1_Version == header.fVersion) {
        if (length < 16 * sizeof(float)) {
            return nullptr;
        }

        skcms_TransferFunction transferFn;
        memcpy(&transferFn, data, 7 * sizeof(float));
        data = SkTAddOffset<const void>(data, 7 * sizeof(float));

        skcms_Matrix3x3 toXYZ;
        memcpy(&toXYZ, data, 9 * sizeof(float));
        return SkColorSpace::MakeRGB(transferFn, toXYZ);
    } else if (k0_Version == header.fVersion) {
        if (0 == header.fFlags) {
            switch ((NamedColorSpace)header.fNamed) {
                case kSRGB_NamedColorSpace:
                    return SkColorSpace::MakeSRGB();
                case kSRGBLinear_NamedColorSpace:
                    return SkColorSpace::MakeSRGBLinear();
                case kAdobeRGB_NamedColorSpace:
                    return SkColorSpace::MakeRGB(SkNamedTransferFn::k2Dot2,
                                                 SkNamedGamut::kAdobeRGB);
            }
        }

        auto make_named_tf = [=](const skcms_TransferFunction& tf) {
            if (ColorSpaceHeader::kMatrix_Flag != header.fFlags || length < 12 * sizeof(float)) {
                return sk_sp<SkColorSpace>(nullptr);
            }

            // Version 0 matrix is row-major 3x4
            skcms_Matrix3x3 toXYZ;
            memcpy(&toXYZ.vals[0][0], (const float*)data + 0, 3 * sizeof(float));
            memcpy(&toXYZ.vals[1][0], (const float*)data + 4, 3 * sizeof(float));
            memcpy(&toXYZ.vals[2][0], (const float*)data + 8, 3 * sizeof(float));
            return SkColorSpace::MakeRGB(tf, toXYZ);
        };

        switch ((NamedGamma) header.fGammaNamed) {
            case kSRGB_NamedGamma:
                return make_named_tf(SkNamedTransferFn::kSRGB);
            case k2Dot2_NamedGamma:
                return make_named_tf(SkNamedTransferFn::k2Dot2);
            case kLinear_NamedGamma:
                return make_named_tf(SkNamedTransferFn::kLinear);
            default:
                break;
        }

        switch (header.fFlags) {
            case ColorSpaceHeader::kICC_Flag: {
                // Deprecated and unsupported code path
                return nullptr;
            }
            case ColorSpaceHeader::kTransferFn_Flag: {
                if (length < 19 * sizeof(float)) {
                    return nullptr;
                }

                // Version 0 TF is in abcdefg order
                skcms_TransferFunction transferFn;
                transferFn.a = *(((const float*) data) + 0);
                transferFn.b = *(((const float*) data) + 1);
                transferFn.c = *(((const float*) data) + 2);
                transferFn.d = *(((const float*) data) + 3);
                transferFn.e = *(((const float*) data) + 4);
                transferFn.f = *(((const float*) data) + 5);
                transferFn.g = *(((const float*) data) + 6);
                data = SkTAddOffset<const void>(data, 7 * sizeof(float));

                // Version 0 matrix is row-major 3x4
                skcms_Matrix3x3 toXYZ;
                memcpy(&toXYZ.vals[0][0], (const float*)data + 0, 3 * sizeof(float));
                memcpy(&toXYZ.vals[1][0], (const float*)data + 4, 3 * sizeof(float));
                memcpy(&toXYZ.vals[2][0], (const float*)data + 8, 3 * sizeof(float));
                return SkColorSpace::MakeRGB(transferFn, toXYZ);
            }
            default:
                return nullptr;
        }
    } else {
        return nullptr;
    }
}

bool SkColorSpace::Equals(const SkColorSpace* x, const SkColorSpace* y) {
    if (x == y) {
        return true;
    }

    if (!x || !y) {
        return false;
    }

    if (x->hash() == y->hash()) {
        for (int i = 0; i < 7; i++) {
            SkASSERT((&x->fTransferFn.g)[i] == (&y->fTransferFn.g)[i] && "Hash collsion");
        }
        for (int r = 0; r < 3; r++) {
            for (int c = 0; c < 3; ++c) {
                SkASSERT(x->fToXYZD50.vals[r][c] == y->fToXYZD50.vals[r][c] && "Hash collsion");
            }
        }
        return true;
    }
    return false;
}

redpajama_set_name: RedPajamaGithub


text:
import { useState } from 'react'
import { useRouter } from 'next/router'
import Link from 'next/link'
import { gql, useMutation } from '@apollo/client'
import { getErrorMessage } from '../lib/form'
import Field from '../components/field'

const SignUpMutation = gql`
  mutation SignUpMutation($email: String!, $password: String!) {
    signUp(input: { email: $email, password: $password }) {
      user {
        id
        email
      }
    }
  }
`

function SignUp() {
  const [signUp] = useMutation(SignUpMutation)
  const [errorMsg, setErrorMsg] = useState()
  const router = useRouter()

  async function handleSubmit(event) {
    event.preventDefault()
    const emailElement = event.currentTarget.elements.email
    const passwordElement = event.currentTarget.elements.password

    try {
      await signUp({
        variables: {
          email: emailElement.value,
          password: passwordElement.value,
        },
      })

      router.push('/signin')
    } catch (error) {
      setErrorMsg(getErrorMessage(error))
    }
  }

  return (
    <>

Sign Up

      <form onSubmit={handleSubmit}>
        {errorMsg &&
{errorMsg}
}
        <Field
          name="email"
          type="email"
          autoComplete="email"
          required
          label="Email"
        />
        <Field
          name="password"
          type="password"
          autoComplete="password"
          required
          label="Password"
        />
        <button type="submit">Sign up</button> or{' '}
        <Link href="/signin">Sign in</Link>
      </form>
    </>
  )
}

export default SignUp


text:
using UnityEngine;
using UnityEditor;

[CustomPropertyDrawer(typeof(ReorderableAttribute))]
public class ReorderableAttributeDrawer : ReorderableDrawer
{
    // --------------------------------------------------------------------------------------------
    private float m_indentationWidth = 15;              // Guess of the width of one Unity indentation (EditorGUI.indentLevel)
    private float m_closedLineMaxHeight = 20;           // Threshold used to know if the property is opened
    private float m_verticalSpacingWhenOpened = 10;     // Spacing after an opened element
    private float m_verticalSpacingWhenClosed = 0;      // Spacing after a closed element
    private float m_bottomPaddingWhenOpened = 10;       // Bottom padding of the box when opened
    private Color m_boxLightSkinColor = new Color(0.6f, 0.6f, 0.6f, 0.2f);
    private Color m_boxDarkSkinColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);

    // --------------------------------------------------------------------------------------------
    public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
    {
        var height = base.GetPropertyHeight(property, label);
        height += (height > m_closedLineMaxHeight) ? m_bottomPaddingWhenOpened + m_verticalSpacingWhenOpened : m_verticalSpacingWhenClosed;
        return height;
    }

    // --------------------------------------------------------------------------------------------
    public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
    {
        m_info = GetArrayFieldInfo(property);

        var reorderable = attribute as ReorderableAttribute;
        if (reorderable != null)
        {
            m_showAdd = reorderable.showAdd;
            m_showDelete = reorderable.showDelete;
            m_showOrder = reorderable.showOrder;
            m_showBox = reorderable.showBox;
        }

        if (m_showBox)
        {
            var boxRect = rect;
            var elementFoldoutX = (EditorGUI.indentLevel - (m_info != null && m_info.isElementSimpleType ? 0 : 1)) * m_indentationWidth;
            boxRect.x += elementFoldoutX;
            boxRect.width -= elementFoldoutX;
            boxRect.height -= (rect.height > m_closedLineMaxHeight) ? m_verticalSpacingWhenOpened : m_verticalSpacingWhenClosed;
            GUI.backgroundColor = EditorGUIUtility.isProSkin ? m_boxDarkSkinColor : m_boxLightSkinColor;
            GUI.Box(boxRect, string.Empty);
            GUI.backgroundColor = Color.white;
        }
        base.OnGUI(rect, property, label);
    }
}


text:
import { Scope } from "src/scope";

export const object = new Scope()


text:
module ActiveRecord
  module Type
    module Internal
      module Timezone
        def is_utc?
          ActiveRecord.default_timezone == :utc
        end

        def default_timezone
          ActiveRecord.default_timezone
        end
      end
    end
  end
end


text:
let viewReports = {
  renderOnAir : function(reports) {
    document.getElementById('reports-onair').innerHTML = `

on Air

`.concat(reports.map(report => {
      return `<li data-report-id="${report.id}" data-onair="true">${report.title}</li>`;
    }).join(' ')).concat('
');
  },

  renderArchived : function(reports) {
    document.getElementById('reports-archived').innerHTML = `

Archived

`.concat(reports.map(report => {
      return `<li data-report-id="${report.id}" data-onair="false">${report.title}</li>`;
    }).join(' ')).concat('
');
  },

  render : function(reports) {
    viewReports.renderOnAir(reports.filter(report => report.onair === true));
    viewReports.renderArchived(reports.filter(report => !report.onair));
  },

  loadReportList : function(APIClient, notifyError) {
    APIClient.getReports()
      .then(viewReports.render)
      .catch(notifyError);
  }
};


text:
let chai = require("chai");
let should = chai.should();
let expect = chai.expect;
const {
  getMocks,
  getMocksAuth,
  example_case,
  getCase,
  addBasicCase,
  updateCase,
} = require("./data/helpers.js");
const {
  getCaseEditHttp,
  getCaseNewHttp,
  postCaseNewHttp,
  getCaseHttp,
  postCaseUpdateHttp,
} = require("../api/controllers/case");

const { listCases, cacheTitlesRefreshSearch } = require("../api/helpers/db");

before(function(done) {
  this.timeout(0);
  if (!listCases["en"]) {
    cacheTitlesRefreshSearch(done);
  } else {
    done();
  }
});

describe("Cases", () => {
  describe("Lookup", async () => {
    it("finds case 100", async () => {
      const body = await getCase(100);
      body.OK.should.be.true;
      const article = body.article;
      article.id.should.equal(100);
    });
  });
  describe("Adding", () => {
    it("fails without authentication", async () => {
      const { req, res, ret } = getMocks({ body: example_case });
      await postCaseNewHttp(req, res);
      ret.body.OK.should.be.false;
    });
    it("fails without content", async () => {
      const { req, res, ret } = getMocksAuth({});
      await postCaseNewHttp(req, res);
      ret.body.OK.should.be.false;
    });
    it("works with authentication", async () => {
      const body = await addBasicCase();
      body.OK.should.be.true;
      let returnedCase = body.article;
      returnedCase.id.should.be.a("number");
      returnedCase.creator.user_id.should.equal(
        returnedCase.last_updated_by.user_id
      );
      // test key fields
      [
        "scope_of_influence",
        "public_spectrum",
        "legality",
        "facilitators",
        "facilitator_training",
        "facetoface_online_or_both",
        "open_limited",
        "recruitment_method",
        "time_limited",
      ].forEach(key => {
        returnedCase[key].should.equal(example_case[key]);
      });
      // test key list fields
      [
        "general_issues",
        "specific_topics",
        "purposes",
        "approaches",
        "targeted_participants",
        "method_types",
        "participants_interactions",
        "learning_resources",
        "decision_methods",
        "if_voting",
        "insights_outcomes",
        "organizer_types",
        "funder_types",
        "change_types",
        "implementers_of_change",
        "tools_techniques_types",
      ].forEach(key => {
        let ret = returnedCase[key];
        let exp = example_case[key];
        ret.length.should.equal(exp.length);
        for (var i = 0; i < ret.length; i++) {
          ret[i].should.equal(exp[i]);
        }
      });
      // test media fields
      [
        "files",
        "links",
        "videos",
        "audio",
        "photos",
        "evaluation_reports",
        "evaluation_links",
      ].forEach(key => {
        returnedCase[key].length.should.equal(example_case[key].length);
        for (let i = 0; i < returnedCase[key].length; i++) {
          let ret = returnedCase[key][i];
          let exp = example_case[key][i];
          expect(ret.attribution).to.equal(exp.attribution);
          expect(ret.title).to.equal(exp.title);
          expect(ret.url).to.equal(exp.url);
          if (exp.source_url) {
            expect(ret.source_url).to.equal(exp.source_url);
          }
        }
      });
    });
  });

  it.skip("test SQL sanitization", async () => {
    const body = await addBasicCase();
    // actually test this!
  });

  describe("Get case with authentication", () => {
    it("should not fail when logged in", async () => {
      const body = await addBasicCase();
      body.OK.should.equal(true);
    });
  });

  describe("Test edit API", () => {
    it("Add case, then modify title and/or body", async () => {
      const body1 = await addBasicCase();
      body1.OK.should.be.true;
      body1.article.id.should.be.a("number");
      const origCase = body1.article;
      origCase.title.should.equal("First Title");
      origCase.body.should.equal("First Body");
      origCase.description.should.equal("First Description");
      const body2 = await updateCase(origCase.id, {
        title: "Second Title",
        body: "Second Body",
        description: "Second Description",
      });
      const updatedCase = body2.article;
      updatedCase.title.should.equal("Second Title");
      updatedCase.body.should.equal("Second Body");
      updatedCase.description.should.equal("Second Description");
      updatedCase.last_updated_by.user_id.should.not.equal(
        origCase.last_updated_by.user_id
      );
    });

    it("Add case, then modify some fields", async () => {
      const body1 = await addBasicCase();
      body1.OK.should.be.true;
      body1.article.id.should.be.a("number");
      const origCase = body1.article;
      origCase.general_issues.length.should.equal(4);
      origCase.general_issues[0].should.equal("arts");
      origCase.general_issues[1].should.equal("education");
      origCase.general_issues[2].should.equal("environment");
      origCase.general_issues[3].should.equal("planning");
      const updatedCase = (await updateCase(origCase.id, {
        general_issues: [{ key: "arts", value: "Arts, Culture, & Recreation" }],
      })).article;
      updatedCase.general_issues.length.should.equal(1);
      updatedCase.general_issues[0].should.equal("arts");
    });

    it("Add case, then modify lead image", async () => {
      const body1 = await addBasicCase();
      body1.OK.should.be.true;
      const case1 = body1.article;
      case1.photos.length.should.equal(3);
      case1.photos[0].url.should.equal(
        "https://s3.amazonaws.com/uploads.participedia.xyz/index.php__21.jpg"
      );
      const { req, res, ret } = getMocksAuth({
        params: { thingid: case1.id },
        body: {
          photos: [
            {
              url: "http://foobar.com/test.jpg",
              source_url: "https://example.com/foobar",
              title: "Right ho!",
              attribution: "Marie Osmond",
            },
          ],
        },
      });
      await postCaseUpdateHttp(req, res);
      const case2 = ret.body.article;
      case2.photos.length.should.equal(1);
      case2.photos[0].url.should.equal("http://foobar.com/test.jpg");
      expect(case2.updated_date > case1.updated_date).to.be.true;
    });
  });

  // need to import bookmark methods. do this in the bookmark test suite?
  describe.skip("Test bookmarked", () => {
    let case1 = null;
    it("Add case, should not be bookmarked", async () => {
      const body1 = await addBasicCase();
      body1.OK.should.be.true;
      case1 = body1.article;
      case1.bookmarked.should.be.false;
      const booked = await chai
        .postJSON("/bookmark/add?returns=json")
        .set("Cookie", "token=" + tokens.user_token)
        .send({ bookmarkType: "case", thingid: case1.id });
      booked.should.have.status(200);
    });
    it("Not authenticated, bookmarked should be false", async () => {
      const res2 = await chai
        .getJSON("/case/" + case1.id + "?returns=json")
        .send({});
      res2.should.have.status(200);
      res2.body.OK.should.be.true;
      const case2 = res2.body.article;
      case2.bookmarked.should.be.false;
    });
    it("Bookmarked should be true", async () => {
      const res3 = await chai
        .getJSON("/case/" + case1.id + "?returns=json")
        .set("Cookie", "token=" + tokens.user_token)
        .send({});
      res3.should.have.status(200);
      res3.body.OK.should.be.true;
      const case3 = res3.body.article;
      case3.bookmarked.should.be.true;
    });
  });
});


text:
package uk.jamierocks.saturn.common.command;

import com.google.common.collect.Lists;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import uk.jamierocks.saturn.api.command.CommandCallable;

import java.util.List;

public class MinecraftCommandCallable extends CommandBase {

    private final CommandCallable callable;
    private final String name;
    private final String[] aliases;

    public MinecraftCommandCallable(CommandCallable callable, String name, String[] aliases) {
        this.callable = callable;
        this.name = name;
        this.aliases = aliases;
    }

    @Override
    public String getCommandName() {
        return this.name;
    }

    @Override
    public List getCommandAliases() {
        return Lists.newArrayList(this.aliases);
    }

    @Override
    public String getCommandUsage(ICommandSender sender) {
        return "";
    }

    @Override
    public void processCommand(ICommandSender sender, String[] args) throws CommandException {
        String arguments = "";
        for (String a : args) {
            arguments = arguments.concat(a + " ");
        }
        this.callable.execute(new SaturnCommandSender(sender), arguments);
    }
}


text:
'use strict';

angular.module('login',[])
  .controller('LoginController', function ($scope, FireAuth, $location, $q, FireRef, $timeout) {
    // Manages authentication to any active providers.

    $scope.oauthLogin = function(provider) {
      $scope.err = null;
      FireAuth.$authWithOAuthPopup(provider, {rememberMe: true}).then(redirect, showError);
    };

    $scope.anonymousLogin = function() {
      $scope.err = null;
      FireAuth.$authAnonymously({rememberMe: true}).then(redirect, showError);
    };

    $scope.passwordLogin = function(email, pass) {
      $scope.err = null;
      FireAuth.$authWithPassword({email: email, password: pass}, {rememberMe: true}).then(
        redirect, showError
      );
    };

    $scope.createAccount = function(email, pass, confirm) {
      $scope.err = null;
      if( !pass ) {
        $scope.err = 'Please enter a password';
      }
      else if( pass !== confirm ) {
        $scope.err = 'Passwords do not match';
      }
      else {
        FireAuth.$createUser({email: email, password: pass})
          .then(function () {
            // authenticate so we have permission to write to Firebase
            return FireAuth.$authWithPassword({email: email, password: pass}, {rememberMe: true});
          })
          .then(createProfile)
          .then(redirect, showError);
      }

      function createProfile(user) {
        var ref = FireRef.child('users', user.uid), def = $q.defer();
        ref.set({email: email, name: firstPartOfEmail(email)}, function(err) {
          $timeout(function() {
            if( err ) {
              def.reject(err);
            }
            else {
              def.resolve(ref);
            }
          });
        });
        return def.promise;
      }
    };

    function firstPartOfEmail(email) {
      return ucfirst(email.substr(0, email.indexOf('@'))||'');
    }

    function ucfirst (str) {
      // inspired by: http://kevin.vanzonneveld.net
      str += '';
      var f = str.charAt(0).toUpperCase();
      return f + str.substr(1);
    }

    function redirect() {
      $location.path('/account');
    }

    function showError(err) {
      $scope.err = err;
    }

  });


text:
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using System.Numerics;

namespace Microsoft.Toolkit.Uwp.UI.Animations.Expressions
{
    // Ignore warning: 'Vector4Node' defines operator == or operator != but does not override Object.Equals(object o) && Object.GetHashCode()
#pragma warning disable CS0660, CS0661
    /// <summary>
    /// Class Vector4Node. This class cannot be inherited.
    /// </summary>
    /// <seealso cref="Microsoft.Toolkit.Uwp.UI.Animations.Expressions.ExpressionNode" />
    public sealed class Vector4Node : ExpressionNode
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Vector4Node"/> class.
        /// </summary>
        internal Vector4Node()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Vector4Node"/> class.
        /// </summary>
        /// <param name="value">The value.</param>
        internal Vector4Node(Vector4 value)
        {
            _value = value;
            NodeType = ExpressionNodeType.ConstantValue;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Vector4Node"/> class.
        /// </summary>
        /// <param name="paramName">Name of the parameter.</param>
        internal Vector4Node(string paramName)
        {
            ParamName = paramName;
            NodeType = ExpressionNodeType.ConstantParameter;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Vector4Node"/> class.
        /// </summary>
        /// <param name="paramName">Name of the parameter.</param>
        /// <param name="value">The value.</param>
        internal Vector4Node(string paramName, Vector4 value)
        {
            ParamName = paramName;
            _value = value;
            NodeType = ExpressionNodeType.ConstantParameter;

            SetVector4Parameter(paramName, value);
        }

        /// <summary>
        /// Performs an implicit conversion from <see cref="Vector4"/> to <see cref="Vector4Node"/>.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns>The result of the conversion.</returns>
        public static implicit operator Vector4Node(Vector4 value)
        {
            return new Vector4Node(value);
        }

        /// <summary>
        /// Implements the + operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static Vector4Node operator +(Vector4Node left, Vector4Node right)
        {
            return ExpressionFunctions.Function<Vector4Node>(ExpressionNodeType.Add, left, right);
        }

        /// <summary>
        /// Implements the - operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static Vector4Node operator -(Vector4Node left, Vector4Node right)
        {
            return ExpressionFunctions.Function<Vector4Node>(ExpressionNodeType.Subtract, left, right);
        }

        /// <summary>
        /// Implements the - operator.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns>The result of the operator.</returns>
        public static Vector4Node operator -(Vector4Node value)
        {
            return ExpressionFunctions.Function<Vector4Node>(ExpressionNodeType.Negate, value);
        }

        /// <summary>
        /// Implements the * operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static Vector4Node operator *(Vector4Node left, ScalarNode right)
        {
            return ExpressionFunctions.Function<Vector4Node>(ExpressionNodeType.Multiply, left, right);
        }

        /// <summary>
        /// Implements the * operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static Vector4Node operator *(Vector4Node left, Vector4Node right)
        {
            return ExpressionFunctions.Function<Vector4Node>(ExpressionNodeType.Multiply, left, right);
        }

        /// <summary>
        /// Implements the / operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static Vector4Node operator /(Vector4Node left, Vector4Node right)
        {
            return ExpressionFunctions.Function<Vector4Node>(ExpressionNodeType.Divide, left, right);
        }

        /// <summary>
        /// Implements the % operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static Vector4Node operator %(Vector4Node left, Vector4Node right)
        {
            return ExpressionFunctions.Function<Vector4Node>(ExpressionNodeType.Modulus, left, right);
        }

        /// <summary>
        /// Implements the == operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static BooleanNode operator ==(Vector4Node left, Vector4Node right)
        {
            return ExpressionFunctions.Function<BooleanNode>(ExpressionNodeType.Equals, left, right);
        }

        /// <summary>
        /// Implements the != operator.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static BooleanNode operator !=(Vector4Node left, Vector4Node right)
        {
            return ExpressionFunctions.Function<BooleanNode>(ExpressionNodeType.NotEquals, left, right);
        }

        /// <summary>
        /// Enum Subchannel
        /// </summary>
        public enum Subchannel
        {
            /// <summary>
            /// The x channel
            /// </summary>
            X,

            /// <summary>
            /// The y channel
            /// </summary>
            Y,

            /// <summary>
            /// The z channel
            /// </summary>
            Z,

            /// <summary>
            /// The w channel
            /// </summary>
            W
        }

        /// <summary>
        /// Gets the x channel.
        /// </summary>
        /// <value>The x.</value>
        public ScalarNode X
        {
            get { return GetSubchannels(Subchannel.X); }
        }

        /// <summary>
        /// Gets the y channel.
        /// </summary>
        /// <value>The y.</value>
        public ScalarNode Y
        {
            get { return GetSubchannels(Subchannel.Y); }
        }

        /// <summary>
        /// Gets the z channel.
        /// </summary>
        /// <value>The z.</value>
        public ScalarNode Z
        {
            get { return GetSubchannels(Subchannel.Z); }
        }

        /// <summary>
        /// Gets the w channel.
        /// </summary>
        /// <value>The w.</value>
        public ScalarNode W
        {
            get { return GetSubchannels(Subchannel.W); }
        }

        /// <summary>
        /// Gets the x and y channels.
        /// </summary>
        /// <value>The xy.</value>
        public Vector2Node XY
        {
            get { return GetSubchannels(Subchannel.X, Subchannel.Y); }
        }

        /// <summary>
        /// Gets the x, y, and z channels.
        /// </summary>
        /// <value>The xyz.</value>
        public Vector3Node XYZ
        {
            get { return GetSubchannels(Subchannel.X, Subchannel.Y, Subchannel.Z); }
        }

        /// <summary>
        /// Create a new type by re-arranging the Vector subchannels.
        /// </summary>
        /// <param name="s">The subchanel.</param>
        /// <returns>ScalarNode</returns>
        public ScalarNode GetSubchannels(Subchannel s)
        {
            return SubchannelsInternal<ScalarNode>(s.ToString());
        }

        /// <summary>
        /// Create a new type by re-arranging the Vector subchannels.
        /// </summary>
        /// <param name="s1">The first subchanel.</param>
        /// <param name="s2">The second subchannel.</param>
        /// <returns>Vector2Node</returns>
        public Vector2Node GetSubchannels(Subchannel s1, Subchannel s2)
        {
            return SubchannelsInternal<Vector2Node>(s1.ToString(), s2.ToString());
        }

        /// <summary>
        /// Create a new type by re-arranging the Vector subchannels.
        /// </summary>
        /// <param name="s1">The first subchanel.</param>
        /// <param name="s2">The second subchannel.</param>
        /// <param name="s3">The third subchannel.</param>
        /// <returns>Vector3Node</returns>
        public Vector3Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3)
        {
            return SubchannelsInternal<Vector3Node>(s1.ToString(), s2.ToString(), s3.ToString());
        }

        /// <summary>
        /// Create a new type by re-arranging the Vector subchannels.
        /// </summary>
        /// <param name="s1">The first subchanel.</param>
        /// <param name="s2">The second subchannel.</param>
        /// <param name="s3">The third subchannel.</param>
        /// <param name="s4">The fourth subchannel.</param>
        /// <returns>Vector4Node</returns>
        public Vector4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3, Subchannel s4)
        {
            return SubchannelsInternal<Vector4Node>(s1.ToString(), s2.ToString(), s3.ToString(), s4.ToString());
        }

        /// <summary>
        /// Create a new type by re-arranging the Vector subchannels.
        /// </summary>
        /// <param name="s1">The first subchanel.</param>
        /// <param name="s2">The second subchannel.</param>
        /// <param name="s3">The third subchannel.</param>
        /// <param name="s4">The fourth subchannel.</param>
        /// <param name="s5">The fifth subchannel.</param>
        /// <param name="s6">The sixth subchannel.</param>
        /// <returns>Matrix3x2Node</returns>
        public Matrix3x2Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3, Subchannel s4, Subchannel s5, Subchannel s6)
        {
            return SubchannelsInternal<Matrix3x2Node>(s1.ToString(), s2.ToString(), s3.ToString(), s4.ToString(), s5.ToString(), s6.ToString());
        }

        /// <summary>
        /// Create a new type by re-arranging the Vector subchannels.
        /// </summary>
        /// <param name="s1">The first subchanel.</param>
        /// <param name="s2">The second subchannel.</param>
        /// <param name="s3">The third subchannel.</param>
        /// <param name="s4">The fourth subchannel.</param>
        /// <param name="s5">The fifth subchannel.</param>
        /// <param name="s6">The sixth subchannel.</param>
        /// <param name="s7">The seventh subchannel.</param>
        /// <param name="s8">The eighth subchannel.</param>
        /// <param name="s9">The ninth subchannel.</param>
        /// <param name="s10">The tenth subchannel.</param>
        /// <param name="s11">The eleventh subchannel.</param>
        /// <param name="s12">The twelfth subchannel.</param>
        /// <param name="s13">The thirteenth subchannel.</param>
        /// <param name="s14">The fourteenth subchannel.</param>
        /// <param name="s15">The fifteenth subchannel.</param>
        /// <param name="s16">The sixteenth subchannel.</param>
        /// <returns>Matrix4x4Node</returns>
#pragma warning disable SA1117 // Parameters must be on same line or separate lines
        public Matrix4x4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3, Subchannel s4,
                                         Subchannel s5, Subchannel s6, Subchannel s7, Subchannel s8,
                                         Subchannel s9, Subchannel s10, Subchannel s11, Subchannel s12,
                                         Subchannel s13, Subchannel s14, Subchannel s15, Subchannel s16)
        {
            return SubchannelsInternal<Matrix4x4Node>(s1.ToString(), s2.ToString(), s3.ToString(), s4.ToString(),
                                                      s5.ToString(), s6.ToString(), s7.ToString(), s8.ToString(),
                                                      s9.ToString(), s10.ToString(), s11.ToString(), s12.ToString(),
                                                      s13.ToString(), s14.ToString(), s15.ToString(), s16.ToString());
        }
#pragma warning restore SA1117 // Parameters must be on same line or separate lines

        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <returns>System.String.</returns>
        protected internal override string GetValue()
        {
            return $"Vector4({_value.X},{_value.Y},{_value.Z},{_value.W})";
        }

        private Vector4 _value;
    }
#pragma warning restore CS0660, CS0661
}


text:
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    // O(n) space
    std::unordered_map<int, int> freqs;

    void traverse(TreeNode* root) {
        if (root->left) {
            traverse(root->left);
        }
        if (root->right) {
            traverse(root->right);
        }
        if (freqs.find(root->val) == freqs.end()) {
            freqs[root->val] = 1;
        } else {
            freqs[root->val]++;
        }
    }

    vector<int> findModeONSpace(TreeNode* root) {
        traverse(root);
        int max_freq = 0;
        vector<int> result;
        for (const pair<const int, int>& kv : freqs) {
            if (kv.second > max_freq) {
                max_freq = kv.second;
                result = {kv.first};
            } else if (kv.second == max_freq) {
                result.push_back(kv.first);
            }
        }
        return result;
    }

    ////////////////////////////////////////////////////////////////////////////
    // O(1) space
    // In order traversal will visit values in ascending order. So keep a running
    // count of the current value. When value changes, adjust maxCount encountered,
    // and adjust answer as needed.

    int currVal = std::numeric_limits<int>::min();
    int currCount = 0;
    int maxCount = 0;
    vector<int> answers = {};

    void handle(int val) {
        if (val == currVal) {
            currCount++;
        } else {
            currVal = val;
            currCount = 1;
        }

        if (currCount == maxCount) {
            answers.push_back(val);
        } else if (currCount > maxCount) {
            maxCount = currCount;
            answers = {val};
        }
    }

    void traverseInOrder(TreeNode *root) {
        if (root == nullptr) {
            return;
        }

        traverseInOrder(root->left);
        handle(root->val);
        traverseInOrder(root->right);
    }

    vector<int> findMode(TreeNode* root) {
        traverseInOrder(root);
        return answers;
    }
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
	<File path="Constants/CCVerticalTextAlignment.html">

		<Token>
			<TokenIdentifier>//apple_ref/c/tdef/CCVerticalTextAlignment</TokenIdentifier>
			<Abstract type="html"></Abstract>
			<DeclaredIn>ccTypes.h</DeclaredIn>

			<NodeRef refid="150"/>
		</Token>

        <Token>
            <TokenIdentifier>//apple_ref/c/econst/CCVerticalTextAlignmentTop</TokenIdentifier>
            <Abstract type="html"></Abstract>
            <Declaration>CCVerticalTextAlignmentTop</Declaration>

            <DeclaredIn>ccTypes.h</DeclaredIn>

            <NodeRef refid="150"/>
        </Token>

        <Token>
            <TokenIdentifier>//apple_ref/c/econst/CCVerticalTextAlignmentCenter</TokenIdentifier>
            <Abstract type="html"></Abstract>
            <Declaration>CCVerticalTextAlignmentCenter</Declaration>

            <DeclaredIn>ccTypes.h</DeclaredIn>

            <NodeRef refid="150"/>
        </Token>

        <Token>
            <TokenIdentifier>//apple_ref/c/econst/CCVerticalTextAlignmentBottom</TokenIdentifier>
            <Abstract type="html"></Abstract>
            <Declaration>CCVerticalTextAlignmentBottom</Declaration>

            <DeclaredIn>ccTypes.h</DeclaredIn>

            <NodeRef refid="150"/>
        </Token>

	</File>
</Tokens>


text:
<?php
/**
 * DataTest
 *
 * PHP version 5
 *
 * @category Class
 * @package  Swagger\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * SKU Comments Sentiment API
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version:
 *
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Please update the test case below to test the model.
 */

namespace Swagger\Client;

/**
 * DataTest Class Doc Comment
 *
 * @category    Class */
// * @description Data
/**
 * @package     Swagger\Client
 * @author      Swagger Codegen team
 * @link        https://github.com/swagger-api/swagger-codegen
 */
class DataTest extends \PHPUnit_Framework_TestCase
{

    /**
     * Setup before running any test case
     */
    public static function setUpBeforeClass()
    {

    }

    /**
     * Setup before running each test case
     */
    public function setUp()
    {

    }

    /**
     * Clean up after running each test case
     */
    public function tearDown()
    {

    }

    /**
     * Clean up after running all test cases
     */
    public static function tearDownAfterClass()
    {

    }

    /**
     * Test "Data"
     */
    public function testData()
    {

    }

    /**
     * Test attribute "sku"
     */
    public function testPropertySku()
    {

    }

    /**
     * Test attribute "content"
     */
    public function testPropertyContent()
    {

    }

    /**
     * Test attribute "tone"
     */
    public function testPropertyTone()
    {

    }

}


text:
<?php
/****************************************************************/
/* ATutor														*/
/****************************************************************/
/* Copyright (c) 2002-2010                                      */
/* Inclusive Design Institute                                   */
/* http://atutor.ca												*/
/*                                                              */
/* This program is free software. You can redistribute it and/or*/
/* modify it under the terms of the GNU General Public License  */
/* as published by the Free Software Foundation.				*/
/****************************************************************/
// $Id: oauth_authenticate.php 10141 2010-08-17 17:56:03Z hwong $

/**
 * This script is called by mods/_core/imscp/ims_export.php
 * to export course content out of ATutor and import into
 * transformable.
 * This script also used as a callback endpoint for Tansformable
 * OAuth authentication.
 * @access public
 * @input  1. $client_callback_url is required
 *         2. when called back by Transformable OAuth authentication,
 *         a request token var 'oauth_token' is required.
 * @output $access_token_key, to import into transformable
 */

if (!defined('AT_INCLUDE_PATH'))
{ // when the script is called back by oauth server,
	define('AT_INCLUDE_PATH', '../../../../include/');
	require_once(AT_INCLUDE_PATH.'vitals.inc.php');
}

require_once('OAuthUtility.class.php');
require_once("OAuth.php");
global $msg, $_config;

// check whether the transformable url is accessible
if (!OAuthUtility::isAccessible(AT_TILE_OAUTH_REGISTER_CONSUMER_URL))
{
	$msg->addError(array('TILE_AUTHENTICATION_FAIL', _AT('tile_not_accessible')));
	header('Location: '.AT_BASE_HREF.'mods/_core/imscp/index.php');
	exit;
}

// check whether the last access token has expired. If not, return it, otherwise, get a new access token.
// skip this step when this script is called by oauth server callback
if (isset($_SESSION['member_id']))
	$access_token_key = OAuthUtility::getUnexpiredAccessToken();

if ($access_token_key == '')
{
	// initialize basic variables
	$sig_method = new OAuthSignatureMethod_HMAC_SHA1(); // use HMAC signature method as default

	if (!isset($_GET['oauth_token'])) // before oauth server authentication, get request token from oauth server
	{
		// 1. register consumer
		$sql = "SELECT * FROM ".TABLE_PREFIX."oauth_client_servers
		         WHERE oauth_server='".mysql_real_escape_string($_config['transformable_uri'])."'";
		$result = mysql_query($sql, $db);

		if (mysql_num_rows($result) == 0)
		{
			$register_consumer_url = AT_TILE_OAUTH_REGISTER_CONSUMER_URL.'?consumer='.urlencode(AT_BASE_HREF).'&expire='.$_config['transformable_oauth_expire'];
			$oauth_server_response = file_get_contents($register_consumer_url);

//			debug('register consumer - request: '.$register_consumer_url);
//			debug('register consumer - OAUTH response: '.$oauth_server_response);

			// handle OAUTH response on register consumer
			foreach (explode('&', $oauth_server_response) as $rtn)
			{
				$rtn_pair = explode('=', $rtn);

				if ($rtn_pair[0] == 'consumer_key') $consumer_key = $rtn_pair[1];
				if ($rtn_pair[0] == 'consumer_secret') $consumer_secret = $rtn_pair[1];
				if ($rtn_pair[0] == 'expire') $expire_threshold = $rtn_pair[1];
				if ($rtn_pair[0] == 'error') $error = urldecode($rtn_pair[1]);
			}

			if ($error <> '')
			{
				$msg->addError(array('TILE_AUTHENTICATION_FAIL', $error));
				header('Location: '.AT_BASE_HREF.'mods/_core/imscp/index.php');
				exit;
			}
			else
			{
				$sql = "INSERT INTO ".TABLE_PREFIX."oauth_client_servers
					    (oauth_server, consumer_key, consumer_secret, expire_threshold, create_date)
					    VALUES ('".mysql_real_escape_string($_config['transformable_uri'])."', '".$consumer_key."',
					    '".$consumer_secret."', ".$expire_threshold.", now())";
				$result = mysql_query($sql, $db);
				$oauth_server_id = mysql_insert_id();
			}
		}
		else
		{
			$row = mysql_fetch_assoc($result);
			$oauth_server_id = $row['oauth_server_id'];
			$consumer_key = $row['consumer_key'];
			$consumer_secret = $row['consumer_secret'];
			$expire_threshold = $row['expire_threshold'];
		}
		$consumer = new OAuthConsumer($consumer_key, $consumer_secret, $client_callback_url);

	//	debug('consumer: '.$consumer);
	//	debug('--- END OF REGISTERING CONSUMER ---');

		// 2. get request token
		$req_req = OAuthRequest::from_consumer_and_token($consumer, NULL, "GET", AT_TILE_OAUTH_REQUEST_TOKEN_URL);
		$req_req->sign_request($sig_method, $consumer, NULL);

		$oauth_server_response = file_get_contents($req_req);

	//	debug('request token - request: '."\n".$req_req);
	//	debug('request token - response: '."\n".$oauth_server_response);

		// handle OAUTH request token response
		foreach (explode('&', $oauth_server_response) as $rtn)
		{
			$rtn_pair = explode('=', $rtn);

			if ($rtn_pair[0] == 'oauth_token') $request_token_key = $rtn_pair[1];
			if ($rtn_pair[0] == 'oauth_token_secret') $request_token_secret = $rtn_pair[1];
			if ($rtn_pair[0] == 'error') $error = urldecode($rtn_pair[1]);
		}

		if ($error == '' && strlen($request_token_key) > 0 && strlen($request_token_secret) > 0)
		{
			$sql = "INSERT INTO ".TABLE_PREFIX."oauth_client_tokens
					(oauth_server_id, token, token_type, token_secret, member_id, assign_date)
					VALUES (".$oauth_server_id.", '".$request_token_key."', 'request',
					'".$request_token_secret."', ".$_SESSION['member_id'].", now())";
			$result = mysql_query($sql, $db);
		}
		else
		{
			$msg->addError(array('TILE_AUTHENTICATION_FAIL', $error));
			header('Location: '.AT_BASE_HREF.'mods/_core/imscp/index.php');
			exit;
		}

		$request_token = new OAuthToken($request_token_key, $request_token_secret);

	//	debug('--- END OF REQESTING REQUEST TOKEN ---');

		// 3. authorization
		$auth_req = AT_TILE_OAUTH_AUTHORIZATION_URL.'?oauth_token='.$request_token_key.'&oauth_callback='.urlencode($client_callback_url);

		header('Location: '.$auth_req);
		exit;
	}
	else // authenticated
	{
		// get consumer id by request token
		$sql = "SELECT ocs.oauth_server_id, ocs.consumer_key, ocs.consumer_secret,
		               ocs.expire_threshold, oct.member_id, oct.token_secret
		          FROM ".TABLE_PREFIX."oauth_client_servers ocs, ".TABLE_PREFIX."oauth_client_tokens oct
		         WHERE ocs.oauth_server_id = oct.oauth_server_id
		           AND oct.token = '".$_GET['oauth_token']."'
		           AND token_type='request'";

		$result = mysql_query($sql, $db);
		if (mysql_num_rows($result)==0)
		{
			$msg->addError(array('TILE_AUTHENTICATION_FAIL', _AT('wrong_request_token')));
			header('Location: '.AT_BASE_HREF.'mods/_core/imscp/index.php');
			exit;
		}

		$row = mysql_fetch_assoc($result);

		$consumer = new OAuthConsumer($row['consumer_key'], $row['consumer_secret'], $client_callback_url);
		$request_token = new OAuthToken($_GET['oauth_token'], $row['token_secret']);

		// 4. get access token
		$access_req = OAuthRequest::from_consumer_and_token($consumer, $request_token, "GET", AT_TILE_OAUTH_ACCESS_TOKEN_URL);
		$access_req->sign_request($sig_method, $consumer, NULL);

		$oauth_server_response = file_get_contents($access_req);

	//	debug('access token - request: '."\n".$access_req);
	//	debug('access token - response: '."\n".$oauth_server_response);

		// handle OAUTH response on access token
		foreach (explode('&', $oauth_server_response) as $rtn)
		{
			$rtn_pair = explode('=', $rtn);

			if ($rtn_pair[0] == 'oauth_token') $access_token_key = $rtn_pair[1];
			if ($rtn_pair[0] == 'oauth_token_secret') $access_token_secret = $rtn_pair[1];
			if ($rtn_pair[0] == 'error') $error = urldecode($rtn_pair[1]);
		}

		if ($error == '' && strlen($access_token_key) > 0 && strlen($access_token_secret) > 0)
		{
			// insert access token
			$sql = "INSERT INTO ".TABLE_PREFIX."oauth_client_tokens
					(oauth_server_id, token, token_type, token_secret, member_id, assign_date)
					VALUES (".$row['oauth_server_id'].", '".$access_token_key."', 'access',
					'".$access_token_secret."', ".$row['member_id'].", now())";
			$result = mysql_query($sql, $db);

			// delete request_token
			$sql = "DELETE FROM ".TABLE_PREFIX."oauth_client_tokens
					 WHERE token = '".$_GET['oauth_token']."'
					   AND token_type='request'";
			$result = mysql_query($sql, $db);
		}
		else
		{
			$msg->addError(array('TILE_AUTHENTICATION_FAIL', $error));
			header('Location: '.AT_BASE_HREF.'mods/_core/imscp/index.php');
			exit;
		}
	}
}
//debug('access token key: '.$access_token_key);
//	debug('--- END OF REQESTING ACCESS TOKEN ---');
//	exit;
?>


text:
import sys, os, pwd

project = "fbone"

# Use instance folder, instead of env variables.
# specify dev/production config
#os.environ['%s_APP_CONFIG' % project.upper()] = ''
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
#os.environ['HOME'] = pwd.getpwuid(os.getuid()).pw_dir

BASE_DIR = os.path.join(os.path.dirname(__file__))
# Change this later, get path from cookiecutter
activate_this = (os.environ['WORKON_HOME'] + 'env' + '/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))

if BASE_DIR not in sys.path:
    sys.path.append(BASE_DIR)

# give wsgi the "application"
from lurcat import create_app
application = create_app()


text:
import {removeElement} from '#core/dom';
import {Layout, applyFillContent} from '#core/dom/layout';
import {setStyles} from '#core/dom/style';

import {Services} from '#service';

import {CSS} from '../../../build/amp-mathml-0.1.css';
import {getIframe} from '../../../src/3p-frame';
import {listenFor} from '../../../src/iframe-helper';

export class AmpMathml extends AMP.BaseElement {
  /** @param {!AmpElement} element */
  constructor(element) {
    super(element);

    /** @private {?HTMLIFrameElement} */
    this.iframe_ = null;
  }

  /**
   * Adds a preconnect
   *
   */
  preconnectCallback() {
    Services.preconnectFor(this.win).url(
      this.getAmpDoc(),
      'https://cdnjs.cloudflare.com'
    );
  }

  /**
   * Adds a callback to mutateElement.
   */
  buildCallback() {
    // Make the element minimally displayed to make sure that `layoutCallback`
    // is called.
    let sizingWidth;
    if (this.element.hasAttribute('inline')) {
      sizingWidth = '1px';
    }
    this.mutateElement(() => {
      setStyles(this.element, {
        width: sizingWidth,
        height: '1rem',
      });
    });
  }

  /**
   * Adds a layout callback for mathml iframe.
   *
   * @return {!Promise}
   */
  layoutCallback() {
    const iframe = getIframe(this.win, this.element, 'mathml');
    iframe.title = this.element.title || 'MathML formula';
    applyFillContent(iframe);
    // Triggered by context.updateDimensions() inside the iframe.
    listenFor(
      iframe,
      'embed-size',
      (data) => {
        if (!this.element.hasAttribute('inline')) {
          // Don't change the width if not inlined.
          data['width'] = undefined;
        }
        Services.mutatorForDoc(this.getAmpDoc()).forceChangeSize(
          this.element,
          data['height'],
          data['width']
        );
      },
      /* opt_is3P */ true
    );
    this.element.appendChild(iframe);
    this.iframe_ = iframe;
    return this.loadPromise(iframe);
  }

  /**
   * Removes mathml iframe.
   *
   * @return {boolean}
   */
  unlayoutCallback() {
    if (this.iframe_) {
      removeElement(this.iframe_);
      this.iframe_ = null;
    }
    return true;
  }

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

AMP.extension('amp-mathml', '0.1', (AMP) => {
  AMP.registerElement('amp-mathml', AmpMathml, CSS);
});


text:
#pragma once
#include <aws/cloudsearch/CloudSearch_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Xml
{
  class XmlNode;
} // namespace Xml
} // namespace Utils
namespace CloudSearch
{
namespace Model
{

  /**
   *
Options for a field that contains an array of text strings. Present if
   * IndexFieldType specifies the field is of type
   * text-array. A text-array field is always searchable.
   * All options are enabled by default.

See Also:
   AWS
   * API Reference

   */
  class AWS_CLOUDSEARCH_API TextArrayOptions
  {
  public:
    TextArrayOptions();
    TextArrayOptions(const Aws::Utils::Xml::XmlNode& xmlNode);
    TextArrayOptions& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);

    void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
    void OutputToStream(Aws::OStream& oStream, const char* location) const;

    /**
     * A value to use for the field if the field isn't specified for a document.
     */
    inline const Aws::String& GetDefaultValue() const{ return m_defaultValue; }

    /**
     * A value to use for the field if the field isn't specified for a document.
     */
    inline void SetDefaultValue(const Aws::String& value) { m_defaultValueHasBeenSet = true; m_defaultValue = value; }

    /**
     * A value to use for the field if the field isn't specified for a document.
     */
    inline void SetDefaultValue(Aws::String&& value) { m_defaultValueHasBeenSet = true; m_defaultValue = std::move(value); }

    /**
     * A value to use for the field if the field isn't specified for a document.
     */
    inline void SetDefaultValue(const char* value) { m_defaultValueHasBeenSet = true; m_defaultValue.assign(value); }

    /**
     * A value to use for the field if the field isn't specified for a document.
     */
    inline TextArrayOptions& WithDefaultValue(const Aws::String& value) { SetDefaultValue(value); return *this;}

    /**
     * A value to use for the field if the field isn't specified for a document.
     */
    inline TextArrayOptions& WithDefaultValue(Aws::String&& value) { SetDefaultValue(std::move(value)); return *this;}

    /**
     * A value to use for the field if the field isn't specified for a document.
     */
    inline TextArrayOptions& WithDefaultValue(const char* value) { SetDefaultValue(value); return *this;}

    /**
     *
A list of source fields to map to the field.

     */
    inline const Aws::String& GetSourceFields() const{ return m_sourceFields; }

    /**
     *
A list of source fields to map to the field.

     */
    inline void SetSourceFields(const Aws::String& value) { m_sourceFieldsHasBeenSet = true; m_sourceFields = value; }

    /**
     *
A list of source fields to map to the field.

     */
    inline void SetSourceFields(Aws::String&& value) { m_sourceFieldsHasBeenSet = true; m_sourceFields = std::move(value); }

    /**
     *
A list of source fields to map to the field.

     */
    inline void SetSourceFields(const char* value) { m_sourceFieldsHasBeenSet = true; m_sourceFields.assign(value); }

    /**
     *
A list of source fields to map to the field.

     */
    inline TextArrayOptions& WithSourceFields(const Aws::String& value) { SetSourceFields(value); return *this;}

    /**
     *
A list of source fields to map to the field.

     */
    inline TextArrayOptions& WithSourceFields(Aws::String&& value) { SetSourceFields(std::move(value)); return *this;}

    /**
     *
A list of source fields to map to the field.

     */
    inline TextArrayOptions& WithSourceFields(const char* value) { SetSourceFields(value); return *this;}

    /**
     *
Whether the contents of the field can be returned in the search results.

     */
    inline bool GetReturnEnabled() const{ return m_returnEnabled; }

    /**
     *
Whether the contents of the field can be returned in the search results.

     */
    inline void SetReturnEnabled(bool value) { m_returnEnabledHasBeenSet = true; m_returnEnabled = value; }

    /**
     *
Whether the contents of the field can be returned in the search results.

     */
    inline TextArrayOptions& WithReturnEnabled(bool value) { SetReturnEnabled(value); return *this;}

    /**
     *
Whether highlights can be returned for the field.

     */
    inline bool GetHighlightEnabled() const{ return m_highlightEnabled; }

    /**
     *
Whether highlights can be returned for the field.

     */
    inline void SetHighlightEnabled(bool value) { m_highlightEnabledHasBeenSet = true; m_highlightEnabled = value; }

    /**
     *
Whether highlights can be returned for the field.

     */
    inline TextArrayOptions& WithHighlightEnabled(bool value) { SetHighlightEnabled(value); return *this;}

    /**
     *
The name of an analysis scheme for a text-array field.

     */
    inline const Aws::String& GetAnalysisScheme() const{ return m_analysisScheme; }

    /**
     *
The name of an analysis scheme for a text-array field.

     */
    inline void SetAnalysisScheme(const Aws::String& value) { m_analysisSchemeHasBeenSet = true; m_analysisScheme = value; }

    /**
     *
The name of an analysis scheme for a text-array field.

     */
    inline void SetAnalysisScheme(Aws::String&& value) { m_analysisSchemeHasBeenSet = true; m_analysisScheme = std::move(value); }

    /**
     *
The name of an analysis scheme for a text-array field.

     */
    inline void SetAnalysisScheme(const char* value) { m_analysisSchemeHasBeenSet = true; m_analysisScheme.assign(value); }

    /**
     *
The name of an analysis scheme for a text-array field.

     */
    inline TextArrayOptions& WithAnalysisScheme(const Aws::String& value) { SetAnalysisScheme(value); return *this;}

    /**
     *
The name of an analysis scheme for a text-array field.

     */
    inline TextArrayOptions& WithAnalysisScheme(Aws::String&& value) { SetAnalysisScheme(std::move(value)); return *this;}

    /**
     *
The name of an analysis scheme for a text-array field.

     */
    inline TextArrayOptions& WithAnalysisScheme(const char* value) { SetAnalysisScheme(value); return *this;}

  private:
    Aws::String m_defaultValue;
    bool m_defaultValueHasBeenSet;
    Aws::String m_sourceFields;
    bool m_sourceFieldsHasBeenSet;
    bool m_returnEnabled;
    bool m_returnEnabledHasBeenSet;
    bool m_highlightEnabled;
    bool m_highlightEnabledHasBeenSet;
    Aws::String m_analysisScheme;
    bool m_analysisSchemeHasBeenSet;
  };

} // namespace Model
} // namespace CloudSearch
} // namespace Aws


text:
const storePlugin = store => app => {
    // TODO: check store is a store indeed
    app.set('store', store);
    app.set('storeState', store.getState());
    store.subscribe(() => app.set('storeState', store.getState()));
};

export default storePlugin;


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using NSubstitute;
using NUnit.Framework;
using Wyam.Common;
using Wyam.Core;
using Wyam.Core.Modules;

namespace Wyam.Modules.Razor.Tests
{
    [TestFixture]
    public class RazorFixture
    {
        [Test]
        public void SimpleTemplate()
        {
            // Given
            string inputFolder = Path.Combine(Environment.CurrentDirectory, @".\Input");
            if (!Directory.Exists(inputFolder))
            {
                Directory.CreateDirectory(inputFolder);
            }
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.RootFolder.Returns(Environment.CurrentDirectory);
            context.InputFolder.Returns(inputFolder);
            Engine engine = new Engine();
            engine.Configure();
            context.Assemblies.Returns(engine.Assemblies);
            IDocument document = Substitute.For<IDocument>();
            List<string> items = new List<string>();
            document
                .When(x => x.Clone(Arg.Any<string>()))
                .Do(x => items.Add(x.Arg<string>()));
            document.GetStream().Returns(new MemoryStream(Encoding.UTF8.GetBytes(@"@for(int c = 0 ; c < 5 ; c++) {
@c
 }")));
            Razor razor = new Razor();

            // When
            razor.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            document.Received().Clone(Arg.Any<string>());
            Assert.AreEqual(1, items.Count());
            Assert.AreEqual("
0

1

2

3

4
 ", items.First());
        }

        [Test]
        public void Metadata()
        {
            // Given
            string inputFolder = Path.Combine(Environment.CurrentDirectory, @".\Input");
            if (!Directory.Exists(inputFolder))
            {
                Directory.CreateDirectory(inputFolder);
            }
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.RootFolder.Returns(Environment.CurrentDirectory);
            context.InputFolder.Returns(inputFolder);
            Engine engine = new Engine();
            engine.Configure();
            context.Assemblies.Returns(engine.Assemblies);
            IDocument document = Substitute.For<IDocument>();
            document.Metadata["MyKey"].Returns("MyValue");
            List<string> items = new List<string>();
            document
                .When(x => x.Clone(Arg.Any<string>()))
                .Do(x => items.Add(x.Arg<string>()));
            document.GetStream().Returns(new MemoryStream(Encoding.UTF8.GetBytes(@"
@Metadata[""MyKey""]
")));
            Razor razor = new Razor();

            // When
            razor.Execute(new[] { document }, context).ToList();

            // Then
            document.Received().Clone(Arg.Any<string>());
            Assert.AreEqual(1, items.Count());
            Assert.AreEqual("
MyValue
", items.First());
        }

        [Test]
        public void LoadSimpleTemplateFile()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"SimpleTemplate\Test.cshtml");
            Razor razor = new Razor();
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual(@"
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }

        [Test]
        public void LoadLayoutFile()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"Layout\Test.cshtml");
            Razor razor = new Razor();
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual("LAYOUT\r\n\r\n
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }

        [Test]
        public void LoadViewStartAndLayoutFile()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"ViewStartAndLayout\Test.cshtml");
            Razor razor = new Razor();
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual("LAYOUT\r\n
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }

        [Test]
        public void AlternateViewStartPath()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"AlternateViewStartPath\Test.cshtml");
            Razor razor = new Razor().SetViewStart(@"AlternateViewStart\_ViewStart.cshtml");
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual("LAYOUT\r\n
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }

        [Test]
        public void IgnoresUnderscoresByDefault()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"IgnoreUnderscores\*.cshtml");
            Razor razor = new Razor();
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual("LAYOUT\r\n\r\n
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }

        [Test]
        public void AlternateIgnorePrefix()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"AlternateIgnorePrefix\*.cshtml");
            Razor razor = new Razor().IgnorePrefix("Ignore");
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual(@"
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }

        [Test]
        public void RenderLayoutSection()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"LayoutWithSection\Test.cshtml");
            Razor razor = new Razor();
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual("LAYOUT\r\n\r\n
Section Content
\r\n\r\n\r\n
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }

        [Test]
        public void RenderLayoutSectionOnMultipleExecution()
        {
            // Given
            Engine engine = new Engine();
            engine.InputFolder = @"TestFiles\Input\";
            ReadFiles readFiles = new ReadFiles(@"LayoutWithSection\Test.cshtml");
            Razor razor = new Razor();
            Meta meta = new Meta("Content", (x, y) => x.Content);
            engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

            // When
            engine.Execute();
            engine.Execute();

            // Then
            Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
            Assert.AreEqual("LAYOUT\r\n\r\n
Section Content
\r\n\r\n\r\n
This is a test
", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
        }
    }
}


text:
package net.fortuna.ical4j.transform.rfc5545;

import net.fortuna.ical4j.model.property.TzId;

/**
 *
 * @author daniel grigore
 * @author corneliu dobrota
 */
public class TzIdRule implements Rfc5545PropertyRule<TzId> {

    @Override
    public void applyTo(TzId element) {
        TzHelper.correctTzValueOf(element);

    }

    @Override
    public Class<TzId> getSupportedType() {
        return TzId.class;
    }
}


text:
#ifndef _DEFINES_H_
#define _DEFINES_H_

#ifndef SCUT_WIN32

#if defined(BOOL)
#undef BOOL
#endif
//	typedef signed char BOOL;

	typedef unsigned int UINT;
	typedef void* HANDLE;
#if defined(DWORD)  //ANDROID NDKÏÂÃæ»áÓÐÖض¨Òå
#undef DWORD
#endif
	typedef unsigned long DWORD;
	typedef unsigned short      WORD;
	typedef unsigned char       BYTE;
	typedef DWORD   COLORREF;
	typedef DWORD   *LPCOLORREF;
	typedef void * LPVOID;
	typedef float               FLOAT;
	typedef int                 INT;
	typedef unsigned int        UINT;
	typedef unsigned int        *PUINT;

	typedef long long INT64;

	typedef char CHAR;
	typedef short SHORT;
	typedef long LONG;

	#define CP_ACP 0
#ifndef MAX_PATH
	#define MAX_PATH          260
#endif

	#ifndef IN
	#define IN
	#endif

	#ifndef OUT
	#define OUT
	#endif

	//#define strnicmp strncasecmp

	#define FALSE 0
	#define TRUE  1

	#ifdef SCUT_UPHONE
		#ifndef WIN32
			typedef struct tagSIZE
			{
				LONG        cx;
				LONG        cy;
			} SIZE, *PSIZE, *LPSIZE;

			#define TEXT(quote) quote   // r_winnt

			#define RGB(r,g,b)          ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
		#endif
	#endif

	#ifdef _UNICODE
		#ifndef LPCTSTR
		typedef const wchar_t *LPCTSTR;
		#endif

		#ifndef LPTSTR
		typedef wchar_t* LPTSTR;
		#endif

		#ifndef TCHAR
				typedef wchar_t TCHAR;
		#endif
	#else
		#ifndef LPCTSTR
		typedef const char *LPCTSTR;
		#endif

		#ifndef LPTSTR
		typedef char* LPTSTR;
		#endif

		#ifndef TCHAR
				typedef char TCHAR;
		#endif
	#endif

	//#ifndef LPCSTR
	//typedef const char *LPCSTR;
	//#endif

	////typedef wchar_t TCHAR;
	//typedef const wchar_t *LPCWSTR;
	//typedef unsigned char _TXCHAR;

	#define SS_ANSI

	#ifdef DEBUG
	# define TRACE printf
	#else
	# define TRACE(str)
	#endif

#else
	#pragma warning (disable:4786) // needed by StdString.h
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

//#include "StdString.h"

#include "ScutString.h"

#define nvl(str1, str2) (str1 != NULL ? str1 : str2)

#define SAFE_FREE(mem) if (mem != NULL) { free(mem); mem = NULL; }

#ifdef SCUT_IPHONE

#endif

#endif


text:
#ifndef PROGDEFS_H
#define PROGDEFS_H
#ifdef _WIN32
#pragma once
#endif

typedef struct
{
	float		time;
	float		frametime;
	float		force_retouch;
	string_t	mapname;
	string_t	startspot;
	float		deathmatch;
	float		coop;
	float		teamplay;
	float		serverflags;
	float		found_secrets;
	vec3_t		v_forward;
	vec3_t		v_up;
	vec3_t		v_right;
	float		trace_allsolid;
	float		trace_startsolid;
	float		trace_fraction;
	vec3_t		trace_endpos;
	vec3_t		trace_plane_normal;
	float		trace_plane_dist;
	edict_t		*trace_ent;
	float		trace_inopen;
	float		trace_inwater;
	int			trace_hitgroup;
	int			trace_flags;
	int			msg_entity;
	int			cdAudioTrack;
	int			maxClients;
	int			maxEntities;
	const char	*pStringBase;

	void		*pSaveData;
	vec3_t		vecLandmarkOffset;
} globalvars_t;

typedef struct entvars_s
{
	string_t	classname;
	string_t	globalname;

	vec3_t		origin;
	vec3_t		oldorigin;
	vec3_t		velocity;
	vec3_t		basevelocity;
	vec3_t      clbasevelocity;  // Base velocity that was passed in to server physics so
							     //  client can predict conveyors correctly.  Server zeroes it, so we need to store here, too.
	vec3_t		movedir;

	vec3_t		angles;			// Model angles
	vec3_t		avelocity;		// angle velocity (degrees per second)
	vec3_t		punchangle;		// auto-decaying view angle adjustment
	vec3_t		v_angle;		// Viewing angle (player only)

	// For parametric entities
	vec3_t		endpos;
	vec3_t		startpos;
	float		impacttime;
	float		starttime;

	int			fixangle;		// 0:nothing, 1:force view angles, 2:add avelocity
	float		idealpitch;
	float		pitch_speed;
	float		ideal_yaw;
	float		yaw_speed;

	int			modelindex;
	string_t	model;

	int			viewmodel;		// player's viewmodel
	int			weaponmodel;	// what other players see

	vec3_t		absmin;		// BB max translated to world coord
	vec3_t		absmax;		// BB max translated to world coord
	vec3_t		mins;		// local BB min
	vec3_t		maxs;		// local BB max
	vec3_t		size;		// maxs - mins

	float		ltime;
	float		nextthink;

	int			movetype;
	int			solid;

	int			skin;
	int			body;			// sub-model selection for studiomodels
	int 		effects;

	float		gravity;		// % of "normal" gravity
	float		friction;		// inverse elasticity of MOVETYPE_BOUNCE

	int			light_level;

	int			sequence;		// animation sequence
	int			gaitsequence;	// movement animation sequence for player (0 for none)
	float		frame;			// % playback position in animation sequences (0..255)
	float		animtime;		// world time when frame was set
	float		framerate;		// animation playback rate (-8x to 8x)
	byte		controller[4];	// bone controller setting (0..255)
	byte		blending[2];	// blending amount between sub-sequences (0..255)

	float		scale;			// sprite rendering scale (0..255)

	int			rendermode;
	float		renderamt;
	vec3_t		rendercolor;
	int			renderfx;

	float		health;
	float		frags;
	int			weapons;  // bit mask for available weapons
	float		takedamage;

	int			deadflag;
	vec3_t		view_ofs;	// eye position

	int			button;
	int			impulse;

	edict_t		*chain;			// Entity pointer when linked into a linked list
	edict_t		*dmg_inflictor;
	edict_t		*enemy;
	edict_t		*aiment;		// entity pointer when MOVETYPE_FOLLOW
	edict_t		*owner;
	edict_t		*groundentity;

	int			spawnflags;
	int			flags;

	int			colormap;		// lowbyte topcolor, highbyte bottomcolor
	int			team;

	float		max_health;
	float		teleport_time;
	float		armortype;
	float		armorvalue;
	int			waterlevel;
	int			watertype;

	string_t	target;
	string_t	targetname;
	string_t	netname;
	string_t	message;

	float		dmg_take;
	float		dmg_save;
	float		dmg;
	float		dmgtime;

	string_t	noise;
	string_t	noise1;
	string_t	noise2;
	string_t	noise3;

	float		speed;
	float		air_finished;
	float		pain_finished;
	float		radsuit_finished;

	edict_t		*pContainingEntity;

	int			playerclass;
	float		maxspeed;

	float		fov;
	int			weaponanim;

	int			pushmsec;

	int			bInDuck;
	int			flTimeStepSound;
	int			flSwimTime;
	int			flDuckTime;
	int			iStepLeft;
	float		flFallVelocity;

	int			gamestate;

	int			oldbuttons;

	int			groupinfo;

	// For mods
	int			iuser1;
	int			iuser2;
	int			iuser3;
	int			iuser4;
	float		fuser1;
	float		fuser2;
	float		fuser3;
	float		fuser4;
	vec3_t		vuser1;
	vec3_t		vuser2;
	vec3_t		vuser3;
	vec3_t		vuser4;
	edict_t		*euser1;
	edict_t		*euser2;
	edict_t		*euser3;
	edict_t		*euser4;
} entvars_t;

#endif // PROGDEFS_H


text:
<?php

namespace MichalKvasnicak\Bundle\OAuth2ServerMongoDBBundle\DependencyInjection\Compiler;

use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class DocumentManagerPass implements CompilerPassInterface
{

    /**
     * You can modify the container here before it is dumped to PHP code.
     *
     * @param ContainerBuilder $container
     *
     * @api
     */
    public function process(ContainerBuilder $container)
    {
        $documentManagerServiceName = $container->getParameter('o_auth2_server_mongo_db.document_manager');

        $service = $container->getDefinition($documentManagerServiceName);
        $class = 'Doctrine\ODM\MongoDB\DocumentManager';
        $serviceClass = $service->getClass();

        if (!(strcmp($serviceClass, $class) == 0 || is_subclass_of($serviceClass, $class))) {
            throw new InvalidConfigurationException(
                "The service $documentManagerServiceName is not instance of Doctrine\\ODM\\MongoDB\\DocumentManager."
            );
        }
    }
}