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

/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX                                                                           XX
XX                          DisAsm                                           XX
XX                                                                           XX
XX  The dis-assembler to display the native code generated                   XX
XX                                                                           XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

/*****************************************************************************/
#ifndef _DIS_H_
#define _DIS_H_
/*****************************************************************************/
#ifdef LATE_DISASM

// free() is deprecated (we should only allocate and free memory through CLR hosting interfaces)
// and is redefined in clrhost.h to cause a compiler error.
// We don't call free(), but this function is mentioned in STL headers included by msvcdis.h
// (and free() is only called by STL functions that we don't use).
// To avoid the compiler error, but at the same time ensure that we don't accidentally use free(),
// free() is redefined to cause a runtime error instead of a compile time error.
#undef free
#ifdef DEBUG
#define free(x) _ASSERTE(false && "Must not call free(). Use a ClrXXX function instead.")
#endif

#if CHECK_STRUCT_PADDING
#pragma warning(pop)
#endif // CHECK_STRUCT_PADDING

#define _OLD_IOSTREAMS
// This pragma is needed because public\vc\inc\xiosbase contains
// a static local variable
#pragma warning(disable : 4640)
#include "msvcdis.h"
#pragma warning(default : 4640)

#ifdef _TARGET_XARCH_
#include "disx86.h"
#elif defined(_TARGET_ARM64_)
#include "disarm64.h"
#else // _TARGET_*
#error Unsupported or unset target architecture
#endif

#if CHECK_STRUCT_PADDING
#pragma warning(push)
#pragma warning(default:4820)   // 'bytes' bytes padding added after construct 'member_name'
#endif // CHECK_STRUCT_PADDING

/*****************************************************************************/

#ifdef _HOST_64BIT_
template<typename T>
struct SizeTKeyFuncs: LargePrimitiveKeyFuncs<T>
{
};
#else // !_HOST_64BIT_
template<typename T>
struct SizeTKeyFuncs: SmallPrimitiveKeyFuncs<T>
{
};
#endif // _HOST_64BIT_

typedef SimplerHashTable<size_t, SizeTKeyFuncs<size_t>, CORINFO_METHOD_HANDLE, JitSimplerHashBehavior> AddrToMethodHandleMap;
typedef SimplerHashTable<size_t, SizeTKeyFuncs<size_t>, size_t, JitSimplerHashBehavior> AddrToAddrMap;

class Compiler;

class DisAssembler
{
public:

    // Constructor
    void            disInit(Compiler* pComp);

    // Initialize the class for the current method being generated.
    void            disOpenForLateDisAsm(const char* curMethodName,
                                         const char* curClassName,
                                         PCCOR_SIGNATURE sig);

    // Disassemble a buffer: called after code for a method is generated.
    void            disAsmCode(BYTE* hotCodePtr, size_t hotCodeSize, BYTE* coldCodePtr, size_t coldCodeSize);

    // Register an address to be associated with a method handle.
    void            disSetMethod(size_t addr, CORINFO_METHOD_HANDLE methHnd);

    // Register a relocation address.
    void            disRecordRelocation(size_t relocAddr, size_t targetAddr);

private:

    /* Address of the hot and cold code blocks to dissasemble */
    size_t          disHotCodeBlock;
    size_t          disColdCodeBlock;

    /* Size of the hot and cold code blocks to dissasemble */
    size_t          disHotCodeSize;
    size_t          disColdCodeSize;

    /* Total code size (simply cached version of disHotCodeSize + disColdCodeSize) */
    size_t          disTotalCodeSize;

    /* Address where the code block is to be loaded */
    size_t          disStartAddr;

    /* Current offset in the code block */
    size_t          disCurOffset;

    /* Size (in bytes) of current dissasembled instruction */
    size_t          disInstSize;

    /* Target address of a jump */
    size_t          disTarget;

    /* temporary buffer for function names */
    // TODO-Review: there is some issue here where this is never set!
    char            disFuncTempBuf[1024];

    /* Method and class name to output */
    const char*     disCurMethodName;
    const char*     disCurClassName;

    /* flag that signals when replacing a symbol name has been deferred for following callbacks */
    // TODO-Review: there is some issue here where this is never set to 'true'!
    bool            disHasName;

    /* An array of labels, for jumps, LEAs, etc. There is one element in the array for each byte in the generated code.
     * That byte is zero if the corresponding byte of generated code is not a label. Otherwise, the value
     * is a label number.
     */
    BYTE*           disLabels;

    void            DisasmBuffer (FILE  *       pfile,
                                  bool          printit);

    /* For the purposes of disassembly, we pretend that the hot and cold sections are linear, and not split.
     * These functions create this model for the rest of the disassembly code.
     */

    /* Given a linear offset into the code, find a pointer to the actual code (either in the hot or cold section) */
    const BYTE*     disGetLinearAddr(size_t offset);

    /* Given a linear offset into the code, determine how many bytes are left in the hot or cold buffer the offset points to */
    size_t          disGetBufferSize(size_t offset);

    // Map of instruction addresses to call target method handles for normal calls.
    AddrToMethodHandleMap*          disAddrToMethodHandleMap;
    AddrToMethodHandleMap*          GetAddrToMethodHandleMap();

    // Map of instruction addresses to call target method handles for JIT helper calls.
    AddrToMethodHandleMap*          disHelperAddrToMethodHandleMap;
    AddrToMethodHandleMap*          GetHelperAddrToMethodHandleMap();

    // Map of relocation addresses to relocation target.
    AddrToAddrMap*                  disRelocationMap;
    AddrToAddrMap*                  GetRelocationMap();

    const char*     disGetMethodFullName(size_t addr);

    FILE*           disAsmFile;

    Compiler*       disComp;

    bool            disDiffable;    // 'true' if the output should be diffable (hide or obscure absolute addresses)

    template<typename T>
    T dspAddr(T addr)
    {
        return (addr == 0) ? 0 : (disDiffable ? T(0xD1FFAB1E) : addr);
    }

    /* Callbacks from msdis */

    static
    size_t __stdcall    disCchAddr          (const DIS* pdis,
                                             DIS::ADDR addr,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax,
                                             DWORDLONG* pdwDisp);

    size_t              disCchAddrMember    (const DIS* pdis,
                                             DIS::ADDR addr,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax,
                                             DWORDLONG* pdwDisp);

    static
    size_t __stdcall    disCchFixup         (const DIS* pdis,
                                             DIS::ADDR addr,
                                             size_t size,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax,
                                             DWORDLONG* pdwDisp);

    size_t              disCchFixupMember   (const DIS* pdis,
                                             DIS::ADDR addr,
                                             size_t size,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax,
                                             DWORDLONG* pdwDisp);

    static
    size_t __stdcall    disCchRegRel        (const DIS* pdis,
                                             DIS::REGA reg,
                                             DWORD disp,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax,
                                             DWORD* pdwDisp);

    size_t              disCchRegRelMember  (const DIS* pdis,
                                             DIS::REGA reg,
                                             DWORD disp,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax,
                                             DWORD* pdwDisp);

    static
    size_t __stdcall    disCchReg           (const DIS* pdis,
                                             DIS::REGA reg,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax);

    size_t              disCchRegMember     (const DIS* pdis,
                                             DIS::REGA reg,
                                             __in_ecount(cchMax) wchar_t* wz,
                                             size_t cchMax);

    /* Disassemble helper */

    size_t              CbDisassemble(DIS*           pdis,
                                      size_t         offs,
                                      DIS::ADDR      addr,
                                      const BYTE*    pb,
                                      size_t         cbMax,
                                      FILE*          pfile,
                                      bool           findLabels,
                                      bool           printit         = false,
                                      bool           dispOffs        = false,
                                      bool           dispCodeBytes   = false);

};

/*****************************************************************************/
#endif  // LATE_DISASM
/*****************************************************************************/
#endif  // _DIS_H_
/*****************************************************************************/


text:
#ifndef __G_MOUNT_H__
#define __G_MOUNT_H__

#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif

#include <gio/giotypes.h>

G_BEGIN_DECLS

#define G_TYPE_MOUNT            (g_mount_get_type ())
#define G_MOUNT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
#define G_IS_MOUNT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
#define G_MOUNT_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))

typedef struct _GMountIface    GMountIface;

/**
 * GMountIface:
 * @g_iface: The parent interface.
 * @changed: Changed signal that is emitted when the mount's state has changed.
 * @unmounted: The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
 * @pre_unmount: The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.
 * @get_root: Gets a #GFile to the root directory of the #GMount.
 * @get_name: Gets a string containing the name of the #GMount.
 * @get_icon: Gets a #GIcon for the #GMount.
 * @get_uuid: Gets the UUID for the #GMount. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
 * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
 * @get_drive: Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
 * @can_unmount: Checks if a #GMount can be unmounted.
 * @can_eject: Checks if a #GMount can be ejected.
 * @unmount: Starts unmounting a #GMount.
 * @unmount_finish: Finishes an unmounting operation.
 * @eject: Starts ejecting a #GMount.
 * @eject_finish: Finishes an eject operation.
 * @remount: Starts remounting a #GMount.
 * @remount_finish: Finishes a remounting operation.
 * @guess_content_type: Starts guessing the type of the content of a #GMount.
 *     See g_mount_guess_content_type() for more information on content
 *     type guessing. This operation was added in 2.18.
 * @guess_content_type_finish: Finishes a content type guessing operation. Added in 2.18.
 * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18
 * @unmount_with_operation: Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
 * @unmount_with_operation_finish: Finishes an unmounting operation using a #GMountOperation. Since 2.22.
 * @eject_with_operation: Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
 * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
 * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
 * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
 * @get_symbolic_icon: Gets a symbolic #GIcon for the #GMount. Since 2.34.
 *
 * Interface for implementing operations for mounts.
 **/
struct _GMountIface
{
  GTypeInterface g_iface;

  /* signals */

  void        (* changed)                   (GMount              *mount);
  void        (* unmounted)                 (GMount              *mount);

  /* Virtual Table */

  GFile     * (* get_root)                  (GMount              *mount);
  char      * (* get_name)                  (GMount              *mount);
  GIcon     * (* get_icon)                  (GMount              *mount);
  char      * (* get_uuid)                  (GMount              *mount);
  GVolume   * (* get_volume)                (GMount              *mount);
  GDrive    * (* get_drive)                 (GMount              *mount);
  gboolean    (* can_unmount)               (GMount              *mount);
  gboolean    (* can_eject)                 (GMount              *mount);

