text:
require('./common');

var fs = require('fs'),
    vm = require('vm');

global.Handlebars = 'no-conflict';
vm.runInThisContext(fs.readFileSync(__dirname + '/../../dist/handlebars.runtime.js'), 'dist/handlebars.runtime.js');

var parse = require('../../dist/cjs/handlebars/compiler/base').parse;
var compiler = require('../../dist/cjs/handlebars/compiler/compiler');
var JavaScriptCompiler = require('../../dist/cjs/handlebars/compiler/javascript-compiler');

global.CompilerContext = {
  browser: true,

  compile: function(template, options) {
    // Hack the compiler on to the environment for these specific tests
    handlebarsEnv.precompile = function(precompileTemplate, precompileOptions) {
      return compiler.precompile(precompileTemplate, precompileOptions, handlebarsEnv);
    };
    handlebarsEnv.parse = parse;
    handlebarsEnv.Compiler = compiler.Compiler;
    handlebarsEnv.JavaScriptCompiler = JavaScriptCompiler;

    var templateSpec = handlebarsEnv.precompile(template, options);
    return handlebarsEnv.template(safeEval(templateSpec));
  },
  compileWithPartial: function(template, options) {
    // Hack the compiler on to the environment for these specific tests
    handlebarsEnv.compile = function(compileTemplate, compileOptions) {
      return compiler.compile(compileTemplate, compileOptions, handlebarsEnv);
    };
    handlebarsEnv.parse = parse;
    handlebarsEnv.Compiler = compiler.Compiler;
    handlebarsEnv.JavaScriptCompiler = JavaScriptCompiler;

    return handlebarsEnv.compile(template, options);
  }
};

function safeEval(templateSpec) {
  /* eslint-disable no-eval, no-console */
  try {
    return eval('(' + templateSpec + ')');
  } catch (err) {
    console.error(templateSpec);
    throw err;
  }
  /* eslint-enable no-eval, no-console */
}

redpajama_set_name: RedPajamaGithub


text:
package com.insightml.utils.ui.reports;

import com.insightml.data.features.stats.FeaturesCorrelation;
import com.insightml.data.features.stats.FeaturesSummary;
import com.insightml.data.features.stats.SplitGain;
import com.insightml.data.samples.ISamples;
import com.insightml.data.samples.Sample;
import com.insightml.utils.pipeline.IPipelineElement;
import com.insightml.utils.types.AbstractModule;

public final class FeaturesReport extends AbstractModule
		implements IPipelineElement<ISamples<? extends Sample, Double>, String> {

	private static final long serialVersionUID = 8255879220226883789L;

	private final int labelIndex;

	public FeaturesReport(final int labelIndex) {
		this.labelIndex = labelIndex;
	}

	@Override
	public String run(final ISamples<?, Double> instances) {
		final StringBuilder builder = new StringBuilder(1024);
		builder.append(instances.size() + "\n\n");

		if (instances.numFeatures() <= 1000) {
			builder.append(append(new FeaturesSummary(), instances) + "\n\n");
		}
		if (instances.numLabels() > 0) {
			builder.append(append(new FeaturesCorrelation(), instances) + "\n\n");
			if (instances.numFeatures() < 5000) {
				builder.append(append(new SplitGain(6, 300), instances) + "\n\n");
			}
		}

		return builder.toString().trim();
	}

	private String append(final IUiProvider<ISamples<?, Double>> provider, final ISamples<?, Double> instances) {
		final String reportClass = provider.getClass().getSimpleName();
		return reportClass + getLegendWithLB(reportClass)
				+ "\n------------------------------------------------------------------------------------------------\n"
				+ provider.getText(instances, labelIndex);
	}

	private static String getLegendWithLB(final String reportClass) {
		final String res = getLegend(reportClass);
		return res == null ? "" : "\n" + res + "\n";
	}

	private static String getLegend(final String reportClass) {
		switch (reportClass) {
		case "FeaturesSummary":
			return "Every row contains one feature, the min/max number of times this feature was seen per sample, how often the feature was null, the median and the mean of the feature over all samples and how many distinct values we have seen.";
		case "FeaturesImportance":
			return null;
		case "SplitGain":
			return "Every row contains one feature, the value shows how good a feature would be to split your data into 2 groups, one having it and one not having it. The higher the better the split would be.";
		case "FeaturesCorrelation":
			return "Every row contains one feature, the correlation (Spearman/Pearson) show how good your feature on its own is to predicts the results. Values close to +/-1 are good.";
		case "FeaturesDistribution":
			return "Work in progress ...";
		default:
			return null;
		}
	}

}


text:
module Gitlab
  module Metrics
    # Class for tracking timing information about method calls
    class MethodCall
      include Gitlab::Metrics::Methods
      BASE_LABELS = { module: nil, method: nil }.freeze
      attr_reader :real_time, :cpu_time, :call_count, :labels

      define_histogram :gitlab_method_call_duration_seconds do
        docstring 'Method calls real duration'
        base_labels Transaction::BASE_LABELS.merge(BASE_LABELS)
        buckets [0.01, 0.05, 0.1, 0.5, 1]
        with_feature :prometheus_metrics_method_instrumentation
      end

      # name - The full name of the method (including namespace) such as
      #        `User#sign_in`.
      #
      def initialize(name, module_name, method_name, transaction)
        @module_name = module_name
        @method_name = method_name
        @transaction = transaction
        @name = name
        @labels = { module: @module_name, method: @method_name }
        @real_time = 0.0
        @cpu_time = 0.0
        @call_count = 0
      end

      # Measures the real and CPU execution time of the supplied block.
      def measure
        start_real = System.monotonic_time
        start_cpu = System.cpu_time
        retval = yield

        real_time = System.monotonic_time - start_real
        cpu_time = System.cpu_time - start_cpu

        @real_time += real_time
        @cpu_time += cpu_time
        @call_count += 1

        if above_threshold?
          self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)
        end

        retval
      end

      # Returns a Metric instance of the current method call.
      def to_metric
        Metric.new(
          Instrumentation.series,
          {
            duration: real_time.in_milliseconds.to_i,
            cpu_duration: cpu_time.in_milliseconds.to_i,
            call_count: call_count
          },
          method: @name
        )
      end

      # Returns true if the total runtime of this method exceeds the method call
      # threshold.
      def above_threshold?
        real_time.in_milliseconds >= Metrics.method_call_threshold
      end
    end
  end
end


text:
/*
 * string.h
 *
 * Definitions for memory and string functions.
 */

#ifndef _STRING_H_
#define	_STRING_H_

#include <stddef.h>

#include "ansi.h"
#include "types.h"

#include "reent.h"

#ifndef NULL
	#define NULL 0
#endif

_BEGIN_STD_C

_PTR 	 _EXFUN(memchr,(const _PTR, int, size_t));
int 	 _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
_PTR 	 _EXFUN(memcpy,(_PTR, const _PTR, size_t));
_PTR	 _EXFUN(memmove,(_PTR, const _PTR, size_t));
_PTR	 _EXFUN(memset,(_PTR, int, size_t));
char 	*_EXFUN(strcat,(char *, const char *));
char 	*_EXFUN(strchr,(const char *, int));
int	 _EXFUN(strcmp,(const char *, const char *));
int	 _EXFUN(strcoll,(const char *, const char *));
char 	*_EXFUN(strcpy,(char *, const char *));
size_t	 _EXFUN(strcspn,(const char *, const char *));
char 	*_EXFUN(strerror,(int));
size_t	 _EXFUN(strlen,(const char *));
char 	*_EXFUN(strncat,(char *, const char *, size_t));
int	 _EXFUN(strncmp,(const char *, const char *, size_t));
char 	*_EXFUN(strncpy,(char *, const char *, size_t));
char 	*_EXFUN(strpbrk,(const char *, const char *));
char 	*_EXFUN(strrchr,(const char *, int));
size_t	 _EXFUN(strspn,(const char *, const char *));
char 	*_EXFUN(strstr,(const char *, const char *));

char 	*_EXFUN(strtok,(char *, const char *));

size_t	 _EXFUN(strxfrm,(char *, const char *, size_t));

char 	*_EXFUN(strtok_r,(char *, const char *, char **));

int	 _EXFUN(bcmp,(const void *, const void *, size_t));
void	 _EXFUN(bcopy,(const void *, void *, size_t));
void	 _EXFUN(bzero,(void *, size_t));
int	 _EXFUN(ffs,(int));
char 	*_EXFUN(index,(const char *, int));
_PTR	 _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
_PTR	 _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
_PTR	 _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
char 	*_EXFUN(rindex,(const char *, int));
char 	*_EXFUN(stpcpy,(char *, const char *));
char 	*_EXFUN(stpncpy,(char *, const char *, size_t));
int	 _EXFUN(strcasecmp,(const char *, const char *));
char	*_EXFUN(strcasestr,(const char *, const char *));
char 	*_EXFUN(strdup,(const char *));
char 	*_EXFUN(_strdup_r,(struct _reent *, const char *));
char 	*_EXFUN(strndup,(const char *, size_t));
char 	*_EXFUN(_strndup_r,(struct _reent *, const char *, size_t));
char 	*_EXFUN(strerror_r,(int, char *, size_t));
size_t	 _EXFUN(strlcat,(char *, const char *, size_t));
size_t	 _EXFUN(strlcpy,(char *, const char *, size_t));
int	 _EXFUN(strncasecmp,(const char *, const char *, size_t));
size_t	 _EXFUN(strnlen,(const char *, size_t));
char 	*_EXFUN(strsep,(char **, const char *));
char	*_EXFUN(strlwr,(char *));
char	*_EXFUN(strupr,(char *));

_END_STD_C

#endif /* _STRING_H_ */


