text:
Simple NodeJS API to get data from [thebluealliance](https://www.thebluealliance.com)

Note: All methods return Promises, so if you do not know what they are, read [this](https://davidwalsh.name/promises) article before continuing

# Usage

## Installation

```
npm install tba-api-storm
```

## Intialization

The constructor takes in the data needed for the X-TBA-App-Id header, which is needed for the API requests (For more info on thebluealliance RESTful API, see [this](https://www.thebluealliance.com/apidocs))

## Method Overview

Dcoumentation and method calls for API v3 is in the form of docstrings for now.

## Notes

Anyone who upgrades from version 1.0.6 to a newer version, please look at the method signatures for some have changed


text:
package org.gradoop.flink.algorithms.fsm.transactional.tle.functions;

import org.apache.flink.api.common.functions.GroupReduceFunction;
import org.apache.flink.hadoop.shaded.com.google.common.collect.Maps;
import org.apache.flink.util.Collector;
import org.gradoop.flink.model.impl.tuples.WithCount;

import java.util.Map;

/**
 * Creates a map of graph counts per category.
 */
public class CategoryGraphCounts implements
  GroupReduceFunction<WithCount<String>, Map<String, Long>> {

  @Override
  public void reduce(Iterable<WithCount<String>> categoriesWithCount,
    Collector<Map<String, Long>> out) throws Exception {

    Map<String, Long> categoryCounts = Maps.newHashMap();

    for (WithCount<String> categoryWithCount : categoriesWithCount) {

      String category = categoryWithCount.getObject();
      long count = categoryWithCount.getCount();

      Long sum = categoryCounts.get(category);

      if (sum == null) {
        sum = count;
      } else {
        sum += count;
      }

      categoryCounts.put(category, sum);
    }

    out.collect(categoryCounts);
  }
}

redpajama_set_name: RedPajamaGithub


text:
[![Build Status](https://travis-ci.org/GillesRasigade/ptdo.svg?branch=master)](https://travis-ci.org/GillesRasigade/ptdo)

[Code coverage](https://rawgit.com/GillesRasigade/ptdo/master/docs/coverage.html)

[Documentation](http://rawgit.com/GillesRasigade/ptdo/master/docs/)

Just a lab project. Not really useful for now =) !


text:
// Copyright (C) 2011 Vicente J. Botet Escriba
//
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// <boost/thread/mutex.hpp>

// <mutex>

// template <class Mutex>
// class shared_lock
// {
// public:
//     typedef Mutex mutex_type;
//     ...
// };

#include <boost/thread/lock_types.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/lightweight_test.hpp>

int main()
{
  BOOST_STATIC_ASSERT_MSG((boost::is_same<boost::shared_lock<boost::shared_mutex>::mutex_type,
      boost::shared_mutex>::value), "");

  return boost::report_errors();
}


text:
void SSoundCuePalette::Construct(const FArguments& InArgs)
{
	// Auto expand the palette as there's so few nodes
	SGraphPalette::Construct(SGraphPalette::FArguments().AutoExpandActionMenu(true));
}

void SSoundCuePalette::CollectAllActions(FGraphActionListBuilderBase& OutAllActions)
{
	const USoundCueGraphSchema* Schema = GetDefault<USoundCueGraphSchema>();

	FGraphActionMenuBuilder ActionMenuBuilder;

	// Determine all possible actions
	Schema->GetPaletteActions(ActionMenuBuilder);

	//@TODO: Avoid this copy
	OutAllActions.Append(ActionMenuBuilder);
}


text:
define([
    'angular',
    'manufacturer/manufacturer-module-def'
], function (angular, manufacturerModule) {

    'use strict';

    manufacturerModule.controller('ManufacturerListCtrl', [
        '$log', '$filter', 'ManufacturerService', ManufacturerListCtrl]);

    /** @ngInject */
    function ManufacturerListCtrl($log, $filter, ManufacturerService) {

        var vm = this;

        vm.remove = remove;

        init();

        function init() {
            ManufacturerService.list().then(function (manufacturers) {
                vm.manufacturers = manufacturers;
            });
        }

        function remove(manufacturer) {
            ManufacturerService.remove(manufacturer)
                .then(function () {
                    // filter out the deleted object
                    vm.manufacturers = $filter('filter')(vm.manufacturers, {id: '!' + manufacturer.id});
                }, function (response) {
                    // TODO show error message
                    $log.error('error deleting manufacturer');
                });
        }

    }

});


text:
<?php

namespace SleepingOwl\Admin\Display\Column;

class Text extends NamedColumn
{
    /**
     * String constructor.
     *
     * {@inheritdoc}
     */
    public function __construct($name, $label = null)
    {
        parent::__construct($name, $label);
        $this->setHtmlAttribute('class', 'row-string');
    }

    /**
     * @return array
     */
    public function toArray()
    {
        return parent::toArray() + [
            'value'  => $this->getModelValue(),
            'append' => $this->getAppends(),
        ];
    }
}


text:
package com.beecavegames.persistence;

import java.io.Serializable;
import java.lang.reflect.Field;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RequiredArgsConstructor
public class FieldAccessor implements IdAccessor {

	private final Field m;

	@Override
	public Serializable get(Serializable entity) {
		try {
			return (Serializable) m.get(entity);
		} catch (IllegalAccessException | IllegalArgumentException e) {
			log.warn("Error fetching id", e);
			return null;
		}
	}

	@Override
	public String getIdPropertyName() {
		return m.getName();
	}

}


text:
//
// Copyright (c) Microsoft.  All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography;
using System.Text;
// using System.Web.Script.Serialization;
using Microsoft.WindowsAzure.Management.RecoveryServices;
using Microsoft.WindowsAzure.Management.SiteRecovery;
using Microsoft.WindowsAzure.Management.SiteRecovery.Models;
using Microsoft.Azure.Common.Internals;
using Hyak.Common.TransientFaultHandling;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Xml;
using Xunit;
using Microsoft.Azure.Test;
using Newtonsoft.Json;
using Microsoft.Azure.Test.HttpRecorder;

namespace SiteRecovery.Tests
{
    public class SiteRecoveryTestsBase : TestBase
    {
        public static string VaultKey;
        public static string VaultLocation = "Southeast Asia";
        public static string MyCloudService;
        public static string MyVaultName;

        protected static CustomRequestHeaders RequestHeaders = new CustomRequestHeaders
        {
            ClientRequestId = Guid.NewGuid().ToString(),
        };
        protected readonly RecordedDelegationHandler CustomHttpHandler = new RecordedDelegationHandler { StatusCodeToReturn = HttpStatusCode.OK };

        public RecoveryServicesManagementClient GetRecoveryServicesClient(RecordedDelegationHandler handler)
        {
            handler.IsPassThrough = true;
            return this.GetRecoveryServicesManagementClient().WithHandler(handler); ;
        }

        public SiteRecoveryManagementClient GetSiteRecoveryClient(RecordedDelegationHandler handler)
        {
            handler.IsPassThrough = true;
            return this.GetSiteRecoveryManagementClient().WithHandler(handler);
        }

        public string GenerateAgentAuthenticationHeader(string clientRequestId)
        {
            CikTokenDetails cikTokenDetails = new CikTokenDetails();

            DateTime currentDateTime = DateTime.Now;
            currentDateTime = currentDateTime.AddHours(-1);
            cikTokenDetails.NotBeforeTimestamp = TimeZoneInfo.ConvertTimeToUtc(currentDateTime);
            cikTokenDetails.NotAfterTimestamp = cikTokenDetails.NotBeforeTimestamp.AddHours(6);
            cikTokenDetails.ClientRequestId = clientRequestId;
            cikTokenDetails.Version = new Version(1, 2);
            cikTokenDetails.PropertyBag = new Dictionary<string, object>();

            string shaInput = JsonConvert.SerializeObject(cikTokenDetails);

            HMACSHA256 sha = new HMACSHA256(Encoding.UTF8.GetBytes(VaultKey));
            cikTokenDetails.Hmac =
                Convert.ToBase64String(sha.ComputeHash(Encoding.UTF8.GetBytes(shaInput)));
            cikTokenDetails.HashFunction = CikSupportedHashFunctions.HMACSHA256.ToString();

            return JsonConvert.SerializeObject(cikTokenDetails);
        }

        #region CIK

        public class CikTokenDetails
        {
            public DateTime NotBeforeTimestamp { get; set; }
            public DateTime NotAfterTimestamp { get; set; }
            public string ClientRequestId { get; set; }
            public string HashFunction { get; set; }
            public string Hmac { get; set; }
            public Version Version { get; set; }
            public Dictionary<string, object> PropertyBag { get; set; }
            public override string ToString()
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("NotBeforeTimestamp: " + NotBeforeTimestamp);
                sb.AppendLine("NotAfterTimestamp: " + NotAfterTimestamp);
                sb.AppendLine("ClientRequestId: " + ClientRequestId);
                sb.AppendLine("Hmac: " + Hmac);
                return sb.ToString();
            }
        }

        public enum CikSupportedHashFunctions
        {
            HMACSHA256,

            HMACSHA384,

            HMACSHA512
        }

        #endregion

        protected void ValidateResponse(JobResponse response)
        {
            Assert.NotNull(response.Job);
            Assert.NotNull(response.Job.ID);
            Assert.True(response.Job.Errors.Count < 1, "Errors found while doing planned failover operation");
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }

        protected void WaitForJobToComplete(SiteRecoveryManagementClient client, string jobId)
        {
            var responseJob = client.Jobs.Get(jobId, RequestHeaders);
            while (responseJob.Job.StateDescription != "Completed")
            {
                // Sleep for 1 min
                System.Threading.Thread.Sleep(60 * 1000);
                responseJob = client.Jobs.Get(jobId, RequestHeaders);
            }

            Assert.NotEqual(responseJob.Job.State, "Failed");
        }
    }
}


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

namespace GraphToDSCompiler
{
    /// <summary>
    /// A class for CycleExceptions
    /// </summary>
    class HasCycleException : System.ApplicationException
    {
        private List<Node> cycle;
        public HasCycleException(string message, List<Node> cycle)
            : base(message)
        {
            this.cycle = cycle;
        }
    }
}


text:
<!doctype html>

		<title>Zabuun - Learn Egyptian Arabic for English speakers</title>
		<meta name="description" content="">
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/head.php';?>

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/ie8.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/header.php';?>

			<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/side.php';?>

Essays > "Oh, Really?"

						Expand All | Collapse All

"Oh, Really?"

"Well, you keep saying 'oh, really?' like you are challenging what I'm saying," Lisa said. Maggie explained that when she said "oh really", it just meant she found what Lisa was saying interesting and wanted her to elaborate. "Oh, really?" Lisa said before the two friends both burst out laughing

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/footer.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/scripts.php';?>


text:
package de.leanovate.swaggercheck.schema.model

import de.leanovate.swaggercheck.schema.adapter.NodeAdapter

case class IntegerDefinition(
                              format: Option[String],
                              minimum: Option[BigInt],
                              maximum: Option[BigInt]
                            ) extends Definition {
  override def validate[T](schema: Schema, path: JsonPath, node: T)
                          (implicit nodeAdapter: NodeAdapter[T]): ValidationResult = {
    nodeAdapter.asInteger(node) match {
      case Some(value) =>
        if (minimum.exists(_ > value))
          ValidationResult.error(s"'$value' has to be greater than ${minimum.mkString} in path $path")
        else if (maximum.exists(_ < value))
          ValidationResult.error(s"'$value' has to be less than ${maximum.mkString} in path $path")
        else
          format.flatMap(schema.findIntegerFormat).map(_.validate(path, value)).getOrElse(ValidationResult.success)
      case _ =>
        ValidationResult.error(s"$node should be an integer in path $path")

    }
  }
}


text:
package com.fireball1725.skeleton.common.util;

import com.fireball1725.skeleton.ModInfo;
import com.fireball1725.skeleton.common.blocks.BlockBase;
import com.fireball1725.skeleton.common.items.ItemBase;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;

import java.util.Locale;

public class RegistrationHelper {
    public static Block registerBlock(Class<? extends Block> blockClass) {
        return registerBlock(blockClass, ItemBlock.class);
    }

    public static Block registerBlock(Class<? extends Block> blockClass, Class<? extends ItemBlock> itemBlockClass) {
        Block block = null;
        ItemBlock itemBlock;
        String internalName;

        try {
            block = blockClass.getConstructor().newInstance();
            itemBlock = itemBlockClass.getConstructor(Block.class).newInstance(block);

            internalName = ((BlockBase) block).getInternalName();

            if (!internalName.equals(internalName.toLowerCase(Locale.US)))
                throw new IllegalArgumentException(String.format("Unlocalized names need to be all lowercase! Item: %s", internalName));

            if (internalName.isEmpty())
                throw new IllegalArgumentException(String.format("Unlocalized name cannot be blank! Item: %s", blockClass.getCanonicalName()));

            block.setRegistryName(ModInfo.MOD_ID, internalName);
            block.setUnlocalizedName(internalName);
            itemBlock.setRegistryName(block.getRegistryName());

            GameRegistry.register(block);
            GameRegistry.register(itemBlock);

            if (block instanceof IBlockRenderer && Platform.isClient()) {
                ((IBlockRenderer) block).registerBlockRenderer();
                ((IBlockRenderer) block).registerBlockItemRenderer();
            }

            LogHelper.info(String.format("Registered block (%s)", blockClass.getCanonicalName()));
        } catch (Exception ex) {
            LogHelper.fatal(String.format("Fatal Error while registering block (%s)", blockClass.getCanonicalName()));
            ex.printStackTrace();
        }

        return block;
    }

    public static Item registerItem(Class<? extends Item> itemClass) {
        Item item = null;
        String internalName;

        try {
            item = itemClass.getConstructor().newInstance();

            internalName = ((ItemBase) item).getInternalName();

            if (!internalName.equals(internalName.toLowerCase(Locale.US)))
                throw new IllegalArgumentException(String.format("Unlocalized names need to be all lowercase! Item: %s", internalName));

            if (internalName.isEmpty())
                throw new IllegalArgumentException(String.format("Unlocalized name cannot be blank! Item: %s", itemClass.getCanonicalName()));

            item.setRegistryName(ModInfo.MOD_ID, internalName);
            item.setUnlocalizedName(internalName);

            GameRegistry.register(item);

            if (item instanceof IItemRenderer && Platform.isClient()) {
                ((IItemRenderer) item).registerItemRenderer();
            }

            LogHelper.info(String.format("Registered item (%s)", itemClass.getCanonicalName()));
        } catch (Exception ex) {
            LogHelper.fatal(String.format("Fatal Error while registering item (%s)", itemClass.getCanonicalName()));
            ex.printStackTrace();
        }

        return item;
    }
}


text:
package com.force.five.app.domain;

public class SalarySheets {

    private Long clientId;

    private String month;

    private String year;

    public Long getClientId() {
        return clientId;
    }

    public void setClientId(Long clientId) {
        this.clientId = clientId;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    @Override
    public String toString() {
        return "SalarySheets{" +
            "clientId=" + clientId +
            ", month='" + month + '\'' +
            ", year='" + year + '\'' +
            '}';
    }
}


text:
#include "private/gc_priv.h"

/*
 * We maintain several hash tables of hblks that have had false hits.
 * Each contains one bit per hash bucket;  If any page in the bucket
 * has had a false hit, we assume that all of them have.
 * See the definition of page_hash_table in gc_private.h.
 * False hits from the stack(s) are much more dangerous than false hits
 * from elsewhere, since the former can pin a large object that spans the
 * block, even though it does not start on the dangerous block.
 */

/*
 * Externally callable routines are:

 * GC_add_to_black_list_normal
 * GC_add_to_black_list_stack
 * GC_promote_black_lists
 * GC_is_black_listed
 *
 * All require that the allocator lock is held.
 */

/* Pointers to individual tables.  We replace one table by another by   */
/* switching these pointers.                                            */
STATIC word * GC_old_normal_bl = NULL;
                /* Nonstack false references seen at last full          */
                /* collection.                                          */
STATIC word * GC_incomplete_normal_bl = NULL;
                /* Nonstack false references seen since last            */
                /* full collection.                                     */
STATIC word * GC_old_stack_bl = NULL;
STATIC word * GC_incomplete_stack_bl = NULL;

STATIC word GC_total_stack_black_listed = 0;
                        /* Number of bytes on stack blacklist.  */

GC_INNER word GC_black_list_spacing = MINHINCR * HBLKSIZE;
                        /* Initial rough guess. */

STATIC void GC_clear_bl(word *);

GC_INNER void GC_default_print_heap_obj_proc(ptr_t p)
{
    ptr_t base = GC_base(p);
    GC_err_printf("start: %p, appr. length: %ld", base,
                  (unsigned long)GC_size(base));
}

GC_INNER void (*GC_print_heap_obj)(ptr_t p) = GC_default_print_heap_obj_proc;

#ifdef PRINT_BLACK_LIST
STATIC void GC_print_source_ptr(ptr_t p)
{
    ptr_t base = GC_base(p);
    if (0 == base) {
        if (0 == p) {
            GC_err_printf("in register");
        } else {
            GC_err_printf("in root set");
        }
    } else {
        GC_err_printf("in object at ");
        /* FIXME: We can't call the debug version of GC_print_heap_obj  */
        /* (with PRINT_CALL_CHAIN) here because the lock is held and    */
        /* the world is stopped.                                        */
        GC_default_print_heap_obj_proc(base);
    }
}
#endif

GC_INNER void GC_bl_init_no_interiors(void)
{
  if (GC_incomplete_normal_bl == 0) {
    GC_old_normal_bl = (word *)GC_scratch_alloc(sizeof(page_hash_table));
    GC_incomplete_normal_bl = (word *)GC_scratch_alloc(
                                                  sizeof(page_hash_table));
    if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) {
      GC_err_printf("Insufficient memory for black list\n");
      EXIT();
    }
    GC_clear_bl(GC_old_normal_bl);
    GC_clear_bl(GC_incomplete_normal_bl);
  }
}

GC_INNER void GC_bl_init(void)
{
    if (!GC_all_interior_pointers) {
      GC_bl_init_no_interiors();
    }
    GC_old_stack_bl = (word *)GC_scratch_alloc(sizeof(page_hash_table));
    GC_incomplete_stack_bl = (word *)GC_scratch_alloc(sizeof(page_hash_table));
    if (GC_old_stack_bl == 0 || GC_incomplete_stack_bl == 0) {
        GC_err_printf("Insufficient memory for black list\n");
        EXIT();
    }
    GC_clear_bl(GC_old_stack_bl);
    GC_clear_bl(GC_incomplete_stack_bl);
}

STATIC void GC_clear_bl(word *doomed)
{
    BZERO(doomed, sizeof(page_hash_table));
}

STATIC void GC_copy_bl(word *old, word *new)
{
    BCOPY(old, new, sizeof(page_hash_table));
}

static word total_stack_black_listed(void);

/* Signal the completion of a collection.  Turn the incomplete black    */
/* lists into new black lists, etc.                                     */
GC_INNER void GC_promote_black_lists(void)
{
    word * very_old_normal_bl = GC_old_normal_bl;
    word * very_old_stack_bl = GC_old_stack_bl;

    GC_old_normal_bl = GC_incomplete_normal_bl;
    GC_old_stack_bl = GC_incomplete_stack_bl;
    if (!GC_all_interior_pointers) {
      GC_clear_bl(very_old_normal_bl);
    }
    GC_clear_bl(very_old_stack_bl);
    GC_incomplete_normal_bl = very_old_normal_bl;
    GC_incomplete_stack_bl = very_old_stack_bl;
    GC_total_stack_black_listed = total_stack_black_listed();
    if (GC_print_stats == VERBOSE)
        GC_log_printf("%ld bytes in heap blacklisted for interior pointers\n",
                      (unsigned long)GC_total_stack_black_listed);
    if (GC_total_stack_black_listed != 0) {
        GC_black_list_spacing =
                HBLKSIZE*(GC_heapsize/GC_total_stack_black_listed);
    }
    if (GC_black_list_spacing < 3 * HBLKSIZE) {
        GC_black_list_spacing = 3 * HBLKSIZE;
    }
    if (GC_black_list_spacing > MAXHINCR * HBLKSIZE) {
        GC_black_list_spacing = MAXHINCR * HBLKSIZE;
        /* Makes it easier to allocate really huge blocks, which otherwise */
        /* may have problems with nonuniform blacklist distributions.      */
        /* This way we should always succeed immediately after growing the */
        /* heap.                                                           */
    }
}

GC_INNER void GC_unpromote_black_lists(void)
{
    if (!GC_all_interior_pointers) {
      GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl);
    }
    GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl);
}

/* P is not a valid pointer reference, but it falls inside      */
/* the plausible heap bounds.                                   */
/* Add it to the normal incomplete black list if appropriate.   */
#ifdef PRINT_BLACK_LIST
  GC_INNER void GC_add_to_black_list_normal(word p, ptr_t source)
#else
  GC_INNER void GC_add_to_black_list_normal(word p)
#endif
{
  if (GC_modws_valid_offsets[p & (sizeof(word)-1)]) {
    word index = PHT_HASH((word)p);

    if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_normal_bl, index)) {
#     ifdef PRINT_BLACK_LIST
        if (!get_pht_entry_from_index(GC_incomplete_normal_bl, index)) {
          GC_err_printf("Black listing (normal) %p referenced from %p ",
                        (ptr_t)p, source);
          GC_print_source_ptr(source);
          GC_err_puts("\n");
        }
#     endif
      set_pht_entry_from_index(GC_incomplete_normal_bl, index);
    } /* else this is probably just an interior pointer to an allocated */
      /* object, and isn't worth black listing.                         */
  }
}

/* And the same for false pointers from the stack. */
#ifdef PRINT_BLACK_LIST
  GC_INNER void GC_add_to_black_list_stack(word p, ptr_t source)
#else
  GC_INNER void GC_add_to_black_list_stack(word p)
#endif
{
  word index = PHT_HASH((word)p);

  if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_stack_bl, index)) {
#   ifdef PRINT_BLACK_LIST
      if (!get_pht_entry_from_index(GC_incomplete_stack_bl, index)) {
        GC_err_printf("Black listing (stack) %p referenced from %p ",
                      (ptr_t)p, source);
        GC_print_source_ptr(source);
        GC_err_puts("\n");
      }
#   endif
    set_pht_entry_from_index(GC_incomplete_stack_bl, index);
  }
}

