text:
void _assert_true(const LargestIntegralType result,
                  const char* const expression,
                  const char * const file, const int line)
{
      __coverity_panic__();
}

void _assert_int_equal(
    const LargestIntegralType a, const LargestIntegralType b,
    const char * const file, const int line)
{
      __coverity_panic__();
}

void _assert_int_not_equal(
    const LargestIntegralType a, const LargestIntegralType b,
    const char * const file, const int line)
{
      __coverity_panic__();
}

void _assert_string_equal(const char * const a, const char * const b,
                          const char * const file, const int line)
{
      __coverity_panic__();
}

void _assert_string_not_equal(const char * const a, const char * const b,
                              const char *file, const int line)
{
      __coverity_panic__();
}

void _assert_memory_equal(const void * const a, const void * const b,
                          const size_t size, const char* const file,
                          const int line)
{
      __coverity_panic__();
}

void _assert_memory_not_equal(const void * const a, const void * const b,
                              const size_t size, const char* const file,
                              const int line)
{
      __coverity_panic__();
}

void _assert_in_range(
    const LargestIntegralType value, const LargestIntegralType minimum,
    const LargestIntegralType maximum, const char* const file, const int line)
{
      __coverity_panic__();
}

void _assert_not_in_range(
    const LargestIntegralType value, const LargestIntegralType minimum,
    const LargestIntegralType maximum, const char* const file, const int line)
{
      __coverity_panic__();
}

void _assert_in_set(
    const LargestIntegralType value, const LargestIntegralType values[],
    const size_t number_of_values, const char* const file, const int line)
{
      __coverity_panic__();
}

void _assert_not_in_set(
    const LargestIntegralType value, const LargestIntegralType values[],
    const size_t number_of_values, const char* const file, const int line)
{
      __coverity_panic__();
}


text:
using UnityEngine;
using UnityEngine.UI;

public class Propulseur : MonoBehaviour
{

	public GameObject target;

	public bool isOn;

	public float initialFuel;
	public float currentFuel;

	public float maxThrust;
	public float currentThrust;

	public float consumption;
	// How much fuel is consumed per second when the thrust is at its maximum

	public bool backward;

	public float emptyMass;

}

redpajama_set_name: RedPajamaGithub


text:
This is a linter for OCaml using [merlin] for the actual linting. It builds on
[atom-linter], like many of the other linter packages. It also uses
merlin to show types of expressions. More merlin functionality will hopefully
be exposed as atom commands in the future.

Since it is [atom-linter] that takes care of the decorations I may as well
steal a screenshot. Imagine the following is OCaml instead of JavaScript:

