text:
#include <cub/device/device_histogram.cuh>

using namespace cub;

template <
    int         NUM_CHANNELS,
    int         ACTIVE_CHANNELS,
    int         NUM_BINS,
    typename    PixelType>
double run_cub_histogram(
    PixelType *d_image,
    int width,
    int height,
    unsigned int *d_hist,
    bool is_warmup)
{
    enum {
        is_float = Equals<PixelType, float4>::VALUE,
    };

    typedef typename If<is_float, float, unsigned char>::Type    SampleT;    // Sample type
    typedef typename If<is_float, float, unsigned int>::Type     LevelT;     // Level type (uint32 for uchar)

    // Setup data structures
    unsigned int*       d_histogram[ACTIVE_CHANNELS];
    int                 num_levels[ACTIVE_CHANNELS];            ///< [in] The number of boundaries (levels) for delineating histogram samples in each active channel.  Implies that the number of bins for channeli is <tt>num_levels[i]</tt> - 1.
    LevelT              lower_level[ACTIVE_CHANNELS];           ///< [in] The lower sample value bound (inclusive) for the lowest histogram bin in each active channel.
    LevelT              upper_level[ACTIVE_CHANNELS];           ///< [in] The upper sample value bound (exclusive) for the highest histogram bin in each active channel.

    for (int CHANNEL = 0; CHANNEL < ACTIVE_CHANNELS; ++CHANNEL)
    {
        d_histogram[CHANNEL] = d_hist + (CHANNEL * NUM_BINS);
        num_levels[CHANNEL] = NUM_BINS + 1;
        lower_level[CHANNEL] = 0;
        upper_level[CHANNEL] = (is_float) ? 1 : 256;
    }

    // Allocate temporary storage
    size_t temp_storage_bytes = 0;
    void *d_temp_storage = NULL;

    SampleT* d_image_samples = (SampleT*) d_image;

    // Get amount of temporary storage needed
    DeviceHistogram::MultiHistogramEven<NUM_CHANNELS, ACTIVE_CHANNELS>(
        d_temp_storage,
        temp_storage_bytes,
        d_image_samples,
        d_histogram,
        num_levels,
        lower_level,
        upper_level,
        width * height,
        (cudaStream_t) 0,
        is_warmup);

    cudaMalloc(&d_temp_storage, temp_storage_bytes);

    GpuTimer gpu_timer;
    gpu_timer.Start();

    // Compute histogram
    DeviceHistogram::MultiHistogramEven<NUM_CHANNELS, ACTIVE_CHANNELS>(
        d_temp_storage,
        temp_storage_bytes,
        d_image_samples,
        d_histogram,
        num_levels,
        lower_level,
        upper_level,
        width * height,
        (cudaStream_t) 0,
        is_warmup);

    gpu_timer.Stop();
    float elapsed_millis = gpu_timer.ElapsedMillis();

    cudaFree(d_temp_storage);

    return elapsed_millis;
}


text:
var Fields = require('oae-config/lib/fields');

module.exports = {
    'title': 'OAE Preview Processor Module',
    'slideshare': {
        'name': 'SlideShare configuration',
        'description': 'Configuration for the SlideShare retriever',
        'elements': {
            'apikey': new Fields.Text('API Key', 'The SlideShare API key', '', {'tenantOverride': false, 'suppress': true, 'globalAdminOnly': true}),
            'sharedsecret': new Fields.Text('Shared Secret', 'The SlideShare shared secret', '', {'tenantOverride': false, 'suppress': true, 'globalAdminOnly': true})
        }
    },
    'flickr': {
        'name': 'Flickr configuration',
        'description': 'Configuration for the Flickr retriever',
        'elements': {
            'apikey': new Fields.Text('API Key', 'The Flickr API key', '', {'tenantOverride': false, 'suppress': true, 'globalAdminOnly': true}),
            'apisecret': new Fields.Text('API Secret', 'The Flickr API secret', '', {'tenantOverride': false, 'suppress': true, 'globalAdminOnly': true})
        }
    },
    'youtube': {
        'name': 'YouTube configuration',
        'description': 'Configuration for the YouTube retriever',
        'elements': {
            'key': new Fields.Text('Key', 'The YouTube server key', '', {'tenantOverride': false, 'suppress': true, 'globalAdminOnly': true})
        }
    }
};

redpajama_set_name: RedPajamaGithub


text:
using System.Composition;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Formatting.Rules;
using Microsoft.CodeAnalysis.Options;

namespace Microsoft.CodeAnalysis.CSharp.Formatting
{
    [ExportFormattingRule(Name, LanguageNames.CSharp), Shared]
    [ExtensionOrder(After = QueryExpressionFormattingRule.Name)]
    internal class TokenBasedFormattingRule : BaseFormattingRule
    {
        internal const string Name = "CSharp Token Based Formatting Rule";