/*
 * Is the block starting at h of size len bytes black listed?   If so,
 * return the address of the next plausible r such that (r, len) might not
 * be black listed.  (R may not actually be in the heap.  We guarantee only
 * that every smaller value of r after h is also black listed.)
 * If (h,len) is not black listed, return 0.
 * Knows about the structure of the black list hash tables.
 */
struct hblk * GC_is_black_listed(struct hblk *h, word len)
{
    word index = PHT_HASH((word)h);
    word i;
    word nblocks;

    if (!GC_all_interior_pointers
        && (get_pht_entry_from_index(GC_old_normal_bl, index)
            || get_pht_entry_from_index(GC_incomplete_normal_bl, index))) {
      return (h+1);
    }

    nblocks = divHBLKSZ(len);
    for (i = 0;;) {
        if (GC_old_stack_bl[divWORDSZ(index)] == 0
            && GC_incomplete_stack_bl[divWORDSZ(index)] == 0) {
            /* An easy case */
          i += WORDSZ - modWORDSZ(index);
        } else {
          if (get_pht_entry_from_index(GC_old_stack_bl, index)
              || get_pht_entry_from_index(GC_incomplete_stack_bl, index)) {
            return(h+i+1);
          }
          i++;
        }
        if (i >= nblocks) break;
        index = PHT_HASH((word)(h+i));
    }
    return(0);
}

