text:
namespace flutter {

//------------------------------------------------------------------------------
/// @brief      Attempts to create a task runner from an embedder task runner
///             description. The first boolean in the pair indicate whether the
///             embedder specified an invalid task runner description. In this
///             case, engine launch must be aborted. If the embedder did not
///             specify any task runner, an engine managed task runner and
///             thread must be selected instead.
///
/// @param[in]  description  The description
///
/// @return     A pair that returns if the embedder has specified a task runner
///             (null otherwise) and whether to terminate further engine launch.
///
static std::pair<bool, fml::RefPtr<EmbedderTaskRunner>>
CreateEmbedderTaskRunner(const FlutterTaskRunnerDescription* description) {
  if (description == nullptr) {
    // This is not embedder error. The embedder API will just have to create a
    // plain old task runner (and create a thread for it) instead of using a
    // task runner provided to us by the embedder.
    return {true, {}};
  }

  if (SAFE_ACCESS(description, runs_task_on_current_thread_callback, nullptr) ==
      nullptr) {
    FML_LOG(ERROR) << "FlutterTaskRunnerDescription.runs_task_on_current_"
                      "thread_callback was nullptr.";
    return {false, {}};
  }

  if (SAFE_ACCESS(description, post_task_callback, nullptr) == nullptr) {
    FML_LOG(ERROR)
        << "FlutterTaskRunnerDescription.post_task_callback was nullptr.";
    return {false, {}};
  }

  auto user_data = SAFE_ACCESS(description, user_data, nullptr);

  // ABI safety checks have been completed.
  auto post_task_callback_c = description->post_task_callback;
  auto runs_task_on_current_thread_callback_c =
      description->runs_task_on_current_thread_callback;

  EmbedderTaskRunner::DispatchTable task_runner_dispatch_table = {
      // .post_task_callback
      [post_task_callback_c, user_data](EmbedderTaskRunner* task_runner,
                                        uint64_t task_baton,
                                        fml::TimePoint target_time) -> void {
        FlutterTask task = {
            // runner
            reinterpret_cast<FlutterTaskRunner>(task_runner),
            // task
            task_baton,
        };
        post_task_callback_c(task, target_time.ToEpochDelta().ToNanoseconds(),
                             user_data);
      },
      // runs_task_on_current_thread_callback
      [runs_task_on_current_thread_callback_c, user_data]() -> bool {
        return runs_task_on_current_thread_callback_c(user_data);
      }};

  return {true, fml::MakeRefCounted<EmbedderTaskRunner>(
                    task_runner_dispatch_table,
                    SAFE_ACCESS(description, identifier, 0u))};
}

std::unique_ptr<EmbedderThreadHost>
EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost(
    const FlutterCustomTaskRunners* custom_task_runners,
    flutter::ThreadConfigSetter config_setter) {
  {
    auto host =
        CreateEmbedderManagedThreadHost(custom_task_runners, config_setter);
    if (host && host->IsValid()) {
      return host;
    }
  }

  // Only attempt to create the engine managed host if the embedder did not
  // specify a custom configuration. Don't fallback to the engine managed
  // configuration if the embedder attempted to specify a configuration but
  // messed up with an incorrect configuration.
  if (custom_task_runners == nullptr) {
    auto host = CreateEngineManagedThreadHost(config_setter);
    if (host && host->IsValid()) {
      return host;
    }
  }

  return nullptr;
}

static fml::RefPtr<fml::TaskRunner> GetCurrentThreadTaskRunner() {
  fml::MessageLoop::EnsureInitializedForCurrentThread();
  return fml::MessageLoop::GetCurrent().GetTaskRunner();
}

constexpr const char* kFlutterThreadName = "io.flutter";

fml::Thread::ThreadConfig MakeThreadConfig(
    flutter::ThreadHost::Type type,
    fml::Thread::ThreadPriority priority) {
  return fml::Thread::ThreadConfig(
      flutter::ThreadHost::ThreadHostConfig::MakeThreadName(type,
                                                            kFlutterThreadName),
      priority);
}

// static
std::unique_ptr<EmbedderThreadHost>
EmbedderThreadHost::CreateEmbedderManagedThreadHost(
    const FlutterCustomTaskRunners* custom_task_runners,
    flutter::ThreadConfigSetter config_setter) {
  if (custom_task_runners == nullptr) {
    return nullptr;
  }

  auto thread_host_config = ThreadHost::ThreadHostConfig(config_setter);

  // The UI and IO threads are always created by the engine and the embedder has
  // no opportunity to specify task runners for the same.
  //
  // If/when more task runners are exposed, this mask will need to be updated.
  thread_host_config.SetUIConfig(MakeThreadConfig(
      ThreadHost::Type::UI, fml::Thread::ThreadPriority::DISPLAY));
  thread_host_config.SetIOConfig(MakeThreadConfig(
      ThreadHost::Type::IO, fml::Thread::ThreadPriority::BACKGROUND));

  auto platform_task_runner_pair = CreateEmbedderTaskRunner(
      SAFE_ACCESS(custom_task_runners, platform_task_runner, nullptr));
  auto render_task_runner_pair = CreateEmbedderTaskRunner(
      SAFE_ACCESS(custom_task_runners, render_task_runner, nullptr));

  if (!platform_task_runner_pair.first || !render_task_runner_pair.first) {
    // User error while supplying a custom task runner. Return an invalid thread
    // host. This will abort engine initialization. Don't fallback to defaults
    // if the user wanted to specify a task runner but just messed up instead.
    return nullptr;
  }

  // If the embedder has not supplied a raster task runner, one needs to be
  // created.
  if (!render_task_runner_pair.second) {
    thread_host_config.SetRasterConfig(MakeThreadConfig(
        ThreadHost::Type::RASTER, fml::Thread::ThreadPriority::RASTER));
  }

  // If both the platform task runner and the raster task runner are specified
  // and have the same identifier, store only one.
  if (platform_task_runner_pair.second && render_task_runner_pair.second) {
    if (platform_task_runner_pair.second->GetEmbedderIdentifier() ==
        render_task_runner_pair.second->GetEmbedderIdentifier()) {
      render_task_runner_pair.second = platform_task_runner_pair.second;
    }
  }

  // Create a thread host with just the threads that need to be managed by the
  // engine. The embedder has provided the rest.
  ThreadHost thread_host(thread_host_config);

  // If the embedder has supplied a platform task runner, use that. If not, use
  // the current thread task runner.
  auto platform_task_runner = platform_task_runner_pair.second
                                  ? static_cast<fml::RefPtr<fml::TaskRunner>>(
                                        platform_task_runner_pair.second)
                                  : GetCurrentThreadTaskRunner();

  // If the embedder has supplied a raster task runner, use that. If not, use
  // the one from our thread host.
  auto render_task_runner = render_task_runner_pair.second
                                ? static_cast<fml::RefPtr<fml::TaskRunner>>(
                                      render_task_runner_pair.second)
                                : thread_host.raster_thread->GetTaskRunner();

  flutter::TaskRunners task_runners(
      kFlutterThreadName,
      platform_task_runner,                    // platform
      render_task_runner,                      // raster
      thread_host.ui_thread->GetTaskRunner(),  // ui (always engine managed)
      thread_host.io_thread->GetTaskRunner()   // io (always engine managed)
  );

  if (!task_runners.IsValid()) {
    return nullptr;
  }

  std::set<fml::RefPtr<EmbedderTaskRunner>> embedder_task_runners;

  if (platform_task_runner_pair.second) {
    embedder_task_runners.insert(platform_task_runner_pair.second);
  }

  if (render_task_runner_pair.second) {
    embedder_task_runners.insert(render_task_runner_pair.second);
  }

  auto embedder_host = std::make_unique<EmbedderThreadHost>(
      std::move(thread_host), std::move(task_runners),
      std::move(embedder_task_runners));

  if (embedder_host->IsValid()) {
    return embedder_host;
  }

  return nullptr;
}

// static
std::unique_ptr<EmbedderThreadHost>
EmbedderThreadHost::CreateEngineManagedThreadHost(
    flutter::ThreadConfigSetter config_setter) {
  // Crate a thraed host config, and specified the thread name and priority.
  auto thread_host_config = ThreadHost::ThreadHostConfig(config_setter);
  thread_host_config.SetUIConfig(MakeThreadConfig(
      flutter::ThreadHost::UI, fml::Thread::ThreadPriority::DISPLAY));
  thread_host_config.SetRasterConfig(MakeThreadConfig(
      flutter::ThreadHost::RASTER, fml::Thread::ThreadPriority::RASTER));
  thread_host_config.SetIOConfig(MakeThreadConfig(
      flutter::ThreadHost::IO, fml::Thread::ThreadPriority::BACKGROUND));

  // Create a thread host with the current thread as the platform thread and all
  // other threads managed.
  ThreadHost thread_host(thread_host_config);

  // For embedder platforms that don't have native message loop interop, this
  // will reference a task runner that points to a null message loop
  // implementation.
  auto platform_task_runner = GetCurrentThreadTaskRunner();

  flutter::TaskRunners task_runners(
      kFlutterThreadName,
      platform_task_runner,                        // platform
      thread_host.raster_thread->GetTaskRunner(),  // raster
      thread_host.ui_thread->GetTaskRunner(),      // ui
      thread_host.io_thread->GetTaskRunner()       // io
  );

  if (!task_runners.IsValid()) {
    return nullptr;
  }

  std::set<fml::RefPtr<EmbedderTaskRunner>> empty_embedder_task_runners;

  auto embedder_host = std::make_unique<EmbedderThreadHost>(
      std::move(thread_host), std::move(task_runners),
      empty_embedder_task_runners);

  if (embedder_host->IsValid()) {
    return embedder_host;
  }

  return nullptr;
}

EmbedderThreadHost::EmbedderThreadHost(
    ThreadHost host,
    flutter::TaskRunners runners,
    std::set<fml::RefPtr<EmbedderTaskRunner>> embedder_task_runners)
    : host_(std::move(host)), runners_(std::move(runners)) {
  for (const auto& runner : embedder_task_runners) {
    runners_map_[reinterpret_cast<int64_t>(runner.get())] = runner;
  }
}

EmbedderThreadHost::~EmbedderThreadHost() = default;

bool EmbedderThreadHost::IsValid() const {
  return runners_.IsValid();
}

const flutter::TaskRunners& EmbedderThreadHost::GetTaskRunners() const {
  return runners_;
}

bool EmbedderThreadHost::PostTask(int64_t runner, uint64_t task) const {
  auto found = runners_map_.find(runner);
  if (found == runners_map_.end()) {
    return false;
  }
  return found->second->PostTask(task);
}

}  // namespace flutter


