text:
#import "NSObject-Protocol.h"

@protocol SBWorkspaceTransactionDelegate <NSObject>
- (void)transactionDidFinish:(id)arg1 success:(_Bool)arg2;
@end

redpajama_set_name: RedPajamaGithub


text:
LIST(APPEND OpenIGTLink_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/Source/VideoStreaming)
LIST(APPEND OpenIGTLink_SOURCES
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtl_video.c
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtl_videometa.c
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoMessage.cxx
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoStreamIGTLinkServer.cxx
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoStreamIGTLinkReceiver.cxx
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlCodecCommonClasses.cxx
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoMetaMessage.cxx
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlI420Decoder.cxx
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlI420Encoder.cxx
  )
LIST(APPEND OpenIGTLink_INCLUDE_DIRS
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming
  )
LIST(APPEND OpenIGTLink_INCLUDE_FILES
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtl_video.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtl_videometa.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoMessage.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoStreamIGTLinkServer.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoStreamIGTLinkReceiver.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlCodecCommonClasses.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVideoMetaMessage.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlI420Decoder.h
  ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlI420Encoder.h
  )
IF(OpenIGTLink_USE_H264)
  INCLUDE(${OpenIGTLink_SOURCE_DIR}/SuperBuild/External_openh264.cmake)
  IF(EXISTS ${OpenH264_LIBRARY_DIR})
    LIST(APPEND OpenIGTLink_SOURCES
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH264Decoder.cxx
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH264Encoder.cxx
      )
    LIST(APPEND OpenIGTLink_INCLUDE_FILES
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH264Decoder.h
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH264Encoder.h
      )
    LIST(APPEND OpenIGTLink_INCLUDE_DIRS
      ${OpenH264_INCLUDE_DIR}
    )
  ELSE()
    MESSAGE("H264_LIBRARY no found.  You could specify OpenH264_INCLUDE_DIR or OpenH264_LIBRARY_DIR")
  ENDIF()
ENDIF()
IF(OpenIGTLink_USE_VP9)
  INCLUDE(${OpenIGTLink_SOURCE_DIR}/SuperBuild/External_VP9.cmake)
  IF((NOT "${VP9_LIBRARY_DIR}" STREQUAL "") AND (NOT "${VP9_INCLUDE_DIR}" STREQUAL ""))
    LIST(APPEND OpenIGTLink_INCLUDE_DIRS
      ${VP9_INCLUDE_DIR}
    )
    LIST(APPEND OpenIGTLink_SOURCES
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVP9Decoder.cxx
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVP9Encoder.cxx
    )
    LIST(APPEND OpenIGTLink_INCLUDE_FILES
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVP9Decoder.h
      ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlVP9Encoder.h
    )
    LINK_DIRECTORIES("${VP9_LIBRARY_DIR}")
  ELSE()
    MESSAGE("VP9_INCLUDE_DIR or VP9_LIBRARY_DIR no found")
  ENDIF()
ENDIF()

IF(OpenIGTLink_USE_X265)
  INCLUDE(${OpenIGTLink_SOURCE_DIR}/SuperBuild/External_X265.cmake)
  LIST(APPEND OpenIGTLink_INCLUDE_DIRS
      ${X265_INCLUDE_DIR}
      ${X265_LIBRARY_DIR}
  )
  LIST(APPEND OpenIGTLink_SOURCES
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH265Encoder.cxx
  )
  LIST(APPEND OpenIGTLink_INCLUDE_FILES
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH265Encoder.h
  )
ENDIF()

IF(OpenIGTLink_USE_OpenHEVC)
  INCLUDE(${OpenIGTLink_SOURCE_DIR}/SuperBuild/External_openHEVC.cmake)
  LIST(APPEND OpenIGTLink_INCLUDE_DIRS
    ${OpenHEVC_INCLUDE_DIR}
  )
  LIST(APPEND OpenIGTLink_SOURCES
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH265Decoder.cxx
  )
  LIST(APPEND OpenIGTLink_INCLUDE_FILES
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlH265Decoder.h
  )
ENDIF()

IF(OpenIGTLink_USE_AV1)
  INCLUDE(${OpenIGTLink_SOURCE_DIR}/SuperBuild/External_AV1.cmake)
  LIST(APPEND OpenIGTLink_INCLUDE_DIRS
    ${AV1_INCLUDE_DIR}
    ${AV1_LIBRARY_DIR}
  )
  LIST(APPEND OpenIGTLink_SOURCES
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlAV1Decoder.cxx
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlAV1Encoder.cxx
  )
  LIST(APPEND OpenIGTLink_INCLUDE_FILES
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlAV1Decoder.h
    ${PROJECT_SOURCE_DIR}/Source/VideoStreaming/igtlAV1Encoder.h
  )
ENDIF()

IF(WIN32) # for Windows
  IF(OpenIGTLink_USE_H264)
    LIST(APPEND LINK_LIBS
      ${OpenH264_LIBRARY_DIR}/openh264.lib
    )
  ENDIF()
  IF(OpenIGTLink_USE_VP9)
    #To do, library name depends on the compiler setting, could be vpxmt.lib and vpxmtd also. Make sure the setting matches.
    #SET(VP9_lib optimized ${VP9_LIBRARY_DIR}\\Release\\vpxmd.lib debug ${VP9_LIBRARY_DIR}\\Debug\\vpxmdd.lib)
    SET(VP9_lib ${VP9_LIBRARY_DIR}\\libvpx.lib)
    LIST(APPEND LINK_LIBS
      ${VP9_lib}
    )
  ENDIF()
  IF(OpenIGTLink_USE_X265)
    #To do, library name depends on the compiler setting, could be vpxmt.lib and vpxmtd also. Make sure the setting matches.
    SET(LINK_X265_LIBRARY optimized ${X265_LIBRARY_DIR}\\Release\\x265-static.lib debug ${X265_LIBRARY_DIR}\\Debug\\x265-static.lib)
    LIST(APPEND LINK_LIBS
      ${LINK_X265_LIBRARY}
    )
  ENDIF()
  IF(OpenIGTLink_USE_OpenHEVC)
    LIST(APPEND LINK_LIBS
      ${OpenHEVC_LIBRARY}
    )
  ENDIF()

  IF(OpenIGTLink_USE_AV1)
    LIST(APPEND LINK_LIBS
      ${AV1_LIBRARY}
    )
  ENDIF()
ELSE() # for POSIX-compatible OSs
  IF(OpenIGTLink_USE_H264)
    LIST(APPEND LINK_LIBS
     ${OpenH264_LIBRARY_DIR}/libopenh264.a
    )
  ENDIF()
  IF(OpenIGTLink_USE_VP9)
    LIST(APPEND LINK_LIBS
      ${VP9_LIBRARY_DIR}/libvpx.a
    )
  ENDIF()
  IF(OpenIGTLink_USE_X265)
    LIST(APPEND LINK_LIBS
      ${X265_LIBRARY_DIR}/libx265.a
    )
  ENDIF()
  IF(OpenIGTLink_USE_OpenHEVC)
    LIST(APPEND LINK_LIBS
      ${OpenHEVC_LIBRARY}
    )
  ENDIF()
  IF(OpenIGTLink_USE_AV1)
    LIST(APPEND LINK_LIBS
      ${AV1_LIBRARY}
    )
  ENDIF()
ENDIF()


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>object-relation-manager</artifactId>
    <groupId>io.subutai</groupId>
    <version>8.6.1-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>object-relation-manager-impl</artifactId>
  <name>Subutai Object Relation Manager Impl</name>
  <description>Subutai Object Relation Manager Impl</description>
  <packaging>bundle</packaging>

  <dependencies>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>security-manager-api</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>identity-manager-api</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
            <Bundle-SymbolicName>${project.groupId}.core.object.relation.impl</Bundle-SymbolicName>
            <Export-Package>
              {local-packages};version=${project.version};-noimport:=true
            </Export-Package>
            <Import-Package>*</Import-Package>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>openjpa-maven-plugin</artifactId>
        <configuration>
          <addDefaultConstructor>true</addDefaultConstructor>
          <!--<enforcePropertyRestriction>true</enforcePropertyRestriction>-->
        </configuration>
        <executions>
          <execution>
            <id>enhancer</id>
            <phase>process-classes</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
            <version>${openjpa.version}</version>
          </dependency>
          <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

</project>


text:
<?php

use httpclient\HttpClient;
use httpclient\HttpRequest;
use packager\cli\Console;
use packager\Event;
use packager\Package;
use php\format\ProcessorException;
use php\format\YamlProcessor;
use php\io\IOException;
use php\lib\fs;
use php\lib\str;

/**
 * Class HubPlugin
 *
 * @jppm-task-prefix hub
 *
 * @jppm-task login
 * @jppm-task publish
 * @jppm-task unpublish
 * @jppm-task user
 * @jppm-task status
 */
class HubPlugin
{
    /**
     * @var string
     */
    private $endpoint;

    /**
     * @var array
     */
    private $config;

    private $defaultLogin;

    private $configDir = "./";

    /**
     * HubPlugin constructor.
     */
    public function __construct(Event $event)
    {
        if ($event->package()) {
            $hub = $event->package()->getAny('hub');

            $this->endpoint = $hub['endpoint'] ?? 'http://api.develnext.org';
            $this->defaultLogin = $hub['login'] ?? null;
            $this->configDir = $event->package()->getAny('hub.config-dir', "./");

            $this->readConfig();
        }
    }

    /**
     * @return array
     */
    protected function readConfig(): array
    {
        try {
            $file = $this->configDir . "package.hub.yml";

            $config = [];
            if (fs::isFile($file)) {
                $config = fs::parse($file);
            }

            $config['login'] = $this->defaultLogin ?? $config['login'];

            return $this->config = $config;
        } catch (ProcessorException|IOException $e) {
            Console::error("Failed to read package.hub.yaml, reason = '{0}'", $e->getMessage());
            exit(-1);
        }
    }

    protected function writeConfig()
    {
        try {
            $file = $this->configDir . "package.hub.yml";

            fs::format($file, $this->config, YamlProcessor::SERIALIZE_PRETTY_FLOW);
        } catch (ProcessorException|IOException $e) {
            Console::error("Failed to save package.hub.yaml, reason = '{0}'", $e->getMessage());
            exit(-1);
        }
    }

    public function requireAuth()
    {
        if (!$this->config['auth']) {
            Tasks::run('hub:login');
        } else {
            $client = $this->client(false);
            $res = $client->get('/auth/account');

            if (!$res->isSuccess()) {
                $this->config['auth'] = null;
                $this->writeConfig();

                Console::log("-> you need to re-login, access token is invalid.");
                Tasks::run('hub:login');
            }
        }
    }

    /**
     * @param bool $requiredAuth
     * @return HttpClient
     */
    public function client(bool $requiredAuth = true): HttpClient
    {
        if ($requiredAuth) {
            $this->requireAuth();
        }

        $client = new HttpClient($this->endpoint);

        $client->requestType = 'JSON';
        $client->responseType = 'JSON';
        $client->handlers = [
            function (HttpRequest $request) {
                Console::debug("-> {0} {1}", $request->method(), $request->url());
            }
        ];

        $client->headers['X-Token'] = $this->config['auth'];

        return $client;
    }