/* Return the number of blacklisted blocks in a given range.    */
/* Used only for statistical purposes.                          */
/* Looks only at the GC_incomplete_stack_bl.                    */
STATIC word GC_number_stack_black_listed(struct hblk *start,
                                         struct hblk *endp1)
{
    register struct hblk * h;
    word result = 0;

    for (h = start; h < endp1; h++) {
        word index = PHT_HASH((word)h);

        if (get_pht_entry_from_index(GC_old_stack_bl, index)) result++;
    }
    return(result);
}

/* Return the total number of (stack) black-listed bytes. */
static word total_stack_black_listed(void)
{
    register unsigned i;
    word total = 0;

    for (i = 0; i < GC_n_heap_sects; i++) {
        struct hblk * start = (struct hblk *) GC_heap_sects[i].hs_start;
        struct hblk * endp1 = start + GC_heap_sects[i].hs_bytes/HBLKSIZE;

        total += GC_number_stack_black_listed(start, endp1);
    }
    return(total * HBLKSIZE);
}


text:
<?php

namespace WellCommerce\Bundle\CatalogBundle\Manager;

use WellCommerce\Bundle\CoreBundle\Manager\AbstractManager;

/**
 * Class ProductStatusManager
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
final class ProductStatusManager extends AbstractManager
{
}


text:
package com.github.vvv1559.algorithms.leetcode.arrays;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;

public class RotateArrayTest {

    private int[] arr;
    private int[] arrEven;
    private int[] arrLongEven;
    private RotateArray rotateArray;

    @BeforeEach
    public void setUp() {
        arr = new int[]{1, 2, 3, 4, 5, 6, 7};
        arrEven = new int[]{-1, -100, 3, 99};
        arrLongEven = new int[]{1, 2, 3, 4, 5, 6};
        rotateArray = new RotateArray();
    }

    @Test
    public void rotateOne() {
        rotateArray.rotate(arr, 1);
        assertArrayEquals(new int[]{7, 1, 2, 3, 4, 5, 6}, arr);
    }

    @Test
    public void rotateLenPlusOne() {
        rotateArray.rotate(arr, 8);
        assertArrayEquals(new int[]{7, 1, 2, 3, 4, 5, 6}, arr);
    }

    @Test
    public void rotateTwo() {
        rotateArray.rotate(arr, 2);
        assertArrayEquals(new int[]{6, 7, 1, 2, 3, 4, 5}, arr);
    }

    @Test
    public void rotateThree() {
        rotateArray.rotate(arr, 3);
        assertArrayEquals(new int[]{5, 6, 7, 1, 2, 3, 4}, arr);
    }

    @Test
    public void rotateEvenOne() {
        rotateArray.rotate(arrEven, 1);
        assertArrayEquals(new int[]{99, -1, -100, 3}, arrEven);
    }

    @Test
    public void rotateEvenHalf() {
        rotateArray.rotate(arrEven, 2);
        assertArrayEquals(new int[]{3, 99, -1, -100}, arrEven);
    }

    @Test
    public void rotateLongEvenTwo() {
        rotateArray.rotate(arrLongEven, 2);
        assertArrayEquals(new int[]{5, 6, 1, 2, 3, 4}, arrLongEven);
    }

    @Test
    public void rotateLongEvenThree() {
        rotateArray.rotate(arrLongEven, 3);
        assertArrayEquals(new int[]{4, 5, 6, 1, 2, 3}, arrLongEven);
    }

    @Test
    public void rotateLongEvenFour() {
        rotateArray.rotate(arrLongEven, 4);
        assertArrayEquals(new int[]{3, 4, 5, 6, 1, 2}, arrLongEven);
    }
}


text:
<?php /** @noinspection PhpIllegalPsrClassPathInspection */