text:
package com.primeton.appframe.common.datasource;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 *
 * ClassName: TargetDataSource

 * Function: TODO ADD FUNCTION.

 * Reason: TODO ADD REASON(可选).

 * date: 2017年10月17日 下午12:20:24

 * 在方法上使用,用于指定使用哪个数据源
 * @author Jin.He (mailto:hejin@primeton.com)
 * @version
 */
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface TargetDataSource {
    String value();
}

redpajama_set_name: RedPajamaGithub


text:
require 'net/http'

module Druid
  class Connection
    CONTENT_TYPE = 'application/json'.freeze
    VERB_MAP = {
      :get    => ::Net::HTTP::Get,
      :post   => ::Net::HTTP::Post,
      :put    => ::Net::HTTP::Put,
      :delete => ::Net::HTTP::Delete
    }

    attr_reader :http

    def initialize(endpoint)
      if endpoint.is_a? String
        uri = URI.parse(endpoint)
        host, port = uri.host, uri.port
      else
        host, port = endpoint.values_at(:host, :port)
      end

      @http = ::Net::HTTP.new(host, port)
    end

    def get(path, params = {})
      request :get, path, params
    end

    def post(path, params = {})
      request :post, path, params
    end

    def put(path, params = {})
      request :put, path, params
    end

    def delete(path, params = {})
      request :delete, path, params
    end

    private

    def encode_path_params(path, params)
      encoded = URI.encode_www_form(params)
      [path, encoded].join("?")
    end

    def request(method, path, params)
      case method
      when :get
        full_path = encode_path_params(path, params)
        request = VERB_MAP[method].new(full_path)
      else
        request = VERB_MAP[method].new(path)
        request.body = params.to_json
      end

      request.content_type = CONTENT_TYPE
      begin
        response = http.request(request)
      rescue Timeout::Error, *Druid::NET_HTTP_EXCEPTIONS => e
        raise ConnectionError, e.message
      end

      response
    end
  end
end


text:
<?php
require_once 'functions.php';
require_once 'functions.omat.php';
$section = 6;
$load_menu = 1;
$sub_page = 6;

$id = (int)$project;

if ($_GET['delete']) {
  $delete = (int)$_GET['delete'];
  $db->query("DELETE FROM mfa_industries WHERE id = $delete AND dataset = $project LIMIT 1");
  $print = "The industry was deleted";
}

$list = $db->query("SELECT * FROM mfa_industries WHERE dataset = $project ORDER BY name");

if ($_GET['saved']) {
  $print = "Information was saved";
}

?>
<!DOCTYPE html>

    <?php echo $header ?>
    <title>Industries | <?php echo SITENAME ?></title>

<?php require_once 'include.header.php'; ?>

  <a href="omat/<?php echo $project ?>/industry/0" class="btn btn-success pull-right"> Add industry
  <a href="omat/<?php echo $project ?>/industrycomparison" class="btn btn-success pull-right"> Industry Comparison

Industries

<a href="omat/<?php echo $project ?>/dashboard">Dashboard

Industries

  <?php if ($print) { echo "
$print
"; } ?>

    <?php echo count($list) ?> industries found.

  <?php if (count($list)) { ?>

        Industry
        Edit
        Delete

    <?php foreach ($list as $row) { ?>

        <a href="omat/<?php echo $project ?>/viewindustry/<?php echo $row['id'] ?>"><?php echo $row['name'] ?>
        <a href="omat/<?php echo $project ?>/industry/<?php echo $row['id'] ?>" class="btn btn-primary">Edit
        <a href="omat/<?php echo $project ?>/industries/delete/<?php echo $row['id'] ?>" class="btn btn-danger" onclick="javascript:return confirm('Are you sure?')">Delete

    <?php } ?>

  <?php } ?>

<?php require_once 'include.footer.php'; ?>


text:
package org.apache.hadoop.io.file.tfile;

import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.test.LambdaTestUtils;
import org.junit.*;

import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class TestCompression {

  @BeforeClass
  public static void resetConfigBeforeAll() {
    Compression.Algorithm.LZO.conf.setBoolean("test.reload.lzo.codec", true);
  }

  @AfterClass
  public static void resetConfigAfterAll() {
    Compression.Algorithm.LZO.conf.setBoolean("test.reload.lzo.codec", false);
  }

  /**
   * Regression test for HADOOP-11418.
   * Verify we can set a LZO codec different from default LZO codec.
   */
  @Test
  public void testConfigureLZOCodec() throws IOException {
    // Dummy codec
    String defaultCodec = "org.apache.hadoop.io.compress.DefaultCodec";
    Compression.Algorithm.conf.set(
        Compression.Algorithm.CONF_LZO_CLASS, defaultCodec);
    assertEquals(defaultCodec,
        Compression.Algorithm.LZO.getCodec().getClass().getName());
  }

  @Test
  public void testMisconfiguredLZOCodec() throws Exception {
    // Dummy codec
    String defaultCodec = "org.apache.hadoop.io.compress.InvalidLzoCodec";
    Compression.Algorithm.conf.set(
        Compression.Algorithm.CONF_LZO_CLASS, defaultCodec);
    IOException ioEx = LambdaTestUtils.intercept(
        IOException.class,
        defaultCodec,
        () -> Compression.Algorithm.LZO.getCodec());

    if (!(ioEx.getCause() instanceof ClassNotFoundException)) {
      throw ioEx;
    }
  }

}


text:
package io.github.lewismcgeary.androidgameoflife;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class IntroFragment extends Fragment {

    private OnFragmentInteractionListener mListener;

    public IntroFragment() {
        // Required empty public constructor
    }

    /**
     * @return A new instance of fragment IntroFragment.
     */
    public static IntroFragment newInstance() {
        IntroFragment fragment = new IntroFragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_intro_card, container, false);
        Button letsPlayButton = (Button)view.findViewById(R.id.lets_play_button);
        Button readRulesButton = (Button)view.findViewById(R.id.read_rules_button);
        letsPlayButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mListener.letsPlay();
            }
        });
        readRulesButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mListener.readRules();
            }
        });
        return view;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (context instanceof OnFragmentInteractionListener) {
            mListener = (OnFragmentInteractionListener) context;
        } else {
            throw new RuntimeException(context.toString()
                    + " must implement OnFragmentInteractionListener");
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    public interface OnFragmentInteractionListener {

        void letsPlay();

        void readRules();
    }
}


text:
/*
 * Created on Nov 11, 2005
 */
package uk.org.ponder.streamutil.read;

import java.io.IOException;

/** A slimline, checked-exception-free INTERFACE replacing java.io.Reader */

