text:
<?php

namespace Evolution7\SocialApi\Config;

interface ConfigInterface
{
    /**
     * Validate platform
     *
     * @param string $platform
     */
    public static function validatePlatform($platform);

    /**
     * Constructor
     *
     * @param string $platform
     * @param string $apiKey
     * @param string $apiSecret
     * @param array  $apiScopes
     * @param string $returnUrl
     */
    public function __construct($platform, $apiKey, $apiSecret, $apiScopes, $returnUrl);

    /**
     * Get platform
     *
     * @return string
     */
    public function getPlatform();

    /**
     * Set platform
     *
     * @param string $platform
     */
    public function setPlatform($platform);

    /**
     * Get API key
     *
     * @return string
     */
    public function getApiKey();

    /**
     * Set API key
     *
     * @param string $apiKey
     */
    public function setApiKey($apiKey);

    /**
     * Get API secret
     *
     * @return string
     */
    public function getApiSecret();

    /**
     * Set API secret
     *
     * @param string $apiSecret
     */
    public function setApiSecret($apiSecret);

    /**
     * Get API scopes
     *
     * @return array
     */
    public function getApiScopes();

    /**
     * Set API scopes
     *
     * @param array $apiScopes
     */
    public function setApiScopes($apiScopes);

    /**
     * Get return url
     *
     * @return string
     */
    public function getReturnUrl();

    /**
     * Set return url
     *
     * @param string $returnUrl
     */
    public function setReturnUrl($returnUrl);
}


text:
id: 587d7faa367417b2b2512bd3
title: Style D3 Labels
required:
  - src: 'https://cdnjs.cloudflare.com/ajax/libs/d3/4.3.0/d3.min.js'
challengeType: 6
videoUrl: ''
localeTitle: Etiquetas de estilo D3
---

## Description

 Los métodos D3 pueden agregar estilos a las etiquetas de barra. El atributo de fill establece el color del texto para un nodo de text . El método style() establece reglas CSS para otros estilos, como "font-family" o "font-size".

## Instructions

 Establezca el font-size de font-size de los elementos de text en 25px, y el color del texto en rojo.

## Tests

```yml
tests:
  - text: Todas las etiquetas deben tener un color de <code>fill</code> rojo.
    testString: 'assert($("text").css("fill") == "rgb(255, 0, 0)", "The labels should all have a <code>fill</code> color of red.");'
  - text: Todas las etiquetas deben tener un <code>font-size</code> de <code>font-size</code> de 25 píxeles.
    testString: 'assert($("text").css("font-size") == "25px", "The labels should all have a <code>font-size</code> of 25 pixels.");'

```

## Challenge Seed

```html
<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];

    const w = 500;
    const h = 100;

    const svg = d3.select("body")
                  .append("svg")
                  .attr("width", w)
                  .attr("height", h);

    svg.selectAll("rect")
       .data(dataset)
       .enter()
       .append("rect")
       .attr("x", (d, i) => i * 30)
       .attr("y", (d, i) => h - 3 * d)
       .attr("width", 25)
       .attr("height", (d, i) => d * 3)
       .attr("fill", "navy");

    svg.selectAll("text")
       .data(dataset)
       .enter()
       .append("text")
       .text((d) => d)
       .attr("x", (d, i) => i * 30)
       .attr("y", (d, i) => h - (3 * d) - 3)
       // Add your code below this line

       // Add your code above this line
  </script>
</body>

```

## Solution

```js
// solution required
```

redpajama_set_name: RedPajamaGithub


text:
package org.apache.samoa.apex;

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

import org.apache.hadoop.conf.Configuration;
import org.apache.samoa.apex.topology.impl.ApexTask;
import org.apache.samoa.apex.topology.impl.ApexTopology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.datatorrent.api.LocalMode;
import com.datatorrent.stram.plan.logical.LogicalPlan;

public class LocalApexDoTask {

  @SuppressWarnings("unused")
  private static final Logger logger = LoggerFactory.getLogger(LocalApexDoTask.class);

  public static void main(String[] args) {

    List<String> tmpArgs = new ArrayList<String>(Arrays.asList(args));

    args = tmpArgs.toArray(new String[0]);

    ApexTopology apexTopo = ApexSamoaUtils.argsToTopology(args);

    LocalMode lma = LocalMode.newInstance();
    Configuration conf = new Configuration(false);
//    conf.set("dt.loggers.level", "org.apache.*:DEBUG");

    try {
      lma.prepareDAG(new ApexTask(apexTopo), conf);
      System.out.println("Dag Set in lma: " + lma.getDAG());
      ((LogicalPlan) lma.getDAG()).validate();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    LocalMode.Controller lc = lma.getController();
    lc.setHeartbeatMonitoringEnabled(false);

    lc.runAsync();
  }
}


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

namespace WhatThe.Mods.CitiesSkylines.ServiceDispatcher
{
    /// <summary>
    /// Method detour class for Mono.
    /// </summary>
    internal class MonoDetour
    {
        /// <summary>
        /// The calling conventions indicating existence of a "this" parameter.
        /// </summary>
        private static readonly CallingConventions TheseCallingConventions = CallingConventions.HasThis | CallingConventions.ExplicitThis;