![Preview](https://camo.githubusercontent.com/70b6e697c9d793642414b4ea6d08dbb9678877b3/687474703a2f2f672e7265636f726469742e636f2f313352666d6972507a322e676966)

[merlin]: https://github.com/the-lambda-church/merlin
[atom-linter]: https://github.com/atom-community/linter

# Usage

Linting is performed when you save the file.

With [hyperclick] installed you can also cmd-click on a word to activate the
`linter-ocaml:type-of` command.

For the keymap some effort has been expended in picking key combinations that
already seem to be used for similar things in other contexts (e.g. the
symbols-view package).

Keyboard activated commands:

|Command|Description|Keybinding (Linux)|Keybinding (OS X)|
|-------|-----------|------------------|-----------------|--------------------|
|`linter-ocaml:type-of`|Show type of expression at cursor|ctrl-alt-?|cmd-alt-?|
|`linter-ocaml:type-of-widen`|Show type of expression one level up|ctrl-alt-.|cmd-alt-.|
|`linter-ocaml:type-of-narrow`|Show type of expression one level down|ctrl-alt-,|cmd-alt-,|
|`linter-ocaml:locate`|Jump to the symbol at the cursor|ctrl-alt-down|cmd-alt-down|
|`linter-ocaml:locate-return`|Return from the jump|ctrl-alt-up|cmd-alt-up|

## Caveat Emptor

I've now used this myself for some time on a program of a couple of thousand
LOC, and it seems to work well. However it still has only been tested on
fairly small programs so YMMV. Bug reports are welcomed.

You should ensure that you are on the latest released merlin version.

Tested on OS X and Linux. Not tested at all on Windows, but if you can get
merlin to work I suppose it should work.

## Other packages

Other packages you probably want:

* [language-ocaml] to get syntax highlighting.
* [minimap] to see errors/warnings in a nice minimappy thing.
* [hyperclick] to get clicky functionality (cmd-click on symbols).

[language-ocaml]: https://atom.io/packages/language-ocaml
[minimap]: https://atom.io/packages/minimap
[hyperclick]: https://atom.io/packages/hyperclick

## Installation

The [package] itself can be installed the normal way (from the Atom package
installer).

[package]: https://atom.io/packages/linter-ocaml

It depends on `ocamlmerlin` being in `PATH`. The simple way to do this is
to install [opam] and then install merlin:

`opam install merlin`

[opam]: https://opam.ocaml.org/doc/Install.html

Additionally you must have a working merlin setup for you project. IOW you must
have a `.merlin` file in your project root directory.

If you are an experienced OCaml person you may stop reading now (or continue
reading and then report any mistakes or bad advice).

I'm not experienced in OCaml so YMMV, however my projects are set up as follows.

A `.merlin` file which looks something like this (add all the packages you need):

```
S src/**
B _build/**
PKG core_kernel
PKG core
PKG core_extended
```

I then have a small build script:

```
#!/usr/bin/env bash
ocamlbuild -package core_extended -I src yo.byte
```

The above assumes you have your sources in `src` (and your main program is
`yo.ml`). The globbing in `.merlin` is needed because `ocamlbuild` makes
subdirectories inside `_build` and merlin needs to see all the cmi files to
find symbols and whatnot.

I recommend also installing ocp-indent (also using opam) and run this on source
files before compilation. Personally I have a simple makefile that runs it
before running ocamlbuild. Atom refreshes the indented files automatically.


text:
package org.apache.flink.api.common.operators;

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

import org.apache.flink.annotation.Internal;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.functions.Partitioner;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.common.io.InputFormat;
import org.apache.flink.api.common.io.RichInputFormat;
import org.apache.flink.api.common.operators.util.UserCodeClassWrapper;
import org.apache.flink.api.common.operators.util.UserCodeObjectWrapper;
import org.apache.flink.api.common.operators.util.UserCodeWrapper;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.core.io.InputSplit;
import org.apache.flink.util.Visitor;

/**
 * Abstract superclass for data sources in a Pact plan.
 *
 * @param <OUT> The output type of the data source
 * @param <T> The type of input format invoked by instances of this data source.
 */
@Internal
public class GenericDataSourceBase<OUT, T extends InputFormat<OUT, ?>> extends Operator<OUT> {

	private static final String DEFAULT_NAME = "<Unnamed Generic Data Source>";

	protected final UserCodeWrapper<? extends T> formatWrapper;

	protected String statisticsKey;

	private SplitDataProperties splitProperties;

	/**
	 * Creates a new instance for the given file using the given input format.
	 *
	 * @param format The {@link org.apache.flink.api.common.io.InputFormat} implementation used to read the data.
	 * @param operatorInfo The type information for the operator.
	 * @param name The given name for the Pact, used in plans, logs and progress messages.
	 */
	public GenericDataSourceBase(T format, OperatorInformation<OUT> operatorInfo, String name) {
		super(operatorInfo, name);

		if (format == null) {
			throw new IllegalArgumentException("Input format may not be null.");
		}

		this.formatWrapper = new UserCodeObjectWrapper<T>(format);
	}

	/**
	 * Creates a new instance for the given file using the given input format, using the default name.
	 *
	 * @param format The {@link org.apache.flink.api.common.io.InputFormat} implementation used to read the data.
	 * @param operatorInfo The type information for the operator.
	 */
	public GenericDataSourceBase(T format, OperatorInformation<OUT> operatorInfo) {
		super(operatorInfo, DEFAULT_NAME);

		if (format == null) {
			throw new IllegalArgumentException("Input format may not be null.");
		}

		this.formatWrapper = new UserCodeObjectWrapper<T>(format);
	}

	/**
	 * Creates a new instance for the given file using the given input format.
	 *
	 * @param format The {@link org.apache.flink.api.common.io.InputFormat} implementation used to read the data.
	 * @param operatorInfo The type information for the operator.
	 * @param name The given name for the Pact, used in plans, logs and progress messages.
	 */
	public GenericDataSourceBase(Class<? extends T> format, OperatorInformation<OUT> operatorInfo, String name) {
		super(operatorInfo, name);

		if (format == null) {
			throw new IllegalArgumentException("Input format may not be null.");
		}

		this.formatWrapper = new UserCodeClassWrapper<T>(format);
	}

	/**
	 * Creates a new instance for the given file using the given input format, using the default name.
	 *
	 * @param format The {@link org.apache.flink.api.common.io.InputFormat} implementation used to read the data.
	 * @param operatorInfo The type information for the operator.
	 */
	public GenericDataSourceBase(Class<? extends T> format, OperatorInformation<OUT> operatorInfo) {
		super(operatorInfo, DEFAULT_NAME);

		if (format == null) {
			throw new IllegalArgumentException("Input format may not be null.");
		}

		this.formatWrapper = new UserCodeClassWrapper<T>(format);
	}

	// --------------------------------------------------------------------------------------------

	/**
	 * Gets the class describing the input format.
	 *
	 * @return The class describing the input format.
	 */
	public UserCodeWrapper<? extends T> getFormatWrapper() {
		return this.formatWrapper;
	}

	/**
	 * Gets the class describing the input format.
	 *

	 * This method is basically identical to {@link #getFormatWrapper()}.
	 *
	 * @return The class describing the input format.
	 *
	 * @see org.apache.flink.api.common.operators.Operator#getUserCodeWrapper()
	 */
	@Override
	public UserCodeWrapper<? extends T> getUserCodeWrapper() {
		return this.formatWrapper;
	}

	// --------------------------------------------------------------------------------------------

	/**
	 * Gets the key under which statistics about this data source may be obtained from the
	 * statistics cache.
	 *
	 * @return The statistics cache key.
	 */
	public String getStatisticsKey() {
		return this.statisticsKey;
	}

	/**
	 * Sets the key under which statistics about this data source may be obtained from the
	 * statistics cache. Useful for testing purposes, when providing mock statistics.
	 *
	 * @param statisticsKey The key for the statistics object.
	 */
	public void setStatisticsKey(String statisticsKey) {
		this.statisticsKey = statisticsKey;
	}

	/**
	 * Sets properties of input splits for this data source.
	 * Split properties can help to generate more efficient execution plans.
	 *

	 *
	 *     IMPORTANT: Providing wrong split data properties can cause wrong results!
	 *
	 *
	 * @param splitDataProperties The data properties of this data source's splits.
	 */
	public void setSplitDataProperties(SplitDataProperties<OUT> splitDataProperties) {
		this.splitProperties = splitDataProperties;
	}

	/**
	 * Returns the data properties of this data source's splits.
	 *
	 * @return The data properties of this data source's splits or null if no properties have been set.
	 */
	public SplitDataProperties<OUT> getSplitDataProperties() {
		return this.splitProperties;
	}

	// --------------------------------------------------------------------------------------------

	/**
	 * Accepts the visitor and applies it this instance. Since the data sources have no inputs, no recursive descend
	 * happens. The visitors pre-visit method is called and, if returning <tt>true</tt>, the post-visit method is called.
	 *
	 * @param visitor The visitor.
	 *
	 * @see org.apache.flink.util.Visitable#accept(org.apache.flink.util.Visitor)
	 */
	@Override
	public void accept(Visitor<Operator<?>> visitor) {
		if (visitor.preVisit(this)) {
			visitor.postVisit(this);
		}
	}

	// --------------------------------------------------------------------------------------------

	protected List<OUT> executeOnCollections(RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception {
		@SuppressWarnings("unchecked")
		InputFormat<OUT, InputSplit> inputFormat = (InputFormat<OUT, InputSplit>) this.formatWrapper.getUserCodeObject();
		//configure the input format
		inputFormat.configure(this.parameters);

		//open the input format
		if (inputFormat instanceof RichInputFormat) {
			((RichInputFormat) inputFormat).setRuntimeContext(ctx);
			((RichInputFormat) inputFormat).openInputFormat();
		}

		List<OUT> result = new ArrayList<OUT>();

		// splits
		InputSplit[] splits = inputFormat.createInputSplits(1);
		TypeSerializer<OUT> serializer = getOperatorInfo().getOutputType().createSerializer(executionConfig);

		for (InputSplit split : splits) {
			inputFormat.open(split);

			while (!inputFormat.reachedEnd()) {
				OUT next = inputFormat.nextRecord(serializer.createInstance());
				if (next != null) {
					result.add(serializer.copy(next));
				}
			}

			inputFormat.close();
		}

		//close the input format
		if (inputFormat instanceof RichInputFormat) {
			((RichInputFormat) inputFormat).closeInputFormat();
		}

		return result;
	}

	// --------------------------------------------------------------------------------------------

	public String toString() {
		return this.name;
	}

	public static interface SplitDataProperties<T> {

		public int[] getSplitPartitionKeys();

		public Partitioner<T> getSplitPartitioner();

		public int[] getSplitGroupKeys();

		public Ordering getSplitOrder();

	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/C:/Users/Florian.S/AndroidStudioProjects/NavigationDrawer/Application/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.2/res/values-w600dp/values.xml -->
    <eat-comment/>
    <dimen name="abc_search_view_text_min_width">192dip</dimen>
    <integer name="abc_max_action_buttons">5</integer>
</resources>


text:
Henrique Moody <henriquemoody@gmail.com>
--FILE--
<?php

declare(strict_types=1);

require 'vendor/autoload.php';

use Respect\Validation\Exceptions\ValidationException;
use Respect\Validation\Validator as v;

$input = ['email' => 'not an email'];

try {
    v::key('email', v::email()->setName('Email'))->setName('Foo')->check($input);
} catch (ValidationException $exception) {
    echo $exception->getMessage() . PHP_EOL;
}

try {
    // This is a trick thing: the call to `setName()` here seems to be the one
    // from the `Key` rule but it's actually from the `Validator`.
    v::key('email', v::email())->setName('Email')->check($input);
} catch (ValidationException $exception) {
    echo $exception->getMessage() . PHP_EOL;
}

try {
    v::key('email', v::email())->check($input);
} catch (ValidationException $exception) {
    echo $exception->getMessage() . PHP_EOL;
}
?>
--EXPECT--
Email must be valid email
email must be valid email
email must be valid email


text:
package org.kaaproject.kaa.server.common.dao.service;

import org.cassandraunit.CassandraCQLUnit;
import org.cassandraunit.dataset.cql.ClassPathCQLDataSet;
import org.junit.AfterClass;
import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "/cassandra-dao-test-context.xml")
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class CassandraLogAppenderServiceImplTest extends LogAppenderServiceImplTest {

    @ClassRule
    public static CassandraCQLUnit cassandraUnit = new CassandraCQLUnit(new ClassPathCQLDataSet("cassandra.cql", false, false));

    @AfterClass
    public static void after() throws Exception {
        cassandraUnit.cluster.close();
        while (!cassandraUnit.cluster.isClosed()){}
    }

}


text:
#ifndef params_h
#define params_h

#define q 4591
/* XXX: also built into modq in various ways */

#define qshift 2295
#define p 761
#define w 250

#define rq_encode_len 1218
#define rq_encoderounded_len 1015
#define small_encode_len 191

#endif


text:
  <button class="btn btn-link" type="button" ng-click="togglePopover()">

  </button>


text:
module Webdrone
  class Browser
    def text
      @text ||= Text.new self
    end
  end

  class Text
    attr_reader :a0

    def initialize(a0)
      @a0 = a0
    end

    def text(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
      item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, scroll: scroll, parent: parent
      if item.is_a? Array
        item.collect(&:text)
      else
        item.text
      end
    rescue StandardError => error
      Webdrone.report_error(@a0, error)
    end

    alias_method :id,     :text
    alias_method :css,    :text
    alias_method :link,   :text
    alias_method :button, :text
    alias_method :on,     :text
    alias_method :option, :text
    alias_method :xpath,  :text

    def page_title
      @a0.driver.title
    rescue StandardError => error
      Webdrone.report_error(@a0, error)
    end

    protected :text
  end
end


text:
<?
//Check access
admin_panel_access("users_newsletter");

if(!defined("site_root")){exit();}
?>

<form action="marketing_save.php" method="post">

Here you can specify some other emails for a newsletter. They are not site user's emails.

<?
$sql="select content from newsletter_emails";
$rs->open($sql);
if(!$rs->eof)
{
?>
	<textarea style="width:600px;height:150px;margin-left:6px" name="content"><?=$rs->row["content"]?></textarea>

 ";" - separator

<?
}
?>

	<input type="submit" value="<?=word_lang("save")?>"  class="btn btn-primary">

</form>


text:
package com.skubit.dialog;

public class ResultCode {

    public static final int NO_CONNECTION = -1;

    public static final int OK = 0;

    public static final int USER_CANCELED = 1;

    public static final int UNKNOWN_ERROR = 199;

}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX                                                                           XX
XX                     Register Requirements for ARM                         XX
XX                                                                           XX
XX  This encapsulates all the logic for setting register requirements for    XX
XX  the ARM  architecture.                                                   XX
XX                                                                           XX
XX                                                                           XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

#include "jitpch.h"
#ifdef _MSC_VER
#pragma hdrstop
#endif

#ifndef LEGACY_BACKEND // This file is ONLY used for the RyuJIT backend that uses the linear scan register allocator

#ifdef _TARGET_ARM_

#include "jit.h"
#include "sideeffects.h"
#include "lower.h"
#include "lsra.h"

void LinearScan::BuildLclHeap(GenTree* tree)
{
    TreeNodeInfo* info = currentNodeInfo;
    assert(info->dstCount == 1);

    // Need a variable number of temp regs (see genLclHeap() in codegenarm.cpp):
    // Here '-' means don't care.
    //
    //  Size?                   Init Memory?    # temp regs
    //   0                          -               0
    //   const and <=4 str instr    -             hasPspSym ? 1 : 0
    //   const and <PageSize        No            hasPspSym ? 1 : 0
    //   >4 ptr words               Yes           hasPspSym ? 2 : 1
    //   Non-const                  Yes           hasPspSym ? 2 : 1
    //   Non-const                  No            hasPspSym ? 2 : 1

    bool hasPspSym;
#if FEATURE_EH_FUNCLETS
    hasPspSym = (compiler->lvaPSPSym != BAD_VAR_NUM);
#else
    hasPspSym = false;
#endif

    GenTree* size = tree->gtOp.gtOp1;
    if (size->IsCnsIntOrI())
    {
        assert(size->isContained());
        info->srcCount = 0;

        size_t sizeVal = size->gtIntCon.gtIconVal;
        if (sizeVal == 0)
        {
            info->internalIntCount = 0;
        }
        else
        {
            sizeVal                          = AlignUp(sizeVal, STACK_ALIGN);
            size_t cntStackAlignedWidthItems = (sizeVal >> STACK_ALIGN_SHIFT);

            // For small allocations up to 4 store instructions
            if (cntStackAlignedWidthItems <= 4)
            {
                info->internalIntCount = 0;
            }
            else if (!compiler->info.compInitMem)
            {
                // No need to initialize allocated stack space.
                if (sizeVal < compiler->eeGetPageSize())
                {
                    info->internalIntCount = 0;
                }
                else
                {
                    info->internalIntCount = 1;
                }
            }
            else
            {
                info->internalIntCount = 1;
            }

            if (hasPspSym)
            {
                info->internalIntCount++;
            }
        }
    }
    else
    {
        // target (regCnt) + tmp + [psp]
        info->srcCount         = 1;
        info->internalIntCount = hasPspSym ? 2 : 1;
        appendLocationInfoToList(size);
    }

    // If we are needed in temporary registers we should be sure that
    // it's different from target (regCnt)
    if (info->internalIntCount > 0)
    {
        info->isInternalRegDelayFree = true;
    }
}

//------------------------------------------------------------------------
// BuildNode: Set the register requirements for RA.
//
// Notes:
//    Takes care of annotating the register requirements
//    for every TreeNodeInfo struct that maps to each tree node.
//
// Preconditions:
//    LSRA has been initialized and there is a TreeNodeInfo node
//    already allocated and initialized for every tree in the IR.
//
// Postconditions:
//    Every TreeNodeInfo instance has the right annotations on register
//    requirements needed by LSRA to build the Interval Table (source,
//    destination and internal [temp] register counts).
//
void LinearScan::BuildNode(GenTree* tree)
{
    TreeNodeInfo* info         = currentNodeInfo;
    unsigned      kind         = tree->OperKind();
    RegisterType  registerType = TypeGet(tree);

    if (tree->isContained())
    {
        info->dstCount = 0;
        assert(info->srcCount == 0);
        return;
    }

    // Set the default dstCount. This may be modified below.
    if (tree->IsValue())
    {
        info->dstCount = 1;
        if (tree->IsUnusedValue())
        {
            info->isLocalDefUse = true;
        }
    }
    else
    {
        info->dstCount = 0;
    }

    switch (tree->OperGet())
    {
        GenTree* op1;
        GenTree* op2;

        case GT_STORE_LCL_FLD:
        case GT_STORE_LCL_VAR:
            BuildStoreLoc(tree->AsLclVarCommon());
            break;

        case GT_NOP:
            // A GT_NOP is either a passthrough (if it is void, or if it has
            // a child), but must be considered to produce a dummy value if it
            // has a type but no child
            info->srcCount = 0;
            if (tree->TypeGet() != TYP_VOID && tree->gtOp.gtOp1 == nullptr)
            {
                assert(info->dstCount == 1);
            }
            else
            {
                assert(info->dstCount == 0);
            }
            break;

        case GT_INTRINSIC:
        {
            // TODO-ARM: Implement other type of intrinsics (round, sqrt and etc.)
            // Both operand and its result must be of the same floating point type.
            op1 = tree->gtOp.gtOp1;
            assert(varTypeIsFloating(op1));
            assert(op1->TypeGet() == tree->TypeGet());
            appendLocationInfoToList(op1);

            switch (tree->gtIntrinsic.gtIntrinsicId)
            {
                case CORINFO_INTRINSIC_Abs:
                case CORINFO_INTRINSIC_Sqrt:
                    info->srcCount = 1;
                    assert(info->dstCount == 1);
                    break;
                default:
                    NYI_ARM("LinearScan::Build for GT_INTRINSIC");
                    break;
            }
        }
        break;

        case GT_CAST:
        {
            assert(info->dstCount == 1);

            // Non-overflow casts to/from float/double are done using SSE2 instructions
            // and that allow the source operand to be either a reg or memop. Given the
            // fact that casts from small int to float/double are done as two-level casts,
            // the source operand is always guaranteed to be of size 4 or 8 bytes.
            var_types castToType = tree->CastToType();
            GenTree*  castOp     = tree->gtCast.CastOp();
            var_types castOpType = castOp->TypeGet();
            info->srcCount       = GetOperandInfo(castOp);
            if (tree->gtFlags & GTF_UNSIGNED)
            {
                castOpType = genUnsignedType(castOpType);
            }

            if (varTypeIsLong(castOpType))
            {
                assert((castOp->OperGet() == GT_LONG) && castOp->isContained());
                info->srcCount = 2;
            }

            // FloatToIntCast needs a temporary register
            if (varTypeIsFloating(castOpType) && varTypeIsIntOrI(tree))
            {
                info->setInternalCandidates(this, RBM_ALLFLOAT);
                info->internalFloatCount     = 1;
                info->isInternalRegDelayFree = true;
            }

            Lowering::CastInfo castInfo;

            // Get information about the cast.
            Lowering::getCastDescription(tree, &castInfo);

            if (castInfo.requiresOverflowCheck)
            {
                var_types srcType = castOp->TypeGet();
                emitAttr  cmpSize = EA_ATTR(genTypeSize(srcType));

                // If we cannot store data in an immediate for instructions,
                // then we will need to reserve a temporary register.

                if (!castInfo.signCheckOnly) // In case of only sign check, temp regs are not needeed.
                {
                    if (castInfo.unsignedSource || castInfo.unsignedDest)
                    {
                        // check typeMask
                        bool canStoreTypeMask = emitter::emitIns_valid_imm_for_alu(castInfo.typeMask);
                        if (!canStoreTypeMask)
                        {
                            info->internalIntCount = 1;
                        }
                    }
                    else
                    {
                        // For comparing against the max or min value
                        bool canStoreMaxValue =
                            emitter::emitIns_valid_imm_for_cmp(castInfo.typeMax, INS_FLAGS_DONT_CARE);
                        bool canStoreMinValue =
                            emitter::emitIns_valid_imm_for_cmp(castInfo.typeMin, INS_FLAGS_DONT_CARE);

                        if (!canStoreMaxValue || !canStoreMinValue)
                        {
                            info->internalIntCount = 1;
                        }
                    }
                }
            }
        }
        break;

        case GT_JTRUE:
            info->srcCount = 0;
            assert(info->dstCount == 0);
            break;

        case GT_JMP:
            info->srcCount = 0;
            assert(info->dstCount == 0);
            break;

        case GT_SWITCH:
            // This should never occur since switch nodes must not be visible at this
            // point in the JIT.
            info->srcCount = 0;
            noway_assert(!"Switch must be lowered at this point");
            break;

        case GT_JMPTABLE:
            info->srcCount = 0;
            assert(info->dstCount == 1);
            break;

        case GT_SWITCH_TABLE:
            assert(info->dstCount == 0);
            info->srcCount = appendBinaryLocationInfoToList(tree->AsOp());
            assert(info->srcCount == 2);
            break;

        case GT_ASG:
            noway_assert(!"We should never hit any assignment operator in lowering");
            info->srcCount = 0;
            break;

        case GT_ADD_LO:
        case GT_ADD_HI:
        case GT_SUB_LO:
        case GT_SUB_HI:
        case GT_ADD:
        case GT_SUB:
            if (varTypeIsFloating(tree->TypeGet()))
            {
                // overflow operations aren't supported on float/double types.
                assert(!tree->gtOverflow());

                // No implicit conversions at this stage as the expectation is that
                // everything is made explicit by adding casts.
                assert(tree->gtOp.gtOp1->TypeGet() == tree->gtOp.gtOp2->TypeGet());

                assert(info->dstCount == 1);
                info->srcCount = appendBinaryLocationInfoToList(tree->AsOp());
                assert(info->srcCount == 2);
                break;
            }

            __fallthrough;

        case GT_AND:
        case GT_OR:
        case GT_XOR:
            assert(info->dstCount == 1);
            info->srcCount = appendBinaryLocationInfoToList(tree->AsOp());
            assert(info->srcCount == (tree->gtOp.gtOp2->isContained() ? 1 : 2));
            break;

        case GT_RETURNTRAP:
            // this just turns into a compare of its child with an int
            // + a conditional call
            info->srcCount = 1;
            assert(info->dstCount == 0);
            appendLocationInfoToList(tree->gtOp.gtOp1);
            break;

        case GT_MUL:
            if (tree->gtOverflow())
            {
                // Need a register different from target reg to check for overflow.
                info->internalIntCount       = 1;
                info->isInternalRegDelayFree = true;
            }
            __fallthrough;

        case GT_DIV:
        case GT_MULHI:
        case GT_UDIV:
        {
            assert(info->dstCount == 1);
            info->srcCount = appendBinaryLocationInfoToList(tree->AsOp());
            assert(info->srcCount == 2);
        }
        break;

        case GT_MUL_LONG:
            info->dstCount = 2;
            info->srcCount = appendBinaryLocationInfoToList(tree->AsOp());
            assert(info->srcCount == 2);
            break;

        case GT_LIST:
        case GT_FIELD_LIST:
        case GT_ARGPLACE:
        case GT_NO_OP:
        case GT_START_NONGC:
        case GT_PROF_HOOK:
            info->srcCount = 0;
            assert(info->dstCount == 0);
            break;

        case GT_LONG:
            assert(tree->IsUnusedValue()); // Contained nodes are already processed, only unused GT_LONG can reach here.
                                           // An unused GT_LONG doesn't produce any registers.
            tree->gtType = TYP_VOID;
            tree->ClearUnusedValue();
            info->isLocalDefUse = false;

            // An unused GT_LONG node needs to consume its sources, but need not produce a register.
            info->srcCount = 2;
            info->dstCount = 0;
            appendLocationInfoToList(tree->gtGetOp1());
            appendLocationInfoToList(tree->gtGetOp2());
            break;

        case GT_CNS_DBL:
            info->srcCount = 0;
            assert(info->dstCount == 1);
            if (tree->TypeGet() == TYP_FLOAT)
            {
                // An int register for float constant
                info->internalIntCount = 1;
            }
            else
            {
                // TYP_DOUBLE
                assert(tree->TypeGet() == TYP_DOUBLE);

                // Two int registers for double constant
                info->internalIntCount = 2;
            }
            break;

        case GT_RETURN:
            BuildReturn(tree);
            break;

        case GT_RETFILT:
            assert(info->dstCount == 0);
            if (tree->TypeGet() == TYP_VOID)
            {
                info->srcCount = 0;
            }
            else
            {
                assert(tree->TypeGet() == TYP_INT);

                info->srcCount = 1;
                info->setSrcCandidates(this, RBM_INTRET);
                LocationInfoListNode* locationInfo = getLocationInfo(tree->gtOp.gtOp1);
                locationInfo->info.setSrcCandidates(this, RBM_INTRET);
                useList.Append(locationInfo);
            }
            break;

        case GT_ARR_BOUNDS_CHECK:
#ifdef FEATURE_SIMD
        case GT_SIMD_CHK:
#endif // FEATURE_SIMD
        {
            // Consumes arrLen & index - has no result
            info->srcCount = 2;
            assert(info->dstCount == 0);
            appendLocationInfoToList(tree->AsBoundsChk()->gtIndex);
            appendLocationInfoToList(tree->AsBoundsChk()->gtArrLen);
        }
        break;

        case GT_ARR_ELEM:
            // These must have been lowered to GT_ARR_INDEX
            noway_assert(!"We should never see a GT_ARR_ELEM in lowering");
            info->srcCount = 0;
            assert(info->dstCount == 0);
            break;

        case GT_ARR_INDEX:
        {
            info->srcCount = 2;
            assert(info->dstCount == 1);
            info->internalIntCount       = 1;
            info->isInternalRegDelayFree = true;

            // For GT_ARR_INDEX, the lifetime of the arrObj must be extended because it is actually used multiple
            // times while the result is being computed.
            LocationInfoListNode* arrObjInfo = getLocationInfo(tree->AsArrIndex()->ArrObj());
            arrObjInfo->info.isDelayFree     = true;
            useList.Append(arrObjInfo);
            useList.Append(getLocationInfo(tree->AsArrIndex()->IndexExpr()));
            info->hasDelayFreeSrc = true;
        }
        break;

        case GT_ARR_OFFSET:

            // This consumes the offset, if any, the arrObj and the effective index,
            // and produces the flattened offset for this dimension.
            assert(info->dstCount == 1);

            if (tree->gtArrOffs.gtOffset->isContained())
            {
                info->srcCount = 2;
            }
            else
            {
                // Here we simply need an internal register, which must be different
                // from any of the operand's registers, but may be the same as targetReg.
                info->internalIntCount = 1;
                info->srcCount         = 3;
                appendLocationInfoToList(tree->AsArrOffs()->gtOffset);
            }
            appendLocationInfoToList(tree->AsArrOffs()->gtIndex);
            appendLocationInfoToList(tree->AsArrOffs()->gtArrObj);
            break;

        case GT_LEA:
        {
            GenTreeAddrMode* lea    = tree->AsAddrMode();
            int              offset = lea->Offset();

            // This LEA is instantiating an address, so we set up the srcCount and dstCount here.
            info->srcCount = 0;
            assert(info->dstCount == 1);
            if (lea->HasBase())
            {
                info->srcCount++;
                appendLocationInfoToList(tree->AsAddrMode()->Base());
            }
            if (lea->HasIndex())
            {
                info->srcCount++;
                appendLocationInfoToList(tree->AsAddrMode()->Index());
            }

            // An internal register may be needed too; the logic here should be in sync with the
            // genLeaInstruction()'s requirements for a such register.
            if (lea->HasBase() && lea->HasIndex())
            {
                if (offset != 0)
                {
                    // We need a register when we have all three: base reg, index reg and a non-zero offset.
                    info->internalIntCount = 1;
                }
            }
            else if (lea->HasBase())
            {
                if (!emitter::emitIns_valid_imm_for_add(offset, INS_FLAGS_DONT_CARE))
                {
                    // We need a register when we have an offset that is too large to encode in the add instruction.
                    info->internalIntCount = 1;
                }
            }
        }
        break;

        case GT_NEG:
            info->srcCount = 1;
            assert(info->dstCount == 1);
            appendLocationInfoToList(tree->gtOp.gtOp1);
            break;

        case GT_NOT:
            info->srcCount = 1;
            assert(info->dstCount == 1);
            appendLocationInfoToList(tree->gtOp.gtOp1);
            break;

        case GT_LSH:
        case GT_RSH:
        case GT_RSZ:
        case GT_ROR:
        case GT_LSH_HI:
        case GT_RSH_LO:
            BuildShiftRotate(tree);
            break;

        case GT_EQ:
        case GT_NE:
        case GT_LT:
        case GT_LE:
        case GT_GE:
        case GT_GT:
        case GT_CMP:
            BuildCmp(tree);
            break;

        case GT_CKFINITE:
            info->srcCount = 1;
            assert(info->dstCount == 1);
            info->internalIntCount = 1;
            appendLocationInfoToList(tree->gtOp.gtOp1);
            break;

        case GT_CALL:
            BuildCall(tree->AsCall());
            break;

        case GT_ADDR:
        {
            // For a GT_ADDR, the child node should not be evaluated into a register
            GenTree* child = tree->gtOp.gtOp1;
            assert(!isCandidateLocalRef(child));
            assert(child->isContained());
            assert(info->dstCount == 1);
            info->srcCount = 0;
        }
        break;

        case GT_STORE_BLK:
        case GT_STORE_OBJ:
        case GT_STORE_DYN_BLK:
            BuildBlockStore(tree->AsBlk());
            break;

        case GT_INIT_VAL:
            // Always a passthrough of its child's value.
            assert(!"INIT_VAL should always be contained");
            break;

        case GT_LCLHEAP:
            BuildLclHeap(tree);
            break;

        case GT_STOREIND:
        {
            assert(info->dstCount == 0);
            GenTree* src = tree->gtOp.gtOp2;

            if (compiler->codeGen->gcInfo.gcIsWriteBarrierAsgNode(tree))
            {
                info->srcCount = 2;
                BuildGCWriteBarrier(tree);
                break;
            }

            BuildIndir(tree->AsIndir());
            // No contained source on ARM.
            assert(!src->isContained());
            info->srcCount++;
            appendLocationInfoToList(src);
        }
        break;

        case GT_NULLCHECK:
            // It requires a internal register on ARM, as it is implemented as a load
            assert(info->dstCount == 0);
            assert(!tree->gtGetOp1()->isContained());
            info->srcCount         = 1;
            info->internalIntCount = 1;
            appendLocationInfoToList(tree->gtOp.gtOp1);
            break;

        case GT_IND:
            assert(info->dstCount == 1);
            info->srcCount = 1;
            BuildIndir(tree->AsIndir());
            break;

        case GT_CATCH_ARG:
            info->srcCount = 0;
            assert(info->dstCount == 1);
            info->setDstCandidates(this, RBM_EXCEPTION_OBJECT);
            break;

        case GT_CLS_VAR:
            info->srcCount = 0;
            // GT_CLS_VAR, by the time we reach the backend, must always
            // be a pure use.
            // It will produce a result of the type of the
            // node, and use an internal register for the address.

            assert(info->dstCount == 1);
            assert((tree->gtFlags & (GTF_VAR_DEF | GTF_VAR_USEASG)) == 0);
            info->internalIntCount = 1;
            break;

        case GT_COPY:
            info->srcCount = 1;
#ifdef _TARGET_ARM_
            // This case currently only occurs for double types that are passed as TYP_LONG;
            // actual long types would have been decomposed by now.
            if (tree->TypeGet() == TYP_LONG)
            {
                info->dstCount = 2;
            }
            else
#endif
            {
                assert(info->dstCount == 1);
            }
            appendLocationInfoToList(tree->gtOp.gtOp1);
            break;

        case GT_PUTARG_SPLIT:
            BuildPutArgSplit(tree->AsPutArgSplit());
            break;

        case GT_PUTARG_STK:
            BuildPutArgStk(tree->AsPutArgStk());
            break;

        case GT_PUTARG_REG:
            BuildPutArgReg(tree->AsUnOp());
            break;

        case GT_BITCAST:
        {
            info->srcCount = 1;
            assert(info->dstCount == 1);
            LocationInfoListNode* locationInfo = getLocationInfo(tree->gtOp.gtOp1);
            useList.Append(locationInfo);
            regNumber argReg  = tree->gtRegNum;
            regMaskTP argMask = genRegMask(argReg);

            // If type of node is `long` then it is actually `double`.
            // The actual `long` types must have been transformed as a field list with two fields.
            if (tree->TypeGet() == TYP_LONG)
            {
                info->dstCount++;
                assert(genRegArgNext(argReg) == REG_NEXT(argReg));
                argMask |= genRegMask(REG_NEXT(argReg));
            }

            info->setDstCandidates(this, argMask);
            info->setSrcCandidates(this, argMask);
        }
        break;

        default:
#ifdef DEBUG
            char message[256];
            _snprintf_s(message, _countof(message), _TRUNCATE, "NYI: Unimplemented node type %s",
                        GenTree::OpName(tree->OperGet()));
            NYIRAW(message);
#else
            NYI_ARM("BuildNode default case");
#endif
        case GT_LCL_FLD:
        case GT_LCL_FLD_ADDR:
        case GT_LCL_VAR:
        case GT_LCL_VAR_ADDR:
        case GT_PHYSREG:
        case GT_CLS_VAR_ADDR:
        case GT_IL_OFFSET:
        case GT_CNS_INT:
        case GT_LABEL:
        case GT_PINVOKE_PROLOG:
        case GT_JCC:
        case GT_SETCC:
        case GT_MEMORYBARRIER:
        case GT_OBJ:
            BuildSimple(tree);
            break;

        case GT_INDEX_ADDR:
            info->dstCount         = 1;
            info->internalIntCount = 1;
            info->srcCount         = appendBinaryLocationInfoToList(tree->AsOp());
            assert(info->srcCount == 2);
            break;
    } // end switch (tree->OperGet())

    if (tree->IsUnusedValue() && (info->dstCount != 0))
    {
        info->isLocalDefUse = true;
    }
    // We need to be sure that we've set info->srcCount and info->dstCount appropriately
    assert((info->dstCount < 2) || tree->IsMultiRegNode());
    assert(info->isLocalDefUse == (tree->IsValue() && tree->IsUnusedValue()));
    assert(!tree->IsUnusedValue() || (info->dstCount != 0));
    assert(info->dstCount == tree->GetRegisterDstCount());
}

#endif // _TARGET_ARM_

#endif // !LEGACY_BACKEND


text:
'use strict';
const { getSourceFileDetails, getRelativeImport } = require('../utils/import-aliases');

/**
 * A group of rules that enforce spinnaker ES6 import alias conventions.
 *
 * Source code in a package (i.e., `amazon`) should not import from package (i.e., `core`) using a relative path.
 * Instead, it should import from `@spinnaker/core`
 *
 * @version 0.1.0
 * @category conventions
 */
const rule = function(context) {
  const sourceFile = context.getFilename();
  const { modulesPath, sourceDirectory, ownPackage } = getSourceFileDetails(sourceFile);
  if (!ownPackage) {
    return {};
  }

  return {
    ImportDeclaration: function(node) {
      if (node.source.type !== 'Literal' || !node.source.value) {
        return;
      }

      const importString = node.source.value;
      const relativeImport = getRelativeImport(sourceDirectory, modulesPath, importString);

      if (!relativeImport || relativeImport.pkg === ownPackage) {
        return;
      }

      const { pkg } = relativeImport;
      const message =
        `Do not use a relative import to import from ${pkg} from code inside ${ownPackage}.` +
        ` Instead, use the npm package @spinnaker/${pkg}`;

      const fix = fixer => fixer.replaceText(node.source, `'@spinnaker/${pkg}'`);
      context.report({ fix, node, message });
    },
  };
};

module.exports = {
  meta: {
    type: 'problem',
    docs: {
      description: `Enforces spinnaker ES6 import conventions for package aliases`,
    },
    fixable: 'code',
  },
  create: rule,
};


text:
package org.jboss.elasticsearch.tools.content;

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

import junit.framework.Assert;

import org.elasticsearch.client.Client;
import org.elasticsearch.common.joda.time.format.ISODateTimeFormat;
import org.elasticsearch.common.settings.SettingsException;
import org.junit.Test;
import org.mockito.Mockito;

/**
 * Unit test for {@link AddCurrentTimestampPreprocessor}.
 *
 * @author Vlastimil Elias (velias at redhat dot com)
 */
public class AddCurrentTimestampPreprocessorTest {

	@Test
	public void init_settingerrors() {
		AddCurrentTimestampPreprocessor tested = new AddCurrentTimestampPreprocessor();
		Client client = Mockito.mock(Client.class);
		Map<String, Object> settings = null;

		// case - settings mandatory
		try {
			tested.init("Test mapper", client, settings);
			Assert.fail("SettingsException must be thrown");
		} catch (SettingsException e) {
			Assert.assertEquals("'settings' section is not defined for preprocessor Test mapper", e.getMessage());
		}

		// case - field mandatory
		settings = new HashMap<String, Object>();
		try {
			tested.init("Test mapper", client, settings);
			Assert.fail("SettingsException must be thrown");
		} catch (SettingsException e) {
			Assert.assertEquals("Missing or empty 'settings/field' configuration value for 'Test mapper' preprocessor",
					e.getMessage());
		}

		settings.put(AddCurrentTimestampPreprocessor.CFG_FIELD, " ");
		try {
			tested.init("Test mapper", client, settings);
			Assert.fail("SettingsException must be thrown");
		} catch (SettingsException e) {
			Assert.assertEquals("Missing or empty 'settings/field' configuration value for 'Test mapper' preprocessor",
					e.getMessage());
		}

		// case - no more mandatory setting fields
		settings.put(AddCurrentTimestampPreprocessor.CFG_FIELD, "field");
		tested.init("Test mapper", client, settings);
	}

	@Test
	public void init() {
		AddCurrentTimestampPreprocessor tested = new AddCurrentTimestampPreprocessor();
		Client client = Mockito.mock(Client.class);

		// case - null value
		{
			Map<String, Object> settings = new HashMap<String, Object>();
			settings.put(AddCurrentTimestampPreprocessor.CFG_FIELD, "source");

			tested.init("Test mapper", client, settings);
			Assert.assertEquals("Test mapper", tested.getName());
			Assert.assertEquals(client, tested.client);
			Assert.assertEquals("source", tested.field);
		}
	}

	@Test
	public void preprocessData() {
		AddCurrentTimestampPreprocessor tested = new AddCurrentTimestampPreprocessor();
		tested.field = "my_field";

		// case - not NPE
		tested.preprocessData(null, null);

		// case - fill date value over null
		{
			Map<String, Object> values = new HashMap<String, Object>();
			long now = System.currentTimeMillis();
			tested.preprocessData(values, null);
			long val = ISODateTimeFormat.dateTimeParser().parseMillis((String) values.get(tested.field));
			Assert.assertTrue(now <= val && val <= now + 100);
		}

		// case - rewrite date value over null
		{
			Map<String, Object> values = new HashMap<String, Object>();
			values.put(tested.field, "value old");
			long now = System.currentTimeMillis();
			tested.preprocessData(values, null);
			long val = ISODateTimeFormat.dateTimeParser().parseMillis((String) values.get(tested.field));
			Assert.assertTrue(now <= val && val <= now + 100);
		}
	}
}


text:
package com.tom_roush.pdfbox.pdmodel.interactive.form;

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

import com.tom_roush.pdfbox.cos.COSDictionary;
import com.tom_roush.pdfbox.cos.COSName;

/**
 * A pushbutton is a purely interactive control that responds immediately to user
 * input without retaining a permanent value.
 *
 * @author sug
 */
public class PDPushButton extends PDButton
{
    /**
     * @see PDField#PDField(PDAcroForm)
     *
     * @param acroForm The acroform.
     */
    public PDPushButton(PDAcroForm acroForm)
    {
        super(acroForm);
        getCOSObject().setFlag(COSName.FF, FLAG_PUSHBUTTON, true);
    }

    /**
     * Constructor.
     *
     * @param acroForm The form that this field is part of.
     * @param field the PDF object to represent as a field.
     * @param parent the parent node of the node
     */
    PDPushButton(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
    {
        super(acroForm, field, parent);
    }

    @Override
    public List<String> getExportValues()
    {
        return Collections.emptyList();
    }

    @Override
    public void setExportValues(List<String> values)
    {
        if (values != null && !values.isEmpty())
        {
            throw new IllegalArgumentException("A PDPushButton shall not use the Opt entry in the field dictionary");
        }
    }

    @Override
    public String getValue()
    {
        return "";
    }

    @Override
    public String getDefaultValue()
    {
        return "";
    }

    @Override
    public String getValueAsString()
    {
        return getValue();
    }

    @Override
    public Set<String> getOnValues()
    {
        return Collections.emptySet();
    }

    @Override
    void constructAppearances() throws IOException
    {
        // TODO: add appearance handler to generate/update appearance
    }
}


text:
using System.Collections.Generic;
using System.Linq;

namespace StackReview2.Review
{
	internal class RandomReviewVk : ReviewMode, IReviewable
	{
		public RandomReviewVk(Deck d) : base(d) { }

		public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
		{
			Correct = 0;
			Incorrect = 0;
			CurrentQuestion = 0;

			foreach (
				var kv in ReviewDeck.GetRandomEnumerator().Select(kvooo => new KeyValuePair<string, string>(kvooo.Value, kvooo.Key))
				)
			{
				if (IsCorrect.ContainsKey(kv.Key.ToLower()))
				{
					if (!IsCorrect[kv.Key.ToLower()])
					{
						yield return kv;
					}
				}
				else
				{
					IsCorrect.Add(kv.Key, false);
					yield return kv;
				}
			}
		}
	}
}


text:
require 'mcd'

class Fraccion

	attr_accessor :numerador
	attr_accessor :denominador
	@numerador
	@denominador

	def initialize(a, b)	# Constructor de la clase que inicializa la fracción con los valores que se le pasan por parametros
	   @numerador = a;
	   @denominador = b;
	   self.reduce()	# LLamamos a la función que simplifica la fracción al mínimo
	end

	def reduce()		# Método encargado de la simplificación del objeto fracción que lo llama
	   div = Mcd(@numerador, @denominador)
	   @numerador = @numerador / div
	   @denominador = @denominador / div
	end

	def num()		# Método encargado de devolver el valor del numerador
	   return @numerador
	end

	def denom()		# Método encargado de devolver el valor del denominador
	   return @denominador
	end

	def to_s		# Método encargado de mostrar por consola la fraccion de forma a/b , donde a es el numerador y b es el denominador
	   "#{@numerador}/#{@denominador}"
	end

	def to_f  		# Método encargado de mostrar por  la consola la fraccion en formato flotante
	   @numerador.to_f / @denominador.to_f
	end

	def ==(frac)		# Sobrecarga del metodo == para la comparación de fracciones
	   if ((@numerador == frac.numerador) && (@denominador == frac.denominador))
		  return true
	   end
	   return false
	end

	def abs			# Metodo que nos devuelve una fracción en valor absoluto
	   Fraccion.new(numerador.abs, denominador.abs)
	end

	def reciprocal		# Metodo que devuelve una fraccion con el numerador y el denominador invertidos
	   Fraccion.new(denominador, numerador)
	end

	def -@			# Sobrecarga del operador - para calcular el opuesto de una fracción
	   Fraccion.new(@numerador *-1,@denominador)
	end

	def +(frac)    		 #Método suma dos fracciones con + y dar el resultado de forma reducida
	   if (frac.is_a? Integer)
			frac = Fraccion.new(frac,1)
		end
                return Fraccion.new((frac.den * @num) + (@den * frac.num), @den * frac.den)
	end

	def -(frac)    		 #Método resta dos fracciones con - y dar el resultado de forma reducida
	   Fraccion.new(@numerador*frac.denominador - frac.numerador*denominador, @denominador*frac.denominador)
	end

	def *(frac)     	#Método multiplca dos fracciones con * y dar el resultado de forma reducida
		if (frac.is_a? Integer)
			frac = Fraccion.new(frac,1)
		end
                return Fraccion.new(@numerador * frac.num, @denominador * frac.den)

	end

				#Método divide dos fracciones con / y dar el resultado de forma reducida
	def /(frac)
	   Fraccion.new(@numerador*frac.denominador,@denominador*frac.numerador)
	end

	def %(frac)   		# Método que  calcula el resto dos fracciones con % y dar el resultado de forma reducida
	   Fraccion.new(@numerador % @denominador, frac.numerador % frac.denominador)
	end

				#Método se debe de poder comprobar si una fracion es menor que otra

 	def <(frac)

	    (@numerador.to_f / @denominador) < (frac.numerador.to_f / frac.denominador)
	end
				#se debe de poder comprobar si una fracion es mayor que otra
	def >(frac)

	    (@numerador.to_f / @denominador) > (frac.numerador.to_f / frac.denominador)
	end
				#se debe de poder comprobar si una fracion es menor o igual que otra

	  def <=(frac)

	    (@numerador.to_f / @denominador) <= (frac.numerador.to_f / frac.denominador)
	end
				#se debe de poder comprobar si una fracion es mayor o igual que otra
	def >=(frac)

	    (@numerador.to_f / @denominador) >= (frac.numerador.to_f / frac.denominador)
	end

	def coerce(frac)
		return self, Fraccion.new(frac,1)
	end

end


text:
var fs = require('fs');
var path = require('path');
var shell = require('shelljs');
var create = require('./create');
var events = require('cordova-common').events;
var ConfigParser = require('cordova-common').ConfigParser;
var CordovaError = require('cordova-common').CordovaError;
var AppxManifest = require('../../template/cordova/lib/AppxManifest');

// updates the cordova.js in project along with the cordova tooling.
module.exports.update = function (destinationDir, options) {
    if (!fs.existsSync(destinationDir)) {
        // if specified project path is not valid then reject promise
        return Promise.reject(new CordovaError('The given path to the project does not exist: ' + destinationDir));
    }

    var projectConfig = path.join(destinationDir, 'config.xml');
    if (!fs.existsSync(projectConfig)) {
        return Promise.reject(new CordovaError('Can\'t update project at ' + destinationDir +
            '. config.xml does not exist in destination directory'));
    }

    var guid;
    var config = new ConfigParser(projectConfig);

    // guid param is used only when adding a platform, and isn't saved anywhere.
    // The only place, where it is being persisted - phone/win10 appxmanifest file,
    // but since win10 introduced just recently, we can't rely on its manifest
    // for old platform versions.
    var manifestPath = path.join(destinationDir, 'package.phone.appxmanifest');
    try {
        guid = AppxManifest.get(manifestPath).getPhoneIdentity().getPhoneProductId();
    } catch (e) { /* ignore IO errors */ }

    shell.rm('-rf', destinationDir);
    return create.create(destinationDir, config, { guid: guid }, events);
};


text:
using System.IO;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;

namespace Microsoft.eShopOnContainers.Services.Identity.API.Certificates
{
    static class Certificate
    {
        public static X509Certificate2 Get()
        {
            var assembly = typeof(Certificate).GetTypeInfo().Assembly;
            var names = assembly.GetManifestResourceNames();

            /***********************************************************************************************
             *  Please note that here we are using a local certificate only for testing purposes. In a
             *  real environment the certificate should be created and stored in a secure way, which is out
             *  of the scope of this project.
             **********************************************************************************************/
            using (var stream = assembly.GetManifestResourceStream("Identity.API.Certificate.idsrv3test.pfx"))
            {
                return new X509Certificate2(ReadStream(stream), "idsrv3test");
            }
        }

        private static byte[] ReadStream(Stream input)
        {
            byte[] buffer = new byte[16 * 1024];
            using (MemoryStream ms = new MemoryStream())
            {
                int read;
                while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
                {
                    ms.Write(buffer, 0, read);
                }
                return ms.ToArray();
            }
        }
    }
}


text:
A [Blockly](https://www.npmjs.com/package/blockly) colour field using HSV sliders for editing.

![A Blockly workspace showing the HSV sliders.](readme-media/hsv_sliders_screenshot.png)

## Installation

### Yarn
```
yarn add @blockly/field-colour-hsv-sliders
```

### npm
```
npm install @blockly/field-colour-hsv-sliders --save
```

## Usage
This plugin adds a field type `FieldColourHsvSliders` that is registered to the name `'field_colour_hsv_sliders'`. This field is an extension of the `Blockly.FieldColour` field and outputs values in the same hexadecimal string format `'#rrggbb'` even though the UI represents the colour in the HSV colour space. See the [Blockly.FieldColour documentation](https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/colour#creation) on what parameters and configurations this field supports, although unlike `Blockly.FieldColour`, this field does not use colour swatches and thus ignores options related to the swatches such as `'colourOptions'`.

The UI also provides an eye dropper button that can be used to take a colour from anywhere on the screen [on supported platforms](https://caniuse.com/?search=eyedropper). Chrome, Edge, and Opera support the eye dropper feature, except [on Chromebooks](https://bugs.chromium.org/p/chromium/issues/detail?id=1348921) and on mobile devices. There is also [a known bug in Chrome on some versions of Linux](https://bugs.chromium.org/p/chromium/issues/detail?id=1227633) where the eye dropper may be visible but does not work correctly.

To use it, you'll need to add this field to a block type definition, and add that block to your toolbox. See below for an example of defining a block type that uses this field.

### JSON

```js
import * as Blockly from 'blockly';
import '@blockly/field-slider';
Blockly.defineBlocksWithJsonArray([
  {
    'type': 'colour_hsv_sliders',
    'message0': 'hsv %1',
    'args0': [
      {
        'type': 'field_colour_hsv_sliders',
        'name': 'COLOUR',
        'colour': '#ff0000'
      }
    ],
    'output': 'Colour',
    'style': 'colour_blocks'
  }
]);
Blockly.JavaScript['colour_hsv_sliders'] = function(block) {
  const code = Blockly.JavaScript.quote_(block.getFieldValue('COLOUR'));
  return [code, Blockly.JavaScript.ORDER_ATOMIC];
};
```

### JavaScript

```js
import * as Blockly from 'blockly';
import {FieldColourHsvSliders} from '@blockly/field-colour-hsv-sliders';
Blockly.Blocks['colour_hsv_sliders'] = {
  init: function () {
    this.appendDummyInput()
      .appendField('hsv ')
      .appendField(new FieldColourHsvSliders('#ff0000'), 'COLOUR');
    this.setOutput(true, 'Colour');
    this.setStyle('colour_blocks');
  }
};
Blockly.JavaScript['colour_hsv_sliders'] = function(block) {
  const code = Blockly.JavaScript.quote_(block.getFieldValue('COLOUR'));
  return [code, Blockly.JavaScript.ORDER_ATOMIC];
};
```

## License

Apache 2.0


text:
namespace NLog.Layouts
{
    using System;
    using System.Linq;
    using System.ComponentModel;
    using System.Text;
    using NLog.Config;
    using NLog.Internal;
    using NLog.Common;
    using System.Collections.Generic;

    /// <summary>
    /// Abstract interface that layouts must implement.
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Justification = "Few people will see this conflict.")]
    [NLogConfigurationItem]
    public abstract class Layout : ISupportsInitialize, IRenderable
    {
        /// <summary>
        /// Is this layout initialized? See <see cref="Initialize(NLog.Config.LoggingConfiguration)"/>
        /// </summary>
        private bool _isInitialized;
        private bool _scannedForObjects;

        /// <summary>
        /// Gets a value indicating whether this layout is thread-agnostic (can be rendered on any thread).
        /// </summary>
        /// <remarks>
        /// Layout is thread-agnostic if it has been marked with [ThreadAgnostic] attribute and all its children are
        /// like that as well.
        ///
        /// Thread-agnostic layouts only use contents of <see cref="LogEventInfo"/> for its output.
        /// </remarks>
        internal bool ThreadAgnostic { get; set; }

        /// <summary>
        /// Gets the level of stack trace information required for rendering.
        /// </summary>
        internal StackTraceUsage StackTraceUsage { get; private set; }

        private const int MaxInitialRenderBufferLength = 16384;
        private int _maxRenderedLength;

        /// <summary>
        /// Gets the logging configuration this target is part of.
        /// </summary>
        protected LoggingConfiguration LoggingConfiguration { get; private set; }

        /// <summary>
        /// Converts a given text to a <see cref="Layout" />.
        /// </summary>
        /// <param name="text">Text to be converted.</param>
        /// <returns><see cref="SimpleLayout"/> object represented by the text.</returns>
        public static implicit operator Layout([Localizable(false)] string text)
        {
            return FromString(text);
        }

        /// <summary>
        /// Implicitly converts the specified string to a <see cref="SimpleLayout"/>.
        /// </summary>
        /// <param name="layoutText">The layout string.</param>
        /// <returns>Instance of <see cref="SimpleLayout"/>.</returns>
        public static Layout FromString(string layoutText)
        {
            return FromString(layoutText, ConfigurationItemFactory.Default);
        }

        /// <summary>
        /// Implicitly converts the specified string to a <see cref="SimpleLayout"/>.
        /// </summary>
        /// <param name="layoutText">The layout string.</param>
        /// <param name="configurationItemFactory">The NLog factories to use when resolving layout renderers.</param>
        /// <returns>Instance of <see cref="SimpleLayout"/>.</returns>
        public static Layout FromString(string layoutText, ConfigurationItemFactory configurationItemFactory)
        {
            return new SimpleLayout(layoutText, configurationItemFactory);
        }

        /// <summary>
        /// Precalculates the layout for the specified log event and stores the result
        /// in per-log event cache.
        ///
        /// Only if the layout doesn't have [ThreadAgnostic] and doens't contain layouts with [ThreadAgnostic].
        /// </summary>
        /// <param name="logEvent">The log event.</param>
        /// <remarks>
        /// Calling this method enables you to store the log event in a buffer
        /// and/or potentially evaluate it in another thread even though the
        /// layout may contain thread-dependent renderer.
        /// </remarks>
        public virtual void Precalculate(LogEventInfo logEvent)
        {
            if (!ThreadAgnostic)
            {
                Render(logEvent);
            }
        }

        /// <summary>
        /// Renders the event info in layout.
        /// </summary>
        /// <param name="logEvent">The event info.</param>
        /// <returns>String representing log event.</returns>
        public string Render(LogEventInfo logEvent)
        {
            if (!_isInitialized)
            {
                Initialize(LoggingConfiguration);
            }

            return GetFormattedMessage(logEvent);
        }

        internal void PrecalculateBuilder(LogEventInfo logEvent, StringBuilder target)
        {
            if (!ThreadAgnostic)
            {
                RenderAppendBuilder(logEvent, target, true);
            }
        }

        /// <summary>
        /// Renders the event info in layout to the provided target
        /// </summary>
        /// <param name="logEvent">The event info.</param>
        /// <param name="target">Appends the string representing log event to target</param>
        /// <param name="cacheLayoutResult">Should rendering result be cached on LogEventInfo</param>
        internal void RenderAppendBuilder(LogEventInfo logEvent, StringBuilder target, bool cacheLayoutResult = false)
        {
            if (!_isInitialized)
            {
                Initialize(LoggingConfiguration);
            }

            if (!ThreadAgnostic)
            {
                string cachedValue;
                if (logEvent.TryGetCachedLayoutValue(this, out cachedValue))
                {
                    target.Append(cachedValue);
                    return;
                }
            }

            cacheLayoutResult = cacheLayoutResult && !ThreadAgnostic;
            using (var localTarget = new AppendBuilderCreator(target, cacheLayoutResult))
            {
                RenderFormattedMessage(logEvent, localTarget.Builder);
                if (cacheLayoutResult)
                {
                    // when needed as it generates garbage
                    logEvent.AddCachedLayoutValue(this, localTarget.Builder.ToString());
                }
            }
        }

        /// <summary>
        /// Valid default implementation of <see cref="GetFormattedMessage" />, when having implemented the optimized <see cref="RenderFormattedMessage"/>
        /// </summary>
        /// <param name="logEvent">The logging event.</param>
        /// <param name="reusableBuilder">StringBuilder to help minimize allocations [optional].</param>
        /// <param name="cacheLayoutResult">Should rendering result be cached on LogEventInfo</param>
        /// <returns>The rendered layout.</returns>
        internal string RenderAllocateBuilder(LogEventInfo logEvent, StringBuilder reusableBuilder = null, bool cacheLayoutResult = true)
        {
            if (!ThreadAgnostic)
            {
                string cachedValue;
                if (logEvent.TryGetCachedLayoutValue(this, out cachedValue))
                {
                    return cachedValue;
                }
            }

            int initialLength = _maxRenderedLength;
            if (initialLength > MaxInitialRenderBufferLength)
            {
                initialLength = MaxInitialRenderBufferLength;
            }

            var sb = reusableBuilder ?? new StringBuilder(initialLength);
            RenderFormattedMessage(logEvent, sb);
            if (sb.Length > _maxRenderedLength)
            {
                _maxRenderedLength = sb.Length;
            }

            if (cacheLayoutResult && !ThreadAgnostic)
            {
                return logEvent.AddCachedLayoutValue(this, sb.ToString());
            }
            else
            {
                return sb.ToString();
            }
        }

        /// <summary>
        /// Renders the layout for the specified logging event by invoking layout renderers.
        /// </summary>
        /// <param name="logEvent">The logging event.</param>
        /// <param name="target"><see cref="StringBuilder"/> for the result</param>
        protected virtual void RenderFormattedMessage(LogEventInfo logEvent, StringBuilder target)
        {
            target.Append(GetFormattedMessage(logEvent) ?? string.Empty);
        }

        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        void ISupportsInitialize.Initialize(LoggingConfiguration configuration)
        {
            Initialize(configuration);
        }

        /// <summary>
        /// Closes this instance.
        /// </summary>
        void ISupportsInitialize.Close()
        {
            Close();
        }

        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        internal void Initialize(LoggingConfiguration configuration)
        {
            if (!_isInitialized)
            {
                LoggingConfiguration = configuration;
                _isInitialized = true;
                _scannedForObjects = false;

                InitializeLayout();

                if (!_scannedForObjects)
                {
                    InternalLogger.Debug("Initialized Layout done but not scanned for objects");
                    PerformObjectScanning();
                }
            }
        }

        internal void PerformObjectScanning()
        {
            var objectGraphScannerList = ObjectGraphScanner.FindReachableObjects<object>(true, this);

            // determine whether the layout is thread-agnostic
            // layout is thread agnostic if it is thread-agnostic and
            // all its nested objects are thread-agnostic.
            ThreadAgnostic = objectGraphScannerList.All(item => item.GetType().IsDefined(typeof(ThreadAgnosticAttribute), true));

            // determine the max StackTraceUsage, to decide if Logger needs to capture callsite
            StackTraceUsage = StackTraceUsage.None;    // Incase this Layout should implement IUsesStackTrace
            StackTraceUsage = objectGraphScannerList.OfType<IUsesStackTrace>().DefaultIfEmpty().Max(item => item == null ? StackTraceUsage.None : item.StackTraceUsage);

            _scannedForObjects = true;
        }

        /// <summary>
        /// Closes this instance.
        /// </summary>
        internal void Close()
        {
            if (_isInitialized)
            {
                LoggingConfiguration = null;
                _isInitialized = false;
                CloseLayout();
            }
        }

        /// <summary>
        /// Initializes the layout.
        /// </summary>
        protected virtual void InitializeLayout()
        {
            PerformObjectScanning();
        }

        /// <summary>
        /// Closes the layout.
        /// </summary>
        protected virtual void CloseLayout()
        {
        }

        /// <summary>
        /// Renders the layout for the specified logging event by invoking layout renderers.
        /// </summary>
        /// <param name="logEvent">The logging event.</param>
        /// <returns>The rendered layout.</returns>
        protected abstract string GetFormattedMessage(LogEventInfo logEvent);

        /// <summary>
        /// Register a custom Layout.
        /// </summary>
        /// <remarks>Short-cut for registing to default <see cref="ConfigurationItemFactory"/></remarks>
        /// <typeparam name="T"> Type of the Layout.</typeparam>
        /// <param name="name"> Name of the Layout.</param>
        public static void Register<T>(string name)
            where T : Layout
        {
            var layoutRendererType = typeof(T);
            Register(name, layoutRendererType);
        }

        /// <summary>
        /// Register a custom Layout.
        /// </summary>
        /// <remarks>Short-cut for registing to default <see cref="ConfigurationItemFactory"/></remarks>
        /// <param name="layoutType"> Type of the Layout.</param>
        /// <param name="name"> Name of the Layout.</param>
        public static void Register(string name, Type layoutType)
        {
            ConfigurationItemFactory.Default.Layouts
                .RegisterDefinition(name, layoutType);
        }

        internal string ToStringWithNestedItems<T>(IList<T> nestedItems, Func<T, string> nextItemToString)
        {
            if (nestedItems?.Count > 0)
            {
                var nestedNames = nestedItems.Select(c => nextItemToString(c)).ToArray();
                return string.Concat(GetType().Name, "=", string.Join("|", nestedNames));
            }
            return base.ToString();
        }
    }
}


text:
@interface DZGrowTextView : UITextView

@end