public interface ReadInputStream {
  public static final char EOF = (char) - 1;
  /** Reads a single character from the stream and returns it. If the stream
   * has reached the end of file, return the value (char)-1.
   * @return The character that was read.
   */
  public char get();
  public int read(char[] target, int start, int length);
  /** Checks if end of the wrapped stream has been reached.
   * @return true if the stream has reached the end of file.
   */
  public boolean EOF();
  /** A close method that will throw NO exception */
  public void close();
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.SignatureHelp
{
    /// <summary>
    /// Used for C#/VB sig help providers so they can build up information using SymbolDisplayParts.
    /// These parts will then by used to properly replace anonymous type information in the parts.
    /// Once that it done, this will be converted to normal SignatureHelpParameters which only
    /// point to TaggedText parts.
    /// </summary>
    internal class SignatureHelpSymbolParameter
    {
        /// <summary>
        /// The name of this parameter.
        /// </summary>
        public string Name { get; }

        /// <summary>
        /// Documentation for this parameter.  This should normally be presented to the user when
        /// this parameter is selected.
        /// </summary>
        public Func<CancellationToken, IEnumerable<TaggedText>> DocumentationFactory { get; }

        /// <summary>
        /// Display parts to show before the normal display parts for the parameter.
        /// </summary>
        public IList<SymbolDisplayPart> PrefixDisplayParts { get; }

        /// <summary>
        /// Display parts to show after the normal display parts for the parameter.
        /// </summary>
        public IList<SymbolDisplayPart> SuffixDisplayParts { get; }

        /// <summary>
        /// Display parts for this parameter.  This should normally be presented to the user as part
        /// of the entire signature display.
        /// </summary>
        public IList<SymbolDisplayPart> DisplayParts { get; }

        /// <summary>
        /// True if this parameter is optional or not.  Optional parameters may be presented in a
        /// different manner to users.
        /// </summary>
        public bool IsOptional { get; }

        /// <summary>
        /// Display parts for this parameter that should be presented to the user when this
        /// parameter is selected.
        /// </summary>
        public IList<SymbolDisplayPart> SelectedDisplayParts { get; }

        private static readonly Func<CancellationToken, IEnumerable<TaggedText>> s_emptyDocumentationFactory =
            _ => SpecializedCollections.EmptyEnumerable<TaggedText>();

        public SignatureHelpSymbolParameter(
            string name,
            bool isOptional,
            Func<CancellationToken, IEnumerable<TaggedText>> documentationFactory,
            IEnumerable<SymbolDisplayPart> displayParts,
            IEnumerable<SymbolDisplayPart> prefixDisplayParts = null,
            IEnumerable<SymbolDisplayPart> suffixDisplayParts = null,
            IEnumerable<SymbolDisplayPart> selectedDisplayParts = null)
        {
            this.Name = name ?? string.Empty;
            this.IsOptional = isOptional;
            this.DocumentationFactory = documentationFactory ?? s_emptyDocumentationFactory;
            this.DisplayParts = displayParts.ToImmutableArrayOrEmpty();
            this.PrefixDisplayParts = prefixDisplayParts.ToImmutableArrayOrEmpty();
            this.SuffixDisplayParts = suffixDisplayParts.ToImmutableArrayOrEmpty();
            this.SelectedDisplayParts = selectedDisplayParts.ToImmutableArrayOrEmpty();
        }

        internal IEnumerable<SymbolDisplayPart> GetAllParts()
        {
            return this.PrefixDisplayParts.Concat(this.DisplayParts)
                                          .Concat(this.SuffixDisplayParts)
                                          .Concat(this.SelectedDisplayParts);
        }

        public static explicit operator SignatureHelpParameter(SignatureHelpSymbolParameter parameter)
        {
            return new SignatureHelp.SignatureHelpParameter(
                parameter.Name, parameter.IsOptional, parameter.DocumentationFactory,
                parameter.DisplayParts.ToTaggedText(),
                parameter.PrefixDisplayParts.ToTaggedText(),
                parameter.SuffixDisplayParts.ToTaggedText(),
                parameter.SelectedDisplayParts.ToTaggedText());
        }
    }

    internal class SignatureHelpParameter
    {
        /// <summary>
        /// The name of this parameter.
        /// </summary>
        public string Name { get; }

        /// <summary>
        /// Documentation for this parameter.  This should normally be presented to the user when
        /// this parameter is selected.
        /// </summary>
        public Func<CancellationToken, IEnumerable<TaggedText>> DocumentationFactory { get; }

        /// <summary>
        /// Display parts to show before the normal display parts for the parameter.
        /// </summary>
        public IList<TaggedText> PrefixDisplayParts { get; }

        /// <summary>
        /// Display parts to show after the normal display parts for the parameter.
        /// </summary>
        public IList<TaggedText> SuffixDisplayParts { get; }

        /// <summary>
        /// Display parts for this parameter.  This should normally be presented to the user as part
        /// of the entire signature display.
        /// </summary>
        public IList<TaggedText> DisplayParts { get; }

        /// <summary>
        /// True if this parameter is optional or not.  Optional parameters may be presented in a
        /// different manner to users.
        /// </summary>
        public bool IsOptional { get; }

        /// <summary>
        /// Display parts for this parameter that should be presented to the user when this
        /// parameter is selected.
        /// </summary>
        public IList<TaggedText> SelectedDisplayParts { get; }

        private static readonly Func<CancellationToken, IEnumerable<TaggedText>> s_emptyDocumentationFactory =
            _ => SpecializedCollections.EmptyEnumerable<TaggedText>();

        // Constructor kept for binary compat with TS.  Remove when they move to the new API.
        public SignatureHelpParameter(
            string name,
            bool isOptional,
            Func<CancellationToken, IEnumerable<SymbolDisplayPart>> documentationFactory,
            IEnumerable<SymbolDisplayPart> displayParts,
            IEnumerable<SymbolDisplayPart> prefixDisplayParts = null,
            IEnumerable<SymbolDisplayPart> suffixDisplayParts = null,
            IEnumerable<SymbolDisplayPart> selectedDisplayParts = null)
            : this(name, isOptional,
                  c => documentationFactory(c).ToTaggedText(),
                  displayParts.ToTaggedText(),
                  prefixDisplayParts.ToTaggedText(),
                  suffixDisplayParts.ToTaggedText(),
                  selectedDisplayParts.ToTaggedText())
        {
        }

        public SignatureHelpParameter(
            string name,
            bool isOptional,
            Func<CancellationToken, IEnumerable<TaggedText>> documentationFactory,
            IEnumerable<TaggedText> displayParts,
            IEnumerable<TaggedText> prefixDisplayParts = null,
            IEnumerable<TaggedText> suffixDisplayParts = null,
            IEnumerable<TaggedText> selectedDisplayParts = null)
        {
            this.Name = name ?? string.Empty;
            this.IsOptional = isOptional;
            this.DocumentationFactory = documentationFactory ?? s_emptyDocumentationFactory;
            this.DisplayParts = displayParts.ToImmutableArrayOrEmpty();
            this.PrefixDisplayParts = prefixDisplayParts.ToImmutableArrayOrEmpty();
            this.SuffixDisplayParts = suffixDisplayParts.ToImmutableArrayOrEmpty();
            this.SelectedDisplayParts = selectedDisplayParts.ToImmutableArrayOrEmpty();
        }

        internal IEnumerable<TaggedText> GetAllParts()
        {
            return this.PrefixDisplayParts.Concat(this.DisplayParts)
                                          .Concat(this.SuffixDisplayParts)
                                          .Concat(this.SelectedDisplayParts);
        }

        public override string ToString()
        {
            var prefix = string.Concat(PrefixDisplayParts);
            var display = string.Concat(DisplayParts);
            var suffix = string.Concat(SuffixDisplayParts);
            return string.Concat(prefix, display, suffix);
        }
    }
}


text:
package edu.umn.paull011.evolveworkoutlogger.helper_classes;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

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

import edu.umn.paull011.evolveworkoutlogger.R;
import edu.umn.paull011.evolveworkoutlogger.components.ButtonEditText;
import edu.umn.paull011.evolveworkoutlogger.components.OnNumberChangedListener;
import edu.umn.paull011.evolveworkoutlogger.data_structures.Exercise;
import edu.umn.paull011.evolveworkoutlogger.data_structures.ExerciseSession;
import edu.umn.paull011.evolveworkoutlogger.data_structures.MeasurementCategory;
import edu.umn.paull011.evolveworkoutlogger.data_structures.Set;

/**
 * Adapter that populates a RecyclerView with the sets inside of an exercise session
 */
public class ExerciseSessionAdapter extends RecyclerView.Adapter<ExerciseSessionAdapter.ViewHolder>
    implements ItemTouchHelperAdapter{

    private ExerciseSession mExerciseSession;
    private Exercise mExercise;
    private int mCompletedColor;
    private int mIncompletedColor;
    private Context mContext;
    private ExerciseSessionDataHolder dataHolder = ExerciseSessionDataHolder.getInstance();
    private static final String TAG = ExerciseSessionAdapter.class.getSimpleName();

    public class SetMeasurementChangedListener implements OnNumberChangedListener {
        int mSetPosition;
        MeasurementCategory mCategory;
        ButtonEditText mButtonEditText;
        private final String TAG = SetMeasurementChangedListener.class.getSimpleName();

        public SetMeasurementChangedListener(int setPosition, MeasurementCategory category, ButtonEditText buttonEditText) {
            Log.d(TAG,"setMeasurementChangedListener");
            mSetPosition = setPosition;
            mCategory = category;
            mButtonEditText = buttonEditText;
        }

        @Override
        public void numberChanged() {
            Log.d(TAG,"numberChanged");
            float number = mButtonEditText.getNumber();
            Set editedSet = mExerciseSession.getSet(mSetPosition);
            editedSet.setMeasurement(mCategory, number);
        }
    }

    public class ViewHolder extends RemovableViewHolder{
        public RelativeLayout mRelativeLayout;
        public TextView mSetNumber;
        public ImageView mCurrentSetCircle;
        public List<FrameLayout> mMeasurementLayouts;
        public List<ButtonEditText> mButtonEditTexts;
        public final String TAG = ExerciseSessionAdapter.ViewHolder.class.getSimpleName();

        public ViewHolder(View v){
            super(v);
            Log.d(TAG,"ViewHolder");
            mRelativeLayout = (RelativeLayout) this.getSwipableView();
            mSetNumber = (TextView) v.findViewById(R.id.set_number);
            mCurrentSetCircle = (ImageView) v.findViewById(R.id.current_set_circle);
            mMeasurementLayouts = new ArrayList<>(4);
            mButtonEditTexts = new ArrayList<>(4);
            for (int i = 0; i < 4; i++) {
                mMeasurementLayouts.add(null);
                mButtonEditTexts.add(null);
            }
            mMeasurementLayouts.set(MeasurementCategory.REPS.value(),
                    (FrameLayout) v.findViewById(R.id.reps_layout));
            mMeasurementLayouts.set(MeasurementCategory.WEIGHT.value(),
                    (FrameLayout) v.findViewById(R.id.weight_layout));
            mMeasurementLayouts.set(MeasurementCategory.DISTANCE.value(),
                    (FrameLayout) v.findViewById(R.id.distance_layout));
            mMeasurementLayouts.set(MeasurementCategory.TIME.value(),
                    (FrameLayout) v.findViewById(R.id.time_layout));
            mButtonEditTexts.set(MeasurementCategory.REPS.value(),
                    (ButtonEditText) v.findViewById(R.id.reps_button_edittext));
            mButtonEditTexts.set(MeasurementCategory.WEIGHT.value(),
                    (ButtonEditText) v.findViewById(R.id.weight_button_edittext));
            mButtonEditTexts.set(MeasurementCategory.DISTANCE.value(),
                    (ButtonEditText) v.findViewById(R.id.distance_button_edittext));
            mButtonEditTexts.set(MeasurementCategory.TIME.value(),
                    (ButtonEditText) v.findViewById(R.id.time_button_edittext));
        }
    }

    public ExerciseSessionAdapter(Context context){
        Log.d(TAG,"ExerciseSessionAdapter");
        mContext = context;
        mExercise = dataHolder.getExercise();
        mExerciseSession = dataHolder.getExerciseSession();
        mCompletedColor = ContextCompat.getColor(context, R.color.accent_green);
        mIncompletedColor = ContextCompat.getColor(context, R.color.white);
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        Log.d(TAG, "onCreateViewHolder");
        // Create a new exercise-session view
        View v = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.component_set, parent, false);
        // pass the view to into the view holder
        return new ViewHolder(v);
    }

    @Override
    public void onViewDetachedFromWindow(ViewHolder holder) {
        int position = holder.getAdapterPosition();
        Log.d(TAG, "onViewDetachedFromWindow (" + position + ")");
        super.onViewDetachedFromWindow(holder);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, int position) {
        Log.d(TAG, "onBindViewHolder");
        Set set = mExerciseSession.getSet(position);
        TextView setNumberText = holder.mSetNumber;
        setNumberText.setText(String.valueOf(position + 1));
        holder.mRelativeLayout.setBackgroundColor(mIncompletedColor);
        if (mExerciseSession.getCurrentSetIndex() == position && !mExerciseSession.isCompleted()) {
            holder.mCurrentSetCircle.setVisibility(View.VISIBLE);
        }
        else {
            holder.mCurrentSetCircle.setVisibility(View.GONE);
        }
        // Disappear layouts for untracked measurements
        ButtonEditText buttonEditText;
        for (final MeasurementCategory category: MeasurementCategory.values()) {
            if (!mExerciseSession.hasCategory(category)) {
                holder.mMeasurementLayouts.get(category.value()).setVisibility(View.GONE);
            }
            else {
                float categoryMeasurement = set.getMeasurementData(category).getMeasurement();
                buttonEditText = holder.mButtonEditTexts.get(category.value());
                SetMeasurementChangedListener listener =
                        new SetMeasurementChangedListener(position, category, buttonEditText);
                buttonEditText.setOnNumberChangedListener(listener);
                buttonEditText.setNumber(categoryMeasurement);
                if (category == MeasurementCategory.WEIGHT || category == MeasurementCategory.DISTANCE) {
                    String unitText = mExercise.getUnit(category).getDisplayName();
                    buttonEditText.setUnit(unitText);
                }
            }
        }
        if (set.isCompleted()) {
            holder.mRelativeLayout.setBackgroundColor(mCompletedColor);
        }
    }