        /// <summary>
        /// The calling conventions that must be the same when comparing two methods.
        /// </summary>
        private static readonly CallingConventions ValidateCallingConventions = CallingConventions.Standard | CallingConventions.VarArgs | CallingConventions.Any;

        /// <summary>
        /// The original call site.
        /// </summary>
        private CallSite originalCallSite = CallSite.Zero;

        /// <summary>
        /// The original call info.
        /// </summary>
        private CodeStart originalCodeStart = CodeStart.Zero;

        /// <summary>
        /// The original method's name.
        /// </summary>
        private string originalMethodName;

        /// <summary>
        /// The original method's class type.
        /// </summary>
        private Type originalType;

        /// <summary>
        /// The replacement call site.
        /// </summary>
        private CallSite replacementCallSite = CallSite.Zero;

        /// <summary>
        /// The replacement method's name.
        /// </summary>
        private string replacementMethodName;

        /// <summary>
        /// The replacement method's class type.
        /// </summary>
        private Type replacementType;

        /// <summary>
        /// Initializes a new instance of the <see cref="MonoDetour" /> class.
        /// </summary>
        /// <param name="originalClass">The original class.</param>
        /// <param name="replacementClass">The replacement class.</param>
        /// <param name="originalMethodName">Name of the original method.</param>
        /// <param name="replacementMethodName">Name of the replacement method.</param>
        /// <exception cref="System.ArgumentException">
        /// Original method name not defined
        /// or
        /// Replacement method name not defined.
        /// </exception>
        /// <exception cref="System.NullReferenceException">
        /// Replacement method not found
        /// or
        /// Original method not found
        /// or
        /// Original method address not found
        /// or
        /// Replacement method address not found
        /// or
        /// Original call info not found.
        /// </exception>
        public MonoDetour(Type originalClass, Type replacementClass, string originalMethodName, string replacementMethodName = null)
        {
            Log.Debug(this, "MonoDetour", "Construct", originalClass, replacementClass, originalMethodName, replacementMethodName);

            this.IsDetoured = false;
            this.originalType = originalClass;
            this.replacementType = replacementClass;
            this.originalMethodName = originalMethodName;
            this.replacementMethodName = (replacementMethodName == null) ? originalMethodName : replacementMethodName;

            if (String.IsNullOrEmpty(this.originalMethodName))
            {
                throw new ArgumentException("Original method name not defined");
            }

            if (String.IsNullOrEmpty(this.replacementMethodName))
            {
                throw new ArgumentException("Replacement method name not defined");
            }

            // Get info for the replacement method.
            MethodInfo replacementMethod = replacementClass.GetMethod(
                                            this.replacementMethodName,
                                            BindingFlags.Default | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            if (replacementMethod == null)
            {
                throw new NullReferenceException("Replacement method not found");
            }

            // Find and get info for the original method by comparing all methods with the specified name to the replacement method.
            MethodInfo originalMethod = FindMethod(originalClass, originalMethodName, replacementMethod);

            if (originalMethod == null)
            {
                throw new NullReferenceException("Original method not found");
            }

            this.originalCallSite = originalMethod.MethodHandle.GetFunctionPointer();
            if (this.originalCallSite == CallSite.Zero)
            {
                throw new NullReferenceException("Original method address not found");
            }

            this.replacementCallSite = replacementMethod.MethodHandle.GetFunctionPointer();
            if (this.replacementCallSite == CallSite.Zero)
            {
                throw new NullReferenceException("Replacement method address not found");
            }

            // Save call info to original code.
            this.originalCodeStart = new CodeStart(this.originalCallSite);
            if (this.originalCodeStart == CodeStart.Zero)
            {
                throw new NullReferenceException("Original call info not found");
            }

            if (Log.LogALot)
            {
                Log.DevDebug(this, "MonoDetour", "Constructed", originalClass, replacementClass, originalMethodName, replacementMethodName);
            }
        }

        /// <summary>
        /// Gets a value indicating whether methods can be detoured or not.
        /// </summary>
        /// <value>
        /// <c>true</c> if methods can be detoured; otherwise, <c>false</c>.
        /// </value>
        public static bool CanDetour
        {
            get
            {
                try
                {
                    PortableExecutableKinds exeKind;
                    ImageFileMachine imgfMachine;
                    typeof(object).Module.GetPEKind(out exeKind, out imgfMachine);

                    bool canDetour = imgfMachine == ImageFileMachine.IA64 || imgfMachine == ImageFileMachine.AMD64 || imgfMachine == ImageFileMachine.I386;

                    if (Log.LogALot)
                    {
                        Log.DevDebug(typeof(MonoDetour), "CanDetour", canDetour, exeKind, imgfMachine);
                    }

                    return canDetour;
                }
                catch (Exception ex)
                {
                    Log.Error(typeof(MonoDetour), "CanDetour", ex);
                    return false;
                }
            }
        }

        /// <summary>
        /// Gets a value indicating whether the method is detoured.
        /// </summary>
        /// <value>
        /// <c>True</c> if the method is detoured; otherwise, <c>false</c>.
        /// </value>
        public bool IsDetoured
        {
            get;
            private set;
        }

        /// <summary>
        /// Finds the method.
        /// </summary>
        /// <param name="sourceClass">The source class.</param>
        /// <param name="methodName">Name of the method.</param>
        /// <returns>
        /// The method information.
        /// </returns>
        /// <exception cref="System.NullReferenceException">Signature method not found.</exception>
        public static MethodInfo FindMethod(Type sourceClass, string methodName)
        {
            return FindMethod(sourceClass, methodName, null);
        }

        /// <summary>
        /// Finds the method.
        /// </summary>
        /// <param name="sourceClass">The source class.</param>
        /// <param name="methodName">Name of the method.</param>
        /// <param name="signatureClass">The signature class.</param>
        /// <param name="signatureMethodName">Name of the signature method.</param>
        /// <returns>
        /// The method information.
        /// </returns>
        /// <exception cref="System.NullReferenceException">Signature method not found.</exception>
        public static MethodInfo FindMethod(Type sourceClass, string methodName, Type signatureClass, string signatureMethodName)
        {
            // Get info for the signature method.
            MethodInfo signatureMethod = signatureClass.GetMethod(
                                            signatureMethodName,
                                            BindingFlags.Default | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            if (signatureMethod == null)
            {
                throw new NullReferenceException("Signature method not found");
            }

            return FindMethod(sourceClass, methodName, signatureMethod);
        }

        /// <summary>
        /// Detours the method.
        /// </summary>
        /// <exception cref="System.NullReferenceException">
        /// Original call site not defined
        /// or
        /// Replacement call site not defined.
        /// </exception>
        public void Detour()
        {
            if (this.originalCallSite == CallSite.Zero)
            {
                throw new NullReferenceException("Original call site not defined");
            }

            if (this.replacementCallSite == CallSite.Zero)
            {
                throw new NullReferenceException("Replacement call site not defined");
            }

            this.PatchCallSiteWithJump(this.originalCallSite, this.replacementCallSite);

            this.IsDetoured = true;
        }

        /// <summary>
        /// Reverts the detour.
        /// </summary>
        /// <exception cref="System.NullReferenceException">
        /// Original call site not defined
        /// or
        /// Original call info not defined.
        /// </exception>
        public void Revert()
        {
            if (this.originalCallSite == CallSite.Zero)
            {
                throw new NullReferenceException("Original call site not defined");
            }

            if (this.originalCodeStart == CodeStart.Zero)
            {
                throw new NullReferenceException("Original call info not defined");
            }

            this.IsDetoured = false;
            this.PatchCallSiteWithCodeStart(this.originalCallSite, this.originalCodeStart);
        }

        /// <summary>
        /// Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String" /> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return (new StringBuilder())
                    .Append("OC:").Append(this.originalType.ToString()).Append(", ")
                    .Append("RC:").Append(this.replacementType.ToString()).Append(", ")
                    .Append("OMN:").Append((this.originalMethodName == null) ? "~" : this.originalMethodName).Append(", ")
                    .Append("RMN:").Append((this.replacementMethodName == null) ? "~" : this.replacementMethodName).Append(", ")
                    .Append("OCS:").Append(this.originalCallSite).Append(", ")
                    .Append("RCS:").Append(this.replacementCallSite).Append(", ")
                    .Append("OCI:").Append(this.originalCodeStart.ToString()).Append(", ")
                    .Append("D:").Append(this.IsDetoured.ToString())
                    .ToString();
        }

        /// <summary>
        /// Checks if types are compatible.
        /// </summary>
        /// <param name="type1">The first type.</param>
        /// <param name="type2">The second type.</param>
        /// <returns>True if types are related or assignable.</returns>
        private static bool CompatibleTypes(Type type1, Type type2)
        {
            return RelatedTypes(type1, type2) || type1.IsAssignableFrom(type2) || type2.IsAssignableFrom(type1);
        }

        /// <summary>
        /// Finds the method.
        /// </summary>
        /// <param name="sourceClass">The source class.</param>
        /// <param name="methodName">Name of the method.</param>
        /// <param name="signatureMethod">The signature method.</param>
        /// <returns>The method information.</returns>
        private static MethodInfo FindMethod(Type sourceClass, string methodName, MethodInfo signatureMethod)
        {
            foreach (MethodInfo method in sourceClass.GetMethods(BindingFlags.Default | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.FlattenHierarchy))
            {
                if (method.Name == methodName)
                {
                    if (ValidateSignatures(signatureMethod, method))
                    {
                        Log.DevDebug(typeof(MonoDetour), "FindMethod", "MethodFound", methodName, method.Name);

                        return method;
                    }
                }
            }

            return null;
        }

        /// <summary>
        /// Check if types are related.
        /// </summary>
        /// <param name="type1">The first type.</param>
        /// <param name="type2">The second type.</param>
        /// <returns>True if types are related.</returns>
        private static bool RelatedTypes(Type type1, Type type2)
        {
            return type1 == type2 || type1.IsSubclassOf(type2) || type2.IsSubclassOf(type1);
        }

        /// <summary>
        /// Validates the method signatures.
        /// </summary>
        /// <param name="method1">The first method.</param>
        /// <param name="method2">The second method2.</param>
        /// <returns>True on success.</returns>
        private static bool ValidateSignatures(MethodInfo method1, MethodInfo method2)
        {
            // Validate method info.
            if ((method1.ReturnType != method2.ReturnType) ||
                (method1.IsGenericMethod != method2.IsGenericMethod) ||
                ((method1.CallingConvention & ValidateCallingConventions) != (method2.CallingConvention & ValidateCallingConventions)))
            {
                return false;
            }

            // Get parameters.
            List<ParameterInfo> params1 = method1.GetParameters().OrderBy(p => p.Position).ToList();
            List<ParameterInfo> params2 = method2.GetParameters().OrderBy(p => p.Position).ToList();

            int pos1Add = 0;

            if ((method1.CallingConvention & TheseCallingConventions) == CallingConventions.HasThis &&
                (method2.CallingConvention & TheseCallingConventions) != CallingConventions.HasThis &&
                params2[0].Position == 0 &&
                (RelatedTypes(params2[0].ParameterType, method1.DeclaringType) || RelatedTypes(params2[0].ParameterType, method1.ReflectedType)))
            {
                params2.RemoveAt(0);
                pos1Add = +1;
            }
            else if ((method2.CallingConvention & TheseCallingConventions) == CallingConventions.HasThis &&
                     (method1.CallingConvention & TheseCallingConventions) != CallingConventions.HasThis &&
                     params1[0].Position == 0 &&
                     (RelatedTypes(params1[0].ParameterType, method2.DeclaringType) || RelatedTypes(params1[0].ParameterType, method2.ReflectedType)))
            {
                params1.RemoveAt(0);
                pos1Add = -1;
            }

            if (method1.ReturnParameter != null)
            {
                params1.Add(method1.ReturnParameter);
            }

            if (method2.ReturnParameter != null)
            {
                params2.Add(method2.ReturnParameter);
            }

            // Validate parameter count.
            if (params1.Count != params2.Count)
            {
                return false;
            }

            // Validate parameters,
            for (int i = 0; i < params1.Count; i++)
            {
                // Validate parameter info.
                if ((params1[i].IsOut != params2[i].IsOut) ||
                    (params1[i].IsRetval != params2[i].IsRetval) ||
                    (params1[i].IsIn != params2[i].IsIn) ||
                    (params1[i].IsLcid != params2[i].IsLcid) ||
                    (params1[i].IsOptional != params2[i].IsOptional) ||
                    ((params1[i].DefaultValue == null) != (params2[i].DefaultValue == null)))
                {
                    return false;
                }

                // Validate parameter type.
                if (!CompatibleTypes(params1[i].ParameterType, params2[i].ParameterType))
                {
                    return false;
                }

                // Validate parameter default values.
                if ((params1[i].DefaultValue != null) && (params1[i].DefaultValue.ToString() != params2[i].DefaultValue.ToString()))
                {
                    return false;
                }

                // Validate parameter position.
                int pos1 = params1[i].Position + (params1[i].Position >= 0 ? pos1Add : 0);
                if (pos1 != params2[i].Position)
                {
                    return false;
                }
            }

            return true;
        }

        /// <summary>
        /// Patches the call site with whatever instructions are in code start.
        /// </summary>
        /// <param name="callSite">The call site.</param>
        /// <param name="codeStart">The call info.</param>
        private void PatchCallSiteWithCodeStart(IntPtr callSite, CodeStart codeStart)
        {
            codeStart.PatchCallSite(callSite);
        }

        /// <summary>
        /// Patches the call site with an assembly jump to pointer.
        /// </summary>
        /// <param name="callSite">The call site.</param>
        /// <param name="targetAddress">The target address pointer.</param>
        /// <exception cref="System.NullReferenceException">
        /// Call site not defined
        /// or
        /// Target address not defined.
        /// </exception>
        private void PatchCallSiteWithJump(IntPtr callSite, IntPtr targetAddress)
        {
            if (callSite == IntPtr.Zero)
            {
                throw new NullReferenceException("Call site not defined");
            }

            if (targetAddress == IntPtr.Zero)
            {
                throw new NullReferenceException("Target address not defined");
            }

            //Log.DevDebug(this, "PatchCallSite", callSite, targetAddress);

            unsafe
            {
                byte* rawPointer = (byte*)callSite.ToPointer();

                // Use temporary %r11 register.
                *rawPointer = 0x49; // movabs
                *(rawPointer + 1) = 0xBB; // %r11
                *((ulong*)(rawPointer + 2)) = (ulong)targetAddress.ToInt64(); // jump target address

                // jump
                *(rawPointer + 10) = 0x41; // encoded ...
                *(rawPointer + 11) = 0xFF; // ... uncondotional jump
                *(rawPointer + 12) = 0xE3; // %r11
            }
        }

        /// <summary>
        /// Integer pointer wrapper for call site.
        /// </summary>
        private struct CallSite
        {
            /// <summary>
            /// The zero, or null, call site.
            /// </summary>
            public static readonly CallSite Zero = new CallSite(IntPtr.Zero);

            /// <summary>
            /// The pointer.
            /// </summary>
            private IntPtr pointer;

            /// <summary>
            /// Initializes a new instance of the <see cref="CallSite"/> struct.
            /// </summary>
            /// <param name="pointer">The pointer.</param>
            public CallSite(IntPtr pointer)
            {
                this.pointer = pointer;
            }

            /// <summary>
            /// Performs an implicit conversion from <see cref="IntPtr"/> to <see cref="CallSite"/>.
            /// </summary>
            /// <param name="pointer">The pointer.</param>
            /// <returns>
            /// The result of the conversion.
            /// </returns>
            public static implicit operator CallSite(IntPtr pointer)
            {
                return new CallSite(pointer);
            }

            /// <summary>
            /// Performs an implicit conversion from <see cref="CallSite"/> to <see cref="IntPtr"/>.
            /// </summary>
            /// <param name="callSite">The call site.</param>
            /// <returns>
            /// The result of the conversion.
            /// </returns>
            public static implicit operator IntPtr(CallSite callSite)
            {
                return callSite.pointer;
            }

            /// <summary>
            /// Implements the operator !=.
            /// </summary>
            /// <param name="callSite1">The first call site.</param>
            /// <param name="callSite2">The second call site.</param>
            /// <returns>
            /// The result of the operator.
            /// </returns>
            public static bool operator !=(CallSite callSite1, CallSite callSite2)
            {
                return callSite1.pointer != callSite2.pointer;
            }

            /// <summary>
            /// Implements the operator ==.
            /// </summary>
            /// <param name="callSite1">The first call site.</param>
            /// <param name="callSite2">The second call site.</param>
            /// <returns>
            /// The result of the operator.
            /// </returns>
            public static bool operator ==(CallSite callSite1, CallSite callSite2)
            {
                return callSite1.pointer == callSite2.pointer;
            }

            /// <summary>
            /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
            /// </summary>
            /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
            /// <returns>
            ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
            /// </returns>
            public override bool Equals(object obj)
            {
                if (obj is CallSite)
                {
                    return ((CallSite)obj).pointer.Equals(this.pointer);
                }

                if (obj is IntPtr)
                {
                    return obj.Equals(this.pointer);
                }

                return false;
            }

            /// <summary>
            /// Returns a hash code for this instance.
            /// </summary>
            /// <returns>
            /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
            /// </returns>
            public override int GetHashCode()
            {
                return this.pointer.ToString().GetHashCode();
            }

            /// <summary>
            /// Returns a <see cref="System.String" /> that represents this instance.
            /// </summary>
            /// <returns>
            /// A <see cref="System.String" /> that represents this instance.
            /// </returns>
            public override string ToString()
            {
                if (this.pointer == IntPtr.Zero)
                {
                    return this.pointer.ToString("X16");
                }

                CodeStart codeStart = new CodeStart(this);
                if (codeStart == CodeStart.Zero)
                {
                    return this.pointer.ToString("X16");
                }

                return this.pointer.ToString("X16") + "(" + codeStart.ToString() + ")";
            }
        }

        /// <summary>
        /// Assembly code from start of call site.
        /// </summary>
        private struct CodeStart
        {
            /// <summary>
            /// The zero, or null, call info.
            /// </summary>
            public static readonly CodeStart Zero = new CodeStart(IntPtr.Zero);

            /// <summary>
            /// Byte at 0 bytes offset from the call site address.
            /// </summary>
            private readonly byte b00;

            /// <summary>
            /// Byte at 1 bytes offset from the call site address.
            /// </summary>
            private readonly byte b01;

            /// <summary>
            /// Byte at 10 bytes offset from the call site address.
            /// </summary>
            private readonly byte b10;

            /// <summary>
            /// Byte at 11 bytes offset from the call site address.
            /// </summary>
            private readonly byte b11;

            /// <summary>
            /// Byte at 12 bytes offset from the call site address.
            /// </summary>
            private readonly byte b12;

            /// <summary>
            /// Unsigned long at 2 bytes offset from the call site address.
            /// </summary>
            private readonly ulong ul02;

            /// <summary>
            /// Initializes a new instance of the <see cref="CodeStart" /> struct.
            /// </summary>
            /// <param name="callSite">The call site address.</param>
            public CodeStart(IntPtr callSite)
            {
                if (callSite == IntPtr.Zero)
                {
                    this.b00 = 0;
                    this.b01 = 0;
                    this.ul02 = 0;
                    this.b10 = 0;
                    this.b11 = 0;
                    this.b12 = 0;
                }
                else
                {
                    unsafe
                    {
                        byte* rawPointer = (byte*)callSite.ToPointer();

                        this.b00 = *rawPointer;
                        this.b01 = *(rawPointer + 1);
                        this.ul02 = *((ulong*)(rawPointer + 2));
                        this.b10 = *(rawPointer + 10);
                        this.b11 = *(rawPointer + 11);
                        this.b12 = *(rawPointer + 12);
                    }
                }
            }

            /// <summary>
            /// Implements the operator !=.
            /// </summary>
            /// <param name="codeStart1">The first call info.</param>
            /// <param name="codeStart2">The second call info.</param>
            /// <returns>
            /// The result of the operator.
            /// </returns>
            public static bool operator !=(CodeStart codeStart1, CodeStart codeStart2)
            {
                return !codeStart1.Equals(codeStart2);
            }

            /// <summary>
            /// Implements the operator ==.
            /// </summary>
            /// <param name="codeStart1">The first call info.</param>
            /// <param name="codeStart2">The second call info.</param>
            /// <returns>
            /// The result of the operator.
            /// </returns>
            public static bool operator ==(CodeStart codeStart1, CodeStart codeStart2)
            {
                return codeStart1.Equals(codeStart2);
            }

            /// <summary>
            /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
            /// </summary>
            /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
            /// <returns>
            ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
            /// </returns>
            public override bool Equals(object obj)
            {
                return
                    obj is CodeStart && obj != null &&
                    this.b00 == ((CodeStart)obj).b00 &&
                    this.b01 == ((CodeStart)obj).b01 &&
                    this.ul02 == ((CodeStart)obj).ul02 &&
                    this.b10 == ((CodeStart)obj).b10 &&
                    this.b11 == ((CodeStart)obj).b11 &&
                    this.b12 == ((CodeStart)obj).b12;
            }

            /// <summary>
            /// Returns a hash code for this instance.
            /// </summary>
            /// <returns>
            /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
            /// </returns>
            public override int GetHashCode()
            {
                return this.ToString().GetHashCode();
            }

            /// <summary>
            /// Patches the call site with instructions.
            /// </summary>
            /// <param name="callSite">The call site.</param>
            /// <exception cref="System.NullReferenceException">
            /// Call info not defined
            /// or
            /// Call site not defined.
            /// </exception>
            public void PatchCallSite(IntPtr callSite)
            {
                if (this == CodeStart.Zero)
                {
                    throw new NullReferenceException("Call info not defined");
                }

                if (callSite == IntPtr.Zero)
                {
                    throw new NullReferenceException("Call site not defined");
                }

                unsafe
                {
                    byte* rawPointer = (byte*)callSite.ToPointer();

                    *rawPointer = this.b00;
                    *(rawPointer + 1) = this.b01;
                    *((ulong*)(rawPointer + 2)) = this.ul02;
                    *(rawPointer + 10) = this.b10;
                    *(rawPointer + 11) = this.b11;
                    *(rawPointer + 12) = this.b12;
                }
            }

            /// <summary>
            /// Returns a <see cref="System.String" /> that represents this instance.
            /// </summary>
            /// <returns>
            /// A <see cref="System.String" /> that represents this instance.
            /// </returns>
            public override string ToString()
            {
                return (new StringBuilder())
                        .Append(this.b00.ToString("X2"))
                        .Append(this.b01.ToString("X2"))
                        .Append(this.ul02.ToString("X16"))
                        .Append(this.b10.ToString("X2"))
                        .Append(this.b11.ToString("X2"))
                        .Append(this.b12.ToString("X2"))
                        .ToString();
            }
        }
    }
}


text:
// Code generated by injection-gen. DO NOT EDIT.

package filtered

import (
	context "context"

	apipolicyv1beta1 "k8s.io/api/policy/v1beta1"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	labels "k8s.io/apimachinery/pkg/labels"
	v1beta1 "k8s.io/client-go/informers/policy/v1beta1"
	kubernetes "k8s.io/client-go/kubernetes"
	policyv1beta1 "k8s.io/client-go/listers/policy/v1beta1"
	cache "k8s.io/client-go/tools/cache"
	client "knative.dev/pkg/client/injection/kube/client"
	filtered "knative.dev/pkg/client/injection/kube/informers/factory/filtered"
	controller "knative.dev/pkg/controller"
	injection "knative.dev/pkg/injection"
	logging "knative.dev/pkg/logging"
)

func init() {
	injection.Default.RegisterFilteredInformers(withInformer)
	injection.Dynamic.RegisterDynamicInformer(withDynamicInformer)
}

// Key is used for associating the Informer inside the context.Context.
type Key struct {
	Selector string
}

func withInformer(ctx context.Context) (context.Context, []controller.Informer) {
	untyped := ctx.Value(filtered.LabelKey{})
	if untyped == nil {
		logging.FromContext(ctx).Panic(
			"Unable to fetch labelkey from context.")
	}
	labelSelectors := untyped.([]string)
	infs := []controller.Informer{}
	for _, selector := range labelSelectors {
		f := filtered.Get(ctx, selector)
		inf := f.Policy().V1beta1().PodDisruptionBudgets()
		ctx = context.WithValue(ctx, Key{Selector: selector}, inf)
		infs = append(infs, inf.Informer())
	}
	return ctx, infs
}

func withDynamicInformer(ctx context.Context) context.Context {
	untyped := ctx.Value(filtered.LabelKey{})
	if untyped == nil {
		logging.FromContext(ctx).Panic(
			"Unable to fetch labelkey from context.")
	}
	labelSelectors := untyped.([]string)
	for _, selector := range labelSelectors {
		inf := &wrapper{client: client.Get(ctx), selector: selector}
		ctx = context.WithValue(ctx, Key{Selector: selector}, inf)
	}
	return ctx
}

// Get extracts the typed informer from the context.
func Get(ctx context.Context, selector string) v1beta1.PodDisruptionBudgetInformer {
	untyped := ctx.Value(Key{Selector: selector})
	if untyped == nil {
		logging.FromContext(ctx).Panicf(
			"Unable to fetch k8s.io/client-go/informers/policy/v1beta1.PodDisruptionBudgetInformer with selector %s from context.", selector)
	}
	return untyped.(v1beta1.PodDisruptionBudgetInformer)
}

type wrapper struct {
	client kubernetes.Interface

	namespace string

	selector string
}

var _ v1beta1.PodDisruptionBudgetInformer = (*wrapper)(nil)
var _ policyv1beta1.PodDisruptionBudgetLister = (*wrapper)(nil)

func (w *wrapper) Informer() cache.SharedIndexInformer {
	return cache.NewSharedIndexInformer(nil, &apipolicyv1beta1.PodDisruptionBudget{}, 0, nil)
}

func (w *wrapper) Lister() policyv1beta1.PodDisruptionBudgetLister {
	return w
}

func (w *wrapper) PodDisruptionBudgets(namespace string) policyv1beta1.PodDisruptionBudgetNamespaceLister {
	return &wrapper{client: w.client, namespace: namespace, selector: w.selector}
}

func (w *wrapper) List(selector labels.Selector) (ret []*apipolicyv1beta1.PodDisruptionBudget, err error) {
	reqs, err := labels.ParseToRequirements(w.selector)
	if err != nil {
		return nil, err
	}
	selector = selector.Add(reqs...)
	lo, err := w.client.PolicyV1beta1().PodDisruptionBudgets(w.namespace).List(context.TODO(), v1.ListOptions{
		LabelSelector: selector.String(),
		// TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria.
	})
	if err != nil {
		return nil, err
	}
	for idx := range lo.Items {
		ret = append(ret, &lo.Items[idx])
	}
	return ret, nil
}

func (w *wrapper) Get(name string) (*apipolicyv1beta1.PodDisruptionBudget, error) {
	// TODO(mattmoor): Check that the fetched object matches the selector.
	return w.client.PolicyV1beta1().PodDisruptionBudgets(w.namespace).Get(context.TODO(), name, v1.GetOptions{
		// TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria.
	})
}


text:
var dom = require('@nymag/dom');

import * as utils from './utils.js';

import * as lib from './remove-service.js';
import { VuexStoreStub } from '../../test/utils.js';

const fakeSpaceUri = '/_components/clay-space/instances/my-space',
  fakeSpaceEl = {
    getAttribute: ()=>fakeSpaceUri
  },
  fakeLogicUri = '/_components/space-logic/instances/space-logic-123',
  fakeLogicEl = {
    getAttribute: ()=>fakeLogicUri
  };

describe('remove-service', ()=>{
  let dispatchCalls, storeStub;

  function mockDependencies() {
    dom = jest.fn();
    dom.find = jest.fn()
      .mockReturnValue(fakeLogicEl);
    // mocking a DOM element object
    utils.getSpaceElFromLogic = jest.fn()
      .mockReturnValue(fakeSpaceEl);
  }

  beforeEach(() => {
    mockDependencies();

    dispatchCalls = [];
    storeStub = new VuexStoreStub(null, dispatchCalls);
    storeStub.state.components[fakeSpaceUri] = { content: [
      {_ref: fakeLogicUri},
      {_ref: '/_components/space-logic/instances/space-logic-345'}
    ]};

  });

  test('remove a Space component given Space Logic', ()=>{
    return lib.removeSpace(storeStub, fakeLogicUri)
      .then(()=>{
        const testDispatch = dispatchCalls[0];

        expect(testDispatch.type).toBe('removeComponent');
        expect(testDispatch.payload).toEqual(fakeSpaceEl);
      });
  });

  test('remove a Space Logic given a Space ref and a Logic ref', ()=>{
    return lib.remove(storeStub, fakeSpaceUri, fakeLogicUri)
      .then(()=>{
        const testDispatch = dispatchCalls[0];

        // check that the Space component is updated
        expect(testDispatch.type).toBe('saveComponent');
        expect(testDispatch.payload.uri).toBe(fakeSpaceUri);
        expect(testDispatch.payload.data.content.includes({_ref:fakeLogicUri})).toBeFalsy();
      });
  });

  // TODO: fix this test. This test is not passing due to some promise trickiness :-/
/*
  test('remove a Space if its last Space Logic is removed', ()=>{
    lib.remove = jest.fn()
      .mockReturnValue(Promise.resolve({}));
    lib.removeSpace = jest.fn()
      .mockReturnValue(Promise.resolve({}));

    return lib.removeLogic(storeStub, fakeLogicUri, 1)
      .then(()=>{
        expect(lib.remove).toBeCalledWith(storeStub, fakeSpaceUri, fakeLogicUri);
        expect(lib.removeSpace).toBeCalledWith(storeStub, fakeLogicUri);
        lib.remove.mockRestore();
        lib.removeSpace.mockRestore();
      });
  });
*/
});


text:
/* global describe, it, expect */
import PropTypes from 'prop-types'
import * as Schemative from '../src/schemative'
import * as mocks from './mocks'

describe('Suite types', () => {
  it('should have exist all the defined types', () => {
    mocks.types.forEach((type) => {
      expect(Schemative[type]).toMatchSnapshot()
    })

    mocks.functionTypes.forEach(([type]) => {
      expect(Schemative[type]).toMatchSnapshot()
    })
  })

  it('should be compatible with React.PropTypes', () => {
    mocks.types.forEach((type) => {
      expect(Schemative[type].type).toEqual(PropTypes[type])
    })

    mocks.functionTypes.forEach(([type, baseType]) => {
      expect(Schemative[type](baseType).type).toEqual(PropTypes[type])
    })
  })

  it('should allow isRequired extra prop', () => {
    mocks.types.forEach((type) => {
      expect(Schemative[type].isRequired).toMatchSnapshot()
      expect(Schemative[type].type.isRequired).toEqual(PropTypes[type].isRequired)
    })

    mocks.functionTypes.forEach(([type, baseType]) => {
      expect(Schemative[type].isRequired).toMatchSnapshot()
      expect(Schemative[type](baseType).type.isRequired).toEqual(PropTypes[type].isRequired)
    })
  })
})

describe('Suite createSchema', () => {
  it('should create from a simple non-nested definition', () => {
    expect(Schemative.createSchema(mocks.defs.simple)).toMatchSnapshot()
  })

  it('should create from a complex non-nested definition', () => {
    expect(Schemative.createSchema(mocks.defs.complex)).toMatchSnapshot()
  })

  it('should create from a simple nested definition', () => {
    expect(mocks.defs.simpleNested).toMatchSnapshot()
  })

  it('should create from a complex nested definition', () => {
    expect(mocks.defs.complexNested).toMatchSnapshot()
  })
})

describe('Suite schema', () => {
  const schema = Schemative.createSchema(mocks.defs.schemativePropTypes)

  it('should return the PropTypes', () => {
    expect(schema.PropTypes).toMatchSnapshot()
  })

  it('should return the default values', () => {
    expect(schema.Default).toMatchSnapshot()
  })

  it('should return a new fulfilled object after transform', () => {
    expect(schema.transform(mocks.fulfilled)).toMatchSnapshot()
  })

  it('should return a new fulfilled object with mutators', () => {
    expect(schema.transform(mocks.fulfilled, mocks.mutators)).toMatchSnapshot()
  })
})