  void        (* unmount)                   (GMount              *mount,
                                             GMountUnmountFlags   flags,
                                             GCancellable        *cancellable,
                                             GAsyncReadyCallback  callback,
                                             gpointer             user_data);
  gboolean    (* unmount_finish)            (GMount              *mount,
                                             GAsyncResult        *result,
                                             GError             **error);

  void        (* eject)                     (GMount              *mount,
                                             GMountUnmountFlags   flags,
                                             GCancellable        *cancellable,
                                             GAsyncReadyCallback  callback,
                                             gpointer             user_data);
  gboolean    (* eject_finish)              (GMount              *mount,
                                             GAsyncResult        *result,
                                             GError             **error);

  void        (* remount)                   (GMount              *mount,
                                             GMountMountFlags     flags,
                                             GMountOperation     *mount_operation,
                                             GCancellable        *cancellable,
                                             GAsyncReadyCallback  callback,
                                             gpointer             user_data);
  gboolean    (* remount_finish)            (GMount              *mount,
                                             GAsyncResult        *result,
                                             GError             **error);

  void        (* guess_content_type)        (GMount              *mount,
                                             gboolean             force_rescan,
                                             GCancellable        *cancellable,
                                             GAsyncReadyCallback  callback,
                                             gpointer             user_data);
  gchar    ** (* guess_content_type_finish) (GMount              *mount,
                                             GAsyncResult        *result,
                                             GError             **error);
  gchar    ** (* guess_content_type_sync)   (GMount              *mount,
                                             gboolean             force_rescan,
                                             GCancellable        *cancellable,
                                             GError             **error);

  /* Signal, not VFunc */
  void        (* pre_unmount)               (GMount              *mount);

  void        (* unmount_with_operation)    (GMount              *mount,
                                             GMountUnmountFlags   flags,
                                             GMountOperation     *mount_operation,
                                             GCancellable        *cancellable,
                                             GAsyncReadyCallback  callback,
                                             gpointer             user_data);
  gboolean    (* unmount_with_operation_finish) (GMount          *mount,
                                             GAsyncResult        *result,
                                             GError             **error);

  void        (* eject_with_operation)      (GMount              *mount,
                                             GMountUnmountFlags   flags,
                                             GMountOperation     *mount_operation,
                                             GCancellable        *cancellable,
                                             GAsyncReadyCallback  callback,
                                             gpointer             user_data);
  gboolean    (* eject_with_operation_finish) (GMount            *mount,
                                             GAsyncResult        *result,
                                             GError             **error);
  GFile     * (* get_default_location)      (GMount              *mount);

  const gchar * (* get_sort_key)            (GMount              *mount);
  GIcon       * (* get_symbolic_icon)       (GMount              *mount);
};

GLIB_AVAILABLE_IN_ALL
GType       g_mount_get_type                  (void) G_GNUC_CONST;