    @Override
    public int getItemCount() {
        Log.d(TAG, "getItemCount");
        return mExerciseSession.getNumSets();
    }

    @Override
    public boolean onItemMove(int fromPosition, int toPosition) {
        Log.d(TAG,"onItemMove");
        mExerciseSession.swapSets(fromPosition, toPosition);
        notifyItemMoved(fromPosition, toPosition);
        return true;
    }

    @Override
    public void onItemDismiss(RecyclerView.ViewHolder viewHolder) {
        ExerciseSessionAdapter.ViewHolder vh = (ExerciseSessionAdapter.ViewHolder) viewHolder;
        int position = vh.getAdapterPosition();
        Log.d(TAG,"onItemDismiss (" + position + ")");

        List<ButtonEditText> bets = vh.mButtonEditTexts;
        for (ButtonEditText bet: bets) {
            bet.clearFocus();
        }

        mExerciseSession.removeSet(position);
        notifyItemRemoved(position);
        if (position != 0) {
            notifyItemRangeChanged(position, mExerciseSession.getNumSets() - position);
        }
        else {
            notifyDataSetChanged();
        }
    }

    // Methods below overridden to provide log messages
    @Override
    public void onBindViewHolder(ViewHolder holder, int position, List<Object> payloads) {
        super.onBindViewHolder(holder, position, payloads);
        Log.d(TAG, "onBindViewHolder (" + position + ")");
    }

    @Override
    public int getItemViewType(int position) {
        Log.d(TAG, "getItemViewType");
        return super.getItemViewType(position);
    }

    @Override
    public void setHasStableIds(boolean hasStableIds) {
        super.setHasStableIds(hasStableIds);
        Log.d(TAG, "setHasStableIds");
    }

    @Override
    public long getItemId(int position) {
        Log.d(TAG, "getItemId");
        return super.getItemId(position);
    }

    @Override
    public void onViewRecycled(ViewHolder holder) {
        super.onViewRecycled(holder);
        int position = holder.getAdapterPosition();
        Log.d(TAG, "onViewRecycled (" + position + ")");
    }

    @Override
    public boolean onFailedToRecycleView(ViewHolder holder) {
        int position = holder.getAdapterPosition();
        Log.d(TAG, "onFailedToRecycleView (" + position + ")");
        return super.onFailedToRecycleView(holder);
    }

    @Override
    public void onViewAttachedToWindow(ViewHolder holder) {
        super.onViewAttachedToWindow(holder);
        int position = holder.getAdapterPosition();
        Log.d(TAG, "onViewAttachedToWindow (" + position + ")");
    }

    @Override
    public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
        super.registerAdapterDataObserver(observer);
        Log.d(TAG, "registerAdapterDataObserver");
    }

    @Override
    public void unregisterAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
        super.unregisterAdapterDataObserver(observer);
        Log.d(TAG, "unregisterAdapterDataObserver");
    }

    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
        Log.d(TAG, "onAttachedToRecyclerView");
    }

    @Override
    public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
        super.onDetachedFromRecyclerView(recyclerView);
        Log.d(TAG, "onDetachedFromRecyclerView");
    }

}


text:
int em_simple_func(int a, int b);

#endif


text:
<?php

declare(strict_types=1);

namespace App\Models;

use App\Models\Interfaces\UserInterface;
use App\Models\Interfaces\ImageInterface;
use App\Models\Interfaces\BillsInterface;
use App\Models\Interfaces\ClientInterface;
use App\Models\Interfaces\CompanyInterface;
use App\Models\Interfaces\AccountingInterface;

/**
 * Class Company
 *
 * @author Guillaume Loulier <contact@guillaumeloulier.fr>
 */
abstract class Company implements CompanyInterface
{
    /**
     * @var int
     */
    protected $id;

    /**
     * @var string
     */
    protected $name;

    /**
     * @var string
     */
    protected $legalIdentifier;

    /**
     * @var string
     */
    protected $address;

    /**
     * @var string
     */
    protected $socialAddress;

    /**
     * @var string
     */
    protected $taxesIdentifier;

    /**
     * @var string
     */
    protected $artisanIdentifier;

    /**
     * @var string
     */
    protected $format;

    /**
     * @var ImageInterface
     */
    protected $image;

    /**
     * @var AccountingInterface
     */
    protected $accounting;

    /**
     * @var \ArrayAccess
     */
    protected $bills;

    /**
     * @var \ArrayAccess
     */
    protected $clients;

    /**
     * @var UserInterface
     */
    protected $owner;

    /**
     * {@inheritdoc}
     */
    public function getId():? int
    {
        return $this->id;
    }

    /**
     * {@inheritdoc}
     */
    public function getName(): string
    {
        return $this->name;
    }

    /**
     * {@inheritdoc}
     */
    public function setName(string $name)
    {
        $this->name = $name;
    }

    /**
     * {@inheritdoc}
     */
    public function getLegalIdentifier(): string
    {
        return $this->legalIdentifier;
    }

    /**
     * {@inheritdoc}
     */
    public function setLegalIdentifier(string $legalIdentifier)
    {
        $this->legalIdentifier = $legalIdentifier;
    }

    /**
     * {@inheritdoc}
     */
    public function getAddress(): string
    {
        return $this->address;
    }

    /**
     * {@inheritdoc}
     */
    public function setAddress(string $address)
    {
        $this->address = $address;
    }

    /**
     * {@inheritdoc}
     */
    public function getSocialAddress(): string
    {
        return $this->socialAddress;
    }

    /**
     * {@inheritdoc}
     */
    public function setSocialAddress(string $socialAddress)
    {
        $this->socialAddress = $socialAddress;
    }

    /**
     * {@inheritdoc}
     */
    public function getTaxesIdentifier(): string
    {
        return $this->taxesIdentifier;
    }

    /**
     * {@inheritdoc}
     */
    public function setTaxesIdentifier(string $taxesIdentifier)
    {
        $this->taxesIdentifier = $taxesIdentifier;
    }

    /**
     * {@inheritdoc}
     */
    public function getArtisanIdentifier(): ? string
    {
        return $this->artisanIdentifier;
    }

    /**
     * {@inheritdoc}
     */
    public function setArtisanIdentifier(string $artisanIdentifier)
    {
        $this->artisanIdentifier = $artisanIdentifier;
    }

    /**
     * {@inheritdoc}
     */
    public function getFormat(): string
    {
        return $this->format;
    }

    /**
     * {@inheritdoc}
     */
    public function setFormat(string $format)
    {
        $this->format = $format;
    }

    /**
     * {@inheritdoc}
     */
    public function getImage(): ImageInterface
    {
        return $this->image;
    }

    /**
     * {@inheritdoc}
     */
    public function setImage(ImageInterface $image)
    {
        $this->image = $image;
    }

    /**
     * {@inheritdoc}
     */
    public function getAccounting(): AccountingInterface
    {
        return $this->accounting;
    }

    /**
     * {@inheritdoc}
     */
    public function setAccounting(AccountingInterface $accounting)
    {
        $this->accounting = $accounting;
    }

    /**
     * {@inheritdoc}
     */
    public function getBills(): \ArrayAccess
    {
        return $this->bills;
    }

    /**
     * {@inheritdoc}
     */
    public function addBill(BillsInterface $bills)
    {
        $this->bills[] = $bills;
    }

    /**
     * {@inheritdoc}
     */
    public function removeBill(BillsInterface $bills)
    {
        unset($this->bills[array_search($bills, (array) $this->bills, true)]);
    }

    /**
     * {@inheritdoc}
     */
    public function getClients(): \ArrayAccess
    {
        return $this->clients;
    }

    /**
     * {@inheritdoc}
     */
    public function addClient(ClientInterface $client)
    {
        $this->clients[] = $client;
    }

    /**
     * {@inheritdoc}
     */
    public function removeClient(ClientInterface $client)
    {
        unset($this->clients[array_search($client, (array) $this->clients, true)]);
    }

    /**
     * {@inheritdoc}
     */
    public function getOwner(): UserInterface
    {
        return $this->owner;
    }

    /**
     * {@inheritdoc}
     */
    public function setOwner(UserInterface $owner): void
    {
        $this->owner = $owner;
    }
}


text:
angular.module('dateValidatorService', [
])

.service('dateValidatorService',
  function dateValidatorService(moment, DATE_RANGE) {
    let minDate = moment(DATE_RANGE.minDate, 'YYYY-MM-DD');
    let maxDate = moment(DATE_RANGE.maxDate, 'YYYY-MM-DD');

    this.isValidDate = function(date) {
      if (!date.isValid()){
        return false;
      }
      return minDate <= date && date <= maxDate;
    };

    this.isValidDateFormat = function(date, format) {
      return moment(date, format, true).isValid();
    };

  });


text:
package com.kvpair.xsql.core;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.kvpair.xsql.annotation.Param;

public class ParamParser {

  public void parse(DefinitionHolder holder, Method method, Object[] args) {
    /*if (args == null || args.length == 0) {
      return;
    }

    LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
    List<Object> params = new ArrayList<>();

    Parameter[] parameters = method.getParameters();
    for (int i = 0; i < parameters.length; i++) {
      Parameter parameter = parameters[i];
      Param namedParamAnno = parameter.getAnnotation(Param.class);
      if (namedParamAnno != null) {
        paramsMap.put(":"+namedParamAnno.value(), args[i]);
      }
    }

    String sql = holder.getSql();

    if(paramsMap != null && paramsMap.size() > 0) {
      for(Map.Entry<String, Object> entry : paramsMap.entrySet()) {
        String paramName = entry.getKey();
        Object value = entry.getValue();
        sql = StringUtils.replace(sql, paramName, "?");
        params.add(value);
      }
    }

    holder.setSql(sql);

    holder.setParams(params);*/
  }
}