/**
 * Copyright (c) 2020, Nosto Solutions Ltd
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors
 * may be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * @author Nosto Solutions Ltd <shopware@nosto.com>
 * @copyright Copyright (c) 2020 Nosto Solutions Ltd (http://www.nosto.com)
 * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
 */

use Nosto\NostoException;
use Nosto\Operation\OrderConfirm as NostoOrderConfirmation;
use Shopware\Models\Attribute\Order as OrderAttribute;
use Shopware\Models\Order\Order as OrderModel;
use Shopware_Plugins_Frontend_NostoTagging_Components_Account as NostoComponentAccount;
use Shopware_Plugins_Frontend_NostoTagging_Components_Model_Order as NostoOrderModel;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;

/**
 * Order confirmation component. Used to send order information to Nosto.
 *
 * @package Shopware
 * @subpackage Plugins_Frontend
 */
class Shopware_Plugins_Frontend_NostoTagging_Components_Order_Confirmation
{
    /**
     * Sends an order confirmation API call to Nosto for an order.
     *
     * @param OrderModel $order the order model.
     *
     * @throws NostoException
     * @throws NostoException
     * @see Shopware_Plugins_Frontend_NostoTagging_Bootstrap::onPostUpdateOrder
     * @suppress PhanUndeclaredMethod
     */
    public function sendOrder(OrderModel $order)
    {
        try {
            $shop = Shopware()->Shop();
        } catch (ServiceNotFoundException $e) {
            $shop = $order->getShop();
            // Shopware throws an exception if service does not exist.
            // This would be the case when using Shopware API or cli
        } catch (Exception $e) {
            /** @noinspection PhpUndefinedMethodInspection */
            Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error($e->getMessage());
            return;
        }
        if ($shop === null) {
            return;
        }
        $account = NostoComponentAccount::findAccount($shop);
        if ($account !== null) {
            $nostoAccount = NostoComponentAccount::convertToNostoAccount($account);
            if ($nostoAccount->isConnectedToNosto()) {
                /** @noinspection BadExceptionsProcessingInspection */
                try {
                    $attribute = Shopware()
                        ->Models()
                        ->getRepository('\Shopware\Models\Attribute\Order')
                        ->findOneBy(array('orderId' => $order->getId()));
                    $customerId = null;
                    if ($attribute instanceof OrderAttribute
                        && method_exists($attribute, 'getNostoCustomerId')
                    ) {
                        $customerId = $attribute->getNostoCustomerId();
                    }
                    $model = new NostoOrderModel();
                    $model->loadData($order);
                    $orderConfirmation = new NostoOrderConfirmation($nostoAccount);
                    $orderConfirmation->send($model, $customerId);
                } catch (Exception $e) {
                    /** @noinspection PhpUndefinedMethodInspection */
                    Shopware()->Plugins()->Frontend()->NostoTagging()->getLogger()->error(
                        sprintf("Nosto order update upsert failed. Message was: %s",
                            $e->getMessage()
                        )
                    );
                }
            }
        }
    }
}


