text:
<!DOCTYPE html>

   <title>The JMockit Tutorial - Reflection-based utilities</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <link rel="stylesheet" type="text/css" href="../prettify.css"/>
   <link rel="shortcut icon" type="image/x-icon" href="../favicon.ico"/>

   Reflection-based utilities

   The utility methods described in this chapter are all static and stateless.
   They are defined in the mockit.Deencapsulation class.
   In the end, these methods simply wrap some of the standard functionality available in the Java
   Reflection API in
   a more convenient, higher-level API.
   As such, they can be used in all kinds of tests, not just those which use the JMockit mocking APIs.

   <map name="figure1">
      <area shape="rect" coords="1,1,163,34" href="../javadoc/mockit/Deencapsulation.html">
   </map>

   To avoid the need to separately import these methods when using the behavior-based mocking API, identical methods are
   directly available inside expectation and verification blocks (see the
   relevant section in that chapter).
   Therefore, this class is only used outside expectation/verification blocks, in tests written with the
   state-based mocking API, or in "pure" JUnit/TestNG tests.

   The following test class will be used for example tests in the sub-sections that follow:

import static mockit.Deencapsulation.*;

public final class DeencapsulationTest
{
   final SubClass anInstance = new SubClass();

   static class BaseClass
   {
      protected int baseInt;
      protected String baseString;
      protected Set<Boolean> baseSet;
   }

   static final class SubClass extends BaseClass
   {
      private static StringBuilder buffer;
      private static char static1;
      private static char static2;

      private int intField;
      private int intField2;
      private String stringField;
      private List<String> listField;

      private SubClass() { intField = -1; }
      private SubClass(int a, String b) { intField = a; stringField = b; }
      private SubClass(String... args) { listField = Arrays.asList(args); }

      private long aMethod() { return 567L; }
      private static Boolean anStaticMethod() { return true; }
      private void instanceMethod(short s, String str, Boolean b) {}
      private static void staticMethod(short s, String str, Boolean b) {}

      private final class InnerClass
      {
         InnerClass() {}
         InnerClass(boolean b, Long l, String s) {}
      }
   }

   // example tests
}

   Getting/setting fields by name or type

   The getField and setField methods, for which there are several
   overloads (variations with different parameters), can be used to access instance and static fields.
   The field to be read or assigned can be specified in two ways: by name or by type.
   In the case of instance fields, the field may be declared in any class along the hierarchy, not
   just in the concrete class of the given owner instance.
   The following example tests should clarify the semantics of these methods and their variations.

   @Test
   public void getSetFieldByName()
   {
      // Get instance fields:
      Integer intValue = getField(anInstance, "intField");
      List<String> listValue = getField(anInstance, "listField");

      // Get static fields:
      StringBuilder b = getField(SubClass.class, "buffer");

      // Set instance fields:
      setField(anInstance, "intField2", 901);

      // Set static fields:
      setField(SubClass.class, "buffer", new StringBuilder());
   }

   @Test
   public void getSetFieldByType()
   {
      // Get instance fields:
      String stringValue = getField(anInstance, String.class);
      List<String> listValue = getField(anInstance, List.class);
      Set<Boolean> setValue = getField(anInstance, HashSet.class);
      getField(anInstance, int.class); // ambiguous: will throw an IllegalArgumentException

      // Get static fields:
      StringBuilder b = getField(SubClass.class, StringBuilder.class);

      // Set instance fields:
      setField(anInstance, "Test"); // will set SubClass#stringField, not BaseClass#baseString
      setField(anInstance, 901); // ambiguous: will throw an IllegalArgumentException

      // Set static fields:
      setField(SubClass.class, new StringBuilder());
      setField(SubClass.class, 'A'); // ambiguous: will throw an IllegalArgumentException
   }

   Access through fields by name is safe, as there is no possibility for ambiguity in the case of
   instance fields declared in multiple classes related by inheritance.
   The same doesn't apply for access by type, since different classes in the hierarchy may declare
   fields of the same type but with different names.
   If an attempt is made to access such a field by its type, an exception will be thrown.

   Invoking non-accessible methods

   There are only two utility methods for invoking non-accessible methods: one for instance methods
   and another for static methods.
   In both cases, the name of the method to be invoked is specified in a string.
   The invocation arguments, one for each declared parameter of the target method, are passed
   through a "varargs" parameter of the utility method:

   @Test
   public void invokeMethod()
   {
      // Instance methods:
      Long l = invoke(anInstance, "aMethod");
      String s = invoke(anInstance, "instanceMethod", (short) 7, "abc", true);

      // Static methods:
      Boolean b = invoke(SubClass.class, "anStaticMethod");
      Object result = invoke(SubClass.class, "staticMethod", (short) 7, "abc", true);
   }

   The parameter types for a method are not explicitly specified.
   Instead, they are inferred from the given argument values.
   A null argument value, therefore, cannot be passed directly as it not allow the
   correct parameter type to be inferred.
   It can be specified indirectly, though, by passing the Class object for the
   correct parameter type instead.
   If the target class (or a super-class in the case of an instance method) has multiple overloads
   for the same method name, then the best match will be chosen based on the parameter types
   inferred from the given argument values.

   Creating instances through non-accessible constructors

   Non-public classes, or classes with no accessible constructors, can be instantiated through
   newInstance and newInnerInstance methods.
   The constructor arguments are passed in the same way as we saw above for method invocations, with the same parameter
   inference rules.

   @Test
   public void newInstance()
   {
      // Instances of top-level or non-inner nested classes:
      SubClass instance = newInstance(SubClass.class.getName());
      SubClass instance2 = newInstance("DeencapsulationTest$Subclass", 1, "XYZ");

      // Instances of inner classes:
      SubClass.InnerClass innerInstance = newInnerInstance("InnerClass", anInstance);
      SubClass.InnerClass innerInstance2 = newInnerInstance("InnerClass", anInstance, true, 5L, "");
   }

   Note that to create an "inner instance" only the simple name of the inner class must be specified.
   The "outer" class is specified through the required owner instance (the second parameter).

redpajama_set_name: RedPajamaGithub


text:
<?php
/*!
* HybridAuth
* http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth
*  (c) 2009-2015 HybridAuth authors | hybridauth.sourceforge.net/licenses.html
*/

/**
 * Hybrid_Providers_Dribbble
 */
class Hybrid_Providers_Dribbble extends Hybrid_Provider_Model_OAuth2
{

	public $scope = "";

	/**
	* IDp wrappers initializer
	*/
	function initialize()
	{
		parent::initialize();

		// Provider api end-points
		$this->api->api_base_url  = "https://api.dribbble.com/v1/";
		$this->api->authorize_url = "https://dribbble.com/oauth/authorize";
		$this->api->token_url     = "https://dribbble.com/oauth/token";
	}

	/**
	* load the user profile from the IDp api client
	*/
	function getUserProfile()
	{

		$data = $this->api->get( "user" );

		if ( ! isset( $data->id ) ) {
			throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
		}

		$this->user->profile->identifier  = @ $data->id;
		$this->user->profile->username    = @ $data->username;
		$this->user->profile->displayName = @ $data->name;
		$this->user->profile->photoURL    = @ $data->avatar_url;
		$this->user->profile->profileURL  = @ $data->html_url;
		$this->user->profile->description = @ $data->bio;
		$this->user->profile->location    = @ $data->location;
		$this->user->profile->webSiteURL  = @ $data->links->web;

		if ( ! $this->user->profile->displayName ) {
			$this->user->profile->displayName = @ $data->username;
		}

		return $this->user->profile;
	}

}


text:
#include "CppUTest/TestHarness.h"
#include "CppUTest/MemoryLeakDetector.h"
#include "CppUTest/TestMemoryAllocator.h"
#include "CppUTest/PlatformSpecificFunctions.h"
#include "CppUTest/TestHarness_c.h"

