text:
package org.robolectric.shadows;

import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.util.StateSet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

@Implements(StateListDrawable.class)
public class ShadowStateListDrawable extends ShadowDrawable {
  private final Map<Integer, Integer> stateToResource = new HashMap<>();
  private final Map<List<Integer>, Drawable> stateToDrawable = new HashMap<>();

  public void addState(int stateId, int resId) {
    stateToResource.put(stateId, resId);
  }

  public int getResourceIdForState(int stateId) {
    return stateToResource.get(stateId);
  }

  @Implementation
  public void addState(int[] stateSet, Drawable drawable) {
    stateToDrawable.put(createStateList(stateSet), drawable);
  }

  @Implementation
  public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException {
  }

  /**
   * Non Android accessor to retrieve drawable added for a specific state.
   *
   * @param stateSet Int array describing the state
   * @return Drawable added via {@link #addState(int[], android.graphics.drawable.Drawable)}
   */
  public Drawable getDrawableForState(int[] stateSet) {
    return stateToDrawable.get(createStateList(stateSet));
  }

  private List<Integer> createStateList(int[] stateSet) {
    List<Integer> stateList = new ArrayList<>();
    if (stateSet == StateSet.WILD_CARD) {
      stateList.add(-1);
    } else {
      for (int state : stateSet) {
        stateList.add(state);
      }
    }

    return stateList;
  }
}


text:
class Engine < ActiveRecord::Base
  belongs_to :my_car, :class_name => 'Car', :foreign_key => 'car_id',  :counter_cache => :engines_count
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

Nested Iframe test


text:
template <typename V, typename I>
class IndirectVectorClosure : public Vector<IndirectVectorClosure<V, I> > {
    typedef IndirectVectorClosure<V, I> SelfT;

public:
    typedef typename TypeInfo<V>::ElementType ElementType;

    class ConstIterator {
    public:
        ConstIterator(typename Ref<V>::Type v, typename I::ConstIterator i)
          : _v(v), _i(i) { }
        ConstIterator & operator++()      { ++_i; return *this; }
        ElementType     operator*() const { return _v[*_i]; }
        bool operator==(const ConstIterator &i) const { return i._i == _i; }
        bool operator!=(const ConstIterator &i) const { return !operator==(i); }

    private:
        typename Ref<V>::Type     _v;
        typename I::ConstIterator _i;
    };

    IndirectVectorClosure(typename Ref<V>::Type v, typename Ref<I>::Type i)
      : _v(v.impl()), _i(i.impl()) { }
    size_t        length() const { return _i.length(); }
    ConstIterator begin() const  { return ConstIterator(_v, _i.begin()); }
    ConstIterator end() const    { return ConstIterator(_v, _i.end()); }
    ElementType   operator[](size_t index) const { return _v[_i[index]]; }

    template <typename I2>
    const IndirectVectorClosure<SelfT, I2> operator[](const Vector<I2> &x) const
    { return IndirectVectorClosure<SelfT, I2>(*this, x.impl()); }

private:
    typename Ref<typename V::Impl>::Type _v;
    typename Ref<typename I::Impl>::Type _i;
};

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

template <typename V, typename I>
struct TypeInfo<IndirectVectorClosure<V, I> > {
    typedef IndirectVectorClosure<V, I> Impl;
    typedef typename V::ElementType     ElementType;
};

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

template <typename Op, typename V>
class UnaryVectorClosure : public Vector<UnaryVectorClosure<Op, V> > {
    typedef UnaryVectorClosure<Op,V> SelfT;

public:
    typedef typename TypeInfo<SelfT>::ElementType ElementType;

    class ConstIterator {
    public:
        ConstIterator(typename V::ConstIterator i) : _i(i) { }
        ConstIterator & operator++() { ++_i; return *this; }
        ElementType     operator*() const { return Op::Eval(*_i); }
        bool operator==(const ConstIterator &i) const { return i._i == _i; }
        bool operator!=(const ConstIterator &i) const { return !operator==(i); }

    private:
        typename V::ConstIterator _i;
    };

    UnaryVectorClosure(typename Ref<V>::Type v) : _v(v.impl()) { }
    size_t        length() const { return _v.length(); }
    ConstIterator begin() const  { return ConstIterator(_v.begin()); }
    ConstIterator end() const    { return ConstIterator(_v.end()); }
    ElementType   operator[](size_t i) const { return Op::Eval(_v[i]); }

    template <typename I>
    const IndirectVectorClosure<SelfT, I> operator[](const Vector<I> &x) const
    { return IndirectVectorClosure<SelfT, I>(*this, x.impl()); }

private:
    typename Ref<typename V::Impl>::Type _v;
};

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

template <typename Op, typename V>
struct TypeInfo<UnaryVectorClosure<Op, V> > {
    typedef UnaryVectorClosure<Op, V> Impl;
    typedef typename V::ElementType   ElementType;
};

template <typename V>
struct TypeInfo<UnaryVectorClosure<OpDouble, V> > {
    typedef UnaryVectorClosure<OpDouble, V> Impl;
    typedef double                          ElementType;
};

template <typename V>
struct TypeInfo<UnaryVectorClosure<OpFloat, V> > {
    typedef UnaryVectorClosure<OpFloat, V> Impl;
    typedef float                          ElementType;
};

template <typename V>
struct TypeInfo<UnaryVectorClosure<OpInt, V> > {
    typedef UnaryVectorClosure<OpInt, V> Impl;
    typedef int                          ElementType;
};

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

template <typename Op, typename L, typename R>
class VectorClosure : public Vector<VectorClosure<Op, L, R> > {
    typedef VectorClosure<Op, L, R> SelfT;

public:
    typedef typename TypeInfo<SelfT>::ElementType ElementType;

    class ConstIterator {
    public:
        ConstIterator(typename L::ConstIterator l, typename R::ConstIterator r)
            : _l(l), _r(r) { }
        ConstIterator & operator++()      { ++_l; ++_r; return *this; }
        ElementType     operator*() const { return Op::Eval(*_l, *_r); }
        bool operator==(const ConstIterator &i) const
                                          { return i._l == _l && i._r == _r; }
        bool operator!=(const ConstIterator &i) const { return !operator==(i); }

    private:
        typename L::ConstIterator _l;
        typename R::ConstIterator _r;
    };

    VectorClosure(typename Ref<L>::Type l, typename Ref<R>::Type r)
      : _l(l.impl()), _r(r.impl()) { }
    size_t length() const       { return std::max(_l.length(), _r.length()); }
    ConstIterator begin() const { return ConstIterator(_l.begin(),_r.begin()); }
    ConstIterator end() const   { return ConstIterator(_l.end(), _r.end()); }
    ElementType   operator[](size_t i) const { return Op::Eval(_l[i], _r[i]); }

    template <typename I>
    const IndirectVectorClosure<SelfT, I> operator[](const Vector<I> &x) const
    { return IndirectVectorClosure<SelfT, I>(*this, x.impl()); }

private:
    typename Ref<typename L::Impl>::Type _l;
    typename Ref<typename R::Impl>::Type _r;
};

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

template <typename L, typename R>
struct VPromotion {
    typedef typename Promotion<typename Vector<L>::ElementType,
                               typename Vector<R>::ElementType>::Type Type;
};

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

template <typename Op, typename L, typename R>
struct TypeInfo<VectorClosure<Op, L, R> > {
    typedef VectorClosure<Op, L, R>         Impl;
    typedef typename VPromotion<L, R>::Type ElementType;
};

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

template <typename C, typename T, typename F>
class CondVectorClosure : public Vector<CondVectorClosure<C, T, F> > {
    typedef CondVectorClosure<C, T, F> SelfT;

public:
    typedef typename TypeInfo<SelfT>::ElementType ElementType;

    class ConstIterator {
    public:
        ConstIterator(typename C::ConstIterator c, typename T::ConstIterator t,
                      typename F::ConstIterator f)
            : _c(c), _t(t), _f(f) { }
        ConstIterator & operator++()      { ++_c; ++_t; ++_f; return *this; }
        ElementType     operator*() const { return *_c ? *_t : *_f; }
        bool operator==(const ConstIterator &i) const
                                          { return i._c == _c; }
        bool operator!=(const ConstIterator &i) const { return !operator==(i); }

    private:
        typename C::ConstIterator _c;
        typename T::ConstIterator _t;
        typename F::ConstIterator _f;
    };

    CondVectorClosure(typename Ref<C>::Type c, typename Ref<T>::Type t,
                      typename Ref<F>::Type f) : _c(c), _t(t), _f(f) { }
    size_t        length() const { return _c.length(); }
    ConstIterator begin() const
      { return ConstIterator(_c.begin(), _t.begin(), _f.begin()); }
    ConstIterator end() const
      { return ConstIterator(_c.end(), _t.end(), _f.end()); }
    ElementType   operator[](size_t i) const { return _c[i] ? _t[i] : _f[i]; }

private:
    typename Ref<typename C::Impl>::Type _c;
    typename Ref<typename T::Impl>::Type _t;
    typename Ref<typename F::Impl>::Type _f;
};

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

template <typename C, typename T, typename F>
struct TypeInfo<CondVectorClosure<C, T, F> > {
    typedef CondVectorClosure<C, T, F>      Impl;
    typedef typename VPromotion<T, F>::Type ElementType;
};

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

template <typename V, typename M>
class MaskedVectorClosure {
public:
    MaskedVectorClosure(V &v, typename Ref<M>::Type m)
      : _v(v.impl()), _m(m.impl()) { }
    size_t                               length() const { return _v.length(); }
    typename V::Impl &                   vector()       { return _v; }
    typename Ref<typename M::Impl>::Type mask() const   { return _m; }