text:
using System;
using UnityEngine;

namespace QFramework
{
    public enum ActionStatus
    {
        NotStart,
        Started,
        Finished,
    }

    public interface IActionController
    {
        bool Paused { get; set; }
        void Reset();
        void Deinit();
    }

    public interface IAction<TStatus> : IActionController
    {
        TStatus Status { get; set; }
        void OnStart();
        void OnExecute(float dt);
        void OnFinish();

        bool Deinited { get; set; }

    }

    public interface IAction : IAction<ActionStatus>
    {
    }

    public static class IActionExtensions
    {
        public static IActionController Start(this IAction self, MonoBehaviour monoBehaviour,
            Action<IAction> onFinish = null)
        {
            return monoBehaviour.ExecuteByUpdate(self, onFinish);
        }

        public static IActionController Start(this IAction self, MonoBehaviour monoBehaviour,
            Action onFinish)
        {
            return monoBehaviour.ExecuteByUpdate(self, _ => onFinish());
        }

        public static IActionController StartGlobal(this IAction self, Action<IAction> onFinish = null)
        {
            IActionExecutor executor = null;
            if (executor.UpdateAction(self, 0, onFinish)) return self;

            void Update()
            {
                if (executor.UpdateAction(self, Time.deltaTime, onFinish))
                {
                    ActionKit.OnUpdate.UnRegister(Update);
                }
            }

            ActionKit.OnUpdate.Register(Update);

            return self;
        }