    private function printRelease(?array $release)
    {
        Console::log("Release Info:");
        Console::log("--------------------------------");

        if ($release) {
            Console::log("     name: {0}", $release['name']);
            Console::log("  version: {0}", $release['version']);
            Console::log("      url: {0}", $release['downloadUrl']);
        } else {
            Console::log("\n   Release not found.\n");
        }

        Console::log("--------------------------------");
    }

    /**
     * @jppm-description Show data of logged user on hub.
     * @param Event $event
     */
    public function user(Event $event)
    {
        $client = $this->client();
        $res = $client->get('/auth/account');

        if ($res->isSuccess()) {
            Console::log("User Info:");
            Console::log("--------------------------------");

            $info = $res->body();

            Console::log("     id: {0}", $info['id']);
            Console::log("  email: {0}", $info['email']);
            Console::log("   name: {0}", $info['login']);
            Console::log("  token: {0}", $this->config['auth']);
            Console::log("--------------------------------");
        } else {
            Console::log("User is not logged.");
        }
    }

    /**
     * @jppm-need-package
     * @jppm-description Login on Hub repository.
     * @param Event $event
     */
    public function login(Event $event)
    {
        if ($this->config['auth']) {
            if (!Console::readYesNo('Do you want to re-login?')) {
                exit();
            }
        }

        $login = str::trim(Console::read('Your Email:', $this->config['login']));
        $password = str::trim(Console::read('Your Password:'));

        $this->config['login'] = $login;

        $client = $this->client(false);

        $res = $client->post('/auth/login', [
            'login' => $login,
            'password' => $password
        ]);

        if ($res->isSuccess()) {
            if (!$res->body()['id']) {
                Console::log("Failed to log in, invalid response body (id not found).");
                exit(-1);
            }

            $this->config['auth'] = $res->body()['id'];

            Console::log("--------------------------------");
            Console::log("     login: {0}", $login);
            Console::log("  password: {0}", '*****');
            Console::log("--------------------------------");

            Console::log("You have successfully logged in, auth data saved to package.hub.yml.");
            Console::log("-> (!) WARNING: Add 'package.hub.yml' to your ignore files.");
            $this->writeConfig();
        } else {
            Console::log("Failed to log in, reason is '{0}'", $res->statusMessage());
            exit(-1);
        }
    }

    /**
     * @jppm-need-package
     * @jppm-description Un-Publish package from remote hub repository.
     * @param Event $event
     */
    public function unpublish(Event $event)
    {
        $this->requireAuth();

        $client = $this->client();
        $pkg = $event->package();

        if (!$client->get('/repo/get', ['name' => $pkg->getName(), 'version' => $pkg->getVersion()])->isSuccess()) {
            Console::log("Package {0} is not published on hub.", $pkg->getNameWithVersion());
            exit();
        }

        $request = new HttpRequest('DELETE', '/repo/unpublish', [], [
            'name' => $pkg->getName(),
            'version' => $pkg->getVersion(),
        ]);

        if ($event->isFlag('y', 'yes')
            || Console::readYesNo("Are you sure to un-publish {$pkg->getNameWithVersion()}?")) {

            $res = $client->send($request);

            if ($res->isSuccess()) {
                $this->printRelease($res->body());
                Console::log("The package '{0}' has been un-published successfully.", $pkg->getNameWithVersion());
            } else {
                Console::error("Failed to un-publish release of current package, {0} {1}.", $res->statusCode(), $res->statusMessage());
                exit(-1);
            }
        } else {
            Console::log("... canceled.");
            exit();
        }
    }

    /**
     * @jppm-need-package
     * @jppm-depends-on build
     * @jppm-description Publish package on remote hub repository.
     * @param Event $event
     */
    public function publish(Event $event)
    {
        $this->requireAuth();
        $client = $this->client();

        $res = $client->get('/repo/get', ['name' => $event->package()->getName(), 'version' => $event->package()->getVersion()]);

        if ($res->isSuccess()) {
            if (!$event->isFlag('f', 'force')) {
                Console::error("Package {0} already has published.", $event->package()->getNameWithVersion());

                Console::log("\n    Use 'hub:unpublish' task to delete this release.");
                Console::log("\n         or\n");
                Console::log("    Use 'hub:publish -f' task to re-publish this release.");
                exit(-1);
            } else {
                Console::warn("-> re-publishing ...");
            }
        }

        Tasks::run('publish', [], 'yes');

        $repo = $event->packager()->getRepo();
        $repo->index($event->package()->getName());

        $pkg = $repo->getPackage($event->package()->getName(), $event->package()->getVersion());
        $archFile = $repo->getPackageArchiveFile($pkg->getName(), $pkg->getVersion());

        Console::print("-> uploading {0} ...", fs::name($archFile));

        $client = $this->client();
        $request = new HttpRequest('POST', '/repo/publish-archive', [], [
            'name' => $pkg->getName(),
            'version' => $pkg->getVersion(),
            'size' => $pkg->getSize(),
            'sha256' => $pkg->getHash(),
            'file' => $archFile,
        ]);
        $request->type('MULTIPART');

        $res = $client->send($request);

        if ($res->isSuccess()) {
            Console::log(" done.");
            $this->printRelease($res->body());
            Console::log("The package '{0}' has been uploaded successfully.", $pkg->getNameWithVersion());
        } else {
            Console::error("Failed to publish release of current package, {0} {1}.", $res->statusCode(), $res->statusMessage());
            exit(-1);
        }
    }

    /**
     * @jppm-description Show status of package on hub!
     * @param Event $event
     */
    public function status(Event $event)
    {
        $pkg = $event->package();

        Console::log("-> Hub of package: {0}", $this->endpoint ?: '*empty*');

        if ($this->config['auth']) {
            Console::log("-> Logged as {0}.", $this->config['login']);
        } else {
            Console::log("-> Not logged.");
        }

        if ($pkg) {
            $client = $this->client(false);
            $res = $client->get('/repo/get', ['name' => $pkg->getName(), 'version' => $pkg->getVersion()]);

            if ($res->isSuccess()) {
                $this->printRelease($res->body());
            } else {
                $this->printRelease(null);
            }
        }
    }
}


text:
module CloudKit

  # A CloudKit::URI wraps a URI string, adding methods useful for routing
  # in CloudKit as well as caching URI components for future comparisons.
  class URI

    # The string form of a URI.
    attr_reader :string

    # Create a new URI with the given string.
    def initialize(string)
      @string = string
    end

    # Return the resource collection URI fragment.
    #   Example: URI.new('/foos/123').collection_uri_fragment => '/foos
    def collection_uri_fragment
      "/#{components[0]}" rescue nil
    end

    # Splits a URI into its components
    def components
      @components ||= @string.split('/').reject{|x| x == '' || x == nil} rescue []
    end

    # Return the resource collection referenced by a URI.
    #   Example: URI.new('/foos/123').collection_type => :foos
    def collection_type
      components[0].to_sym rescue nil
    end

    # Return the URI for the current version of a resource.
    #   Example: URI.new('/foos/123/versions/abc').current_resource_uri => '/foos/123'
    def current_resource_uri
      "/#{components[0..1].join('/')}" rescue nil
    end

    # Returns true if URI matches /cloudkit-meta
    def meta_uri?
      return components.size == 1 && components[0] == 'cloudkit-meta'
    end

    # Returns true if URI matches /{collection}
    def resource_collection_uri?
      return components.size == 1 && components[0] != 'cloudkit-meta'
    end

    # Returns true if URI matches /{collection}/_resolved
    def resolved_resource_collection_uri?
      return components.size == 2 && components[1] == '_resolved'
    end

    # Returns true if URI matches /{collection}/{uuid}
    def resource_uri?
      return components.size == 2 && components[1] != '_resolved'
    end

    # Returns true if URI matches /{collection}/{uuid}/versions
    def version_collection_uri?
      return components.size == 3 && components[2] == 'versions'
    end

    # Returns true if URI matches /{collection}/{uuid}/versions/_resolved
    def resolved_version_collection_uri?
      return components.size == 4 && components[2] == 'versions' && components[3] == '_resolved'
    end

    # Returns true if URI matches /{collection}/{uuid}/versions/{etag}
    def resource_version_uri?
      return components.size == 4 && components[2] == 'versions' && components[3] != '_resolved'
    end

    # Returns a cannonical URI for a given URI/URI fragment, generating it if
    # required.
    #   Example: URI.new('/items/123').cannoncal_uri_string => /items/123
    #
    #   Example: URI.new('/items').cannonical_uri_string => /items/some-new-uuid
    def cannonical_uri_string
      @cannonical_uri_string ||= if resource_collection_uri?
        "#{@string}/#{UUID.generate}"
      elsif resource_uri?
        @string
      else
        raise CloudKit::InvalidURIFormat
      end
    end
  end
end


text:
typedef struct BLKSYMTYPE     // Obsolete
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      len;        /* Block length */
    char        name[1];    /* Length-prefixed name */
} BLKSYMTYPE;

typedef struct PROCSYMTYPE     // Obsolete
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      typind;     /* Type index */
    unsigned short      len;        /* Proc length */
    unsigned short      startoff;   /* Debug start offset */
    unsigned short      endoff;     /* Debug end offset */
    short       res;        /* Reserved */
    char        rtntyp;     /* Return type (NEAR/FAR) */
    char        name[1];    /* Length-prefixed name */
} PROCSYMTYPE;

typedef struct WITHSYMTYPE      // Obsolete
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      len;        /* Length of scope */
    char        name[1];    /* String to be evaluated */
} WITHSYMTYPE;

typedef struct BPSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* BP-relative offset */
    unsigned short      typind;     /* Type index */
    char        name[1];    /* Length-prefixed name */
} BPSYMTYPE;

typedef struct LABSYMTYPE     //Obsolete
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* Offset in code seg */
    char        rtntyp;     /* Return type (NEAR/FAR) */
    char        name[1];    /* Length-prefixed name */
} LABSYMTYPE;

typedef struct LOCSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* Offset in segment */
    unsigned short      seg;        /* Segment address */
    unsigned short      typind;     /* Type index */
    char        name[1];    /* Length-prefixed name */
} LOCSYMTYPE;

typedef struct REGSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned short      typind;     /* Type index */
    char        reg;        /* Which register */
    char        name[1];    /* Length-prefixed name */
} REGSYMTYPE;

typedef struct CONSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned short      typind;     /* Type index */
    char        value[1];   /* Variable-length value */
    char        name[1];    /* Length-prefixed name */
} CONSYMTYPE;

typedef struct TYPEDEFSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned short      typind;     /* Type index */
    char        name[1];    /* Length-prefixed name */
} TYPEDEFSYMTYPE;