    template <typename RHS>
    void operator=(const Vector<RHS> &rhs) { MaskAssign(_m, rhs.impl(), _v); }
    void set(typename V::ElementType value)
      { for (size_t i = 0; i < _v.length(); i++) if (_m[i]) _v[i] = 0; }

private:
    typename V::Impl &                   _v;
    typename Ref<typename M::Impl>::Type _m;
};

#endif // VECTORCLOSURES_H


text:
<?php
namespace Icecave\Pasta\AST\Func;

use Icecave\Pasta\AST\Expr\IExpression;
use Icecave\Pasta\AST\Identifier;
use Icecave\Pasta\AST\Node;

class Parameter extends Node
{
    public function __construct(Identifier $name, TypeHint $typeHint = null)
    {
        $this->name = $name;
        $this->typeHint = $typeHint;
        $this->isOptional = false;
        $this->defaultValue = null;
    }

    public function name()
    {
        return $this->name;
    }

    public function setName(Identifier $name)
    {
        $this->name = $name;
    }

    public function typeHint()
    {
        return $this->typeHint;
    }

    public function setTypeHint(TypeHint $typeHint = null)
    {
        $this->typeHint = $typeHint;
    }

    public function isOptional()
    {
        return $this->isOptional;
    }

    public function defaultValue()
    {
        return $this->defaultValue;
    }

    public function setDefaultValue(IExpression $defaultValue)
    {
        $this->isOptional = true;
        $this->defaultValue = $defaultValue;
    }

    public function clearDefaultValue()
    {
        $this->isOptional = false;
        $this->defaultValue = null;
    }

    private $name;
    private $typeHint;
    private $isOptional;
    private $defaultValue;
}


text:
<?php

/**
 *      This file is a test suite to run all unit tests
 */
print "PHP Version: ".phpversion()."\n";
print "Memory: ". ini_get('memory_limit')."\n";

require_once 'PHPUnit/Framework.php';

/**
 * Class for the All test suite
 */
class odtPHPSuite
{
	public static function suite()
    {
		$suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');

        require_once dirname(__FILE__).'/odfTest.php';
		$suite->addTestSuite('OdfTest');

        require_once dirname(__FILE__).'/pclZipProxyTest.php';
        $suite->addTestSuite('PclZipProxyTest');

        require_once dirname(__FILE__).'/phpZipProxyTest.php';
        $suite->addTestSuite('PhpZipProxyTest');

        return $suite;
    }
}

?>


text:
package io.vantiq.client.internal;

import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.RecordedRequest;
import io.vantiq.client.VantiqError;
import io.vantiq.client.VantiqResponse;
import io.vantiq.client.VantiqTestBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.util.Collections;
import java.util.HashMap;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.*;

/**
 * Mocked unit tests that exercise the connection and
 * authentication support for VantiqSession.
 */
public class VantiqSessionConnectAuthTest extends VantiqTestBase {

    private VantiqSession session;

    @Before
    public void setUpSession() {
        session = new VantiqSession(server.url("/").toString());
    }

    @After
    public void tearDownSession() {
        session = null;
    }

    @Test
    public void testAuthenticate() throws Exception {
        server.enqueue(new MockResponse()
                               .setResponseCode(200)
                               .setHeader("Content-Type", "application/json")
                               .setBody(new JsonObjectBuilder()
                                    .addProperty("accessToken", "abc123")
                                    .json()));

        session.authenticate(USERNAME, PASSWORD, handler);
        waitForCompletion();
        assertTrue("Successful response",   handler.success);
        assertTrue("Session authenticated", session.isAuthenticated());
        assertThat("Valid access token",    session.getAccessToken(), is("abc123"));
    }

    @Test
    public void testHandleAuthenticationFailure() throws Exception {
        server.enqueue(new MockResponse()
                               .setResponseCode(401)
                               .setHeader("Content-Type", "application/json")
                               .setBody(toJson(Collections.singletonList(new VantiqError(
                                   "io.vantiq.server.error",
                                   "Unauthorized",
                                   Collections.emptyList()
                               )))));

        session.authenticate("bad", "user", handler);
        waitForCompletion();

        assertTrue("Should not be success",     !handler.success);
        assertTrue("Should be error",           handler.error);
        assertTrue("Session not authenticated", !session.isAuthenticated());
        assertThat("Should be no access token", session.getAccessToken(), is(nullValue()));
        assertThat("HTTP Status", handler.getStatusCode(),              is(401));
        assertThat("Error code",  handler.getErrors().get(0).getCode(), is("io.vantiq.server.error"));
    }

    @Test
    public void testPassTokenOnAuthenticatedSession() throws Exception {
        // First authenticate, then issue request
        server.enqueue(new MockResponse()
                               .setResponseCode(200)
                               .setHeader("Content-Type", "application/json")
                               .setBody(new JsonObjectBuilder()
                                    .addProperty("accessToken", "abc123")
                                    .json()));
        server.enqueue(new MockResponse()
                               .setHeader("Content-Type", "application/json")
                               .setResponseCode(200));

        // Issue authentication request
        session.authenticate(USERNAME, PASSWORD, handler);
        waitForCompletion();
        server.takeRequest();

        // Issue subsequent request
        session.get("/resources/types", new HashMap<String, String>(), handler.reset());
        waitForCompletion();
        RecordedRequest request = server.takeRequest();

        assertThat("Correct path", request.getPath(), is("/api/v1/resources/types"));
        assertThat("Ensure token", request.getHeader("Authorization"), is("Bearer " + session.getAccessToken()));
        assertTrue(session.isAuthenticated());
    }

    @Test
    public void testUnauthorizedGet() throws Exception {
        try {
            session.get("/resources/types", null, handler);
            fail("Should not allow unauthenticated requests");
        } catch(IllegalStateException ex) {
            assertThat(ex.getMessage(), is("Not authenticated"));
        }
    }

    @Test
    public void testUnauthorizedPut() throws Exception {
        try {
            session.put("/resources/types/abc123", null, null, handler);
            fail("Should not allow unauthenticated requests");
        } catch(IllegalStateException ex) {
            assertThat(ex.getMessage(), is("Not authenticated"));
        }
    }

    @Test
    public void testUnauthorizedPost() throws Exception {
        try {
            session.post("/resources/types", null, null, handler);
            fail("Should not allow unauthenticated requests");
        } catch(IllegalStateException ex) {
            assertThat(ex.getMessage(), is("Not authenticated"));
        }
    }

    @Test
    public void testUnauthorizedDelete() throws Exception {
        try {
            session.delete("/resources/types/abc123", null, handler);
            fail("Should not allow unauthenticated requests");
        } catch(IllegalStateException ex) {
            assertThat(ex.getMessage(), is("Not authenticated"));
        }
    }

    @Test
    public void testAuthenticateSync() throws Exception {
        server.enqueue(new MockResponse()
                           .setResponseCode(200)
                           .setHeader("Content-Type", "application/json")
                           .setBody(new JsonObjectBuilder()
                                        .addProperty("accessToken", "abc123")
                                        .json()));

        session.authenticate(USERNAME, PASSWORD, null);
        assertTrue("Session authenticated", session.isAuthenticated());
        assertThat("Valid access token",    session.getAccessToken(), is("abc123"));
    }

    @Test
    public void testHandleAuthenticationFailureSync() throws Exception {
        server.enqueue(new MockResponse()
                           .setResponseCode(401)
                           .setHeader("Content-Type", "application/json")
                           .setBody(toJson(Collections.singletonList(new VantiqError(
                               "io.vantiq.server.error",
                               "Unauthorized",
                               Collections.emptyList()
                           )))));

        VantiqResponse response = session.authenticate("bad", "user", null);

        assertTrue("Should not be success",     response.hasErrors());
        assertTrue("Should be error",           !response.hasException());
        assertTrue("Session not authenticated", !session.isAuthenticated());
        assertThat("Should be no access token", session.getAccessToken(), is(nullValue()));
        assertThat("HTTP Status", response.getStatusCode(),              is(401));
        assertThat("Error code",  response.getErrors().get(0).getCode(), is("io.vantiq.server.error"));
    }}


text:
<?php

namespace app\controllers;

use app\entities\course\CourseMaterial;
use app\libraries\CourseMaterialsUtils;
use app\libraries\DateUtils;
use app\libraries\FileUtils;
use app\libraries\response\RedirectResponse;
use app\libraries\response\WebResponse;
use app\libraries\routers\AccessControl;
use app\libraries\response\MultiResponse;
use app\libraries\response\JsonResponse;
use app\views\MiscView;
use Symfony\Component\Routing\Annotation\Route;
use app\models\User;

class MiscController extends AbstractController {

    const GENERIC_NO_ACCESS_MSG = 'You do not have access to this file';

    /**
     * Get the current server time
     *
     * Returns a json string which contains the current server time broken up into year, month, day, hour, minute,
     * second
     *
     * @Route("/server_time")
     */
    public function getServerTime(): JsonResponse {
        return JsonResponse::getSuccessResponse(DateUtils::getServerTimeJson($this->core));
    }

    /**
     * Given a path that may or may not contain the anon_id instead of the user_id return the path containing the user_id
     */
    public function decodeAnonPath($path) {
        $exploded_path = explode("/", $path);
        if (count($exploded_path) < 10) {
            return $path;
        }
        $anon_id = explode("/", $path)[9];
        $correct_user_id = $this->core->getQueries()->getSubmitterIdFromAnonId($anon_id);
        if ($correct_user_id !== null) {
            $path = str_replace($anon_id, $correct_user_id, $path);
        }
        return $path;
    }