        public static void Pause(this IActionController self)
        {
            self.As<IAction>().Paused = true;
        }

        public static void Resume(this IActionController self)
        {
            self.As<IAction>().Paused = false;
        }

        public static void Finish(this IAction self)
        {
            self.Status = ActionStatus.Finished;
        }

        public static bool Execute(this IAction self, float dt)
        {
            if (self.Status == ActionStatus.NotStart)
            {
                self.OnStart();

                if (self.Status == ActionStatus.Finished)
                {
                    self.OnFinish();
                    return true;
                }

                self.Status = ActionStatus.Started;
            }
            else if (self.Status == ActionStatus.Started)
            {
                self.OnExecute(dt);

                if (self.Status == ActionStatus.Finished)
                {
                    self.OnFinish();
                    return true;
                }
            }
            else if (self.Status == ActionStatus.Finished)
            {
                self.OnFinish();
                return true;
            }

            return false;
        }
    }
}


text:
package org.springframework.boot.devtools.autoconfigure;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.junit.Test;
import org.mockito.InOrder;

import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

/**
 * Tests for {@link DevToolsDataSourceAutoConfiguration}.
 *
 * @author Andy Wilkinson
 */
public class DevToolsDataSourceAutoConfigurationTests {

	@Test
	public void embeddedDatabaseIsNotShutDown() throws SQLException {
		ConfigurableApplicationContext context = createContextWithDriver("org.h2.Driver",
				EmbeddedDatabaseConfiguration.class);
		DataSource dataSource = context.getBean(DataSource.class);
		context.close();
		verify(dataSource, times(0)).getConnection();
	}