GLIB_AVAILABLE_IN_ALL
GFile     * g_mount_get_root                  (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
GFile     * g_mount_get_default_location      (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
char      * g_mount_get_name                  (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
GIcon     * g_mount_get_icon                  (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
GIcon     * g_mount_get_symbolic_icon         (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
char      * g_mount_get_uuid                  (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
GVolume   * g_mount_get_volume                (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
GDrive    * g_mount_get_drive                 (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
gboolean    g_mount_can_unmount               (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
gboolean    g_mount_can_eject                 (GMount              *mount);

GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation)
void        g_mount_unmount                   (GMount              *mount,
                                               GMountUnmountFlags   flags,
                                               GCancellable        *cancellable,
                                               GAsyncReadyCallback  callback,
                                               gpointer             user_data);

GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation_finish)
gboolean    g_mount_unmount_finish            (GMount              *mount,
                                               GAsyncResult        *result,
                                               GError             **error);

GLIB_DEPRECATED_FOR(g_mount_eject_with_operation)
void        g_mount_eject                     (GMount              *mount,
                                               GMountUnmountFlags   flags,
                                               GCancellable        *cancellable,
                                               GAsyncReadyCallback  callback,
                                               gpointer             user_data);

GLIB_DEPRECATED_FOR(g_mount_eject_with_operation_finish)
gboolean    g_mount_eject_finish              (GMount              *mount,
                                               GAsyncResult        *result,
                                               GError             **error);

GLIB_AVAILABLE_IN_ALL
void        g_mount_remount                   (GMount              *mount,
                                               GMountMountFlags     flags,
                                               GMountOperation     *mount_operation,
                                               GCancellable        *cancellable,
                                               GAsyncReadyCallback  callback,
                                               gpointer             user_data);
GLIB_AVAILABLE_IN_ALL
gboolean    g_mount_remount_finish            (GMount              *mount,
                                               GAsyncResult        *result,
                                               GError             **error);

GLIB_AVAILABLE_IN_ALL
void        g_mount_guess_content_type        (GMount              *mount,
                                               gboolean             force_rescan,
                                               GCancellable        *cancellable,
                                               GAsyncReadyCallback  callback,
                                               gpointer             user_data);
GLIB_AVAILABLE_IN_ALL
gchar    ** g_mount_guess_content_type_finish (GMount              *mount,
                                               GAsyncResult        *result,
                                               GError             **error);
GLIB_AVAILABLE_IN_ALL
gchar    ** g_mount_guess_content_type_sync   (GMount              *mount,
                                               gboolean             force_rescan,
                                               GCancellable        *cancellable,
                                               GError             **error);

GLIB_AVAILABLE_IN_ALL
gboolean    g_mount_is_shadowed               (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
void        g_mount_shadow                    (GMount              *mount);
GLIB_AVAILABLE_IN_ALL
void        g_mount_unshadow                  (GMount              *mount);

GLIB_AVAILABLE_IN_ALL
void        g_mount_unmount_with_operation    (GMount              *mount,
                                               GMountUnmountFlags   flags,
                                               GMountOperation     *mount_operation,
                                               GCancellable        *cancellable,
                                               GAsyncReadyCallback  callback,
                                               gpointer             user_data);
GLIB_AVAILABLE_IN_ALL
gboolean    g_mount_unmount_with_operation_finish (GMount          *mount,
                                               GAsyncResult        *result,
                                               GError             **error);

GLIB_AVAILABLE_IN_ALL
void        g_mount_eject_with_operation      (GMount              *mount,
                                               GMountUnmountFlags   flags,
                                               GMountOperation     *mount_operation,
                                               GCancellable        *cancellable,
                                               GAsyncReadyCallback  callback,
                                               gpointer             user_data);
GLIB_AVAILABLE_IN_ALL
gboolean    g_mount_eject_with_operation_finish (GMount            *mount,
                                               GAsyncResult        *result,
                                               GError             **error);

GLIB_AVAILABLE_IN_ALL
const gchar *g_mount_get_sort_key             (GMount              *mount);

G_END_DECLS

#endif /* __G_MOUNT_H__ */

redpajama_set_name: RedPajamaGithub


text:
<?php

$autoloader = require_once realpath(__DIR__).'/../vendor/autoload.php';

$autoloader->add('JigDemo', [realpath(__DIR__).'/']);
$autoloader->add('Jig', [realpath(__DIR__).'/compile/']);

use Auryn\Injector;
use Jig\JigConfig;
use Jig\Jig;
use JigDemo\Response\StandardHTTPResponse;
use JigDemo\Application\InjectionParams;
use JigDemo\Application\Tier;
use Jig\JigBase;

function bootstrapInjector() {

    $jigConfig = new JigConfig(
        __DIR__."/templates/",
        __DIR__."/compile/",
        Jig::COMPILE_CHECK_MTIME,
        'php.tpl'
    );

    $injector = new Injector();
    $injector->share($jigConfig);
    $injector->share('Jig\JigRender');
    $injector->share('Jig\Jig');
    $injector->share('Jig\JigConverter');
    $injector->share($injector); //yolo service locator

    return $injector;
}

function createTemplateResponse(JigBase $template)
{
    $text = $template->render();

    return new JigDemo\Response\TextResponse($text);
}

function getTemplateCallable($templateName, array $sharedObjects = [])
{
    $fn = function (Jig $jigRender) use ($templateName, $sharedObjects) {
        $className = $jigRender->getFQCNFromTemplateName($templateName);
        $jigRender->compile($templateName);

        $alias = [];
        $alias['Jig\JigBase'] = $className;
        $injectionParams = new InjectionParams($sharedObjects, $alias, [], []);

        return new Tier('createTemplateResponse', $injectionParams);
    };

    return new Tier($fn);
}

function getRouteCallable() {

    $dispatcher = FastRoute\simpleDispatcher('routesFunction');

    $httpMethod = 'GET'; //yay hard coding.
    $uri = '/';

    if (array_key_exists('REQUEST_URI', $_SERVER)) {
        $uri = $_SERVER['REQUEST_URI'];
    }

    $path = $uri;
    $queryPosition = strpos($path, '?');
    if ($queryPosition !== false) {
        $path = substr($path, 0, $queryPosition);
    }

    $routeInfo = $dispatcher->dispatch($httpMethod, $path);

    switch ($routeInfo[0]) {
        case FastRoute\Dispatcher::NOT_FOUND: {
            return new StandardHTTPResponse(404, $uri, "Not found");
        }

        case FastRoute\Dispatcher::METHOD_NOT_ALLOWED: {
            $allowedMethods = $routeInfo[1];
            // ... 405 Method Not Allowed
            return new StandardHTTPResponse(405, $uri, "Not allowed");
        }

        case FastRoute\Dispatcher::FOUND: {
            $handler = $routeInfo[1];
            $vars = $routeInfo[2];
            $params = InjectionParams::fromParams($vars);

            return new Tier($handler, $params);
        }

        default: {
            //Not supported
            return new StandardHTTPResponse(404, $uri, "Not found");
            break;
        }
    }
}

 function routesFunction(FastRoute\RouteCollector $r) {
    //Category indices
    $r->addRoute(
        'GET',
        "/",
        ['JigDemo\Controller\Index', 'display']
    );

    $r->addRoute(
        'GET',
        "/bindingDataExample",
        ['JigDemo\Controller\BindingDataExample', 'display']
    );

    $r->addRoute(
        'GET',
        "/extend",
        ['JigDemo\Controller\Extend', 'display']
    );

    $r->addRoute(
        'GET',
        "/reuseExample",
        ['JigDemo\Controller\ReuseExample', 'display']
    );

    $r->addRoute(
        'GET',
        "/functionExample",
        ['JigDemo\Controller\FunctionExample', 'display']
    );

    $r->addRoute(
        'GET',
        "/blockExample",
        ['JigDemo\Controller\BlockExample', 'display']
    );

    $r->addRoute(
        'GET',
        "/syntaxExample",
        ['JigDemo\Controller\SyntaxExample', 'display']
    );
};

function addInjectionParams(Injector $injector, Tier $tier)
{
    $injectionParams = $tier->getInjectionParams();

    if (!$injectionParams) {
        return;
    }

    foreach ($injectionParams->getAliases() as $original => $alias) {
        $injector->alias($original, $alias);
    }

    foreach ($injectionParams->getShares() as $share) {
        $injector->share($share);
    }

    foreach ($injectionParams->getParams() as $paramName => $value) {
        $injector->defineParam($paramName, $value);
    }

    foreach ($injectionParams->getDelegates() as $className => $callable) {
        $injector->delegate($className, $callable);
    }
}


text:
package pl.msitko.xml.test.utils

import pl.msitko.xml.entities.{LabeledElement, _}

final case class Example(stringRepr: String, document: XmlDocument)

object Example {
  val defaultDecl = XmlDeclaration("1.0", Some("UTF-8"))

  def apply(stringRepr: String, root: LabeledElement): Example = {
    val prolog = Prolog(Some(defaultDecl), List.empty, None)
    Example(stringRepr, XmlDocument(prolog, root))
  }

  def withDoctypeDecl(stringRepr: String, doctypeDeclaration: DoctypeDeclaration, root: LabeledElement): Example = {
    val prolog = Prolog(Some(defaultDecl), List.empty, Some((doctypeDeclaration, List.empty)))
    Example(stringRepr, XmlDocument(prolog, root))
  }

  def apply(stringRepr: String, misc: Seq[Misc], root: LabeledElement): Example = {
    val prolog = Prolog(Some(defaultDecl), misc, None)
    Example(stringRepr, XmlDocument(prolog, root))
  }

}

trait ExampleInputs extends AnyRef with ExampleBuilderHelper {
  val noNamespaceExample = Example(
    """<?xml version="1.0" encoding="UTF-8"?>
      |<c1><f>item1</f><g>item2</g></c1><c1><f>item1</f><h>item2</h></c1>""".stripMargin,
    labeledElement("a",
      labeledElement("c1",
        labeledElement("f", Text("item1")),
        labeledElement("g", Text("item2"))
      ),
      labeledElement("c1",
        labeledElement("f", Text("item1")),
        labeledElement("h", Text("item2"))
      )
    )
  )

  val noNamespaceXmlStringWithWsExample = Example(
    """<?xml version="1.0" encoding="UTF-8"?>
      |
      |   <c1>
      |      <f>item1</f>
      |      <g>item2</g>
      |   </c1>
      |   <c1>
      |      <f>item1</f>
      |      <h>item2</h>
      |   </c1>
      |""".stripMargin,
    labeledElement("a",
      indent(1),
      labeledElement("c1",
        indent(2),
        labeledElement("f", Text("item1")),
        indent(2),
        labeledElement("g", Text("item2")),
        indent(1)
      ),
      indent(1),
      labeledElement("c1",
        indent(2),
        labeledElement("f", Text("item1")),
        indent(2),
        labeledElement("h", Text("item2")),
        indent(1)
      ),
      Text(lineBreak)
    )
  )

  val namespaceXmlStringExample = {
    val defaultNs = NamespaceDeclaration("", "http://www.develop.com/student")
    val anotherNs = NamespaceDeclaration("xyz", "http://www.example.com")

    Example(
      """<?xml version="1.0" encoding="UTF-8"?>
        |
        |   <c1>
        |      <f>item1</f>
        |      <g>item2</g>
        |   </c1>
        |   <c1>
        |      <f>item1</f>
        |      <xyz:h>item2</xyz:h>
        |   </c1>
        |""".stripMargin,
      LabeledElement(defaultNs.resolvedName("a"),
        Element(
          attributes = List(Attribute(ResolvedName.unprefixed("XMLNS"), "http://a.com")),
          children = List(
            indent(1),
            LabeledElement(defaultNs.resolvedName("c1"), element(
              indent(2),
              LabeledElement(defaultNs.resolvedName("f"), element(Text("item1"))),
              indent(2),
              LabeledElement(defaultNs.resolvedName("g"), element(Text("item2"))),
              indent(1)
            )),
            indent(1),
            LabeledElement(defaultNs.resolvedName("c1"), element(
              indent(2),
              LabeledElement(defaultNs.resolvedName("f"), element(Text("item1"))),
              indent(2),
              LabeledElement(anotherNs.resolvedName("h"), element(Text("item2"))),
              indent(1)
            )),
            Text(lineBreak)
          ),
          namespaceDeclarations =
            List(defaultNs, anotherNs)))
    )
  }

  val attributesXmlStringExample = {
    val fAttributes = List(Attribute.unprefixed("name", "abc"), Attribute.unprefixed("name2", "something else"))
    val c1Attributes = List(Attribute.unprefixed("name", ""))

    Example(
      """<?xml version="1.0" encoding="UTF-8"?>
        |<c1><f name="abc" name2="something else">item1</f><g>item2</g></c1><c1 name=""><F>item1</F><h>item2</h></c1>""".stripMargin,
      labeledElement("a",
        labeledElement("c1",
          LabeledElement.unprefixed("f", Element(fAttributes, List(Text("item1")), Seq.empty)),
          labeledElement("g", Text("item2"))
        ),
        LabeledElement.unprefixed("c1", Element(c1Attributes, List(
          labeledElement("F", Text("item1")),
          labeledElement("h", Text("item2"))
        ), Seq.empty))
      )
    )
  }

  val attributesXmlStringExampleCaseSensitive = {
    val fAttributes = List(Attribute.unprefixed("name", "abc"), Attribute.unprefixed("NaMe", "Hello"), Attribute.unprefixed("name2", "something else"))
    val c1Attributes = List(Attribute.unprefixed("name", ""))

    Example(
      """<?xml version="1.0" encoding="UTF-8"?>
        |<c1><f name="abc" "NaMe"="Hello" name2="something else">item1</f><g>item2</g></c1><c1 name=""><f>item1</f><h>item2</h></c1>""".stripMargin,
      labeledElement("a",
        labeledElement("c1",
          LabeledElement.unprefixed("f", Element(fAttributes, List(Text("item1")), Seq.empty)),
          labeledElement("g", Text("item2"))
        ),
        LabeledElement.unprefixed("c1", Element(c1Attributes, List(
          labeledElement("f", Text("item1")),
          labeledElement("h", Text("item2"))
        ), Seq.empty))
      )
    )
  }

  val xmlWithDtd = {
    val str = """<?xml version="1.0" encoding="UTF-8"?>
                |<!DOCTYPE html
                |    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                |    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
                |[
                |    <!ENTITY test-entity "This is an entity.">
                |]>
                |<note></note>""".stripMargin

    // Note, that there are 2 top level elements: Dtd and LabeledElements, end of line after the Dtd is ignored
    Example.withDoctypeDecl(
      str,
      DoctypeDeclaration("""<!DOCTYPE html
            |    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            |    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
            |[
            |    <!ENTITY test-entity "This is an entity.">
            |]>""".stripMargin),
      labeledElement("note")
    )
  }

  val xmlWithDtdIncorrectly = {
    """<?xml version="1.0" encoding="UTF-8"?>
      |<note>
      |<!DOCTYPE html
      |    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      |    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
      |[
      |    <!ENTITY test-entity "This is an entity.">
      |]>
      |</note>""".stripMargin
  }

  val xmlWithPI = {
    val str =
      """<?xml version="1.0" encoding="UTF-8"?>
        |<?xml-stylesheet type="text/xsl" href="style.xsl"?>
        |<?welcome  to pg = 10 of tutorials point?>
        |<?welcome?>
        |<note>something<?mso-application progid="Excel.Sheet"?>else</note>
      """.stripMargin

    Example(
      str,
      List(
        ProcessingInstruction("xml-stylesheet", """type="text/xsl" href="style.xsl""""),
        ProcessingInstruction("welcome", "to pg = 10 of tutorials point"),
        ProcessingInstruction("welcome", "")
      ),
      labeledElement("note", Text("something"), ProcessingInstruction("mso-application", """progid="Excel.Sheet""""), Text("else"))
    )
  }

  val   xmlWithCData = {
    val cdataContent = """
                         |    I can use all sorts of reserved characters
                         |    like > < " and &
                         |    or write things like
                         |    <foo></bar>
                         |    but my document is still well formed!
                         |""".stripMargin

    val str =
      s"""<?xml version="1.0" encoding="UTF-8"?>
        |<note>something<![CDATA[$cdataContent]]>else</note>""".stripMargin

    Example(
      str,
      labeledElement("note", Text("something"), CData(cdataContent), Text("else"))
    )
  }

  val attributesWithNsXmlStringExample = {
    val defaultNs = NamespaceDeclaration("", "http://www.a.com")
    val bNs = NamespaceDeclaration("b", "http://www.b.com")

    // https://stackoverflow.com/questions/41561/xml-namespaces-and-attributes
    val fAttributes = List(Attribute.unprefixed("name", "abc"), Attribute(bNs.resolvedName("attr"), "attr1"))
    val gAttributes = List(Attribute(bNs.resolvedName("name"), "def"))
    val hAttributes = List(Attribute.unprefixed("name", "ghi"))

    Example(
      """<?xml version="1.0" encoding="UTF-8"?>
        |<c1><f name="abc" b:attr="attr1">item1</f><g b:name="def">item2</g>item3</c1>""".stripMargin,
      LabeledElement(defaultNs.resolvedName("a"), Element(Seq.empty, List(
        LabeledElement(defaultNs.resolvedName("c1"), element(
          LabeledElement(defaultNs.resolvedName("f"), Element(fAttributes, List(Text("item1")))),
          LabeledElement(defaultNs.resolvedName("g"), Element(gAttributes, List(Text("item2")))),
          LabeledElement(bNs.resolvedName("h"), Element(hAttributes, List(Text("item3"))))
        ))
      ), List(defaultNs, bNs)))
    )
  }

  val commentsExamples = List(
    Example(
      """<?xml version="1.0" encoding="UTF-8"?><c1></c1>""",
      labeledElement("a",
        Comment("something "),
        labeledElement("c1")
      )
    ),
    Example(
      """<?xml version="1.0" encoding="UTF-8"?><c1></c1>""",
      labeledElement("a",
        Comment("<c0></c0>"),
        labeledElement("c1")
      )
    )
  )

  val emptyStringAsXmlnsValue =
    Example("""<?xml version="1.0" encoding="UTF-8"?>
        |
      """.stripMargin,
      LabeledElement.unprefixed("a", Element(namespaceDeclarations = Seq(NamespaceDeclaration("", ""))))
    )

  val malformedXmlStrings = List(
    """<?xml version="1.0" encoding="UTF-8"?>
      |a xmlns="http://www.develop.com/student" xmlns:xyz="http://www.example.com">
      |   <c1>
      |      <f>item1</f>
      |   </c1>
      |
      """.stripMargin,
    """<?xml version="1.0" encoding="UTF-8"?>
      |
      |
      |   <c1>
      |      <f>item1</f>
      |   </c1>
      |
      """.stripMargin,
    """<?xml version="1.0" encoding="UTF-8"?>
      |
      |
      |   <c1>
      |      <yy:f>item1</yy:f>
      |   </c1>
      |
      """.stripMargin,
    // unbound prefix:
    """<?xml version="1.0" encoding="UTF-8"?>
        |
        |   <c1>
        |      <yy:f>item1</yy:f>
        |   </c1>
        |
      """.stripMargin,
    """<?xml version="1.0" encoding="UTF-8"?>
        |
        |   <c1>
        |      <xyz:f>item1</xyz:f>
        |
        |
      """.stripMargin,
    """<?xml version="1.0" encoding="UTF-8"?>
      |
    """.stripMargin,
    """<?xml version="1.0" encoding="UTF-8"?>
      |
    """.stripMargin,
    """<?xml version="1.0" encoding="UTF-8"?>
      |
    """.stripMargin,
    "".stripMargin,
    "<></>".stripMargin
  )
}


text:
{% extends 'base.html' %}
{% block title %}Packages - {{ super() }}{% endblock %}
{% block content %}

  {% for version_row in versions | batch(3) %}

    {% for version in version_row %}

{{ version.displaynames['enu'].displayname }}
            v{{ version.version_string }}
              {% if version.report_url %}beta{% endif %}

{{ version.descriptions['enu'].description }}

    {% endfor %}

  {% endfor %}

{% endblock %}


text:
/*global hljs:true */

/**
  Helper object for syntax highlighting. Uses highlight.js which is loaded on demand.

  @class SyntaxHighlighting
  @namespace Discourse
  @module Discourse
**/
Discourse.SyntaxHighlighting = {

  /**
    Apply syntax highlighting to a jQuery element

    @method apply
    @param {jQuery.selector} $elem The element we want to apply our highlighting to
  **/
  apply: function($elem) {
    $('pre code[class]', $elem).each(function(i, e) {
      return $LAB.script("/javascripts/highlight-handlebars.pack.js").wait(function() {
        return hljs.highlightBlock(e);
      });
    });
  }
};


text:
/**
* (c) 2014 by Christian Schenk
**/
package de.schenk.jrtrace.enginex.testscripts;

public class LoadCheck {
	static public boolean instrumentedClassLoaded = false;
	static public boolean instrumentedClassLoader2 = false;
}


text:
OneTwo360 API Client
=====================

[![Build Status](https://travis-ci.org/onetwo360/onetwo360-php-client.png?branch=master)](https://travis-ci.org/onetwo360/onetwo360-php-client)

Installation
------------

You can (and should) use Composer to install the client.

This is done by adding the following line to the require section of your composer.json file

	"onetwo360/onetwo360-api-client": "dev-master"

Now all you need to do is run the installation like this

	$ php composer.phar update

Test it out!
------------

To test the client simply `cd` to the root dir of your project and use the built-in web server in PHP.

	$ php -S localhost:8080 -t vendor/onetwo360/onetwo360-api-client/examples/

You can now point your browser to http://localhost:8080/ and test it out.

Autoloading
-----------

Composer generates an autoloader file that you need to require in order to use the library.

	require 'vendor/autoload.php';

You should now have autoloading for all the libraries installed through Composer.


text:
package com.amazonaws.services.iotthingsgraph.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * An object that contains a workflow's definition and summary information.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class FlowTemplateDescription implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * An object that contains summary information about a workflow.
     *

     */
    private FlowTemplateSummary summary;
    /**
     *

     * A workflow's definition document.
     *

     */
    private DefinitionDocument definition;
    /**
     *

     * The version of the user's namespace against which the workflow was validated. Use this value in your system
     * instance.
     *

     */
    private Long validatedNamespaceVersion;

    /**
     *

     * An object that contains summary information about a workflow.
     *

     *
     * @param summary
     *        An object that contains summary information about a workflow.
     */

    public void setSummary(FlowTemplateSummary summary) {
        this.summary = summary;
    }

    /**
     *

     * An object that contains summary information about a workflow.
     *

     *
     * @return An object that contains summary information about a workflow.
     */

    public FlowTemplateSummary getSummary() {
        return this.summary;
    }

    /**
     *

     * An object that contains summary information about a workflow.
     *

     *
     * @param summary
     *        An object that contains summary information about a workflow.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FlowTemplateDescription withSummary(FlowTemplateSummary summary) {
        setSummary(summary);
        return this;
    }

    /**
     *

     * A workflow's definition document.
     *

     *
     * @param definition
     *        A workflow's definition document.
     */

    public void setDefinition(DefinitionDocument definition) {
        this.definition = definition;
    }

    /**
     *

     * A workflow's definition document.
     *

     *
     * @return A workflow's definition document.
     */

    public DefinitionDocument getDefinition() {
        return this.definition;
    }

    /**
     *

     * A workflow's definition document.
     *

     *
     * @param definition
     *        A workflow's definition document.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FlowTemplateDescription withDefinition(DefinitionDocument definition) {
        setDefinition(definition);
        return this;
    }

    /**
     *

     * The version of the user's namespace against which the workflow was validated. Use this value in your system
     * instance.
     *

     *
     * @param validatedNamespaceVersion
     *        The version of the user's namespace against which the workflow was validated. Use this value in your
     *        system instance.
     */

    public void setValidatedNamespaceVersion(Long validatedNamespaceVersion) {
        this.validatedNamespaceVersion = validatedNamespaceVersion;
    }

    /**
     *

     * The version of the user's namespace against which the workflow was validated. Use this value in your system
     * instance.
     *

     *
     * @return The version of the user's namespace against which the workflow was validated. Use this value in your
     *         system instance.
     */

    public Long getValidatedNamespaceVersion() {
        return this.validatedNamespaceVersion;
    }

    /**
     *

     * The version of the user's namespace against which the workflow was validated. Use this value in your system
     * instance.
     *

     *
     * @param validatedNamespaceVersion
     *        The version of the user's namespace against which the workflow was validated. Use this value in your
     *        system instance.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FlowTemplateDescription withValidatedNamespaceVersion(Long validatedNamespaceVersion) {
        setValidatedNamespaceVersion(validatedNamespaceVersion);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getSummary() != null)
            sb.append("Summary: ").append(getSummary()).append(",");
        if (getDefinition() != null)
            sb.append("Definition: ").append(getDefinition()).append(",");
        if (getValidatedNamespaceVersion() != null)
            sb.append("ValidatedNamespaceVersion: ").append(getValidatedNamespaceVersion());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof FlowTemplateDescription == false)
            return false;
        FlowTemplateDescription other = (FlowTemplateDescription) obj;
        if (other.getSummary() == null ^ this.getSummary() == null)
            return false;
        if (other.getSummary() != null && other.getSummary().equals(this.getSummary()) == false)
            return false;
        if (other.getDefinition() == null ^ this.getDefinition() == null)
            return false;
        if (other.getDefinition() != null && other.getDefinition().equals(this.getDefinition()) == false)
            return false;
        if (other.getValidatedNamespaceVersion() == null ^ this.getValidatedNamespaceVersion() == null)
            return false;
        if (other.getValidatedNamespaceVersion() != null && other.getValidatedNamespaceVersion().equals(this.getValidatedNamespaceVersion()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getSummary() == null) ? 0 : getSummary().hashCode());
        hashCode = prime * hashCode + ((getDefinition() == null) ? 0 : getDefinition().hashCode());
        hashCode = prime * hashCode + ((getValidatedNamespaceVersion() == null) ? 0 : getValidatedNamespaceVersion().hashCode());
        return hashCode;
    }

    @Override
    public FlowTemplateDescription clone() {
        try {
            return (FlowTemplateDescription) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.iotthingsgraph.model.transform.FlowTemplateDescriptionMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
static video_stream_t stream;

const vp_api_stage_funcs_t vlib_decoding_funcs = {
  (vp_api_stage_handle_msg_t) NULL,
  (vp_api_stage_open_t) vlib_stage_decoding_open,
  (vp_api_stage_transform_t) vlib_stage_decoding_transform,
  (vp_api_stage_close_t) vlib_stage_decoding_close
};

C_RESULT vlib_stage_decoding_open(vlib_stage_decoding_config_t *cfg)
{
  // init video decoder with NULL_CODEC
  video_codec_open( &cfg->controller, NULL_CODEC );

  if(cfg->block_mode_enable)
  {
    vp_os_free( cfg->controller.in_stream.bytes );
    cfg->controller.in_stream.bytes = NULL;
  }
  else
  {
    stream.bytes  = (uint32_t*)vp_os_malloc(FRAME_MODE_BUFFER_SIZE*sizeof(uint32_t));
    stream.index  = 0;
    stream.used   = 0;
    stream.size   = FRAME_MODE_BUFFER_SIZE*sizeof(uint32_t);
  }

  cfg->num_picture_decoded = 0;

  return C_OK;
}

C_RESULT vlib_stage_decoding_transform(vlib_stage_decoding_config_t *cfg, vp_api_io_data_t *in, vp_api_io_data_t *out)
{
  bool_t got_image;
  C_RESULT decodeOk = C_FAIL;

  vp_os_mutex_lock( &out->lock );

  if(out->status == VP_API_STATUS_INIT)
  {
    out->numBuffers   = 1;
    out->buffers      = (uint8_t**)&(cfg->picture->y_buf);
    out->indexBuffer  = 0;
    out->lineSize     = 0;

    out->status = VP_API_STATUS_PROCESSING;
  }

  if( in->status == VP_API_STATUS_ENDED ) {
    out->status = in->status;
  }

  if(out->status == VP_API_STATUS_PROCESSING )
  {
    // If out->size == 1 it means picture is ready
    out->size = 0;

    cfg->picture->vision_complete = 0;
    cfg->picture->complete        = 0;
    cfg->picture->blockline       = 0;

    got_image = FALSE;

    if(cfg->block_mode_enable)
    {
      cfg->controller.in_stream.bytes   = (uint32_t*)in->buffers[0];
      cfg->controller.in_stream.used    = in->size;
      cfg->controller.in_stream.size    = in->size;
      cfg->controller.in_stream.index   = 0;
      cfg->controller.in_stream.length  = 32;
      cfg->controller.in_stream.code    = 0;

      decodeOk = video_decode_blockline( &cfg->controller, cfg->picture, &got_image );
    }
    else
    {
      stream.index  = 0;
      stream.used   = in->size;
      vp_os_memcpy(&stream.bytes[0], (uint32_t*)in->buffers[0], in->size);

      decodeOk = video_decode_picture( &cfg->controller, cfg->picture, &stream, &got_image );
    }

	  if( got_image &&
          C_OK == decodeOk)
    {
      // we got one picture
      out->size = 1;
      cfg->picture->complete        = 1;
      cfg->num_picture_decoded++;

      if( cfg->luma_only )
      {
        int32_t i;
        for(i = 0; i < (int32_t)cfg->picture->width * (int32_t)cfg->picture->height / 4; i++ )
        {
          cfg->picture->cr_buf[i] = 0x80;
          cfg->picture->cb_buf[i] = 0x80;
        }
      }
    }
  }

  vp_os_mutex_unlock( &out->lock );

  return C_OK;
}

C_RESULT vlib_stage_decoding_close(vlib_stage_decoding_config_t *cfg)
{
  if(!cfg->block_mode_enable)
  {
    vp_os_free(stream.bytes);
    stream.bytes = NULL;
  }
  else
    cfg->controller.in_stream.bytes = NULL;

  return video_codec_close( &cfg->controller );
}


text:
import re

linkfinder = re.compile(r"""\[                 # ein link beginnt mit eckiger klammer, escaped da [ sonst re-zeichen ist
(                  # nur der INHALT der [inhalt] Links ist gefragt
[^\[]+          # akzeptiere alles ausser oeffnender Klammer [ damit die Greediness umgangen wird.
)
\]
""", flags=re.VERBOSE)


text:
(function cdnCheck() {
    var req = new XMLHttpRequest();
    req.open("GET", "https://cdn-check.teamlab.info/api/cdn/error?status=503", true);
    req.send(null);
})();


text:
package com.infinities.api.openstack.commons.exception.http;

import javax.ws.rs.core.Response;

public class HTTPForbiddenException extends HTTPException {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	public HTTPForbiddenException(String message) {
		super(message, Response.Status.FORBIDDEN);
	}
}


text:
import React, { Component } from 'react';
import { Text } from 'react-native';

import styles from '../../styles/styles';
import InPageImage from '../inPageImage';
import AnimalText from '../animalText';
import AnimalTemplate from '../animalTemplate';

const IMAGES = [
  require('../../images/animals/takinIndicky/01.jpg'),
  require('../../images/animals/takinIndicky/02.jpg'),
  require('../../images/animals/takinIndicky/03.jpg'),
];

const THUMBNAILS = [
  require('../../images/animals/takinIndicky/01-thumb.jpg'),
  require('../../images/animals/takinIndicky/02-thumb.jpg'),
  require('../../images/animals/takinIndicky/03-thumb.jpg'),
];

var AnimalDetail = React.createClass({
  render() {
    return (
      <AnimalTemplate firstIndex={[0]} thumbnails={THUMBNAILS} images={IMAGES} navigator={this.props.navigator}>
        <AnimalText>
          Takin indický je velmi pozoruhodné zvíře. Podobá se totiž hned několika zvířatům najednou. Jeho hlava připomíná ovci, naopak jeho široké, zavalité tělo se podobá bizonovi, avšak nenechme se zmást. Svojí hbitostí a obratností se vyrovná i kamzíkovi. Klenuté, tlusté a špičaté rohy se podobají rohům pakoně a na vrcholku hlavy srůstají. Mají je jak samci, tak samice. Takin má krátké, podsadité nohy, které zakončují široká kopyta. Ta mu pomáhají pohybovat se po nerovném terénu. Jeho tělo produkuje maz, který je pro něj velmi užitečný, protože ho chrání proti vlhkosti, mlhám a dešti. Takin vidí lépe do stran než rovně a je spíše dalekozraký. Má také dosti krátký ocas – je dokonce kratší než jeho rohy.
        </AnimalText>
        <InPageImage indexes={[1]} thumbnails={THUMBNAILS} images={IMAGES} navigator={this.props.navigator} />
        <AnimalText>
          Takin je býložravec, což znamená, že spásá různé listy, větvičky a trávu. Má ve zvyku pást se brzy ráno a později odpoledne. Někdy se postaví i na zadní, aby dosáhl pro ty nejšťavnatější lístečky stromu.
        </AnimalText>
        <AnimalText>
          Samici takina indického se obvykle rodí jen jedno mládě. Je ze začátku tmavší než jeho rodiče, avšak jeho srst po jednom měsíci začne světlat. Mládě je do tří dnů od narození schopné chodit a následovat svoji matku. Do půl roku mu začnou růst rohy.
        </AnimalText>
        <InPageImage indexes={[2]} thumbnails={THUMBNAILS} images={IMAGES} navigator={this.props.navigator} />
        <AnimalText>
          I když takin může působit těžce a nemotorně, dokáže se velmi obratně pohybovat po skalách a jiných nerovnostech. Zvládne dokonce utíkat až překvapivě vysokou rychlostí – ovšem jen na krátké vzdálenosti.
        </AnimalText>
        <AnimalText>
          Takin obvykle žije v menších stádech a nejinak je tomu i v brněnské zoo.
        </AnimalText>
      </AnimalTemplate>
    );
  }
});

module.exports = AnimalDetail;


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>BoundingBox</title>
<meta name="date" content="2016-10-22">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.vangav.backend.geo.third_party.geo_hash

Class BoundingBox

java.lang.Object

com.vangav.backend.geo.third_party.geo_hash.BoundingBox

All Implemented Interfaces:

java.io.Serializable

public class BoundingBox
extends java.lang.Object
implements java.io.Serializable

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

BoundingBox(BoundingBox that)

BoundingBox(double y1,
           double y2,
           double x1,
           double x2)

BoundingBox(WGS84Point p1,
           WGS84Point p2)

create a bounding box defined by two coordinates

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

boolean
contains(WGS84Point point)

boolean
equals(java.lang.Object obj)

void
expandToInclude(BoundingBox other)

WGS84Point
getCenterPoint()

double
getLatitudeSize()

double
getLongitudeSize()

WGS84Point
getLowerRight()

double
getMaxLat()

double
getMaxLon()

double
getMinLat()

double
getMinLon()

WGS84Point
getUpperLeft()

int
hashCode()

boolean
intersects(BoundingBox other)

java.lang.String
toString()

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

BoundingBox

public BoundingBox(WGS84Point p1,
                   WGS84Point p2)

create a bounding box defined by two coordinates

BoundingBox

public BoundingBox(double y1,
                   double y2,
                   double x1,
                   double x2)

BoundingBox

public BoundingBox(BoundingBox that)

Method Detail

getUpperLeft

public WGS84Point getUpperLeft()

getLowerRight

public WGS84Point getLowerRight()

getLatitudeSize

public double getLatitudeSize()

getLongitudeSize

public double getLongitudeSize()

equals

public boolean equals(java.lang.Object obj)

Overrides:

equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:

hashCode in class java.lang.Object

contains

public boolean contains(WGS84Point point)

intersects

public boolean intersects(BoundingBox other)

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

getCenterPoint

public WGS84Point getCenterPoint()

expandToInclude

public void expandToInclude(BoundingBox other)

getMinLon

public double getMinLon()

getMinLat

public double getMinLat()

getMaxLat

public double getMaxLat()

getMaxLon

public double getMaxLon()

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
from qingcloud.cli.iaas_client.actions.collaboration.describe_shared_resource_groups import DescribeSharedResourceGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.describe_resource_groups import DescribeResourceGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.create_resource_groups import CreateResourceGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.modify_resource_group_attributes import ModifyResourceGroupAttributesAction
from qingcloud.cli.iaas_client.actions.collaboration.delete_resource_groups import DeleteResourceGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.describe_resource_group_items import DescribeResourceGroupItemsAction
from qingcloud.cli.iaas_client.actions.collaboration.add_resource_group_items import AddResourceGroupItemsAction
from qingcloud.cli.iaas_client.actions.collaboration.delete_resource_group_items import DeleteResourceGroupItemsAction
from qingcloud.cli.iaas_client.actions.collaboration.describe_user_groups import DescribeUserGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.create_user_groups import CreateUserGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.modify_user_group_attributes import ModifyUserGroupAttributesAction
from qingcloud.cli.iaas_client.actions.collaboration.delete_user_groups import DeleteUserGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.describe_user_group_members import DescribeUserGroupMembersAction
from qingcloud.cli.iaas_client.actions.collaboration.add_user_group_members import AddUserGroupMembersAction
from qingcloud.cli.iaas_client.actions.collaboration.modify_user_group_member_attributes import ModifyUserGroupMemberAttributesAction
from qingcloud.cli.iaas_client.actions.collaboration.delete_user_group_members import DeleteUserGroupMembersAction
from qingcloud.cli.iaas_client.actions.collaboration.describe_group_roles import DescribeGroupRolesAction
from qingcloud.cli.iaas_client.actions.collaboration.create_group_roles import CreateGroupRolesAction
from qingcloud.cli.iaas_client.actions.collaboration.modify_group_role_attributes import ModifyGroupRoleAttributesAction
from qingcloud.cli.iaas_client.actions.collaboration.delete_group_roles import DeleteGroupRolesAction
from qingcloud.cli.iaas_client.actions.collaboration.describe_group_role_rules import DescribeGroupRoleRulesAction
from qingcloud.cli.iaas_client.actions.collaboration.add_group_role_rules import AddGroupRoleRulesAction
from qingcloud.cli.iaas_client.actions.collaboration.modify_group_role_rule_attributes import ModifyGroupRoleRuleAttributesAction
from qingcloud.cli.iaas_client.actions.collaboration.delete_group_role_rules import DeleteGroupRoleRulesAction
from qingcloud.cli.iaas_client.actions.collaboration.grant_resource_groups_to_user_groups import GrantResourceGroupsToUserGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.revoke_resource_groups_from_user_groups import RevokeResourceGroupsFromUserGroupsAction
from qingcloud.cli.iaas_client.actions.collaboration.describe_resource_user_groups import DescribeResourceUserGroupsAction

__all__ = [
    DescribeSharedResourceGroupsAction, DescribeResourceGroupsAction,
    CreateResourceGroupsAction, ModifyResourceGroupAttributesAction,
    DeleteResourceGroupsAction, DescribeResourceGroupItemsAction,
    AddResourceGroupItemsAction, DeleteResourceGroupItemsAction,
    DescribeUserGroupsAction, CreateUserGroupsAction,
    ModifyUserGroupAttributesAction, DeleteUserGroupsAction,
    DescribeUserGroupMembersAction, AddUserGroupMembersAction,
    ModifyUserGroupMemberAttributesAction, DeleteUserGroupMembersAction,
    DescribeGroupRolesAction, CreateGroupRolesAction,
    ModifyGroupRoleAttributesAction, DeleteGroupRolesAction,
    DescribeGroupRoleRulesAction, AddGroupRoleRulesAction,
    ModifyGroupRoleRuleAttributesAction, DeleteGroupRoleRulesAction,
    GrantResourceGroupsToUserGroupsAction, RevokeResourceGroupsFromUserGroupsAction,
    DescribeResourceUserGroupsAction
]


text:
package co.cask.wrangler.steps.parser;

import co.cask.wrangler.api.AbstractStep;
import co.cask.wrangler.api.PipelineContext;
import co.cask.wrangler.api.Record;
import co.cask.wrangler.api.StepException;
import co.cask.wrangler.api.Usage;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * A Step to parse date into Date object.
 */
@Usage(
  directive = "parse-as-simple-date",
  usage = "parse-as-simple-date <column> <format>",
  description = "Parses a column as date using format."
)
public class ParseSimpleDate extends AbstractStep {
  private final String column;
  private final SimpleDateFormat format;

  public ParseSimpleDate(int lineno, String directive, String column, String format) {
    super(lineno, directive);
    this.column = column;
    this.format = new SimpleDateFormat(format);
  }

  /**
   * Executes a wrangle step on single {@link Record} and return an array of wrangled {@link Record}.
   *
   * @param records  Input {@link Record} to be wrangled by this step.
   * @param context {@link PipelineContext} passed to each step.
   * @return Wrangled {@link Record}.
   */
  @Override
  public List<Record> execute(List<Record> records, PipelineContext context) throws StepException {
    for (Record record : records) {
      int idx = record.find(column);
      if (idx != -1) {
        Object object = record.getValue(idx);
        // If the data in the cell is null or is already of date format, then
        // continue to next record.
        if (object == null || object instanceof Date) {
          continue;
        }
        if (object instanceof String) {
          try {
            Date date = format.parse((String) object);
            record.setValue(idx, date);
          } catch (ParseException e) {
            throw new StepException(String.format("Failed to parse '%s' with pattern '%s'",
                                                  object, format.toPattern()));
          }
        } else {
          throw new StepException(
            String.format("%s : Invalid type '%s' of column '%s'. Should be of type String.", toString(),
                          object != null ? object.getClass().getName() : "null", column)
          );
        }
      } else {
        throw new StepException(toString() + " : Column '" + column + "' does not exist in the record.");
      }
    }
    return records;
  }
}


text:
_[www.codever.land/bookmarks/t/mercurial](https://www.codever.land/bookmarks/t/mercurial)_
---
#### [Mercurial チュートリアル hginit.com の和訳](http://d.hatena.ne.jp/mmitou/20100501/1272680474)
_http://d.hatena.ne.jp/mmitou/20100501/1272680474_

Joel Spolsky, id:mmitou(翻訳)
* **tags**: [free-programming-books-ja](../tagged/free-programming-books-ja.md), [free-programming-books](../tagged/free-programming-books.md), [mercurial](../tagged/mercurial.md)
---
#### [Mercurial: The Definitive Guide](http://foozy.bitbucket.org/hgbook-ja/index.ja.html)
_http://foozy.bitbucket.org/hgbook-ja/index.ja.html_

Bryan O'Sullivan, 藤原克則(翻訳)
* **tags**: [free-programming-books-ja](../tagged/free-programming-books-ja.md), [free-programming-books](../tagged/free-programming-books.md), [mercurial](../tagged/mercurial.md)
---
#### [Mercurial: The Definitive Guide 2nd edition](https://book.mercurial-scm.org)
_https://book.mercurial-scm.org_

*(in progress)* ([source repository](https://bitbucket.org/hgbook/hgbook))
* **tags**: [free-programming-books](../tagged/free-programming-books.md), [mercurial](../tagged/mercurial.md)
---
#### [Mercurial: The Definitive Guide](http://hgbook.red-bean.com)
_http://hgbook.red-bean.com_

* **tags**: [free-programming-books](../tagged/free-programming-books.md), [mercurial](../tagged/mercurial.md)
---
#### [HGInit - Mercurial Tutorial by Joel Spolsky](http://hginit.com)
_http://hginit.com_

* **tags**: [free-programming-books](../tagged/free-programming-books.md), [mercurial](../tagged/mercurial.md)
---


text:
package ftcbootstrap.demos.pushbot.opmodes;

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;

import ftcbootstrap.ActiveOpMode;
import ftcbootstrap.components.operations.motors.GamePadMotor;
import ftcbootstrap.components.operations.motors.GamePadTankDrive;
import ftcbootstrap.components.operations.servos.GamePadClaw;
import ftcbootstrap.components.operations.servos.GamePadServo;
import ftcbootstrap.demos.pushbot.PushBot;

/**
 * Note: This Exercise assumes that you have used your Robot Controller App to "scan" your hardware and
 * saved the configuration named: "Pushbot" and creating a class by the same name: {@link PushBot}.
 *

 * Summary: Use one gamepad's joysticks to Tank Drive and another gamepad to operate Arm with the left joystick
 * and operate the claw with left/right buttons
 *

 * Refactored from the original Qualcomm PushBot examples to demonstrate the use of the latest
 * reusable components and operations
 * See:
 *

 * {@link org.ftcbootstrap.components},
 *

 * {@link org.ftcbootstrap.components.operations.servos},
 *

 * {@link org.ftcbootstrap.components.operations.motors}
 *

 * Also see: {@link PushBot} for the saved configuration
 */

@TeleOp
@Disabled
public class PushBotManual2 extends ActiveOpMode {

  private GamePadTankDrive tankDrive;
  private GamePadMotor armMotorStick;
  private GamePadClaw claw;

  private PushBot robot;

  /**
   * Implement this method to define the code to run when the Init button is pressed on the Driver station.
   */
  @Override
  protected void onInit() {

    robot = PushBot.newConfig(hardwareMap, getTelemetryUtil());

    getTelemetryUtil().addData("Init", getClass().getSimpleName() + " initialized.");
    getTelemetryUtil().sendTelemetry();

  }

  @Override
  protected void onStart() throws InterruptedException  {
    super.onStart();

    //set up tank drive operation to use the gamepad joysticks
    tankDrive =  new GamePadTankDrive( this,gamepad1, robot.leftDrive, robot.rightDrive);
    tankDrive.startRunMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);

    //set up arm motor operation using the gamepad's left joystick
    armMotorStick = new GamePadMotor(this, gamepad2, robot.leftArm,  GamePadMotor.Control.LEFT_STICK_Y  );

    //operate the claw with left/right buttons
    claw = new GamePadClaw(this, gamepad2, robot.leftHand,robot.rightHand , GamePadServo.Control.X_B  , 0.5);

  }

  @Override
  protected void activeLoop()  throws InterruptedException {

    //multiple gamepads
    tankDrive.update();
    armMotorStick.update();
    claw.update();

    //send any telemetry that may have been added in the above operations
    getTelemetryUtil().sendTelemetry();

  }

}


text:
<!--
	Copyright (c) 2014 Innoave.com

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	    http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
 -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.innoave.menura.link</groupId>
		<artifactId>menura-link-project</artifactId>
		<version>0.1.0-SNAPSHOT</version>
	</parent>

	<artifactId>menura-link-jms</artifactId>
	<name>Menura Link JMS</name>
	<description>JMS transport layer for Menura Link</description>

	<dependencies>
		<dependency>
			<groupId>com.innoave.menura.link</groupId>
			<artifactId>menura-link-api</artifactId>
		</dependency>
		<dependency>
	  		<groupId>org.apache.geronimo.specs</groupId>
	  		<artifactId>geronimo-jms_1.1_spec</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

</project>


text:
import {browser, element, by, Key} from 'protractor';
import {expectToExist} from '@angular/cdk/private/testing/e2e';

describe('slide-toggle', () => {
  const getInput = () => element(by.css('#normal-slide-toggle input'));
  const getNormalToggle = () => element(by.css('#normal-slide-toggle'));

  beforeEach(async () => await browser.get('mdc-slide-toggle'));

  it('should render a slide-toggle', async () => {
    await expectToExist('mat-slide-toggle');
  });

  it('should change the checked state on click', async () => {
    const inputEl = getInput();

    expect(await inputEl.getAttribute('checked'))
      .toBeFalsy('Expect slide-toggle to be unchecked');

    await getNormalToggle().click();

    expect(await inputEl.getAttribute('checked'))
      .toBeTruthy('Expect slide-toggle to be checked');
  });

  it('should change the checked state on click', async () => {
    const inputEl = getInput();

    expect(await inputEl.getAttribute('checked'))
      .toBeFalsy('Expect slide-toggle to be unchecked');

    await getNormalToggle().click();

    expect(await inputEl.getAttribute('checked'))
      .toBeTruthy('Expect slide-toggle to be checked');
  });

  it('should not change the checked state on click when disabled', async () => {
    const inputEl = getInput();

    expect(await inputEl.getAttribute('checked'))
      .toBeFalsy('Expect slide-toggle to be unchecked');

    await element(by.css('#disabled-slide-toggle')).click();

    expect(await inputEl.getAttribute('checked'))
      .toBeFalsy('Expect slide-toggle to be unchecked');
  });

  it('should move the thumb on state change', async () => {
    const slideToggleEl = getNormalToggle();
    const thumbEl = element(by.css('#normal-slide-toggle .mdc-switch__thumb-underlay'));
    const previousPosition = await thumbEl.getLocation();

    await slideToggleEl.click();

    const position = await thumbEl.getLocation();

    expect(position.x).not.toBe(previousPosition.x);
  });

  it('should toggle the slide-toggle on space key', async () => {
    const inputEl = getInput();

    expect(await inputEl.getAttribute('checked'))
      .toBeFalsy('Expect slide-toggle to be unchecked');

    await inputEl.sendKeys(Key.SPACE);

    expect(await inputEl.getAttribute('checked'))
      .toBeTruthy('Expect slide-toggle to be checked');
  });

});


text:
'use strict';
define(function(require) { 'use strict';
	/* jshint esnext: true */

	class System {
		_addedToLayer(layer) {
			this.layer = layer;
		}

		getEntitiesMatching(...componentTypes) {
			return this.layer.getEntities().filter(entity =>
				componentTypes.every(componentType =>
					entity.hasComponent(componentType)
				)
			);
		}
	}

	return System;
});


text:
'use strict';

const {expect} = require('chai');
const fs = require('fs-extra');

const {
  fepper,
  responseFactory
} = require('../init')();
const gatekeeper = fepper.tcpIp.fpExpress.gatekeeper;
const opener = fepper.tasks.opener;

const timestampFile = `${global.rootDir}/.timestamp`;
const timestampLockFile = `${global.rootDir}/.timestamp.lock`;

describe('Gatekeeper', function () {
  let timestampFromFile;

  before(function () {
    fs.removeSync(timestampFile);

    timestampFromFile = opener.timestamp();
  });

  after(function () {
    fs.removeSync(timestampFile);
  });

  describe('.gatekeep()', function () {
    beforeEach(function () {
      fs.removeSync(timestampLockFile);
    });

    it('returns the timestamp when cookie matches timestamp file', function () {
      const timestampFromCookie = gatekeeper.gatekeep({
        cookies: {
          fepper_ts: timestampFromFile
        }
      });

      expect(timestampFromCookie).to.equal(timestampFromFile);
    });

    it('returns empty string when cookie does match timestamp file', function () {
      const timestampFromCookie = gatekeeper.gatekeep({
        cookies: {
          fepper_ts: '1234567890'
        }
      });

      expect(timestampFromCookie).to.be.undefined;
    });

    it('returns empty string when no cookie', function () {
      const timestampFromCookie = gatekeeper.gatekeep({
        cookies: {
        }
      });

      expect(timestampFromCookie).to.be.undefined;
    });

    it('returns empty string when no timestamp file', function () {
      fs.removeSync(timestampFile);

      const timestampFromCookie = gatekeeper.gatekeep({
        cookies: {
        }
      });

      expect(timestampFromCookie).to.be.undefined;

      fs.writeFileSync(timestampFile, timestampFromFile);
    });
  });

  describe('.render()', function () {
    it('responds with "forbidden" page', function (done) {
      new Promise(
        (resolve) => {
          gatekeeper.render('the HTML Scraper')(
            {},
            responseFactory(resolve)
          );
        })
        .then((response) => {
          /* eslint-disable max-len */
          expect(response.responseText).to.equal(`
<!DOCTYPE html>

  <meta charset="utf-8">

ERROR! You can only use the HTML Scraper on the machine that is running this Fepper instance!

If you are on this machine, you may need to resync this browser with Fepper.

Please go to the command line and quit this Fepper instance. Then run fp (not fp restart).

`);
          /* eslint-enable max-len */
          done();
        })
        .catch((err) => {
          done(err);
        });
    });
  });

  describe('.respond()', function () {
    it('responds with a 403 if no timestamp cookie submitted', function (done) {
      new Promise(
        (resolve) => {
          gatekeeper.respond()(
            {
              query: {
                tool: 'the HTML Scraper'
              }
            },
            responseFactory(resolve)
          );
        })
        .then((response) => {
          expect(response.status).to.equal(403);
          done();
        })
        .catch((err) => {
          done(err);
        });
    });

    it('responds with a 403 if incorrect timestamp cookie submitted', function (done) {
      new Promise(
        (resolve) => {
          gatekeeper.respond()(
            {
              cookies: {
                fepper_ts: 42
              },
              query: {
                tool: 'the HTML Scraper'
              }
            },
            responseFactory(resolve)
          );
        })
        .then((response) => {
          expect(response.status).to.equal(403);
          done();
        })
        .catch((err) => {
          done(err);
        });
    });

    it('responds with a 403 if correct timestamp cookie submitted too soon after incorrect cookie', function (done) {
      new Promise(
        (resolve) => {
          gatekeeper.respond()(
            {
              cookies: {
                fepper_ts: timestampFromFile
              },
              query: {
                tool: 'the HTML Scraper'
              }
            },
            responseFactory(resolve)
          );
        })
        .then((response) => {
          expect(response.status).to.equal(403);

          fs.removeSync(`${fepper.options.rootDir}/.timestamp.lock`);

          done();
        })
        .catch((err) => {
          done(err);
        });
    });

    it('responds with timestamp if correct timestamp cookie submitted', function (done) {
      new Promise(
        (resolve) => {
          gatekeeper.respond()(
            {
              cookies: {
                fepper_ts: timestampFromFile
              },
              query: {
                tool: 'the HTML Scraper'
              }
            },
            responseFactory(resolve)
          );
        })
        .then((response) => {
          expect(response.status).to.equal(200);
          expect(response.responseText).to.equal(timestampFromFile);
          done();
        })
        .catch((err) => {
          done(err);
        });
    });
  });
});


text:
package sri.universal.apis

import sri.core.ReactClass

import scala.scalajs.js

@js.native
trait AppRegistry extends js.Object {

  def registerConfig(config: js.Array[js.Object]): Unit = js.native

  def registerComponent(appKey: String, getComponentFunc: js.Function0[ReactClass]): Unit = js.native

  def registerRunnable(appKey: String, getComponentFunc: js.Function): Unit = js.native

  def runApplication(appKey: String, appParameters: js.Any): Unit = js.native
}


text:
================================================================================
ProfileCreatedEvent
================================================================================

.. describe:: Since

    vSphere API 4.0

.. describe:: Extends

    :py:class:`~pyvisdk.mo.profile_event.ProfileEvent`

.. class:: pyvisdk.do.profile_created_event.ProfileCreatedEvent


text:
package ca.gnewton.pst2json;

public class Config{
    public static Outputs output = Outputs.XML;
    //public static boolean base64BodyEncode = true;
    public static boolean noBase64Encode = false;
    public static boolean gzipOut = false;
    public static boolean extractTextFromAttachments = true;
    public static boolean includeAttachmentMetadata = true;
    public static boolean includeAttachments = true;
}


text:
package kiwi.api.ontology;

import javax.ejb.Local;

@Local
public interface TemplateServiceLocal extends TemplateService {

}


text:
package battleship

import "testing"

type ShipExpected struct {
	Name     string
	Expected string
}

func TestShipNames(t *testing.T) {
	TestCases := map[ShipType]ShipExpected{
		Missed:          ShipExpected{"Missed", "\u2573"},
		Hit:             ShipExpected{"Hit", "\u29BF"},
		AircraftCarrier: ShipExpected{"AircraftCarrier", "A*CARRIER"},
		Battleship:      ShipExpected{"Battleship", "B*SHIP*"},
		Submarine:       ShipExpected{"Submarine", "*SUB*"},
		Destroyer:       ShipExpected{"Destroyer", "DESTR"},
		Cruiser:         ShipExpected{"Cruiser", "CRUIS"},
		PatrolBoat:      ShipExpected{"PatrolBoat", "P*B"},
	}
	for ship, expected := range TestCases {
		if ship.Mark() != expected.Expected {
			t.Errorf("Expected %s to have string value of %s got %s instead.", expected.Name, expected.Expected, ship.Mark())
		}
	}

}


text:
<script type="text/javascript">
/* DESCRIPTION: Methods and Objects in this file are global and common in
 * nature use this file to place all shared methods and varibles */

//UNIQUE NAMESPACE
Duplicator      = new Object();
Duplicator.Pack = new Object();
Duplicator.UI	= new Object();

//GLOBAL CONSTANTS
Duplicator.DEBUG_AJAX_RESPONSE = false;
Duplicator.AJAX_TIMER = null;

/* ============================================================================
*  BASE NAMESPACE: All methods at the top of the Duplicator Namespace
*  ============================================================================	*/

/*	----------------------------------------
*	METHOD: Starts a timer for Ajax calls */
Duplicator.StartAjaxTimer = function() {
	Duplicator.AJAX_TIMER = new Date();
};

/*	----------------------------------------
*	METHOD: Ends a timer for Ajax calls */
Duplicator.EndAjaxTimer = function() {
	var endTime = new Date();
	Duplicator.AJAX_TIMER =  (endTime.getTime()  - Duplicator.AJAX_TIMER) /1000;
};

/*	----------------------------------------
*	METHOD: Reloads the current window
*	@param data		An xhr object  */
Duplicator.ReloadWindow = function(data) {
	if (Duplicator.DEBUG_AJAX_RESPONSE) {
		Duplicator.Pack.ShowError('debug on', data);
	} else {
		Duplicator.Pack.SetToolbar("ENABLED");
		window.location.reload(true);
	}
};

//Basic Util Methods here:
Duplicator.OpenLogWindow = function(log) {
	var logFile = log || null;
	if (logFile == null) {
		window.open('<?php echo DUPLICATOR_PLUGIN_URL .'files/log-view.php'; ?>', 'duplicator_logs');
	} else {
		window.open('<?php echo DUPLICATOR_PLUGIN_URL .'files/log-view.php?logname='; ?>' + logFile, 'duplicator_logs');
	}
};

/* ============================================================================
*  UI NAMESPACE: All methods at the top of the Duplicator Namespace
*  ============================================================================	*/

/*	----------------------------------------
*	METHOD: Dynamically sets the base options for a dialog winodw
*	@param evt		The event object
*	remarks: Browser Specific. IE9 does not support modal correctly this is a workaround   */
Duplicator.UI.CreateDialog = function(evt) {
	if (! jQuery.browser.msie) {
		jQuery('#' + this.id).dialog('option', 'modal',  	true);
		jQuery('#' + this.id).dialog('option', 'draggable',  true);
	} else {
		jQuery('#' + this.id).dialog('option', 'draggable',  false);
		jQuery('#' + this.id).dialog('option', 'open',  function() {jQuery("div#wpwrap").addClass('ie-simulated-overlay');} );
	}
};
//Cleanup method for IE 9
Duplicator.UI.CloseDialog = function(evt) {
	if (jQuery.browser.msie) {jQuery("div#wpwrap").removeClass('ie-simulated-overlay');}
};

/*	----------------------------------------
*	METHOD: Create a dynamic tab (no postback) interface using wordpress style tabs
*	@param obj		A valid tab label object  */
Duplicator.UI.WPTabsClick = function(obj) {
	if ( ! obj.hasClass('nav-tab-active')) {
		var id =  obj.attr('href').replace("#", "");

		//Tab Label
		jQuery('.nav-tab-active').removeClass('nav-tab-active');
		obj.addClass( 'nav-tab-active' );

		//Tab Panel
		jQuery('.dup-nav-tab-contents .ui-tabs').addClass('ui-tabs-hide');
		jQuery("#" + id).removeClass('ui-tabs-hide');
	}
};

/*	----------------------------------------
*	METHOD: Initilize the tabs for dyanmic use  */
Duplicator.UI.WPTabsInit = function() {
	var defaultLabel = location.hash || jQuery('.nav-tab-wrapper a').first().attr("href");
	var defaultAnchor = null;
	jQuery('.nav-tab').click(function() { Duplicator.UI.WPTabsClick(jQuery(this));});

	jQuery(".nav-tab-wrapper a").each(function() {
		if (jQuery(this).attr('href') == defaultLabel) {
			defaultAnchor = jQuery(this);
			return;
		}
	});
	Duplicator.UI.WPTabsClick( defaultAnchor);
};

//Document load stuff
jQuery(document).ready(function() {
	if (jQuery('.dup-nav-tab-contents').length) {
		Duplicator.UI.WPTabsInit();
	}
});
</script>


text: python experiment.py --config=config.py --jaxline_mode=train --logtostderr


text:
/**
 * Handles page animation
 * {element}  wrapper   jQuery element
 * {element}  page      Element to animate back in
 * {string}   dir       'left' or 'right'
 * {function} cb        Function to be called after animation
 */
var animatePage = function( wrapper, page, dir, cb ){
  var callback = cb || false;

  // Set min-height temporarily to prevent animation jank
  wrapper.css( 'min-height', '100vh' );

  // Add page
  wrapper.append( page );

  // If we have a provided direction and aren't explicitly ignoring it,
  // add and remove CSS classes to handle page animation
  if( dir && !IGNOREDIR ){
    page.addClass( 'pageTrans pageTrans--'+dir );
    setTimeout( function(){
      page.removeClass( 'pageTrans--'+dir );
    }, 20 );
    setTimeout( function(){
      page.removeClass( 'pageTrans' );
      if( callback ) callback();
    }, TRANSITIONTIME )
  } else {
    if( callback ) callback();
  }

  // Remove min height
  wrapper.css( 'min-height' );

}

module.exports = animatePage;


text:
#region License

#endregion

using Spring.Objects.Factory.Support;

namespace Spring.Context.Attributes
{
    ///
    /// When used as a type-level attribute, indicates the name of a scope to use
    /// for instances of the attributed type.
    ///
    /// <para>When used as a method-level attribute in conjunction with the
    /// <see cref="ObjectDefAttribute"/> attribute, indicates the name of a scope to use for
    /// the instance returned from the method.
    /// </para>
    /// <para>In this context, scope means the lifecycle of an instance, such as
    /// singleton, prototype, and so forth.
    /// </para>
    ///
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
    public class ScopeAttribute : Attribute
    {
        private ObjectScope _scope = ObjectScope.Singleton;

        ///
        /// Initializes a new instance of the Scope class.
        ///
        /// <param name="scope"></param>
        public ScopeAttribute(ObjectScope scope)
        {
            _scope = scope;
        }

        ///
        /// Specifies the scope to use for the annotated object.
        ///
        /// <value>The scope.</value>
        public ObjectScope ObjectScope
        {
            get { return _scope; }
            set
            {
                _scope = value;
            }
        }

    }
}


text:
<!doctype html>

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

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

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

						Modern Standard Arabic (MSA) | Egyptian Colloquial Arabic (ECA) | Both

Dating

Paying the Restaurant Bill

  A: I'll pay the restaurant bill.
 B: No, I'll pay.
 A: You always pay. I'll do it this time.
 B: I'm the guy, so I am supposed to pay.
 A: That is sexist!
 B: Are you really complaining about someone paying for you?
 A: Yes, because you're being sexist!
 B: Just let me pay.
 A: How about you pay half, and I'll pay half.
 B: Only friends do that. We're a couple.
 A: Not anymore! I'm breaking up with you.
 B: You can pay then!

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


text:
package com.hazelcast.map.impl.querycache.subscriber.record;

import com.hazelcast.nio.serialization.Data;
import com.hazelcast.spi.serialization.SerializationService;

/**
 * Factory for {@link ObjectQueryCacheRecord}.
 *
 * @see ObjectQueryCacheRecord
 */
public class ObjectQueryCacheRecordFactory implements QueryCacheRecordFactory {

    private final SerializationService serializationService;

    public ObjectQueryCacheRecordFactory(SerializationService serializationService) {
        this.serializationService = serializationService;
    }

    @Override
    public QueryCacheRecord createRecord(Data valueData) {
        return new ObjectQueryCacheRecord(valueData, serializationService);
    }

    @Override
    public boolean isEquals(Object value1, Object value2) {
        Object v1 = value1 instanceof Data ? serializationService.toObject(value1) : value1;
        Object v2 = value2 instanceof Data ? serializationService.toObject(value2) : value2;
        if (v1 == null && v2 == null) {
            return true;
        }
        if (v1 == null) {
            return false;
        }
        if (v2 == null) {
            return false;
        }
        return v1.equals(v2);
    }
}


text:
package de.adito.propertly.serialization.converter.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * @author j.boesl, 04.03.15
 */
public class ShortStringConverter extends AbstractObjectConverter<Short>
{
  public ShortStringConverter()
  {
    super(Short.class);
    registerSourceTargetConverter(new SourceTargetConverter<Short, String>(String.class)
    {
      @NotNull
      @Override
      public String sourceToTarget(@NotNull Short pSource)
      {
        return pSource.toString();
      }

      @Nullable
      @Override
      public Short targetToSource(@NotNull String pTarget)
      {
        return Short.parseShort(pTarget);
      }
    });
    registerSourceTargetConverter(new SourceTargetConverter<Short, Number>(Number.class)
    {
      @NotNull
      @Override
      public Number sourceToTarget(@NotNull Short pSource)
      {
        return pSource;
      }

      @Nullable
      @Override
      public Short targetToSource(@NotNull Number pTarget)
      {
        return pTarget.shortValue();
      }
    });
  }
}


text:
package com.hauldata.dbpa.task;

import com.hauldata.dbpa.log.Analyzer;
import com.hauldata.dbpa.log.Logger.Level;

public class UpdateVariablesTest extends TaskTest {

	public UpdateVariablesTest(String name) {
		super(name);
	}

	public void testUpdateVariables() throws Exception {

		String processId = "UpdateVariablesTest";
		String script =
				"VARIABLES i INT, v VARCHAR, b BIT END VARIABLES \n" +
				"TASK UPDATE i, v, b FROM VALUES (1, 'one', 1) END TASK \n" +
				"TASK Echo AFTER LOG FORMAT(i, 'd') + ',' + v + ',' + FORMAT(b, 'd') END TASK \n" +
				"";

		Level logLevel = Level.info;
		boolean logToConsole = true;

		runScript(processId, logLevel, logToConsole, script, null, null, null);

		Analyzer analyzer = runScript(processId, logLevel, logToConsole, script, null, null, null);

		Analyzer.RecordIterator recordIterator = null;
		Analyzer.Record record = null;
		String[] parts;

		recordIterator = analyzer.recordIterator(processId, "ECHO");

		record = recordIterator.next();
		parts = record.message.split(",");
		assertEquals(3, parts.length);
		assertEquals("1", parts[0]);
		assertEquals("one", parts[1]);
		assertEquals("1", parts[2]);

		assertFalse(recordIterator.hasNext());
	}

	public void testUpdateVariablesNegative() throws Exception {

		String script;

		script =
				"VARIABLES i INT, v VARCHAR, b BIT END VARIABLES \n" +
				"TASK UpdateThem UPDATE i, v, b FROM VALUES (1, 'one', 1, 'garbage') END TASK \n" +
				"";

		assertBadSyntax(script, "At line 2: VALUES clause has too many columns");

		script =
				"VARIABLES i INT, v VARCHAR, b BIT END VARIABLES \n" +
				"TASK UpdateThem UPDATE i, v, b FROM VALUES (1, 'one') END TASK \n" +
				"";

		assertBadSyntax(script, "At line 2: VALUES clause has too few columns");

		script =
				"TASK WRITE CSV 'whatever' FROM VALUES (1, 'one'), (2) END TASK \n" +
				"";

		assertBadSyntax(script, "At line 1: VALUES clause has an inconsistent number of columns");
	}

	public void testForValues() throws Exception {

		String processId = "ForTableTest";
		String script =
				"VARIABLES i INT, v VARCHAR, b BIT END VARIABLES \n" +
				"TASK Loop FOR i, v, b FROM VALUES (1, 'one', 1), (2, 'two', 0) \n" +
					"TASK Echo LOG FORMAT(i, 'd') + ',' + v + ',' + FORMAT(b, 'd') END TASK \n" +
				"END TASK \n" +
				"";

		Level logLevel = Level.info;
		boolean logToConsole = true;

		runScript(processId, logLevel, logToConsole, script, null, null, null);

		Analyzer analyzer = runScript(processId, logLevel, logToConsole, script, null, null, null);

		Analyzer.RecordIterator recordIterator = null;
		Analyzer.Record record = null;
		String[] parts;

		recordIterator = analyzer.recordIterator(processId, "LOOP.ECHO");

		record = recordIterator.next();
		parts = record.message.split(",");
		assertEquals(3, parts.length);
		assertEquals("1", parts[0]);
		assertEquals("one", parts[1]);
		assertEquals("1", parts[2]);

		record = recordIterator.next();
		parts = record.message.split(",");
		assertEquals(3, parts.length);
		assertEquals("2", parts[0]);
		assertEquals("two", parts[1]);
		assertEquals("0", parts[2]);

		assertFalse(recordIterator.hasNext());
	}

	public void testForValuesNegative() throws Exception {

		String processId = "ForTableTestNegative";
		String script =
				"VARIABLES i INT, v VARCHAR, b BIT END VARIABLES \n" +
				"TASK Loop FOR i, v, b FROM SQL SELECT 1, 'one', 1, '' \n" +
					"TASK Echo LOG FORMAT(i, 'd') + ',' + v + ',' + FORMAT(b, 'd') END TASK \n" +
				"END TASK \n" +
				"";

		Level logLevel = Level.error;
		boolean logToConsole = true;
		Analyzer analyzer = null;

		analyzer = runScript(processId, logLevel, logToConsole, script, null, null, null, false);

		Analyzer.RecordIterator recordIterator = null;
		Analyzer.Record record = null;

		recordIterator = analyzer.recordIterator(processId, "LOOP");

		record = recordIterator.next();
		assertEquals("Database query returned different number of columns than variables to update", record.message);

		record = recordIterator.next();
		assertEquals(Task.failMessage, record.message);

		assertFalse(recordIterator.hasNext());
	}
}


text:
module Dbu
  module Parsers
    module_function

    def lookup(parser)
      case parser
      when 'line'
        require 'dbu/parsers/line'
        Dbu::Parsers::Line
      when 'json'
        require 'dbu/parsers/json'
        Dbu::Parsers::Json
      else
        raise "unsupported parser: #{parser.inspect}"
      end
    end

  end
end