typedef struct CV4PROCSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       parentsym;  /* Offset of sym of enclosing proc */
    unsigned long       endsym;     /* matching end */
    unsigned long       nextsym;    /* Sym of closest following proc */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      seg;        /* Seg of proc */
    unsigned short      typind;     /* Type index */
    unsigned long       len;        /* Proc length */
    unsigned long       startoff;   /* Debug start offset */
    unsigned long       endoff;     /* Debug end offset */
    char                rtntyp;     /* Return type (NEAR/FAR) */
    char                name[1];    /* Length-prefixed name */
} CV4PROCSYMTYPE;

typedef struct THUNKSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       parentsym;  /* Offset of sym of enclosing proc */
    unsigned long       endsym;     /* matching end */
    unsigned long       nextsym;    /* Sym of closest following proc */
    char                ord;        /* Type of thunk */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      seg;        /* Seg of proc */
    unsigned short      len;        /* Thunk length */
    char                name[1];    /* Thunk name */
    union {
        struct {
            short           delta;      /* Size of adjustment */
            char            name[1];    /* Name of target function */
            }             adjustor;
        short             vtaboff;      /* Offset into the vtable */
        }               variant;
} THUNKSYMTYPE;

typedef struct CV4BLKSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       parentsym;  /* Offset of sym of enclosing proc */
    unsigned long       endsym;     /* matching end */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      seg;        /* Segment of code */
    unsigned long       len;        /* Block length */
    char                name[1];    /* Length-prefixed name */
} CV4BLKSYMTYPE;

typedef struct CV4WITHSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       parentsym;  /* Offset of sym of enclosing proc */
    unsigned long       endsym;     /* matching end */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      seg;        /* Segment of code */
    unsigned long       len;        /* Length of scope */
    char                name[1];    /* String to be evaluated */
} CV4WITHSYMTYPE;

typedef struct CV4LABSYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      seg;        /* Segment of code */
    char                rtntyp;     /* Return type (NEAR/FAR) */
    char                name[1];    /* Length-prefixed name */
} CV4LABSYMTYPE;

typedef struct CV4CHANGESYMTYPE
{
    unsigned char       reclen;     /* Record length */
    unsigned char       rectyp;     /* Record type */
    unsigned long       off;        /* Offset in code seg */
    unsigned short      seg;        /* Segment of code */
    char                model;      /* Execution model to change to */
    char                var[1];     /* Variant info (unspecified) */
} CV4CHANGESYMTYPE;

/* Far pointer definitions */

typedef BLKSYMTYPE          *BLKSYMPTR;        // Obsolete
typedef CONSYMTYPE          *CONSYMPTR;
typedef REGSYMTYPE          *REGSYMPTR;
typedef LOCSYMTYPE          *LOCSYMPTR;
typedef LABSYMTYPE          *LABSYMPTR;        // Obsolete
typedef BPSYMTYPE           *BPSYMPTR;
typedef WITHSYMTYPE         *WITHSYMPTR;       // Obsolete
typedef PROCSYMTYPE         *PROCSYMPTR;       // Obsolete
typedef TYPEDEFSYMTYPE      *TYPEDEFSYMPTR;
typedef CV4PROCSYMTYPE      *CV4PROCSYMPTR;
typedef THUNKSYMTYPE        *THUNKSYMPTR;
typedef CV4BLKSYMTYPE       *CV4BLKSYMPTR;
typedef CV4WITHSYMTYPE      *CV4WITHSYMPTR;
typedef CV4LABSYMTYPE       *CV4LABSYMPTR;
typedef CV4CHANGESYMTYPE    *CV4CHANGESYMPTR;


text:
(function(window, document, exportName) {

  let _target = false;
  const _window = [window];
  const defaultOptions = {
    'mouseEvent': true,
    'minDistance': 30
  };

  function SwipeIt(selector, options = {}) {
    const _elements = nodeListToArray(document.querySelectorAll(selector));
    let _xStart, _yStart, _xEnd, _yEnd;

    options.mouseEvent = (options.mouseEvent === undefined) ? defaultOptions.mouseEvent : options.mouseEvent;
    options.minDistance = (options.minDistance === undefined) ? defaultOptions.minDistance : options.minDistance;

    init();
    ready();

    this.on = function(swipeEvent, callback) {
      listen(swipeEvent, callback, _elements);
      return this;
    }

    function ready() {
      //for touching device
      listen('touchstart', touchStartHandler, _elements);
      listen('touchmove', touchMoveHandler, _elements);
      listen('touchend', touchEndHandler, _elements);
      //for mouse
      if (options.mouseEvent) {
        listen('mousedown', mouseDownHandler, _elements);
      }
    }

    function init() {
      _xStart = false;
      _yStart = false;
      _xEnd = false;
      _yEnd = false;
      _target = false;
    }

    function mouseDownHandler(e) {
      _target = this;
      _xStart = e.clientX;
      _yStart = e.clientY;
      listen('mousemove', mouseMoveHandler, _window);
      listen('mouseup', mouseEndHandler, _window);
    }

    function mouseMoveHandler(e) {
      e.preventDefault(); // **prevent drag event from being triggered**
      if (!_xStart || !_yStart) return;
      _xEnd = e.clientX;
      _yEnd = e.clientY;
    }

    function mouseEndHandler(e) {
      stopListen('mousemove', mouseMoveHandler, _window);
      stopListen('mouseup', mouseEndHandler, _window);
      touchEndHandler(e);
    }

    function touchStartHandler(e) {
      _target = this;
      _xStart = e.touches[0].clientX;
      _yStart = e.touches[0].clientY;
    }

    function touchMoveHandler(e) {
      _xEnd = e.touches[0].clientX;
      _yEnd = e.touches[0].clientY;
    }

    function touchEndHandler(e) {
      if (_xStart && _yStart && _xEnd && _yEnd) {
        const [disH, disV] = [_xStart - _xEnd, _yStart - _yEnd];
        const [h, v] = [disH, disV].map(Math.abs);
        const d = options.minDistance;
        if (h > d) { //horizontal
          const swipeEventString = (_xStart < _xEnd) ? 'swipeRight' : 'swipeLeft';
          triggerEvent(swipeEventString, _target, {
            distance: disH,
            start: _xStart,
            end: _xEnd
          });
        }
        if (v > d) { //vertical
          const swipeEventString = (_yStart > _yEnd) ? 'swipeUp' : 'swipeDown';
          triggerEvent(swipeEventString, _target, {
            distance: disV,
            start: _yStart,
            end: _yEnd
          });
        }
        if (h > d || v > d) {
          triggerEvent('swipe', _target);
        }
      };
      init();
    }
  }

  function listen(event, handler, elements) {
    toArray(elements).forEach(element => element.addEventListener(event, handler));
  }

  function stopListen(event, handler, elements) {
    toArray(elements).forEach(element => element.removeEventListener(event, handler));
  }

  function triggerEvent(eventString, elements, extraParams = {}) {
    const event = document.createEvent('Event');
    event.initEvent(eventString, true, true);
    event.swipe = extraParams;
    toArray(elements).forEach(element => element.dispatchEvent(event));
  }

  function nodeListToArray(nodes) {
    const nodesArray = [];
    for (let i = 0; i < nodes.length; i++) {
      nodesArray.push(nodes[i]);
    }
    return nodesArray;
  }

  function toArray(elements) {
    return Array.isArray(elements) ? elements : [elements];
  }

  //export
  window[exportName] = SwipeIt;

})(window, document, 'SwipeIt');


text:
package org.apache.ignite.schema.ui;

/**
 * Validator for editable table view text column.
 */
public interface TextColumnValidator<T> {
    /**
     * Validate new value of text.
     *
     * @param rowVal Row value.
     * @param newVal New value of text.
     * @return {@code true} if text is valid.
     */
    public boolean valid(T rowVal, String newVal);
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />


text:
package com.asakusafw.dag.api.common;

import java.io.IOException;

/**
 * Represents a reporter.
 * @since 0.4.0
 */
@FunctionalInterface
public interface Reportable {

    /**
     * Generates a report.
     * @throws IOException if I/O error was occurred while generating the report
     * @throws InterruptedException if interrupted while generating the report
     */
    void report() throws IOException, InterruptedException;
}


text:
package testutils

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"sort"
	"strings"
	"testing"

	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/kops/pkg/apis/kops"
	"k8s.io/kops/pkg/apis/kops/v1alpha2"
	"k8s.io/kops/pkg/diff"
	"k8s.io/kops/pkg/kopscodecs"
	"k8s.io/kops/upup/pkg/fi"
)

type Model struct {
	Cluster        *kops.Cluster
	InstanceGroups []*kops.InstanceGroup
}

// LoadModel loads a cluster and instancegroups from a cluster.yaml file found in basedir
func LoadModel(basedir string) (*Model, error) {
	clusterYamlPath := path.Join(basedir, "cluster.yaml")
	clusterYaml, err := ioutil.ReadFile(clusterYamlPath)
	if err != nil {
		return nil, fmt.Errorf("error reading file %q: %v", clusterYamlPath, err)
	}

	spec := &Model{}

	// Codecs provides access to encoding and decoding for the scheme
	codecs := kopscodecs.Codecs

	codec := codecs.UniversalDecoder(kops.SchemeGroupVersion)

	sections := bytes.Split(clusterYaml, []byte("\n---\n"))
	for _, section := range sections {
		defaults := &schema.GroupVersionKind{
			Group:   v1alpha2.SchemeGroupVersion.Group,
			Version: v1alpha2.SchemeGroupVersion.Version,
		}
		o, gvk, err := codec.Decode(section, defaults, nil)
		if err != nil {
			return nil, fmt.Errorf("error parsing file %v", err)
		}

		switch v := o.(type) {
		case *kops.Cluster:
			if spec.Cluster != nil {
				return nil, fmt.Errorf("found multiple clusters")
			}
			spec.Cluster = v
		case *kops.InstanceGroup:
			spec.InstanceGroups = append(spec.InstanceGroups, v)

		default:
			return nil, fmt.Errorf("Unhandled kind %q", gvk)
		}
	}

	return spec, nil
}

func ValidateTasks(t *testing.T, basedir string, context *fi.ModelBuilderContext) {
	var keys []string
	for key := range context.Tasks {
		keys = append(keys, key)
	}
	sort.Strings(keys)

	var yamls []string
	for _, key := range keys {
		task := context.Tasks[key]
		yaml, err := kops.ToRawYaml(task)
		if err != nil {
			t.Fatalf("error serializing task: %v", err)
		}
		yamls = append(yamls, strings.TrimSpace(string(yaml)))
	}

	actualTasksYaml := strings.Join(yamls, "\n---\n")

	tasksYamlPath := path.Join(basedir, "tasks.yaml")
	expectedTasksYamlBytes, err := ioutil.ReadFile(tasksYamlPath)
	if err != nil {
		t.Fatalf("error reading file %q: %v", tasksYamlPath, err)
	}

	actualTasksYaml = strings.TrimSpace(actualTasksYaml)
	expectedTasksYaml := strings.TrimSpace(string(expectedTasksYamlBytes))

	if expectedTasksYaml != actualTasksYaml {
		if os.Getenv("HACK_UPDATE_EXPECTED_IN_PLACE") != "" {
			t.Logf("HACK_UPDATE_EXPECTED_IN_PLACE: writing expected output %s", tasksYamlPath)
			if err := ioutil.WriteFile(tasksYamlPath, []byte(actualTasksYaml), 0644); err != nil {
				t.Errorf("error writing expected output %s: %v", tasksYamlPath, err)
			}
		}

		diffString := diff.FormatDiff(expectedTasksYaml, actualTasksYaml)
		t.Logf("diff:\n%s\n", diffString)

		t.Fatalf("tasks differed from expected for test %q", basedir)
	}
}