	@Test
	public void externalDatabaseIsNotShutDown() throws SQLException {
		ConfigurableApplicationContext context = createContextWithDriver(
				"org.postgresql.Driver", DataSourceConfiguration.class);
		DataSource dataSource = context.getBean(DataSource.class);
		context.close();
		verify(dataSource, times(0)).getConnection();
	}

	@Test
	public void nonEmbeddedInMemoryDatabaseIsShutDown() throws SQLException {
		ConfigurableApplicationContext context = createContextWithDriver("org.h2.Driver",
				DataSourceConfiguration.class);
		DataSource dataSource = context.getBean(DataSource.class);
		Connection connection = mock(Connection.class);
		given(dataSource.getConnection()).willReturn(connection);
		Statement statement = mock(Statement.class);
		given(connection.createStatement()).willReturn(statement);
		context.close();
		verify(statement).execute("SHUTDOWN");
	}

	@Test
	public void nonEmbeddedInMemoryDatabaseConfiguredWithDriverIsShutDown()
			throws SQLException {
		ConfigurableApplicationContext context = createContextWithDriver("org.h2.Driver",
				DataSourceConfiguration.class);
		DataSource dataSource = context.getBean(DataSource.class);
		Connection connection = mock(Connection.class);
		given(dataSource.getConnection()).willReturn(connection);
		Statement statement = mock(Statement.class);
		given(connection.createStatement()).willReturn(statement);
		context.close();
		verify(statement).execute("SHUTDOWN");
	}