text:
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.8](https://github.com/bukalapak/snowboard/compare/snowboard-linter@1.0.7...snowboard-linter@1.0.8) (2021-12-17)

**Note:** Version bump only for package snowboard-linter

## [1.0.7](https://github.com/bukalapak/snowboard/compare/snowboard-linter@1.0.6...snowboard-linter@1.0.7) (2020-12-04)

**Note:** Version bump only for package snowboard-linter

## [1.0.6](https://github.com/bukalapak/snowboard/compare/snowboard-linter@1.0.5...snowboard-linter@1.0.6) (2020-09-22)

**Note:** Version bump only for package snowboard-linter

## [1.0.5](https://github.com/bukalapak/snowboard/compare/snowboard-linter@1.0.4...snowboard-linter@1.0.5) (2020-08-12)

### Bug Fixes

* update dependencies ([dd79007](https://github.com/bukalapak/snowboard/commit/dd79007450a6a461849cd6dacfaa9eda00917c90))

## [1.0.4](https://github.com/bukalapak/snowboard/compare/snowboard-linter@1.0.3...snowboard-linter@1.0.4) (2020-07-27)

**Note:** Version bump only for package snowboard-linter

## [1.0.3](https://github.com/bukalapak/snowboard/compare/snowboard-linter@1.0.2...snowboard-linter@1.0.3) (2020-05-11)

**Note:** Version bump only for package snowboard-linter

## [1.0.2](https://github.com/bukalapak/snowboard/compare/snowboard-linter@1.0.1...snowboard-linter@1.0.2) (2020-04-25)

### Bug Fixes

* use babel transform corejs 3 ([cdbf00e](https://github.com/bukalapak/snowboard/commit/cdbf00e5f5911c4a49f6c2254a2dd1c7a87b0ace))


text:
package scenarios

import (
	"bytes"
	"context"
	"log"
	"os"
	"strings"
	"testing"

	"github.com/aws/aws-sdk-go-v2/config"
)

func TestRunPartiQLSingleScenario_Integration(t *testing.T) {
	sdkConfig, err := config.LoadDefaultConfig(context.TODO())
	if err != nil {
		log.Fatalf("unable to load SDK config, %v", err)
	}

	log.SetFlags(0)
	var buf bytes.Buffer
	log.SetOutput(&buf)

	RunPartiQLSingleScenario(sdkConfig, "doc-example-test-partiql-single-integ")

	log.SetOutput(os.Stderr)
	if !strings.Contains(buf.String(), "Thanks for watching") {
		t.Errorf("didn't run to successful completion. Here's the log:\n%v", buf.String())
	}
}


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#include <stdio.h>
#include <iostream>
#include <random>

#include "arrow/test-util.h"
#include "arrow/util/compression.h"
#include "arrow/util/compression_snappy.h"

#include "parquet/encoding-internal.h"
#include "parquet/util/logging.h"
#include "parquet/util/stopwatch.h"

/**
 * Test bed for encodings and some utilities to measure their throughput.
 * TODO: this file needs some major cleanup.
 */

class DeltaBitPackEncoder {
 public:
  explicit DeltaBitPackEncoder(int mini_block_size = 8) {
    mini_block_size_ = mini_block_size;
  }

  void Add(int64_t v) { values_.push_back(v); }

  uint8_t* Encode(int* encoded_len) {
    uint8_t* result = new uint8_t[10 * 1024 * 1024];
    int num_mini_blocks = static_cast<int>(arrow::BitUtil::CeilDiv(num_values() - 1,
                                                                   mini_block_size_));
    uint8_t* mini_block_widths = NULL;

    arrow::BitWriter writer(result, 10 * 1024 * 1024);

    // Writer the size of each block. We only use 1 block currently.
    writer.PutVlqInt(static_cast<uint32_t>(num_mini_blocks * mini_block_size_));

    // Write the number of mini blocks.
    writer.PutVlqInt(static_cast<uint32_t>(num_mini_blocks));

    // Write the number of values.
    writer.PutVlqInt(num_values() - 1);

    // Write the first value.
    writer.PutZigZagVlqInt(static_cast<uint32_t>(values_[0]));

    // Compute the values as deltas and the min delta.
    int64_t min_delta = std::numeric_limits<int64_t>::max();
    for (size_t i = values_.size() - 1; i > 0; --i) {
      values_[i] -= values_[i - 1];
      min_delta = std::min(min_delta, values_[i]);
    }

    // Write out the min delta.
    writer.PutZigZagVlqInt(static_cast<int32_t>(min_delta));

    // We need to save num_mini_blocks bytes to store the bit widths of the mini
    // blocks.
    mini_block_widths = writer.GetNextBytePtr(num_mini_blocks);

    int idx = 1;
    for (int i = 0; i < num_mini_blocks; ++i) {
      int n = std::min(mini_block_size_, num_values() - idx);

      // Compute the max delta in this mini block.
      int64_t max_delta = std::numeric_limits<int64_t>::min();
      for (int j = 0; j < n; ++j) {
        max_delta = std::max(values_[idx + j], max_delta);
      }

      // The bit width for this block is the number of bits needed to store
      // (max_delta - min_delta).
      int bit_width = arrow::BitUtil::NumRequiredBits(max_delta - min_delta);
      mini_block_widths[i] = static_cast<uint8_t>(bit_width);

      // Encode this mini blocking using min_delta and bit_width
      for (int j = 0; j < n; ++j) {
        writer.PutValue(values_[idx + j] - min_delta, bit_width);
      }

      // Pad out the last block.
      for (int j = n; j < mini_block_size_; ++j) {
        writer.PutValue(0, bit_width);
      }
      idx += n;
    }

    writer.Flush();
    *encoded_len = writer.bytes_written();
    return result;
  }

  int num_values() const { return static_cast<int>(values_.size()); }

 private:
  int mini_block_size_;
  std::vector<int64_t> values_;
};

class DeltaLengthByteArrayEncoder {
 public:
  explicit DeltaLengthByteArrayEncoder(int mini_block_size = 8)
      : len_encoder_(mini_block_size),
        buffer_(new uint8_t[10 * 1024 * 1024]),
        offset_(0),
        plain_encoded_len_(0) {}

  void Add(const std::string& s) {
    Add(reinterpret_cast<const uint8_t*>(s.data()), static_cast<int>(s.size()));
  }

  void Add(const uint8_t* ptr, int len) {
    plain_encoded_len_ += static_cast<int>(len + sizeof(int));
    len_encoder_.Add(len);
    memcpy(buffer_ + offset_, ptr, len);
    offset_ += len;
  }

  uint8_t* Encode(int* encoded_len) {
    uint8_t* encoded_lengths = len_encoder_.Encode(encoded_len);
    memmove(buffer_ + *encoded_len + sizeof(int), buffer_, offset_);
    memcpy(buffer_, encoded_len, sizeof(int));
    memcpy(buffer_ + sizeof(int), encoded_lengths, *encoded_len);
    *encoded_len += static_cast<int>(offset_ + sizeof(int));
    return buffer_;
  }

  int num_values() const { return len_encoder_.num_values(); }
  int plain_encoded_len() const { return plain_encoded_len_; }

 private:
  DeltaBitPackEncoder len_encoder_;
  uint8_t* buffer_;
  int offset_;
  int plain_encoded_len_;
};

class DeltaByteArrayEncoder {
 public:
  DeltaByteArrayEncoder() : plain_encoded_len_(0) {}

  void Add(const std::string& s) {
    plain_encoded_len_ += static_cast<int>(s.size() + sizeof(int));
    int min_len = static_cast<int>(std::min(s.size(), last_value_.size()));
    int prefix_len = 0;
    for (int i = 0; i < min_len; ++i) {
      if (s[i] == last_value_[i]) {
        ++prefix_len;
      } else {
        break;
      }
    }
    prefix_len_encoder_.Add(prefix_len);
    suffix_encoder_.Add(reinterpret_cast<const uint8_t*>(s.data()) + prefix_len,
                        static_cast<int>(s.size() - prefix_len));
    last_value_ = s;
  }

  uint8_t* Encode(int* encoded_len) {
    int prefix_buffer_len;
    uint8_t* prefix_buffer = prefix_len_encoder_.Encode(&prefix_buffer_len);
    int suffix_buffer_len;
    uint8_t* suffix_buffer = suffix_encoder_.Encode(&suffix_buffer_len);

    uint8_t* buffer = new uint8_t[10 * 1024 * 1024];
    memcpy(buffer, &prefix_buffer_len, sizeof(int));
    memcpy(buffer + sizeof(int), prefix_buffer, prefix_buffer_len);
    memcpy(buffer + sizeof(int) + prefix_buffer_len, suffix_buffer, suffix_buffer_len);
    *encoded_len = static_cast<int>(sizeof(int) + prefix_buffer_len + suffix_buffer_len);
    return buffer;
  }

  int num_values() const { return prefix_len_encoder_.num_values(); }
  int plain_encoded_len() const { return plain_encoded_len_; }

 private:
  DeltaBitPackEncoder prefix_len_encoder_;
  DeltaLengthByteArrayEncoder suffix_encoder_;
  std::string last_value_;
  int plain_encoded_len_;
};

uint64_t TestPlainIntEncoding(const uint8_t* data, int num_values, int batch_size) {
  uint64_t result = 0;
  parquet::PlainDecoder<parquet::Int64Type> decoder(nullptr);
  decoder.SetData(num_values, data, static_cast<int>(num_values * sizeof(int64_t)));
  std::vector<int64_t> values(batch_size);
  for (int i = 0; i < num_values;) {
    int n = decoder.Decode(values.data(), batch_size);
    for (int j = 0; j < n; ++j) {
      result += values[j];
    }
    i += n;
  }
  return result;
}

uint64_t TestBinaryPackedEncoding(const char* name, const std::vector<int64_t>& values,
                                  int benchmark_iters = -1,
                                  int benchmark_batch_size = 1) {
  int mini_block_size;
  if (values.size() < 8) {
    mini_block_size = 8;
  } else if (values.size() < 16) {
    mini_block_size = 16;
  } else {
    mini_block_size = 32;
  }
  parquet::DeltaBitPackDecoder<parquet::Int64Type> decoder(nullptr);
  DeltaBitPackEncoder encoder(mini_block_size);
  for (size_t i = 0; i < values.size(); ++i) {
    encoder.Add(values[i]);
  }

  int raw_len = static_cast<int>(encoder.num_values() * sizeof(int));
  int len;
  uint8_t* buffer = encoder.Encode(&len);

  if (benchmark_iters == -1) {
    printf("%s\n", name);
    printf("  Raw len: %d\n", raw_len);
    printf("  Encoded len: %d (%0.2f%%)\n", len,
           static_cast<float>(len) * 100.0f / static_cast<float>(raw_len));
    decoder.SetData(encoder.num_values(), buffer, len);
    for (int i = 0; i < encoder.num_values(); ++i) {
      int64_t x = 0;
      decoder.Decode(&x, 1);
      if (values[i] != x) {
        std::cerr << "Bad: " << i << std::endl;
        std::cerr << "  " << x << " != " << values[i] << std::endl;
        break;
      }
    }
    return 0;
  } else {
    printf("%s\n", name);
    printf("  Raw len: %d\n", raw_len);
    printf("  Encoded len: %d (%0.2f%%)\n", len,
           static_cast<float>(len) * 100.0f / static_cast<float>(raw_len));

    uint64_t result = 0;
    std::vector<int64_t> buf(benchmark_batch_size);
    parquet::StopWatch sw;
    sw.Start();
    for (int k = 0; k < benchmark_iters; ++k) {
      decoder.SetData(encoder.num_values(), buffer, len);
      for (size_t i = 0; i < values.size();) {
        int n = decoder.Decode(buf.data(), benchmark_batch_size);
        for (int j = 0; j < n; ++j) {
          result += buf[j];
        }
        i += n;
      }
    }
    uint64_t elapsed = sw.Stop();
    double num_ints = static_cast<double>(values.size() * benchmark_iters) * 1000.;
    printf("%s rate (batch size = %2d): %0.3fM per second.\n", name, benchmark_batch_size,
           num_ints / static_cast<double>(elapsed));
    return result;
  }
}

#define DECODE_TEST(NAME, FN, DATA, BATCH_SIZE)                                \
  sw.Start();                                                                  \
  for (int i = 0; i < NUM_ITERS; ++i) {                                        \
    FN(reinterpret_cast<uint8_t*>(&DATA[0]), NUM_VALUES, BATCH_SIZE);          \
  }                                                                            \
  elapsed = sw.Stop();                                                         \
  printf("%s rate (batch size = %2d): %0.3fM per second.\n", NAME, BATCH_SIZE, \
         mult / static_cast<double>(elapsed));

void TestPlainIntCompressed(::arrow::Codec* codec, const std::vector<int64_t>& data,
                            int num_iters, int batch_size) {
  const uint8_t* raw_data = reinterpret_cast<const uint8_t*>(&data[0]);
  int uncompressed_len = static_cast<int>(data.size() * sizeof(int64_t));
  uint8_t* decompressed_data = new uint8_t[uncompressed_len];

  int64_t max_compressed_size = codec->MaxCompressedLen(uncompressed_len, raw_data);
  uint8_t* compressed_data = new uint8_t[max_compressed_size];
  int64_t compressed_len;
  DCHECK(codec
             ->Compress(uncompressed_len, raw_data, max_compressed_size, compressed_data,
                        &compressed_len)
             .ok());

  printf("\n%s:\n  Uncompressed len: %d\n  Compressed len:   %d\n", codec->name(),
         uncompressed_len, static_cast<int>(compressed_len));

  double mult = static_cast<double>(num_iters * data.size()) * 1000.;
  parquet::StopWatch sw;
  sw.Start();
  uint64_t r = 0;
  for (int i = 0; i < num_iters; ++i) {
    ABORT_NOT_OK(codec->Decompress(compressed_len, compressed_data, uncompressed_len,
                                   decompressed_data));
    r += TestPlainIntEncoding(decompressed_data, static_cast<int>(data.size()),
                              batch_size);
  }
  int64_t elapsed = sw.Stop();
  printf("Compressed(%s) plain int rate (batch size = %2d): %0.3fM per second.\n",
         codec->name(), batch_size, mult / static_cast<double>(elapsed));

  delete[] compressed_data;
  delete[] decompressed_data;
}

void TestBinaryPacking() {
  std::vector<int64_t> values;
  values.clear();
  for (int i = 0; i < 100; ++i) values.push_back(0);
  TestBinaryPackedEncoding("Zeros", values);

  values.clear();
  for (int i = 1; i <= 5; ++i) values.push_back(i);
  TestBinaryPackedEncoding("Example 1", values);

  values.clear();
  values.push_back(7);
  values.push_back(5);
  values.push_back(3);
  values.push_back(1);
  values.push_back(2);
  values.push_back(3);
  values.push_back(4);
  values.push_back(5);
  TestBinaryPackedEncoding("Example 2", values);

  // Test rand ints between 0 and 10K
  values.clear();
  int seed = 0;
  std::mt19937 gen(seed);
  std::uniform_int_distribution<int> d(0, 10000);
  for (int i = 0; i < 500000; ++i) {
    values.push_back(d(gen));
  }
  TestBinaryPackedEncoding("Rand [0, 10000)", values);

  // Test rand ints between 0 and 100
  values.clear();
  std::uniform_int_distribution<int> d1(0, 100);
  for (int i = 0; i < 500000; ++i) {
    values.push_back(d1(gen));
  }
  TestBinaryPackedEncoding("Rand [0, 100)", values);
}

void TestDeltaLengthByteArray() {
  parquet::DeltaLengthByteArrayDecoder decoder(nullptr);
  DeltaLengthByteArrayEncoder encoder;

  std::vector<std::string> values;
  values.push_back("Hello");
  values.push_back("World");
  values.push_back("Foobar");
  values.push_back("ABCDEF");

  for (size_t i = 0; i < values.size(); ++i) {
    encoder.Add(values[i]);
  }

  int len = 0;
  uint8_t* buffer = encoder.Encode(&len);
  printf("DeltaLengthByteArray\n  Raw len: %d\n  Encoded len: %d\n",
         encoder.plain_encoded_len(), len);
  decoder.SetData(encoder.num_values(), buffer, len);
  for (int i = 0; i < encoder.num_values(); ++i) {
    parquet::ByteArray v = {0, NULL};
    decoder.Decode(&v, 1);
    std::string r = std::string(reinterpret_cast<const char*>(v.ptr), v.len);
    if (r != values[i]) {
      std::cout << "Bad " << r << " != " << values[i] << std::endl;
    }
  }
}

void TestDeltaByteArray() {
  parquet::DeltaByteArrayDecoder decoder(nullptr);
  DeltaByteArrayEncoder encoder;

  std::vector<std::string> values;

  // Wikipedia example
  values.push_back("myxa");
  values.push_back("myxophyta");
  values.push_back("myxopod");
  values.push_back("nab");
  values.push_back("nabbed");
  values.push_back("nabbing");
  values.push_back("nabit");
  values.push_back("nabk");
  values.push_back("nabob");
  values.push_back("nacarat");
  values.push_back("nacelle");

  for (size_t i = 0; i < values.size(); ++i) {
    encoder.Add(values[i]);
  }

  int len = 0;
  uint8_t* buffer = encoder.Encode(&len);
  printf("DeltaLengthByteArray\n  Raw len: %d\n  Encoded len: %d\n",
         encoder.plain_encoded_len(), len);
  decoder.SetData(encoder.num_values(), buffer, len);
  for (int i = 0; i < encoder.num_values(); ++i) {
    parquet::ByteArray v;
    decoder.Decode(&v, 1);
    std::string r = std::string(reinterpret_cast<const char*>(v.ptr), v.len);
    if (r != values[i]) {
      std::cout << "Bad " << r << " != " << values[i] << std::endl;
    }
  }
}

int main(int argc, char** argv) {
  TestBinaryPacking();
  TestDeltaLengthByteArray();
  TestDeltaByteArray();

  parquet::StopWatch sw;
  uint64_t elapsed = 0;

  const int NUM_VALUES = 1024 * 1024;
  const int NUM_ITERS = 10;
  const double mult = NUM_VALUES * NUM_ITERS * 1000.;

  std::vector<int64_t> plain_int_data;
  plain_int_data.resize(NUM_VALUES);

  DECODE_TEST("Plain decoder", TestPlainIntEncoding, plain_int_data, 1);
  DECODE_TEST("Plain decoder", TestPlainIntEncoding, plain_int_data, 16);
  DECODE_TEST("Plain decoder", TestPlainIntEncoding, plain_int_data, 32);
  DECODE_TEST("Plain decoder", TestPlainIntEncoding, plain_int_data, 64);

  // Test rand ints between 0 and 10K
  std::vector<int64_t> values;
  int seed = 0;
  std::mt19937 gen(seed);
  std::uniform_int_distribution<int> d(0, 10000);
  for (int i = 0; i < 1000000; ++i) {
    values.push_back(d(gen));
  }
  TestBinaryPackedEncoding("Rand 0-10K", values, 100, 1);
  TestBinaryPackedEncoding("Rand 0-10K", values, 100, 16);
  TestBinaryPackedEncoding("Rand 0-10K", values, 100, 32);
  TestBinaryPackedEncoding("Rand 0-10K", values, 100, 64);

  ::arrow::SnappyCodec snappy_codec;

  TestPlainIntCompressed(&snappy_codec, values, 100, 1);
  TestPlainIntCompressed(&snappy_codec, values, 100, 16);
  TestPlainIntCompressed(&snappy_codec, values, 100, 32);
  TestPlainIntCompressed(&snappy_codec, values, 100, 64);

  return 0;
}


text:
A small, very limited, line counting program for windows

Counts all the newlines in all files in a specified directory in a very brute-force manner

Usage:

    LineCounter.exe [directory_path] [/r]

        directory_path: The path to the directory in which to count lines

            If omitted, will print a warning message and count files in the current working directory

        /r: Recursive mode

            By default, LineCounter will only count files directly in the directory given: That is, it will produce a flat count.

            Passing this flag will instruct it to count files in all subdirectories as well: A recursive count.

The help message can be generated by calling the program with any supported help flag. That is to say,

    LineCounter.exe [/h|/help|/?|-h|--help]


text:
\begin {figure}[hbtp]
\centering
\includegraphics[width=\textwidth]{output/R5_1000_LINEAR_NCORE/plot_R5_1000.eps}
\caption{Completion time vs ncores for query R5 with datasize 1000GB}
\label{fig:coreonly_linear_R5_1000}
\end {figure}


text:
/* Noramlize.css */
.rw-btn,
.rw-input {
  color: inherit;
  font: inherit;
  margin: 0;
}
button.rw-input {
  overflow: visible;
}
button.rw-input,
select.rw-input {
  text-transform: none;
}
button.rw-input,
html input[type="button"].rw-input,
input[type="reset"].rw-input,
input[type="submit"].rw-input {
  -webkit-appearance: button;
  cursor: pointer;
}
button[disabled].rw-input,
html input[disabled].rw-input {
  cursor: not-allowed;
}
button.rw-input::-moz-focus-inner,
input.rw-input::-moz-focus-inner {
  border: 0;
  padding: 0;
}
/* -------------- */
.rw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.rw-widget,
.rw-widget * {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
.rw-widget:before,
.rw-widget *:before,
.rw-widget:after,
.rw-widget *:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
@font-face {
  font-family: 'RwWidgets';
  src: url('../fonts/rw-widgets.eot?v=4.1.0');
  src: url('../fonts/rw-widgets.eot?#iefix&v=4.1.0') format('embedded-opentype'), url('../fonts/rw-widgets.woff?v=4.1.0') format('woff'), url('../fonts/rw-widgets.ttf?v=4.1.0') format('truetype'), url('../fonts/rw-widgets.svg?v=4.1.0#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;
}
.rw-i {
  display: inline-block;
  font-family: RwWidgets;
  font-style: normal;
  font-weight: normal;
  line-height: 1em;
  font-variant: normal;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.rw-i-caret-down:before {
  content: '\e803';
}
.rw-i-caret-up:before {
  content: '\e800';
}
.rw-i-caret-left:before {
  content: '\e801';
}
.rw-i-caret-right:before {
  content: '\e802';
}
.rw-i-clock-o:before {
  content: '\e805';
}
.rw-i-calendar:before {
  content: '\e804';
}
.rw-i-search:before {
  content: '\e806';
}
/* for debugging */
.rw-widget {
  outline: 0;
  -moz-background-clip: border-box;
  -webkit-background-clip: border-box;
  background-clip: border-box;
}
.rw-btn {
  color: #333333;
  line-height: 2.286em;
  display: inline-block;
  margin: 0;
  text-align: center;
  vertical-align: middle;
  background: none;
  background-image: none;
  border: 1px solid transparent;
  padding: 0;
  white-space: nowrap;
}
.rw-rtl {
  direction: rtl;
}
.rw-input {
  color: #555555;
  height: 2.286em;
  padding: 0.429em 0.857em;
  background-color: #ffffff;
}
.rw-input[disabled] {
  -webkit-box-shadow: none;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  background-color: #eeeeee;
  border-color: #cccccc;
}
.rw-input[readonly] {
  cursor: not-allowed;
}
.rw-filter-input {
  position: relative;
  width: 100%;
  padding-right: 1.9em;
  border: #cccccc 1px solid;
  border-radius: 4px;
  margin-bottom: 2px;
}
.rw-rtl .rw-filter-input {
  padding-left: 1.9em;
  padding-right: 0;
}
.rw-filter-input > .rw-input {
  width: 100%;
  border: none;
  outline: none;
}
.rw-filter-input > span {
  margin-top: -2px;
}
.rw-i.rw-loading {
  background: url("../img/loading.gif") no-repeat center;
  width: 16px;
  height: 100%;
}
.rw-i.rw-loading:before {
  content: "";
}
.rw-loading-mask {
  border-radius: 4px;
  position: relative;
}
.rw-loading-mask:after {
  content: '';
  background: url("../img/loader-big.gif") no-repeat center;
  position: absolute;
  background-color: #fff;
  opacity: 0.7;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}
.rw-now {
  font-weight: 600;
}
.rw-state-focus {
  background-color: #ffffff;
  border: #66afe9 1px solid;
  color: #333333;
}
.rw-state-selected {
  background-color: #adadad;
  border: #adadad 1px solid;
  color: #333333;
}
.rw-state-disabled {
  -webkit-box-shadow: none;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}
.rw-btn,
.rw-dropdownlist {
  cursor: pointer;
}
.rw-btn[disabled],
.rw-state-disabled .rw-btn,
.rw-state-readonly .rw-btn {
  -webkit-box-shadow: none;
  box-shadow: none;
  pointer-events: none;
  cursor: not-allowed;
  filter: alpha(opacity=65);
  opacity: .65;
}
ul.rw-list,
.rw-selectlist {
  margin: 0;
  padding-left: 0;
  list-style: none;
  padding: 5px 0;
  overflow: auto;
  outline: 0;
  height: 100%;
}
ul.rw-list > li,
.rw-selectlist > li {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
ul.rw-list > li.rw-list-optgroup,
.rw-selectlist > li.rw-list-optgroup {
  font-weight: bold;
}
ul.rw-list > li.rw-list-option,
ul.rw-list > li.rw-list-empty,
.rw-selectlist > li.rw-list-option,
.rw-selectlist > li.rw-list-empty {
  padding-left: 10px;
  padding-right: 10px;
}
ul.rw-list > li.rw-list-option,
.rw-selectlist > li.rw-list-option {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
}
ul.rw-list > li.rw-list-option:hover,
.rw-selectlist > li.rw-list-option:hover {
  background-color: #e6e6e6;
  border-color: #adadad;
}
ul.rw-list > li.rw-list-option.rw-state-focus,
.rw-selectlist > li.rw-list-option.rw-state-focus {
  background-color: #ffffff;
  border: #66afe9 1px solid;
  color: #333333;
}
ul.rw-list > li.rw-list-option.rw-state-selected,
.rw-selectlist > li.rw-list-option.rw-state-selected {
  background-color: #adadad;
  border: #adadad 1px solid;
  color: #333333;
}
ul.rw-list.rw-list-grouped > li.rw-list-optgroup,
.rw-selectlist.rw-list-grouped > li.rw-list-optgroup {
  padding-left: 10px;
}
ul.rw-list.rw-list-grouped > li.rw-list-option,
.rw-selectlist.rw-list-grouped > li.rw-list-option {
  padding-left: 20px;
}
.rw-widget {
  position: relative;
}
.rw-open.rw-widget,
.rw-open > .rw-multiselect-wrapper {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.rw-open-up.rw-widget,
.rw-open-up > .rw-multiselect-wrapper {
  border-top-right-radius: 0;
  border-top-left-radius: 0;
}
.rw-combobox .rw-list,
.rw-datetimepicker .rw-list,
.rw-numberpicker .rw-list,
.rw-dropdownlist .rw-list,
.rw-multiselect .rw-list {
  max-height: 200px;
  height: auto;
}
.rw-widget {
  background-color: #ffffff;
  border: #cccccc 1px solid;
  border-radius: 4px;
}
.rw-widget .rw-input {
  border-bottom-left-radius: 4px;
  border-top-left-radius: 4px;
}
.rw-rtl.rw-widget .rw-input {
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
  border-bottom-right-radius: 4px;
  border-top-right-radius: 4px;
}
.rw-widget > .rw-select {
  border-left: #cccccc 1px solid;
}
.rw-rtl.rw-widget > .rw-select {
  border-right: #cccccc 1px solid;
  border-left: none;
}
.rw-widget.rw-state-focus,
.rw-widget.rw-state-focus:hover {
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
  border-color: #66afe9;
  outline: 0;
}
.rw-widget.rw-state-readonly,
.rw-widget.rw-state-readonly > .rw-multiselect-wrapper {
  cursor: not-allowed;
}
.rw-widget.rw-state-disabled,
.rw-widget.rw-state-disabled:hover,
.rw-widget.rw-state-disabled:active {
  -webkit-box-shadow: none;
  box-shadow: none;
  background-color: #eeeeee;
  border-color: #cccccc;
}
.rw-combobox,
.rw-datetimepicker,
.rw-numberpicker,
.rw-dropdownlist {
  padding-right: 1.9em;
}
.rw-combobox.rw-rtl,
.rw-datetimepicker.rw-rtl,
.rw-numberpicker.rw-rtl,
.rw-dropdownlist.rw-rtl {
  padding-right: 0;
  padding-left: 1.9em;
}
.rw-combobox > .rw-input,
.rw-datetimepicker > .rw-input,
.rw-numberpicker > .rw-input,
.rw-dropdownlist > .rw-input {
  width: 100%;
  border: none;
  outline: 0;
}
.rw-combobox > .rw-input::-moz-placeholder,
.rw-datetimepicker > .rw-input::-moz-placeholder,
.rw-numberpicker > .rw-input::-moz-placeholder,
.rw-dropdownlist > .rw-input::-moz-placeholder {
  color: #999999;
  opacity: 1;
}
.rw-combobox > .rw-input:-ms-input-placeholder,
.rw-datetimepicker > .rw-input:-ms-input-placeholder,
.rw-numberpicker > .rw-input:-ms-input-placeholder,
.rw-dropdownlist > .rw-input:-ms-input-placeholder {
  color: #999999;
}
.rw-combobox > .rw-input::-webkit-input-placeholder,
.rw-datetimepicker > .rw-input::-webkit-input-placeholder,
.rw-numberpicker > .rw-input::-webkit-input-placeholder,
.rw-dropdownlist > .rw-input::-webkit-input-placeholder {
  color: #999999;
}
.rw-placeholder {
  color: #999999;
}
.rw-select {
  position: absolute;
  width: 1.9em;
  height: 100%;
  right: 0;
}
.rw-select.rw-btn,
.rw-select > .rw-btn {
  height: 100%;
  vertical-align: middle;
  outline: 0;
}
.rw-rtl .rw-select {
  left: 0;
  right: auto;
}
.rw-multiselect,
.rw-combobox input.rw-input,
.rw-datetimepicker input.rw-input,
.rw-numberpicker input.rw-input {
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
}
.rw-combobox:active,
.rw-datetimepicker:active,
.rw-dropdownlist:active,
.rw-header > .rw-btn:active,
.rw-numberpicker .rw-btn.rw-state-active,
.rw-combobox:active.rw-state-focus,
.rw-datetimepicker:active.rw-state-focus,
.rw-dropdownlist:active.rw-state-focus,
.rw-header > .rw-btn:active.rw-state-focus,
.rw-numberpicker .rw-btn.rw-state-active.rw-state-focus {
  background-image: none;
  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.rw-combobox:hover,
.rw-datetimepicker:hover,
.rw-numberpicker:hover,
.rw-dropdownlist:hover {
  background-color: #e6e6e6;
  border-color: #adadad;
}
.rw-dropdownlist.rw-state-disabled,
.rw-dropdownlist.rw-state-readonly {
  cursor: not-allowed;
}
.rw-dropdownlist > .rw-input {
  line-height: 2.286em;
  background-color: transparent;
  padding-top: 0;
  padding-bottom: 0;
  padding-right: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rw-dropdownlist.rw-rtl > .rw-input {
  padding: 0.429em 0.857em;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 0;
}
.rw-dropdownlist > .rw-select,
.rw-dropdownlist.rw-rtl > .rw-select {
  border-width: 0;
}
.rw-numberpicker .rw-btn {
  display: block;
  height: 1.143em;
  line-height: 1.143em;
  width: 100%;
  border-width: 0;
}
.rw-popup {
  position: absolute;
  -webkit-box-shadow: 0 5px 6px rgba(0, 0, 0, 0.2);
  box-shadow: 0 5px 6px rgba(0, 0, 0, 0.2);
  border-top-right-radius: 0;
  border-top-left-radius: 0;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  border: #cccccc 1px solid;
  background: #ffffff;
  padding: 2px;
  overflow: auto;
  margin-bottom: 10px;
  left: 10px;
  right: 10px;
}
.rw-dropup > .rw-popup {
  margin-bottom: 0;
  margin-top: 10px;
  border-top-right-radius: 3px;
  border-top-left-radius: 3px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}
.rw-popup-container {
  position: absolute;
  top: 100%;
  margin-top: 1px;
  z-index: 1005;
  left: -11px;
  right: -11px;
}
.rw-popup-container.rw-dropup {
  top: auto;
  bottom: 100%;
}
.rw-popup-container.rw-calendar-popup {
  right: auto;
  width: 18em;
}
.rw-datetimepicker .rw-btn {
  width: 1.8em;
}
.rw-datetimepicker.rw-has-neither {
  padding-left: 0;
  padding-right: 0;
}
.rw-datetimepicker.rw-has-neither .rw-input {
  border-radius: 4px;
}
.rw-datetimepicker.rw-has-both {
  padding-right: 3.8em;
}
.rw-datetimepicker.rw-has-both.rw-rtl {
  padding-right: 0;
  padding-left: 3.8em;
}
.rw-datetimepicker.rw-has-both > .rw-select {
  width: 3.8em;
  height: 100%;
}
.rw-calendar {
  background-color: #ffffff;
}
.rw-calendar thead > tr {
  border-bottom: 2px solid #cccccc;
}
.rw-calendar .rw-header {
  padding-bottom: 5px;
}
.rw-calendar .rw-header .rw-btn-left,
.rw-calendar .rw-header .rw-btn-right {
  width: 12.5%;
}
.rw-calendar .rw-header .rw-btn-view {
  width: 75%;
  background-color: #eeeeee;
  border-radius: 4px;
}
.rw-calendar .rw-header .rw-btn-view[disabled] {
  -webkit-box-shadow: none;
  box-shadow: none;
  cursor: not-allowed;
}
.rw-calendar .rw-footer {
  border-top: 1px solid #cccccc;
}
.rw-calendar .rw-footer .rw-btn {
  width: 100%;
  white-space: normal;
}
.rw-calendar .rw-footer .rw-btn:hover {
  background-color: #e6e6e6;
}
.rw-calendar .rw-footer .rw-btn[disabled] {
  -webkit-box-shadow: none;
  box-shadow: none;
  cursor: not-allowed;
}
.rw-calendar-grid {
  height: 14.28571429em;
  table-layout: fixed;
  width: 100%;
}
.rw-calendar-grid th {
  text-align: right;
  padding: 0 .4em 0 .1em;
}
.rw-calendar-grid .rw-btn {
  width: 100%;
  text-align: right;
}
.rw-calendar-grid td .rw-btn {
  border-radius: 4px;
  padding: 0 .4em 0 .1em;
  outline: 0;
}
.rw-calendar-grid td .rw-btn:hover {
  background-color: #e6e6e6;
}
.rw-calendar-grid td .rw-btn.rw-off-range {
  color: #b3b3b3;
}
.rw-calendar-grid.rw-nav-view .rw-btn {
  padding: .25em 0 .3em;
  display: block;
  overflow: hidden;
  text-align: center;
  white-space: normal;
}
.rw-selectlist {
  padding: 2px;
}
.rw-selectlist > ul {
  height: 100%;
  overflow: auto;
}
.rw-selectlist > ul > li.rw-list-option {
  position: relative;
  min-height: 27px;
  cursor: auto;
  padding-left: 5px;
}
.rw-selectlist > ul > li.rw-list-option > label > input {
  position: absolute;
  margin: 4px 0 0 -20px;
}
.rw-selectlist > ul > li.rw-list-option > label {
  padding-left: 20px;
  line-height: 1.423em;
  display: inline-block;
}
.rw-selectlist.rw-rtl > ul > li.rw-list-option {
  padding-left: 0;
  padding-right: 5px;
}
.rw-selectlist.rw-rtl > ul > li.rw-list-option > label > input {
  margin: 4px -20px 0 0px;
}
.rw-selectlist.rw-rtl > ul > li.rw-list-option > label {
  padding-left: 0;
  padding-right: 20px;
}
.rw-selectlist.rw-rtl > ul > li.rw-list-option {
  padding-left: 0;
  padding-right: 5px;
}
.rw-selectlist.rw-rtl > ul > li.rw-list-option > label > input {
  margin: 4px -20px 0 0px;
}
.rw-selectlist.rw-rtl > ul > li.rw-list-option > label {
  padding-left: 0;
  padding-right: 20px;
}
.rw-selectlist.rw-state-disabled > ul > li:hover,
.rw-selectlist.rw-state-readonly > ul > li:hover {
  background: none;
  border-color: transparent;
}
.rw-multiselect {
  background-color: #ffffff;
}
.rw-multiselect:hover {
  border-color: #adadad;
}
.rw-multiselect-wrapper {
  border-radius: 4px;
  position: relative;
  cursor: text;
}
.rw-multiselect-wrapper:before,
.rw-multiselect-wrapper:after {
  content: " ";
  display: table;
}
.rw-multiselect-wrapper:after {
  clear: both;
}
.rw-multiselect-wrapper i.rw-loading {
  position: absolute;
  right: 3px;
}
.rw-multiselect-wrapper > .rw-input {
  float: left;
  outline: 0;
  border-width: 0;
  line-height: normal;
  width: auto;
  max-width: 100%;
}
.rw-multiselect-wrapper > .rw-input::-moz-placeholder {
  color: #999999;
  opacity: 1;
}
.rw-multiselect-wrapper > .rw-input:-ms-input-placeholder {
  color: #999999;
}
.rw-multiselect-wrapper > .rw-input::-webkit-input-placeholder {
  color: #999999;
}
.rw-state-readonly > .rw-multiselect-wrapper,
.rw-state-disabled > .rw-multiselect-wrapper {
  cursor: not-allowed;
}
.rw-rtl .rw-multiselect-wrapper > .rw-input {
  float: right;
}
.rw-multiselect-create-tag {
  border-top: 1px #cccccc solid;
  padding-top: 5px;
  margin-top: 5px;
}
.rw-multiselect-taglist {
  margin: 0;
  padding-left: 0;
  list-style: none;
  padding-right: 0;
}
.rw-multiselect-taglist > li {
  display: inline-block;
  padding-left: 5px;
  padding-right: 5px;
}
.rw-multiselect-taglist > li {
  float: left;
  display: inline-block;
  margin: 1px;
  padding: 0.214em 0.15em 0.214em 0.4em;
  line-height: 1.4em;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  border-radius: 3px;
  border: 1px solid #cccccc;
  background-color: #cccccc;
  cursor: pointer;
}
.rw-multiselect-taglist > li.rw-state-focus {
  background-color: #ffffff;
  border: #66afe9 1px solid;
  color: #333333;
}
.rw-multiselect-taglist > li.rw-state-readonly,
.rw-multiselect-taglist > li.rw-state-disabled,
.rw-multiselect.rw-state-readonly .rw-multiselect-taglist > li,
.rw-multiselect.rw-state-disabled .rw-multiselect-taglist > li {
  cursor: not-allowed;
  filter: alpha(opacity=65);
  opacity: .65;
}
.rw-multiselect-taglist > li .rw-btn {
  outline: 0;
  font-size: 115%;
  line-height: normal;
}
.rw-rtl .rw-multiselect-taglist > li {
  float: right;
}
/* material-ui */
.cf:before,
.cf:after {
  content: " ";
  /* 1 */
  display: table;
  /* 2 */
}
.cf:after {
  clear: both;
}
/**
 * For IE 6/7 only
 * Include this rule to trigger hasLayout and contain floats.
 */
.cf {
  *zoom: 1;
}
body {
  margin: 0;
  font-family: Roboto, sans-serif;
}
body a {
  color: #999;
  text-decoration: none;
  outline: none;
}
body a:hover {
  text-decoration: underline;
}
body header {
  background-color: #C9C9AF;
  position: relative;
  margin: 0 0 20px;
  padding: 0;
  -webkit-box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
  -moz-box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
  box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
}
body header h1 {
  margin: 0;
  color: #57572C;
  padding: 3px 10px;
  display: inline-block;
  vertical-align: top;
}
body header .link {
  display: inline-block;
  vertical-align: top;
  overflow: hidden;
  text-indent: -9999px;
  border-radius: 3px;
  margin: 5px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
body header .link.teamwork {
  width: 192px;
  height: 30px;
  background: url('/assets/img/logo-tw-projects.png') no-repeat center rgba(255, 255, 255, 0.5);
}
body header .link.teamwork-desk {
  width: 169px;
  height: 30px;
  background: url('/assets/img/logo-tw-desk.png') no-repeat center rgba(255, 255, 255, 0.5);
}
body header .link.active {
  border: 1px solid white;
}
body header .buttons {
  position: absolute;
  right: 0;
  top: 0;
  padding: 7px 10px;
}
body .outer {
  position: relative;
}
body #panels {
  display: none;
  height: 500px;
  padding: 0 10px;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-y: scroll;
}
body #panels.active {
  display: block;
}
body .panel {
  display: inline-block;
  vertical-align: top;
  width: 32%;
  margin-right: 2%;
  border-radius: 2px;
  -webkit-box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
  -moz-box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
  box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
}
body .panel:last-child {
  margin-right: 0;
}
body .panel .header {
  position: relative;
}
body .panel .header h2 {
  background-color: #eeeedf;
  color: #666666;
  font-size: 16px;
  font-weight: normal;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #ddd;
}
body .panel .header .buttons {
  position: absolute;
  right: 0;
  top: 0;
  padding: 4px 5px;
}
body .panel h3 {
  font-size: 14px;
  font-weight: normal;
  margin: 0;
  padding: 6px 12px;
  background-color: #f5f5f5;
}
body .panel .item {
  position: relative;
  padding: 10px;
  border-bottom: 1px solid #eee;
}
body .panel .item:last-child {
  border-bottom: none;
}
body .panel .item .marker {
  position: absolute;
  width: 20%;
  height: 4px;
  top: 0;
  left: 0;
}
body .panel .item .marker.project {
  left: 21%;
}
body .panel .item .title {
  display: inline-block;
  vertical-align: top;
  width: 75%;
  font-size: 14px;
  line-height: 28px;
}
body .panel .item .title a {
  color: black;
}
body .panel .item .timer {
  display: inline-block;
  vertical-align: top;
  font-size: 14px;
  width: 25%;
}
body .panel .item .details {
  color: #999;
  font-size: 12px;
}
body .panel .item .buttons {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 5px;
}
body .panel .item .buttons.left {
  padding: 0 5px 0 0;
  display: inline-block;
  vertical-align: top;
  position: relative;
}
body .panel .item .buttons.additional {
  bottom: 0;
  top: auto;
}
body .panel .item .buttons.additional button,
body .panel .item .buttons.additional a {
  display: inline-block;
  border: 1px solid #e0e0e0;
  background-color: white;
  font-size: 12px;
  width: 22px;
  height: 22px;
  text-decoration: none;
  line-height: 18px;
  text-align: center;
}
body .panel .item .buttons.additional button:hover,
body .panel .item .buttons.additional a:hover {
  text-decoration: none;
  background-color: #f0f0f0;
}
body .panel #time .days .day {
  position: relative;
}
body .panel #time .days .day .time-total {
  position: absolute;
  top: 0;
  right: 0;
  padding: 5px 10px;
}
body .panel #time .item .timer {
  display: inline-block;
  vertical-align: top;
  font-size: 14px;
  width: 25%;
}
body .panel #time .item .details {
  padding-right: 70px;
}
body .panel #time .item .buttons button.billable {
  color: #ddd;
}
body .panel #time .item .buttons button.billable.active {
  color: green;
}
body .panel #time .current_timer {
  background-color: #DCD8DA;
}
body .panel #time .current_timer .title {
  font-size: 15px;
}
body .panel #time .current_timer .timer {
  font-size: 15px;
}
body .panel #time .current_timer .details {
  color: #87697A;
}
body .panel #time .current_timer .buttons button {
  border-color: white;
}
body .panel #tasks .item {
  border-left: 3px dotted #ccc;
}
body .panel #tasks .item.priority-low {
  border-left-color: green;
}
body .panel #tasks .item.priority-medium {
  border-left-color: yellow;
}
body .panel #tasks .item.priority-high {
  border-left-color: red;
}
body .panel #tasks .item .description {
  display: none;
}
body .panel #tasks .item .title {
  cursor: pointer;
}
body .panel #tasks .item .title:hover {
  text-decoration: underline;
}
body .panel #tasks .item .time {
  display: inline-block;
  vertical-align: top;
  color: #ccc;
  font-size: 14px;
}
body .panel #tasks .item .time.logged {
  color: black;
}
body .panel #tickets .tabs .tab {
  display: inline-block;
  vertical-align: top;
  width: 50%;
  padding: 4px 10px;
  box-sizing: border-box;
  background-color: #eee;
  color: #aaa;
}
body .panel #tickets .tabs .tab.active {
  background-color: white;
  color: black;
}
body .panel #tickets .item {
  border-left: 3px solid #ccc;
}
body .panel #tickets .item.priority-low {
  border-left-color: green;
}
body .panel #tickets .item.priority-medium {
  border-left-color: yellow;
}
body .panel #tickets .item.priority-high {
  border-left-color: red;
}
body .panel #tickets .none,
body .panel #tasks .none {
  padding: 10px 10px;
  color: #bbb;
}
body .panel #tickets .options,
body .panel #tasks .options {
  background-color: #DCD8DA;
  position: relative;
}
body .panel #tickets .options .buttons,
body .panel #tasks .options .buttons {
  position: relative;
  top: 0;
  left: 0;
}
body .panel #tickets .options .buttons button,
body .panel #tasks .options .buttons button {
  border: 1px solid white;
}
body .buttons button {
  width: 32px;
  height: 28px;
  overflow: hidden;
  border: 1px solid #ddd;
  border-radius: 2px;
  font-size: 24px;
  margin-right: 2px;
  color: #666;
  padding: 0;
  background-color: #F0F0F0;
}
body .buttons button:hover {
  background-color: white;
}
body .buttons button:last-child {
  margin-right: 0;
}
body .modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
}
body .modal > div {
  width: 100%;
  max-width: 800px;
  background-color: white;
  margin: 20px auto;
  border-radius: 4px;
  -webkit-box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
  -moz-box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
  box-shadow: 2px 2px 10px -4px rgba(0, 0, 0, 0.75);
  box-sizing: border-box;
  position: relative;
}
body .modal > div h2 {
  background-color: #eeeedf;
  color: #666666;
  font-size: 16px;
  font-weight: normal;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #ddd;
}
body .modal > div .buttons {
  position: absolute;
  top: 4px;
  right: 5px;
}
body form {
  padding: 20px;
  box-sizing: border-box;
}
body form .row {
  margin-bottom: 10px;
}
body form .row label {
  width: 100%;
  display: inline-block;
  vertical-align: top;
  margin-bottom: 5px;
}
body form .row input.text,
body form .row select {
  width: 100%;
  display: inline-block;
  vertical-align: top;
  border-radius: 4px;
  padding: 10px 15px;
  border: 1px solid #ddd;
  box-sizing: border-box;
}
body form .row .invalid-field {
  background-color: #fee;
}
body form .row .validation-error {
  color: red;
}
body form.time-entry-edit .time {
  width: 80px;
  display: inline-block;
  vertical-align: top;
}
body form .submit {
  border: 1px solid #ddd;
  background-color: #f0f0f0;
  border-radius: 4px;
  padding: 4px 10px;
  float: right;
}
body form .submit:hover {
  background-color: white;
}
body .frame {
  display: none;
  background-color: red;
  width: 100%;
  height: 300px;
  overflow: hidden;
}
body .frame.active {
  display: block;
}
body .frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  margin: 0;
}