text:
package com.github.out.http.retrofit;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.widget.Toast;

import com.github.out.R;
import com.github.out.bean.BaseEntity;
import com.github.out.http.HttpContents;
import com.github.out.listener.SubscriberListener;
import com.github.out.weight.progress.ProgressDialogHandler;
import com.google.gson.Gson;

import rx.Subscriber;

/**
 * 请求订阅者
 */
public class HttpRequestSubscriber extends Subscriber<BaseEntity> implements ProgressDialog.OnCancelListener
{
    private Context context;

    private ProgressDialogHandler pdh;

    private SubscriberListener onNextListener;

    /**
     * 默认订阅者, 含有默认请求弹窗
     * @param context
     * @param onNextListener
     */
    public HttpRequestSubscriber(Context context, SubscriberListener onNextListener)
    {
        this.context = context;
        this.onNextListener = onNextListener;

        pdh = ProgressDialogHandler.getInstance(context, this);
    }

    /**
     * 不含请求弹窗, 适用于列表刷新/加载, 防止重复
     * @param context
     * @param onNextListener
     * @param isShowProgress
     */
    public HttpRequestSubscriber(Context context, SubscriberListener onNextListener, boolean isShowProgress)
    {
        this.context = context;
        this.onNextListener = onNextListener;
    }

    @Override
    public void onStart()
    {
        super.onStart();
        if (pdh != null)
        {
            pdh.show();
        }
    }

    @Override
    public void onCompleted()
    {
        if (pdh != null)
        {
            pdh.dismiss();
        }
    }