	@Test
	public void nonEmbeddedInMemoryDatabaseConfiguredWithUrlIsShutDown()
			throws SQLException {
		ConfigurableApplicationContext context = createContextWithUrl("jdbc:h2:mem:test",
				DataSourceConfiguration.class);
		DataSource dataSource = context.getBean(DataSource.class);
		Connection connection = mock(Connection.class);
		given(dataSource.getConnection()).willReturn(connection);
		Statement statement = mock(Statement.class);
		given(connection.createStatement()).willReturn(statement);
		context.close();
		verify(statement).execute("SHUTDOWN");
	}

	@Test
	public void configurationBacksOffWithoutDataSourceProperties() throws SQLException {
		ConfigurableApplicationContext context = createContext("org.h2.Driver",
				NoDataSourcePropertiesConfiguration.class);
		assertThat(context.getBeansOfType(DevToolsDataSourceAutoConfiguration.class))
				.isEmpty();
	}

	@Test
	public void entityManagerFactoryIsClosedBeforeDatabaseIsShutDown()
			throws SQLException {
		ConfigurableApplicationContext context = createContextWithUrl("jdbc:h2:mem:test",
				DataSourceConfiguration.class, EntityManagerFactoryConfiguration.class);
		DataSource dataSource = context.getBean(DataSource.class);
		Connection connection = mock(Connection.class);
		given(dataSource.getConnection()).willReturn(connection);
		Statement statement = mock(Statement.class);
		given(connection.createStatement()).willReturn(statement);
		EntityManagerFactory entityManagerFactory = context
				.getBean(EntityManagerFactory.class);
		context.close();
		InOrder inOrder = inOrder(statement, entityManagerFactory);
		inOrder.verify(statement).execute("SHUTDOWN");
		inOrder.verify(entityManagerFactory).close();
	}

	private ConfigurableApplicationContext createContextWithDriver(String driver,
			Class<?>... classes) {
		return createContext("spring.datasource.driver-class-name:" + driver, classes);
	}

	private ConfigurableApplicationContext createContextWithUrl(String url,
			Class<?>... classes) {
		return createContext("spring.datasource.url:" + url, classes);
	}

	private ConfigurableApplicationContext createContext(String property,
			Class<?>... classes) {
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
		context.register(classes);
		context.register(DevToolsDataSourceAutoConfiguration.class);
		EnvironmentTestUtils.addEnvironment(context, property);
		context.refresh();
		return context;
	}

	@Configuration
	@EnableConfigurationProperties(DataSourceProperties.class)
	static class EmbeddedDatabaseConfiguration {

		@Bean
		public EmbeddedDatabase embeddedDatabase() {
			return mock(EmbeddedDatabase.class);
		}
	}

	@Configuration
	@EnableConfigurationProperties(DataSourceProperties.class)
	static class DataSourceConfiguration {

		@Bean
		public DataSource dataSource() {
			return mock(DataSource.class);
		}

	}

	@Configuration
	static class NoDataSourcePropertiesConfiguration {

		@Bean
		public DataSource dataSource() {
			return mock(DataSource.class);
		}

	}

	@Configuration
	static class EntityManagerFactoryConfiguration {

		@Bean
		public EntityManagerFactory entityManagerFactory() {
			return mock(EntityManagerFactory.class);
		}
	}

}