        public override AdjustNewLinesOperation GetAdjustNewLinesOperation(SyntaxToken previousToken, SyntaxToken currentToken, OptionSet optionSet, NextOperation<AdjustNewLinesOperation> nextOperation)
        {
            ////////////////////////////////////////////////////
            // brace related operations
            // * { or * }
            switch (currentToken.Kind())
            {
                case SyntaxKind.OpenBraceToken:
                if (currentToken.IsInterpolation())
                {
                    return null;
                }
                    if (!previousToken.IsParenInParenthesizedExpression() && previousToken.Parent != null && !previousToken.Parent.IsKind(SyntaxKind.ArrayRankSpecifier))
                    {
                        return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
                    }

                    break;

                case SyntaxKind.CloseBraceToken:
                if (currentToken.IsInterpolation())
                {
                    return null;
                }
                    return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            // do { } while case
            if (previousToken.Kind() == SyntaxKind.CloseBraceToken && currentToken.Kind() == SyntaxKind.WhileKeyword)
            {
                return CreateAdjustNewLinesOperation(0, AdjustNewLinesOption.PreserveLines);
            }

            // { * or } *
            switch (previousToken.Kind())
            {
                case SyntaxKind.CloseBraceToken:
                    if (!previousToken.IsCloseBraceOfExpression())
                    {
                        if (currentToken.Kind() != SyntaxKind.SemicolonToken &&
                            !currentToken.IsParenInParenthesizedExpression() &&
                            !currentToken.IsCommaInInitializerExpression() &&
                            !currentToken.IsCommaInAnyArgumentsList() &&
                            !currentToken.IsParenInArgumentList() &&
                            !currentToken.IsDotInMemberAccess() &&
                            !currentToken.IsCloseParenInStatement())
                        {
                            return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
                        }
                    }

                    break;

                case SyntaxKind.OpenBraceToken:
                    return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            ///////////////////////////////////////////////////
            // statement related operations
            // object and anonymous initializer "," case
            if (previousToken.IsCommaInInitializerExpression())
            {
                return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            // else * except else if case
            if (previousToken.Kind() == SyntaxKind.ElseKeyword && currentToken.Kind() != SyntaxKind.IfKeyword)
            {
                return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            // , * in enum declarations
            if (previousToken.IsCommaInEnumDeclaration())
            {
                return CreateAdjustNewLinesOperation(0, AdjustNewLinesOption.PreserveLines);
            }

            // : cases
            if (previousToken.IsColonInSwitchLabel() ||
                previousToken.IsColonInLabeledStatement())
            {
                return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            // embedded statement
            if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen())
            {
                return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.Kind() == SyntaxKind.DoStatement)
            {
                return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            // for (int i = 10; i < 10; i++) case
            if (previousToken.IsSemicolonInForStatement())
            {
                return nextOperation.Invoke();
            }

            // ; case in the switch case statement and else condition
            if (previousToken.Kind() == SyntaxKind.SemicolonToken &&
                (currentToken.Kind() == SyntaxKind.CaseKeyword || currentToken.Kind() == SyntaxKind.DefaultKeyword || currentToken.Kind() == SyntaxKind.ElseKeyword))
            {
                return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
            }

            // ; * or ; * for using directive
            if (previousToken.Kind() == SyntaxKind.SemicolonToken)
            {
                var line = (previousToken.Parent is UsingDirectiveSyntax) ? 1 : 0;
                return CreateAdjustNewLinesOperation(line, AdjustNewLinesOption.PreserveLines);
            }

            // attribute case ] *
            // force to next line for top level attributes
            if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax)
            {
                var attributeOwner = (previousToken.Parent != null) ? previousToken.Parent.Parent : null;

                if (attributeOwner is CompilationUnitSyntax ||
                    attributeOwner is MemberDeclarationSyntax ||
                    attributeOwner is AccessorDeclarationSyntax)
                {
                    return CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines);
                }

                return CreateAdjustNewLinesOperation(0, AdjustNewLinesOption.PreserveLines);
            }

            return nextOperation.Invoke();
        }

        public override AdjustSpacesOperation GetAdjustSpacesOperation(SyntaxToken previousToken, SyntaxToken currentToken, OptionSet optionSet, NextOperation<AdjustSpacesOperation> nextOperation)
        {
            //////////////////////////////////////////////////////
            // ";" related operations
            if (currentToken.Kind() == SyntaxKind.SemicolonToken)
            {
                // ; ;
                if (previousToken.Kind() == SyntaxKind.SemicolonToken)
                {
                    return CreateAdjustSpacesOperation(1, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
                }

                // ) ; with embedded statement case
                if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen())
                {
                    return CreateAdjustSpacesOperation(1, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
                }

                // * ;
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // omitted tokens case
            if (previousToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken ||
                previousToken.Kind() == SyntaxKind.OmittedTypeArgumentToken ||
                currentToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken ||
                currentToken.Kind() == SyntaxKind.OmittedTypeArgumentToken)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // some * "(" cases
            if (currentToken.Kind() == SyntaxKind.OpenParenToken)
            {
                if (previousToken.Kind() == SyntaxKind.IdentifierToken ||
                    previousToken.Kind() == SyntaxKind.DefaultKeyword ||
                    previousToken.Kind() == SyntaxKind.BaseKeyword ||
                    previousToken.Kind() == SyntaxKind.ThisKeyword ||
                    previousToken.Kind() == SyntaxKind.NewKeyword ||
                    previousToken.Parent.Kind() == SyntaxKind.OperatorDeclaration ||
                    previousToken.IsGenericGreaterThanToken() ||
                    currentToken.IsParenInArgumentList())
                {
                    return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
                }
            }

            // empty () or []
            if (previousToken.ParenOrBracketContainsNothing(currentToken))
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // attribute case
            // , [
            if (previousToken.Kind() == SyntaxKind.CommaToken && currentToken.Kind() == SyntaxKind.OpenBracketToken && currentToken.Parent is AttributeListSyntax)
            {
                return CreateAdjustSpacesOperation(1, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // ] *
            if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax)
            {
                // preserving dev10 behavior, in dev10 we didn't touch space after attribute
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.PreserveSpaces);
            }

            // * )
            // * [
            // * ]
            // * ,
            // * .
            // * ->
            switch (currentToken.Kind())
            {
                case SyntaxKind.CloseParenToken:
                case SyntaxKind.OpenBracketToken:
                case SyntaxKind.CloseBracketToken:
                case SyntaxKind.CommaToken:
                case SyntaxKind.DotToken:
                case SyntaxKind.MinusGreaterThanToken:
                    return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // case * :
            // default:
            // <label> :
            if (currentToken.IsKind(SyntaxKind.ColonToken))
            {
                if (currentToken.Parent.IsKind(SyntaxKind.CaseSwitchLabel,
                                               SyntaxKind.DefaultSwitchLabel,
                                               SyntaxKind.LabeledStatement,
                                               SyntaxKind.AttributeTargetSpecifier,
                                               SyntaxKind.NameColon))
                {
                    return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
                }
            }

            // [cast expression] * case
            if (previousToken.Parent is CastExpressionSyntax &&
                previousToken.Kind() == SyntaxKind.CloseParenToken)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // generic name
            if (previousToken.Parent.Kind() == SyntaxKind.TypeArgumentList || previousToken.Parent.Kind() == SyntaxKind.TypeParameterList)
            {
                // generic name < *
                if (previousToken.Kind() == SyntaxKind.LessThanToken)
                {
                    return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
                }

                // generic name > *
                if (previousToken.Kind() == SyntaxKind.GreaterThanToken && currentToken.Kind() == SyntaxKind.GreaterThanToken)
                {
                    return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
                }
            }

            // generic name * < or * >
            if ((currentToken.Kind() == SyntaxKind.LessThanToken || currentToken.Kind() == SyntaxKind.GreaterThanToken) &&
                (currentToken.Parent.Kind() == SyntaxKind.TypeArgumentList || currentToken.Parent.Kind() == SyntaxKind.TypeParameterList))
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // ++ * or -- *
            if ((previousToken.Kind() == SyntaxKind.PlusPlusToken || previousToken.Kind() == SyntaxKind.MinusMinusToken) &&
                 previousToken.Parent is PrefixUnaryExpressionSyntax)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // * ++ or * --
            if ((currentToken.Kind() == SyntaxKind.PlusPlusToken || currentToken.Kind() == SyntaxKind.MinusMinusToken) &&
                 currentToken.Parent is PostfixUnaryExpressionSyntax)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // For spacing between the identifer and the conditional operator
            if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.Kind() == SyntaxKind.ConditionalAccessExpression)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // ( * or ) * or [ * or ] * or . * or -> *
            switch (previousToken.Kind())
            {
                case SyntaxKind.OpenParenToken:
                case SyntaxKind.OpenBracketToken:
                case SyntaxKind.DotToken:
                case SyntaxKind.MinusGreaterThanToken:
                    return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);

                case SyntaxKind.CloseParenToken:
                case SyntaxKind.CloseBracketToken:
                    int space = (previousToken.Kind() == currentToken.Kind()) ? 0 : 1;
                    return CreateAdjustSpacesOperation(space, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // +1 or -1
            if (previousToken.IsPlusOrMinusExpression() && !currentToken.IsPlusOrMinusExpression())
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // +- or -+
            if (previousToken.IsPlusOrMinusExpression() && currentToken.IsPlusOrMinusExpression() &&
                previousToken.Kind() != currentToken.Kind())
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // ! *
            if (previousToken.Kind() == SyntaxKind.ExclamationToken)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // nullable
            if (currentToken.Kind() == SyntaxKind.QuestionToken &&
                currentToken.Parent.Kind() == SyntaxKind.NullableType)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // pointer case
            if ((currentToken.Kind() == SyntaxKind.AsteriskToken && currentToken.Parent is PointerTypeSyntax) ||
                (previousToken.Kind() == SyntaxKind.AsteriskToken && previousToken.Parent is PrefixUnaryExpressionSyntax))
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // ~ * case
            if (previousToken.Kind() == SyntaxKind.TildeToken && (previousToken.Parent is PrefixUnaryExpressionSyntax || previousToken.Parent is DestructorDeclarationSyntax))
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // & * case
            if (previousToken.Kind() == SyntaxKind.AmpersandToken &&
                previousToken.Parent is PrefixUnaryExpressionSyntax)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            // * :: or :: * case
            if (previousToken.Kind() == SyntaxKind.ColonColonToken || currentToken.Kind() == SyntaxKind.ColonColonToken)
            {
                return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
            }

            return nextOperation.Invoke();
        }
    }
}


text:
#include <aws/alexaforbusiness/model/GetRoomResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>

#include <utility>

using namespace Aws::AlexaForBusiness::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;

GetRoomResult::GetRoomResult()
{
}

GetRoomResult::GetRoomResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
  *this = result;
}

GetRoomResult& GetRoomResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
  JsonView jsonValue = result.GetPayload().View();
  if(jsonValue.ValueExists("Room"))
  {
    m_room = jsonValue.GetObject("Room");

  }

  return *this;
}


text:
cask "clipy" do
  version "1.2.1"
  sha256 "dfbb66ce3135fbaa2d64eaeea99a63e63485e322c9746045a1098b1696a1ecd5"

  url "https://github.com/Clipy/Clipy/releases/download/#{version}/Clipy_#{version}.dmg",
      verified: "github.com/Clipy/Clipy/"
  appcast "https://github.com/Clipy/Clipy/releases.atom"
  name "Clipy"
  desc "Clipboard extension app"
  homepage "https://clipy-app.com/"

  depends_on macos: ">= :yosemite"

  app "Clipy.app"

  uninstall quit: "com.clipy-app.Clipy"

  zap trash: [
    "~/Library/Application Support/Clipy",
    "~/Library/Application Support/com.clipy-app.Clipy",
    "~/Library/Caches/com.clipy-app.Clipy",
    "~/Library/Caches/com.crashlytics.data/com.clipy-app.Clipy",
    "~/Library/Caches/io.fabric.sdk.mac.data/com.clipy-app.Clipy",
    "~/Library/Cookies/com.clipy-app.Clipy.binarycookies",
    "~/Library/Preferences/com.clipy-app.Clipy.plist",
  ]
end


text:
package skyhussars.engine.terrain;

import com.fasterxml.jackson.databind.JsonMappingException;
import java.io.File;
import java.io.IOException;
import static java.util.Arrays.*;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import skyhussars.persistence.base.Marshal;
import skyhussars.persistence.terrain.TerrainDescriptor;

public class TheatreLoaderTest {
    @Rule
    public ExpectedException expected = ExpectedException.none();

    @Rule
    public TemporaryFolder folder = new TemporaryFolder();

    @Test
    public void testInstantiation(){
        expected.expect(NullPointerException.class);
        TheatreLoader theatreLoader = new TheatreLoader(null);
    }

    @Test
    public void testTheatresAreLoaded(){
        try {
            File assets = folder.newFolder("test");
            createFolderStructure(assets);
            TheatreLoader theatreLoader = new TheatreLoader(assets);
            assertEquals(asList("Adria","Himalaya"),theatreLoader.theatres());
        } catch (IOException ex) { throw new RuntimeException(ex);}
    }

    private void createFolderStructure(File assets) throws IOException{
        File theatres = new File(assets,"Theatres");
        theatres.mkdir();
        File adria = new File(theatres,"Adria");
        adria.mkdir();
        File theatre1 = new File(adria,"theatre.json");
        theatre1.createNewFile();
        File himalaya = new File(theatres,"Himalaya");
        himalaya.mkdir();
        File theatre2 = new File(himalaya,"theatre.json");
        theatre2.createNewFile();
        TerrainDescriptor t = new TerrainDescriptor("test", 1, "test");
        Marshal.marshal(t, theatre1);
        Marshal.marshal(t, theatre2);
    }

    @Test
    public void testInvalidTheatreJson(){
        expected.expect(RuntimeException.class);
        try {
            File assets = folder.newFolder("test");
            File theatres = new File(assets,"Theatres");
            theatres.mkdir();
            File adria = new File(theatres,"Adria");
            adria.mkdir();
            File theatre1 = new File(adria,"theatre.json");
            theatre1.createNewFile();
            TheatreLoader theatreLoader = new TheatreLoader(assets);
        } catch (IOException ex) { throw new RuntimeException(ex);}
    }

    @Test
    public void testTheatresFolderNotFound(){
        expected.expect(IllegalStateException.class);
        try {
            File assets = folder.newFolder("test");
            File theatres = new File(assets,"Theaters");
            theatres.mkdir();
            TheatreLoader theatreLoader = new TheatreLoader(assets);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }

    @Test
    public void testTheatresIsFile(){
        expected.expect(IllegalStateException.class);
        try {
            File assets = folder.newFolder("test");
            File theatres = new File(assets,"Theatres");
            theatres.createNewFile();
            TheatreLoader theatreLoader = new TheatreLoader(assets);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }

}


text:
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vidyano;

namespace Data.Tests
{
    [TestClass]
    public class PresentTests
    {
        private Tester tester;

        [TestInitialize]
        public void Initialize()
        {
            tester = new Tester();
        }

        [TestMethod]
        public async Task CreatePresent()
        {
            await tester.Impersonate("admin");

            var client = tester.Client;
            var query = await client.GetQueryAsync("Presents");

            var newObj = await client.ExecuteActionAsync("Query.New", query: query);
        }
    }
}


text:
#ifndef TRACE_PERFORMANCEBOUNDGENERATOR_H_INCLUDED
#define TRACE_PERFORMANCEBOUNDGENERATOR_H_INCLUDED

#include <traceGenerator.h>
#include <fstream>

namespace meta {

	/*!
		Base class for generating traces
	*/
	class PerformanceBoundGenerator: public TraceGenerator {
	public:
		//! \brief specifies how memory bandwidth is computed
		enum CoalescingProtocol {
			Protocol_sm_10,
			Protocol_sm_11,
			Protocol_sm_12,
			Protocol_sm_13,
			Protocol_sm_20,
			Protocol_ideal,
			Protocol_invalid
		};

		enum OutputFormat {
			Output_dot,			//! output: dot
			Output_append_csv,	//! output: csv
			Output_invalid
		};

		class Counter {
		public:
			Counter();

			Counter & operator += (const Counter &c) {
				memoryDemand += c.memoryDemand;
				warpInstructions += c.warpInstructions;
				branchInstructions += c.branchInstructions;
				noopInstructions += c.noopInstructions;
				instructions += c.instructions;
				flops += c.flops;
				sharedBytes += c.sharedBytes;
				bankConflicts += c.bankConflicts;

				stackDepth += c.stackDepth;
				stackVisitNodes += c.stackVisitNodes;
				stackVisitEnd += c.stackVisitEnd;
				stackVisitMiddle += c.stackVisitMiddle;
				stackInsert += c.stackInsert;
				stackMerge += c.stackMerge;
				conservativeBranches += c.conservativeBranches;

				return *this;
			}

		public:

			//! \brief bytes transferred to or from global memory [including texture samples]
			size_t memoryDemand;

			//! \brief warp instructions
			size_t warpInstructions;

			//! \brief number of branch instructions
			size_t branchInstructions;

			//! \brief number of no-op instructions
			size_t noopInstructions;

			//! \brief dynamic instructions
			size_t instructions;

			//! \brief floating-point operations [subset of dynamic instructions]
			size_t flops;

			//! \brief counts number of bytes loaded or stored to shared memory
			size_t sharedBytes;

			/*!
				\brief incremented every time a thread conflicts with the address bank of an earlier
					thread in the half-warp - efficiency of shared memory access
			*/
			size_t bankConflicts;

			size_t stackDepth;

			size_t stackVisitNodes;

			size_t stackVisitEnd;

			size_t stackVisitMiddle;

			size_t stackInsert;

			size_t stackMerge;

			size_t conservativeBranches;
		};

		//! \brief maps basic block label to operation counters
		typedef std::map< std::string, Counter > OperationCounterMap;

	public:
		PerformanceBoundGenerator();
		virtual ~PerformanceBoundGenerator();

		/*! \brief called when a traced kernel is launched to retrieve some
				parameters from the kernel
		*/
		virtual void initialize(const executive::ExecutableKernel& kernel);

		/*! \brief Called whenever an event takes place.

			Note, the const reference 'event' is only valid until event()
			returns
		*/
		virtual void event(const TraceEvent & event);

		/*! \brief Called when a kernel is finished. There will be no more
				events for this kernel.
		*/
		virtual void finish();

	protected:

		//! \brief visits each basic block and initializes a counter for each block
		void analyzeKernel(const executive::EmulatedKernel &kernel);

		//! \brief computes the number of bytes of effective demand from an event given a coalescing protocol
		static size_t computeMemoryDemand(const trace::TraceEvent &event,
			CoalescingProtocol protocol);

		//! \brief determines if instruction is a significant floating-point operation
		static int isFlop(const ir::PTXInstruction &instr);

		//! \brief tests
		static bool isGlobalMemoryOp(const ir::PTXInstruction &instr);

		//! \brief computes bytes loaded or stored to shared memory and number of conflicts
		static size_t computeSharedDemand(const trace::TraceEvent &event, int * conflicts);

	public:

		bool render;

		//! \brief specifies the active memory coalescing protocol to employ
		CoalescingProtocol protocol;

		//! \brief specifies the output format of the trace generator: [ dot, csv ]
		OutputFormat outputFormat;

		//! \brief kernel
		const executive::EmulatedKernel * kernel;

		/*! \brief Counter for creating unique file names. */
		static unsigned int _counter;

		/*!	\brief Entry for the current kernel	*/
		KernelEntry _entry;

		//! \brief maps basic blocks onto performance counters
		OperationCounterMap counterMap;

		//! maps the PC of the last instruction of each block to the block's label
		std::map< int, std::string > PCsToBlocks;
	};
}

std::ostream & operator <<(std::ostream &out, const trace::PerformanceBoundGenerator::Counter &counter);

#endif


text:
package weixin.inteface;

import weixin.event.MenuEvent;
import weixin.message.MessageResponse;

public interface MenuEventHandler {
    public void handle(MenuEvent msg, MessageResponse res);
}


text:
package org.openqa.selenium.remote.http;

public enum HttpMethod {
  DELETE,
  GET,
  POST,
}


text:
from __future__ import absolute_import
# Copyright (c) 2010-2017 openpyxl

from operator import itemgetter

from openpyxl.compat import safe_string
from openpyxl.comments.comment_sheet import CommentRecord
from openpyxl.xml.functions import Element, SubElement
from openpyxl import LXML

def get_rows_to_write(worksheet):
    """Return all rows, and any cells that they contain"""
    # order cells by row
    rows = {}
    for (row, col), cell in worksheet._cells.items():
        rows.setdefault(row, []).append((col, cell))

    # add empty rows if styling has been applied
    for row_idx in worksheet.row_dimensions:
        if row_idx not in rows:
            rows[row_idx] = []

    return sorted(rows.items())

def write_rows(xf, worksheet):
    """Write worksheet data to xml."""

    all_rows = get_rows_to_write(worksheet)
    max_column = worksheet.max_column

    with xf.element("sheetData"):
        for row_idx, row in sorted(all_rows):
            row = sorted(row, key=itemgetter(0))
            write_row(xf, worksheet, row, row_idx, max_column)

def write_row(xf, worksheet, row, row_idx, max_column):

    attrs = {'r': '%d' % row_idx, 'spans': '1:%d' % max_column}
    dims = worksheet.row_dimensions
    if row_idx in dims:
        row_dimension = dims[row_idx]
        attrs.update(dict(row_dimension))

    with xf.element("row", attrs):

        for col, cell in row:
            if (
                cell._value is None
                and not cell.has_style
                and not cell._comment
                ):
                continue
            el = write_cell(xf, worksheet, cell, cell.has_style)

def etree_write_cell(xf, worksheet, cell, styled=None):

    coordinate = cell.coordinate
    attributes = {'r': coordinate}
    if styled:
        attributes['s'] = '%d' % cell.style_id

    if cell.data_type != 'f':
        attributes['t'] = cell.data_type

    value = cell._value

    if cell._comment is not None:
        comment = CommentRecord.from_cell(cell)
        worksheet._comments.append(comment)

    el = Element("c", attributes)
    if value is None or value == "":
        xf.write(el)
        return

    if cell.data_type == 'f':
        shared_formula = worksheet.formula_attributes.get(coordinate, {})
        formula = SubElement(el, 'f', shared_formula)
        if value is not None:
            formula.text = value[1:]
            value = None

    if cell.data_type == 's':
        value = worksheet.parent.shared_strings.add(value)
    cell_content = SubElement(el, 'v')
    if value is not None:
        cell_content.text = safe_string(value)

    if cell.hyperlink:
        worksheet._hyperlinks.append(cell.hyperlink)

    xf.write(el)

def lxml_write_cell(xf, worksheet, cell, styled=False):
    coordinate = cell.coordinate
    attributes = {'r': coordinate}
    if styled:
        attributes['s'] = '%d' % cell.style_id

    if cell.data_type != 'f':
        attributes['t'] = cell.data_type

    value = cell._value

    if cell._comment is not None:
        comment = CommentRecord.from_cell(cell)
        worksheet._comments.append(comment)

    if value == '' or value is None:
        with xf.element("c", attributes):
            return

    with xf.element('c', attributes):
        if cell.data_type == 'f':
            shared_formula = worksheet.formula_attributes.get(coordinate, {})
            with xf.element('f', shared_formula):
                if value is not None:
                    xf.write(value[1:])
                    value = None

        if cell.data_type == 's':
            value = worksheet.parent.shared_strings.add(value)
        with xf.element("v"):
            if value is not None:
                xf.write(safe_string(value))

        if cell.hyperlink:
            worksheet._hyperlinks.append(cell.hyperlink)

if LXML:
    write_cell = lxml_write_cell
else:
    write_cell = etree_write_cell


text:
'use strict';

const gulp = require('gulp');
const g = require('gulp-load-plugins')();

gulp.task('build', function () {
  return gulp.src(['./src/*.ts'])
    .pipe(g.typescript())
    .pipe(g.angularFilesort())
    .pipe(g.ngAnnotate())
    .pipe(g.concatUtil('app.js'))
    .pipe(g.rename('ny-angular-material-icons.js'))
    .pipe(gulp.dest('dist'))
    .pipe(g.uglify())
    .pipe(g.rename('ny-angular-material-icons.min.js'))
    .pipe(gulp.dest('dist'));
});

module.exports = gulp;


text:
var can = require("can-util/namespace");

require("can-component");
require("can-route");
require("can-stache");
require("can-stache-bindings");
require("can-compute");
require("can-event");
require("can-view-model");

// Extra stuff
require("can-map");
require("can-list");
require("can-connect/can/model/model");
require("can-jquery");
require("can-fixture");

// Legacy namespacing for these
can.view.attr = can.view.callbacks.attr;
can.view.tag = can.view.callbacks.tag;

module.exports = can;


text:
import { get, has, merge, set, unset } from 'lodash';

// export declare const get:any,set:any,has:any,unset:any,merge:any;

export class ChainData {
    protected data={}
    public get<T extends any>(path: string, defaultValue?: any): T {
        return get(this['data'], path, defaultValue) as any;
    }

    public set(path: string, value: any): this {
        set(this['data'], path, value);
        return this;
    }

    public has(path: string): boolean {
        return has(this['data'], path);
    }

    public unset(path: string): this {
        unset(this['data'], path);
        return this;
    }

    public merge(data: any): this {
        merge(this['data'], data);
        return this;
    }
}

// ChainData.prototype['data'] = {}


text:
angular.module('kindly.requests').directive('suggestion', function() {
  return {
    restrict: 'E',
    replace: true,
    scope: {
      suggestion: '='
    },
    controller: function($scope) {
      $scope.selected = function(medium) {
        return $scope.$parent.selectionMedium === medium;
      };
    },
    templateUrl: 'requests/_suggestion.html'
  };
});


text:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed')?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php if(isset($browser_title))echo $browser_title?></title>
    <base href="<?php echo $this->config->base_url()?>">
    <link href="<?php echo APPFOLDER?>/views/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo APPFOLDER?>/views/admin/css/admin.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo APPFOLDER?>/views/admin/css/alert.css" rel="stylesheet" type="text/css" />

<?php require_once APPPATH. 'views/admin/modules/header.php'?>

        <form class="admin_form_validate" method="post">
			<?php if(USE_SESSION_TOKEN) {
				$CI =& get_instance();
				$CI->load->library('form');
				echo $CI->form->form_token('admin_login');
			}?>

Đăng nhập quản trị

                <?php if(isset($message) && $message):?>
                <?php echo $message?>
                <?php endif;?>

            Tên đăng nhập
            <input type="text" id="username" name="username" value="<?php if(isset($username))echo $username?>">

            Mật khẩu
            <input type="password" id="password" name="password">

            <button type="submit" class="btn">Đăng nhập</button>
        </form>
        <?php require_once APPPATH. 'views/admin/modules/footer.php'?>


text:
package com.totvslabs.mdm.restclient;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.ReaderInterceptor;
import javax.ws.rs.ext.ReaderInterceptorContext;

/**
 *
 * @author shivang
 */
@Provider
public class GZipReaderInterceptor implements ReaderInterceptor {

    @Override
    public Object aroundReadFrom(ReaderInterceptorContext context)
            throws IOException, WebApplicationException {
        String encoding = context.getHeaders().getFirst(HttpHeaders.ACCEPT_ENCODING);
        if (encoding != null && encoding.equalsIgnoreCase("gzip")) {
            final InputStream originalInputStream = context.getInputStream();
            context.setInputStream(new GZIPInputStream(originalInputStream));
        }
        return context.proceed();
    }
}


text:
#include "tensorflow/lite/tools/optimize/subgraph_quantizer.h"

#include <algorithm>
#include <limits>

#include "flatbuffers/flexbuffers.h"
#include "absl/memory/memory.h"
#include "tensorflow/lite/context.h"
#include "tensorflow/lite/core/api/error_reporter.h"
#include "tensorflow/lite/kernels/internal/round.h"
#include "tensorflow/lite/kernels/internal/tensor_utils.h"
#include "tensorflow/lite/kernels/internal/types.h"
#include "tensorflow/lite/model.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/tools/optimize/quantization_utils.h"

namespace tflite {
namespace optimize {
namespace internal {

namespace {
TfLiteStatus AddQuantizationParams(const std::vector<float>& scales,
                                   const std::vector<int64_t>& zero_point,
                                   int quantized_dimension,
                                   const uint8_t* buffer_data,
                                   size_t buffer_size, TensorType output_type,
                                   ModelT* model, TensorT* tensor) {
  tensor->quantization = absl::make_unique<QuantizationParametersT>();
  tensor->quantization->scale.assign(scales.begin(), scales.end());
  if (zero_point.size() != scales.size()) {
    return kTfLiteError;
  }
  tensor->quantization->zero_point.assign(zero_point.begin(), zero_point.end());
  tensor->quantization->quantized_dimension = quantized_dimension;
  model->buffers[tensor->buffer]->data.assign(buffer_data,
                                              buffer_data + buffer_size);
  // Update the tensor type.
  tensor->type = output_type;
  return kTfLiteOk;
}

bool OpHasOptionalBiasTensor(BuiltinOperator op_code) {
  return op_code == BuiltinOperator_CONV_2D ||
         op_code == BuiltinOperator_DEPTHWISE_CONV_2D;
}

struct OpWithBiasTensors {
  int activation_input_index;
  int weights_input_index;
  int bias_input_index;
  int index_for_channel_in_weights;
};

const OpWithBiasTensors* GetInfoForOpWithBiasTensor(BuiltinOperator op_code) {
  if (op_code == BuiltinOperator_CONV_2D) {
    static OpWithBiasTensors op_info = {/* activation_input_index */ 0,
                                        /* weights_input_index */ 1,
                                        /* bias_input_index */ 2,
                                        /* index_for_channel_in_weights */ 0};
    return &op_info;
  }
  if (op_code == BuiltinOperator_DEPTHWISE_CONV_2D) {
    static OpWithBiasTensors op_info = {/* bias_input_index */ 0,
                                        /* bias_input_index */ 1,
                                        /* bias_input_index */ 2,
                                        /* index_for_channel_in_weights */ 3};
    return &op_info;
  }

  return nullptr;
}

// Symmetrically Quantizes the given tensor as int8 values.
TfLiteStatus SymmetricPerChannelQuantizeTensor(ModelT* model, TensorT* tensor,
                                               int32_t channel_dim_index,
                                               ErrorReporter* error_reporter) {
  if (tensor->shape.size() != 4) {
    error_reporter->Report("Only dims=4 is supported, tensor dims: %d",
                           tensor->shape.size());
    return kTfLiteError;
  }

  // Get dimensions.
  uint64_t num_elements;
  TF_LITE_ENSURE_STATUS(utils::NumElements(*tensor, &num_elements));
  const int32_t channel_dim_size = tensor->shape[channel_dim_index];

  // Get input float data.
  BufferT* buffer = model->buffers[tensor->buffer].get();
  float* float_input_data = reinterpret_cast<float*>(buffer->data.data());

  // Create container for output scale and output data.
  std::vector<float> scales(channel_dim_size);
  std::vector<int8_t> final_buffer(num_elements);

  // Quantize the input data with respect to channel_dim_index.
  const std::vector<int> tensor_dims = {tensor->shape[0], tensor->shape[1],
                                        tensor->shape[2], tensor->shape[3]};
  utils::SymmetricPerChannelQuantization(
      float_input_data, tensor_dims, channel_dim_index, &scales, &final_buffer);

  // Set the buffers and output type.
  uint8_t* uint8_buffer = reinterpret_cast<uint8_t*>(final_buffer.data());
  const size_t buffer_size = num_elements * sizeof(int8_t);
  std::vector<int64_t> zero_point(scales.size(), 0);
  return AddQuantizationParams(scales, zero_point, channel_dim_index,
                               uint8_buffer, buffer_size, TensorType_INT8,
                               model, tensor);
}

// Symmetrically quantizes the bias for ops like Conv and DepthwiseConv.
// The scale of bias if weight_per_channel_scale[channel] * input_scale
TfLiteStatus SymmetricPerChannelBiasQuantize(const TensorT* input_tensor,
                                             const TensorT* weight_tensor,
                                             int channel_dim_index,
                                             ModelT* model, TensorT* tensor,
                                             ErrorReporter* error_reporter) {
  if (tensor->shape.size() != 1) {
    error_reporter->Report("Expected bias tensor shape to be 1.");
    return kTfLiteError;
  }

  if (tensor->type != TensorType_FLOAT32) {
    return kTfLiteOk;
  }

  // TODO(shashishekhar): Make this support scalar biases.
  if (tensor->shape[0] != weight_tensor->shape[channel_dim_index]) {
    error_reporter->Report(
        "Channel mismatch between bias and weight tensors %d vs %d",
        tensor->shape[0], weight_tensor->shape[channel_dim_index]);
    return kTfLiteError;
  }
  int32_t channel_dim_size = tensor->shape[0];
  if (!input_tensor->quantization ||
      input_tensor->quantization->scale.size() != 1) {
    error_reporter->Report("Input tensor missing quantization information");
    return kTfLiteError;
  }
  TF_LITE_ENSURE(error_reporter, weight_tensor->quantization);
  const std::vector<float>& weight_scales = weight_tensor->quantization->scale;

  if (weight_scales.size() != channel_dim_size) {
    error_reporter->Report("Mismatch weight scale dimension: %d",
                           weight_scales.size());
    return kTfLiteError;
  }

  // Compute scales.
  std::vector<float> scales(channel_dim_size);
  for (size_t i = 0; i < channel_dim_size; i++) {
    scales[i] = input_tensor->quantization->scale[0] * weight_scales[i];
  }

  BufferT* buffer = model->buffers[tensor->buffer].get();
  float* float_data = reinterpret_cast<float*>(buffer->data.data());
  uint64_t num_elements;
  TF_LITE_ENSURE_STATUS(utils::NumElements(*tensor, &num_elements));

  std::vector<int32_t> final_buffer(num_elements);
  const int32_t kScale = std::numeric_limits<int32_t>::max();

  for (int32_t channel_idx = 0; channel_idx < channel_dim_size; channel_idx++) {
    float scaling_factor = scales[channel_idx];
    float scaling_factor_inv = (scaling_factor == 0) ? 0 : 1.0 / scaling_factor;
    const int32_t quantized_value = static_cast<int32_t>(
        TfLiteRound(float_data[channel_idx] * scaling_factor_inv));
    final_buffer[channel_idx] =
        std::min(kScale, std::max(-kScale, quantized_value));
  }

  // Set the buffers and output type.
  uint8_t* uint8_buffer = reinterpret_cast<uint8_t*>(final_buffer.data());
  size_t buffer_size = num_elements * sizeof(int32_t);
  std::vector<int64_t> zero_point(scales.size(), 0);
  return AddQuantizationParams(scales, zero_point, channel_dim_index,
                               uint8_buffer, buffer_size, TensorType_INT32,
                               model, tensor);
}
}  // namespace

TfLiteStatus SubgraphQuantizer::AsymmetricQuantizeTensor(
    BuiltinOperator op_code, int32_t tensor_idx) {
  TensorT* tensor = subgraph_->tensors[tensor_idx].get();
  if (tensor->type != TensorType_FLOAT32) {
    return kTfLiteOk;
  }

  if (model_->buffers[tensor->buffer]->data.data() != nullptr) {
    return kTfLiteError;
  }
  if (!tensor->quantization || tensor->quantization->min.empty() ||
      tensor->quantization->max.empty()) {
    error_reporter_->Report(
        "Missing required min/max information for tensor_idx %d of operation: "
        "%s",
        tensor_idx, EnumNameBuiltinOperator(op_code));
    return kTfLiteError;
  }
  utils::GetAsymmetricQuantizationParams(
      tensor->quantization->min[0], tensor->quantization->max[0],
      std::numeric_limits<int8_t>::min(), std::numeric_limits<int8_t>::max(),
      tensor->quantization.get());
  tensor->type = TensorType_INT8;
  return kTfLiteOk;
}

TfLiteStatus SubgraphQuantizer::QuantizeOpWithBias(BuiltinOperator op_code,
                                                   OperatorT* op) {
  auto op_tensor_info = GetInfoForOpWithBiasTensor(op_code);
  if (!op_tensor_info) {
    error_reporter_->Report("Cannot quantize op: %s",
                            EnumNameBuiltinOperator(op_code));
    return kTfLiteError;
  }

  // Conv/Depthwise conv have 2 inputs when there is no bias, 3 otherwise.
  if (op->inputs.size() != 2 && op->inputs.size() != 3) {
    return kTfLiteError;
  }
  auto input_tensor_idx = op->inputs[op_tensor_info->activation_input_index];
  if (IsSubgraphInput(input_tensor_idx)) {
    TF_LITE_ENSURE_STATUS(AsymmetricQuantizeTensor(op_code, input_tensor_idx));
  }
  auto weights_tensor_idx = op->inputs[op_tensor_info->weights_input_index];

  TensorT* weights_tensor = subgraph_->tensors[weights_tensor_idx].get();
  int weights_channel_index = op_tensor_info->index_for_channel_in_weights;

  auto status = SymmetricPerChannelQuantizeTensor(
      model_, weights_tensor, weights_channel_index, error_reporter_);
  TF_LITE_ENSURE_STATUS(status);

  // If there is bias, quantize it.
  if (op->inputs.size() == 3) {
    auto bias_tensor_idx = op->inputs[op_tensor_info->bias_input_index];
    const TensorT* input_tensor = subgraph_->tensors[input_tensor_idx].get();
    TensorT* bias_tensor = subgraph_->tensors[bias_tensor_idx].get();
    TF_LITE_ENSURE_STATUS(SymmetricPerChannelBiasQuantize(
        input_tensor, weights_tensor, weights_channel_index, model_,
        bias_tensor, error_reporter_));
  }

  if (op->outputs.size() != 1) {
    return kTfLiteError;
  }
  auto output_tensor_idx = op->outputs[0];
  TF_LITE_ENSURE_STATUS(AsymmetricQuantizeTensor(op_code, output_tensor_idx));

  return kTfLiteOk;
}

TfLiteStatus SubgraphQuantizer::PropagateMinMaxForAvgAndMaxPool(
    BuiltinOperator op_code, OperatorT* op) {
  TF_LITE_ENSURE_EQ(this->error_reporter_, op->inputs.size(), 1);

  if (IsSubgraphInput(op->inputs[0])) {
    TF_LITE_ENSURE_STATUS(AsymmetricQuantizeTensor(op_code, op->inputs[0]));
  }

  auto output_tensor = subgraph_->tensors[op->outputs[0]].get();
  if (output_tensor->type != TensorType_FLOAT32) {
    return kTfLiteOk;
  }
  auto input_tensor = subgraph_->tensors[op->inputs[0]].get();
  if (!input_tensor->quantization) {
    error_reporter_->Report(
        "Missing required min/max information for input of operation: %s",
        EnumNameBuiltinOperator(op_code));
    return kTfLiteError;
  }
  if (input_tensor->quantization->min.size() != 1 ||
      input_tensor->quantization->max.size() != 1 ||
      input_tensor->quantization->scale.size() != 1 ||
      input_tensor->quantization->zero_point.size() != 1) {
    error_reporter_->Report(
        "Invalid quantization information for Op: %s, tensor: %s",
        EnumNameBuiltinOperator(op_code), input_tensor->name.c_str());
    return kTfLiteError;
  }
  auto quant_params = absl::make_unique<QuantizationParametersT>();
  // Nudge min, max to include the floating point zero.
  const float min = std::min(0.f, input_tensor->quantization->min[0]);
  const float max = std::max(0.f, input_tensor->quantization->max[0]);
  quant_params->min.push_back(min);
  quant_params->max.push_back(max);
  quant_params->scale.push_back(input_tensor->quantization->scale[0]);
  quant_params->zero_point.push_back(input_tensor->quantization->zero_point[0]);
  // TODO(shashishekhar): Log a warning here if overriding existing
  // min/max/scales differ from input scales.
  output_tensor->quantization = std::move(quant_params);
  output_tensor->type = TensorType_INT8;
  return kTfLiteOk;
}

TfLiteStatus SubgraphQuantizer::AsymmetricQuantizeSoftmax(
    BuiltinOperator op_code, OperatorT* op) {
  TF_LITE_ENSURE_EQ(this->error_reporter_, op->inputs.size(), 1);
  TF_LITE_ENSURE_EQ(this->error_reporter_, op->outputs.size(), 1);

  if (IsSubgraphInput(op->inputs[0])) {
    TF_LITE_ENSURE_STATUS(AsymmetricQuantizeTensor(op_code, op->inputs[0]));
  }

  auto output_tensor = subgraph_->tensors[op->outputs[0]].get();
  if (output_tensor->type != TensorType_FLOAT32) {
    return kTfLiteOk;
  }

  // Softmax output is hardcoded to have 1/256 as scale and -128 as zero point.
  output_tensor->type = TensorType_INT8;
  output_tensor->quantization->scale = {1.0f / 256.0f};
  output_tensor->quantization->zero_point = {-128};
  return kTfLiteOk;
}

TfLiteStatus SubgraphQuantizer::AsymmetricQuantizeInputsAndOutputs(
    BuiltinOperator op_code, OperatorT* op) {
  TF_LITE_ENSURE(this->error_reporter_, !op->inputs.empty());
  TF_LITE_ENSURE(this->error_reporter_, !op->outputs.empty());
  for (size_t input_idx = 0; input_idx < op->inputs.size(); ++input_idx) {
    auto input_tensor = subgraph_->tensors[op->inputs[input_idx]].get();
    if (IsSubgraphInput(op->inputs[input_idx]) &&
        input_tensor->type == TensorType_FLOAT32) {
      TF_LITE_ENSURE_STATUS(
          AsymmetricQuantizeTensor(op_code, op->inputs[input_idx]));
    }
  }

  for (size_t output_idx = 0; output_idx < op->outputs.size(); ++output_idx) {
    auto output_tensor = subgraph_->tensors[op->outputs[output_idx]].get();
    if (output_tensor->type == TensorType_FLOAT32) {
      TF_LITE_ENSURE_STATUS(
          AsymmetricQuantizeTensor(op_code, op->outputs[output_idx]));
    }
  }
  return kTfLiteOk;
}

bool SubgraphQuantizer::IsSubgraphInput(int32_t tensor_idx) const {
  return std::find(subgraph_->inputs.begin(), subgraph_->inputs.end(),
                   tensor_idx) != subgraph_->inputs.end();
}

TfLiteStatus SubgraphQuantizer::QuantizeOperator(int op_idx) {
  OperatorT* op = subgraph_->operators[op_idx].get();
  const BuiltinOperator op_code =
      model_->operator_codes[op->opcode_index]->builtin_code;
  if (OpHasOptionalBiasTensor(op_code)) {
    return QuantizeOpWithBias(op_code, op);
  }
  switch (op_code) {
    case BuiltinOperator_AVERAGE_POOL_2D:
    case BuiltinOperator_MAX_POOL_2D:
      return PropagateMinMaxForAvgAndMaxPool(op_code, op);
    case BuiltinOperator_SQUEEZE:
    case BuiltinOperator_RESHAPE:
    case BuiltinOperator_ADD:
      return AsymmetricQuantizeInputsAndOutputs(op_code, op);
    case BuiltinOperator_SOFTMAX:
      return AsymmetricQuantizeSoftmax(op_code, op);
    default:
      return kTfLiteError;
  }

  return kTfLiteError;
}

}  // namespace internal
}  // namespace optimize
}  // namespace tflite


text:
package com.xrtb.common;

import java.util.HashMap;
import java.util.Map;

import com.xrtb.tools.XORShiftRandom;

/**
 * Class that determines if a request log should be released. By default, all requests will be released. You can
 * set the percentage to globally log. You can however override the global request percentage by specfying the
 * log level in the creation of the endpoint.
 * @author Ben M. Faul
 *
 */
public enum ExchangeLogLevel {
	// The instance
	INSTANCE;

	// The exchange level logging
	Map<String, Integer> levels = new HashMap<String,Integer>();

	// Global request log strategy
	int requestLogPercentage = 100;

	// Random numbers 0 - 100
	final XORShiftRandom xorrandom = new XORShiftRandom();

	/**
	 * Returns the instance.
	 * @return Exchange logger.
	 */
	public static ExchangeLogLevel getInstance() {
		return INSTANCE;
	}

	/**
	 * Get the log level for an exchange.
	 * @param exchange String. Get the exchange level.
	 * @return Integer. The log level. 50 means 50%
	 */
	public Integer getLevel(String exchange) {
		Integer level = levels.get(exchange);
		if (level == null)
			return requestLogPercentage;
		return level;
	}

	/**
	 * Set the global logging level for requests.
	 * @param level
	 */
	public void setStdLevel(int level) {
		requestLogPercentage = level;
	}

	/**
	 * Set the log level for an exchange's requests.
	 * @param exchange String. The exchange in question.
	 * @param level int. The level to log at 100 means all, 50 means 50%, for example.
	 */
	public void setExchangeLogLevel(String exchange, int level) {
		levels.put(exchange, level);
	}

	/**
	 * Should this request be logged.
	 * @param exchange String. The exchaange in question.
	 * @return boolean. True means log it, false means don't log it.
	 */
	public boolean shouldLog(String exchange) {
		Integer level = getLevel(exchange);
		if (level == null)
			level = requestLogPercentage;

		if (level == 100)
			return true;

		int value = xorrandom.random(100);
		if (! (requestLogPercentage >= value)) {
			return false;
		}
		return true;

	}
}


text:
import { IDataPlatform } from '@datahub/metadata-types/types/entity/dataset/platform';
import { ISuggestionBuilder } from 'datahub-web/utils/parsers/autocomplete/types';
import { readDataPlatforms } from '@datahub/data-models/api/dataset/platforms';

let platforms: Array<IDataPlatform>;

/**
 * when we expect to autosuggest a platform, we call backend to get the entire list
 * then cache it and do a local search.
 * TODO: META-7667 scope cache to function instead of module
 */
export const platform = async (builder: ISuggestionBuilder, facetValue: string): Promise<ISuggestionBuilder> => {
  if (!platforms) {
    platforms = await readDataPlatforms();
  }

  return {
    ...builder,
    facetNames: [
      ...builder.facetNames,
      ...platforms
        .filter(platform => platform.name.indexOf(facetValue) >= 0)
        .map(platform => ({
          title: `platform:${platform.name}`,
          text: `${builder.textPrevious}platform:${platform.name} `
        }))
    ]
  };
};


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Jasmine Test - parseUtilsSpec.js</title>
  <link rel="stylesheet" type="text/css" href="jasmine.css">
  <script type="text/javascript" src="jasmine.js"></script>
  <script type="text/javascript" src="jasmine-html.js"></script>
  <script type="text/javascript" src="require.js"></script>
  <script src="jquery.js"></script>
</head>
<body>
<script type="text/javascript" >
    require(['./jasmine-test']);
	var jasmineEnv = jasmine.getEnv();
	jasmineEnv.updateInterval = 1000;

	var htmlReporter = new jasmine.HtmlReporter();

	jasmineEnv.addReporter(htmlReporter);
	jasmineEnv.specFilter = function(spec) {
	    return htmlReporter.specFilter(spec);
	};

	var currentWindowOnload = window.setTimeout( function(){execJasmine()},100);

	function execJasmine() {
	    jasmineEnv.execute();
	}

</script>
</body>
</html>


text:
package com.aniXification.copypaste.model;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class RecordDataSource {

	  private SQLiteDatabase database;
	  private MySQLiteHelper dbHelper;
	  private String[] allColumns = { MySQLiteHelper.COLUMN_ID,MySQLiteHelper.COLUMN_RECORD, MySQLiteHelper.COLUMN_TIMESPAMP, MySQLiteHelper.COLUMN_FAV };

	  public RecordDataSource(Context context) {
		  dbHelper = new MySQLiteHelper(context);
	  }

	  public void open() throws SQLException {
	    database = dbHelper.getWritableDatabase();
	  }

	  public void close() {
	    dbHelper.close();
	  }

	  public Record createRecord(String record, Long timeStamp, String fav) {
		    ContentValues values = new ContentValues();
		    values.put(MySQLiteHelper.COLUMN_RECORD, record);
		    values.put(MySQLiteHelper.COLUMN_TIMESPAMP, timeStamp);
		    values.put(MySQLiteHelper.COLUMN_FAV, fav);
		    long insertId = database.insert(MySQLiteHelper.TABLE_COPYPASTE, null,values);
		    Cursor cursor = database.query(MySQLiteHelper.TABLE_COPYPASTE, allColumns, MySQLiteHelper.COLUMN_ID + " = " + insertId, null,null, null, null);
		    cursor.moveToFirst();
		    Record newRecord = cursorToRecord(cursor);
		    cursor.close();
		    return newRecord;
		  }

	  public void deletRecord(Record record) {

		  System.out.println("Id to delete:: " + record.getId());

		  long id = record.getId();

		  System.out.println("the deleteRecord called in databast class!!!");
		  System.out.println("Record deleted with id: " + id);
		  database.delete(MySQLiteHelper.TABLE_COPYPASTE, MySQLiteHelper.COLUMN_ID + " = " + id, null);
	  }

	  public List<Record> getAllRecord(){
		  List<Record> records = new ArrayList<Record>();

		  Cursor cursor = database.query(MySQLiteHelper.TABLE_COPYPASTE, allColumns, null, null, null, null, MySQLiteHelper.COLUMN_TIMESPAMP + " DESC");

		  cursor.moveToFirst();
		  while(!cursor.isAfterLast()) {
			  Record record = cursorToRecord(cursor);
			  records.add(record);
			  cursor.moveToNext();
		  }

		  //closing the cursor
		  cursor.close();
		  return records;
	  }

	  private Record cursorToRecord(Cursor cursor) {
		  Record record = new Record();
		  record.setId(cursor.getLong(0));
		  record.setRecord(cursor.getString(1));
		  record.setTimestamp(cursor.getLong(2));
		  record.setFav(cursor.getString(3));

		  return record;
	  }

}


text:
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace BepuPhysics.Collidables
{
    /// <summary>
    /// Represents an index with an associated type packed into a single integer.
    /// </summary>
    public struct TypedIndex : IEquatable<TypedIndex>
    {
        /// <summary>
        /// Bit packed representation of the typed index.
        /// </summary>
        public uint Packed;

        /// <summary>
        /// Gets the type index of the object.
        /// </summary>
        public int Type
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get { return (int)(Packed & 0x7F000000) >> 24; }
        }

        /// <summary>
        /// Gets the index of the object.
        /// </summary>
        public int Index
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get { return (int)(Packed & 0x00FFFFFF); }
        }

        /// <summary>
        /// Gets whether this index actually refers to anything. The Type and Index should only be used if this is true.
        /// </summary>
        public bool Exists
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get { return (Packed & (1 << 31)) > 0; }
        }

        public TypedIndex(int type, int index)
        {
            Debug.Assert(type >= 0 && type < 128, "Do you really have that many type indices, or is the index corrupt?");
            Debug.Assert(index >= 0 && index < (1 << 24), "Do you really have that many instances, or is the index corrupt?");
            //Note the inclusion of a set bit in the most significant slot.
            //This encodes that the index was explicitly constructed, so it is a 'real' reference.
            //A default constructed TypeIndex will have a 0 in the MSB, so we can use the default constructor for empty references.
            Packed = (uint)((type << 24) | index | (1u << 31));
        }

        public override string ToString()
        {
            return $"<{Type}, {Index}>";
        }

        public bool Equals(TypedIndex other) => Packed == other.Packed;

        public override bool Equals(object other) => other is TypedIndex otherTypedIndex && Equals(otherTypedIndex);

        public static bool operator ==(TypedIndex x, TypedIndex y) => x.Packed == y.Packed;

        public static bool operator !=(TypedIndex x, TypedIndex y) => x.Packed != y.Packed;

        public override int GetHashCode() => (int)Packed;
    }
}


text:
class SampleController < ApplicationController
  def sample_action
    render :text => 'hoge'
  end
end


text:
/*-------------------------------------------------------------------------*/
/**
   @file    Splash_window.h
   @author  P. Batty
   @brief   The window structs

   This module implements the creation and manipulations of the
   window structure in the framework.

*/
/*--------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
                                Includes
 ---------------------------------------------------------------------------*/

#include "Splash/Splash_window.h"
#include "SDL2/SDL.h"
#include <stdint.h>
#include <stdlib.h>

/*---------------------------------------------------------------------------
                            Private functions
 ---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------
                            Function codes
 ---------------------------------------------------------------------------*/

/*!--------------------------------------------------------------------------
  @brief    Creates a new Splash_window
  @param  title   The window title
  @param  width   The width of the window
  @param  hight   The height of the window
  @return   New Splash_window otherwise NULL.

  Creates a new Splash_window object destroy with splash_window_destroy();
  return a new object else null if unsuccessful

\-----------------------------------------------------------------------------*/
Splash_window *splash_window_create(const char *title, int32_t width, int32_t height) {
	Splash_window *window = malloc(sizeof(Splash_window));

	if (!window) {
		return NULL;
	}

	window->window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL);

	if (!window->window) {
		free(window);
		return NULL;
	}

	splash_window_set_title(window, title);
	splash_window_set_size(window, width, height);
  splash_window_set_resolution(window, width, height);
  window->context = SDL_GL_CreateContext(window->window);

	return window;
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window title
  @param  window   The window to modify
  @param  title    The new title
  @return  Void

  Changes the title on the window to the one passed in.

\-----------------------------------------------------------------------------*/
 void splash_window_set_title(Splash_window *window, const char *title) {
 	SDL_SetWindowTitle(window->window, title);
 	window->title = title;
 }

 /*!--------------------------------------------------------------------------
  @brief    Sets the window brightness
  @param  window      The window to modify
  @param  brightness  The new brightness
  @return  Void

  Changes the brightness on the window to the one passed in.

\-----------------------------------------------------------------------------*/
void splash_window_set_brightness(Splash_window *window, float brightness) {
	if (brightness >= 0.0 && brightness <= 1.0) {
		SDL_SetWindowBrightness(window->window, brightness);
		window->brightness = brightness;
	}
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window positon
  @param  window       The window to modify
  @param  x_position   The x cooridnate to move the window to
  @param  y_position   The y cooridnate to move the window to
  @return  Void

  Move the window to the coordinates passed in.

\-----------------------------------------------------------------------------*/
void splash_window_set_position(Splash_window *window, int32_t x_position, int32_t y_position) {
	window->position.x = abs(x_position);
	window->position.y = abs(y_position);
	SDL_SetWindowPosition(window->window, window->position.x, window->position.y);
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window size
  @param  window  The window to modify
  @param  width   The width of the window
  @param  hight   The height of the window
  @return  Void

  Changes the windows size to the size passed in.

\-----------------------------------------------------------------------------*/
void splash_window_set_size(Splash_window *window, int32_t width, int32_t height) {
	window->size.x = abs(width);
	window->size.y = abs(height);
	SDL_SetWindowSize(window->window, window->size.x, window->size.y);
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window size
  @param  window  The window to modify
  @param  width   The width of the resolution
  @param  hight   The height of the resolution
  @return  Void

  Changes the windows resolution to the size passed in.

\-----------------------------------------------------------------------------*/
void splash_window_set_resolution(Splash_window *window, int32_t width, int32_t height) {
  window->resolution.x = width;
  window->resolution.y = height;
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window fullscreen
  @param  window      The window to modify
  @param  fullscreen  Should we go fullscreen
  @return  Void

  if true is passed in and possible the window will be made fullscreen
  if false is passed in the window will be made windowed

\-----------------------------------------------------------------------------*/
void splash_window_set_fullscreen(Splash_window *window, int8_t fullscreen) {
	window->fullscreen = (fullscreen) ? 1 : 0;
	if (window->fullscreen) {
		if (SDL_SetWindowFullscreen(window->window, SDL_WINDOW_FULLSCREEN) == 0) {
			window->fullscreen = 1;
		} else {
			window->fullscreen = 0;
		}
	} else {
		if (SDL_SetWindowFullscreen(window->window, 0) == 0) {
			window->fullscreen = 0;
		} else {
			window->fullscreen = 1;
		}
	}
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window borders
  @param  window      The window to modify
  @param  borderless  Should we have borderless
  @return  Void

  if true is passed in and possible the window will be made borderless
  if false is passed in the window will be made bordered

\-----------------------------------------------------------------------------*/
void splash_window_set_borderless(Splash_window *window, int8_t borderless) {
	window->borderless = (borderless) ? 1 : 0;
	SDL_SetWindowBordered(window->window, window->borderless);
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window visiblity
  @param  window    The window to modify
  @param  visible   Should we be visible
  @return  Void

  if true is passed in and possible the window will be made visible
  if false is passed in the window will be made hidden

\-----------------------------------------------------------------------------*/
void splash_window_set_visible(Splash_window *window, int8_t visible) {
	window->visible = (visible) ? 1 : 0;
	if (window->visible) {
		SDL_ShowWindow(window->window);
	} else {
		SDL_HideWindow(window->window);
	}
}

/*!--------------------------------------------------------------------------
  @brief    Sets the window resizable
  @param  window      The window to modify
  @param  resizable   Should we be resizable
  @return  Void

  if true is passed in and possible the window will be made resizable
  if false is passed in the window will be made fixed size

\-----------------------------------------------------------------------------*/
void splash_window_set_resizable(Splash_window *window, int8_t resizable) {
	window->resizable = (resizable) ? 1 : 0;
	SDL_DestroyWindow(window->window);
	if (window->resizable) {
		window->window = SDL_CreateWindow(window->title, window->position.x, window->position.y, window->size.x, window->size.y, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
	} else {
		window->window = SDL_CreateWindow(window->title, window->position.x, window->position.y, window->size.x, window->size.y, SDL_WINDOW_OPENGL);
	}

	splash_window_set_visible(window, window->visible);
	splash_window_set_borderless(window, window->borderless);
	splash_window_set_fullscreen(window, window->fullscreen);
	splash_window_set_brightness(window, window->brightness);
}

/*!--------------------------------------------------------------------------
  @brief    Gets the window title
  @param  window      The window to get
  @return  The window title

  Gets the current window title

\-----------------------------------------------------------------------------*/
char *splash_window_get_title(Splash_window *window) {
	return window->title;
}

/*!--------------------------------------------------------------------------
  @brief    Gets the window brightness
  @param  window      The window to get
  @return  The window brightness

  Gets the current window brightness

\-----------------------------------------------------------------------------*/
float splash_window_get_brightness(Splash_window *window) {
	return window->brightness;
}

/*!--------------------------------------------------------------------------
  @brief    Gets the window position
  @param  window      The window to get
  @return  The window positon inside a point

  Gets the current window position

\-----------------------------------------------------------------------------*/
SDL_Point splash_window_get_position(Splash_window *window) {
	return window->position;
}

/*!--------------------------------------------------------------------------
  @brief    Gets the window size
  @param  window      The window to get
  @return  The window size inside a point

  Gets the current window size

\-----------------------------------------------------------------------------*/
SDL_Point splash_window_get_size(Splash_window *window) {
	return window->size;
}

/*!--------------------------------------------------------------------------
  @brief    Gets the window size
  @param  window      The window to get
  @return  The window resolution inside a point

  Gets the current window resolution

\-----------------------------------------------------------------------------*/
SDL_Point splash_window_get_resolution(Splash_window *window) {
  return window->resolution;
}

/*!--------------------------------------------------------------------------
  @brief    Is the window fullscreen
  @param  window      The window to get
  @return  1 if fullscreen else 0

  Gets the whether the window is currenly fullscreen

\-----------------------------------------------------------------------------*/
int8_t splash_window_get_fullscreen(Splash_window *window) {
	return window->fullscreen;
}

/*!--------------------------------------------------------------------------
  @brief    Is the window borderless
  @param  window      The window to get
  @return  1 if borderless else 0

  Gets the whether the window is currenly borderless

\-----------------------------------------------------------------------------*/
int8_t splash_window_get_borderless(Splash_window *window) {
	return window->borderless;
}

/*!--------------------------------------------------------------------------
  @brief    Is the window visible
  @param  window      The window to get
  @return  1 if visible else 0

  Gets the whether the window is currenly visible

\-----------------------------------------------------------------------------*/
int8_t splash_window_get_visible(Splash_window *window) {
	return window->visible;
}

/*!--------------------------------------------------------------------------
  @brief    Is the window resizable
  @param  window      The window to get
  @return  1 if resizable else 0

  Gets the whether the window is currenly resizable

\-----------------------------------------------------------------------------*/
int8_t splash_window_get_resizable(Splash_window *window) {
	return window->resizable;
}

/*!--------------------------------------------------------------------------
  @brief    Destroy's the window
  @param  window      The window to destroy
  @return  Void

  Destroy's the window

\-----------------------------------------------------------------------------*/
void splash_window_destroy(Splash_window *window) {
	SDL_DestroyWindow(window->window);
	free(window);
}


text:
using System.Collections.ObjectModel;
using GraphQL.Validation;

namespace GraphQL
{
    /// <summary>
    /// Represents a readonly dictionary of variable inputs to a document. Typically this
    /// contains the deserialized 'variables' property from the GraphQL request. During document execution,
    /// these inputs will be validated and coerced into a <see cref="Variables"/> dictionary.
    /// </summary>
    public class Inputs : ReadOnlyDictionary<string, object?>
    {
        /// <summary>
        /// Returns an empty set of inputs.
        /// </summary>
        public static readonly Inputs Empty = new(new Dictionary<string, object?>());

        /// <summary>
        /// Initializes a new instance that is a wrapper for the specified dictionary of elements.
        /// </summary>
        public Inputs(IDictionary<string, object?> dictionary)
            : base(dictionary)
        {
        }
    }
}


text:
function observer() {
    let cache = [];
    const ret = function(cb) {
        if (typeof cb !== 'function') {
            return;
        }

        cache.push(cb);
    };

    ret.fire = function(...args) {
        let ni;

        for (ni = 0; ni < cache.length; ni++) {
            cache[ni].apply(this, args);
        }
    };

    ret.remove = function(cb) {
        let ni;

        for (ni = 0; ni < cache.length; ni++) {
            if (cache[ni] === cb) {
                cache.splice(ni, 1);
                break;
            }
        }
    };

    ret.clear = function() {
        cache = [];
    };

    return ret;
}

class ImageHandler {
    change = null;
    canvas = null;
    scaledOriginal = null;

    minWidth = 0;
    minHeight = 0;

    _zoom = 0;
    _translate = {
        x: 0,
        y: 0,
        r: 0
    };
    _offset = {
        x: 0,
        y: 0,
        r: 0
    };

    constructor() {
        this.change = observer();

        this.canvas = document.createElement('canvas');
        this.scaledOriginal = document.createElement('canvas');
    }

    minSize(w, h) {
        this.minWidth = w;
        this.minHeight = h;

        this.hardZoom();
    }

    draw() {
        const ctx = this.canvas.getContext('2d'),
            t = this.hardTranslate();

        this.canvas.width = this.minWidth;
        this.canvas.height = this.minHeight;

        ctx.save();
        ctx.translate(
            (this.canvas.width - (this.img.width * this._zoom)) / 2 + t.x,
            (this.canvas.height - (this.img.height * this._zoom)) / 2 + t.y
        );
        ctx.scale(this._zoom, this._zoom);

        ctx.drawImage(this.img, 0, 0);
        ctx.restore();

        this.change.fire();
    }

    drawScaledOriginal() {
        let ctx;

        this.scaledOriginal.width = this.img.width * this._zoom;
        this.scaledOriginal.height = this.img.height * this._zoom;
        ctx = this.scaledOriginal.getContext('2d');
        ctx.save();
        ctx.scale(this._zoom, this._zoom);
        ctx.drawImage(this.img, 0, 0);
        ctx.restore();
    }

    setFile(file) {
        const reader = new FileReader(),
            img = document.createElement('img');

        img.onload = function() {
            this._translate.x = this._translate.y = 0;
            this._offset.x = this._offset.y = 0;
            this._zoom = 0;

            // this is needed to keep jpegs from flashing
            // on drag
            this.img = document.createElement('canvas');
            this.img.width = img.width;
            this.img.height = img.height;
            this.img.getContext('2d')
                .drawImage(img, 0, 0);

            this.hardZoom();

            this.draw();
            this.drawScaledOriginal();
        }.bind(this);

        reader.onload = function(evt) {
            img.src = evt.target.result;
        }.bind(this);

        reader.readAsDataURL(file);
    }

    hardTranslate() {
        const halfImgHeight = (this.img.height * this._zoom) / 2,
            halfCanvasHeight = this.minHeight / 2,
            halfImgWidth = (this.img.width * this._zoom) / 2,
            halfCanvasWidth = this.minWidth / 2;
        let x = this._translate.x + this._offset.x,
            y = this._translate.y + this._offset.y;

        if (halfImgHeight - halfCanvasHeight < y) {
            y = halfImgHeight - halfCanvasHeight;
        }

        if (halfCanvasHeight - halfImgHeight > y) {
            y = halfCanvasHeight - halfImgHeight;
        }

        if (halfImgWidth - halfCanvasWidth < x) {
            x = halfImgWidth - halfCanvasWidth;
        }

        if (halfCanvasWidth - halfImgWidth > x) {
            x = halfCanvasWidth - halfImgWidth;
        }

        return { x: x, y: y };
    }

    hardZoom() {
        let zoom;

        if (!this.img) {
            return;
        }

        if (!this.minWidth || !this.minHeight) {
            return;
        }

        if (
            this.img.width / this.img.height >
            this.minWidth / this.minHeight
        ) {
            zoom = this.minHeight / this.img.height;
        } else {
            zoom = this.minWidth / this.img.width;
        }

        if (this._zoom < zoom) {
            this._zoom = zoom;
        }
    }

    translate(point) {
        if (!this.img) {
            return;
        }

        if (!this.minWidth || !this.minHeight) {
            return;
        }

        if (point.hasOwnProperty('x')) {
            this._translate.x = point.x;
        }

        if (point.hasOwnProperty('y')) {
            this._translate.y = point.y;
        }

        if (point.hasOwnProperty('r')) {
            this._translate.r = point.r;
        }

        this.draw();
    }

    commitTranslation() {
        if (!this.img) {
            return;
        }

        if (!this.minWidth || !this.minHeight) {
            return;
        }

        this._offset.x += this._translate.x;
        this._offset.y += this._translate.y;
        this._offset.r += this._translate.r;

        this._translate.x = 0;
        this._translate.y = 0;
        this._translate.r = 0;

        this._offset = this.hardTranslate();

        this.draw();
    }

    zoom(by) {
        this._zoom += by;
        this.hardZoom();
        this.draw();
        this.drawScaledOriginal();
    }

    out(_zoom = 1) {
        const t = this.hardTranslate(),
            canvas = document.createElement('canvas'),
            zoom = this._zoom * _zoom;
        let ctx;

        canvas.width = this.minWidth * _zoom;
        canvas.height = this.minHeight * _zoom;

        ctx = canvas.getContext('2d');
        ctx.save();
        ctx.translate(
            (canvas.width - (this.img.width * zoom)) / 2 + t.x * _zoom,
            (canvas.height - (this.img.height * zoom)) / 2 + t.y * _zoom
        );
        ctx.scale(zoom, zoom);
        ctx.drawImage(this.img, 0, 0);
        ctx.restore();

        return canvas;
    }
}

export default ImageHandler;


text:
set -o errexit
set -o nounset
set -o pipefail

TESTINFRA_ROOT=$(git rev-parse --show-toplevel)

GENERATED_SECURITY_CONFIG="${TESTINFRA_ROOT}/config/jobs/kubernetes-security/generated-security-jobs.yaml"

rm "${GENERATED_SECURITY_CONFIG}"

bazel run //config/jobs/kubernetes-security:genjobs -- \
"--config=${TESTINFRA_ROOT}/prow/config.yaml" \
"--jobs=${TESTINFRA_ROOT}/config/jobs" \
"--output=${GENERATED_SECURITY_CONFIG}"


text:
window.addEventListener ('load', function () {
 var entry_text_list = [
  ['cheese'    , 'yellow'],
  ['orange'    , 'orange'],
  ['monkey'    , 'brown'],
  ['shoe store', 'white'],
  ['bread'     , 'orange'],
  ['banana'    , 'yellow']
 ]
 var header_text = ["name", "color"]

 var mytable = make_table ({
  entry_text_list : entry_text_list,
  header_text     : header_text,
  parent          : document.body,
  prefix          : "mytable--"
 })
})

function make_table (init) {
 var entry_text_list   = init.entry_text_list
 var header_text       = init.header_text
 var parent            = init.parent
 var prefix            = init.prefix
 var precision_limit   = init.precision_limit || 1
 var check_if_attached = (typeof init.check_if_attached != "undefined") ? false : true
 var fancysorter = {}

 var table = document.createElement ('div')
 table.className = "mytable-table"
 parent.appendChild (table)

 var dom_header = document.createElement ('div')
 dom_header.className = 'mytable--header'
 table.appendChild (dom_header)

 var header_object_array = fancysorter.header_object_array = []
 header_text.forEach (function (data, i) {
  var dom_subentry = document.createElement ('div')
  dom_subentry.className = prefix + "header-subentry " + prefix + "header-subentry-" + (i + 1)
  header_object_array.push (dom_subentry)
  dom_subentry.innerHTML = header_text[i]
  dom_header.appendChild (dom_subentry)
 })

 var entry_wrapper = document.createElement ('div')
 entry_wrapper.className = 'mytable--entry_wrapper'
 table.appendChild (entry_wrapper)

 var entry_object_array = fancysorter.entry_object_array = []
 Array.prototype.slice.call(entry_text_list).forEach (function (data, i) {
  var dom_entry = document.createElement ('div')
  dom_entry.className = prefix + "entry"
  entry_object_array.push (dom_entry)
  entry_wrapper.appendChild (dom_entry)
  data.forEach (function (subdata, i) {
   var dom_subentry = document.createElement ('div')
   dom_subentry.className = prefix + "entry-subentry " + prefix + "entry-subentry-" + (i + 1)
   dom_subentry.innerHTML = subdata
   dom_entry.appendChild (dom_subentry)
  })
 })

 var line_height = init.line_height || entry_object_array[0].offsetHeight

 entry_wrapper.style.height = (line_height * entry_text_list.length) + "px"
 entry_wrapper.style.display = "block"
 entry_wrapper.style.pointerEvents = "none"
 table.appendChild (entry_wrapper)

 header_object_array.forEach (function (subentry, i) {
  subentry.addEventListener ('click', function () {
   fancysorter.sortby (i)
  })
 })

 // Set initial top values.
 entry_object_array.forEach (function (entry, i) {
  entry.style.top = (i * line_height) + "px"
 })

 fancysorter.sortby = function (index) {
  if (fancysorter.running) clearInterval (fancysorter.interval_id)
  fancysorter.running = true

  var entry_list_ref = []
  entry_text_list.forEach (function (entry, i) {
   var entry_ref = {}
   entry_list_ref.push(entry_ref)
   entry_ref.data           = entry[index]
   entry_ref.original_index = i
  })

  // We need to find the new order here by looking at entry_list.
  entry_list_ref.sort (function (a, b) {
   if (a.data > b.data) return 1
   if (b.data > a.data) return -1
   return 0
  })

  var active_rows = {}
  entry_list_ref.forEach (function (entry_ref, i) {
   var index = entry_ref.original_index
   var item = entry_object_array[index]
   active_rows[index] = {
    dom_object       : entry_object_array[index],
    current_position : parseFloat(window.getComputedStyle(item).top),
    target_position  : i * line_height
   }
  })

  begin_mechanic ()

  function begin_mechanic () {
   fancysorter.interval_id = setInterval (mechanic, 15)

   function mechanic () {
    var finished = true
    for (var item_index in active_rows) {
     finished = false
     var item = active_rows[item_index]

     if ((check_if_attached) && (!isAttached (item.dom_object))) {delete (lm[item_index]); return}

     // Set the offset.
     item.dom_object.style.top = item.current_position + 'px'

     // Offset too big.
     if (item.current_position - item.target_position > precision_limit) {
      item.current_position -= (item.current_position - item.target_position) / line_height
      continue
     }

     // Offset too small.
     if (item.target_position - item.current_position > precision_limit) {
      item.current_position += (item.target_position - item.current_position) / line_height
      continue
     }

     // Offset is perfect or nearly so.
     item.current_position = item.target_position
     delete (active_rows[item_index])
    }

    if (finished) {clearInterval (fancysorter.interval_id); fancysorter.running = false}
   }
  }
 }

 function isAttached (obj) {
  while (true) {
   obj = obj.parentNode
   if (obj == document.documentElement) return true
   if (obj == null) return false
  }
 }

 function getClientHeightFull (obj, init) {
  var style = window.getComputedStyle(obj)
  var box_sizing = (style.boxSizing != "") ? style.boxSizing : style.mozBoxSizing
  if (box_sizing != "border-box") {
   var padding_and_margin = 0
  } else {
   var padding_and_margin = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)
  }
  if ((typeof init != "undefined") && (typeof init.margin != "undefined") && (init.margin == true)) {
   padding_and_margin += parseFloat(style.marginTop) + parseFloat(style.marginBottom)
  }
  return obj.clientHeight + padding_and_margin + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth)
 }
}


text:
from gitfs.worker.peasant import Peasant
from gitfs.events import fetch, fetch_successful, shutting_down, idle, remote_operation
from gitfs.log import log

class FetchWorker(Peasant):
    name = "FetchWorker"

    def work(self):
        while True:
            timeout = self.timeout
            if idle.is_set():
                timeout = self.idle_timeout

            log.debug("Wait for {}".format(timeout))
            fetch.wait(timeout)

            if shutting_down.is_set():
                log.info("Stop fetch worker")
                break

            self.fetch()

    def fetch(self):
        log.debug("Lock fetching operation")
        with remote_operation:
            fetch.clear()

            try:
                log.debug("Start fetching")
                was_behind = self.repository.fetch(
                    self.upstream, self.branch, self.credentials
                )
                fetch_successful.set()
                if was_behind:
                    log.info("Fetch done")
                else:
                    log.debug("Nothing to fetch")
            except:
                fetch_successful.clear()
                log.exception("Fetch failed")


text:
body{background-color:#f9f9f9;color:#181818}
header nav{background-color:#f9f9f9}
header #overview-section{background-color:#6ea448;color:#f9f9f9}


text:
namespace TestCases.HSSF.Record
{

    using System;
    using NPOI.HSSF.Record;
    using NUnit.Framework;

    /**
     * Tests the serialization and deserialization of the SupBook record
     * class works correctly.
     *
     * @author Andrew C. Oliver (acoliver at apache dot org)
     */
    [TestFixture]
    public class TestSupBookRecord
    {
        /**
         * This contains a fake data section of a SubBookRecord
         */
        byte[] dataIR = new byte[] {
        (byte)0x04,(byte)0x00,(byte)0x01,(byte)0x04,
    };
        byte[] dataAIF = new byte[] {
        (byte)0x01,(byte)0x00,(byte)0x01,(byte)0x3A,
    };
        byte[] dataER = new byte[] {
        (byte)0x02,(byte)0x00,
        (byte)0x07,(byte)0x00,   (byte)0x00,
                (byte)'t', (byte)'e', (byte)'s', (byte)'t', (byte)'U', (byte)'R', (byte)'L',
        (byte)0x06,(byte)0x00,   (byte)0x00,
                (byte)'S', (byte)'h', (byte)'e', (byte)'e', (byte)'t', (byte)'1',
        (byte)0x06,(byte)0x00,   (byte)0x00,
                (byte)'S', (byte)'h', (byte)'e', (byte)'e', (byte)'t', (byte)'2',
   };

        public TestSupBookRecord()
        {

        }

        /**
         * tests that we can load the record
         */
        [Test]
        public void TestLoadIR()
        {

            SupBookRecord record = new SupBookRecord(TestcaseRecordInputStream.Create(0x01AE, dataIR));
            Assert.IsTrue(record.IsInternalReferences);             //expected flag
            Assert.AreEqual(0x4, record.NumberOfSheets);    //expected # of sheets

            Assert.AreEqual(8, record.RecordSize);  //sid+size+data
        }
        /**
         * tests that we can load the record
         */
        [Test]
        public void TestLoadER()
        {

            SupBookRecord record = new SupBookRecord(TestcaseRecordInputStream.Create(0x01AE, dataER));
            Assert.IsTrue(record.IsExternalReferences);             //expected flag
            Assert.AreEqual(0x2, record.NumberOfSheets);    //expected # of sheets

            Assert.AreEqual(34, record.RecordSize);  //sid+size+data

            Assert.AreEqual("testURL", record.URL);
            String[] sheetNames = record.SheetNames;
            Assert.AreEqual(2, sheetNames.Length);
            Assert.AreEqual("Sheet1", sheetNames[0]);
            Assert.AreEqual("Sheet2", sheetNames[1]);
        }

        /**
         * tests that we can load the record
         */
        [Test]
        public void TestLoadAIF()
        {

            SupBookRecord record = new SupBookRecord(TestcaseRecordInputStream.Create(0x01AE, dataAIF));
            Assert.IsTrue(record.IsAddInFunctions);             //expected flag
            Assert.AreEqual(0x1, record.NumberOfSheets);    //expected # of sheets
            Assert.AreEqual(8, record.RecordSize);  //sid+size+data
        }

        /**
         * Tests that we can store the record
         *
         */
        [Test]
        public void TestStoreIR()
        {
            SupBookRecord record = SupBookRecord.CreateInternalReferences((short)4);

            TestcaseRecordInputStream.ConfirmRecordEncoding(0x01AE, dataIR, record.Serialize());
        }
        [Test]
        public void TestStoreER()
        {
            String url = "testURL";
            String[] sheetNames = { "Sheet1", "Sheet2", };
            SupBookRecord record = SupBookRecord.CreateExternalReferences(url, sheetNames);

            TestcaseRecordInputStream.ConfirmRecordEncoding(0x01AE, dataER, record.Serialize());
        }
        [Test]
        public void TestExternalReferenceUrl()
        {
            String[] sheetNames = new String[] { "SampleSheet" };
            char startMarker = (char)1;

            SupBookRecord record;

            record = new SupBookRecord(startMarker + "test.xls", sheetNames);
            Assert.AreEqual("test.xls", record.URL);

            //UNC path notation
            record = new SupBookRecord(startMarker + "" + SupBookRecord.CH_VOLUME + "@servername" + SupBookRecord.CH_DOWN_DIR + "test.xls", sheetNames);
            Assert.AreEqual("\\\\servername" + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);

            //Absolute path notation - different device
            record = new SupBookRecord(startMarker + "" + SupBookRecord.CH_VOLUME + "D" + SupBookRecord.CH_DOWN_DIR + "test.xls", sheetNames);
            Assert.AreEqual("D:" + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);

            //Absolute path notation - same device
            record = new SupBookRecord(startMarker + "" + SupBookRecord.CH_SAME_VOLUME + "folder" + SupBookRecord.CH_DOWN_DIR + "test.xls", sheetNames);
            Assert.AreEqual(SupBookRecord.PATH_SEPERATOR + "folder" + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);

            //Relative path notation - down
            record = new SupBookRecord(startMarker + "folder" + SupBookRecord.CH_DOWN_DIR + "test.xls", sheetNames);
            Assert.AreEqual("folder" + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);

            //Relative path notation - up
            record = new SupBookRecord(startMarker + "" + SupBookRecord.CH_UP_DIR + "test.xls", sheetNames);
            Assert.AreEqual(".." + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);

            //Relative path notation - for EXCEL.exe - fallback
            record = new SupBookRecord(startMarker + "" + SupBookRecord.CH_STARTUP_DIR + "test.xls", sheetNames);
            Assert.AreEqual("." + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);

            //Relative path notation - for EXCEL lib folder - fallback
            record = new SupBookRecord(startMarker + "" + SupBookRecord.CH_LIB_DIR + "test.xls", sheetNames);
            Assert.AreEqual("." + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);

            //Relative path notation - for alternative EXCEL.exe - fallback
            record = new SupBookRecord(startMarker + "" + SupBookRecord.CH_ALT_STARTUP_DIR + "test.xls", sheetNames);
            Assert.AreEqual("." + SupBookRecord.PATH_SEPERATOR + "test.xls", record.URL);
        }
    }
}


text:
/**
 * PlayerActor object extends the Phaser.Sprite object and represents the player's character
 */
Phaser.Plugin.PNCAdventure.PlayerActor = function (game, actorDefinition) {
	Phaser.Plugin.PNCAdventure.Actor.call(this, game, actorDefinition);
	console.debug('PlayerActor initialised');
	this.initSignalListeners();
};

Phaser.Plugin.PNCAdventure.PlayerActor.prototype = Object.create(Phaser.Plugin.PNCAdventure.Actor.prototype);
Phaser.Plugin.PNCAdventure.PlayerActor.prototype.constructor = Phaser.Plugin.PNCAdventure.PlayerActor;

Phaser.Plugin.PNCAdventure.PlayerActor.prototype.initSignalListeners = function () {
	 this.game.pncPlugin.signals.sceneTappedSignal.add(function (pointer, navmesh) {
	 	console.debug('Movement signal received');
	 	if (!navmesh) { return; }

	 	if (this.walkTween && this.walkTween.isRunning) {
	 		this.walkTween.stop();
	 	}

	 	this.walkTween = this.game.add.tween(this);

	 	var path = navmesh.findPath();
	 	console.log(path);

	 	var pointer;
	 	for (var i = 0; i < path.length; i++) {
	 		pointer = path[i];
	 		var distance = Phaser.Math.distance(path[i-1] != undefined ? path[i-1].x : this.x, path[i-1] != undefined ? path[i-1].y : this.y, pointer.x, pointer.y);
	 		this.walkTween.to({x: pointer.x, y: pointer.y}, distance * 4);
	 	}

	 	this.walkTween.start();

	 }, this);
};