    @Override
    public void onError(Throwable e)
    {
        if (pdh != null)
        {
            pdh.dismiss();
        }
        Toast.makeText(context, context.getString(R.string.net_error), Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onNext(BaseEntity baseEntity)
    {
        //对请求是否得到正确相应做出判断
        if (null != onNextListener)
        {
            if (HttpContents.SUCCESS.equals(baseEntity.getCode()))
            {
                Gson gson = new Gson();
                String infoStr = gson.toJson(baseEntity.getData());
                onNextListener.onSuccess(infoStr);
            }
            else
            {
                onNextListener.onSuccess(baseEntity.getMsg());
            }
        }
    }

    /**
     * 取消ProgressDialog的时候,取消对observable的订阅,同时也取消了http请求
     */
    @Override
    public void onCancel(DialogInterface dialog)
    {
        if (this.isUnsubscribed())
        {
            this.unsubscribe();
        }
    }
}


text:
require "graphql/query/arguments"
require "graphql/query/context"
require "graphql/query/executor"
require "graphql/query/literal_input"
require "graphql/query/serial_execution"
require "graphql/query/variables"
require "graphql/query/input_validation_result"
require "graphql/query/variable_validation_error"

module GraphQL
  # A combination of query string and {Schema} instance which can be reduced to a {#result}.
  class Query
    class OperationNameMissingError < GraphQL::ExecutionError
      def initialize(names)
        msg = "You must provide an operation name from: #{names.join(", ")}"
        super(msg)
      end
    end

    attr_reader :schema, :document, :context, :fragments, :operations, :root_value, :max_depth, :query_string

    # Prepare query `query_string` on `schema`
    # @param schema [GraphQL::Schema]
    # @param query_string [String]
    # @param context [#[]] an arbitrary hash of values which you can access in {GraphQL::Field#resolve}
    # @param variables [Hash] values for `$variables` in the query
    # @param validate [Boolean] if true, `query_string` will be validated with {StaticValidation::Validator}
    # @param operation_name [String] if the query string contains many operations, this is the one which should be executed
    # @param root_value [Object] the object used to resolve fields on the root type
    # @param max_depth [Numeric] the maximum number of nested selections allowed for this query (falls back to schema-level value)
    # @param max_complexity [Numeric] the maximum field complexity for this query (falls back to schema-level value)
    def initialize(schema, query_string = nil, document: nil, context: nil, variables: {}, validate: true, operation_name: nil, root_value: nil, max_depth: nil, max_complexity: nil)
      fail ArgumentError, "a query string or document is required" unless query_string || document

      @schema = schema
      @max_depth = max_depth || schema.max_depth
      @max_complexity = max_complexity || schema.max_complexity
      @query_analyzers = schema.query_analyzers.dup
      if @max_depth
        @query_analyzers << GraphQL::Analysis::MaxQueryDepth.new(@max_depth)
      end
      if @max_complexity
        @query_analyzers << GraphQL::Analysis::MaxQueryComplexity.new(@max_complexity)
      end
      @context = Context.new(query: self, values: context)
      @root_value = root_value
      @validate = validate
      @operation_name = operation_name
      @fragments = {}
      @operations = {}
      @provided_variables = variables
      @query_string = query_string

      @document = document || GraphQL.parse(query_string)
      @document.definitions.each do |part|
        if part.is_a?(GraphQL::Language::Nodes::FragmentDefinition)
          @fragments[part.name] = part
        elsif part.is_a?(GraphQL::Language::Nodes::OperationDefinition)
          @operations[part.name] = part
        else
          raise GraphQL::ExecutionError, "GraphQL query cannot contain a schema definition"
        end
      end

      @arguments_cache = Hash.new { |h, k| h[k] = {} }
    end

    # Get the result for this query, executing it once
    def result
      @result ||= begin
        if @validate && (validation_errors.any? || analysis_errors.any?)
          { "errors" => validation_errors + analysis_errors}
        else
          Executor.new(self).result
        end
      end

    end

    # This is the operation to run for this query.
    # If more than one operation is present, it must be named at runtime.
    # @return [GraphQL::Language::Nodes::OperationDefinition, nil]
    def selected_operation
      @selected_operation ||= begin
        perform_validation
        @selected_operation
      end
    end

    # Determine the values for variables of this query, using default values
    # if a value isn't provided at runtime.
    #
    # Raises if a non-null variable isn't provided at runtime.
    # @return [GraphQL::Query::Variables] Variables to apply to this query
    def variables
      @variables ||= GraphQL::Query::Variables.new(
        schema,
        selected_operation.variables,
        @provided_variables
      )
    end

    def internal_representation
      @internal_representation ||= begin
        perform_validation
        @internal_representation
      end
    end

    def validation_errors
      @validation_errors ||= begin
        perform_validation
        @validation_errors
      end
    end

    # Node-level cache for calculating arguments. Used during execution and query analysis.
    # @return [GraphQL::Query::Arguments] Arguments for this node, merging default values, literal values and query variables
    def arguments_for(irep_node, definition)
      @arguments_cache[irep_node][definition] ||= begin
        GraphQL::Query::LiteralInput.from_arguments(
          irep_node.ast_node.arguments,
          definition.arguments,
          self.variables
        )
      end
    end

    private

    def perform_validation
      @selected_operation = find_operation(@operations, @operation_name)
      validation_result = schema.static_validator.validate(self)
      @validation_errors = validation_result[:errors]
      @internal_representation = validation_result[:irep]
      if @validation_errors.none?
        # Accessing variables will raise errors if there are any :S
        variables
      end
      nil
    rescue GraphQL::Query::OperationNameMissingError, GraphQL::Query::VariableValidationError => err
      @validation_errors = [err.to_h]
      @internal_representation = nil
      nil
    end

    def find_operation(operations, operation_name)
      if operations.length == 1
        operations.values.first
      elsif operations.length == 0
        nil
      elsif !operations.key?(operation_name)
        raise OperationNameMissingError, operations.keys
      else
        operations[operation_name]
      end
    end

    def analysis_errors
      @analysis_errors ||= begin
        if validation_errors.any?
          # Can't reduce an invalid query
          []
        elsif @query_analyzers.any?
          reduce_results = GraphQL::Analysis.analyze_query(self, @query_analyzers)
          reduce_results.select { |r| r.is_a?(GraphQL::AnalysisError) }.map(&:to_h)
        else
          []
        end
      end
    end
  end
end


text:
package webmon;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.*;

import com.google.appengine.api.taskqueue.*;

import webmon.models.Website;
import webmon.utils.DatastoreUtils;

/**
 * The Class ResponseTimeServlet.
 */
@SuppressWarnings("serial")
public class ResponseTimeServlet extends HttpServlet {

	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		final List<Website> allWebsites = DatastoreUtils.getAllWebsites();
		int i = 0;

		for(i=0; i<allWebsites.size(); i++) {
			Website website = allWebsites.get(i);
			if(website.getUsers().size() == 0) {
				DatastoreUtils.deleteWebsite(website.getUrl());
				continue;
			}

			Queue queue = QueueFactory.getDefaultQueue();
	        queue.add(TaskOptions.Builder.withUrl("/pinger")
					.param("id", String.valueOf(website.getId())));
		}

		resp.setStatus(HttpServletResponse.SC_OK);
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.moss.apidoc.repository.MessageRepository">

    <select id="getMessages" parameterType="string" resultType="Message">
        SELECT messageKey, locale, message
        FROM message
        WHERE locale = #{locale};
    </select>
</mapper>


text:
using System;
using System.Diagnostics.CodeAnalysis;
using System.Web.Mvc;

namespace NuGetGallery.Areas.Admin.Controllers
{
    public partial class HomeController : AdminControllerBase
    {
        private readonly IContentService _content;

        public HomeController(IContentService content)
        {
            _content = content;
        }

        public virtual ActionResult Index()
        {
            return View();
        }

        [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Throw", Justification="This is an admin action")]
        [SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "This is an admin action")]
        public virtual ActionResult Throw()
        {
            throw new Exception("KA BOOM!");
        }

        public virtual ActionResult ClearContentCache()
        {
            _content.ClearCache();
            TempData["Message"] = "Cleared Content Cache";
            return RedirectToAction("Index");
        }
    }
}


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="form.resolved_type_factory.class">Symfony\Component\Form\ResolvedFormTypeFactory</parameter>
        <parameter key="form.registry.class">Symfony\Component\Form\FormRegistry</parameter>
        <parameter key="form.factory.class">Symfony\Component\Form\FormFactory</parameter>
        <parameter key="form.extension.class">Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension</parameter>
        <parameter key="form.type_guesser.validator.class">Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser</parameter>
        <parameter key="property_accessor.class">Symfony\Component\PropertyAccess\PropertyAccessor</parameter>
    </parameters>

    <services>
        <!-- ResolvedFormTypeFactory -->
        <service id="form.resolved_type_factory" class="%form.resolved_type_factory.class%" />

        <!-- FormRegistry -->
        <service id="form.registry" class="%form.registry.class%">
            <argument type="collection">
                <!--
                We don't need to be able to add more extensions.
                 * more types can be registered with the form.type tag
                 * more type extensions can be registered with the form.type_extension tag
                 * more type_guessers can be registered with the form.type.type_guesser tag
                -->
                <argument type="service" id="form.extension" />
            </argument>
            <argument type="service" id="form.resolved_type_factory" />
        </service>

        <!-- FormFactory -->
        <service id="form.factory" class="%form.factory.class%">
            <argument type="service" id="form.registry" />
            <argument type="service" id="form.resolved_type_factory" />
        </service>

        <!-- DependencyInjectionExtension -->
        <service id="form.extension" class="%form.extension.class%" public="false">
            <argument type="service" id="service_container" />
            <!-- All services with tag "form.type" are inserted here by FormPass -->
            <argument type="collection" />
            <!-- All services with tag "form.type_extension" are inserted here by FormPass -->
            <argument type="collection" />
            <!-- All services with tag "form.type_guesser" are inserted here by FormPass -->
            <argument type="collection" />
        </service>

        <!-- ValidatorTypeGuesser -->
        <service id="form.type_guesser.validator" class="%form.type_guesser.validator.class%">
            <tag name="form.type_guesser" />
            <argument type="service" id="validator.mapping.class_metadata_factory" />
        </service>

        <!-- PropertyAccessor -->
        <service id="property_accessor" class="%property_accessor.class%" />

        <!-- CoreExtension -->
        <service id="form.type.field" class="Symfony\Component\Form\Extension\Core\Type\FieldType">
            <tag name="form.type" alias="field" />
        </service>
        <service id="form.type.form" class="Symfony\Component\Form\Extension\Core\Type\FormType">
            <argument type="service" id="property_accessor"/>
            <tag name="form.type" alias="form" />
        </service>
        <service id="form.type.birthday" class="Symfony\Component\Form\Extension\Core\Type\BirthdayType">
            <tag name="form.type" alias="birthday" />
        </service>
        <service id="form.type.checkbox" class="Symfony\Component\Form\Extension\Core\Type\CheckboxType">
            <tag name="form.type" alias="checkbox" />
        </service>
        <service id="form.type.choice" class="Symfony\Component\Form\Extension\Core\Type\ChoiceType">
            <tag name="form.type" alias="choice" />
        </service>
        <service id="form.type.collection" class="Symfony\Component\Form\Extension\Core\Type\CollectionType">
            <tag name="form.type" alias="collection" />
        </service>
        <service id="form.type.country" class="Symfony\Component\Form\Extension\Core\Type\CountryType">
            <tag name="form.type" alias="country" />
        </service>
        <service id="form.type.date" class="Symfony\Component\Form\Extension\Core\Type\DateType">
            <tag name="form.type" alias="date" />
        </service>
        <service id="form.type.datetime" class="Symfony\Component\Form\Extension\Core\Type\DateTimeType">
            <tag name="form.type" alias="datetime" />
        </service>
        <service id="form.type.email" class="Symfony\Component\Form\Extension\Core\Type\EmailType">
            <tag name="form.type" alias="email" />
        </service>
        <service id="form.type.file" class="Symfony\Component\Form\Extension\Core\Type\FileType">
            <tag name="form.type" alias="file" />
        </service>
        <service id="form.type.hidden" class="Symfony\Component\Form\Extension\Core\Type\HiddenType">
            <tag name="form.type" alias="hidden" />
        </service>
        <service id="form.type.integer" class="Symfony\Component\Form\Extension\Core\Type\IntegerType">
            <tag name="form.type" alias="integer" />
        </service>
        <service id="form.type.language" class="Symfony\Component\Form\Extension\Core\Type\LanguageType">
            <tag name="form.type" alias="language" />
        </service>
        <service id="form.type.locale" class="Symfony\Component\Form\Extension\Core\Type\LocaleType">
            <tag name="form.type" alias="locale" />
        </service>
        <service id="form.type.money" class="Symfony\Component\Form\Extension\Core\Type\MoneyType">
            <tag name="form.type" alias="money" />
        </service>
        <service id="form.type.number" class="Symfony\Component\Form\Extension\Core\Type\NumberType">
            <tag name="form.type" alias="number" />
        </service>
        <service id="form.type.password" class="Symfony\Component\Form\Extension\Core\Type\PasswordType">
            <tag name="form.type" alias="password" />
        </service>
        <service id="form.type.percent" class="Symfony\Component\Form\Extension\Core\Type\PercentType">
            <tag name="form.type" alias="percent" />
        </service>
        <service id="form.type.radio" class="Symfony\Component\Form\Extension\Core\Type\RadioType">
            <tag name="form.type" alias="radio" />
        </service>
        <service id="form.type.repeated" class="Symfony\Component\Form\Extension\Core\Type\RepeatedType">
            <tag name="form.type" alias="repeated" />
        </service>
        <service id="form.type.search" class="Symfony\Component\Form\Extension\Core\Type\SearchType">
            <tag name="form.type" alias="search" />
        </service>
        <service id="form.type.textarea" class="Symfony\Component\Form\Extension\Core\Type\TextareaType">
            <tag name="form.type" alias="textarea" />
        </service>
        <service id="form.type.text" class="Symfony\Component\Form\Extension\Core\Type\TextType">
            <tag name="form.type" alias="text" />
        </service>
        <service id="form.type.time" class="Symfony\Component\Form\Extension\Core\Type\TimeType">
            <tag name="form.type" alias="time" />
        </service>
        <service id="form.type.timezone" class="Symfony\Component\Form\Extension\Core\Type\TimezoneType">
            <tag name="form.type" alias="timezone" />
        </service>
        <service id="form.type.url" class="Symfony\Component\Form\Extension\Core\Type\UrlType">
            <tag name="form.type" alias="url" />
        </service>

        <!-- FormTypeHttpFoundationExtension -->
        <service id="form.type_extension.form.http_foundation" class="Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension">
            <tag name="form.type_extension" alias="form" />
        </service>

        <!-- FormTypeValidatorExtension -->
        <service id="form.type_extension.form.validator" class="Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension">
            <tag name="form.type_extension" alias="form" />
            <argument type="service" id="validator" />
        </service>
        <service id="form.type_extension.repeated.validator" class="Symfony\Component\Form\Extension\Validator\Type\RepeatedTypeValidatorExtension">
            <tag name="form.type_extension" alias="repeated" />
        </service>
    </services>
</container>


text:
package com.michaelszymczak.speccare.specminer.controller;

import com.michaelszymczak.speccare.specminer.core.ResultLocator;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.io.IOException;

@Controller
@RequestMapping("/examples")
class ExamplesController {

    @Resource(name = "resultLocator") private ResultLocator featuresDir;

    @RequestMapping(value="/featuresPath", method = RequestMethod.GET)
    @ResponseBody
    public String featuresPath() throws IOException {
        return featuresDir.getFeaturesDirPath().toFile().getAbsolutePath();
    }

    @RequestMapping(value="/resultFilePath", method = RequestMethod.GET)
    @ResponseBody
    public String resultFilePath() throws IOException {
        return featuresDir.getResultFilePath().toFile().getAbsolutePath();
    }
}


text:
id: bad87fee1348bd9aedf08802
title: Uncomment HTML
challengeType: 0
videoUrl: 'https://scrimba.com/p/pVMPUv/cBmG9T7'
forumTopicId: 18329
---

## Description

Commenting is a way that you can leave comments for other developers within your code without affecting the resulting output that is displayed to the end user.
Commenting is also a convenient way to make code inactive without having to delete it entirely.
Comments in HTML start with <!-- and end with a -->

## Instructions

Uncomment your h1, h2 and p elements.

## Tests

```yml
tests:
  - text: Your <code>h1</code> element should be visible on the page by uncommenting it.
    testString: assert($("h1").length > 0);
  - text: Your <code>h2</code> element should be visible on the page by uncommenting it.
    testString: assert($("h2").length > 0);
  - text: Your <code>p</code> element should be visible on the page by uncommenting it.
    testString: assert($("p").length > 0);
  - text: No trailing comment tags should be visible on the page (i.e. <code>--></code>).
    testString: assert(!$('*:contains("-->")')[1]);

```

## Challenge Seed

```html
<!--
<h1>Hello World</h1>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
-->
```

## Solution

```js
<h1>Hello World</h1>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
```


text:
package com.avanza.astrix.config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;

import org.junit.Test;

public class DynamicConfigTest {

	MapConfigSource firstSource = new MapConfigSource();
	MapConfigSource secondSource = new MapConfigSource();
	DynamicConfig dynamicConfig = new DynamicConfig(Arrays.asList(firstSource, secondSource));

	@Test
	public void propertyIsResolvedToFirstOccurenceInConfigSources() throws Exception {
		DynamicStringProperty stringProperty = dynamicConfig.getStringProperty("foo", "defaultFoo");

		secondSource.set("foo", "secondValue");
		assertEquals("secondValue", stringProperty.get());

		firstSource.set("foo", "firstValue");
		assertEquals("firstValue", stringProperty.get());

		secondSource.set("foo", "secondNewValue");
		assertEquals("firstValue", stringProperty.get());
	}

	@Test
	public void propertyValueReturnsToDefaultValueWhenConfigSourceValueIsRemoved() throws Exception {
		DynamicStringProperty stringProperty = dynamicConfig.getStringProperty("foo", "defaultFoo");

		firstSource.set("foo", "firstValue");
		assertEquals("firstValue", stringProperty.get());

		firstSource.set("foo", null);
		assertEquals("defaultFoo", stringProperty.get());

	}

	@Test
	public void booleanProperty() throws Exception {
		DynamicBooleanProperty booleanProperty = dynamicConfig.getBooleanProperty("foo", false);

		secondSource.set("foo", "true");
		assertTrue(booleanProperty.get());

		firstSource.set("foo", "false");
		assertFalse(booleanProperty.get());
	}

	@Test
	public void intProperty() throws Exception {
		DynamicIntProperty intProperty = dynamicConfig.getIntProperty("foo", 0);
		assertEquals(0, intProperty.get());

		secondSource.set("foo", "2");
		assertEquals(2, intProperty.get());

		firstSource.set("foo", "1");
		assertEquals(1, intProperty.get());
	}

	@Test
	public void unparsableBooleanPropertiesAreIgnored() throws Exception {
		DynamicBooleanProperty booleanProperty = dynamicConfig.getBooleanProperty("foo", false);

		secondSource.set("foo", "true");
		assertTrue(booleanProperty.get());

		firstSource.set("foo", "true[L]");
		assertTrue(booleanProperty.get());

		secondSource.set("foo", "MALFORMED");
		assertTrue(booleanProperty.get());

		secondSource.set("foo", "false");
		assertFalse(booleanProperty.get());

		firstSource.set("foo", "true");
		assertTrue(booleanProperty.get());

		firstSource.set("foo", "MALFORMED");
		assertTrue(booleanProperty.get());
	}

	@Test
	public void unparsableIntPropertiesAreIgnored() throws Exception {
		DynamicIntProperty intProperty = dynamicConfig.getIntProperty("foo", 0);

		secondSource.set("foo", "2d");
		assertEquals(0, intProperty.get());

		secondSource.set("foo", "1");
		assertEquals(1, intProperty.get());

		firstSource.set("foo", "1s");
		assertEquals(1, intProperty.get());
	}

	@Test
	public void merge() throws Exception {
		MapConfigSource thirdSource = new MapConfigSource();
		DynamicConfig dynamicConfigB = new DynamicConfig(Arrays.asList(thirdSource));

		DynamicConfig merged = DynamicConfig.merged(dynamicConfig, dynamicConfigB);

		assertEquals("defaultValue", merged.getStringProperty("foo", "defaultValue").get());

		thirdSource.set("foo", "thirdValue");
		assertEquals("thirdValue", merged.getStringProperty("foo", "defaultValue").get());

		firstSource.set("foo", "firstValue");
		assertEquals("firstValue", merged.getStringProperty("foo", "defaultValue").get());

		secondSource.set("foo", "secondValue");
		assertEquals("firstValue", merged.getStringProperty("foo", "defaultValue").get());
	}

	@Test
	public void propertyListenerSupport_StringType() throws Exception {
		firstSource.set("foo", "1");
		secondSource.set("foo", "2");
		Queue<String> events = new LinkedBlockingQueue<>();
		DynamicStringProperty prop = dynamicConfig.getStringProperty("foo", "-");
		prop.addListener(events::add);

		assertEquals("1", prop.getCurrentValue());
		assertNull("Listener should not be notified before a property actually changes", events.poll());
		secondSource.set("foo", "22");
		assertNull("Listener should not be notfied when a property changes but resolved property has the same value", events.poll());

		firstSource.set("foo", "11");
		assertEquals("Listener should be notified when property resolved changes", "11", events.poll());

		secondSource.set("foo", "11");
		assertNull(events.poll());
	}

	@Test
	public void propertyListenerSupport_IntType() throws Exception {
		firstSource.set("intProp", "1");
		DynamicIntProperty prop = dynamicConfig.getIntProperty("intProp", 0);
		Queue<Integer> events = new LinkedBlockingQueue<>();
		prop.addListener(events::add);

		assertEquals(1, prop.getCurrentValue().intValue());
		assertNull("Listener should not be notified before a property actually changes", events.poll());

		firstSource.set("intProp", "11");
		assertEquals("Listener should be notified when property resolved changes", Integer.valueOf(11), events.poll());
	}

	@Test
	public void propertyListenerSupport_LongType() throws Exception {
		firstSource.set("longProp", "1");
		DynamicLongProperty prop = dynamicConfig.getLongProperty("longProp", 0);
		Queue<Long> events = new LinkedBlockingQueue<>();
		prop.addListener(events::add);

		assertEquals(1, prop.getCurrentValue().longValue());
		assertNull("Listener should not be notified before a property actually changes", events.poll());

		firstSource.set("longProp", "11");
		assertEquals("Listener should be notified when property resolved changes", Long.valueOf(11), events.poll());
	}

	@Test
	public void propertyListenerSupport_BooleanType() throws Exception {
		firstSource.set("booleanProp", "true");
		DynamicBooleanProperty prop = dynamicConfig.getBooleanProperty("booleanProp", false);
		Queue<Boolean> events = new LinkedBlockingQueue<>();
		prop.addListener(events::add);

		assertEquals(Boolean.TRUE, prop.getCurrentValue());
		assertNull("Listener should not be notified before a property actually changes", events.poll());

		firstSource.set("booleanProp", "false");
		assertEquals("Listener should be notified when property resolved changes", Boolean.FALSE, events.poll());
	}

	@Test
	public void globalPropertyListenerIsNotifiedWhenNewPropertyIsCreated() throws Exception {
		firstSource.set("booleanProp", "true");
		DynamicBooleanProperty prop = dynamicConfig.getBooleanProperty("booleanProp", false);
		Queue<Boolean> events = new LinkedBlockingQueue<>();
		prop.addListener(events::add);

		assertEquals(Boolean.TRUE, prop.getCurrentValue());
		assertNull("Listener should not be notified before a property actually changes", events.poll());

		firstSource.set("booleanProp", "false");
		assertEquals("Listener should be notified when property resolved changes", Boolean.FALSE, events.poll());
	}

	@Test
	public void globalConfigListenerSupport_PropertyCreatedEvents() throws Exception {
		class Prop {
			String name;
			Object val;
			public Prop(String name, Object val) {
				this.name = name;
				this.val = val;
			}
			@Override
			public String toString() {
				return name + "=" + val;
			}
		}
		MapConfigSource firstSource = new MapConfigSource();
		firstSource.set("foo", "1");
		MapConfigSource secondSource = new MapConfigSource();
		secondSource.set("foo", "2");

		DynamicConfig config = DynamicConfig.create(firstSource, secondSource);
		Queue<Prop> propertyCreatedEvents = new LinkedBlockingQueue<>();
		config.addListener(new DynamicConfigListener() {
			@Override
			public void propertyCreated(String propertyName, Object initialValue) {
				propertyCreatedEvents.add(new Prop(propertyName, initialValue));
			}
		});

		assertNull(propertyCreatedEvents.poll());
		config.getStringProperty("foo", "default");
		assertEquals("foo", propertyCreatedEvents.poll().name);

		// Should return cached value and not fire created event
		config.getStringProperty("foo", "default");
		assertNull(propertyCreatedEvents.poll());
	}

	@Test
	public void globalConfigListenerSupport_PropertyUpdateEvents() throws Exception {
		class Prop {
			String name;
			Object val;
			public Prop(String name, Object val) {
				this.name = name;
				this.val = val;
			}
			@Override
			public String toString() {
				return name + "=" + val;
			}
		}
		MapConfigSource firstSource = new MapConfigSource();
		firstSource.set("foo", "1");
		MapConfigSource secondSource = new MapConfigSource();
		secondSource.set("foo", "2");

		DynamicConfig config = DynamicConfig.create(firstSource, secondSource);
		Queue<Prop> propertyChangeEvents = new LinkedBlockingQueue<>();
		config.addListener(new DynamicConfigListener() {
			@Override
			public void propertyChanged(String propertyName, Object newValue) {
				propertyChangeEvents.add(new Prop(propertyName, newValue));
			}
		});

		assertNull(propertyChangeEvents.poll());
		config.getStringProperty("foo", "default");
		assertNull(propertyChangeEvents.poll());

		firstSource.set("foo", "11");
		Prop prop = propertyChangeEvents.poll();
		assertNotNull(prop);
		assertEquals("foo", prop.name);
		assertEquals("11", prop.val);

		secondSource.set("foo", "11");
		assertNull(propertyChangeEvents.poll());
	}

}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Trudy Bjuro Prikl. Bot. 8:64. 1915

#### Original name
null

### Remarks
null


text:
from collections import namedtuple

scopes = namedtuple('Scope', 'type_prefix type_5 type_7')(
    type_prefix='string.unquoted.cisco.password.type',
    type_5=[
        'string.unquoted.cisco.password.type.5',
    ],
    type_7=[
        'string.unquoted.cisco.password.type.7',
    ],
)


text:
/* Countdown timer */
function Countdown(duration, granularity) {
  this.duration = duration;
  this.granularity = granularity || 1000;
  this.tickCallbacks = [];
  this.expireCallbacks = [];
  this.running = false;
  this._timeout = null;
}

Countdown.prototype.start = function() {
  if (this.running) { return; }
  this.running = true;
  var start = Date.now(),
      self = this,
      diff;

  (function timer() {
    diff = self.duration - (((Date.now() - start) / 1000) | 0);

    if (diff > 0) {
      self._timeout = setTimeout(timer, self.granularity);
    } else {
      diff = 0;
      self.running = false;
      self._timeout = null;
    }

    self.tickCallbacks.forEach(function(f) {
      f.call(this, diff);
    }, self);

    if (diff <= 0) {
    self.expireCallbacks.forEach(function(f) {
        f.call(this);
      }, self);
    };

  }());
};

Countdown.prototype.stop = function() {
  if (!this.running) { return; }
  if (this._timeout != null) {
    clearTimeout(this._timeout);
    this._timeout = null;
  }
  this.running = false;
}

Countdown.prototype.restart = function() {
  this.stop();
  this.start();
}

Countdown.prototype.onTick = function(f) {
  if (typeof f === 'function') {
    this.tickCallbacks.push(f);
  }
  return this;
};

Countdown.prototype.onExpire = function(f) {
  if (typeof f === 'function') {
    this.expireCallbacks.push(f);
  }
  return this;
}

Countdown.prototype.expired = function() {
  return !this.running;
};

/* Templates */

var nodeFactory = new (function(){
	var self = this;
	return self = {
		templates: {
			'post': '

{{ topic }} {{ author_name }} {{ created_at }} #{{ id }}

{{ text }}

'
		},

		buildFromData: function buildFromData(template_name, data) {
			var node = $(self.templates[template_name]);
			if (template_name == 'post') {
				node.attr('data-post-id', data.id);
				node.find('.header .topic').html(data.topic);
				node.find('.header .author_name').html(data.author_name || 'Аноним');
				node.find('.header .date').html(data.created_at.replace(/\.[0-9]+$/, '')); // a bit hacky
				node.find('.header .reflink').html('#' + data.id);
				node.find('.text').html(data.text);
			} else {
				throw new Error('No such template: ' + template_name);
			}
			return node;
		}
	};
})();

/* Settings */

var userSettings = {
	'autoupdate': true,
	'autoupdate_board': false,
	'autoupdate_interval': 10
};

/* Application */

var App = function(){
	var self = this;
	return self = {

		config: {},

		getThreadPostsAfter: function getThreadPostsAfter(thread_id, last_post_id) {
			return $.getJSON(
				'/api/threads/' + thread_id + '/posts/after/' + last_post_id
			);
		},

		updateThreads: function() {
			var threads = $('.thread');

			threads.each(function(index){
				var thread = $(this);
				var thread_id = thread.attr('data-thread-id');
				var last_post_id = thread.find('.post').last().attr('data-post-id');

				// Optionally update thread previews on board page; TODO
				if (thread.hasClass('preview') && userSettings.autoupdate_board) {
					self.getThreadPostsAfter(thread_id, last_post_id)
					.done(function(response) {
						if (!response.posts) { return; }
						var posts = response.posts.slice(-self.config.THREAD_PREVIEW_POSTS_COUNT);
						var delete_count = Math.min(thread.find('.post').length - 1, posts.length);

						// TODO: nice animations
						thread.find('.post').slice(1, 1 + delete_count).remove();

						for (var i = 0; i < posts.length; ++i) {
							var post = nodeFactory.buildFromData('post', posts[i]);
							thread.append(post);
						}

					});
				} else {
					self.getThreadPostsAfter(thread_id, last_post_id)
						.done(function(response) {
							if (!response.posts) { return; }
							for (var i = 0; i < response.posts.length; ++i) {
								var post = nodeFactory.buildFromData('post', response.posts[i]);
								// TODO: nice animations
								post.css('display', 'none');
								thread.append(post);
								post.fadeIn();
							}
							self.autoupdateCountdown.start();
						})
						.error(function() {
							self.autoupdateCountdown.start();
						});
				}
			})
		},

		init: function() {
			console.log('initializing');
			if (userSettings.autoupdate) {
				this.autoupdateCountdown = new Countdown(userSettings.autoupdate_interval, 1000)
					.onTick(function(remaining) {
						$('.autoupdate-countdown').html('Автообновление через ' + remaining.toString());
					})
					.onExpire(function() {
						try {
							$('.autoupdate-countdown').html('Автообновление...');
							self.updateThreads();
						} catch(e) {

						}
					});
				this.autoupdateCountdown.start();
			}
		}
	};
};

// Some settings are set in base.html template, so app must be accessible from global scope
var app = new App();

$(document).ready(function() {
	app.init();
	$('.autoupdate-toggle').prop('checked', userSettings.autoupdate === true);

	/* Posting form */
	$('.posting-form-toggle').each(function() {
		var $this = $(this);
		$this.html('[ ' + $this.attr('data-message-on') + ' ]');
		$this.attr('data-form-open', false);
	});

	$('.posting-form-toggle').on('click', function() {
		var $this = $(this);
		var $posting_form = $this.next('.posting-form');

		if ($this.attr('data-form-open') == 'false') {
			$this.html('[ ' + $this.attr('data-message-off') + ' ]');
			$posting_form.show();
			$this.attr('data-form-open', true);
		} else {
			$this.html('[ ' + $this.attr('data-message-on') + ' ]');
			$posting_form.hide();
			$this.attr('data-form-open', false);
		}

	});

	/* Youtube previews */
	$('.yt-preview').on('click', function() {
		var $this = $(this);
		var $video = $this.next('.yt-player');
		$video.show();
		$this.hide();
	});

	/* Autoupdating */

	$autoupdate_toggles = $('input[type="checkbox"].autoupdate-toggle')
	$autoupdate_toggles.on('change', function() {
		var $this = $(this);
		if ($this.is(':checked')) {
			app.autoupdateCountdown.start();
			$autoupdate_toggles.prop('checked', true);
		} else {
			app.autoupdateCountdown.stop();
			$autoupdate_toggles.prop('checked', false);
			$autoupdate_toggles.next('.autoupdate-countdown').html('Автообновление');
		}
	});

	/* Post links (works for dynamic elements) */

	$('.thread').on('mouseover', 'a.postlink', function() {
		// TODO
	});

	// Helper function to smartly toggle on posting forms on a page
	function showPostingForms() {
		var $forms = $('.posting-form')
		var $hidden_forms = $forms.filter(':hidden');
		// If there are visible forms, do nothing
		if ($forms.count - $hidden_forms.count > 0) { return; }
		$hidden_forms.each(function() {
			$(this).prev('.posting-form-toggle').click();
		});
	}

	/* Reflink click */

	$('.thread').on('click', 'a.reflink', function() {
		var reflink = $(this).html().match(/\d+/);
		$('.posting-form textarea[name="text"]').each(function() {
			var $this = $(this);
			$this.val( $this.val() + ">>" + reflink );
		});
		showPostingForms();
	});

});


text:
<?xml version="1.0" encoding="utf-8"?>
<project>
  <triggers class="vector">
    <org.jenkinsci.plugins.urltrigger.URLTrigger>
      <spec>* * * * *</spec>
      <labelRestriction>true</labelRestriction>
      <triggerLabel>label expression</triggerLabel>
      <entries>
        <org.jenkinsci.plugins.urltrigger.URLTriggerEntry>
          <url>http://example.com/url1</url>
          <username>username</username>
          <password>sekr3t</password>
          <checkStatus>true</checkStatus>
          <proxyActivated>false</proxyActivated>
          <timeout>442</timeout>
          <checkETag>false</checkETag>
          <checkLastModificationDate>true</checkLastModificationDate>
          <statusCode>202</statusCode>
          <inspectingContent>true</inspectingContent>
          <contentTypes>
            <org.jenkinsci.plugins.urltrigger.content.SimpleContentType/>
            <org.jenkinsci.plugins.urltrigger.content.JSONContentType>
              <jsonPaths>
                <org.jenkinsci.plugins.urltrigger.content.JSONContentEntry>
                  <jsonPath>$..author</jsonPath>
                </org.jenkinsci.plugins.urltrigger.content.JSONContentEntry>
                <org.jenkinsci.plugins.urltrigger.content.JSONContentEntry>
                  <jsonPath>$.store..price</jsonPath>
                </org.jenkinsci.plugins.urltrigger.content.JSONContentEntry>
              </jsonPaths>
            </org.jenkinsci.plugins.urltrigger.content.JSONContentType>
          </contentTypes>
        </org.jenkinsci.plugins.urltrigger.URLTriggerEntry>
        <org.jenkinsci.plugins.urltrigger.URLTriggerEntry>
          <url>http://example.com/url2</url>
          <checkStatus>false</checkStatus>
          <statusCode>200</statusCode>
          <proxyActivated>true</proxyActivated>
          <timeout>300</timeout>
          <checkETag>true</checkETag>
          <checkLastModificationDate>false</checkLastModificationDate>
          <statusCode/>
          <inspectingContent>true</inspectingContent>
          <contentTypes>
            <org.jenkinsci.plugins.urltrigger.content.XMLContentType>
              <xPaths>
                <org.jenkinsci.plugins.urltrigger.content.XMLContentEntry>
                  <xPath>//author</xPath>
                </org.jenkinsci.plugins.urltrigger.content.XMLContentEntry>
                <org.jenkinsci.plugins.urltrigger.content.XMLContentEntry>
                  <xPath>/store//price</xPath>
                </org.jenkinsci.plugins.urltrigger.content.XMLContentEntry>
              </xPaths>
            </org.jenkinsci.plugins.urltrigger.content.XMLContentType>
            <org.jenkinsci.plugins.urltrigger.content.TEXTContentType>
              <regExElements>
                <org.jenkinsci.plugins.urltrigger.content.TEXTContentEntry>
                  <regEx>\d+</regEx>
                </org.jenkinsci.plugins.urltrigger.content.TEXTContentEntry>
              </regExElements>
            </org.jenkinsci.plugins.urltrigger.content.TEXTContentType>
          </contentTypes>
        </org.jenkinsci.plugins.urltrigger.URLTriggerEntry>
      </entries>
    </org.jenkinsci.plugins.urltrigger.URLTrigger>
  </triggers>
</project>


text:
import NegativeValidator  from 'ember-cli-data-validation/validators/negative';

export default NegativeValidator;


text:
package org.I0Itec.zkclient;

import org.I0Itec.zkclient.exception.ZkTimeoutException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;

//import org.apache.log4j.Logger;

public abstract class AbstractBaseZkClientTest {

    //protected static final Logger LOG = Logger.getLogger(AbstractBaseZkClientTest.class);
    protected static final Logger LOG = LoggerFactory.getLogger(AbstractBaseZkClientTest.class);
    protected ZkServer _zkServer;
    protected ZkClient _client;

    @Before
    public void setUp() throws Exception {
        LOG.info("------------ BEFORE -------------");

    }

    @After
    public void tearDown() throws Exception {
        LOG.info("------------ AFTER -------------");
    }

    @Test(expected = ZkTimeoutException.class, timeout = 15000)
    public void testUnableToConnect() throws Exception {
        LOG.info("--- testUnableToConnect");
        // we are using port 4711 to avoid conflicts with the zk server that is
        // started by the Spring context
        new ZkClient("localhost:4712", 5000);
    }

    @Test
    public void testWriteAndRead() throws Exception {
        LOG.info("--- testWriteAndRead");
        String data = "something";
        String path = "/a";
        _client.createPersistent(path, data);
        String data2 = _client.readData(path);
        Assert.assertEquals(data, data2);
        _client.delete(path);
    }

    @Test
    public void testDelete() throws Exception {
        LOG.info("--- testDelete");
        String path = "/a";
        assertFalse(_client.delete(path));
        _client.createPersistent(path, null);
        assertTrue(_client.delete(path));
        assertFalse(_client.delete(path));
    }

    @Test
    public void testDeleteRecursive() throws Exception {
        LOG.info("--- testDeleteRecursive");

        // should be able to call this on a not existing directory
        _client.deleteRecursive("/doesNotExist");
    }

    @Test
    public void testWaitUntilExists() {
        LOG.info("--- testWaitUntilExists");
        // create /gaga node asynchronously
        new Thread() {
            @Override
            public void run() {
                try {
                    Thread.sleep(100);
                    _client.createPersistent("/gaga");
                } catch (Exception e) {
                    // ignore
                }
            }
        }.start();

        // wait until this was created
        assertTrue(_client.waitUntilExists("/gaga", TimeUnit.SECONDS, 5));
        assertTrue(_client.exists("/gaga"));

        // waiting for /neverCreated should timeout
        assertFalse(_client.waitUntilExists("/neverCreated", TimeUnit.MILLISECONDS, 100));
    }

    @Test
    public void testDataChanges1() throws Exception {
        LOG.info("--- testDataChanges1");
        String path = "/a";
        final Holder<String> holder = new Holder<String>();

        IZkDataListener listener = new IZkDataListener() {

            @Override
            public void handleDataChange(String dataPath, Object data) throws Exception {
                holder.set((String) data);
            }

            @Override
            public void handleDataDeleted(String dataPath) throws Exception {
                holder.set(null);
            }
        };
        _client.subscribeDataChanges(path, listener);
        _client.createPersistent(path, "aaa");

        // wait some time to make sure the event was triggered
        String contentFromHolder = TestUtil.waitUntil("b", new Callable<String>() {

            @Override
            public String call() throws Exception {
                return holder.get();
            }
        }, TimeUnit.SECONDS, 5);

        assertEquals("aaa", contentFromHolder);
    }

    @Test
    public void testDataChanges2() throws Exception {
        LOG.info("--- testDataChanges2");
        String path = "/a";
        final AtomicInteger countChanged = new AtomicInteger(0);
        final AtomicInteger countDeleted = new AtomicInteger(0);

        IZkDataListener listener = new IZkDataListener() {

            @Override
            public void handleDataChange(String dataPath, Object data) throws Exception {
                countChanged.incrementAndGet();
            }

            @Override
            public void handleDataDeleted(String dataPath) throws Exception {
                countDeleted.incrementAndGet();
            }
        };
        _client.subscribeDataChanges(path, listener);

        // create node
        _client.createPersistent(path, "aaa");

        // wait some time to make sure the event was triggered
        TestUtil.waitUntil(1, new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return countChanged.get();
            }
        }, TimeUnit.SECONDS, 5);
        assertEquals(1, countChanged.get());
        assertEquals(0, countDeleted.get());

        countChanged.set(0);
        countDeleted.set(0);
        // delete node, this should trigger a delete event
        _client.delete(path);
        // wait some time to make sure the event was triggered
        TestUtil.waitUntil(1, new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return countDeleted.get();
            }
        }, TimeUnit.SECONDS, 5);
        assertEquals(0, countChanged.get());
        assertEquals(1, countDeleted.get());