text:
require 'pp'
require 'java'
require 'jruby/core_ext'

require 'rbconfig'
require 'fileutils'
require 'erb'
require 'delegate'
require 'singleton'
require 'logger'
require 'optparse'
require 'thwait'
require 'digest'
require 'rack'
require 'rack/mime'   # This is an attempt to avoid NameError exceptions
require 'sinatra/base'
require 'rack/flash'
require 'sequel'
require 'sequel/extensions/migration'
require 'json'
require 'fastercsv'
require 'carrierwave/sequel'
require 'mongrel'

=begin
# Sequel will automatically include these as needed
require 'jdbc/mysql'
require 'jdbc/h2'
=end

module Coupler
  def self.environment
    @environment ||= ENV['COUPLER_ENV'] || :production
  end

  def self.db_path(dbname)
    File.join(data_path, 'db', environment.to_s, dbname)
  end

  def self.connection_string(dbname)
    "jdbc:h2:#{db_path(dbname)};IGNORECASE=TRUE"
  end

  def self.upload_path
    @upload_path ||= File.join(data_path, 'uploads', environment.to_s)
  end

  def self.log_path
    @log_path ||= File.join(data_path, 'log')
  end

  def self.data_path
    # NOTE: Unfortunately, this code is in two places. Coupler can
    # be run with or without the launcher, and the launcher needs
    # to know about Coupler's data path before it runs Coupler.
    if !defined? @data_path
      dir =
        if ENV['COUPLER_HOME']
          ENV['COUPLER_HOME']
        else
          case Config::CONFIG['host_os']
          when /mswin|windows/i
            # Windows
            File.join(ENV['APPDATA'], "coupler")
          else
            if ENV['HOME']
              File.join(ENV['HOME'], ".coupler")
            else
              raise "Can't figure out where Coupler lives! Try setting the COUPLER_HOME environment variable"
            end
          end
        end
      if !File.exist?(dir)
        begin
          Dir.mkdir(dir)
        rescue SystemCallError
          raise "Can't create Coupler directory (#{dir})! Is the parent directory accessible?"
        end
      end
      if !File.writable?(dir)
        raise "Coupler directory (#{dir}) is not writable!"
      end
      @data_path = File.expand_path(dir)
    end
    @data_path
  end
end

require File.dirname(__FILE__) + "/coupler/logger"
require File.dirname(__FILE__) + "/coupler/database"
require File.dirname(__FILE__) + "/coupler/scheduler"
require File.dirname(__FILE__) + "/coupler/data_uploader"
require File.dirname(__FILE__) + "/coupler/import_buffer"
require File.dirname(__FILE__) + "/coupler/models"
require File.dirname(__FILE__) + "/coupler/extensions"
require File.dirname(__FILE__) + "/coupler/helpers"
require File.dirname(__FILE__) + "/coupler/runner"
require File.dirname(__FILE__) + "/coupler/base"


text:
/*
@header
    The zfile class provides methods to work with disk files. A file object
    provides the modified date, current size, and type of the file. You can
    create a file object for a filename that does not yet exist. To read or
    write data from the file, use the input and output methods, and then
    read and write chunks. The output method lets you both read and write
    chunks, at any offset. Finally, this class provides portable symbolic
    links. If a filename ends in ".ln", the first line of text in the file
    is read, and used as the underlying file for read/write operations.
    This lets you manipulate (e.g.) copy symbolic links without copying
    the perhaps very large files they point to.
@discuss
    This class is a new API, deprecating the old zfile class (which still
    exists but is implemented in zsys now).
@end
*/

#include "../include/czmq.h"

//  Structure of our class

struct _zfile_t {
    //  Properties for all file objects
    char *fullname;         //  File name with path
    char *link;             //  Optional linked file
    bool exists;            //  true if file exists
    bool stable;            //  true if file is stable
    bool eof;               //  true if at end of file
    FILE *handle;           //  Read/write handle
    zdigest_t *digest;      //  File digest, if known
    char *curline;          //  Last read line, if any
    size_t linemax;         //  Size of allocated buffer

    //  Properties from files that exist on file system
    time_t modified;        //  Modification time
    off_t cursize;          //  Size of the file
    mode_t mode;            //  POSIX permission bits
};

//  --------------------------------------------------------------------------
//  Constructor
//  If file exists, populates properties. CZMQ supports portable symbolic
//  links, which are files with the extension ".ln". A symbolic link is a
//  text file containing one line, the filename of a target file. Reading
//  data from the symbolic link actually reads from the target file. Path
//  may be NULL, in which case it is not used.

zfile_t *
zfile_new (const char *path, const char *name)
{
    zfile_t *self = (zfile_t *) zmalloc (sizeof (zfile_t));

    if (self) {
        //  Format full path to file
        if (path) {
            self->fullname = (char *) zmalloc (strlen (path) + strlen (name) + 2);
            if (self->fullname)
                sprintf (self->fullname, "%s/%s", path, name);
            else {
                zfile_destroy (&self);
                return NULL;
            }
        }
        else
            self->fullname = strdup (name);

        if (self->fullname) {
            //  Resolve symbolic link if possible
            if (strlen (self->fullname) > 3
            &&  streq (self->fullname + strlen (self->fullname) - 3, ".ln")) {
                FILE *handle = fopen (self->fullname, "r");
                if (handle) {
                    char buffer [256];
                    if (fgets (buffer, 256, handle)) {
                        //  We have the contents of the symbolic link
                        if (buffer [strlen (buffer) - 1] == '\n')
                            buffer [strlen (buffer) - 1] = 0;
                        self->link = strdup (buffer);

                        //  Chop ".ln" off name for external use
                        if (self->link)
                            self->fullname [strlen (self->fullname) - 3] = 0;
                        else {
                            fclose (handle);
                            zfile_destroy (&self);
                            return NULL;
                        }
                    }
                    fclose (handle);
                }
            }
            zfile_restat (self);
        }
        else
            zfile_destroy (&self);
    }
    return self;
}

//  --------------------------------------------------------------------------
//  Destroy a file item

void
zfile_destroy (zfile_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zfile_t *self = *self_p;
        zdigest_destroy (&self->digest);
        if (self->handle)
            fclose (self->handle);
        free (self->fullname);
        free (self->curline);
        free (self->link);
        free (self);
        *self_p = NULL;
    }
}

//  --------------------------------------------------------------------------
//  Duplicate a file item, returns a newly constructed item. If the file
//  is null, or memory was exhausted, returns null.

zfile_t *
zfile_dup (zfile_t *self)
{
    if (self) {
        zfile_t *copy = (zfile_t *) zmalloc (sizeof (zfile_t));
        if (copy)
            copy->fullname = strdup (self->fullname);
        if (copy->fullname) {
            copy->modified = self->modified;
            copy->cursize = self->cursize;
            copy->link = self->link? strdup (self->link): NULL;
            copy->mode = self->mode;
        }
        else
            zfile_destroy (&copy);
        return copy;
    }
    else
        return NULL;
}

//  --------------------------------------------------------------------------
//  Return file name, remove path if provided

const char *
zfile_filename (zfile_t *self, const char *path)
{
    assert (self);
    char *name = self->fullname;
    if (path
    &&  strlen (self->fullname) >= strlen (path)
    &&  memcmp (self->fullname, path, strlen (path)) == 0) {
        name += strlen (path);
        if (*name == '/')
            name++;
    }
    return name;
}

//  --------------------------------------------------------------------------
//  Refresh file properties from disk; this is not done automatically
//  on access methods, otherwise it is not possible to compare directory
//  snapshots.

void
zfile_restat (zfile_t *self)
{
    assert (self);
    struct stat stat_buf;
    char *real_name = self->link? self->link: self->fullname;
    if (stat (real_name, &stat_buf) == 0) {
        self->cursize = stat_buf.st_size;
        self->modified = stat_buf.st_mtime;
        self->mode = zsys_file_mode (real_name);
        self->stable = zsys_file_stable (real_name);
    }
    else {
        self->cursize = 0;
        self->modified = 0;
        self->mode = 0;
        self->stable = false;
    }
    zdigest_destroy (&self->digest);
}

//  --------------------------------------------------------------------------
//  Return when the file was last modified. If you want this to reflect the
//  current situation, call zfile_restat before checking this property.

time_t
zfile_modified (zfile_t *self)
{
    assert (self);
    return self->modified;
}

//  --------------------------------------------------------------------------
//  Return the last-known size of the file. If you want this to reflect the
//  current situation, call zfile_restat before checking this property.

off_t
zfile_cursize (zfile_t *self)
{
    assert (self);
    return self->cursize;
}

//  --------------------------------------------------------------------------
//  Return true if the file is a directory. If you want this to reflect
//  any external changes, call zfile_restat before checking this property.

bool
zfile_is_directory (zfile_t *self)
{
    assert (self);
    return S_ISDIR (self->mode);
}

//  --------------------------------------------------------------------------
//  Return true if the file is a regular file. If you want this to reflect
//  any external changes, call zfile_restat before checking this property.

bool
zfile_is_regular (zfile_t *self)
{
    assert (self);
    return S_ISREG (self->mode);
}

//  --------------------------------------------------------------------------
//  Return true if the file is readable by this process. If you want this to
//  reflect any external changes, call zfile_restat before checking this
//  property.

bool
zfile_is_readable (zfile_t *self)
{
    assert (self);
    return (self->mode & S_IRUSR) != 0;
}

//  --------------------------------------------------------------------------
//  Return true if the file is writeable by this process. If you want this
//  to reflect any external changes, call zfile_restat before checking this
//  property.

bool
zfile_is_writeable (zfile_t *self)
{
    assert (self);
    return (self->mode & S_IWUSR) != 0;
}

//  --------------------------------------------------------------------------
//  Check if file has stopped changing and can be safely processed.
//  If you want this to reflect the current situation, call zfile_restat
//  before checking this property.

bool
zfile_is_stable (zfile_t *self)
{
    assert (self);
    return self->stable;
}

//  --------------------------------------------------------------------------
//  Return true if the file was changed on disk since the zfile_t object
//  was created, or the last zfile_restat() call made on it. Note that the
//  file will not necessarily yet be stable.