    /**
     * @Route("/courses/{_semester}/{_course}/gradeable/{gradeable_id}/encode_pdf")
     * @return MultiResponse
     */
    public function encodePDF($gradeable_id) {
        $id = $_POST['user_id'] ?? null;
        $file_name = $_POST['filename'] ?? null;
        $file_name = html_entity_decode($file_name);
        $gradeable = $this->tryGetGradeable($gradeable_id);
        $submitter = $this->core->getQueries()->getSubmitterById($id);
        $graded_gradeable = $this->core->getQueries()->getGradedGradeableForSubmitter($gradeable, $submitter);
        $active_version = $graded_gradeable->getAutoGradedGradeable()->getActiveVersion();
        $file_path = $this->decodeAnonPath(urldecode($_POST['file_path']));
        $directory = 'invalid';
        if (strpos($file_path, 'submissions') !== false) {
            $directory = 'submissions';
        }
        elseif (strpos($file_path, 'checkout') !== false) {
            $directory = 'checkout';
        }
        $check_path = FileUtils::joinPaths($this->core->getConfig()->getCoursePath(), $directory, $gradeable_id, $id, $active_version);

        if ($gradeable->isGradeByRegistration()) {
            $section = $submitter->getRegistrationSection();
        }
        else {
            $section = $submitter->getRotatingSection();
        }

        if (!str_starts_with($file_path, $check_path)) {
            return MultiResponse::JsonOnlyResponse(
                JsonResponse::getFailResponse("Invalid file path")
            );
        }

        if (!$this->core->getAccess()->canI("path.read", ["dir" => $directory, "path" => $file_path, "gradeable" => $gradeable, "graded_gradeable" => $graded_gradeable, "section" => $section])) {
            return MultiResponse::JsonOnlyResponse(
                JsonResponse::getFailResponse(self::GENERIC_NO_ACCESS_MSG)
            );
        }

        $pdf64 = base64_encode(file_get_contents($file_path));
        return MultiResponse::JsonOnlyResponse(
            JsonResponse::getSuccessResponse($pdf64)
        );
    }

    /**
     * @Route("/courses/{_semester}/{_course}/display_file")
     */
    public function displayFile($dir = null, $path = null, $gradeable_id = null, $user_id = null, $ta_grading = null, $course_material_id = null) {
        $cm = null;
        //Is this per-gradeable?
        if ($course_material_id === null && ($dir !== null && $path !== null)) {
            $path = $this->decodeAnonPath($this->core->getAccess()->resolveDirPath($dir, htmlspecialchars_decode(rawurldecode($path))));
            if ($dir === 'course_materials') {
                $cm = $this->core->getCourseEntityManager()->getRepository(CourseMaterial::class)
                    ->findOneBy(['path' => $path]);
            }
        }
        else {
            $cm = $this->core->getCourseEntityManager()->getRepository(CourseMaterial::class)
                ->findOneBy(['id' => $course_material_id]);
            if ($cm !== null) {
                $path = $cm->getPath();
                $dir = 'course_materials';
            }
            else {
                $path = null;
            }
        }

        if (!is_null($gradeable_id)) {
            $gradeable = $this->tryGetGradeable($gradeable_id, false);
            if ($gradeable === false) {
                return false;
            }
            $graded_gradeable =  $this->tryGetGradedGradeable($gradeable, $user_id, false);
            if ($graded_gradeable === false) {
                return false;
            }
            if (!$this->core->getAccess()->canI("path.read", ["dir" => $dir, "path" => $path, "gradeable" => $gradeable, "graded_gradeable" => $graded_gradeable])) {
                $this->core->getOutput()->showError(self::GENERIC_NO_ACCESS_MSG);
                return false;
            }
        }
        else {
            // Check access through Access library
            if (!$this->core->getAccess()->canI("path.read", ["dir" => $dir, "path" => $path])) {
                $this->core->getOutput()->showError(self::GENERIC_NO_ACCESS_MSG);
                return false;
            }

            if ($dir == 'course_materials' && !$this->core->getUser()->accessGrading()) {
                if ($cm === null) {
                    $access_failure = 'Course material not found';
                }
                else {
                    $access_failure = CourseMaterialsUtils::finalAccessCourseMaterialCheck($this->core, $cm);
                }
                if ($access_failure) {
                    $this->core->getOutput()->showError($access_failure);
                    return false;
                }
            }

            if ($dir === "course_materials") {
                CourseMaterialsUtils::insertCourseMaterialAccess($this->core, $path);
            }
        }

        $file_name = basename($path);
        $corrected_name = pathinfo($path, PATHINFO_DIRNAME) . "/" .  $file_name;
        $mime_type = mime_content_type($corrected_name);
        $file_type = FileUtils::getContentType($file_name);
        $this->core->getOutput()->useHeader(false);
        $this->core->getOutput()->useFooter(false);
        if ($mime_type === "application/pdf" || (str_starts_with($mime_type, "image/") && $mime_type !== "image/svg+xml")) {
            header("Content-type: " . $mime_type);
            header('Content-Disposition: inline; filename="' . $file_name . '"');
            readfile($corrected_name);
            $this->core->getOutput()->renderString($path);
        }
        else {
            $contents = file_get_contents($corrected_name);
            if (!is_null($ta_grading) && $ta_grading === "true") {
                $newlines = substr_count($contents, "\n");
                $carriage_returns = substr_count($contents, "\r");
                if ($newlines + $carriage_returns > 2000) {
                    return new WebResponse(MiscView::class, 'tooLarge');
                }
                $this->core->getOutput()->renderOutput('Misc', 'displayCode', $file_type, $corrected_name, $contents);
            }
            else {
                $this->core->getOutput()->renderOutput('Misc', 'displayFile', $contents);
            }
        }
    }

    /**
     * @Route("/courses/{_semester}/{_course}/read_file")
     */
    public function readFile($dir, $path, $csrf_token = null) {
        // security check
        if (!$this->core->getAccess()->canI("path.read", ["dir" => $dir, "path" => $path])) {
            $this->core->getOutput()->showError(self::GENERIC_NO_ACCESS_MSG);
            return false;
        }

        //Since this can serve raw html files we should make sure they're coming from a valid source
        if (is_null($csrf_token) || !$this->core->checkCsrfToken($csrf_token)) {
            $this->core->getOutput()->showError("Invalid csrf token");
            return false;
        }

        $this->core->getOutput()->useHeader(false);
        $this->core->getOutput()->useFooter(false);

        $mime_type = mime_content_type($path);
        if ($mime_type === 'text/plain') {
            if (substr($path, '-3') === '.js') {
                $mime_type = 'application/javascript';
            }
            elseif (substr($path, '-4') === '.css') {
                $mime_type = 'text/css';
            }
            elseif (substr($path, '-5') === '.html') {
                $mime_type = 'text/html';
            }
        }
        header('Content-type: ' . $mime_type);
        readfile($path);
        return true;
    }

    /**
     * @Route("/courses/{_semester}/{_course}/download")
     */
    public function downloadCourseFile($dir = null, $path = null, $course_material_id = null) {
        // security check
        $cm = null;
        if ($course_material_id === null && ($dir !== null && $path !== null)) {
            $path = $this->decodeAnonPath($this->core->getAccess()->resolveDirPath($dir, htmlspecialchars_decode(rawurldecode($path))));
        }
        elseif ($course_material_id !== null) {
            $cm = $this->core->getCourseEntityManager()->getRepository(CourseMaterial::class)
                ->findOneBy(['id' => $course_material_id]);
            if ($cm !== null) {
                $dir = 'course_materials';
                $path = $cm->getPath();
            }
        }

        if (!$this->core->getAccess()->canI("path.read", ["dir" => $dir, "path" => $path])) {
            $this->core->getOutput()->showError(self::GENERIC_NO_ACCESS_MSG);
            return false;
        }

        if ($dir == 'course_materials' && !$this->core->getUser()->accessGrading()) {
            if ($cm === null) {
                $access_failure = 'Course material not found';
            }
            else {
                $access_failure = CourseMaterialsUtils::finalAccessCourseMaterialCheck($this->core, $cm);
            }
            if ($access_failure) {
                $this->core->getOutput()->showError($access_failure);
                return false;
            }
        }

        if ($dir === "course_materials") {
            CourseMaterialsUtils::insertCourseMaterialAccess($this->core, $path);
        }

        if ($dir == 'submissions') {
            //cannot download scanned images for bulk uploads
            if (
                strpos(basename($path), "upload_page_") !== false
                && FileUtils::getContentType($path) !== "application/pdf"
            ) {
                $this->core->getOutput()->showError(self::GENERIC_NO_ACCESS_MSG);
                return false;
            }
        }

        $filename = pathinfo($path, PATHINFO_BASENAME);
        $this->core->getOutput()->useHeader(false);
        $this->core->getOutput()->useFooter(false);
        header('Content-Type: application/octet-stream');
        header("Content-Transfer-Encoding: Binary");
        header("Content-disposition: attachment; filename=\"{$filename}\"");
        readfile($path);
    }