        // test if watch was reinstalled after the file got deleted
        countChanged.set(0);
        _client.createPersistent(path, "aaa");

        // wait some time to make sure the event was triggered
        TestUtil.waitUntil(1, new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return countChanged.get();
            }
        }, TimeUnit.SECONDS, 5);
        assertEquals(1, countChanged.get());

        // test if changing the contents notifies the listener
        _client.writeData(path, "bbb");

        // wait some time to make sure the event was triggered
        TestUtil.waitUntil(2, new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return countChanged.get();
            }
        }, TimeUnit.SECONDS, 5);
        assertEquals(2, countChanged.get());
    }

    @Test(timeout = 15000)
    public void testHandleChildChanges() throws Exception {
        LOG.info("--- testHandleChildChanges");
        String path = "/a";
        final AtomicInteger count = new AtomicInteger(0);
        final Holder<List<String>> children = new Holder<List<String>>();

        IZkChildListener listener = new IZkChildListener() {

            @Override
            public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
                count.incrementAndGet();
                children.set(currentChilds);
            }
        };
        _client.subscribeChildChanges(path, listener);

        // ----
        // Create the root node should throw the first child change event
        // ----
        _client.createPersistent(path);

        // wait some time to make sure the event was triggered
        TestUtil.waitUntil(1, new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return count.get();
            }
        }, TimeUnit.SECONDS, 5);
        assertEquals(1, count.get());
        assertEquals(0, children.get().size());

        // ----
        // Creating a child node should throw another event
        // ----
        count.set(0);
        _client.createPersistent(path + "/child1");

        // wait some time to make sure the event was triggered
        TestUtil.waitUntil(1, new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return count.get();
            }
        }, TimeUnit.SECONDS, 5);
        assertEquals(1, count.get());
        assertEquals(1, children.get().size());
        assertEquals("child1", children.get().get(0));

        // ----
        // Creating another child and deleting the node should also throw an event
        // ----
        count.set(0);
        _client.createPersistent(path + "/child2");
        _client.deleteRecursive(path);

        // wait some time to make sure the event was triggered
        Boolean eventReceived = TestUtil.waitUntil(true, new Callable<Boolean>() {

            @Override
            public Boolean call() throws Exception {
                return count.get() > 0 && children.get() == null;
            }
        }, TimeUnit.SECONDS, 5);
        assertTrue(eventReceived);
        assertNull(children.get());

        // ----
        // Creating root again should throw an event
        // ----
        count.set(0);
        _client.createPersistent(path);

        // wait some time to make sure the event was triggered
        eventReceived = TestUtil.waitUntil(true, new Callable<Boolean>() {

            @Override
            public Boolean call() throws Exception {
                return count.get() > 0 && children.get() != null;
            }
        }, TimeUnit.SECONDS, 5);
        assertTrue(eventReceived);
        assertEquals(0, children.get().size());

        // ----
        // Creating child now should throw an event
        // ----
        count.set(0);
        _client.createPersistent(path + "/child");

        // wait some time to make sure the event was triggered
        eventReceived = TestUtil.waitUntil(true, new Callable<Boolean>() {

            @Override
            public Boolean call() throws Exception {
                return count.get() > 0;
            }
        }, TimeUnit.SECONDS, 5);
        assertTrue(eventReceived);
        assertEquals(1, children.get().size());
        assertEquals("child", children.get().get(0));

        // ----
        // Deleting root node should throw an event
        // ----
        count.set(0);
        _client.deleteRecursive(path);

        // wait some time to make sure the event was triggered
        eventReceived = TestUtil.waitUntil(true, new Callable<Boolean>() {

            @Override
            public Boolean call() throws Exception {
                return count.get() > 0 && children.get() == null;
            }
        }, TimeUnit.SECONDS, 5);
        assertTrue(eventReceived);
        assertNull(children.get());
    }

    @Test
    public void testGetCreationTime() throws Exception {
        long start = System.currentTimeMillis();
        Thread.sleep(100);
        String path = "/a";
        _client.createPersistent(path);
        Thread.sleep(100);
        long end = System.currentTimeMillis();
        long creationTime = _client.getCreationTime(path);
        assertTrue(start < creationTime && end > creationTime);
    }

    @Test
    public void testNumberOfListeners() {
        IZkChildListener zkChildListener = mock(IZkChildListener.class);
        _client.subscribeChildChanges("/", zkChildListener);
        assertEquals(1, _client.numberOfListeners());

        IZkDataListener zkDataListener = mock(IZkDataListener.class);
        _client.subscribeDataChanges("/a", zkDataListener);
        assertEquals(2, _client.numberOfListeners());

        _client.subscribeDataChanges("/b", zkDataListener);
        assertEquals(3, _client.numberOfListeners());

        IZkStateListener zkStateListener = mock(IZkStateListener.class);
        _client.subscribeStateChanges(zkStateListener);
        assertEquals(4, _client.numberOfListeners());

        _client.unsubscribeChildChanges("/", zkChildListener);
        assertEquals(3, _client.numberOfListeners());

        _client.unsubscribeDataChanges("/b", zkDataListener);
        assertEquals(2, _client.numberOfListeners());

        _client.unsubscribeDataChanges("/a", zkDataListener);
        assertEquals(1, _client.numberOfListeners());

        _client.unsubscribeStateChanges(zkStateListener);
        assertEquals(0, _client.numberOfListeners());
    }
}