bool
zfile_has_changed (zfile_t *self)
{
    assert (self);
    struct stat stat_buf;
    char *real_name = self->link? self->link: self->fullname;
    if (stat (real_name, &stat_buf) == 0) {
        //  It's not a foolproof heuristic but catches most cases
        if (stat_buf.st_mtime != self->modified
        ||  stat_buf.st_size != self->cursize)
            return true;
    }
    return false;
}

//  --------------------------------------------------------------------------
//  Remove the file

void
zfile_remove (zfile_t *self)
{
    assert (self);
    //  Restore ".ln" in file name if this was a symbolic link
    if (self->link)
        self->fullname [strlen (self->fullname)] = '.';
    zfile_close (self);
    zsys_file_delete (self->fullname);
}

//  --------------------------------------------------------------------------
//  Open file for reading
//  Returns 0 if OK, -1 if not found or not accessible

int
zfile_input (zfile_t *self)
{
    assert (self);
    if (self->handle)
        zfile_close (self);

    char *real_name = self->link? self->link: self->fullname;
    self->handle = fopen (real_name, "rb");
    if (self->handle) {
        struct stat stat_buf;
        if (stat (real_name, &stat_buf) == 0)
            self->cursize = stat_buf.st_size;
        else
            self->cursize = 0;
    }
    return self->handle? 0: -1;
}

//  --------------------------------------------------------------------------
//  Open file for writing, creating directory if needed
//  File is created if necessary; chunks can be written to file at any
//  location. Returns 0 if OK, -1 if error.

int
zfile_output (zfile_t *self)
{
    int rc;
    assert (self);

    //  Create file path if it doesn't exist
    char *file_path = strdup (self->fullname);
    if (!file_path)
        return -1;
    char *last_slash = strrchr (file_path, '/');
    if (last_slash)
        *last_slash = 0;

    //  Wipe symbolic link if that's what the file was
    if (self->link) {
        free (self->link);
        self->link = NULL;
    }
    rc = zsys_dir_create (file_path);
    free (file_path);
    if (rc != 0)
        return -1;

    //  Create file if it doesn't exist
    if (self->handle)
        zfile_close (self);

    self->handle = fopen (self->fullname, "r+b");
    if (!self->handle)
        self->handle = fopen (self->fullname, "w+b");

    return self->handle? 0: -1;
}

//  --------------------------------------------------------------------------
//  Read chunk from file at specified position. If this was the last chunk,
//  sets the eof property. Returns a null chunk in case of error.

zchunk_t *
zfile_read (zfile_t *self, size_t bytes, off_t offset)
{
    assert (self);
    assert (self->handle);

    //  Calculate real number of bytes to read
    if (offset > self->cursize)
        bytes = 0;
    else
    if (bytes > (size_t) (self->cursize - offset))
        bytes = (size_t) (self->cursize - offset);

    if (fseek (self->handle, (long) offset, SEEK_SET) == -1)
        return NULL;

    self->eof = false;
    zchunk_t *chunk = zchunk_read (self->handle, bytes);
    if (chunk)
        self->eof = zchunk_size (chunk) < bytes;
    return chunk;
}

//  --------------------------------------------------------------------------
//  Returns the eof property.

bool
zfile_eof (zfile_t *self)
{
    assert (self);
    return self->eof;
}

//  --------------------------------------------------------------------------
//  Write chunk to file at specified position
//  Return 0 if OK, else -1

int
zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset)
{
    assert (self);
    assert (self->handle);
    int rc = fseek (self->handle, (long) offset, SEEK_SET);
    if (rc >= 0)
        rc = zchunk_write (chunk, self->handle);
    return rc;
}

//  --------------------------------------------------------------------------
//  Read next line of text from file. Returns a pointer to the text line,
//  or NULL if there was nothing more to read from the file.

const char *
zfile_readln (zfile_t *self)
{
    assert (self);
    assert (self->handle);

    //  Opportunistically allocate line buffer if needed; we'll grow this
    //  if needed, so the initial linemax is not a big deal
    if (!self->curline) {
        self->linemax = 512;
        self->curline = (char *) malloc (self->linemax);
    }
    uint char_nbr = 0;
    while (true) {
        int cur_char = fgetc (self->handle);
        if (cur_char == '\r')
            continue;               //  Skip CR in MS-DOS format files
        else
        if (cur_char == EOF && char_nbr == 0)
            return NULL;            //  Signal end of file
        else
        if (cur_char == '\n' || cur_char == EOF)
            cur_char = 0;
        if (char_nbr == self->linemax - 1) {
            self->linemax *= 2;
            self->curline = (char *) realloc (self->curline, self->linemax);
        }
        self->curline [char_nbr++] = cur_char;
        if (cur_char == 0)
            break;
    }
    return self->curline;
}

//  --------------------------------------------------------------------------
//  Close file, if open

void
zfile_close (zfile_t *self)
{
    assert (self);
    if (self->handle) {
        fclose (self->handle);
        zfile_restat (self);
        self->handle = 0;
        self->eof = false;
    }
}

//  --------------------------------------------------------------------------
//  Return file handle, if opened

FILE *
zfile_handle (zfile_t *self)
{
    assert (self);
    return self->handle;
}

//  --------------------------------------------------------------------------
//  Calculate SHA1 digest for file, using zdigest class.

const char *
zfile_digest (zfile_t *self)
{
    assert (self);
    if (!self->digest) {
        if (zfile_input (self) == -1)
            return NULL;            //  Problem reading file

        //  Now calculate hash for file data, chunk by chunk
        size_t blocksz = 65535;
        off_t offset = 0;

        self->digest = zdigest_new ();
        if (!self->digest)
            return NULL;
        zchunk_t *chunk = zfile_read (self, blocksz, offset);
        while (zchunk_size (chunk)) {
            zdigest_update (self->digest,
                            zchunk_data (chunk), zchunk_size (chunk));
            zchunk_destroy (&chunk);

            //  off_t is defined as long (32 bit on Windows, 64 bit otherwise)
            //  This guards against overflow in both contexts.
            if (blocksz > LONG_MAX - offset)
                return NULL;

            offset += (off_t) blocksz;
            chunk = zfile_read (self, blocksz, offset);
        }
        zchunk_destroy (&chunk);
        fclose (self->handle);
        self->handle = 0;
    }
    return zdigest_string (self->digest);
}

//  Deprecated API, moved to zsys class. The zfile class works with
//  an object instance, which is more consistent with the CLASS style
//  and lets us do more interesting things. These functions were
//  essentially about portability, so now sit in zsys.

bool
zfile_exists (const char *filename)
{
    return zsys_file_exists (filename);
}
ssize_t
zfile_size (const char *filename)
{
    return zsys_file_size (filename);
}
mode_t
zfile_mode (const char *filename)
{
    return zsys_file_mode (filename);
}
int
zfile_delete (const char *filename)
{
    return zsys_file_delete (filename);
}
bool
zfile_stable (const char *filename)
{
    return zsys_file_stable (filename);
}
int
zfile_mkdir (const char *pathname)
{
    return zsys_dir_create (pathname);
}
int
zfile_rmdir (const char *pathname)
{
    return zsys_dir_delete (pathname);
}
void
zfile_mode_private (void)
{
    zsys_file_mode_private ();
}
void
zfile_mode_default (void)
{
    zsys_file_mode_default ();
}

//  --------------------------------------------------------------------------
//  Self test of this class

void
zfile_test (bool verbose)
{
    printf (" * zfile: ");

    //  @selftest
    zfile_t *file = zfile_new (NULL, "bilbo");
    assert (file);
    assert (streq (zfile_filename (file, "."), "bilbo"));
    assert (zfile_is_readable (file) == false);
    zfile_destroy (&file);

    //  Create a test file in some random subdirectory
    file = zfile_new ("./this/is/a/test", "bilbo");
    assert (file);
    int rc = zfile_output (file);
    assert (rc == 0);
    zchunk_t *chunk = zchunk_new (NULL, 100);
    assert (chunk);
    zchunk_fill (chunk, 0, 100);

    //  Write 100 bytes at position 1,000,000 in the file
    rc = zfile_write (file, chunk, 1000000);
    assert (rc == 0);
    zchunk_destroy (&chunk);
    zfile_close (file);
    assert (zfile_is_readable (file));
    assert (zfile_cursize (file) == 1000100);
    assert (!zfile_is_stable (file));
    assert (zfile_digest (file));

    //  Now truncate file from outside
    int handle = open ("./this/is/a/test/bilbo", O_WRONLY | O_TRUNC | O_BINARY, 0);
    assert (handle >= 0);
    rc = write (handle, "Hello, World\n", 13);
    assert (rc == 13);
    close (handle);
    assert (zfile_has_changed (file));
    zclock_sleep (1001);
    assert (zfile_has_changed (file));

    assert (!zfile_is_stable (file));
    zfile_restat (file);
    assert (zfile_is_stable (file));
    assert (streq (zfile_digest (file), "4AB299C8AD6ED14F31923DD94F8B5F5CB89DFB54"));

    //  Check we can read from file
    rc = zfile_input (file);
    assert (rc == 0);
    chunk = zfile_read (file, 1000100, 0);
    assert (chunk);
    assert (zchunk_size (chunk) == 13);
    zchunk_destroy (&chunk);
    zfile_close (file);

    //  Check we can read lines from file
    rc = zfile_input (file);
    assert (rc == 0);
    const char *line = zfile_readln (file);
    assert (streq (line, "Hello, World"));
    line = zfile_readln (file);
    assert (line == NULL);
    zfile_close (file);

    //  Try some fun with symbolic links
    zfile_t *link = zfile_new ("./this/is/a/test", "bilbo.ln");
    assert (link);
    rc = zfile_output (link);
    assert (rc == 0);
    fprintf (zfile_handle (link), "./this/is/a/test/bilbo\n");
    zfile_destroy (&link);

    link = zfile_new ("./this/is/a/test", "bilbo.ln");
    assert (link);
    rc = zfile_input (link);
    assert (rc == 0);
    chunk = zfile_read (link, 1000100, 0);
    assert (chunk);
    assert (zchunk_size (chunk) == 13);
    zchunk_destroy (&chunk);
    zfile_destroy (&link);

    //  Remove file and directory
    zdir_t *dir = zdir_new ("./this", NULL);
    assert (dir);
    assert (zdir_cursize (dir) == 26);
    zdir_remove (dir, true);
    assert (zdir_cursize (dir) == 0);
    zdir_destroy (&dir);

    //  Check we can no longer read from file
    assert (zfile_is_readable (file));
    zfile_restat (file);
    assert (!zfile_is_readable (file));
    rc = zfile_input (file);
    assert (rc == -1);
    zfile_destroy (&file);
    //  @end

    printf ("OK\n");
}