extern "C"
{

void CHECK_EQUAL_C_BOOL_LOCATION(int expected, int actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertEquals(!!expected != !!actual, expected ? "true" : "false", actual ? "true" : "false", text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_INT_LOCATION(int expected, int actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertLongsEqual((long)expected, (long)actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_UINT_LOCATION(unsigned int expected, unsigned int actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertUnsignedLongsEqual((unsigned long)expected, (unsigned long)actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_LONG_LOCATION(long expected, long actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertLongsEqual(expected, actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_ULONG_LOCATION(unsigned long expected, unsigned long actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertUnsignedLongsEqual(expected, actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_LONGLONG_LOCATION(cpputest_longlong expected, cpputest_longlong actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertLongLongsEqual(expected, actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_ULONGLONG_LOCATION(cpputest_ulonglong expected, cpputest_ulonglong actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertUnsignedLongLongsEqual(expected, actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_REAL_LOCATION(double expected, double actual, double threshold, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertDoublesEqual(expected, actual, threshold, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_CHAR_LOCATION(char expected, char actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertEquals(((expected) != (actual)), StringFrom(expected).asCharString(), StringFrom(actual).asCharString(), text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

extern void CHECK_EQUAL_C_UBYTE_LOCATION(unsigned char expected, unsigned char actual, const char* text, const char* fileName, int lineNumber)\
{
    UtestShell::getCurrent()->assertEquals(((expected) != (actual)),StringFrom((int)expected).asCharString(), StringFrom((int) actual).asCharString(), text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_SBYTE_LOCATION(char signed expected, signed char actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertEquals(((expected) != (actual)),StringFrom((int)expected).asCharString(), StringFrom((int) actual).asCharString(), text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_STRING_LOCATION(const char* expected, const char* actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertCstrEqual(expected, actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void CHECK_EQUAL_C_POINTER_LOCATION(const void* expected, const void* actual, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertPointersEqual(expected, actual, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

extern void CHECK_EQUAL_C_BITS_LOCATION(unsigned int expected, unsigned int actual, unsigned int mask, size_t size, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertBitsEqual(expected, actual, mask, size, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

void FAIL_TEXT_C_LOCATION(const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->fail(text,  fileName, lineNumber, TestTerminatorWithoutExceptions());
} // LCOV_EXCL_LINE

void FAIL_C_LOCATION(const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->fail("",  fileName, lineNumber, TestTerminatorWithoutExceptions());
} // LCOV_EXCL_LINE

void CHECK_C_LOCATION(int condition, const char* conditionString, const char* text, const char* fileName, int lineNumber)
{
    UtestShell::getCurrent()->assertTrue(condition != 0, "CHECK_C", conditionString, text, fileName, lineNumber, TestTerminatorWithoutExceptions());
}

enum { NO_COUNTDOWN = -1, OUT_OF_MEMORRY = 0 };
static int malloc_out_of_memory_counter = NO_COUNTDOWN;
static int malloc_count = 0;

void cpputest_malloc_count_reset(void)
{
    malloc_count = 0;
}

int cpputest_malloc_get_count()
{
    return malloc_count;
}

void cpputest_malloc_set_out_of_memory()
{
    setCurrentMallocAllocator(NullUnknownAllocator::defaultAllocator());
}

void cpputest_malloc_set_not_out_of_memory()
{
    malloc_out_of_memory_counter = NO_COUNTDOWN;
    setCurrentMallocAllocatorToDefault();
}

void cpputest_malloc_set_out_of_memory_countdown(int count)
{
    malloc_out_of_memory_counter = count;
    if (malloc_out_of_memory_counter == OUT_OF_MEMORRY)
        cpputest_malloc_set_out_of_memory();
}

void* cpputest_malloc(size_t size)
{
    return cpputest_malloc_location(size, "<unknown>", 0);
}

char* cpputest_strdup(const char* str)
{
    return cpputest_strdup_location(str, "<unknown>", 0);
}

char* cpputest_strndup(const char* str, size_t n)
{
    return cpputest_strndup_location(str, n, "<unknown>", 0);
}

void* cpputest_calloc(size_t num, size_t size)
{
    return cpputest_calloc_location(num, size, "<unknown>", 0);
}

void* cpputest_realloc(void* ptr, size_t size)
{
    return cpputest_realloc_location(ptr, size, "<unknown>", 0);
}

void cpputest_free(void* buffer)
{
    cpputest_free_location(buffer, "<unknown>", 0);
}

static void countdown()
{
    if (malloc_out_of_memory_counter <= NO_COUNTDOWN)
        return;

    if (malloc_out_of_memory_counter == OUT_OF_MEMORRY)
        return;

    malloc_out_of_memory_counter--;

    if (malloc_out_of_memory_counter == OUT_OF_MEMORRY)
        cpputest_malloc_set_out_of_memory();
}

void* cpputest_malloc_location(size_t size, const char* file, int line)
{
    countdown();
    malloc_count++;
    return cpputest_malloc_location_with_leak_detection(size, file, line);
}

static size_t test_harness_c_strlen(const char * str)
{
    size_t n = 0;
    while (*str++) n++;
    return n;
}

static char* strdup_alloc(const char * str, size_t size, const char* file, int line)
{
    char* result = (char*) cpputest_malloc_location(size, file, line);
    PlatformSpecificMemCpy(result, str, size);
    result[size-1] = '\0';
    return result;
}

char* cpputest_strdup_location(const char * str, const char* file, int line)
{
    size_t length = 1 + test_harness_c_strlen(str);
    return strdup_alloc(str, length, file, line);
}

char* cpputest_strndup_location(const char * str, size_t n, const char* file, int line)
{
    size_t length = test_harness_c_strlen(str);
    length = length < n ? length : n;
    length = length + 1;
    return strdup_alloc(str, length, file, line);
}

void* cpputest_calloc_location(size_t num, size_t size, const char* file, int line)
{
    void* mem = cpputest_malloc_location(num * size, file, line);
    if (mem)
        PlatformSpecificMemset(mem, 0, num*size);
    return mem;
}

void* cpputest_realloc_location(void* memory, size_t size, const char* file, int line)
{
    return cpputest_realloc_location_with_leak_detection(memory, size, file, line);
}

void cpputest_free_location(void* buffer, const char* file, int line)
{
    cpputest_free_location_with_leak_detection(buffer, file, line);
}

}


text:
using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Linq;
using System.Threading.Tasks;

using Demo.ADTProcessing.Core;
using Demo.ADTProcessing.Router.RabbitMQ;

using MassTransit;

using RabbitMQ.Client;

namespace Demo.ADTProcessing.Router
{
    public class AccountSequenceCompletedEventConsumer : IConsumer<IAccountSequenceCompletedEvent>
    {
        private readonly IConnection _connection;
        private readonly IConsole _console;
        private readonly IAccountSequenceNotifier _accountSequenceNotifier;
        private readonly ISendEndpoint _workerEndpoint;
        private readonly NameValueCollection _appSettings = ConfigurationManager.AppSettings;

        public AccountSequenceCompletedEventConsumer(IConnection connection, IConsole console, IAccountSequenceNotifier accountSequenceNotifier, ISendEndpoint workerEndpoint)
        {
            _connection = connection;
            _console = console;
            _accountSequenceNotifier = accountSequenceNotifier;
            _workerEndpoint = workerEndpoint;
        }

        public Task Consume(ConsumeContext<IAccountSequenceCompletedEvent> context)
        {
            try
            {
                using (var channel = _connection.CreateModel())
                {
                    var address = new Uri(context.Message.QueueAddress);
                    var queueName = address.Segments.Last();
                    var queue = channel.QueueDeclarePassive(queueName);

                    if (queue.MessageCount == 0)
                    {
                        if (Program.Queues.ContainsKey(context.Message.QueueAddress))
                        {
                            lock (Lock.SyncRoot)
                            {
                                DeleteQueue(context.Message.QueueAddress);

                                string queueAddress;
                                while (Program.Queues.TryRemove(context.Message.QueueAddress, out queueAddress) == false)
                                {
                                }
                            }
                        }
                    }
                    else
                    {
                        //var busHostUri = _appSettings["busHostUri"];
                        //var workerQueueName = _appSettings["workerQueueName"];
                        //var workerQueueUri = new Uri($"{busHostUri}/{workerQueueName}");

                        try
                        {
                            _accountSequenceNotifier.NotifyWorkers(context, context.Message.QueueAddress).Wait();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            throw;
                        }
                    }

                    channel.Close(200, "Ok");
                }

                return Task.Factory.StartNew(() => _console.WriteLine($"{context.Message.QueueAddress}"));
            }
            catch (Exception ex)
            {
                _console.WriteLine("AccountSequenceCompletedEventConsumer::" + ex.Message);
                throw;
            }

        }

        private void DeleteQueue(string addressUrl)
        {
            using (var channel = _connection.CreateModel())
            {
                var name = RabbitMqEndpointAddress.Parse(addressUrl).Name;
                channel.QueueDelete(name);
                channel.ExchangeDelete(name);
                channel.Close(200, "ok");
            }
        }
    }
}


text:
package org.apache.tinkerpop.gremlin.hadoop.structure.hdfs;

import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertex;
import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.InputFormat;

import java.io.IOException;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public final class HadoopVertexIterator extends HadoopElementIterator<Vertex> {

    private HadoopVertex nextVertex = null;

    public HadoopVertexIterator(final HadoopGraph graph) throws IOException {
        super(graph);
    }

    @Override
    public Vertex next() {
        try {
            if (this.nextVertex != null) {
                final Vertex temp = this.nextVertex;
                this.nextVertex = null;
                return temp;
            } else {
                while (!this.readers.isEmpty()) {
                    if (this.readers.peek().nextKeyValue())
                        return new HadoopVertex(this.readers.peek().getCurrentValue().get(), this.graph);
                    else
                        this.readers.remove();
                }
            }
            throw FastNoSuchElementException.instance();
        } catch (final Exception e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }

    @Override
    public boolean hasNext() {
        try {
            if (null != this.nextVertex) return true;
            else {
                while (!this.readers.isEmpty()) {
                    if (this.readers.peek().nextKeyValue()) {
                        this.nextVertex = new HadoopVertex(this.readers.peek().getCurrentValue().get(), this.graph);
                        return true;
                    } else
                        this.readers.remove();
                }
            }
        } catch (final Exception e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
        return false;
    }
}


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

namespace Tachycardia
{
    abstract class GameObject
    {
        public abstract void Update();
    }
}


text:
#pragma once
#include <aws/email/SES_EXPORTS.h>
#include <aws/email/SESRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/email/model/EventDestination.h>
#include <utility>

namespace Aws
{
namespace SES
{
namespace Model
{

  /**
   *
Represents a request to update the event destination of a configuration set.
   * Configuration sets enable you to publish email sending events. For information
   * about using configuration sets, see the Amazon
   * SES Developer Guide.

See Also:
   AWS
   * API Reference

   */
  class AWS_SES_API UpdateConfigurationSetEventDestinationRequest : public SESRequest
  {
  public:
    UpdateConfigurationSetEventDestinationRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "UpdateConfigurationSetEventDestination"; }

    Aws::String SerializePayload() const override;

  protected:
    void DumpBodyToUrl(Aws::Http::URI& uri ) const override;

  public:

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to update.

     */
    inline const Aws::String& GetConfigurationSetName() const{ return m_configurationSetName; }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to update.

     */
    inline void SetConfigurationSetName(const Aws::String& value) { m_configurationSetNameHasBeenSet = true; m_configurationSetName = value; }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to update.

     */
    inline void SetConfigurationSetName(Aws::String&& value) { m_configurationSetNameHasBeenSet = true; m_configurationSetName = std::move(value); }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to update.

     */
    inline void SetConfigurationSetName(const char* value) { m_configurationSetNameHasBeenSet = true; m_configurationSetName.assign(value); }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to update.

     */
    inline UpdateConfigurationSetEventDestinationRequest& WithConfigurationSetName(const Aws::String& value) { SetConfigurationSetName(value); return *this;}

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to update.

     */
    inline UpdateConfigurationSetEventDestinationRequest& WithConfigurationSetName(Aws::String&& value) { SetConfigurationSetName(std::move(value)); return *this;}

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to update.

     */
    inline UpdateConfigurationSetEventDestinationRequest& WithConfigurationSetName(const char* value) { SetConfigurationSetName(value); return *this;}

    /**
     *
The event destination object that you want to apply to the specified
     * configuration set.

     */
    inline const EventDestination& GetEventDestination() const{ return m_eventDestination; }

    /**
     *
The event destination object that you want to apply to the specified
     * configuration set.

     */
    inline void SetEventDestination(const EventDestination& value) { m_eventDestinationHasBeenSet = true; m_eventDestination = value; }

    /**
     *
The event destination object that you want to apply to the specified
     * configuration set.

     */
    inline void SetEventDestination(EventDestination&& value) { m_eventDestinationHasBeenSet = true; m_eventDestination = std::move(value); }

    /**
     *
The event destination object that you want to apply to the specified
     * configuration set.

     */
    inline UpdateConfigurationSetEventDestinationRequest& WithEventDestination(const EventDestination& value) { SetEventDestination(value); return *this;}

    /**
     *
The event destination object that you want to apply to the specified
     * configuration set.

     */
    inline UpdateConfigurationSetEventDestinationRequest& WithEventDestination(EventDestination&& value) { SetEventDestination(std::move(value)); return *this;}

  private:

    Aws::String m_configurationSetName;
    bool m_configurationSetNameHasBeenSet;

    EventDestination m_eventDestination;
    bool m_eventDestinationHasBeenSet;
  };

} // namespace Model
} // namespace SES
} // namespace Aws


text:
#include <vector>
#include <ostream>
#include <map>
#include <string>

// Number of events, signal, etc., in the ABCD regions.
struct ABCD {
	double A, B, C, D;
};

// Allow use to refer to regions directly instead of by numbers.
enum Region {
	A = 0, B = 1, C = 2, D = 3
};

// For signal, the number of events is also associated with a lifetime.
struct signal_lifetime {
	ABCD signalEvents;
	double lifetime;
	std::vector<double> efficiency; // A, B, C, D efficiencies for the sample
};

// Control how the limit is actually run
struct abcd_limit_config {
	bool useToys; // True if we should run toys, otherwise run asym fit.
	bool scaleLimitByEfficiency; // True if we should run limit once, and rescale result. False we re-run limit at each lifetime point.
	std::string fileName; // Output filename for this
	double rescaleSignalTo; // How to rescale region A during the limit setting
	int nToys; // How many toys to run if using the toy method
	std::map<std::string, double> systematic_errors;
	double luminosity; // Lumi in fb that we are looking at
};

// Result (and input parameters) from a limit.
struct limit_result {
	ABCD observed_data;
	signal_lifetime signal;
	// Expected limit numbers.
	// TODO: Rename to something more clear.
	double cl_95;
	double cl_p1sigma;
	double cl_p2sigma;
	double cl_n1sigma;
	double cl_n2sigma;

	// Actual limit.
	double cl_limit;
};

// Some output operators to make debugging/dumping a little easier.

inline std::ostream &operator<< (std::ostream &s, const ABCD &v)
{
	s << "(" << v.A << ", " << v.B << ", " << v.C << ", " << v.D << ")";
	return s;
}

inline std::ostream &operator<< (std::ostream &s, const signal_lifetime &v)
{
	s << "(ctau=" << v.lifetime << ", events=" << v.signalEvents << ")";
	return s;
}

inline std::ostream &operator<< (std::ostream &s, const limit_result &r)
{
	s << "Obs: " << r.observed_data << " sig: " << r.signal
		<< " limit: " << r.cl_limit
		<< " 95%: " << r.cl_95 << " 1s+" << r.cl_p1sigma << "-" << r.cl_n1sigma
		<< " 2s+" << r.cl_p2sigma << "-" << r.cl_n2sigma;

	return s;
}

#endif


text:
<?php
namespace Bixev\ORM;

class Collection implements \ArrayAccess, \Countable, \Iterator
{

    /**
     * @var array
     */
    protected $_content = [];

    /**
     * @var int
     */
    protected $_iteratorPosition = 0;

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

    const STORE_METHOD_OBJECT = 1;
    const STORE_METHOD_ROW = 2;
    const STORE_METHOD_ID = 3;
    const STORE_METHOD_DEFAULT = 1;

    static protected $_allowedStoreMethods = [1, 2, 3];

    /**
     * @var AbstractModel
     */
    protected $_className;

    /**
     * @param string $className
     * @param string $storeMethod
     * @throws \Exception
     */
    public function __construct($className, $storeMethod = null)
    {
        $this->setClass($className);
        $this->setStoreMethod($storeMethod);
    }

    //###############################//
    //#####     ArrayAccess     #####//
    public function offsetExists($offset)
    {
        return isset($this->_content[$offset]);
    }

    public function offsetGet($offset)
    {
        if (!isset($this->_content[$offset])) {
            return null;
        }

        return $this->convertFromStore($this->_content[$offset]);
    }

    public function offsetSet($offset, $value)
    {
        $value = $this->getRecordObject($value);
        if (!($value instanceof $this->_className)) {
            throw new Exception(__METHOD__ . ' : Value is not instanceof : ' . $this->_className);
        }
        if (!$value->isValid()) {
            throw new Exception(__METHOD__ . ' : Value is not a valid instance of : ' . $this->_className);
        }

        $value = $this->convertToStore($value);

        if (!$this->contains($value) || $this->search($value) === $offset) {
            if ($offset === null) {
                $this->_content[] = $value;
            } else {
                $this->_content[$offset] = $value;
            }
        } elseif ($offset !== null) {
            throw new \Exception(__METHOD__ . ' : offset given and element already in collection');
        }
    }

    public function offsetUnset($offset)
    {
        if (isset($this->_content[$offset])) {
            unset($this->_content[$offset]);
            if ($this->_iteratorPosition > 0) {
                $this->_iteratorPosition--;
            }
        }
    }
    //#####   end ArrayAccess   #####//
    //###############################//
    //#############################//
    //#####     Countable     #####//
    public function count()
    {
        return count($this->_content);
    }
    //#####   end Countable   #####//
    //#############################//
    //############################//
    //#####     Iterator     #####//
    public function rewind()
    {
        $this->_iteratorPosition = 0;
    }

    public function current()
    {
        return $this->convertFromStore($this->_content[$this->_iteratorPosition]);
    }

    public function key()
    {
        return $this->_iteratorPosition;
    }

    public function next()
    {
        ++$this->_iteratorPosition;
    }

    public function valid()
    {
        return isset($this->_content[$this->_iteratorPosition]);
    }
    //#####     end Iterator     #####//
    //################################//

    /**
     * Checks whether the collection contains a specific key/index.
     *
     * @param mixed $key The key to check for.
     * @return boolean true if the given key/index exists, false otherwise.
     */
    public function containsKey($key)
    {
        return isset($this->_content[$key]);
    }

    /**
     * Checks whether the given element is contained in the collection.
     * Only element values are compared, not keys. The comparison of two elements
     * is strict, that means not only the value but also the type must match.
     * For objects this means reference equality.
     *
     * @param AbstractModel $value
     * @return boolean true if the given element is contained in the collection,
     *          false otherwise.
     */
    public function contains($value)
    {
        if (!$this->isObjectValid($value)) {
            return false;
        }

        if ('\\' . get_class($value) != $this->_className) {
            return false;
        }
        $value = $this->convertToStore($value, static::STORE_METHOD_ROW);

        foreach ($this->_content as $elt) {
            if ($value === $this->convertToStore($elt, static::STORE_METHOD_ROW)) {
                return true;
            }
        }

        return false;
    }

    /**
     * Checks whether the given element is contained in the collection.
     * Only element values are compared, not keys. The comparison of two elements
     * is strict, that means not only the value but also the type must match.
     * For objects this means reference equality.
     *
     * @param AbstractModel $value
     * @return boolean true if the given element is contained in the collection,
     *          false otherwise.
     */
    public function containsById($value)
    {
        if (!$this->isObjectValid($value)) {
            return false;
        }

        if ('\\' . get_class($value) != $this->_className) {
            return false;
        }

        return $this->containsId($value->getId());
    }

    /**
     * Checks whether the given element id is contained in the collection.
     *
     * @param int $id
     * @return boolean true if the given element is contained in the collection,
     *          false otherwise.
     */
    public function containsId($id)
    {
        foreach ($this as $elt) {
            if ($id == $elt->getId()) {
                return true;
            }
        }

        return false;
    }

    /**
     * return the ids of the collection
     *
     * @return int[]
     */
    public function getIds()
    {
        $ids = [];
        foreach ($this as $elt) {
            $ids[] = $elt->getId();
        }

        return $ids;
    }

    /**
     * @param AbstractModel $value
     * @return int offset, false if not found
     */
    public function search($value)
    {
        if (!$this->isObjectValid($value)) {
            return false;
        }

        $value = $this->convertToStore($value);

        foreach ($this->_content as $k => $elt) {
            if ($value === $elt) {
                return $k;
            }
        }

        return false;
    }

    /**
     * Searches for a given element and, if found, returns the corresponding key/index
     * of that element. The comparison of two elements is strict, that means not
     * only the value but also the type must match.
     * For objects this means reference equality.
     *
     * @param AbstractModel $element The element to search for.
     * @return mixed The key/index of the element or false if the element was not found.
     */
    public function indexOf($element)
    {
        $element = $this->getRecordObject($element);
        if (!$this->isObjectValid($element)) {
            return false;
        }

        $value = $this->convertToStore($element);

        foreach ($this->_content as $key => $elt) {
            if ($value === $elt) {
                return $key;
            }
        }

        return false;
    }
    /**
     * like array_slice, extracts subset of data
     *
     * @param int  $offset
     * @param int  $length
     * @param bool $preserve_keys
     *
     * @return static
     */
    public function slice($offset, $length = null, $preserve_keys = true)
    {
        $newData    = new static($this->_className, $this->_storeMethod);
        $newContent = array_slice($this->_content, $offset, $length, $preserve_keys);
        foreach ($newContent as $k => $v) {
            if ($preserve_keys) {
                $newData[$k] = $v;
            } else {
                $newData[] = $v;
            }
        }

        return $newData;
    }

    /**
     * @param AbstractModel $value
     * @return bool
     */
    public function isObjectValid($value)
    {
        $value = $this->getRecordObject($value);

        return $value->isValid();
    }

    public function usort($callback)
    {
        usort($this->_content, $callback);
    }

    /**
     * Ordonne la collection selon un champ de Record
     *
     * @param string $fieldName
     * @param string $order ASC|DESC
     * @throws \Exception
     */
    public function orderBy($fieldName, $order = 'ASC')
    {
        if ($this->_storeMethod != static::STORE_METHOD_OBJECT && $this->_storeMethod != static::STORE_METHOD_ROW) {
            throw new \Exception(
                __METHOD__ . " : Collection doesn't use objects or row - unable to order by field " . $fieldName
            );
        }

        $class = $this->_className;
        $infos = $class::getFieldInfos($fieldName);
        $fieldType = $infos['type'];
        $storeMethod = $this->_storeMethod;

        usort(
            $this->_content,
            function ($a, $b) use ($fieldName, $fieldType, $order, $storeMethod) {
                if ($storeMethod == static::STORE_METHOD_OBJECT) {
                    $valueA = $a->$fieldName;
                    $valueB = $b->$fieldName;
                } else {
                    $valueA = $a[$fieldName];
                    $valueB = $b[$fieldName];
                }
                //'int','bool','str','float','date','dateTime'
                switch ($fieldType) {
                    case'int':
                    case'float':
                    case'bool':
                        if ($valueA > $valueB) {
                            $return = 1;
                        } else {
                            $return = -1;
                        }
                        break;
                    case 'str':
                        $return = strcmp($valueA, $valueB);
                        break;
                    case'date':
                        // compare timestamps
                        preg_match('!([0-9]+)-([0-9]+)-([0-9]+)!si', $valueA, $aMatches);
                        preg_match('!([0-9]+)-([0-9]+)-([0-9]+)!si', $valueB, $bMatches);
                        $d = mktime(0, 0, 0, $aMatches[2], $aMatches[1], $aMatches[3]) - mktime(
                                0,
                                0,
                                0,
                                $bMatches[2],
                                $bMatches[1],
                                $bMatches[3]
                            );
                        if ($d > 0) {
                            $return = 1;
                        } else {
                            $return = -1;
                        }
                        break;
                    case'dateTime':
                        // compare timestamps
                        preg_match('!([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+)!si', $valueA, $aMatches);
                        preg_match('!([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+)!si', $valueB, $bMatches);
                        $d = mktime(
                                $aMatches[4],
                                $aMatches[5],
                                $aMatches[6],
                                $aMatches[2],
                                $aMatches[1],
                                $aMatches[3]
                            ) - mktime(
                                $bMatches[4],
                                $bMatches[5],
                                $bMatches[6],
                                $bMatches[2],
                                $bMatches[1],
                                $bMatches[3]
                            );
                        if ($d > 0) {
                            $return = 1;
                        } else {
                            $return = -1;
                        }
                        break;
                    default:
                        throw new \Exception(__METHOD__ . ' : unknown fieldType : ' . $fieldType);
                        break;
                }

                // inverse order ?
                if ($order == 'DESC') {
                    $return = -$return;
                }

                return $return;
            }
        );
    }

    /**
     * @param array $row
     */
    public function addByRow($row)
    {
        $class = $this->_className;
        $this[] = new $class('row', $row);
    }

    /**
     * @param int $id
     */
    public function addById($id)
    {
        $class = $this->_className;
        $this[] = new $class('id', $id);
    }

    /**
     * @param int $storeMethod
     * @return bool
     */
    protected function isStoreMethodValid($storeMethod)
    {
        return (array_search($storeMethod, static::$_allowedStoreMethods) !== false);
    }

    /**
     * @param null $storeMethod
     * @throws \Exception
     */
    public function setStoreMethod($storeMethod = null)
    {
        $storeMethod = $storeMethod ? $storeMethod : static::STORE_METHOD_DEFAULT;

        if (!$this->isStoreMethodValid($storeMethod)) {
            throw new Exception(__METHOD__ . ' : Unknown storeMethod : ' . $storeMethod);
        }

        if ($storeMethod == $this->_storeMethod) {
            return;
        } elseif ($storeMethod == static::STORE_METHOD_OBJECT) {
            foreach ($this->_content as $key => $elt) {
                $this->_content[$key] = $this->convertFromStore($elt);
            }
        } elseif ($storeMethod == static::STORE_METHOD_ROW) {
            foreach ($this->_content as $key => $elt) {
                $this->_content[$key] = $this->convertFromStore($elt)->getRow();
            }
        } else {
            foreach ($this->_content as $key => $elt) {
                $this->_content[$key] = $this->convertFromStore($elt)->getId();
            }
        }

        $this->_storeMethod = $storeMethod;
    }

    protected function setClass($class)
    {
        if (!class_exists($class)) {
            throw new \Exception(__METHOD__ . ' : Unknown model className : ' . $class);
        }
        $this->_className = $class;
    }

    /**
     * @param $value
     * @return bool
     * @throws \Exception
     */
    public function remove($value)
    {
        $value = $this->getRecordObject($value);
        if (!$this->isObjectValid($value)) {
            return false;
        }

        $value = $this->convertToStore($value);

        foreach ($this->_content as $key => $elt) {
            if ($value === $elt) {
                unset($this->_content[$key]);
                if ($this->_iteratorPosition > 0) {
                    $this->_iteratorPosition--;
                }

                return true;
            }
        }

        return false;
    }

    /**
     * @return AbstractModel
     */
    public function getModelClass()
    {
        return $this->_className;
    }

    /**
     * @param Collection $collection
     * @throws \Exception
     */
    public function merge($collection)
    {
        if (get_class($collection) != __CLASS__ || $this->getModelClass() != $collection->getModelClass()) {
            throw new \Exception(__METHOD__ . " : Collection to merge does not match");
        }

        foreach ($collection as $elt) {
            $this[] = $elt;
        }
    }

    /**
     * @param Collection $collection
     * @return array|static
     * @throws \Exception
     */
    public function diff($collection)
    {
        if (get_class($collection) != __CLASS__ || $this->getModelClass() != $collection->getModelClass()) {
            throw new \Exception(__METHOD__ . " : Collection to merge does not match");
        }

        $newCollection = new static($this->_className, $this->_storeMethod);
        foreach ($this as $elt) {
            if (!$collection->contains($elt)) {
                $newCollection[] = $elt;
            }
        }

        return $newCollection;
    }

    /**
     * get the last element
     *
     * @return AbstractModel
     */
    public function pop()
    {
        $elt = array_pop($this->_content);

        return $this->convertFromStore($elt);
    }

    /**
     * get the first element
     *
     * @return AbstractModel
     */
    public function shift()
    {
        $elt = array_shift($this->_content);

        return $this->convertFromStore($elt);
    }

    /**
     * @param AbstractModel $storedObj
     * @param string $storeMethod
     * @return AbstractModel
     * @throws \Exception
     */
    protected function convertFromStore($storedObj = null, $storeMethod = null)
    {
        $storeMethod = $storeMethod ? $storeMethod : $this->_storeMethod;

        if (!$this->isStoreMethodValid($storeMethod)) {
            throw new Exception(__METHOD__ . ' : Unknown storeMethod : ' . $storeMethod);
        }

        if ($storedObj === null) {
            return null;
        } elseif ($storeMethod == static::STORE_METHOD_OBJECT) {
            return $storedObj;
        } elseif ($storeMethod == static::STORE_METHOD_ROW) {
            $class = $this->_className;

            return new $class('row', $storedObj);
        } else {
            $class = $this->_className;

            return new $class('id', $storedObj);
        }
    }

    /**
     * @param null $obj
     * @param null $storeMethod
     * @return array|AbstractModel|int|null
     * @throws \Exception
     */
    protected function convertToStore($obj = null, $storeMethod = null)
    {
        $storeMethod = $storeMethod ? $storeMethod : $this->_storeMethod;

        if (!$this->isStoreMethodValid($storeMethod)) {
            throw new Exception(__METHOD__ . ' : Unknown storeMethod : ' . $storeMethod);
        }

        if ($obj === null) {
            return null;
        } else {
            $obj = $this->getRecordObject($obj);
            if ($storeMethod == static::STORE_METHOD_OBJECT) {
                return $obj;
            } elseif ($storeMethod == static::STORE_METHOD_ROW) {
                return $obj->getRow();
            } else {
                return $obj->getId();
            }
        }
    }

    /**
     * @param int|array|AbstractModel $obj
     * @return AbstractModel
     */
    protected function getRecordObject($obj = null)
    {
        $class = $this->_className;
        if ($obj === null) {
            $obj = null;
        } elseif (is_int($obj)) {
            $obj = new $class('id', $obj);
        } elseif (is_array($obj)) {
            $obj = new $class('row', $obj);
        } elseif ($obj instanceof $class) {

        } else {
            $obj = null;
        }

        return $obj;
    }
}


text:
<?php
namespace Vivo\Validator;

use Vivo\InputFilter\Condition\ConditionAwareInterface;
use Vivo\Service\Initializer\InputFilterFactoryAwareInterface;

use Zend\InputFilter\Factory as InputFilterFactory;
use Zend\Stdlib\ArrayUtils;
use Zend\Validator\AbstractValidator;

use Traversable;

/**
 * Class Conditional
 * Validates conditionally
 * @package Vivo\validator
 */
class Conditional extends AbstractValidator implements ConditionAwareInterface, InputFilterFactoryAwareInterface
{
    /**
     * Default value of the condition - used when the condition is not set
     * @var boolean
     */
    protected $defaultConditionValue    = true;

    /**
     * Value of the condition
     * @var boolean
     */
    private $conditionValue;

    /**
     * Input filter factory
     * @var InputFilterFactory
     */
    protected $inputFilterFactory;

    /**
     * Perform validation when the validation of the cond field input returns this value
     * When set to true, the actual validation will be performed only when the cond field validation returns true
     * When set to false, the actual validation will be performed only when the cond field validation returns false
     * (When the actual validation is not performed, this validator returns true)
     * @var bool
     */
    protected $validateWhenCondIs   = true;

    /**
     * Input configuration used for the tested value
     * This is the actual input configuration used for validation when the cond input validation returns the value
     * prescribed in $this->validateWhenCondIs
     * @var array
     */
    protected $inputConfig          = array();

    /**
     * Returns true if and only if $value meets the validation requirements
     *
     * If $value fails validation, then this method returns false, and
     * getMessages() will return an array of messages that explain why the
     * validation failed.
     *
     * @param  mixed $value
     * @param $context
     * @throws Exception\InvalidArgumentException
     * @throws Exception\RuntimeException
     * @throws Exception\ConfigException
     * @return bool
     */
    public function isValid($value, $context = null)
    {
        $this->setValue($value);
        if ($this->getConditionValue() === $this->getValidateWhenCondIs()) {
            //Perform validation
            $input  = $this->inputFilterFactory->createInput($this->getInputConfig());
            $input->setValue($value);
            $valid  = $input->isValid($context);
            if (!$valid) {
                $messages   = $input->getMessages();
                $this->abstractOptions['messages']  = $messages;
            }
        } else {
            //Do not perform validation - the input is considered valid
            $valid  = true;
        }
        return $valid;
    }

    /**
     * Sets the input filter factory
     * @param InputFilterFactory $inputFilterFactory
     */
    public function setInputFilterFactory(InputFilterFactory $inputFilterFactory)
    {
        $this->inputFilterFactory   = $inputFilterFactory;
    }

    /**
     * Sets on which cond field validation result the actual validation should be performed
     * @param boolean $validateWhenCondIs
     */
    public function setValidateWhenCondIs($validateWhenCondIs)
    {
        $this->validateWhenCondIs = (bool) $validateWhenCondIs;
    }

    /**
     * Returns on which cond field validation result the actual validation should be performed
     * @return boolean
     */
    public function getValidateWhenCondIs()
    {
        return $this->validateWhenCondIs;
    }

    /**
     * Sets the actual input configuration which should be performed based on the cond validation
     * @param array|Traversable $inputConfig
     * @throws Exception\InvalidArgumentException
     */
    public function setInputConfig($inputConfig)
    {
        if ($inputConfig instanceof Traversable) {
            $inputConfig = ArrayUtils::iteratorToArray($inputConfig);
        }
        if (!is_array($inputConfig)) {
            throw new Exception\InvalidArgumentException(
                sprintf("%s: Input config must be either an array or a Traversable", __METHOD__));
        }
        $this->inputConfig = $inputConfig;
    }

    /**
     * @return array
     */
    public function getInputConfig()
    {
        return $this->inputConfig;
    }

    /**
     * Returns the current condition value
     * @return bool
     */
    public function getConditionValue()
    {
        if (is_null($this->conditionValue)) {
            $this->conditionValue   = $this->defaultConditionValue;
        }
        return $this->conditionValue;
    }

    /**
     * Sets the current value of the condition
     * @param bool $condition
     * @return void
     */
    public function setConditionValue($condition)
    {
        $this->conditionValue   = (bool) $condition;
    }

    /**
     * Sets the default condition value
     * @param boolean $defaultConditionValue
     */
    public function setDefaultConditionValue($defaultConditionValue)
    {
        $this->defaultConditionValue = (bool) $defaultConditionValue;
    }

    /**
     * Returns the default condition value
     * @return boolean
     */
    public function getDefaultConditionValue()
    {
        return $this->defaultConditionValue;
    }
}


text:
package com.netflix.astyanax;

import java.nio.ByteBuffer;
import java.util.Date;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import com.netflix.astyanax.model.ConsistencyLevel;
import com.netflix.astyanax.retry.RetryPolicy;

public interface ColumnMutation {
    ColumnMutation setConsistencyLevel(ConsistencyLevel consistencyLevel);

    ColumnMutation withRetryPolicy(RetryPolicy retry);

    /**
     * Change the default timestamp from the clock with a user supplied timestamp.
     *
     * @param timestamp  Timestamp in microseconds
     * @return
     */
    ColumnMutation withTimestamp(long timestamp);

    Execution<Void> putValue(String value, Integer ttl);

    Execution<Void> putValue(byte[] value, Integer ttl);

    Execution<Void> putValue(byte value, Integer ttl);

    Execution<Void> putValue(short value, Integer ttl);

    Execution<Void> putValue(int value, Integer ttl);

    Execution<Void> putValue(long value, Integer ttl);

    Execution<Void> putValue(boolean value, Integer ttl);

    Execution<Void> putValue(ByteBuffer value, Integer ttl);

    Execution<Void> putValue(Date value, Integer ttl);

    Execution<Void> putValue(float value, Integer ttl);

    Execution<Void> putValue(double value, Integer ttl);

    Execution<Void> putValue(UUID value, Integer ttl);

    <T> Execution<Void> putValue(T value, Serializer<T> serializer, Integer ttl);

    Execution<Void> putEmptyColumn(Integer ttl);

    Execution<Void> incrementCounterColumn(long amount);

    Execution<Void> deleteColumn();

    Execution<Void> deleteCounterColumn();
}


text:
'use strict';
angular.module('bmApp').
    filter('pagination', function () {
        return function (value, offset, limit) {
            if (angular.isDefined(value)) {
                return value.slice(offset, offset + limit);
            }
        }
    });


text:
namespace softdsp {
  namespace proto = boost::proto;
  using proto::argsns_::list2;
  using proto::exprns_::expr;

  template< typename function_type_ >
  class softdsp_context {
  public:
    typedef function_type_ function_type;
    typedef std::shared_ptr< llvm_toolbox< function_type > > toolbox_type;
    typedef softdsp_context< function_type > context_type;
    typedef boost::function_types::result_type< function_type > result_type;
    typedef boost::function_types::parameter_types< function_type > parameter_types;
    softdsp_context(
      const toolbox_type &tools_
    ) : tools( tools_ ) {}
    template< typename Expr, typename Enable = void > struct eval{};
    template< typename Expr > struct eval<
      Expr,
      typename boost::enable_if<
        proto::matches< Expr, proto::terminal< proto::_ > >
      >::type
    > {
      typedef decltype( std::declval< context_type& >().tools->as_value( boost::proto::value( std::declval< Expr& >() ) ) ) result_type;
      result_type operator()( Expr &expr, context_type &context ) {
        return context.tools->as_value( boost::proto::value( expr ) );
      }
    };

SOFTDSP_ENABLE_UNARY_OPERATOR_( dereference )
SOFTDSP_ENABLE_UNARY_OPERATOR_( unary_plus )
SOFTDSP_ENABLE_UNARY_OPERATOR_( negate )
SOFTDSP_ENABLE_UNARY_OPERATOR_( complement )
SOFTDSP_ENABLE_UNARY_OPERATOR_( address_of )
SOFTDSP_ENABLE_UNARY_OPERATOR_( logical_not )
SOFTDSP_ENABLE_UNARY_OPERATOR_( pre_inc )
SOFTDSP_ENABLE_UNARY_OPERATOR_( pre_dec )
SOFTDSP_ENABLE_UNARY_OPERATOR_( post_inc )
SOFTDSP_ENABLE_UNARY_OPERATOR_( post_dec )
SOFTDSP_ENABLE_BINARY_OPERATOR_( plus )
SOFTDSP_ENABLE_BINARY_OPERATOR_( minus )
SOFTDSP_ENABLE_BINARY_OPERATOR_( multiplies )
SOFTDSP_ENABLE_BINARY_OPERATOR_( divides )
SOFTDSP_ENABLE_BINARY_OPERATOR_( modulus )
SOFTDSP_ENABLE_BINARY_OPERATOR_( subscript )
SOFTDSP_ENABLE_BINARY_OPERATOR_( shift_left )
SOFTDSP_ENABLE_BINARY_OPERATOR_( shift_right )
SOFTDSP_ENABLE_BINARY_OPERATOR_( equal_to )
SOFTDSP_ENABLE_BINARY_OPERATOR_( not_equal_to )
SOFTDSP_ENABLE_BINARY_OPERATOR_( less )
SOFTDSP_ENABLE_BINARY_OPERATOR_( less_equal )
SOFTDSP_ENABLE_BINARY_OPERATOR_( greater )
SOFTDSP_ENABLE_BINARY_OPERATOR_( greater_equal )
SOFTDSP_ENABLE_BINARY_OPERATOR_( logical_or )
SOFTDSP_ENABLE_BINARY_OPERATOR_( logical_and )
SOFTDSP_ENABLE_BINARY_OPERATOR_( bitwise_or )
SOFTDSP_ENABLE_BINARY_OPERATOR_( bitwise_and )
SOFTDSP_ENABLE_BINARY_OPERATOR_( bitwise_xor )
SOFTDSP_ENABLE_BINARY_OPERATOR_( comma )
SOFTDSP_ENABLE_BINARY_OPERATOR_( assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( shift_left_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( shift_right_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( multiplies_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( divides_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( modulus_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( plus_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( minus_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( bitwise_and_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( bitwise_or_assign )
SOFTDSP_ENABLE_BINARY_OPERATOR_( bitwise_xor_assign )

#define SOFTDSP_CONTEXT_FUNCTION_PROTO_( z, index, unused ) \
  proto::_

#define SOFTDSP_CONTEXT_FUNCTION_ARGUMENTS_DECLTYPE( z, index, unused ) \
  proto::eval( \
    boost::proto::child< boost::mpl::int_< BOOST_PP_INC( index ) > >( \
      std::declval< Expr& >() \
    ), \
    std::declval< context_type& >() \
  )

#define SOFTDSP_CONTEXT_FUNCTION_ARGUMENTS( z, index, unused ) \
  proto::eval( boost::proto::child< boost::mpl::int_< BOOST_PP_INC( index ) > >( expr ), context )

#define SOFTDSP_CONTEXT_FUNCTION( z, arg_num, unused ) \
  template< \
    class Expr \
  > struct eval< \
    Expr, \
    typename boost::enable_if< \
      proto::matches< Expr, proto::function< BOOST_PP_ENUM( arg_num, SOFTDSP_CONTEXT_FUNCTION_PROTO_, ) > > \
    >::type \
  > { \
    typedef decltype( \
      std::declval< \
        typename decltype( proto::eval( boost::proto::left( std::declval< Expr >() ), std::declval< context_type >() ) ):: \
          template eval< context_type > \
      >()( \
        BOOST_PP_ENUM( BOOST_PP_DEC( arg_num ), SOFTDSP_CONTEXT_FUNCTION_ARGUMENTS_DECLTYPE, ) \
      ) \
    ) result_type; \
    result_type operator()( Expr &expr, context_type &context ) { \
      typedef decltype( proto::eval( boost::proto::left( expr ), context ) ) tag; \
      typename tag:: template eval< context_type > function( context ); \
      return function( \
        BOOST_PP_ENUM( BOOST_PP_DEC( arg_num ), SOFTDSP_CONTEXT_FUNCTION_ARGUMENTS, ) \
      );\
    } \
  };

BOOST_PP_REPEAT_FROM_TO( 1, FUSION_MAX_VECTOR_SIZE, SOFTDSP_CONTEXT_FUNCTION, )

    toolbox_type &get_toolbox() {
      return tools;
    }
    const toolbox_type &get_toolbox() const {
      return tools;
    }
  private:
    const toolbox_type tools;
  };
}

#endif


text:
QtxCore provides extra core classes that are generally useful to Qt applications
and libraries.

## Build

To build a dynamic library:

    $ qmake CONFIG+=dylib
    $ make

To build a static library:

    $ qmake CONFIG+=static
    $ make

## Test

To run the test suite, first configure and build QtxCore as a dynamic library,
which each test executable will link against.  Then invoke the `check` target
to execute all tests in the suite.

    $ qmake CONFIG+=dylib
    $ make
    $ make check

## Documentation

To generate API documentation, invoke the `docs` target.

    $ make docs

To view the documentation, open it in a web browser.

    $ open doc/qtxcore/qtxcore-module.html

## License

[Apache License, Version 2.0](http://opensource.org/licenses/Apache-2.0)

Copyright (c) 2012-2013 Sifteo Inc. <[http://www.sifteo.com/](http://www.sifteo.com/)>


text:
import type {FloatingNodeType, ReferenceType} from '../types';

export function getChildren<RT extends ReferenceType = ReferenceType>(
  nodes: Array<FloatingNodeType<RT>>,
  id: string | undefined
) {
  let allChildren =
    nodes.filter((node) => node.parentId === id && node.context?.open) ?? [];
  let currentChildren = allChildren;

  while (currentChildren.length) {
    currentChildren =
      nodes.filter((node) =>
        currentChildren?.some(
          (n) => node.parentId === n.id && node.context?.open
        )
      ) ?? [];

    allChildren = allChildren.concat(currentChildren);
  }

  return allChildren;
}


text:
'use strict';

const util = require('../util.js');
const handlerCache = require('../handler.cache.js');

/**
 * Extends handle message rapport functionality, adding progress update handling.
 *
 * @param {object} wrappedSocket The wrapped socket to add functionality to.
 */
const extendHandleMessage = (wrappedSocket) => {
    const previousHandleMessage = wrappedSocket._functions.onMessage.handleMessage;

    // Replace the handle message function with one that checks if it's a progress update
    wrappedSocket._functions.onMessage.handleMessage = (standardSocket, wrappedSocket, requestCache, options, msg, handler) => {
        if (util.isObject(msg) && msg._pu) {
            handlerCache.callHandler(msg._pu, msg._b);
        } else {
            previousHandleMessage(standardSocket, wrappedSocket, requestCache, options, msg, handler);
        }
    };
};

/**
 * Extends the rapport responder object, adding a `sendProgressUpdate` function.
 *
 * @param {object} wrappedSocket The wrapped socket to add functionality to.
 */
const extendCreateResponderObject = (wrappedSocket) => {
    const previousCreateResponderObject = wrappedSocket._functions.onMessage.createResponderObject;

    wrappedSocket._functions.onMessage.createResponderObject = (standardSocket, wrappedSocket, requestCache, options, requestId) => {
        const responder = previousCreateResponderObject(standardSocket, wrappedSocket, requestCache, options, requestId);

        responder.sendProgressUpdate = (message) => {
            wrappedSocket.sendProgressUpdate(requestId, message);
        };

        return responder;
    };
};

/**
 * Adds onMessage functionality to a rapport websocket.
 *
 * @param {object} wrappedSocket The websocket to extend.
 */
module.exports = (wrappedSocket) => {
    extendHandleMessage(wrappedSocket);
    extendCreateResponderObject(wrappedSocket);
};


text:
package stdlib

import (
	"database/sql"
	"database/sql/driver"
	"errors"
	"fmt"
	"io"
	"sync"

	"github.com/jackc/pgx"
)

var (
	openFromConnPoolCountMu sync.Mutex
	openFromConnPoolCount   int
)

// oids that map to intrinsic database/sql types. These will be allowed to be
// binary, anything else will be forced to text format
var databaseSqlOids map[pgx.Oid]bool

func init() {
	d := &Driver{}
	sql.Register("pgx", d)

	databaseSqlOids = make(map[pgx.Oid]bool)
	databaseSqlOids[pgx.BoolOid] = true
	databaseSqlOids[pgx.ByteaOid] = true
	databaseSqlOids[pgx.Int2Oid] = true
	databaseSqlOids[pgx.Int4Oid] = true
	databaseSqlOids[pgx.Int8Oid] = true
	databaseSqlOids[pgx.Float4Oid] = true
	databaseSqlOids[pgx.Float8Oid] = true
	databaseSqlOids[pgx.DateOid] = true
	databaseSqlOids[pgx.TimestampTzOid] = true
	databaseSqlOids[pgx.TimestampOid] = true
}

type Driver struct {
	Pool *pgx.ConnPool
}

func (d *Driver) Open(name string) (driver.Conn, error) {
	if d.Pool != nil {
		conn, err := d.Pool.Acquire()
		if err != nil {
			return nil, err
		}

		return &Conn{conn: conn, pool: d.Pool}, nil
	}

	connConfig, err := pgx.ParseConnectionString(name)
	if err != nil {
		return nil, err
	}

	conn, err := pgx.Connect(connConfig)
	if err != nil {
		return nil, err
	}

	c := &Conn{conn: conn}
	return c, nil
}

// OpenFromConnPool takes the existing *pgx.ConnPool pool and returns a *sql.DB
// with pool as the backend. This enables full control over the connection
// process and configuration while maintaining compatibility with the
// database/sql interface. In addition, by calling Driver() on the returned
// *sql.DB and typecasting to *stdlib.Driver a reference to the pgx.ConnPool can
// be reaquired later. This allows fast paths targeting pgx to be used while
// still maintaining compatibility with other databases and drivers.
//
// pool connection size must be at least 2.
func OpenFromConnPool(pool *pgx.ConnPool) (*sql.DB, error) {
	d := &Driver{Pool: pool}

	openFromConnPoolCountMu.Lock()
	name := fmt.Sprintf("pgx-%d", openFromConnPoolCount)
	openFromConnPoolCount++
	openFromConnPoolCountMu.Unlock()

	sql.Register(name, d)
	db, err := sql.Open(name, "")
	if err != nil {
		return nil, err
	}

	// Presumably OpenFromConnPool is being used because the user wants to use
	// database/sql most of the time, but fast path with pgx some of the time.
	// Allow database/sql to use all the connections, but release 2 idle ones.
	// Don't have database/sql immediately release all idle connections because
	// that would mean that prepared statements would be lost (which kills
	// performance if the prepared statements constantly have to be reprepared)
	stat := pool.Stat()

	if stat.MaxConnections <= 2 {
		return nil, errors.New("pool connection size must be at least 3")
	}
	db.SetMaxIdleConns(stat.MaxConnections - 2)
	db.SetMaxOpenConns(stat.MaxConnections)

	return db, nil
}

type Conn struct {
	conn    *pgx.Conn
	pool    *pgx.ConnPool
	psCount int64 // Counter used for creating unique prepared statement names
}

func (c *Conn) Prepare(query string) (driver.Stmt, error) {
	if !c.conn.IsAlive() {
		return nil, driver.ErrBadConn
	}

	name := fmt.Sprintf("pgx_%d", c.psCount)
	c.psCount++

	ps, err := c.conn.Prepare(name, query)
	if err != nil {
		return nil, err
	}

	restrictBinaryToDatabaseSqlTypes(ps)

	return &Stmt{ps: ps, conn: c}, nil
}

func (c *Conn) Close() error {
	if c.pool != nil {
		c.pool.Release(c.conn)
		return nil
	}

	return c.conn.Close()
}

func (c *Conn) Begin() (driver.Tx, error) {
	if !c.conn.IsAlive() {
		return nil, driver.ErrBadConn
	}

	_, err := c.conn.Exec("begin")
	if err != nil {
		return nil, err
	}

	return &Tx{conn: c.conn}, nil
}

func (c *Conn) Exec(query string, argsV []driver.Value) (driver.Result, error) {
	if !c.conn.IsAlive() {
		return nil, driver.ErrBadConn
	}

	args := valueToInterface(argsV)
	commandTag, err := c.conn.Exec(query, args...)
	return driver.RowsAffected(commandTag.RowsAffected()), err
}

func (c *Conn) Query(query string, argsV []driver.Value) (driver.Rows, error) {
	if !c.conn.IsAlive() {
		return nil, driver.ErrBadConn
	}

	ps, err := c.conn.Prepare("", query)
	if err != nil {
		return nil, err
	}

	restrictBinaryToDatabaseSqlTypes(ps)

	return c.queryPrepared("", argsV)
}

func (c *Conn) queryPrepared(name string, argsV []driver.Value) (driver.Rows, error) {
	if !c.conn.IsAlive() {
		return nil, driver.ErrBadConn
	}

	args := valueToInterface(argsV)

	rows, err := c.conn.Query(name, args...)
	if err != nil {
		return nil, err
	}

	return &Rows{rows: rows}, nil
}

// Anything that isn't a database/sql compatible type needs to be forced to
// text format so that pgx.Rows.Values doesn't decode it into a native type
// (e.g. []int32)
func restrictBinaryToDatabaseSqlTypes(ps *pgx.PreparedStatement) {
	for i := range ps.FieldDescriptions {
		intrinsic, _ := databaseSqlOids[ps.FieldDescriptions[i].DataType]
		if !intrinsic {
			ps.FieldDescriptions[i].FormatCode = pgx.TextFormatCode
		}
	}
}

type Stmt struct {
	ps   *pgx.PreparedStatement
	conn *Conn
}

func (s *Stmt) Close() error {
	return s.conn.conn.Deallocate(s.ps.Name)
}

func (s *Stmt) NumInput() int {
	return len(s.ps.ParameterOids)
}

func (s *Stmt) Exec(argsV []driver.Value) (driver.Result, error) {
	return s.conn.Exec(s.ps.Name, argsV)
}

func (s *Stmt) Query(argsV []driver.Value) (driver.Rows, error) {
	return s.conn.queryPrepared(s.ps.Name, argsV)
}

// TODO - rename to avoid alloc
type Rows struct {
	rows *pgx.Rows
}

func (r *Rows) Columns() []string {
	fieldDescriptions := r.rows.FieldDescriptions()
	names := make([]string, 0, len(fieldDescriptions))
	for _, fd := range fieldDescriptions {
		names = append(names, fd.Name)
	}
	return names
}

func (r *Rows) Close() error {
	r.rows.Close()
	return nil
}

func (r *Rows) Next(dest []driver.Value) error {
	more := r.rows.Next()
	if !more {
		if r.rows.Err() == nil {
			return io.EOF
		} else {
			return r.rows.Err()
		}
	}

	values, err := r.rows.Values()
	if err != nil {
		return err
	}

	if len(dest) < len(values) {
		fmt.Printf("%d: %#v\n", len(dest), dest)
		fmt.Printf("%d: %#v\n", len(values), values)
		return errors.New("expected more values than were received")
	}

	for i, v := range values {
		dest[i] = driver.Value(v)
	}

	return nil
}

func valueToInterface(argsV []driver.Value) []interface{} {
	args := make([]interface{}, 0, len(argsV))
	for _, v := range argsV {
		if v != nil {
			args = append(args, v.(interface{}))
		} else {
			args = append(args, nil)
		}
	}
	return args
}

type Tx struct {
	conn *pgx.Conn
}

func (t *Tx) Commit() error {
	_, err := t.conn.Exec("commit")
	return err
}

func (t *Tx) Rollback() error {
	_, err := t.conn.Exec("rollback")
	return err
}


text:
using UnityEngine;
using System.Collections;

public class ScrollBackground : MonoBehaviour {

	public float scrollDevider = 2f;

	private Material mat;

	void Start () {
		mat = GetComponent<MeshRenderer>().material;
	}

	// Update is called once per frame
	void Update () {
		Vector2 materialOffset = mat.mainTextureOffset;

		materialOffset.x = transform.position.x / transform.localScale.x / scrollDevider;
		materialOffset.y = transform.position.y / transform.localScale.y / scrollDevider;

		mat.mainTextureOffset = materialOffset;
	}
}


text:
class Client < ActiveRecord::Base
  validates :name, presence: true, uniqueness: true, length: { minimum: 2 }
  has_many :users

  before_create :generate_key
  before_create :generate_secret

  private

  def generate_key
    # TODO: prevent duplicate key edge case
    self.key = SecureRandom.hex 8
  end

  def generate_secret
    # TODO: prevent duplicate key edge case
    self.secret = SecureRandom.hex 16
  end

end


text:
{
\parindent0pt
\null
\colorlet{mintgreen}{green!50!black!50}

\thispagestyle{empty}
\vskip3cm
\vfill
\hfil
\begin{tikzpicture}[overlay]
\coordinate (front) at (0,0);
\coordinate (horizon) at (0,.31\paperheight);
\coordinate (bottom) at (0,-.6\paperheight);
\coordinate (sky) at (0,.57\paperheight);
\coordinate (left) at (-.51\paperwidth,0);
\coordinate (right) at (.51\paperwidth,0);

\shade [bottom color=blue!30!black!10,top color=blue!30!black!50]
([yshift=-5mm]horizon -|  left) rectangle (sky -| right);
\shade [bottom color=black!70!green!25,top color=black!70!green!10]
(front -| left) -- (horizon -| left)
decorate [decoration=random steps] { -- (horizon -| right) }
-- (front -| right) -- cycle;
\shade [top color=black!70!green!25,bottom color=black!25]
([yshift=-5mm-1pt]front -| left) rectangle ([yshift=1pt]front -| right);
\fill [black!25] (bottom -| left) rectangle ([yshift=-5mm]front -| right);

\def\nodeshadowed[#1]#2;{\node[scale=2,above,#1]{#2};\node[scale=2,above,#1,yscale=-1,scope fading=south,opacity=0.4]{#2};}

\nodeshadowed [at={(-5,5  )},yslant=0.05] {\Huge Ti\textcolor{orange}{\emph{k}}Z};
\nodeshadowed [at={( 0,5.3)}] {\huge \textcolor{mintgreen}{\&}};
\nodeshadowed [at={( 5,5  )},yslant=-0.05] {\Huge \textsc{PGF}};
\nodeshadowed [at={( 0,2  )}] {Manual for Version \pgftypesetversion};

\foreach \i in {0.5,0.6,...,2}
\fill [white,decoration=Koch snowflake,opacity=.9]
[shift=(horizon),shift={(rand*11,rnd*7)},scale=\i]
[double copy shadow={opacity=0.2,shadow xshift=0pt,shadow
yshift=3*\i pt,fill=white,draw=none}]
decorate {
decorate {
decorate {
(0,0) -- ++(60:1) -- ++(-60:1) -- cycle
}
}
};

\node (left text) [text width=.5\paperwidth-2cm,below right,at={(-.5\paperwidth+1cm,-1.5cm)}]
{
\fontfamily{pcr}
\def\textbraceleft{\char`\{}
\def\textbraceright{\char`\}}
\def\textbackslash{\char`\\}
\begin{lstlisting}[basicstyle=\scriptsize\color{black},
keywordstyle=\bfseries\color{white},
identifierstyle=\bfseries\color{black},
keywords={tikzpicture,shade,fill,draw,path,node},
literate={-}{{-}}1]
\begin{tikzpicture}
\coordinate (front) at (0,0);
\coordinate (horizon) at (0,.31\paperheight);
\coordinate (bottom) at (0,-.6\paperheight);
\coordinate (sky) at (0,.57\paperheight);
\coordinate (left) at (-.51\paperwidth,0);
\coordinate (right) at (.51\paperwidth,0);

\shade [bottom color=white,
top color=blue!30!black!50]
([yshift=-5mm]horizon -|  left)
rectangle (sky -| right);

\shade [bottom color=black!70!green!25,
top color=black!70!green!10]
(front -| left) -- (horizon -| left)
decorate [decoration=random steps] {
-- (horizon -| right)  }
-- (front -| right) -- cycle;

\shade [top color=black!70!green!25,
bottom color=black!25]
([yshift=-5mm-1pt]front -| left)
rectangle ([yshift=1pt]front -| right);

\fill [black!25]
(bottom -| left)
rectangle ([yshift=-5mm]front -| right);

\def\nodeshadowed[#1]#2;{
\node[scale=2,above,#1]{#2};
\node[scale=2,above,#1,yscale=-1,
scope fading=south,opacity=0.4]{#2};
}
\end{lstlisting}
};

\node (right text) [text width=.5\paperwidth-2cm,below right,at={(1cm,-1.5cm)}]
{
\fontfamily{pcr}
\def\textbraceleft{\char`\{}
\def\textbraceright{\char`\}}
\def\textbackslash{\char`\\}
\begin{lstlisting}[basicstyle=\scriptsize\color{black},
keywordstyle=\bfseries\color{white},
identifierstyle=\bfseries\color{black},
keywords={tikzpicture,shade,fill,draw,path,node},
literate={-}{{-}}1]
\nodeshadowed [at={(-5,8  )},yslant=0.05]
{\Huge Ti\textcolor{orange}{\emph{k}}Z};
\nodeshadowed [at={( 0,8.3)}]
{\huge \textcolor{green!50!black!50}{\&}};
\nodeshadowed [at={( 5,8  )},yslant=-0.05]
{\Huge \textsc{PGF}};
\nodeshadowed [at={( 0,5  )}]
{Manual for Version \pgftypesetversion};

\foreach \i in {0.5,0.6,...,2}
\fill
[white,opacity=\i/2,
decoration=Koch snowflake,
shift=(horizon),shift={(rand*11,rnd*7)},
scale=\i,double copy shadow={
opacity=0.2,shadow xshift=0pt,
shadow yshift=3*\i pt,
fill=white,draw=none}]
decorate {
decorate {
decorate {
(0,0)- ++(60:1) -- ++(-60:1) -- cycle
} } };

\node (left text) ...
\node (right text) ...

\fill [decorate,
decoration={footprints,foot of=gnome},
opacity=.5,brown] (left text.south)
to [out=-45,in=135]    (right text.north);
\fill [decorate,
decoration={footprints,foot of=felis silvestris,
foot length=5pt,stride length=15pt,foot angle=0},
opacity=.5,green!50!black] (left text.south)
to [out=20,in=180] (right text.north west);
\end{tikzpicture}
\end{lstlisting}
};

\fill [decorate,decoration=footprints,
decoration={footprints,foot of=gnome},
opacity=.5,brown] (left text.south)
to [out=-45,in=135]    (right text.north);
\fill [decorate,decoration={footprints,foot length=5pt,foot of=felis
silvestris,stride  length=15pt,foot angle=0},
opacity=.5,green!50!black] (left text.south)
to [out=20,in=180] (right text.north west);
\end{tikzpicture}
\vfill
\vbox{}
\clearpage
}


text:
import { ComponentFactoryResolver, ComponentRef, ViewContainerRef } from "@angular/core";
import { BaseComponentWrapper, FrameworkComponentWrapper, WrapableInterface } from '@ag-grid-community/core';
export declare class AngularFrameworkComponentWrapper extends BaseComponentWrapper<WrapableInterface> implements FrameworkComponentWrapper {
    private viewContainerRef;
    private componentFactoryResolver;
    setViewContainerRef(viewContainerRef: ViewContainerRef): void;
    setComponentFactoryResolver(componentFactoryResolver: ComponentFactoryResolver): void;
    createWrapper(OriginalConstructor: {
        new (): any;
    }): WrapableInterface;
    createComponent<T>(componentType: {
        new (...args: any[]): T;
    }): ComponentRef<T>;
}


text:
package org.olat.modules.webFeed.ui;

import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.form.flexible.elements.FileElement;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController;
import org.olat.core.gui.control.generic.dtabs.Activateable;
import org.olat.core.id.OLATResourceable;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.coordinate.CoordinatorManager;
import org.olat.core.util.coordinate.LockResult;
import org.olat.core.util.event.GenericEventListener;
import org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent;
import org.olat.modules.webFeed.FeedSecurityCallback;
import org.olat.modules.webFeed.FeedViewHelper;
import org.olat.modules.webFeed.managers.FeedManager;
import org.olat.modules.webFeed.models.Feed;
import org.olat.modules.webFeed.models.Item;
import org.olat.util.logging.activity.LoggingResourceable;

/**
 * This is the main feed layout controller. It handles everything from adding episodes to changing title and description.
 *

 * Initial Date: Feb 5, 2009

 *
 * @author gwassmann
 */
// ClosableModalController is deprecated. No alternative implemented.
@SuppressWarnings("deprecation")
public class FeedMainController extends BasicController implements Activateable, GenericEventListener {

	private static final FeedManager feedManager = FeedManager.getInstance();
	private Feed feed;
	private Link editFeedButton;
	private CloseableModalController cmc;
	private FormBasicController feedFormCtr;
	private VelocityContainer vcMain, vcInfo, vcRightCol;
	private ItemsController itemsCtr;
	private LockResult lock;
	private final FeedViewHelper helper;
	private DisplayFeedUrlController displayUrlCtr;
	private final FeedUIFactory uiFactory;
	private final FeedSecurityCallback callback;
	// needed for comparison
	private String oldFeedUrl;

	/**
	 * Constructor for learning resource (not course nodes)
	 *
	 * @param ores
	 * @param ureq
	 * @param wControl
	 * @param previewMode Indicates that the content will only be displayed in preview and no editing functionality is enabled.
	 */
	public FeedMainController(final OLATResourceable ores, final UserRequest ureq, final WindowControl wControl, final FeedUIFactory uiFactory,
			final FeedSecurityCallback callback) {
		this(ores, ureq, wControl, null, null, uiFactory, callback);
	}

	/**
	 * Constructor for course node
	 *
	 * @param ores
	 * @param ureq
	 * @param wControl
	 * @param previewMode Indicates that the content will only be displayed in preview and no editing functionality is enabled.
	 */
	public FeedMainController(final OLATResourceable ores, final UserRequest ureq, final WindowControl wControl, final Long courseId, final String nodeId,
			final FeedUIFactory uiFactory, final FeedSecurityCallback callback) {
		super(ureq, wControl);
		this.uiFactory = uiFactory;
		this.callback = callback;
		setTranslator(uiFactory.getTranslator());
		feed = feedManager.getFeed(ores);
		helper = new FeedViewHelper(feed, getIdentity(), uiFactory.getTranslator(), courseId, nodeId, callback);
		CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, ureq.getIdentity(), feed);
		display(ureq, wControl);
		// do logging
		ThreadLocalUserActivityLogger.log(FeedLoggingAction.FEED_READ, getClass(), LoggingResourceable.wrap(feed));
	}

	/**
	 * Sets up the velocity container for displaying the view
	 *
	 * @param ores
	 * @param ureq
	 * @param wControl
	 * @param previewMode
	 * @param isCourseNode
	 */
	private void display(final UserRequest ureq, final WindowControl wControl) {
		vcMain = createVelocityContainer("feed_main");

		vcInfo = uiFactory.createInfoVelocityContainer(this);
		vcInfo.contextPut("feed", feed);
		vcInfo.contextPut("helper", helper);

		vcRightCol = uiFactory.createRightColumnVelocityContainer(this);
		vcMain.put("rightColumn", vcRightCol);

		// The current user has edit rights if he/she is an administrator or an
		// owner of the resource.
		if (callback.mayEditMetadata()) {
			editFeedButton = LinkFactory.createButtonSmall("feed.edit", vcInfo, this);
		}

		vcInfo.contextPut("callback", callback);

		displayUrlCtr = new DisplayFeedUrlController(ureq, wControl, feed, helper, uiFactory.getTranslator());
		listenTo(displayUrlCtr);
		vcInfo.put("feedUrlComponent", displayUrlCtr.getInitialComponent());

		vcMain.put("info", vcInfo);

		itemsCtr = new ItemsController(ureq, wControl, feed, helper, uiFactory, callback, vcRightCol);
		listenTo(itemsCtr);
		vcMain.put("items", itemsCtr.getInitialComponent());

		this.putInitialPanel(vcMain);
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#doDispose()
	 */
	@Override
	protected void doDispose() {
		feedManager.releaseLock(lock);
		CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, feed);
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
	 */
	@Override
	@SuppressWarnings("unused")
	protected void event(final UserRequest ureq, final Component source, final Event event) {
		if (source == editFeedButton) {
			lock = feedManager.acquireLock(feed, ureq.getIdentity());
			if (lock.isSuccess()) {
				if (feed.isExternal()) {
					oldFeedUrl = feed.getExternalFeedUrl();
					feedFormCtr = new ExternalFeedFormController(ureq, getWindowControl(), feed, uiFactory.getTranslator());
				} else {
					// Default for podcasts is that they are edited within OLAT
					feedFormCtr = new FeedFormController(ureq, getWindowControl(), feed, uiFactory);
				}
				activateModalDialog(feedFormCtr);
			} else {
				showInfo("feed.is.being.edited.by", lock.getOwner().getName());
			}
		}
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
	 */
	@Override
	protected void event(final UserRequest ureq, final Controller source, final Event event) {
		if (source == cmc) {
			if (event.equals(CloseableModalController.CLOSE_MODAL_EVENT)) {
				removeAsListenerAndDispose(cmc);
				cmc = null;
				removeAsListenerAndDispose(feedFormCtr);
				feedFormCtr = null;
				// If the user cancels the first time after deciding to subscribe to
				// an external feed, undo his decision
				if (feed.isExternal()) {
					if (oldFeedUrl == null || "".equals(oldFeedUrl)) {
						feed = feedManager.updateFeedMode(null, feed);
						itemsCtr.makeInternalAndExternalButtons();
					}
				}
				// release lock
				feedManager.releaseLock(lock);
			}
		} else if (source == feedFormCtr) {
			if (event.equals(Event.CHANGED_EVENT) || event.equals(Event.CANCELLED_EVENT)) {
				// Dispose the cmc and the feedFormCtr.
				cmc.deactivate();
				removeAsListenerAndDispose(cmc);
				cmc = null;

				if (event.equals(Event.CHANGED_EVENT)) {
					vcInfo.setDirty(true);
					// For external podcasts, set the feed to undefined if the feed url
					// has been set empty.
					if (feed.isExternal()) {
						final String newFeed = feed.getExternalFeedUrl();
						displayUrlCtr.setUrl(newFeed);
						if (newFeed == null) {
							feed.setExternal(null);
							itemsCtr.makeInternalAndExternalButtons();
							// No more episodes to display
							itemsCtr.resetItems(ureq, feed);
						} else if (!newFeed.equals(oldFeedUrl)) {
							// Set the episodes dirty since the feed url changed.
							itemsCtr.resetItems(ureq, feed);
						}
						// Set the URIs correctly
						helper.setURIs();
					} else {
						if (feedFormCtr instanceof FeedFormController) {
							final FeedFormController internalFormCtr = (FeedFormController) feedFormCtr;
							if (internalFormCtr.imageDeleted()) {
								feedManager.deleteImage(feed);
							} else {
								// set the image
								FileElement image = null;
								image = internalFormCtr.getFile();
								feedManager.setImage(image, feed);
							}
						} else {
							// it's an external feed form, nothing to do in this case
						}
					}
					// Eventually update the feed
					feed = feedManager.updateFeedMetadata(feed);
					// Dispose the feedFormCtr
					removeAsListenerAndDispose(feedFormCtr);
					feedFormCtr = null;
					// do logging
					ThreadLocalUserActivityLogger.log(FeedLoggingAction.FEED_EDIT, getClass(), LoggingResourceable.wrap(feed));
				} else if (event.equals(Event.CANCELLED_EVENT)) {
					// If the user cancels the first time after deciding to subscribe to
					// an external feed, undo his decision
					if (feed.isExternal()) {
						if (oldFeedUrl == null || "".equals(oldFeedUrl)) {
							feed = feedManager.updateFeedMode(null, feed);
							itemsCtr.makeInternalAndExternalButtons();
						}
					}
				}
				// release the lock
				feedManager.releaseLock(lock);
			}
		} else if (source == itemsCtr && event.equals(ItemsController.HANDLE_NEW_EXTERNAL_FEED_DIALOG_EVENT)) {
			oldFeedUrl = feed.getExternalFeedUrl();
			feedFormCtr = new ExternalFeedFormController(ureq, getWindowControl(), feed, uiFactory.getTranslator());
			activateModalDialog(feedFormCtr);
		} else if (source == itemsCtr && event.equals(ItemsController.FEED_INFO_IS_DIRTY_EVENT)) {
			vcInfo.setDirty(true);
		}
	}

	/**
	 * @param controller The FormBasicController to be displayed in the modal dialog.
	 */
	private void activateModalDialog(final FormBasicController controller) {
		listenTo(controller);
		cmc = new CloseableModalController(getWindowControl(), translate("close"), controller.getInitialComponent());
		listenTo(cmc);
		cmc.activate();
	}

	/**
	 * @see org.olat.core.gui.control.generic.dtabs.Activateable#activate(org.olat.core.gui.UserRequest, java.lang.String)
	 */
	@Override
	public void activate(final UserRequest ureq, final String itemId) {
		final int index = feed.getItemIds().indexOf(itemId);
		if (index >= 0) {
			final Item item = feed.getItems().get(index);
			itemsCtr.activate(ureq, item);
		}
	}

	/**
	 * @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
	 */
	@Override
	public void event(final Event event) {
		if (event instanceof OLATResourceableJustBeforeDeletedEvent) {
			final OLATResourceableJustBeforeDeletedEvent ojde = (OLATResourceableJustBeforeDeletedEvent) event;
			// make sure it is our course (actually not needed till now, since we
			// registered only to one event, but good style.
			if (ojde.targetEquals(feed, true)) {
				dispose();
			}
		}
	}
}


text:
<?php
/**
 * Отображение для layouts/main:
 *
 *   @category YupeLayout
 *   @package  YupeCMS
 *   @author   Yupe Team <team@yupe.ru>
 *   @license  https://github.com/yupe/yupe/blob/master/LICENSE BSD
 *   @link     http://yupe.ru
 **/
?>
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="<?php echo Yii::app()->baseUrl;?>/web/images/favicon.png" />
    <title><?php echo CHtml::encode(Yii::app()->name); ?> <?php echo CHtml::encode($this->pageTitle); ?></title>
    <?php
    $mainAssets = Yii::app()->assetManager->publish(
        Yii::getPathOfAlias('application.modules.yupe.views.assets')
    );
    Yii::app()->clientScript->registerCssFile($mainAssets . '/css/styles.css');
    Yii::app()->clientScript->registerScriptFile($mainAssets . '/js/main.js');
    if (($langs = $this->yupe->languageSelectorArray) != array())
        Yii::app()->clientScript->registerCssFile($mainAssets. '/css/flags.css');
    ?>

        <?php
        $brandTitle = Yii::t('YupeModule.yupe', 'Перейти на главную панели управления');

        $this->widget('YAdminPanel'); ?>

<?php echo $content; ?>

        Copyright © 2009-<?php echo date('Y'); ?>
        <a href='<?php echo $this->yupe->brandUrl; ?>'>
            <?php echo CHtml::encode(Yii::app()->name); ?>

        <?php echo $this->yupe->getVersion(); ?>

            <?php echo Yii::t('YupeModule.yupe', 'Разработка и поддержка'); ?> - yupe team

        <?php echo Yii::powered(); ?>
        <?php $this->widget('YPerformanceStatistic'); ?>


text:
package com.zhaidaosi.game.jgframework.common.queue;

public class BaseQueueElement<E> {

    private E value;
    private BaseQueueElement<E> before;
    private BaseQueueElement<E> next;
    private long No;

    public BaseQueueElement(E value) {
        this.value = value;
    }

    public void setValue(E value) {
        this.value = value;
    }

    public E getValue() {
        return value;
    }

    public BaseQueueElement<E> getBefore() {
        return before;
    }

    public void setBefore(BaseQueueElement<E> before) {
        this.before = before;
    }

    public BaseQueueElement<E> getNext() {
        return next;
    }

    public void setNext(BaseQueueElement<E> next) {
        this.next = next;
    }

    public void setNo(long No) {
        this.No = No;
    }

    public long getNo() {
        return No;
    }

    public void reset() {
        before = null;
        next = null;
        No = 0;
    }

}


text:
#include "postgres.h"

#include "access/relscan.h"
#include "pgstat.h"
#include "miscadmin.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "utils/memutils.h"
#include "utils/rel.h"

#include "bloom.h"

/*
 * Begin scan of bloom index.
 */
IndexScanDesc
blbeginscan(Relation r, int nkeys, int norderbys)
{
	IndexScanDesc scan;
	BloomScanOpaque so;

	scan = RelationGetIndexScan(r, nkeys, norderbys);

	so = (BloomScanOpaque) palloc(sizeof(BloomScanOpaqueData));
	initBloomState(&so->state, scan->indexRelation);
	so->sign = NULL;

	scan->opaque = so;

	return scan;
}

/*
 * Rescan a bloom index.
 */
void
blrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
		 ScanKey orderbys, int norderbys)
{
	BloomScanOpaque so = (BloomScanOpaque) scan->opaque;

	if (so->sign)
		pfree(so->sign);
	so->sign = NULL;

	if (scankey && scan->numberOfKeys > 0)
	{
		memmove(scan->keyData, scankey,
				scan->numberOfKeys * sizeof(ScanKeyData));
	}
}

/*
 * End scan of bloom index.
 */
void
blendscan(IndexScanDesc scan)
{
	BloomScanOpaque so = (BloomScanOpaque) scan->opaque;

	if (so->sign)
		pfree(so->sign);
	so->sign = NULL;
}

/*
 * Insert all matching tuples into a bitmap.
 */
int64
blgetbitmap(IndexScanDesc scan, Node **bmNodeP)
{
	int64		ntids = 0;
	BlockNumber blkno = BLOOM_HEAD_BLKNO,
				npages;
	int			i;
	TIDBitmap  *tbm;
	BufferAccessStrategy bas;
	BloomScanOpaque so = (BloomScanOpaque) scan->opaque;

	/*
	 * GPDB specific code. Since GPDB also support StreamBitmap
	 * in bitmap index. So normally we need to create specific bitmap
	 * node in the amgetbitmap AM.
	 */
	Assert(bmNodeP);
	if (*bmNodeP == NULL)
	{
		/* XXX should we use less than work_mem for this? */
		tbm = tbm_create(work_mem * 1024L, NULL);
		*bmNodeP = (Node *) tbm;
	}
	else if (!IsA(*bmNodeP, TIDBitmap))
		elog(ERROR, "non bloom bitmap");
	else
		tbm = (TIDBitmap *)*bmNodeP;

	if (so->sign == NULL)
	{
		/* New search: have to calculate search signature */
		ScanKey		skey = scan->keyData;

		so->sign = palloc0(sizeof(BloomSignatureWord) * so->state.opts.bloomLength);

		for (i = 0; i < scan->numberOfKeys; i++)
		{
			/*
			 * Assume bloom-indexable operators to be strict, so nothing could
			 * be found for NULL key.
			 */
			if (skey->sk_flags & SK_ISNULL)
			{
				pfree(so->sign);
				so->sign = NULL;
				return 0;
			}

			/* Add next value to the signature */
			signValue(&so->state, so->sign, skey->sk_argument,
					  skey->sk_attno - 1);

			skey++;
		}
	}

	/*
	 * We're going to read the whole index. This is why we use appropriate
	 * buffer access strategy.
	 */
	bas = GetAccessStrategy(BAS_BULKREAD);
	npages = RelationGetNumberOfBlocks(scan->indexRelation);

	for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno++)
	{
		Buffer		buffer;
		Page		page;

		buffer = ReadBufferExtended(scan->indexRelation, MAIN_FORKNUM,
									blkno, RBM_NORMAL, bas);

		LockBuffer(buffer, BUFFER_LOCK_SHARE);
		page = BufferGetPage(buffer);
		TestForOldSnapshot(scan->xs_snapshot, scan->indexRelation, page);

		if (!PageIsNew(page) && !BloomPageIsDeleted(page))
		{
			OffsetNumber offset,
						maxOffset = BloomPageGetMaxOffset(page);

			for (offset = 1; offset <= maxOffset; offset++)
			{
				BloomTuple *itup = BloomPageGetTuple(&so->state, page, offset);
				bool		res = true;

				/* Check index signature with scan signature */
				for (i = 0; i < so->state.opts.bloomLength; i++)
				{
					if ((itup->sign[i] & so->sign[i]) != so->sign[i])
					{
						res = false;
						break;
					}
				}

				/* Add matching tuples to bitmap */
				if (res)
				{
					tbm_add_tuples(tbm, &itup->heapPtr, 1, true);
					ntids++;
				}
			}
		}

		UnlockReleaseBuffer(buffer);
		CHECK_FOR_INTERRUPTS();
	}
	FreeAccessStrategy(bas);

	return ntids;
}


text:
{% load league_registrations %}
{% load math %}

{% with registration.progress as registration_progress %}

  {% if league.checks_accepted and league.check_price > 0 %}

  {% else %}

  {% endif %}

  {% if registration_progress >= tick_percentage|multiply_by:'0' %}
    Code of Conduct
  {% else %}
    Code of Conduct
  {% endif %}

  {% if registration_progress >= tick_percentage|multiply_by:'1' %}
    Waiver
  {% else %}
    Waiver
  {% endif %}

  {% if registration_progress >= tick_percentage|multiply_by:'2' %}
    Attendance
  {% else %}
    Attendance
  {% endif %}

  {% if league.checks_accepted and league.check_price > 0 %}

    {% if registration_progress >= tick_percentage|multiply_by:'3' %}
      Payment Type
    {% else %}
      Payment Type
    {% endif %}

    {% if registration_progress >= tick_percentage|multiply_by:'4' %}
      Status
    {% else %}
      Status
    {% endif %}

  {% else %}

    {% if registration_progress >= tick_percentage|multiply_by:'3' %}
      Status
    {% else %}
      Status
    {% endif %}

  {% endif %}

{% endwith %}


text:
package org.uberfire.ext.wires.bpmn.client.commands.impl;

import org.uberfire.commons.validation.PortablePreconditions;
import org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;
import org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;
import org.uberfire.ext.wires.bpmn.client.commands.Command;
import org.uberfire.ext.wires.bpmn.client.commands.ResultType;
import org.uberfire.ext.wires.bpmn.client.commands.Results;
import org.uberfire.ext.wires.bpmn.client.rules.RuleManager;

/**
 * A Command to delete an Edge between two GraphNodes
 */
public class DeleteEdgeCommand implements Command {

    private BpmnGraphNode outgoingNode;
    private BpmnGraphNode incomingNode;
    private BpmnEdge edge;

    public DeleteEdgeCommand( final BpmnGraphNode outgoingNode,
                              final BpmnGraphNode incomingNode,
                              final BpmnEdge edge ) {
        this.outgoingNode = PortablePreconditions.checkNotNull( "outgoingNode",
                                                                outgoingNode );
        this.incomingNode = PortablePreconditions.checkNotNull( "incomingNode",
                                                                incomingNode );
        this.edge = PortablePreconditions.checkNotNull( "edge",
                                                        edge );
    }

    @Override
    public Results apply( final RuleManager ruleManager ) {
        final Results results = new DefaultResultsImpl();
        boolean isEdgeOutgoing = false;
        boolean isEdgeIncoming = false;
        for ( BpmnEdge e : outgoingNode.getOutEdges() ) {
            if ( e.equals( edge ) ) {
                isEdgeOutgoing = true;
                break;
            }
        }
        for ( BpmnEdge e : incomingNode.getInEdges() ) {
            if ( e.equals( edge ) ) {
                isEdgeIncoming = true;
                break;
            }
        }
        if ( isEdgeOutgoing && isEdgeIncoming ) {
            results.getMessages().addAll( ruleManager.checkCardinality( outgoingNode,
                                                                        incomingNode,
                                                                        edge,
                                                                        RuleManager.Operation.DELETE ).getMessages() );
            if ( !results.contains( ResultType.ERROR ) ) {
                outgoingNode.getOutEdges().remove( edge );
                incomingNode.getInEdges().remove( edge );
            }
        } else {
            results.addMessage( new DefaultResultImpl( ResultType.WARNING,
                                                       "The Edge does not connect the given GraphNodes and hence was not deleted." ) );
        }
        return results;
    }

    @Override
    public Results undo( final RuleManager ruleManager ) {
        final Command undoCommand = new AddEdgeCommand( outgoingNode,
                                                        incomingNode,
                                                        edge );
        return undoCommand.apply( ruleManager );
    }

}