text:
/***
* Inferno Engine v4 2015-2017
* Written by Tomasz "Rex Dex" Jonarski
*
***/

#include "build.h"
#include "hl2StudioModelFile.h"

namespace hl2
{
    namespace mdl
    {

// Insert this code anywhere that you need to allow for conversion from an old STUDIO_VERSION
// to a new one.
// If we only support the current version, this function should be empty.
        inline bool Studio_ConvertStudioHdrToNewVersion( studiohdr_t *pStudioHdr )
        {
            //( STUDIO_VERSION == 48 ); //  put this to make sure this code is updated upon changing version.

            if (pStudioHdr->studiohdr2index == -1)
                pStudioHdr->studiohdr2index = 0;

            int version = pStudioHdr->version;
            if ( version == STUDIO_VERSION )
                return true;

            bool bResult = true;
            if (version < 46)
            {
                // some of the anim index data is incompatible
                for (int i = 0; i < pStudioHdr->numlocalanim; i++)
                {
                    mstudioanimdesc_t *pAnim = (mstudioanimdesc_t *)pStudioHdr->pLocalAnimdesc( i );

                    // old ANI files that used sections (v45 only) are not compatible
                    if ( pAnim->sectionframes != 0 )
                    {
                        // zero most everything out
                        memset( &(pAnim->numframes), 0, (Uint8 *)(pAnim + 1) - (Uint8 *)&(pAnim->numframes) );

                        pAnim->numframes = 1;
                        pAnim->animblock = -1; // disable animation fetching
                        bResult = false;
                    }
                }
            }

            if (version < 47)
            {
                // used to contain zeroframe cache data
                if (pStudioHdr->unused4 != 0)
                {
                    pStudioHdr->unused4 = 0;
                    bResult = false;
                }
                for (int i = 0; i < pStudioHdr->numlocalanim; i++)
                {
                    mstudioanimdesc_t *pAnim = (mstudioanimdesc_t *)pStudioHdr->pLocalAnimdesc( i );
                    pAnim->zeroframeindex = 0;
                    pAnim->zeroframespan = 0;
                }
            }
            else if (version == 47)
            {
                for (int i = 0; i < pStudioHdr->numlocalanim; i++)
                {
                    mstudioanimdesc_t *pAnim = (mstudioanimdesc_t *)pStudioHdr->pLocalAnimdesc( i );
                    if (pAnim->zeroframeindex != 0)
                    {
                        pAnim->zeroframeindex = 0;
                        pAnim->zeroframespan = 0;
                        bResult = false;
                    }
                }
            }

            // for now, just slam the version number since they're compatible
            TRACE_INFO("Original file version: {}", pStudioHdr->version);
            pStudioHdr->version = STUDIO_VERSION;

            return bResult;
        }