text:
require 'chemistrykit/formula/base'

module Formulas
  module SubModule
    class BasicFormula < ChemistryKit::Formula::Base
      def open(url)
        @driver.get url
      end
    end
  end
end


text:
package org.jbpm.workbench.forms.client.display.util;

import com.google.gwt.core.client.JavaScriptObject;

public class ActionRequest extends JavaScriptObject {

    protected ActionRequest() {
    }

    public final native String getAction() /*-{
        return this.action;
    }-*/;

    public final native String getTaskId() /*-{
        return this.taskId;
    }-*/;

    public final native String getProcessId() /*-{
        return this.processId;
    }-*/;

    public final native String getDomainId() /*-{
        return this.domainId;
    }-*/;

}


text:
<?php
/**
 * My Orders
 *
 * Shows recent orders on the account page
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.1.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $woocommerce;

$customer_orders = get_posts( apply_filters( 'woocommerce_my_account_my_orders_query', array(
	'numberposts' => $order_count,
	'meta_key'    => '_customer_user',
	'meta_value'  => get_current_user_id(),
	'post_type'   => 'shop_order',
	'post_status' => 'publish'
) ) );

if ( $customer_orders ) : ?>

<?php echo apply_filters( 'woocommerce_my_account_my_orders_title', __( 'Recent Orders', 'woocommerce' ) ); ?>

				<?php _e( 'Order', 'woocommerce' ); ?>
				<?php _e( 'Date', 'woocommerce' ); ?>
				<?php _e( 'Status', 'woocommerce' ); ?>
				<?php _e( 'Total', 'woocommerce' ); ?>

<?php
			foreach ( $customer_orders as $customer_order ) {
				$order = new WC_Order();

				$order->populate( $customer_order );

				$status     = get_term_by( 'slug', $order->status, 'shop_order_status' );
				$item_count = $order->get_item_count();

				?>

						<a href="<?php echo $order->get_view_order_url(); ?>">
							<?php echo $order->get_order_number(); ?>

						<time datetime="<?php echo date( 'Y-m-d', strtotime( $order->order_date ) ); ?>" title="<?php echo esc_attr( strtotime( $order->order_date ) ); ?>"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></time>

						<?php echo ucfirst( __( $status->name, 'woocommerce' ) ); ?>

						<?php echo sprintf( _n( '%s for %s item', '%s for %s items', $item_count, 'woocommerce' ), $order->get_formatted_order_total(), $item_count ); ?>

						<?php
							$actions = array();

							if ( in_array( $order->status, apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order ) ) ) {
								$actions['pay'] = array(
									'url'  => $order->get_checkout_payment_url(),
									'name' => __( 'Pay', 'woocommerce' )
								);
							}

							if ( in_array( $order->status, apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ), $order ) ) ) {
								$actions['cancel'] = array(
									'url'  => $order->get_cancel_order_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ),
									'name' => __( 'Cancel', 'woocommerce' )
								);
							}

							$actions['view'] = array(
								'url'  => $order->get_view_order_url(),
								'name' => __( 'View', 'woocommerce' )
							);

							$actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order );

							if ($actions) {
								foreach ( $actions as $key => $action ) {
									echo '' . esc_html( $action['name'] ) . '';
								}
							}
						?>

<?php
			}
		?>

<?php endif; ?>


text:
require 'test/unit'
require 'beavero.rb'

class TestBeavero < Test::Unit::TestCase
  def setup
    # Switch to test enviroment
    Dir.chdir('tests/test_enviroment')

    # Clean test enviroment
    FileUtils.rm_rf( Dir.glob( './*' ) )

    # Create test enviroment
    FileUtils.copy_entry('../test_enviroment_configuration', '.')

    # Run build
    Beavero.build
  end

  def teardown
    Dir.chdir('../..')
  end

  def test_create_output
    assert( Dir.exist?( 'public' ) )
  end
end


text:
package ru.fly.client.ui.panel.accordion;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import ru.fly.client.ui.CommonDecor;

/**
 * Created by fil on 05.01.14.
 */
public class AccordionDecor {

    public static interface Resources extends ClientBundle {

        @Source({"ru/fly/client/ui/common.css", "accordion.css"})
        public Styles css();

    }

    @CssResource.Shared
    public static interface Styles extends CommonDecor.Styles {
        String item();

        @ClassName("item-header")
        String itemHeader();

        @ClassName("item-header-ico")
        String headerIcon();

        String expanded();
    }

    public final Resources res = GWT.create(Resources.class);

    public AccordionDecor(){
        res.css().ensureInjected();
    }

    public Styles css(){
        return res.css();
    }

}