text:
@interface CellCommand:NSObject
@property (nonatomic,copy) NSString* title;
@property (nonatomic,assign) SEL action;
-(id)initWithTitle:(NSString*)title action:(SEL)action;
+(id)cellCommandWithTitle:(NSString*)title action:(SEL)action;
@end
@interface ViewController : UITableViewController{
    NSMutableArray* _cellCommandList;
}
@end


text:
using System;
using System.Collections.Generic;
using Common;
using Fairweather.Service;
using TT = Versioning.TransType;

namespace DTA
{
    public class TE_Helper : Ini_Helper
    {
        public TE_Helper(Ini_File ini, Company_Number company) :
            base(ini, company) {

        }

        public IEnumerable<TT> Check_Ref() {

            if (!False(DTA_Fields.TE_sales_ref_check)) {
                yield return TT.sdoSI;
                yield return TT.sdoSC;

            }

            if (!False(DTA_Fields.TE_purchase_ref_check)) {
                yield return TT.sdoPI;
                yield return TT.sdoPC;

            }

        }

        public int Max_Details_History_Length {
            get {
                return Math.Max(Int(DTA_Fields.TE_max_details_history_length), 0);
            }
        }

        public string Default_Nominal_Code(bool is_receipt) {
            return String(is_receipt ?
                        DTA_Fields.TE_default_bank_receipts :
                        DTA_Fields.TE_default_bank_payments);
        }