    /**
     * @Route("/courses/{_semester}/{_course}/gradeable/{gradeable_id}/downloadTestCaseResult")
     */
    public function downloadTestCaseResult(string $gradeable_id, int $version, int $test_case, string $file_name, string $user_id) {
        $gradeable = $this->tryGetGradeable($gradeable_id);
        $graded_gradeable = $this->tryGetGradedGradeable($gradeable, $user_id, false);
        if ($user_id !== $this->core->getUser()->getId()) {
            if (!$this->core->getAccess()->canI("grading.electronic.grade", ["gradeable" => $gradeable, "graded_gradeable" => $graded_gradeable])) {
                $this->core->addErrorMessage("You do not have permission to download this file!");
                return new RedirectResponse($this->core->buildCourseUrl(['gradeable', $gradeable_id]));
            }
        }
        $autograde = $graded_gradeable->getAutoGradedGradeable()->getAutoGradedVersionInstance($version);
        $file_path = null;
        $testcase = $autograde->getTestcases()[$test_case - 1];
        if (!$testcase->getTestcase()->isHidden() && $testcase->hasAutochecks()) {
            foreach ($testcase->getAutochecks() as $autocheck) {
                $path = explode('/', $autocheck->getDiffViewer()->getActualFilename());
                $actual_file_name = array_pop($path);
                if ($file_name === $actual_file_name) {
                    $file_path = $autocheck->getDiffViewer()->getActualFilename();
                    break;
                }
            }
        }
        if ($file_path !== null) {
            if (file_exists($file_path)) {
                $this->core->getOutput()->useHeader(false);
                $this->core->getOutput()->useFooter(false);
                header('Content-Type: application/octet-stream');
                header("Content-Transfer-Encoding: Binary");
                header("Content-disposition: attachment; filename=\"{$file_name}\"");
                readfile($file_path);
            }
            else {
                $this->core->addErrorMessage("That file does not seem to exist");
                return new RedirectResponse($this->core->buildCourseUrl(['gradeable', $gradeable_id]));
            }
        }
        else {
            $this->core->addErrorMessage("That file does not seem to exist");
            return new RedirectResponse($this->core->buildCourseUrl(['gradeable', $gradeable_id]));
        }
    }

    /**
     * @Route("/courses/{_semester}/{_course}/gradeable/{gradeable_id}/download_zip")
     */
    public function downloadSubmissionZip($gradeable_id, $user_id, $version, $is_anon, $origin = null) {

        $anon_id = $user_id;
        if ($is_anon === "true") {
            $user_id = $this->core->getQueries()->getSubmitterIdFromAnonId($anon_id);
        }

        $gradeable = $this->core->getQueries()->getGradeableConfig($gradeable_id);
        if ($gradeable === null) {
            $message = "You do not have access to that page.";
            $this->core->addErrorMessage($message);
            $this->core->redirect($this->core->buildCourseUrl());
        }

        $graded_gradeable = $this->core->getQueries()->getGradedGradeable($gradeable, $user_id, $gradeable->isTeamAssignment());

        if ($gradeable->isTeamAssignment()) {
            $graded_gradeable = $this->core->getQueries()->getGradedGradeable($gradeable, null, $user_id);
        }

        if ($graded_gradeable === null) {
            $message = "You do not have access to that page.";
            $this->core->addErrorMessage($message);
            $this->core->redirect($this->core->buildCourseUrl());
        }

        $gradeable_version = $graded_gradeable->getAutoGradedGradeable()->getAutoGradedVersionInstance($version);

        if ($gradeable_version === null) {
            $message = "You do not have access to that page.";
            $this->core->addErrorMessage($message);
            $this->core->redirect($this->core->buildCourseUrl());
        }

        $folder_names = [];
        //See which directories we are allowed to read.
        if ($this->core->getAccess()->canI("path.read.submissions", ["gradeable" => $gradeable, "graded_gradeable" => $graded_gradeable, "gradeable_version" => $gradeable_version->getVersion()])) {
            //These two have the same check
            $folder_names[] = "submissions";
            $folder_names[] = "checkout";
        }

        // Context of these next two checks is important
        // If the request is coming from the submissions page, then the results and results_public folder
        // should not be included, otherwise include them
        if ($origin != 'submission') {
            if ($this->core->getAccess()->canI("path.read.results", ["gradeable" => $gradeable, "graded_gradeable" => $graded_gradeable, "gradeable_version" => $gradeable_version->getVersion()])) {
                $folder_names[] = "results";
            }
            if ($this->core->getAccess()->canI("path.read.results_public", ["gradeable" => $gradeable, "graded_gradeable" => $graded_gradeable, "gradeable_version" => $gradeable_version->getVersion()])) {
                $folder_names[] = "results_public";
            }
        }

        //No results, no download
        if (count($folder_names) === 0) {
            $message = "You do not have access to that page.";
            $this->core->addErrorMessage($message);
            $this->core->redirect($this->core->buildCourseUrl());
        }

        $this->core->getOutput()->useHeader(false);
        $this->core->getOutput()->useFooter(false);
        $gradeable_path = $this->core->getConfig()->getCoursePath();
        $active_version = $graded_gradeable->getAutoGradedGradeable()->getActiveVersion();
        $version = $version ?? $active_version;

        // TODO: Zip file anonymization is currently done based on access level (students==peers)
        // When single/double blind grading is merged, this will need to be updated.
        if ($this->core->getUser()->getGroup() === User::GROUP_STUDENT) {
            $zip_file_name = $gradeable_id . "_" . $anon_id . "_v" . $version . ".zip";
        }
        else {
            $zip_file_name = $gradeable_id . "_" . $user_id . "_v" . $version . ".zip";
        }

        $options = new \ZipStream\Option\Archive();
        $options->setSendHttpHeaders(true);
        $options->setEnableZip64(false);

        // create a new zipstream object
        $zip_stream = new \ZipStream\ZipStream($zip_file_name, $options);
        foreach ($folder_names as $folder_name) {
            $path = FileUtils::joinPaths($gradeable_path, $folder_name, $gradeable->getId(), $graded_gradeable->getSubmitter()->getId(), $version);
            if (is_dir($path)) {
                $files = new \RecursiveIteratorIterator(
                    new \RecursiveDirectoryIterator($path),
                    \RecursiveIteratorIterator::LEAVES_ONLY
                );
                $zip_stream->addFile($folder_name . "/", "");
                foreach ($files as $name => $file) {
                    // Skip directories (they are added automatically)
                    if ($file->isDir()) {
                        continue;
                    }
                    $file_path = $file->getRealPath();
                    $relative_path = substr($file_path, strlen($path) + 1);
                    if ($this->core->getAccess()->canI("path.read", ["dir" => $folder_name, "path" => $file_path, "gradeable" => $gradeable, "graded_gradeable" => $graded_gradeable, "gradeable_version" => $gradeable_version->getVersion()])) {
                        // For scanned exams, the directories get polluted with the images of the split apart
                        // pages, so we selectively only grab the PDFs there. For all other types,
                        // we can grab all files regardless of type.
                        if ($gradeable->isScannedExam()) {
                            if (mime_content_type($file_path) === 'application/pdf') {
                                $zip_stream->addFileFromPath($folder_name . "/" . $relative_path, $file_path);
                            }
                        }
                        else {
                            $zip_stream->addFileFromPath($folder_name . "/" . $relative_path, $file_path);
                        }
                    }
                }
            }
        }
        $zip_stream->finish();
    }