text:
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.Network.Models
{
    internal partial class ListHubVirtualNetworkConnectionsResult
    {
        internal static ListHubVirtualNetworkConnectionsResult DeserializeListHubVirtualNetworkConnectionsResult(JsonElement element)
        {
            Optional<IReadOnlyList<HubVirtualNetworkConnection>> value = default;
            Optional<string> nextLink = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List<HubVirtualNetworkConnection> array = new List<HubVirtualNetworkConnection>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(HubVirtualNetworkConnection.DeserializeHubVirtualNetworkConnection(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return new ListHubVirtualNetworkConnectionsResult(Optional.ToList(value), nextLink.Value);
        }
    }
}


text:
Voltage
=======

View the current volume percentage in the HUD!

Pull Requests
=======

Please make sure is neat and clear! Also test on your own device!


text: export { default } from 'shared/components/new-password/component';


text:
package test.automation.shoppinglist;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyAdapter extends BaseAdapter
{
    String[] myShoppingData = new String [] {"Eggs", "Milk", "Flour", "Mushrooms"};
    Activity myActivity = null;

    public MyAdapter(Activity context)
    {
		this.myActivity = context;
    }

	public int getCount()
	{
        return 4;
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	public android.view.View getView(int position,
			android.view.View convertView, ViewGroup parent)
	{
        if(convertView == null)
        {
            convertView = new TextView(myActivity);
        }

		((TextView)convertView).setText (myShoppingData[position]);
        return convertView;

	}
}


text:
package com.hazelcast.simulator.worker.loadsupport;

import com.hazelcast.map.IMap;

/**
 * Synchronous implementation of {@link Streamer} for {@link IMap}.
 *
 * @param <K> key type
 * @param <V> value type
 */
final class SyncMapStreamer<K, V> implements Streamer<K, V> {

    private final IMap<K, V> map;

    SyncMapStreamer(IMap<K, V> map) {
        this.map = map;
    }

    @Override
    public void pushEntry(K key, V value) {
        map.set(key, value);
    }

    @Override
    public void await() {
    }
}


text:
/**
 * This file was generated by the Objective Systems ASN1C Compiler
 * (http://www.obj-sys.com).  Version: 5.83, Date: 19-Mar-2007.
 */
#include "asn1intl.h"
#include "NBAP-Containers.h"
#include "NBAP-CommonDataTypes.h"

/**************************************************************/
/*                                                            */
/*  ProtocolIE_Field                                          */
/*                                                            */
/**************************************************************/

ProtocolIE_Field* asn1Test_ProtocolIE_Field
   (ASN1CTXT* pctxt)
{
   ProtocolIE_Field* pvalue = (ProtocolIE_Field*)rtMemAllocZ (pctxt, sizeof(ProtocolIE_Field));
   memset((void*)pvalue, 0, sizeof(ProtocolIE_Field));

   /* Start populating the Sequence or Set type */

   /* Populate the Integer type */
   pvalue->id = 27015;

   /* Populate the Enumerated type */
   pvalue->criticality = reject;

   /* Populate OpenType */
   /* Populate open type with encoded string
      - example uses arbitray string, users
      should populate the encoded string of
      appropriate type. The "-tables" option
      of compiler supports appropriate type
      encoded string generation. */
   {
      static const OSOCTET testdata[] = {0x04, 0x08,
      0x2b, 0x9, 0x19, 0x72, 0xd, 0x36, 0x10, 0x58,  };
      pvalue->value.data = (ASN1ConstOctetPtr)rtMemAllocZ(pctxt, 10);
      pvalue->value.numocts = 10;
      memcpy ((void*)pvalue->value.data, testdata, 10);
   }
   /* End of Sequence or Set type */
   return (pvalue);
}

/**************************************************************/
/*                                                            */
/*  ProtocolIE_Single_Container                               */
/*                                                            */
/**************************************************************/

ProtocolIE_Single_Container* asn1Test_ProtocolIE_Single_Container
   (ASN1CTXT* pctxt)
{
   ProtocolIE_Single_Container* pvalue = (ProtocolIE_Single_Container*)rtMemAllocZ (pctxt, sizeof(ProtocolIE_Single_Container));
   memset((void*)pvalue, 0, sizeof(ProtocolIE_Single_Container));

   /* Start populating the Sequence or Set type */

   /* Populate the Integer type */
   pvalue->id = 47788;

   /* Populate the Enumerated type */
   pvalue->criticality = reject;

   /* Populate OpenType */
   /* Populate open type with encoded string
      - example uses arbitray string, users
      should populate the encoded string of
      appropriate type. The "-tables" option
      of compiler supports appropriate type
      encoded string generation. */
   {
      static const OSOCTET testdata[] = {0x04, 0x08,
      0x83, 0xf1, 0x89, 0xe7, 0x18, 0xf, 0xfc, 0xab,  };
      pvalue->value.data = (ASN1ConstOctetPtr)rtMemAllocZ(pctxt, 10);
      pvalue->value.numocts = 10;
      memcpy ((void*)pvalue->value.data, testdata, 10);
   }
   /* End of Sequence or Set type */
   return (pvalue);
}

/**************************************************************/
/*                                                            */
/*  ProtocolIE_ContainerPair                                  */
/*                                                            */
/**************************************************************/

ProtocolIE_ContainerPair* asn1Test_ProtocolIE_ContainerPair
   (ASN1CTXT* pctxt)
{
   ProtocolIE_ContainerPair* pvalue = (ProtocolIE_ContainerPair*)rtMemAllocZ (pctxt, sizeof(ProtocolIE_ContainerPair));
   memset((void*)pvalue, 0, sizeof(ProtocolIE_ContainerPair));

   /* Start populating the Sequence Of type */

   {
      ProtocolIE_ContainerPair *plist = pvalue;
   }
   /* End of Sequence Of type */
   return (pvalue);
}


text:
class BBitmap;
class BMediaFile;
class BMediaTrack;
struct media_codec_info;
struct entry_ref;
class BFile;

class BitmapMovie
{
public:
	BitmapMovie(float width, float height, color_space);
	~BitmapMovie();

	float Width() const { return mWidth; }
	float Height() const { return mHeight; }
	color_space ColorSpace() const { return mColorSpace; }

	// Create the file
	status_t CreateFile(
		const entry_ref& file,
		const media_file_format& file_format,
		const media_format& input_format,
		const media_codec_info& codec,
		float quality = -1);			// [0,1]; negative number means use default quality

	// Write a BBitmap as one frame of the file
	status_t WriteFrame(void* data, bool isKeyFrame = false);

	// Close down the file nicely
	status_t CloseFile();

	// provide a pointer to the BMediaTrack -- dangerous!
	BMediaTrack* GetTrack() const;

private:
	float mWidth, mHeight;
	color_space mColorSpace;
	BMediaFile* mMediaFile;
	BMediaTrack* mTrack;
	bool mIsOpen, mHeaderCommitted;
};

#endif


text:
<?php

namespace ZendTest\Code\Reflection\TestAsset;

class TestSampleClass7
{
    /**
     * @param Zend\Foo\Bar $var desc
     * @return Zend\Code\Reflection\Docblock
     */
    public function doSomething()
    {

    }
}


text:
/**
 * THIS IS THE ENTRY POINT FOR THE CLIENT, JUST LIKE server.js IS THE ENTRY POINT FOR THE SERVER.
 */
import 'babel/polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import createHistory from 'history/lib/createBrowserHistory';
import useScroll from 'scroll-behavior/lib/useStandardScroll';
import createStore from './redux/create';
import ApiClient from './helpers/ApiClient';
import io from 'socket.io-client';
import {Provider} from 'react-redux';
import {reduxReactRouter, ReduxRouter} from 'redux-router';

import getRoutes from './routes';
import makeRouteHooksSafe from './helpers/makeRouteHooksSafe';
import {addLocaleData, IntlProvider} from 'react-intl';

const client = new ApiClient();

// Three different types of scroll behavior available.
// Documented here: https://github.com/rackt/scroll-behavior
const scrollableHistory = useScroll(createHistory);

const dest = document.getElementById('content');
const store = createStore(reduxReactRouter, makeRouteHooksSafe(getRoutes), scrollableHistory, client, window.__data);
const {locale, localeData, localeMessages} = window.__I18n;
function initSocket() {
  const socket = io('', {path: '/api/ws', transports: ['polling']});
  socket.on('news', (data) => {
    console.log(data);
    socket.emit('my other event', { my: 'data from client' });
  });
  socket.on('msg', (data) => {
    console.log(data);
  });

  return socket;
}

global.socket = initSocket();

const component = (
  <ReduxRouter routes={getRoutes(store)} />
);

ReactDOM.render(
  <Provider store={store} key="provider">
    <IntlProvider locale={locale} messages={localeMessages}>
      {component}
    </IntlProvider>
  </Provider>,
  dest
);

if (process.env.NODE_ENV !== 'production') {
  window.React = React; // enable debugger

  if (!dest || !dest.firstChild || !dest.firstChild.attributes || !dest.firstChild.attributes['data-react-checksum']) {
    console.error('Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.');
  }
}

if (__DEVTOOLS__ && !window.devToolsExtension) {
  const DevTools = require('./containers/DevTools/DevTools');
  ReactDOM.render(
    <Provider store={store} key="provider">
      <IntlProvider locale={locale} messages={localeMessages}>
        <div>
            {component}
          <DevTools />
        </div>
      </IntlProvider>
    </Provider>,
    dest
  );
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

#if HAS_IOPERATION

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Analyzer.Utilities.Extensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Operations;

namespace Analyzer.Utilities
{
    internal abstract class DoNotCatchGeneralUnlessRethrownAnalyzer : DiagnosticAnalyzer
    {
        private readonly bool _shouldCheckLambdas;
        private readonly string? _enablingMethodAttributeFullyQualifiedName;

        private bool RequiresAttributeOnMethod => !string.IsNullOrEmpty(_enablingMethodAttributeFullyQualifiedName);

        protected DoNotCatchGeneralUnlessRethrownAnalyzer(bool shouldCheckLambdas, string? enablingMethodAttributeFullyQualifiedName = null)
        {
            _shouldCheckLambdas = shouldCheckLambdas;
            _enablingMethodAttributeFullyQualifiedName = enablingMethodAttributeFullyQualifiedName;
        }

        protected abstract Diagnostic CreateDiagnostic(IMethodSymbol containingMethod, SyntaxToken catchKeyword);
        protected virtual bool IsConfiguredDisallowedExceptionType(INamedTypeSymbol namedTypeSymbol, IMethodSymbol containingMethod, Compilation compilation, AnalyzerOptions analyzerOptions, CancellationToken cancellationToken)
        {
            return false;
        }

        public override void Initialize(AnalysisContext analysisContext)
        {
            analysisContext.EnableConcurrentExecution();
            analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze);

            analysisContext.RegisterCompilationStartAction(compilationStartAnalysisContext =>
            {
                INamedTypeSymbol? requiredAttributeType = null;
                if (RequiresAttributeOnMethod && (requiredAttributeType = GetRequiredAttributeType(compilationStartAnalysisContext.Compilation)) == null)
                {
                    return;
                }

                var disallowedCatchTypes = GetDisallowedCatchTypes(compilationStartAnalysisContext.Compilation);

                compilationStartAnalysisContext.RegisterOperationBlockAction(operationBlockAnalysisContext =>
                {
                    if (operationBlockAnalysisContext.OwningSymbol.Kind != SymbolKind.Method)
                    {
                        return;
                    }

                    var method = (IMethodSymbol)operationBlockAnalysisContext.OwningSymbol;

                    if (RequiresAttributeOnMethod && !method.HasAttribute(requiredAttributeType))
                    {
                        return;
                    }

                    foreach (var operation in operationBlockAnalysisContext.OperationBlocks)
                    {
                        var walker = new DisallowGeneralCatchUnlessRethrowWalker(IsDisallowedCatchType, _shouldCheckLambdas);
                        walker.Visit(operation);

                        foreach (var catchClause in walker.CatchClausesForDisallowedTypesWithoutRethrow)
                        {
                            operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.GetFirstToken()));
                        }
                    }

                    bool IsDisallowedCatchType(INamedTypeSymbol type) =>
                        disallowedCatchTypes.Contains(type) ||
                        IsConfiguredDisallowedExceptionType(type, method, compilationStartAnalysisContext.Compilation,
                            compilationStartAnalysisContext.Options, compilationStartAnalysisContext.CancellationToken);

                });
            });
        }

        private INamedTypeSymbol? GetRequiredAttributeType(Compilation compilation)
        {
            RoslynDebug.Assert(_enablingMethodAttributeFullyQualifiedName != null);
            return compilation.GetOrCreateTypeByMetadataName(_enablingMethodAttributeFullyQualifiedName);
        }

        private static IReadOnlyCollection<INamedTypeSymbol> GetDisallowedCatchTypes(Compilation compilation)
        {
            return ImmutableHashSet.CreateRange(
                new[] {
                    compilation.GetSpecialType(SpecialType.System_Object),
                    compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemException),
                    compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemSystemException)
                }.WhereNotNull());
        }

        /// <summary>
        /// Walks an IOperation tree to find catch blocks that handle general types without rethrowing them.
        /// </summary>
        private class DisallowGeneralCatchUnlessRethrowWalker : OperationWalker
        {
            private readonly Func<INamedTypeSymbol, bool> _isDisallowedCatchType;
            private readonly bool _checkAnonymousFunctions;
            private readonly Stack<bool> _seenRethrowInCatchClauses = new Stack<bool>();

            public ISet<ICatchClauseOperation> CatchClausesForDisallowedTypesWithoutRethrow { get; } = new HashSet<ICatchClauseOperation>();

            public DisallowGeneralCatchUnlessRethrowWalker(Func<INamedTypeSymbol, bool> isDisallowedCatchType, bool checkAnonymousFunctions)
            {
                _isDisallowedCatchType = isDisallowedCatchType;
                _checkAnonymousFunctions = checkAnonymousFunctions;
            }

            public override void VisitAnonymousFunction(IAnonymousFunctionOperation operation)
            {
                if (_checkAnonymousFunctions)
                {
                    base.VisitAnonymousFunction(operation);
                }
            }

            public override void VisitCatchClause(ICatchClauseOperation operation)
            {
                _seenRethrowInCatchClauses.Push(false);

                Visit(operation.Filter);
                Visit(operation.Handler);

                bool seenRethrow = _seenRethrowInCatchClauses.Pop();

                if (!seenRethrow && IsDisallowedCatch(operation) && !MightBeFilteringBasedOnTheCaughtException(operation))
                {
                    CatchClausesForDisallowedTypesWithoutRethrow.Add(operation);
                }
            }

            public override void VisitThrow(IThrowOperation operation)
            {
                if (_seenRethrowInCatchClauses.Count > 0 && !_seenRethrowInCatchClauses.Peek())
                {
                    _seenRethrowInCatchClauses.Pop();
                    _seenRethrowInCatchClauses.Push(true);
                }

                base.VisitThrow(operation);
            }

            private bool IsDisallowedCatch(ICatchClauseOperation operation)
            {
                return operation.ExceptionType is INamedTypeSymbol exceptionType &&
                    _isDisallowedCatchType(exceptionType);
            }

            private static bool MightBeFilteringBasedOnTheCaughtException(ICatchClauseOperation operation)
            {
                return operation.ExceptionDeclarationOrExpression != null && operation.Filter != null;
            }
        }
    }
}

#endif