        const Bool ValidateFile(const studiohdr_t& file)
        {
            if (file.version > STUDIO_VERSION)
            {
                TRACE_ERROR("Studio model file is in unsupported version {}", file.version);
                return false;
            }

            return Studio_ConvertStudioHdrToNewVersion(const_cast<studiohdr_t*>(&file));
        }

    } // mdl
} // hl2


text:
import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import {Observable} from 'rxjs/Observable';

import {ContactModel} from '../models/contact.model';
import {DirectoryService} from './directory.service';

@Component({
  moduleId: module.id,
  templateUrl: 'directory.component.html',
  styleUrls: ['directory.component.css']
})
export class DirectoryComponent implements OnInit {
  contacts: Observable<any[]>;

  constructor(private _directoryService: DirectoryService, private _router: Router) {}

  ngOnInit() {
    this.getContacts();
  }

  getContacts() {
    this.contacts = this._directoryService.getContacts();
  }

  onSelect(contactModel: ContactModel) {
    let name = this._directoryService.getLinkName(contactModel.name);
    this._router.navigate(['/' + name]);
  }
}


text:
{-# LANGUAGE FlexibleContexts    #-}
{-# LANGUAGE ScopedTypeVariables #-}

module PostgREST.App (
  postgrest
) where

import           Control.Applicative
import           Data.Aeson                (toJSON, eitherDecode)
import qualified Data.ByteString.Char8     as BS
import           Data.Maybe
import           Data.IORef                (IORef, readIORef)
import           Data.Text                 (intercalate)

import qualified Hasql.Pool                 as P
import qualified Hasql.Transaction          as HT
import qualified Hasql.Transaction.Sessions as HT

import           Network.HTTP.Types.Header
import           Network.HTTP.Types.Status
import           Network.HTTP.Types.URI    (renderSimpleQuery)
import           Network.Wai
import           Network.Wai.Middleware.RequestLogger (logStdout)

import qualified Data.Vector               as V
import qualified Hasql.Transaction         as H

import qualified Data.HashMap.Strict       as M

import           PostgREST.ApiRequest   ( ApiRequest(..), ContentType(..)
                                        , Action(..), Target(..)
                                        , PreferRepresentation (..)
                                        , mutuallyAgreeable
                                        , userApiRequest
                                        )
import           PostgREST.Auth            (jwtClaims, containsRole, parseJWK)
import           PostgREST.Config          (AppConfig (..))
import           PostgREST.DbStructure
import           PostgREST.DbRequestBuilder( readRequest
                                           , mutateRequest
                                           , readRpcRequest
                                           , fieldNames
                                           )
import           PostgREST.Error           ( simpleError, pgError
                                           , apiRequestError
                                           , singularityError, binaryFieldError
                                           , connectionLostError, gucHeadersError
                                           )
import           PostgREST.RangeQuery      (allRange, rangeOffset)
import           PostgREST.Middleware
import           PostgREST.QueryBuilder ( callProc
                                        , requestToQuery
                                        , requestToCountQuery
                                        , createReadStatement
                                        , createWriteStatement
                                        , ResultsWithCount
                                        )
import           PostgREST.Types
import           PostgREST.OpenAPI

import           Data.Function (id)
import           Protolude              hiding (intercalate, Proxy)
import           Safe                   (headMay)

postgrest :: AppConfig -> IORef (Maybe DbStructure) -> P.Pool -> IO () -> Application
postgrest conf refDbStructure pool worker =
  let middle = (if configQuiet conf then id else logStdout) . defaultMiddle
      jwtSecret = parseJWK <$> configJwtSecret conf in

  middle $ \ req respond -> do
    body <- strictRequestBody req
    maybeDbStructure <- readIORef refDbStructure
    case maybeDbStructure of
      Nothing -> respond connectionLostError
      Just dbStructure -> do
        response <- case userApiRequest (configSchema conf) req body of
          Left err -> return $ apiRequestError err
          Right apiRequest -> do
            eClaims <- jwtClaims jwtSecret (configJwtAudience conf) (toS $ iJWT apiRequest)

            let authed = containsRole eClaims
                handleReq = runWithClaims conf eClaims (app dbStructure conf) apiRequest
                txMode = transactionMode dbStructure
                  (iTarget apiRequest) (iAction apiRequest)
            response <- P.use pool $ HT.transaction HT.ReadCommitted txMode handleReq
            return $ either (pgError authed) identity response
        when (responseStatus response == status503) worker
        respond response

transactionMode :: DbStructure -> Target -> Action -> H.Mode
transactionMode structure target action =
  case action of
    ActionRead -> HT.Read
    ActionInfo -> HT.Read
    ActionInspect -> HT.Read
    ActionInvoke{isReadOnly=False} ->
      let proc =
            case target of
              (TargetProc qi) -> M.lookup (qiName qi) $
                                   dbProcs structure
              _               -> Nothing
          v = fromMaybe Volatile $ pdVolatility <$> proc in
      if v == Stable || v == Immutable
         then HT.Read
         else HT.Write
    ActionInvoke{isReadOnly=True} -> HT.Read
    _ -> HT.Write

app :: DbStructure -> AppConfig -> ApiRequest -> H.Transaction Response
app dbStructure conf apiRequest =
  case responseContentTypeOrError (iAccepts apiRequest) (iAction apiRequest) of
    Left errorResponse -> return errorResponse
    Right contentType ->
      case (iAction apiRequest, iTarget apiRequest, iPayload apiRequest) of

        (ActionRead, TargetIdent qi, Nothing) ->
          let partsField = (,) <$> readSqlParts
                <*> (binaryField contentType =<< fldNames) in
          case partsField of
            Left errorResponse -> return errorResponse
            Right ((q, cq), bField) -> do
              let stm = createReadStatement q cq (contentType == CTSingularJSON) shouldCount
                                            (contentType == CTTextCSV) bField
              row <- H.query () stm
              let (tableTotal, queryTotal, _ , body) = row
                  (status, contentRange) = rangeHeader queryTotal tableTotal
                  canonical = iCanonicalQS apiRequest
              return $
                if contentType == CTSingularJSON && queryTotal /= 1
                  then singularityError (toInteger queryTotal)
                  else responseLBS status
                    [toHeader contentType, contentRange,
                      ("Content-Location",
                        "/" <> toS (qiName qi) <>
                          if BS.null canonical then "" else "?" <> toS canonical
                      )
                    ] (toS body)

        (ActionCreate, TargetIdent (QualifiedIdentifier _ table), Just payload@(PayloadJSON rows)) ->
          case mutateSqlParts of
            Left errorResponse -> return errorResponse
            Right (sq, mq) -> do
              let isSingle = (==1) $ V.length rows
              if contentType == CTSingularJSON
                 && not isSingle
                 && iPreferRepresentation apiRequest == Full
                then return $ singularityError (toInteger $ V.length rows)
                else do
                  let pKeys = map pkName $ filter (filterPk schema table) allPrKeys -- would it be ok to move primary key detection in the query itself?
                      stm = createWriteStatement sq mq
                        (contentType == CTSingularJSON) isSingle
                        (contentType == CTTextCSV) (iPreferRepresentation apiRequest)
                        pKeys
                  row <- H.query payload stm
                  let (_, _, fs, body) = extractQueryResult row
                      headers = catMaybes [
                          if null fs
                            then Nothing
                            else Just (hLocation, "/" <> toS table <> renderLocationFields fs)
                        , if iPreferRepresentation apiRequest == Full
                            then Just $ toHeader contentType
                            else Nothing
                        , Just . contentRangeH 1 0 $
                            toInteger <$> if shouldCount then Just (V.length rows) else Nothing
                        ]

                  return . responseLBS status201 headers $
                    if iPreferRepresentation apiRequest == Full
                      then toS body else ""

        (ActionUpdate, TargetIdent _, Just payload@(PayloadJSON rows)) ->
          case (mutateSqlParts, null <$> rows V.!? 0, iPreferRepresentation apiRequest == Full) of
            (Left errorResponse, _, _) -> return errorResponse
            (_, Just True, True) -> return $ responseLBS status200 [contentRangeH 1 0 Nothing] "[]"
            (_, Just True, False) -> return $ responseLBS status204 [contentRangeH 1 0 Nothing] ""
            (Right (sq, mq), _, _) -> do
              let stm = createWriteStatement sq mq
                    (contentType == CTSingularJSON) False (contentType == CTTextCSV)
                    (iPreferRepresentation apiRequest) []
              row <- H.query payload stm
              let (_, queryTotal, _, body) = extractQueryResult row
              if contentType == CTSingularJSON
                 && queryTotal /= 1
                 && iPreferRepresentation apiRequest == Full
                then do
                  HT.condemn
                  return $ singularityError (toInteger queryTotal)
                else do
                  let r = contentRangeH 0 (toInteger $ queryTotal-1)
                            (toInteger <$> if shouldCount then Just queryTotal else Nothing)
                      s = if iPreferRepresentation apiRequest == Full
                            then status200
                            else status204
                  return $ if iPreferRepresentation apiRequest == Full
                    then responseLBS s [toHeader contentType, r] (toS body)
                    else responseLBS s [r] ""

        (ActionDelete, TargetIdent _, Nothing) ->
          case mutateSqlParts of
            Left errorResponse -> return errorResponse
            Right (sq, mq) -> do
              let emptyPayload = PayloadJSON V.empty
                  stm = createWriteStatement sq mq
                    (contentType == CTSingularJSON) False
                    (contentType == CTTextCSV)
                    (iPreferRepresentation apiRequest) []
              row <- H.query emptyPayload stm
              let (_, queryTotal, _, body) = extractQueryResult row
                  r = contentRangeH 1 0 $
                        toInteger <$> if shouldCount then Just queryTotal else Nothing
              if contentType == CTSingularJSON
                 && queryTotal /= 1
                 && iPreferRepresentation apiRequest == Full
                then do
                  HT.condemn
                  return $ singularityError (toInteger queryTotal)
                else
                  return $ if iPreferRepresentation apiRequest == Full
                    then responseLBS status200 [toHeader contentType, r] (toS body)
                    else responseLBS status204 [r] ""

        (ActionInfo, TargetIdent (QualifiedIdentifier tSchema tTable), Nothing) ->
          let mTable = find (\t -> tableName t == tTable && tableSchema t == tSchema) (dbTables dbStructure) in
          case mTable of
            Nothing -> return notFound
            Just table ->
              let acceptH = (hAllow, if tableInsertable table then "GET,POST,PATCH,DELETE" else "GET") in
              return $ responseLBS status200 [allOrigins, acceptH] ""

        (ActionInvoke _isReadOnly, TargetProc qi, payload) ->
          let proc = M.lookup (qiName qi) allProcs
              returnsScalar = case proc of
                Just ProcDescription{pdReturnType = (Single (Scalar _))} -> True
                _ -> False
              rpcBinaryField = if returnsScalar
                                 then Right Nothing
                                 else binaryField contentType =<< fldNames
              parts = (,,) <$> readSqlParts <*> rpcBinaryField <*> rpcQParams in
          case parts of
            Left errorResponse -> return errorResponse
            Right ((q, cq), bField, params) -> do
              let prms = case payload of
                          Just (PayloadJSON pld) -> V.head pld
                          Nothing -> M.fromList $ second toJSON <$> params -- toJSON is just for reusing the callProc function
                  singular = contentType == CTSingularJSON
                  paramsAsSingleObject = iPreferSingleObjectParameter apiRequest
              row <- H.query () $
                callProc qi prms returnsScalar q cq shouldCount
                         singular paramsAsSingleObject
                         (contentType == CTTextCSV)
                         (contentType == CTOctetStream) _isReadOnly bField
                         (pgVersion dbStructure)
              let (tableTotal, queryTotal, body, jsonHeaders) =
                    fromMaybe (Just 0, 0, "[]", "[]") row
                  (status, contentRange) = rangeHeader queryTotal tableTotal
                  decodedHeaders = first toS $ eitherDecode $ toS jsonHeaders :: Either Text [GucHeader]
              case decodedHeaders of
                Left _ -> return gucHeadersError
                Right hs ->
                  if singular && queryTotal /= 1
                    then do
                      HT.condemn
                      return $ singularityError (toInteger queryTotal)
                    else return $ responseLBS status ([toHeader contentType, contentRange] ++ toHeaders hs) (toS body)

        (ActionInspect, TargetRoot, Nothing) -> do
          let host = configHost conf
              port = toInteger $ configPort conf
              proxy = pickProxy $ toS <$> configProxyUri conf
              uri Nothing = ("http", host, port, "/")
              uri (Just Proxy { proxyScheme = s, proxyHost = h, proxyPort = p, proxyPath = b }) = (s, h, p, b)
              uri' = uri proxy
              encodeApi ti sd procs = encodeOpenAPI (M.elems procs) (toTableInfo ti) uri' sd (dbPrimaryKeys dbStructure)
          body <- encodeApi <$> H.query schema accessibleTables <*> H.query schema schemaDescription <*> H.query schema accessibleProcs
          return $ responseLBS status200 [toHeader CTOpenAPI] $ toS body

        _ -> return notFound

    where
      toTableInfo :: [Table] -> [(Table, [Column], [Text])]
      toTableInfo = map (\t ->
        let tSchema = tableSchema t
            tTable = tableName t
            cols = filter (filterCol tSchema tTable) $ dbColumns dbStructure
            pkeys = map pkName $ filter (filterPk tSchema tTable) allPrKeys
        in (t, cols, pkeys))
      notFound = responseLBS status404 [] ""
      filterPk sc table pk = sc == (tableSchema . pkTable) pk && table == (tableName . pkTable) pk
      filterCol :: Schema -> TableName -> Column -> Bool
      filterCol sc tb Column{colTable=Table{tableSchema=s, tableName=t}} = s==sc && t==tb
      allPrKeys = dbPrimaryKeys dbStructure
      allProcs = dbProcs dbStructure
      allOrigins = ("Access-Control-Allow-Origin", "*") :: Header
      shouldCount = iPreferCount apiRequest
      schema = toS $ configSchema conf
      topLevelRange = fromMaybe allRange $ M.lookup "limit" $ iRange apiRequest
      rangeHeader queryTotal tableTotal =
        let lower = rangeOffset topLevelRange
            upper = lower + toInteger queryTotal - 1
            contentRange = contentRangeH lower upper (toInteger <$> tableTotal)
            status = rangeStatus lower upper (toInteger <$> tableTotal)
        in (status, contentRange)

      readReq = readRequest (configMaxRows conf) (dbRelations dbStructure) allProcs apiRequest
      fldNames = fieldNames <$> readReq
      readDbRequest = DbRead <$> readReq
      mutateDbRequest = DbMutate <$> (mutateRequest apiRequest =<< fldNames)
      rpcQParams = readRpcRequest apiRequest
      selectQuery = requestToQuery schema False <$> readDbRequest
      mutateQuery = requestToQuery schema False <$> mutateDbRequest
      countQuery = requestToCountQuery schema <$> readDbRequest
      readSqlParts = (,) <$> selectQuery <*> countQuery
      mutateSqlParts = (,) <$> selectQuery <*> mutateQuery

responseContentTypeOrError :: [ContentType] -> Action -> Either Response ContentType
responseContentTypeOrError accepts action = serves contentTypesForRequest accepts
  where
    contentTypesForRequest =
      case action of
        ActionRead ->    [CTApplicationJSON, CTSingularJSON, CTTextCSV, CTOctetStream]
        ActionCreate ->  [CTApplicationJSON, CTSingularJSON, CTTextCSV]
        ActionUpdate ->  [CTApplicationJSON, CTSingularJSON, CTTextCSV]
        ActionDelete ->  [CTApplicationJSON, CTSingularJSON, CTTextCSV]
        ActionInvoke _ ->  [CTApplicationJSON, CTSingularJSON, CTTextCSV, CTOctetStream]
        ActionInspect -> [CTOpenAPI, CTApplicationJSON]
        ActionInfo ->    [CTTextCSV]
    serves sProduces cAccepts =
      case mutuallyAgreeable sProduces cAccepts of
        Nothing -> do
          let failed = intercalate ", " $ map (toS . toMime) cAccepts
          Left $ simpleError status415 [] $
            "None of these Content-Types are available: " <> failed
        Just ct -> Right ct

binaryField :: ContentType -> [FieldName] -> Either Response (Maybe FieldName)
binaryField CTOctetStream fldNames =
  if length fldNames == 1 && fieldName /= Just "*"
    then Right fieldName
    else Left binaryFieldError
  where
    fieldName = headMay fldNames
binaryField _ _ = Right Nothing

splitKeyValue :: BS.ByteString -> (BS.ByteString, BS.ByteString)
splitKeyValue kv = (k, BS.tail v)
  where (k, v) = BS.break (== '=') kv

renderLocationFields :: [BS.ByteString] -> BS.ByteString
renderLocationFields fields =
  renderSimpleQuery True $ map splitKeyValue fields

rangeStatus :: Integer -> Integer -> Maybe Integer -> Status
rangeStatus _ _ Nothing = status200
rangeStatus lower upper (Just total)
  | lower > total            = status416
  | (1 + upper - lower) < total = status206
  | otherwise               = status200

contentRangeH :: Integer -> Integer -> Maybe Integer -> Header
contentRangeH lower upper total =
    ("Content-Range", headerValue)
    where
      headerValue   = rangeString <> "/" <> totalString
      rangeString
        | totalNotZero && fromInRange = show lower <> "-" <> show upper
        | otherwise = "*"
      totalString   = fromMaybe "*" (show <$> total)
      totalNotZero  = fromMaybe True ((/=) 0 <$> total)
      fromInRange   = lower <= upper

extractQueryResult :: Maybe ResultsWithCount -> ResultsWithCount
extractQueryResult = fromMaybe (Nothing, 0, [], "")


text:
import { bindAll } from "../index";
export = bindAll;


text:
define("mmDeferred", ["avalon"], function(avalon) {
    //http://www.codingserf.com/index.php/2013/06/dropdownlist2/
    // 允许传入一个对象,它将混入到整条Deferred链的所有Promise对象
    var noop = function() {
    }
    function Deferred(mixin) {
        var state = "pending", dirty = false
        function ok(x) {
            state = "fulfilled"
            return x
        }
        function ng(e) {
            state = "rejected"
            throw e
        }

        var dfd = {
            callback: {
                resolve: ok,
                reject: ng,
                notify: noop,
                ensure: noop
            },
            dirty: function() {
                return dirty
            },
            state: function() {
                return state
            },
            promise: {
                then: function() {
                    return _post.apply(null, arguments)
                },
                otherwise: function(onReject) {
                    return _post(0, onReject)
                },
                //https://github.com/cujojs/when/issues/103
                ensure: function(onEnsure) {
                    return _post(0, 0, 0, onEnsure)
                },
                _next: null
            }
        }
        if (typeof mixin === "function") {
            mixin(dfd.promise)
        } else if (mixin && typeof mixin === "object") {
            for (var i in mixin) {
                if (!dfd.promise[i]) {
                    dfd.promise[i] = mixin[i]
                }
            }
        }

//http://thanpol.as/javascript/promises-a-performance-hits-you-should-be-aware-of/
        "resolve,reject,notify".replace(/\w+/g, function(method) {
            dfd[method] = function() {
                var that = this, args = arguments
                //http://promisesaplus.com/ 4.1
                if (that.dirty()) {
                    _fire.call(that, method, args)
                } else {
                    Deferred.nextTick(function() {
                        _fire.call(that, method, args)
                    })
                }
            }
        })
        return dfd

        function _post() {
            var index = -1, fns = arguments;
            "resolve,reject,notify,ensure".replace(/\w+/g, function(method) {
                var fn = fns[++index];
                if (typeof fn === "function") {
                    dirty = true
                    if (method === "resolve" || method === "reject") {
                        dfd.callback[method] = function() {
                            try {
                                var value = fn.apply(this, arguments)
                                state = "fulfilled"
                                return value
                            } catch (err) {
                                state = "rejected"
                                return err
                            }
                        }
                    } else {
                        dfd.callback[method] = fn;
                    }
                }
            })
            var deferred = dfd.promise._next = Deferred(mixin)
            return deferred.promise;
        }

        function _fire(method, array) {
            var next = "resolve", value
            if (this.state() === "pending" || method === "notify") {
                var fn = this.callback[method]
                try {
                    value = fn.apply(this, array);
                } catch (e) {//处理notify的异常
                    value = e
                }
                if (this.state() === "rejected") {
                    next = "reject"
                } else if (method === "notify") {
                    next = "notify"
                }
                array = [value]
            }
            var ensure = this.callback.ensure
            if (noop !== ensure) {
                try {
                    ensure.call(this)//模拟finally
                } catch (e) {
                    next = "reject";
                    array = [e];
                }
            }
            var nextDeferred = this.promise._next
            if (Deferred.isPromise(value)) {
                value._next = nextDeferred
            } else {
                if (nextDeferred) {
                    _fire.call(nextDeferred, next, array);
                }
            }
        }

    }
    window.Deferred = Deferred;
    Deferred.isPromise = function(obj) {
        return !!(obj && typeof obj.then === "function");
    };

    function some(any, promises) {
        var deferred = Deferred(), n = 0, result = [], end
        function loop(promise, index) {
            promise.then(function(ret) {
                if (!end) {
                    result[index] = ret//保证回调的顺序
                    n++;
                    if (any || n >= promises.length) {
                        deferred.resolve(any ? ret : result);
                        end = true
                    }
                }
            }, function(e) {
                end = true
                deferred.reject(e);
            })
        }
        for (var i = 0, l = promises.length; i < l; i++) {
            loop(promises[i], i)
        }
        return deferred.promise;
    }
    Deferred.all = function() {
        return some(false, arguments)
    }
    Deferred.any = function() {
        return some(true, arguments)
    }
    Deferred.nextTick = avalon.nextTick
//http://www.raychase.net/1329
//http://www.cnblogs.com/iamzhanglei/archive/2013/02/24/2924680.html
    return Deferred
})


text: <!doctype html>


text:
module CatalogAdmin::ItemTypesHelper
  def setup_item_type_nav_link(item_type)
    slug = params[:item_type_slug] || params[:slug]
    active = params[:controller] =~ /item_types|fields/ &&
             slug == item_type.slug

    klass = "list-group-item list-group-item-action"
    klass << " active" if active

    link_to(
      item_type.name,
      catalog_admin_item_type_fields_path(item_type.catalog, I18n.locale, item_type),
      :class => klass
    )
  end

  def entry_item_type_nav_link(item_type)
    slug = params[:item_type_slug] || params[:slug]
    active = params[:controller] == "catalog_admin/items" &&
             slug == item_type.slug

    klass = "list-group-item list-group-item-action"
    klass << " active" if active

    label = [h(item_type.name_plural)]
    label << tag.span(
      number_with_delimiter(item_type.items.count),
      :class => "badge-pill badge-secondary float-right"
    )

    link_to(
      label.join(" ").html_safe,
      catalog_admin_items_path(item_type.catalog, I18n.locale, item_type),
      :class => klass
    )
  end

  def catalog_admin_contextual_data_path
    return catalog_admin_data_path unless params[:item_type_slug].present?

    catalog_admin_items_path
  end

  def catalog_admin_contextual_setup_path
    return catalog_admin_setup_path unless params[:item_type_slug].present?

    catalog_admin_item_type_fields_path
  end
end


text:
from zeit.cms.i18n import MessageFactory as _
import grokcore.component as grok
import zeit.content.cp.blocks.block
import zeit.content.cp.interfaces
import zeit.content.modules.quiz

class QuizBlock(
        zeit.content.modules.quiz.Quiz,
        zeit.content.cp.blocks.block.Block):

    grok.implements(zeit.content.cp.interfaces.IQuizBlock)
    type = 'quiz'

    # XXX somehow we use a PathProperty here, but an AttributeProperty on
    # articles, sigh.
    quiz_id = zeit.cms.content.property.ObjectPathProperty(
        '.quiz_id', zeit.content.cp.interfaces.IQuizBlock['quiz_id'])

class Factory(zeit.content.cp.blocks.block.BlockFactory):

    produces = QuizBlock
    title = _('Quiz block')


text:
#import "PBTextView.h"

@implementation PBTextView

- (BOOL) isOpaque
{
    return NO;
}

@end


text:
<?php
/**
 * Template part for displaying page content in page.php.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Web_Layouts
 */

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

		<?php
			the_content();

			wp_link_pages( array(
				'before' => '
' . esc_html__( 'Pages:', 'web_layouts' ),
				'after'  => '
',
			) );
		?>


text:
package com.specmate.common.cache;

public interface ICacheService {
	/**
	 * Creates a new cache. In case a cache with the given name has already been
	 * created, returns the already created cache. Note: capacity and evict time are
	 * not updated.
	 */
	public <K,V> ICache<K,V> createCache(String name, int capacity, int evictTime, ICacheLoader<K,V> loader);

	void removeCache(String name);
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HIO.Backup.Interface
{
    public interface IDirectoryCreator
    {
        Task CreateDirectoryAsync(string path);
    }
}


text: document.getElementById('link_nombre').textContent = " " +$.cookie("nombre");


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Sphaeria punicae Mont.

### Remarks
null