    /**
     * @Route("/courses/{_semester}/{_course}/gradeable/{gradeable_id}/grading/download_zip")
     * @AccessControl(role="LIMITED_ACCESS_GRADER")
     */
    public function downloadAssignedZips($gradeable_id, $type = null) {
        $zip_file_name = $gradeable_id . "_section_students_" . date("m-d-Y") . ".zip";
        $this->core->getOutput()->useHeader(false);
        $this->core->getOutput()->useFooter(false);
        if (in_array($type, ["all", "results", "active", "both"])) {
            $zip_file_name = $gradeable_id . "_all_students_" . date("m-d-Y") . ".zip";
            if (!($this->core->getUser()->accessFullGrading())) {
                $message = "You do not have access to that page.";
                $this->core->addErrorMessage($message);
                $this->core->redirect($this->core->buildCourseUrl());
            }
        }

        $temp_dir = "/tmp";
        //makes a random zip file name on the server
        $temp_name = uniqid($this->core->getUser()->getId(), true);
        $zip_name = $temp_dir . "/" . $temp_name . ".zip";
        $gradeable = $this->tryGetGradeable($gradeable_id);
        if ($gradeable === false) {
            return;
        }
        $paths = ['submissions'];
        if ($gradeable->isVcs()) {
            //VCS submissions are stored in the checkout directory
            $paths[] = 'checkout';
        }
        if (in_array($type, ["results", "both", "limited_results", "limited_both"])) {
            $paths[] = 'results';
        }

        $options = new \ZipStream\Option\Archive();
        $options->setSendHttpHeaders(true);
        $options->setEnableZip64(false);

        // create a new zipstream object
        $zip_stream = new \ZipStream\ZipStream($zip_file_name, $options);

        foreach ($paths as $path) {
            $gradeable_path = FileUtils::joinPaths(
                $this->core->getConfig()->getCoursePath(),
                $path,
                $gradeable->getId()
            );
            if (in_array($type, ["all", "results"])) {
                $zip_stream->addFile($path . "/", "");
                if (file_exists($gradeable_path)) {
                    if (!is_dir($gradeable_path)) { //if dir is already present, but it's a file
                        $message = "Oops! That page is not available.";
                        $this->core->addErrorMessage($message);
                        $this->core->redirect($this->core->buildCourseUrl());
                    }
                    else {
                        $files = new \RecursiveIteratorIterator(
                            new \RecursiveDirectoryIterator($gradeable_path),
                            \RecursiveIteratorIterator::LEAVES_ONLY
                        );
                        foreach ($files as $name => $file) {
                            // Skip directories (they would be added automatically)
                            if (!$file->isDir() && !$file->isLink()) {
                                // Get real and relative path for current file
                                $filePath = $file->getRealPath();
                                $relativePath = substr($filePath, strlen($gradeable_path) + 1);
                                // Add current file to archive
                                $zip_stream->addFileFromPath($path . "/" . $relativePath, $filePath);
                            }
                        }
                    }
                }
                else { //no dir exists with this name
                    $message = "Oops! That page is not available.";
                    $this->core->addErrorMessage($message);
                    $this->core->redirect($this->core->buildCourseUrl());
                }
            }
            elseif (in_array($type, ["active", "both"])) {
                $zip_stream->addFile($path . "/", "");
                if (file_exists($gradeable_path)) {
                    if (!is_dir($gradeable_path)) { //if dir is already present, but it's a file
                        $message = "Oops! That page is not available.";
                        $this->core->addErrorMessage($message);
                        $this->core->redirect($this->core->buildCourseUrl());
                    }
                    else {
                        $graded_gradeables = $this->core->getQueries()->getGradedGradeables([$gradeable]);

                        foreach ($graded_gradeables as $gg) { //get each graded gradeable
                            $user = $gg->getSubmitter()->getId();
                            $version = $gg->getAutoGradedGradeable()->getActiveVersion();
                            if ($version <= 0) { //if no active version exitsts, continue
                                continue;
                            }
                            $gradeable_path = FileUtils::joinPaths(
                                $this->core->getConfig()->getCoursePath(),
                                $path,
                                $gradeable->getId(),
                                $user,
                                $version
                            );

                            $files = new \RecursiveIteratorIterator(
                                new \RecursiveDirectoryIterator($gradeable_path),
                                \RecursiveIteratorIterator::LEAVES_ONLY
                            );

                            foreach ($files as $name => $file) {
                                // Skip directories (they would be added automatically)
                                if (!$file->isDir()) {
                                    // Get real and relative path for current file
                                    $filePath = $file->getRealPath();
                                    $relativePath = $user . "/" . substr($filePath, strlen($gradeable_path) + 1);

                                    // Add current file to archive
                                    $zip_stream->addFileFromPath($path . "/" . $relativePath, $filePath);
                                }
                            }
                        }
                    }
                }
                else { //no dir exists with this name
                    $message = "Oops! That page is not available.";
                    $this->core->addErrorMessage($message);
                    $this->core->redirect($this->core->buildCourseUrl());
                }
            }
            else {
                //gets the students that are part of the sections
                if ($gradeable->isGradeByRegistration()) {
                    $section_key = "registration_section";
                    $sections = $this->core->getUser()->getGradingRegistrationSections();
                    $students = $this->core->getQueries()->getUsersByRegistrationSections($sections);
                }
                else {
                    $section_key = "rotating_section";
                    $sections = $this->core->getQueries()->getRotatingSectionsForGradeableAndUser(
                        $gradeable->getId(),
                        $this->core->getUser()->getId()
                    );
                    $students = $this->core->getQueries()->getUsersByRotatingSections($sections);
                }
                $students_array = [];
                foreach ($students as $student) {
                    $students_array[] = $student->getId();
                }
                $files = scandir($gradeable_path);
                $arr_length = count($students_array);
                foreach ($files as $file) {
                    for ($x = 0; $x < $arr_length; $x++) {
                        if ($students_array[$x] === $file) {
                            if (in_array($type, ["limited_active", "limited_both"])) {
                                $gg = $this->core->getQueries()->getGradedGradeable($gradeable, $students_array[$x], null);
                                $version = $gg->getAutoGradedGradeable()->getActiveVersion();
                                if ($version <= 0) { //if no active version exitsts, continue
                                    continue;
                                }
                                $temp_path = $gradeable_path . "/" . $file . "/" . $version;
                            }
                            else {
                                $temp_path = $gradeable_path . "/" . $file;
                            }
                            $files_in_folder = new \RecursiveIteratorIterator(
                                new \RecursiveDirectoryIterator($temp_path),
                                \RecursiveIteratorIterator::LEAVES_ONLY
                            );

                            //makes a new directory in the zip to add the files in
                            $zip_stream->addFile($file . "/", "");

                            foreach ($files_in_folder as $name => $file_in_folder) {
                                // Skip directories (they would be added automatically)
                                if (!$file_in_folder->isDir()) {
                                    // Get real and relative path for current file
                                    $filePath = $file_in_folder->getRealPath();
                                    $relativePath = substr($filePath, strlen($temp_path) + 1);

                                    // Add current file to archive
                                    $zip_stream->addFileFromPath($file . "/" . $relativePath, $filePath);
                                }
                            }
                            $x = $arr_length; //cuts the for loop early when found
                        }
                    }
                }
            }
        }
        // Zip archive will be created only after closing object
        $zip_stream->finish();
        header("Content-type: application/zip");
        header("Content-Disposition: attachment; filename=$zip_file_name");
        header("Content-length: " . filesize($zip_name));
        header("Pragma: no-cache");
        header("Expires: 0");
        readfile("$zip_name");
        unlink($zip_name); //deletes the random zip file
    }

    /**
     * @Route("/courses/{_semester}/{_course}/gradeable/{gradeable_id}/bulk/progress")
     */
    public function checkBulkProgress($gradeable_id) {
        $job_path = "/var/local/submitty/daemon_job_queue/";
        $result = [];
        $found = false;
        $job_data = null;
        $complete_count = 0;
        try {
            foreach (scandir($job_path) as $job) {
                if (strpos($job, 'bulk_upload_') !== false) {
                    $found = true;
                }
                else {
                    continue;
                }
                //remove 'bulk_upload_' and '.json' from job file name
                $result[] = substr($job, 11, -5);
            }
            //look in the split upload folder to see what is complete
            $split_uploads = FileUtils::joinPaths($this->core->getConfig()->getCoursePath(), "uploads", "split_pdf", $gradeable_id);
            $sub_dirs = array_filter(glob($split_uploads . '/*'), 'is_dir');
            foreach ($sub_dirs as $dir) {
                foreach (scandir($dir) as $file) {
                    if (pathinfo($file)['extension'] !== "pdf") {
                        continue;
                    }

                    if (strpos($file, "_cover")) {
                        $complete_count++;
                    }
                }
            }
            $result = ['found' => $found, 'job_data' => $result, 'count' => $complete_count];
            return $this->core->getOutput()->renderJsonSuccess($result);
        }
        catch (\Exception $e) {
            return $this->core->getOutput()->renderJsonError($e->getMessage());
        }
    }
}


text:
<?php
/**
 * @author Bryan Jayson Tan <admin@bryantan.info>.
 * @link http://bryantan.info
 * @date 12/20/12
 * @time 11:26 AM
 */
class TweetMaster extends CWidget
{
    /**
     * @var string
     */
    public $username=null;

    /**
     * @var string
     */
    public $query=null;

    /**
     * available option are 'username' and 'query'
     * @var string
     */
    public $type='username';

    /**
     * options for the tweet master
     * @var array
     */
    public $options=array();

    /**
     * @var string
     */
    public $cssFile=null;

    /**
     * @var string
     */
    public $tag='div';

    /**
     * @var array
     */
    public $tagOptions=array();

    /**
     * if id = null, we will generate a new ID
     * @var null
     */
    public $id=null;

    private $_assetsUrl=null;

    public function init(){
        if (!$this->id){
            $this->id=$this->getId();
        }
        if (!$this->username && !$this->query){
            throw new CException("Username or Query cannot be empty!");
        }else if ($this->username && $this->query){
            throw new CException("Username and Query cannot be initialized at the same time!");
        }

        if ($this->type==='username'){
            $this->options['username']=$this->username;
        }else if ($this->type==='query'){
            $this->options['query']=$this->query;
        }
        $this->tagOptions['id']=$this->id;

        $this->registerClientScript();

    }

    public function run(){
        $options=CJSON::encode($this->options);
        Yii::app()->clientScript->registerScript('tweet'.$this->id,"jQuery('#{$this->id}').tweet({$options})");

        echo CHtml::tag($this->tag,$this->tagOptions,'');
    }

    public function registerClientScript(){
        // publish assets
        $this->_assetsUrl=Yii::app()->getAssetManager()->publish(dirname(__FILE__).'/assets');

        Yii::app()->clientScript->registerCoreScript('jquery');
        Yii::app()->clientScript->registerScriptFile($this->_assetsUrl.'/jquery.tweet.js');
        if ($this->cssFile===null){
            Yii::app()->clientScript->registerCssFile($this->_assetsUrl.'/jquery.tweet.css');
        }else{
            Yii::app()->clientScript->registerCssFile($this->cssFile);
        }

    }
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Tetrastigma serrulatum var. lasiogynum W.T.Wang

### Remarks
null


text:
//Copyright (C) 2014  Tom Deseyn

//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.

//This library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//Lesser General Public License for more details.

//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace Tmds.Sdp
{
    class Announcement
    {
        public enum MessageType
        {
            Announcement,
            Deletion
        }
        public byte Version { get; set; }
        public MessageType Type { get; set; }
        public bool IsEncrypted { get; set; }
        public bool IsCompressed { get; set; }
        public ArraySegment<byte> AuthenticationData { get; set; }
        public ushort Hash { get; set; }
        public IPAddress Source { get; set; }
        public string PayloadType { get; set; }
        public ArraySegment<byte> Payload { get; set; }

        public void Decompress()
        {
            if (!IsCompressed)
            {
                return;
            }

            MemoryStream stream = new MemoryStream(Payload.Array, Payload.Offset + 2, Payload.Count - 2);
            DeflateStream deflateStream = new DeflateStream(stream, CompressionMode.Decompress);
            stream = new MemoryStream();
            deflateStream.CopyTo(stream);
            IsCompressed = false;
            Payload = new ArraySegment<byte>(stream.GetBuffer(), 0, (int)stream.Length);
        }
    }
}


text:
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
        "http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
<module>
	<inherits name='com.google.gwt.user.User' />
	<inherits name='com.google.gwt.i18n.I18N' />
	<inherits name='fr.mncc.gwttoolbox.primitives.primitives' />