        public bool Jx_Against_Debtors_Creditors_Ctrl {
            get {
                return True(DTA_Fields.TE_jx_against_debtors_creditors_ctrl);
            }
        }
        public bool Posted_Report {
            get {
                return True(DTA_Fields.TE_posted_report);
            }
        }

    }
}


text:
package com.lachesis.support.auth.cache;

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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lachesis.support.auth.data.TokenService;
import com.lachesis.support.objects.entity.auth.Token;

public abstract class AbstractTokenSynchronizer implements TokenSynchronizer {
	private static final Logger LOG = LoggerFactory.getLogger(AbstractTokenSynchronizer.class);
	private TokenQueueBroker tokenQueueBroker;
	private TokenService tokenService;
	private int waitPeriodMilliSeconds = 1000*10;
	private int maxSizeInPatch = 100;

	public AbstractTokenSynchronizer(TokenQueueBroker tokenQueueBroker, TokenService tokenService) {
		super();
		this.tokenQueueBroker = tokenQueueBroker;
		this.tokenService = tokenService;
	}

	protected TokenQueueBroker getTokenQueueBroker() {
		return tokenQueueBroker;
	}

	protected TokenService getTokenService() {
		return tokenService;
	}

	protected boolean needToWait(long st, long ed, int size) {
		if (size == 0) {
			return true;
		}

		long elapse = (ed - st);
		if (elapse >= waitPeriodMilliSeconds) {
			return false;
		}

		if (size >= maxSizeInPatch) {
			return false;
		}

		return true;
	}

	protected int getMaxSizeInPatch() {
		return maxSizeInPatch;
	}

	public void setMaxSizeInPatch(int maxSizeInPatch) {
		this.maxSizeInPatch = maxSizeInPatch;
	}

	@Override
	public void run() {
		while (true) {
			try {
				long st = System.currentTimeMillis();
				List<Token> tokens = new ArrayList<Token>(getMaxSizeInPatch());
				while (true) {
					if (!needToWait(st, System.currentTimeMillis(), tokens.size())) {
						List<Token> tokensCopy = new LinkedList<Token>(tokens);
						processWithTokenService(tokensCopy);

						tokens.clear();
						st = System.currentTimeMillis();
					}

					Token t = takeToken();
					if (t != null) {
						tokens.add(t);
					}
				}

			} catch (Exception e) {
				LOG.warn(this.getClass().getSimpleName() + " - " + e.getMessage(),e);
			}

		}
	}

	protected abstract void processWithTokenService(List<Token> tokensCopy);

	protected abstract Token takeToken();

}


text:
protractor-linkuisref-locator
===

Adds a locator to a protractor instance that finds `anchor` elements by their `ui-sref` attribute.

**Need a general (not just anchors) `ui-sref` locator? See [protractor-uisref-locator](https://github.com/crzrcn/protractor-uisref-locator).**

## Installation

`$ npm install protractor-linkuisref-locator`

## Usage

```javascript
onPrepare: function () {
  // Your other stuff.
  require('protractor-linkuisref-locator')(protractor);
}
```

The locator will be available in your specs as `by.linkUiSref(toState, [parentElement])`.

`toState` is a `String` that represents a [ui-router](https://github.com/angular-ui/ui-router) state. Also supports `data-` prefix.

`parentElement` represents an `HTML element`. It is optional and defaults to the `document` element.

The locator returns:
* `null` if no anchor is found.
* An `anchor` element if only one is found.
* An `Array` of anchor elements if more than one is found.

## Example Calls

```javascript
by.linkUiSref('users.show({id: 42})', element(by.css('.users')));
```

```javascript
by.linkUiSref('users.index.page({page: 2})');
```

## Tests

You will run each command on a separate terminal window.

`$ npm run start`

`$ npm run webdriver`

`$ npm run test`