	<!-- Specify the paths for translatable code -->
	<source path='client' excludes="**/*Test.java" />
</module>


text:
using Concordion.Api.Listener;

namespace Concordion.Internal.Listener
{
    public class RunResultRenderer : ExceptionRenderer, IRunListener
    {
        #region IRunListener Members

        public void SuccessReported(RunSuccessEvent runSuccessEvent)
        {
            runSuccessEvent.Element.AddStyleClass("success").AppendNonBreakingSpaceIfBlank();
        }

        public void FailureReported(RunFailureEvent runFailureEvent)
        {
            runFailureEvent.Element.AddStyleClass("failure").AppendNonBreakingSpaceIfBlank();
        }

        public void IgnoredReported(RunIgnoreEvent runIgnoreEvent)
        {
            runIgnoreEvent.Element.AddStyleClass("ignored").AppendNonBreakingSpaceIfBlank();
        }

        #endregion

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<spirit:component xmlns:xilinx="http://www.xilinx.com"
		xmlns:spirit="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<spirit:vendor>xilinx.com</spirit:vendor>
	<spirit:library>customized_ip</spirit:library>
	<spirit:name>Program_Counter_Constant_0_0</spirit:name>
	<spirit:version>1.0</spirit:version>
	<spirit:model>
		<spirit:views>
			<spirit:view>
				<spirit:name>xilinx_vhdlsynthesis</spirit:name>
				<spirit:displayName>VHDL Synthesis</spirit:displayName>
				<spirit:envIdentifier>vhdlSource:vivado.xilinx.com:synthesis</spirit:envIdentifier>
				<spirit:language>vhdl</spirit:language>
				<spirit:fileSetRef>
					<spirit:localName>xilinx_vhdlsynthesis_view_fileset</spirit:localName>
				</spirit:fileSetRef>
				<spirit:parameters>
					<spirit:parameter>
						<spirit:name>GENtimestamp</spirit:name>
						<spirit:value>Tue Oct 17 05:16:33 UTC 2017</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRC</spirit:name>
						<spirit:value>d9eeb715</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRCversion</spirit:name>
						<spirit:value>1</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRC</spirit:name>
						<spirit:value>bb3df4f1</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRCversion</spirit:name>
						<spirit:value>6</spirit:value>
					</spirit:parameter>
				</spirit:parameters>
			</spirit:view>
			<spirit:view>
				<spirit:name>xilinx_vhdlsynthesiswrapper</spirit:name>
				<spirit:displayName>VHDL Synthesis Wrapper</spirit:displayName>
				<spirit:envIdentifier>vhdlSource:vivado.xilinx.com:synthesis.wrapper</spirit:envIdentifier>
				<spirit:language>vhdl</spirit:language>
				<spirit:fileSetRef>
					<spirit:localName>xilinx_vhdlsynthesiswrapper_view_fileset</spirit:localName>
				</spirit:fileSetRef>
				<spirit:parameters>
					<spirit:parameter>
						<spirit:name>GENtimestamp</spirit:name>
						<spirit:value>Tue Oct 17 05:16:33 UTC 2017</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRC</spirit:name>
						<spirit:value>d9eeb715</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRCversion</spirit:name>
						<spirit:value>1</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRC</spirit:name>
						<spirit:value>bb3df4f1</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRCversion</spirit:name>
						<spirit:value>6</spirit:value>
					</spirit:parameter>
				</spirit:parameters>
			</spirit:view>
			<spirit:view>
				<spirit:name>xilinx_vhdlbehavioralsimulation</spirit:name>
				<spirit:displayName>VHDL Simulation</spirit:displayName>
				<spirit:envIdentifier>vhdlSource:vivado.xilinx.com:simulation</spirit:envIdentifier>
				<spirit:language>vhdl</spirit:language>
				<spirit:fileSetRef>
					<spirit:localName>xilinx_vhdlbehavioralsimulation_view_fileset</spirit:localName>
				</spirit:fileSetRef>
				<spirit:parameters>
					<spirit:parameter>
						<spirit:name>GENtimestamp</spirit:name>
						<spirit:value>Tue Oct 17 05:16:33 UTC 2017</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRC</spirit:name>
						<spirit:value>d9eeb715</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRCversion</spirit:name>
						<spirit:value>1</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRC</spirit:name>
						<spirit:value>7210611c</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRCversion</spirit:name>
						<spirit:value>6</spirit:value>
					</spirit:parameter>
				</spirit:parameters>
			</spirit:view>
			<spirit:view>
				<spirit:name>xilinx_vhdlsimulationwrapper</spirit:name>
				<spirit:displayName>VHDL Simulation Wrapper</spirit:displayName>
				<spirit:envIdentifier>vhdlSource:vivado.xilinx.com:simulation.wrapper</spirit:envIdentifier>
				<spirit:language>vhdl</spirit:language>
				<spirit:fileSetRef>
					<spirit:localName>xilinx_vhdlsimulationwrapper_view_fileset</spirit:localName>
				</spirit:fileSetRef>
				<spirit:parameters>
					<spirit:parameter>
						<spirit:name>GENtimestamp</spirit:name>
						<spirit:value>Tue Oct 17 05:16:33 UTC 2017</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRC</spirit:name>
						<spirit:value>d9eeb715</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>boundaryCRCversion</spirit:name>
						<spirit:value>1</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRC</spirit:name>
						<spirit:value>7210611c</spirit:value>
					</spirit:parameter>
					<spirit:parameter>
						<spirit:name>customizationCRCversion</spirit:name>
						<spirit:value>6</spirit:value>
					</spirit:parameter>
				</spirit:parameters>
			</spirit:view>
		</spirit:views>
		<spirit:ports>
			<spirit:port>
				<spirit:name>dout</spirit:name>
				<spirit:wire>
					<spirit:direction>out</spirit:direction>
					<spirit:vector>
						<spirit:left spirit:format="long"
								spirit:resolve="dependent"
								spirit:dependency="(spirit:decode(id('MODELPARAM_VALUE.CONST_WIDTH')) - 1)">9</spirit:left>
						<spirit:right spirit:format="long">0</spirit:right>
					</spirit:vector>
					<spirit:wireTypeDefs>
						<spirit:wireTypeDef>
							<spirit:typeName>std_logic_vector</spirit:typeName>
							<spirit:viewNameRef>xilinx_vhdlsynthesis</spirit:viewNameRef>
							<spirit:viewNameRef>xilinx_vhdlbehavioralsimulation</spirit:viewNameRef>
						</spirit:wireTypeDef>
					</spirit:wireTypeDefs>
				</spirit:wire>
			</spirit:port>
		</spirit:ports>
		<spirit:modelParameters>
			<spirit:modelParameter xsi:type="spirit:nameValueTypeType"
					spirit:dataType="integer">
				<spirit:name>CONST_VAL</spirit:name>
				<spirit:displayName>Const Val</spirit:displayName>
				<spirit:value spirit:resolve="generated"
						spirit:id="MODELPARAM_VALUE.CONST_VAL">1111111111</spirit:value>
			</spirit:modelParameter>
			<spirit:modelParameter spirit:dataType="integer">
				<spirit:name>CONST_WIDTH</spirit:name>
				<spirit:displayName>Const Width</spirit:displayName>
				<spirit:value spirit:format="long"
						spirit:resolve="generated"
						spirit:id="MODELPARAM_VALUE.CONST_WIDTH">10</spirit:value>
			</spirit:modelParameter>
		</spirit:modelParameters>
	</spirit:model>
	<spirit:fileSets>
		<spirit:fileSet>
			<spirit:name>xilinx_vhdlsynthesis_view_fileset</spirit:name>
			<spirit:file>
				<spirit:name>../../ipshared/e147/xlconstant.vhd</spirit:name>
				<spirit:fileType>vhdlSource</spirit:fileType>
				<spirit:logicalName>work</spirit:logicalName>
			</spirit:file>
		</spirit:fileSet>
		<spirit:fileSet>
			<spirit:name>xilinx_vhdlsynthesiswrapper_view_fileset</spirit:name>
			<spirit:file>
				<spirit:name>sim/Program_Counter_Constant_0_0.vhd</spirit:name>
				<spirit:fileType>vhdlSource</spirit:fileType>
			</spirit:file>
		</spirit:fileSet>
		<spirit:fileSet>
			<spirit:name>xilinx_vhdlbehavioralsimulation_view_fileset</spirit:name>
			<spirit:file>
				<spirit:name>../../ipshared/e147/xlconstant.vhd</spirit:name>
				<spirit:fileType>vhdlSource</spirit:fileType>
				<spirit:logicalName>work</spirit:logicalName>
			</spirit:file>
		</spirit:fileSet>
		<spirit:fileSet>
			<spirit:name>xilinx_vhdlsimulationwrapper_view_fileset</spirit:name>
			<spirit:file>
				<spirit:name>sim/Program_Counter_Constant_0_0.vhd</spirit:name>
				<spirit:fileType>vhdlSource</spirit:fileType>
			</spirit:file>
		</spirit:fileSet>
	</spirit:fileSets>
	<spirit:description>Gives a constant signed value.</spirit:description>
	<spirit:parameters>
		<spirit:parameter>
			<spirit:name>CONST_WIDTH</spirit:name>
			<spirit:displayName>Const Width</spirit:displayName>
			<spirit:value spirit:format="long"
					spirit:resolve="user"
					spirit:id="PARAM_VALUE.CONST_WIDTH"
					spirit:order="1100"
					spirit:minimum="1"
					spirit:maximum="4096"
					spirit:rangeType="long">10</spirit:value>
		</spirit:parameter>
		<spirit:parameter>
			<spirit:name>CONST_VAL</spirit:name>
			<spirit:displayName>Const Val</spirit:displayName>
			<spirit:value spirit:resolve="user"
					spirit:id="PARAM_VALUE.CONST_VAL"
					spirit:order="1200">0x3FF</spirit:value>
		</spirit:parameter>
		<spirit:parameter>
			<spirit:name>Component_Name</spirit:name>
			<spirit:value spirit:resolve="user"
					spirit:id="PARAM_VALUE.Component_Name"
					spirit:order="1">Program_Counter_Constant_0_0</spirit:value>
		</spirit:parameter>
	</spirit:parameters>
	<spirit:vendorExtensions>
		<xilinx:coreExtensions>
			<xilinx:displayName>Constant</xilinx:displayName>
			<xilinx:coreRevision>2</xilinx:coreRevision>
			<xilinx:configElementInfos>
				<xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.CONST_VAL"
						xilinx:valueSource="user"/>
				<xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.CONST_WIDTH"
						xilinx:valueSource="user"/>
			</xilinx:configElementInfos>
		</xilinx:coreExtensions>
		<xilinx:packagingInfo>
			<xilinx:xilinxVersion>2015.1</xilinx:xilinxVersion>
			<xilinx:checksum xilinx:scope="fileGroups"
					xilinx:value="b506dfe0"/>
			<xilinx:checksum xilinx:scope="ports"
					xilinx:value="29239cd1"/>
			<xilinx:checksum xilinx:scope="hdlParameters"
					xilinx:value="3daeed25"/>
			<xilinx:checksum xilinx:scope="parameters"
					xilinx:value="5d3438b5"/>
		</xilinx:packagingInfo>
	</spirit:vendorExtensions>
</spirit:component>


text:
<md-dialog class="dialog-settings" aria-label="Z-med Products" layout="column">
  <form flex="90">
    <md-toolbar flex="nogrow">

        <md-button class="md-icon-button" ng-click="tabsCtrl.cancel()">
          <md-icon md-font-set="material-icons" aria-label="Close dialog">close</md-icon>
        </md-button>

    </md-toolbar>

      <md-input-container flex="45" flex-md="55" flex-xs="55" class="md-block">

        <input type="text" ng-model="search.$" class="md-input" ng-focus="focus=true;blur=false;" ng-blur="blur=true;focus=false;" aria-label="Search for products textfield" blur-on-enter>
      </md-input-container>
      <md-select flex="15" flex-md="25" flex-xs="25" placeholder="{{'FILTER_SELECTION' | translate}}" aria-label="Filter Options" ng-model="search.tag">
        <md-option ng-repeat="tags in tabsCtrl.filterOptions" ng-value="tags.tag">{{tags.name}}</md-option>
      </md-select>

    <md-divider></md-divider>
    <md-dialog-content class="dialog-size" flex layout-padding>
      <md-grid-list md-cols="1" md-cols-sm="4" md-cols-md="9" md-cols-gt-md="12" md-gutter-sm="4px" md-gutter-md="4px" md-gutter-gt-md="8px" md-row-height="1:1">
        <md-grid-tile
          ng-repeat="items in tabsCtrl.products | filter : search | filter : {'tag' : tabsCtrl.filterVal}"
          lazy-repeater="10"
          class="list-background repeated-item"
          md-colspan="1"
          md-rowspan="1"
          md-colspan-sm="2"
          md-rowspan-sm="2"
          md-colspan-md="3"
          md-rowspan-md="3"
          md-colspan-gt-md="3"
          md-rowspan-gt-md="3"
          data-product-tag="{{items.tag}}"
          ng-click="option=option == false ? true : false"
          ng-mouseenter="option=true"
          ng-mouseleave="option=false">

          <md-content ng-show="option" class="product-description" layout-padding flex>
            {{items.description}}
          </md-content>
          <md-grid-tile-footer class="footer-height" ng-hide="option">

{{items.name}}

          </md-grid-tile-footer>
        </md-grid-tile>
      </md-grid-list>
    </md-dialog-content>
  </form>
  <md-dialog-actions flex="nogrow" layout-margin layout="row">
    <md-button class="md-primary md-raised" href="" target="_blank" ng-click="tabsCtrl.cancel()" aria-label="Close action" translate="CLOSE_ACTION"></md-button>
  </md-dialog-actions>
</md-dialog>


text:
package techreborn.client.gui.slot.elements;

public enum SlotType {
	NORMAL(1, 1, Sprite.SLOT_NORMAL, Sprite.BUTTON_SLOT_NORMAL, Sprite.BUTTON_HOVER_OVERLAY_SLOT_NORMAL);

	int slotOffsetX;
	int slotOffsetY;
	Sprite sprite;
	Sprite buttonSprite;
	Sprite buttonHoverOverlay;

	SlotType(int slotOffsetX, int slotOffsetY, Sprite sprite, Sprite buttonSprite, Sprite buttonHoverOverlay) {
		this.slotOffsetX = slotOffsetX;
		this.slotOffsetY = slotOffsetY;
		this.sprite = sprite;
		this.buttonSprite = buttonSprite;
		this.buttonHoverOverlay = buttonHoverOverlay;
	}

	SlotType(int slotOffset, Sprite sprite) {
		this.slotOffsetX = slotOffset;
		this.slotOffsetY = slotOffset;
		this.sprite = sprite;
	}

	public int getSlotOffsetX() {
		return slotOffsetX;
	}

	public int getSlotOffsetY() {
		return slotOffsetY;
	}

	public Sprite getSprite() {
		return sprite;
	}

	public Sprite getButtonSprite() {
		return buttonSprite;
	}

	public Sprite getButtonHoverOverlay() {
		return buttonHoverOverlay;
	}
}


text:
/*
 * framebuffer.h
 * GLB
 * March 18, 2013
 * Brandon Surmanski
 */

#ifndef _GLB_FRAMEBUFFER_H
#define _GLB_FRAMEBUFFER_H

#include "glb_types.h"

#define GLB_FRAMEBUFFER_COLORS_MAX 16

GLBFramebuffer *glbCreateFramebuffer(int *errcode_ret);
void            glbDeleteFramebuffer(GLBFramebuffer *framebuffer);
void            glbRetainFramebuffer(GLBFramebuffer *framebuffer);
void            glbReleaseFramebuffer(GLBFramebuffer *framebuffer);
int             glbFramebufferTexture(GLBFramebuffer *framebuffer, GLBTexture *texture);
int             glbFramebufferColor(GLBFramebuffer *framebuffer, int i, GLBTexture *texture);
int             glbFramebufferDepth(GLBFramebuffer *framebuffer, GLBTexture *depth);
int             glbFramebufferStencil(GLBFramebuffer *framebuffer, GLBTexture *stencil);
int             glbFramebufferDepthStencil(GLBFramebuffer *framebuffer, GLBTexture *depth_stencil);
void            glbFramebufferClear(GLBFramebuffer *framebuffer);

void            glbFramebufferReadColor(GLBFramebuffer *framebuffer, int i,
                                        int *origin, int *region, void *dst);

GLBTexture     *glbGetFramebufferColor(GLBFramebuffer *framebuffer, int i);
GLBTexture     *glbGetFramebufferDepth(GLBFramebuffer *framebuffer);
GLBTexture     *glbGetFramebufferStencil(GLBFramebuffer *framebuffer);

#endif


text:
  Let no man think lightly of good, saying in his heart, It will
  not come nigh unto me.  Even by the falling of water-drops a water-pot
  is filled; the wise man becomes full of good, even if he gather it
  little by little. 122


text:
package net.chriswareham.gui;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * This class provides a table model that maintains the natural ordering of
 * rows.
 *
 * @author Chris Wareham
 * @param <T> type of the objects that make up the rows of the model
 */
public abstract class SortedTableModel<T extends Comparable<? super T>> extends BaseTableModel {
    /**
     * The serial version UID.
     */
    private static final long serialVersionUID = 1L;

    /**
     * The list of rows that make up the model.
     */
    private final List<T> rows = new ArrayList<>();

    /**
     * Get whether there are no rows in the model.
     *
     * @return whether there are no rows in the model
     */
    @Override
    public boolean isRowsEmpty() {
        return rows.isEmpty();
    }

    /**
     * Get the number of rows in the model.
     *
     * @return the number of rows
     */
    @Override
    public int getRowCount() {
        return rows.size();
    }

    /**
     * Get whether the model contains a row.
     *
     * @param row the row
     * @return whether the model contains the row
     */
    public boolean isRow(final T row) {
        return rows.contains(row);
    }

    /**
     * Get the rows from the model.
     *
     * @return the rows
     */
    public List<T> getRows() {
        return Collections.unmodifiableList(rows);
    }

    /**
     * Get a row from the model.
     *
     * @param ri the row index
     * @return the row
     */
    public T getRow(final int ri) {
        return rows.get(ri);
    }

    /**
     * Get the index of a row in the model.
     *
     * @param r the row
     * @return the index, or -1 if the model does not contain the row
     */
    public int getRowIndex(final T r) {
        return rows.indexOf(r);
    }

    /**
     * Add rows to the model.
     *
     * @param r the rows to add
     */
    public void addRows(final Collection<T> r) {
        for (T row : r) {
            addRow(row);
        }
    }

    /**
     * Add a row to the model.
     *
     * @param r the row to add
     */
    public void addRow(final T r) {
        int ri = Collections.binarySearch(rows, r);
        if (ri < 0) {
            ri = ~ri;
        }
        rows.add(ri, r);
        fireTableRowsInserted(ri, ri);
    }

    /**
     * Remove a particular row from the model.
     *
     * @param ri the row index
     */
    public void removeRow(final int ri) {
        rows.remove(ri);
        fireTableRowsDeleted(ri, ri);
    }

    /**
     * Remove a particular row from the model.
     *
     * @param r the row to remove
     */
    public void removeRow(final T r) {
        int ri = rows.indexOf(r);
        rows.remove(ri);
        fireTableRowsDeleted(ri, ri);
    }

    /**
     * Removes all rows from the model.
     */
    public void removeRows() {
        if (!rows.isEmpty()) {
            int ri = rows.size();
            rows.clear();
            fireTableRowsDeleted(0, ri - 1);
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void fireTableDataChanged() {
        Collections.sort(rows);
        super.fireTableDataChanged();
    }
}


text:
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis;

namespace RefactoringEssentials
{
    internal static class SyntaxTriviaListExtensions
    {
        public static bool Any(this SyntaxTriviaList triviaList, params SyntaxKind[] kinds)
        {
            foreach (var trivia in triviaList)
            {
                if (trivia.MatchesKind(kinds))
                {
                    return true;
                }
            }

            return false;
        }

        public static SyntaxTrivia? GetFirstNewLine(this SyntaxTriviaList triviaList)
        {
            return triviaList
                .Where(t => t.Kind() == SyntaxKind.EndOfLineTrivia)
                .FirstOrNullable();
        }

        public static SyntaxTrivia? GetLastComment(this SyntaxTriviaList triviaList)
        {
            return triviaList
                .Where(t => t.MatchesKind(SyntaxKind.SingleLineCommentTrivia, SyntaxKind.MultiLineCommentTrivia))
                .LastOrNullable();
        }

        public static IEnumerable<SyntaxTrivia> SkipInitialWhitespace(this SyntaxTriviaList triviaList)
        {
            return triviaList.SkipWhile(t => t.Kind() == SyntaxKind.WhitespaceTrivia);
        }
    }
}


text:
class JobRunCount < ActiveRecord::Base
end


text:
package com.intellij.codeInsight.template.emmet;

import com.intellij.codeInsight.template.emmet.tokens.*;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * User: zolotov
 * Date: 1/25/13
 */
public class EmmetLexer {
  private static final String DELIMS = ">^+*|()[]{}.#,='\" \0";

  @Nullable
  public List<ZenCodingToken> lex(@NotNull String text) {
    text += ZenCodingTemplate.MARKER;
    final List<ZenCodingToken> result = new ArrayList<ZenCodingToken>();

    boolean inQuotes = false;
    boolean inApostrophes = false;
    int bracesStack = 0;

    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < text.length(); i++) {
      final char c = text.charAt(i);

      if (inQuotes) {
        builder.append(c);
        if (c == '"') {
          inQuotes = false;
          result.add(new StringLiteralToken(builder.toString()));
          builder = new StringBuilder();
        }
        continue;
      }

      if (inApostrophes) {
        builder.append(c);
        if (c == '\'') {
          inApostrophes = false;
          result.add(new StringLiteralToken(builder.toString()));
          builder = new StringBuilder();
        }
        continue;
      }

      if (bracesStack > 0) {
        builder.append(c);
        if (c == '}') {
          bracesStack--;
          if (bracesStack == 0) {
            result.add(new TextToken(builder.toString()));
            builder = new StringBuilder();
          }
        }
        else if (c == '{') {
          bracesStack++;
        }
        continue;
      }

      if (DELIMS.indexOf(c) < 0) {
        builder.append(c);
      }
      else {
        // handle special case: ul+ template
        if (c == '+' && (i == text.length() - 2 || text.charAt(i + 1) == ')')) {
          builder.append(c);
          continue;
        }

        if (builder.length() > 0) {
          final String tokenText = builder.toString();
          final int n = StringUtil.parseInt(tokenText, -1);
          if (!StringUtil.startsWithChar(tokenText, '0') && n >= 0) {
            result.add(new NumberToken(n));
          }
          else {
            result.add(new IdentifierToken(tokenText));
          }
          builder = new StringBuilder();
        }
        if (c == '"') {
          inQuotes = true;
          builder.append(c);
        }
        else if (c == '\'') {
          inApostrophes = true;
          builder.append(c);
        }
        else if (c == '{') {
          bracesStack = 1;
          builder.append(c);
        }
        else if (c == '(') {
          result.add(ZenCodingTokens.OPENING_R_BRACKET);
        }
        else if (c == ')') {
          result.add(ZenCodingTokens.CLOSING_R_BRACKET);
        }
        else if (c == '[') {
          result.add(ZenCodingTokens.OPENING_SQ_BRACKET);
        }
        else if (c == ']') {
          result.add(ZenCodingTokens.CLOSING_SQ_BRACKET);
        }
        else if (c == '=') {
          result.add(ZenCodingTokens.EQ);
        }
        else if (c == '.') {
          result.add(ZenCodingTokens.DOT);
        }
        else if (c == '#') {
          result.add(ZenCodingTokens.SHARP);
        }
        else if (c == ',') {
          result.add(ZenCodingTokens.COMMA);
        }
        else if (c == ' ') {
          result.add(ZenCodingTokens.SPACE);
        }
        else if (c == '|') {
          result.add(ZenCodingTokens.PIPE);
        }
        else if (c != ZenCodingTemplate.MARKER) {
          result.add(new OperationToken(c));
        }
      }
    }
    if (bracesStack != 0 || inQuotes || inApostrophes) {
      return null;
    }
    return result;
  }
}


text:
package edu.sampleu.travel;

import org.kuali.rice.testtools.common.JiraAwareFailable;
import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
import org.kuali.rice.testtools.selenium.WebDriverUtils;

/**
 * Tests the Component section in Rice.
 *
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public abstract class FiscalOfficerInfoMaintenanceAftBase extends WebDriverLegacyITBase {

    /**
     * ITUtil.PORTAL
     * + "?channelTitle=FiscalOfficerInfo%20Maintenance%20(New)&channelUrl="
     * + WebDriverUtils.getBaseUrlString()
     * + "/kr-krad/maintenance?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dto.FiscalOfficerInfo&returnLocation="
     * + ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK
     */
    public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL
            + "?channelTitle=FiscalOfficerInfo%20Maintenance%20(New)&channelUrl="
            + WebDriverUtils.getBaseUrlString()
            + "/kr-krad/maintenance?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dto.FiscalOfficerInfo&returnLocation="
            + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;

    @Override
    protected String getBookmarkUrl() {
        return BOOKMARK_URL;
    }

    protected void navigation() throws InterruptedException {
        waitAndClickKRAD();
        waitAndClickByXpath(FISCAL_OFFICER_INFO_MAINTENANCE_NEW_XPATH);
    }

    protected void testFiscalOfficerInfoMaintenanceNav(JiraAwareFailable failable) throws Exception {
        navigation();
        testFiscalOfficerInfoMaintenanceNew();
        passed();
    }

    protected void testFiscalOfficerInfoMaintenanceBookmark(JiraAwareFailable failable) throws Exception {
        testFiscalOfficerInfoMaintenanceNew();
        passed();
    }
}


text:
#include "caffe2/core/common.h"
#include "caffe2/core/net.h"
#include "caffe2/core/observer.h"
#include "caffe2/core/operator.h"
#include "time_observer.h"

#include <google/protobuf/text_format.h>
#include <gtest/gtest.h>
#include <chrono>
#include <thread>

namespace caffe2 {

namespace {

class SleepOp final : public OperatorBase {
 public:
  using OperatorBase::OperatorBase;
  bool Run(int /* unused */) override {
    StartAllObservers();
    std::this_thread::sleep_for(std::chrono::milliseconds(3000));
    StopAllObservers();
    return true;
  }
};

REGISTER_CPU_OPERATOR(SleepOp, SleepOp);
REGISTER_CUDA_OPERATOR(SleepOp, SleepOp);

OPERATOR_SCHEMA(SleepOp)
    .NumInputs(0, INT_MAX)
    .NumOutputs(0, INT_MAX)
    .AllowInplace({{0, 0}, {1, 1}});

unique_ptr<NetBase> CreateNetTestHelper(Workspace* ws) {
  NetDef net_def;
  {
    auto& op = *(net_def.add_op());
    op.set_type("SleepOp");
    op.add_input("in");
    op.add_output("hidden");
  }
  {
    auto& op = *(net_def.add_op());
    op.set_type("SleepOp");
    op.add_input("hidden");
    op.add_output("out");
  }
  net_def.add_external_input("in");
  net_def.add_external_output("out");

  return CreateNet(net_def, ws);
}
}

TEST(TimeObserverTest, Test3Seconds) {
  Workspace ws;
  ws.CreateBlob("in");
  NetDef net_def;
  unique_ptr<NetBase> net(CreateNetTestHelper(&ws));
  unique_ptr<TimeObserver<NetBase>> net_ob =
      make_unique<TimeObserver<NetBase>>(net.get());
  const auto* ob = dynamic_cast_if_rtti<const TimeObserver<NetBase>*>(
      net->AttachObserver(std::move(net_ob)));
  net->Run();
  CAFFE_ENFORCE(ob);
  LOG(INFO) << "av time children: " << ob->average_time_children();
  LOG(INFO) << "av time: " << ob->average_time();
  CAFFE_ENFORCE(ob->average_time_children() > 3000);
  CAFFE_ENFORCE(ob->average_time_children() < 3500);
  CAFFE_ENFORCE(ob->average_time() > 6000);
  CAFFE_ENFORCE(ob->average_time() < 6500);
}
}