text:
(function(){
  var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;

  // The base Class implementation (does nothing)
  this.Class = function(){};

  // Create a new Class that inherits from this class
  Class.extend = function(prop) {
    var _super = this.prototype;

    // Instantiate a base class (but only create the instance,
    // don't run the init constructor)
    initializing = true;
    var prototype = new this();
    initializing = false;

    // Copy the properties over onto the new prototype
    for (var name in prop) {
      // Check if we're overwriting an existing function
      prototype[name] = typeof prop[name] == "function" &&
        typeof _super[name] == "function" && fnTest.test(prop[name]) ?
        (function(name, fn){
          return function() {
            var tmp = this._super;

            // Add a new ._super() method that is the same method
            // but on the super-class
            this._super = _super[name];

            // The method only need to be bound temporarily, so we
            // remove it when we're done executing
            var ret = fn.apply(this, arguments);
            this._super = tmp;

            return ret;
          };
        })(name, prop[name]) :
        prop[name];
    }

    // The dummy class constructor
    function Class() {
      // All construction is actually done in the init method
      if ( !initializing && this.init )
        this.init.apply(this, arguments);
    }

    // Populate our constructed prototype object
    Class.prototype = prototype;

    // Enforce the constructor to be what we expect
    Class.constructor = Class;

    // And make this class extendable
    Class.extend = arguments.callee;

    return Class;
  };
})();

var Collage = Class.extend({
    DEFAULT_TARGET_HEIGHT: 250,
    DEFAULT_BORDER_WIDTH: 1,

    init: function(params) {
        this._photos = params.photos;
        this._renderTargetId = params.renderTargetId;
        this._containerWidth = params.width || $('#' + this._renderTargetId).width();
        this._clipSize = (params.borderWidth || this.DEFAULT_BORDER_WIDTH) * 2;
        this._targetHeight = (params.targetRowHeight || this.DEFAULT_TARGET_HEIGHT);

        var timeoutId;
        var self = this;
        $(window).resize(function() {
            clearTimeout(timeoutId);
            timeoutId = setTimeout(self.doneResizing, 500);
        });
    },
    doneResizing: function(){
      this.render();
      // console.log('done')
    },

    render: function() {
        var rowData = this.setupRows();
        this.renderRows(rowData.rows, rowData.rowWidths);
    },

    getImageWidth: function(photo) {
        return photo.width;
    },

    getImageHeight: function(photo) {
        return photo.height;
    },

    getScaledWidth: function(photo) {
        var imgWidth = this.getImageWidth(photo);
        var imgHeight = this.getImageHeight(photo);
        return imgWidth * this._targetHeight / imgHeight;
    },

    // returns rows which is array of arrays
    setupRows: function() {
        // have a target height
        // iterate through each photo
        var rows = [];
        var rowWidths = [];
        var row = [];
        var tempWidth = 0;
        var rowCount = 0;
        rows[rowCount] = new Array();
        for (var i = 0; i < this._photos.length; i++) {
            var photo = this._photos[i];
            // keep track of a 'row' by summing the scaled widths until we cross the max width
            // calculate scaled width given target height
            var scaledWidth = this.getScaledWidth(photo);
            tempWidth += scaledWidth;
            if (tempWidth < this._containerWidth) {
                rows[rowCount].push(photo);
                rowWidths[rowCount] = tempWidth;
            } else {
                rowCount++;
                tempWidth = scaledWidth;
                rows[rowCount] = new Array();
                rows[rowCount].push(photo);
                rowWidths[rowCount] = tempWidth;
            }
        }
        // we handle special case where we have 1 left in last row
        if (rows[rowCount].length == 1 && rowCount > 0) {
            rows[rowCount - 1].push(photo);
            rowWidths[rowCount - 1] += this.getScaledWidth(photo);
            rows.pop();
            rowWidths.pop();
        }

        return {rows: rows, rowWidths: rowWidths};
    },

    renderRows: function(rows, rowWidths) {
        var str = '';
        for (var i = 0; i < rows.length; i++) {
            str += this.renderRow(rows[i], rowWidths[i]);
        }
        $('#' + this._renderTargetId).html(str);
    },

    // row is an array of photos
    renderRow: function(rowPhotos, tempWidth) {
        var str = '';
        var ratio = this._containerWidth / tempWidth;
        for (var i = 0; i < rowPhotos.length; i++) {
            var photo = rowPhotos[i];
            var finalWidth = this.getScaledWidth(photo) * ratio;
            var finalHeight = this._targetHeight * ratio;
            str += '
'
            if (photo.linkUrl) {
                str += '';
            }
            str += ''
            if (photo.linkUrl) {
                str += '';
            }
            str += '
';
        }
        return str;
    }
});


text:
/**
 * @module ol/interaction/DragPan
 */
import {inherits} from '../util.js';
import ViewHint from '../ViewHint.js';
import {scale as scaleCoordinate, rotate as rotateCoordinate, add as addCoordinate} from '../coordinate.js';
import {easeOut} from '../easing.js';
import {noModifierKeys} from '../events/condition.js';
import {FALSE} from '../functions.js';
import PointerInteraction, {centroid as centroidFromPointers} from '../interaction/Pointer.js';

/**
 * @typedef {Object} Options
 * @property {module:ol/events/condition~Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
 * to indicate whether that event should be handled.
 * Default is {@link module:ol/events/condition~noModifierKeys}.
 * @property {module:ol/Kinetic} [kinetic] Kinetic inertia to apply to the pan.
 */

/**
 * @classdesc
 * Allows the user to pan the map by dragging the map.
 *
 * @constructor
 * @extends {module:ol/interaction/Pointer}
 * @param {module:ol/interaction/DragPan~Options=} opt_options Options.
 * @api
 */
const DragPan = function(opt_options) {

  PointerInteraction.call(this, {
    handleDownEvent: handleDownEvent,
    handleDragEvent: handleDragEvent,
    handleUpEvent: handleUpEvent
  });

  const options = opt_options ? opt_options : {};

  /**
   * @private
   * @type {module:ol/Kinetic|undefined}
   */
  this.kinetic_ = options.kinetic;

  /**
   * @type {module:ol~Pixel}
   */
  this.lastCentroid = null;

  /**
   * @type {number}
   */
  this.lastPointersCount_;

  /**
   * @private
   * @type {module:ol/events/condition~Condition}
   */
  this.condition_ = options.condition ? options.condition : noModifierKeys;

  /**
   * @private
   * @type {boolean}
   */
  this.noKinetic_ = false;

};

inherits(DragPan, PointerInteraction);

/**
 * @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
 * @this {module:ol/interaction/DragPan}
 */
function handleDragEvent(mapBrowserEvent) {
  const targetPointers = this.targetPointers;
  const centroid = centroidFromPointers(targetPointers);
  if (targetPointers.length == this.lastPointersCount_) {
    if (this.kinetic_) {
      this.kinetic_.update(centroid[0], centroid[1]);
    }
    if (this.lastCentroid) {
      const deltaX = this.lastCentroid[0] - centroid[0];
      const deltaY = centroid[1] - this.lastCentroid[1];
      const map = mapBrowserEvent.map;
      const view = map.getView();
      let center = [deltaX, deltaY];
      scaleCoordinate(center, view.getResolution());
      rotateCoordinate(center, view.getRotation());
      addCoordinate(center, view.getCenter());
      center = view.constrainCenter(center);
      view.setCenter(center);
    }
  } else if (this.kinetic_) {
    // reset so we don't overestimate the kinetic energy after
    // after one finger down, tiny drag, second finger down
    this.kinetic_.begin();
  }
  this.lastCentroid = centroid;
  this.lastPointersCount_ = targetPointers.length;
}

/**
 * @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
 * @return {boolean} Stop drag sequence?
 * @this {module:ol/interaction/DragPan}
 */
function handleUpEvent(mapBrowserEvent) {
  const map = mapBrowserEvent.map;
  const view = map.getView();
  if (this.targetPointers.length === 0) {
    if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {
      const distance = this.kinetic_.getDistance();
      const angle = this.kinetic_.getAngle();
      const center = /** @type {!module:ol/coordinate~Coordinate} */ (view.getCenter());
      const centerpx = map.getPixelFromCoordinate(center);
      const dest = map.getCoordinateFromPixel([
        centerpx[0] - distance * Math.cos(angle),
        centerpx[1] - distance * Math.sin(angle)
      ]);
      view.animate({
        center: view.constrainCenter(dest),
        duration: 500,
        easing: easeOut
      });
    }
    view.setHint(ViewHint.INTERACTING, -1);
    return false;
  } else {
    if (this.kinetic_) {
      // reset so we don't overestimate the kinetic energy after
      // after one finger up, tiny drag, second finger up
      this.kinetic_.begin();
    }
    this.lastCentroid = null;
    return true;
  }
}

/**
 * @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
 * @return {boolean} Start drag sequence?
 * @this {module:ol/interaction/DragPan}
 */
function handleDownEvent(mapBrowserEvent) {
  if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {
    const map = mapBrowserEvent.map;
    const view = map.getView();
    this.lastCentroid = null;
    if (!this.handlingDownUpSequence) {
      view.setHint(ViewHint.INTERACTING, 1);
    }
    // stop any current animation
    if (view.getAnimating()) {
      view.setCenter(mapBrowserEvent.frameState.viewState.center);
    }
    if (this.kinetic_) {
      this.kinetic_.begin();
    }
    // No kinetic as soon as more than one pointer on the screen is
    // detected. This is to prevent nasty pans after pinch.
    this.noKinetic_ = this.targetPointers.length > 1;
    return true;
  } else {
    return false;
  }
}

/**
 * @inheritDoc
 */
DragPan.prototype.shouldStopEvent = FALSE;
export default DragPan;

redpajama_set_name: RedPajamaGithub


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

namespace Neptuo.Converters
{
    /// <summary>
    /// Registration extensions for <see cref="IConverterRepository"/>.
    /// </summary>
    public static class _ConverterRepositoryExtensions
    {
        /// <summary>
        /// Adds <paramref name="converter"/> for conversion from <typeparamref name="TSource"/> to <typeparamref name="TTarget"/>.
        /// </summary>
        /// <typeparam name="TSource">Source type.</typeparam>
        /// <typeparam name="TTarget">Target type.</typeparam>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="converter">The converter.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository Add<TSource, TTarget>(this IConverterRepository repository, IConverter<TSource, TTarget> converter)
        {
            Ensure.NotNull(repository, "repository");
            repository.Add(typeof(TSource), typeof(TTarget), converter);
            return repository;
        }

        /// <summary>
        /// Adds <paramref name="converter"/> for conversion from <typeparamref name="TOne"/> to <typeparamref name="TTwo"/> and from <typeparamref name="TTwo"/> to <typeparamref name="TOne"/>.
        /// </summary>
        /// <typeparam name="TOne">The first type of the vice-versa convertion.</typeparam>
        /// <typeparam name="TTwo">The second type of the vice-versa convertion.</typeparam>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="converter">The converter.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository Add<TOne, TTwo>(this IConverterRepository repository, TwoWayConverter<TOne, TTwo> converter)
        {
            DefaultConverter<TOne, TTwo> converter1 = converter;
            DefaultConverter<TTwo, TOne> converter2 = converter;
            Add<TOne, TTwo>(repository, converter1);
            Add<TTwo, TOne>(repository, converter2);
            return repository;
        }

        /// <summary>
        /// Adds <paramref name="converter"/> for conversion from <typeparamref name="TSource"/> to <typeparamref name="TTarget"/>.
        /// The <paramref name="converter"/> should always success.
        /// </summary>
        /// <typeparam name="TSource">Source type.</typeparam>
        /// <typeparam name="TTarget">Target type.</typeparam>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="converter">The converter.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository Add<TSource, TTarget>(this IConverterRepository repository, Func<TSource, TTarget> converter)
        {
            Ensure.NotNull(converter, "converter");
            return Add<TSource, TTarget>(repository, (TSource source, out TTarget target) =>
            {
                target = converter(source);
                return true;
            });
        }

        /// <summary>
        /// Adds <paramref name="tryConvert"/> for conversion from <typeparamref name="TSource"/> to <typeparamref name="TTarget"/>.
        /// </summary>
        /// <typeparam name="TSource">Source type.</typeparam>
        /// <typeparam name="TTarget">Target type.</typeparam>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="tryConvert">The converter delegate.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository Add<TSource, TTarget>(this IConverterRepository repository, OutFunc<TSource, TTarget, bool> tryConvert)
        {
            Ensure.NotNull(repository, "repository");
            Ensure.NotNull(tryConvert, "tryConvert");
            return Add(repository, new DefaultConverter<TSource, TTarget>(tryConvert));
        }

        /// <summary>
        /// Adds <paramref name="tryConvert"/> for conversion from <see cref="String"/> to <typeparamref name="TTarget"/>.
        /// Alse adds support for nullable conversion from <see cref="String"/> to <see cref="Nullable{TTarget}"/>.
        /// </summary>
        /// <typeparam name="TTarget">Target type.</typeparam>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="tryConvert">The converter delegate.</param>
        /// <param name="isWhitespaceAccepted">Whether whitespaces should be treated as nulls.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository AddStringTo<TTarget>(this IConverterRepository repository, OutFunc<string, TTarget, bool> tryConvert, bool isWhitespaceAccepted = true)
            where TTarget : struct
        {
            Ensure.NotNull(repository, "repository");
            Ensure.NotNull(tryConvert, "tryConvert");

            IConverter<string, TTarget> converter = new DefaultConverter<string, TTarget>(tryConvert);
            return repository
                .Add<string, TTarget>(converter)
                .Add<string, TTarget?>(new StringToNullableConverter<TTarget>(converter, isWhitespaceAccepted));
        }

        /// <summary>
        /// Adds <paramref name="tryConvert"/> for convertion of string value separated by <paramref name="separator"/>
        /// to <see cref="List{TTargetItem}"/>, <see cref="IList{TTargetItem}"/>, <see cref="ICollection{TTargetItem}"/> and <see cref="IEnumerable{TTargetItem}"/>.
        /// </summary>
        /// <typeparam name="TTargetItem">Type of collection item.</typeparam>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="tryConvert">The converter delegate.</param>
        /// <param name="separator">Item separator.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository AddStringToCollection<TTargetItem>(this IConverterRepository repository, OutFunc<string, TTargetItem, bool> tryConvert, string separator = ",")
        {
            Ensure.NotNull(repository, "repository");
            StringToCollectionConverter<TTargetItem> converter = new StringToCollectionConverter<TTargetItem>(separator, new DefaultConverter<string, TTargetItem>(tryConvert));
            return repository
                .Add<string, List<TTargetItem>>(converter)
                .Add<string, IList<TTargetItem>>(converter)
                .Add<string, ICollection<TTargetItem>>(converter)
                .Add<string, IEnumerable<TTargetItem>>(converter);
        }

        /// <summary>
        /// Adds converter for conversion from <typeparamref name="TSource"/> to <see cref="String"/>.
        /// If <paramref name="format"/> is not <c>null</c>, then it is used as format string, eg. yyyy-MM-dd.
        /// </summary>
        /// <typeparam name="TSource">Source type.</typeparam>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="format">Format string, eg. yyyy-MM-dd for datetime.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository AddToString<TSource>(this IConverterRepository repository, string format = null)
        {
            Ensure.NotNull(repository, "repository");
            if (format == null)
                return Add(repository, new ToStringConverter<TSource>());
            else
                return Add(repository, new ToStringConverter<TSource>(format));
        }

        /// <summary>
        /// Adds search handler for converting any type to string.
        /// </summary>
        /// <param name="repository">The repository to register converter to.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository AddToStringSearchHandler(this IConverterRepository repository)
        {
            Ensure.NotNull(repository, "repository");
            return repository.AddSearchHandler(TryConvertToString);
        }

        private static bool TryConvertToString(ConverterSearchContext context, out IConverter converter)
        {
            converter = new ToStringConverter();
            return true;
        }

        /// <summary>
        /// Adds string to any enum (and any nullable enum) converter search handler.
        /// Any enums types will be converted using <see cref="StringToEnumConverter"/>.
        /// </summary>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="isCaseSensitive">Whether parsing should be case-sensitive.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository AddEnumSearchHandler(this IConverterRepository repository, bool isCaseSensitive)
        {
            Ensure.NotNull(repository, "repository");

            if (isCaseSensitive)
                return repository.AddSearchHandler(TryConvertStringToEnumCaseSensitive);
            else
                return repository.AddSearchHandler(TryConvertStringToEnum);
        }

        private static bool TryConvertStringToEnumCaseSensitive(ConverterSearchContext context, out IConverter converter)
        {
            if (context.TargetType.GetTypeInfo().IsEnum)
            {
                converter = new StringToEnumConverter(true);
                return true;
            }
            else if (context.TargetType.GetTypeInfo().IsGenericType && context.TargetType.GetGenericTypeDefinition() == typeof(Nullable<>) && context.TargetType.GetGenericArguments()[0].GetTypeInfo().IsEnum)
            {
                converter = new StringToNullableConverter(new StringToEnumConverter(false), false);
                return true;
            }

            converter = null;
            return false;
        }

        private static bool TryConvertStringToEnum(ConverterSearchContext context, out IConverter converter)
        {
            if (context.TargetType.GetTypeInfo().IsEnum)
            {
                converter = new StringToEnumConverter(false);
                return true;
            }
            else if (context.TargetType.GetTypeInfo().IsGenericType && context.TargetType.GetGenericTypeDefinition() == typeof(Nullable<>) && context.TargetType.GetGenericArguments()[0].GetTypeInfo().IsEnum)
            {
                converter = new StringToNullableConverter(new StringToEnumConverter(false), true);
                return true;
            }

            converter = null;
            return false;
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="BruinGold">#f4cd41</color>

    <!---      new color palette       -->

    <color name="accent">#ffeb3b</color>
    <color name="Open">#15a32a</color>
    <color name="background_material_dark">#303030</color>
    <color name="black">#000000</color>
</resources>


text:
<?php

namespace Mailgun\Messages;

use Mailgun\Constants\Api;
use Mailgun\Constants\ExceptionMessages;
use Mailgun\Messages\Exceptions\MissingRequiredMIMEParameters;
use Mailgun\Messages\Exceptions\TooManyParameters;

/**
 * This class is used for batch sending. See the official documentation (link below)
 * for usage instructions.
 *
 * @see https://github.com/mailgun/mailgun-php/blob/master/src/Mailgun/Messages/README.md
 */
class BatchMessage extends MessageBuilder
{
    /**
     * @var array
     */
    private $batchRecipientAttributes;

    /**
     * @var bool
     */
    private $autoSend;

    /**
     * @var \Mailgun\Connection\RestClient
     */
    private $restClient;

    /**
     * @var string
     */
    private $workingDomain;

    /**
     * @var array
     */
    private $messageIds = [];

    /**
     * @var string
     */
    private $endpointUrl;

    /**
     * @param \Mailgun\Connection\RestClient $restClient
     * @param string                         $workingDomain
     * @param bool                           $autoSend
     */
    public function __construct($restClient, $workingDomain, $autoSend)
    {
        $this->batchRecipientAttributes = [];
        $this->autoSend = $autoSend;
        $this->restClient = $restClient;
        $this->workingDomain = $workingDomain;
        $this->endpointUrl = $workingDomain.'/messages';
    }

    /**
     * @param string $headerName
     * @param string $address
     * @param array  $variables
     *
     * @throws MissingRequiredMIMEParameters
     * @throws TooManyParameters
     */
    protected function addRecipient($headerName, $address, $variables)
    {
        if (array_key_exists($headerName, $this->counters['recipients'])) {
            if ($this->counters['recipients'][$headerName] == Api::RECIPIENT_COUNT_LIMIT) {
                if (false === $this->autoSend) {
                    throw new TooManyParameters(ExceptionMessages::TOO_MANY_RECIPIENTS);
                }
                $this->sendMessage();
            }
        }

        $compiledAddress = $this->parseAddress($address, $variables);

        if (isset($this->message[$headerName])) {
            array_push($this->message[$headerName], $compiledAddress);
        } elseif ($headerName == 'h:reply-to') {
            $this->message[$headerName] = $compiledAddress;
        } else {
            $this->message[$headerName] = [$compiledAddress];
        }

        if (array_key_exists($headerName, $this->counters['recipients'])) {
            $this->counters['recipients'][$headerName] += 1;
            if (is_array($variables) && !array_key_exists('id', $variables)) {
                $variables['id'] = $this->counters['recipients'][$headerName];
            }
        }
        $this->batchRecipientAttributes["$address"] = $variables;
    }

    /**
     * @param array $message
     * @param array $files
     *
     * @throws MissingRequiredMIMEParameters
     */
    public function sendMessage($message = [], $files = [])
    {
        if (count($message) < 1) {
            $message = $this->message;
            $files = $this->files;
        }
        if (!array_key_exists('from', $message)) {
            throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
        } elseif (!array_key_exists('to', $message)) {
            throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
        } elseif (!array_key_exists('subject', $message)) {
            throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
        } elseif ((!array_key_exists('text', $message) && !array_key_exists('html', $message))) {
            throw new MissingRequiredMIMEParameters(ExceptionMessages::EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS);
        } else {
            $message['recipient-variables'] = json_encode($this->batchRecipientAttributes);
            $response = $this->restClient->post($this->endpointUrl, $message, $files);
            $this->batchRecipientAttributes = [];
            $this->counters['recipients']['to'] = 0;
            $this->counters['recipients']['cc'] = 0;
            $this->counters['recipients']['bcc'] = 0;
            unset($this->message['to']);
            array_push($this->messageIds, $response->http_response_body->id);
        }
    }

    /**
     * @throws MissingRequiredMIMEParameters
     */
    public function finalize()
    {
        $this->sendMessage();
    }

    /**
     * @return string[]
     */
    public function getMessageIds()
    {
        return $this->messageIds;
    }
}


text:
#ifndef EARL_MPI_GET1TS_REP_H
#define EARL_MPI_GET1TS_REP_H

/*
 *----------------------------------------------------------------------------
 *
 * class MPIGet1TS_rep
 *
 * transfer start of an 'GET' operation.
 * Occurs only on target location.
 * Corresponding MPIGet1TE_rep has the same 'rmaid' value
 *
 *----------------------------------------------------------------------------
 */

#include "State.h"
#include "MPIRmaComm_rep.h"

namespace earl
{
  class MPIGet1TS_rep : public MPIRmaComm_rep
  {
  public:

    MPIGet1TS_rep(State&        state,
                  EventBuffer*  buffer,
                  Location*     loc,
                  double        time,
                  Location*     dst,
                  MPIWindow*    win,
                  long          rmaid,
                  long          length ) :
    MPIRmaComm_rep(state, buffer, loc, time, win, rmaid, length),
    dst(dst), originptr(state.get_mpiorigin(dst, rmaid) )
    {
      if (originptr.null())
        throw RuntimeError("MPIGet1TS_rep()::MPIGet1TS_rep(): origin pointer not found");
      originptr->set_win(win);
    }

    // accessor functions
    Location* get_dest()     const { return dst;  }
    Location* get_src()      const { return get_loc();  }
    Location* get_origin()   const { return dst;  }
    Location* get_target()   const { return get_loc();  }
    Event     get_TO_event() const { return originptr; }

    virtual bool is_type(etype type) const
      { return MPIRmaComm_rep::is_type(type) || type == MPIGET1TS; }
    virtual etype       get_type()    const { return MPIGET1TS; }
    virtual std::string get_typestr() const { return "MPIGET1TS"; }

    virtual void trans(State& state);

  private:
    // destination of data transfer
    Location* dst;
    // origin of data transfer
    Event originptr;
  };
}
#endif


text:
/* Copyright (c) 2006, Sun Microsystems, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
	  disclaimer in the documentation and/or other materials provided with the distribution.
    * Neither the name of Sun Microsystems nor the names of its contributors may be used to endorse or promote products derived
	  from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE

*/

# include "incls/_precompiled.incl"

#ifdef DELTA_COMPILER

# include "incls/_ncode.cpp.incl"

void OopNCode::remember() {
Unimplemented();//  if (rememberLink.isEmpty()) Memory->code->rememberLink.add(&rememberLink);
}

void OopNCode::relocate() {
  Unimplemented();
}

bool OopNCode::switch_pointers(oop from, oop to,
				   GrowableArray<nmethod*>* /*nmethods_to_invalidate*/) {
  bool needToInvalICache = false;
  Unimplemented();
  return needToInvalICache;
}

void NCodeBase::verify2(const char* name) {
  if ((int)this & (oopSize - 1))
    error("alignment error in %s at %#lx", name, this);
  if (instsLen() > 256 * K)
    error("instr length of %s at %#lx seems too big (%ld)", name, this, instsLen());
}

void OopNCode::verify() {
  const char* name = isNMethod() ? "nmethod" : (isPIC() ? " PIC" : "count stub");
  NCodeBase::verify2(name);
  // %fixme: Verify via relocIterator
}

NCodeBase* findThing(void* addr) {
  if (Universe::code->contains(addr)) {
    nmethod* n = (nmethod*)nmethod_from_insts((char*)addr);
    return n;
  } else {
    return NULL;
  }
}

#endif


text:
import sys
from javax.swing import JFrame
from javax.swing import JPanel
from javax.swing import JLabel
from javax.swing import JTextArea
from javax.swing import JScrollPane
from javax.swing import JTabbedPane
from javax.swing import WindowConstants
from java.awt import BorderLayout
from java.lang import Boolean

# myService is a local variable
# created to point to this Python
# service

class Console:

  def __init__(self):
    self.stdout = None
    self.stderr = None

  def write(self,string):
    myService.invoke("publishStdOut", string)

  def attach(self):
    if (self.stdout == None):
      self.stdout = sys.stdout
      self.stderr = sys.stderr
      sys.stdout = self
      sys.stderr = self

  def detach(self):
    if (self.stdout != None):
      sys.stdout = self.stdout
      sys.stderr = self.stderr
      self.stdout = None
      self.stderr = None

console = Console()
console.attach()


text:
/*
package p1;

import Appconfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Spy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import Solution1;

import static org.hamcrest.Matchers.is;

*/
/**
 * Created by xd031 on 2017/7/10.
 *//*

public class Solution1Test {
  @Spy
  private Solution1 solution;

  */
/**
   * Input: [1,4,3,2]
   * <p>
   * Output: 4
   * Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + min(3, 4).
   *//*

  @Test
  public void testarrayPairSum() {
    int[] arrs = {1, 4, 3, 2};
    Assert.assertThat(solution.arrayPairSum(arrs), is(4));
    Assert.assertThat(solution.arrayPairSum1(arrs), is(4));
  }
}
*/


text:
\section{Discussion} We now discuss our main findings, how RxFiddle
resolves the debugging problem of Rx, and contrast our design to other
design choices and possibilities of future work.

\subsection{Main results}
\paragraph{Quick and dirty debugging} Through interviews and literature
we establish that current debugging practices for RP consist mostly of
\printfdebugging{}.  The shortcomings of this method were evident from
the interviews:  it works reliably only for synchronous execution or
small amounts of events being logged, otherwise overview is lost.
Furthermore the time-context of events and dependency-context of flows
are not available using this method.  We attribute the prevalence of
\printfdebugging{} to this \emph{``quick and dirty''} method being
available in every language and on every platform, without a viable
alternative.

\paragraph{Improved context:  being complete, disposing doubts} With our
design and complementary implementation we show that the abstract model
of RP is suitable for visualization on two levels:  overview and detail.
On the overview level, we complement the dependencies visible in source
code with a graph of the resulting structure, showing the run-time
effect of certain operators on the reactive structure.  On the detail
level we add the time-context, by showing previous values on a
horizontal time line, and the dependency-context, by showing input and
output flows above and below the flow of interest.  While the results of
our evaluation could be observed as a negative, RxFiddle is a new tool,
where subjects have only just been exposed to the tool and received only
a short training.  We expect that by designing a debugger model so close
to the actual abstractions, our debugger works especially well for users
with some knowledge of these abstractions; while only T3 shows better
performance with high significancy, we observe slightly better results
when controlling for experience.  Future research might investigate the
effect of experience in more detail, including the use of more
complicated tasks, with larger samples.

In the presented research, we did not perform tests with subjects using
their own code.  However, during piloting and after the release of
RxFiddle we received positive feedback regarding the completeness of the
visualization.  As one user put it, \emph{``by using RxFiddle when
learning and understanding what RxJS does in our project, I have a
feeling of improved control over our Observables, Subscriptions and the
reactive parts of our app''}.  Specifically the life-cycle events, which
are generally hard to debug using \printfdebugging{}, are more clear:
\emph{``Initially we were reluctant to manually subscribe, but after
seeing that `complete' often triggers a `dispose', the team became more
confident to sometimes use \code{subscribe()} directly''}.  Future
research might address this by designing experiments specifically using
the users own code.

%%%%%%%%%%%%%%%%
% Quotes:
% ``the experience helped me understand what a specific operator was doing and how it was messing up my code.''
% `` Dat was de ervaring die ik net beschreef en die kwam direct voort uit wat wij keer hadden besproken dat `.share()` iets complexer is dan dat wij (als team) hadden gedacht en dat de effecten van hem twee keer gebruiken nogal, ongewenst waren. Dat hadden we op geen manier kunnen debuggen zonder RxFiddle, want met een `console.log()` kan je dat niet checken''.
% ``Wij waren vroeg in het project een beetje huiverig voor `subscribe()` en door RxFiddle zagen we dat een `onComplete()` ook een `unsubscribe()` triggert, in veel gevallen. En dat maakte het team iets geruster om hier en daar een `subscribe()` te gebruiken.''
% ``Door m'n ervaringen met onder andere RxFiddle ten tijde van het leren en begrijpen van wat RxJS in ons project doet, heb ik het idee nu meer grip te hebben op onze Observables, Subscriptions en de Reactive delen van onze applicatie.''

%%%%%%%%%%%%%%%%% OLD


text:
'use strict';

var mongoose = require('mongoose'),
	errorHandler = require('./errors.server.controller'),
	Organization = mongoose.model('Organization'),
	_ = require('lodash');

/**
 * Create a Organization
 */
exports.create = function(req, res) {
	var Organization = new Organization(req.body);
	Organization.owner = req.user;

	Organization.save(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(Organization);
		}
	});
};

/**
 * Show the current Organization
 */
exports.read = function(req, res) {
	res.json(req.Organization);
};

/**
 * Update a Organization
 */
exports.update = function(req, res) {
	var Organization = req.Organization;

	Organization = _.extend(Organization, req.body);

	Organization.save(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(Organization);
		}
	});
};

/**
 * Delete an Organization
 */
exports.delete = function(req, res) {
	var Organization = req.Organization;

	Organization.remove(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(Organization);
		}
	});
};

/**
 * List of Organization
 */
exports.list = function(req, res) {
	var populateQuery = [{path:'owner', select:'displayName'},
						 {path:'instructors', select:'displayName'},
						 {path:'followers', select:'displayName'}];

	Organization.find().sort('-title').populate(populateQuery).exec(function(err, Organization) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(Organization);
		}
	});
};

/**
 * Organization middleware
 */
exports.organizationByID = function(req, res, next, id) {

	if (!mongoose.Types.ObjectId.isValid(id)) {
		return res.status(400).send({
			message: 'Organization is invalid'
		});
	}

	var populateQuery = [{path:'owner', select:'displayName'},
						 {path:'instructors', select:'displayName'},
						 {path:'followers', select:'displayName'}];

	Organization.findById(id).populate(populateQuery).exec(function(err, Organization) {
		if (err) return next(err);
		if (!Organization) {
			return res.status(404).send({
				message: 'Organization not found'
			});
		}
		req.Organization = Organization;
		next();
	});
};

var organizationServerControllerAuthHelper = {};
(function () {

	function isOwner (req) {
		return (req.Organization.owner.id === req.user.id);
	}

	function isInstructor (req) {
		var instructors = req.Organization.instructors;
		var found = false;
		_(instructors).each(function(instructor) {
			if (instructor.id === req.user.id) {
				found = true;
				return false; // break early.
			}
		});
		return found;
	}

	organizationServerControllerAuthHelper.isOwner = isOwner;
	organizationServerControllerAuthHelper.isInstructor = isInstructor;
})();

/**
 * Organization authorization middleware
 */
exports.hasAuthorization = function(req, res, next) {
	if (req.Organization.owner.id !== req.owner.id) {
		return res.status(403).send({
			message: 'User is not authorized'
		});
	}
	next();
};


text:
<?php
/* $Id: url_generating.lib.php 9713 2006-11-17 09:32:24Z nijel $ */
// vim: expandtab sw=4 ts=4 sts=4:

/**
 * URL/hidden inputs generating.
 */

/**
 * Generates text with hidden inputs.
 *
 * @see     PMA_generate_common_url()
 * @param   string   optional database name
 * @param   string   optional table name
 * @param   int      indenting level
 *
 * @return  string   string with input fields
 *
 * @global  string   the current language
 * @global  string   the current conversion charset
 * @global  string   the current connection collation
 * @global  string   the current server
 * @global  array    the configuration array
 * @global  boolean  whether recoding is allowed or not
 *
 * @access  public
 *
 * @author  nijel
 */
function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $skip = array())
{
    if (is_array($db)) {
        $params  =& $db;
        $_indent = empty($table) ? $indent : $table;
        $_skip   = empty($indent) ? $skip : $indent;
        $indent  =& $_indent;
        $skip    =& $_skip;
    } else {
        $params = array();
        if (isset($db) && strlen($db)) {
            $params['db'] = $db;
        }
        if (isset($table) && strlen($table)) {
            $params['table'] = $table;
        }
    }

    if (! empty($GLOBALS['server'])
    &&  $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']) {
        $params['server'] = $GLOBALS['server'];
    }
    if (empty($_COOKIE['pma_lang'])
    && ! empty($GLOBALS['lang'])) {
        $params['lang'] = $GLOBALS['lang'];
    }
    if (empty($_COOKIE['pma_charset'])
    && ! empty($GLOBALS['convcharset'])) {
        $params['convcharset'] = $GLOBALS['convcharset'];
    }
    if (empty($_COOKIE['pma_collation_connection'])
    && ! empty($GLOBALS['collation_connection'])) {
        $params['collation_connection'] = $GLOBALS['collation_connection'];
    }

    $params['token'] = $_SESSION[' PMA_token '];

    if (! is_array($skip)) {
        if (isset($params[$skip])) {
            unset($params[$skip]);
        }
    } else {
        foreach ($skip as $skipping) {
            if (isset($params[$skipping])) {
                unset($params[$skipping]);
            }
        }
    }

    $spaces = str_repeat('    ', $indent);

    $return = '';
    foreach ($params as $key => $val) {
        $return .= $spaces . '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />' . "\n";
    }

    return $return;
}

/**
 * Generates text with URL parameters.
 *
 * <code>
 * // note the ?
 * echo 'script.php?' . PMA_generate_common_url('mysql', 'rights');
 * // produces with cookies enabled:
 * // script.php?db=mysql&table=rights
 * // with cookies disabled:
 * // script.php?server=1&lang=en-utf-8&db=mysql&table=rights
 *
 * $params['myparam'] = 'myvalue';
 * $params['db']      = 'mysql';
 * $params['table']   = 'rights';
 * // note the missing ?
 * echo 'script.php' . PMA_generate_common_url($params);
 * // produces with cookies enabled:
 * // script.php?myparam=myvalue&db=mysql&table=rights
 * // with cookies disabled:
 * // script.php?server=1&lang=en-utf-8&myparam=myvalue&db=mysql&table=rights
 *
 * // note the missing ?
 * echo 'script.php' . PMA_generate_common_url();
 * // produces with cookies enabled:
 * // script.php
 * // with cookies disabled:
 * // script.php?server=1&lang=en-utf-8
 * </code>
 *
 * @param   mixed    assoc. array with url params or optional string with database name
 *                   if first param is an array there is also an ? prefixed to the url
 * @param   string   optional table name only if first param is array
 * @param   string   character to use instead of '&' for deviding
 *                   multiple URL parameters from each other
 *
 * @return  string   string with URL parameters
 *
 * @global  string   the current language
 * @global  string   the current conversion charset
 * @global  string   the current connection collation
 * @global  string   the current server
 * @global  array    the configuration array
 * @global  boolean  whether recoding is allowed or not
 *
 * @access  public
 *
 * @author  nijel
 */
function PMA_generate_common_url ($db = '', $table = '', $delim = '&')
{
    if (is_array($db)) {
        $params =& $db;
        $delim  = empty($table) ? $delim : $table;
        $questionmark = '?';
    } else {
        $params = array();
        if (isset($db) && strlen($db)) {
            $params['db'] = $db;
        }
        if (isset($table) && strlen($table)) {
            $params['table'] = $table;
        }
        $questionmark = '';
    }

    // use seperators defined by php, but prefer ';'
    // as recommended by W3C
    $separator = PMA_get_arg_separator();

    // check wether to htmlentity the separator or not
    if ($delim === '&') {
        $delim = htmlentities($separator);
    } else {
        $delim = $separator;
    }

    if (isset($GLOBALS['server'])
      && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']) {
        $params['server'] = $GLOBALS['server'];
    }

    if (empty($_COOKIE['pma_lang'])
      && ! empty($GLOBALS['lang'])) {
        $params['lang'] = $GLOBALS['lang'];
    }
    if (empty($_COOKIE['pma_charset'])
      && ! empty($GLOBALS['convcharset'])) {
        $params['convcharset'] = $GLOBALS['convcharset'];
    }
    if (empty($_COOKIE['pma_collation_connection'])
      && ! empty($GLOBALS['collation_connection'])) {
        $params['collation_connection'] = $GLOBALS['collation_connection'];
    }

    $params['token'] = $_SESSION[' PMA_token '];

    $param_strings = array();
    foreach ($params as $key => $val) {
        /* We ignore arrays as we don't use them! */
        if (!is_array($val)) {
            $param_strings[] = urlencode($key) . '=' . urlencode($val);
        }
    }

    if (empty($param_strings)) {
        return '';
    }

    return $questionmark . implode($delim, $param_strings);
}

/**
 * Returns url separator
 *
 * @return  string   character used for separating url parts
 *
 * @access  public
 *
 * @author  nijel
 */
function PMA_get_arg_separator() {
    // use seperators defined by php, but prefer ';'
    // as recommended by W3C
    $php_arg_separator_input = ini_get('arg_separator.input');
    if (strpos($php_arg_separator_input, ';') !== false) {
        return ';';
    } elseif (strlen($php_arg_separator_input) > 0) {
        return $php_arg_separator_input{0};
    } else {
        return '&';
    }
}

?>


text:
Prevents the use of string interpolations in snapshots.

## Rule Details

Interpolation prevents snapshots from being updated. Instead, properties should
be overloaded with a matcher by using
[property matchers](https://jestjs.io/docs/en/snapshot-testing#property-matchers).

Examples of **incorrect** code for this rule:

```js
expect(something).toMatchInlineSnapshot(
  `Object {
    property: ${interpolated}
  }`,
);

expect(something).toMatchInlineSnapshot(
  { other: expect.any(Number) },
  `Object {
    other: Any<Number>,
    property: ${interpolated}
  }`,
);

expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot(
  `${interpolated}`,
);
```

Examples of **correct** code for this rule:

```js
expect(something).toMatchInlineSnapshot();

expect(something).toMatchInlineSnapshot(
  `Object {
    property: 1
  }`,
);

expect(something).toMatchInlineSnapshot(
  { property: expect.any(Date) },
  `Object {
    property: Any<Date>
  }`,
);

expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot();

expect(errorThrowingFunction).toThrowErrorMatchingInlineSnapshot(
  `Error Message`,
);
```

## When Not To Use It

Don't use this rule on non-jest test files.


text:
function doImport () {

	var importJson = require('importJson');

 	var jsonString = importJson.importJson("aiba.txt");

 	ds.costImportHeader.importJSON(jsonString);

 }

doImport();


text:
<?php namespace Pz\Doctrine\Rest\QueryParser;

use Doctrine\Common\Collections\Criteria;
use Pz\Doctrine\Rest\Contracts\RestRequestContract;

class SearchFilterParser extends FilterParserAbstract
{
    const PARAM_PREFIX = '';

    const SEARCH_KEY = 'search';

    /**
     * @var string|bool
     */
    protected $property;

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

    /**
     * StringParser constructor.
     *
     * @param RestRequestContract $request
     * @param string              $property Property name that will be filtered by query.
     * @param string              $searchKey
     */
    public function __construct(RestRequestContract $request, $property, $searchKey = self::SEARCH_KEY)
    {
        parent::__construct($request);
        $this->property = $property;
        $this->searchKey = $searchKey;
    }

    /**
     * Assign LIKE operator on property if query is string.
     *
     * @param Criteria $criteria
     * @param          $filter
     *
     * @return Criteria
     */
    public function applyFilter(Criteria $criteria, $filter)
    {
        if (is_string($filter) && is_string($this->property)) {
            $criteria->andWhere(
                $criteria->expr()->contains($this->property, $filter)
            );
        }

        if (is_array($filter) && isset($filter[$this->searchKey])) {
            $criteria->andWhere(
                $criteria->expr()->contains($this->property, $filter[$this->searchKey])
            );
        }

        return $criteria;
    }
}


text:
#ifndef __ARCH_POWER_REMOTE_GDB_HH__
#define __ARCH_POWER_REMOTE_GDB_HH__

#include "arch/power/registers.hh"
#include "arch/power/remote_gdb.hh"
#include "base/remote_gdb.hh"

namespace PowerISA
{

class RemoteGDB : public BaseRemoteGDB
{
  protected:
    bool acc(Addr addr, size_t len);

    class PowerGdbRegCache : public BaseGdbRegCache
    {
      using BaseGdbRegCache::BaseGdbRegCache;
      private:
        struct {
            uint32_t gpr[NumIntArchRegs];
            uint64_t fpr[NumFloatArchRegs];
            uint32_t pc;
            uint32_t msr;
            uint32_t cr;
            uint32_t lr;
            uint32_t ctr;
            uint32_t xer;
        } r;
      public:
        char *data() const { return (char *)&r; }
        size_t size() const { return sizeof(r); }
        void getRegs(ThreadContext*);
        void setRegs(ThreadContext*) const;
        const std::string
        name() const
        {
            return gdb->name() + ".PowerGdbRegCache";
        }
    };

    PowerGdbRegCache regCache;

  public:
    RemoteGDB(System *_system, ThreadContext *tc, int _port);
    BaseGdbRegCache *gdbRegs();
};

} // namespace PowerISA

#endif /* __ARCH_POWER_REMOTE_GDB_H__ */


text:
checkniner
==========

This application provides a database for tracking pilot-airstrip-aircraft
checkout tuples. Once recorded the tuples can be searched to find available
flight scheduling assignments based on the known parameters or to identify
checkouts which should be prioritized for new training to alleviate scheduling
constraints. A reporting feature allows analyzing checkouts per pilot, per
airstrip, or per base of operations.

### Built With

Checkniner stands on the shoulders of many incredible free & libre software
giants. Among them are several particularly valuable projects which have made
this application possible:

- [Django](https://www.djangoproject.com/)
- [Let's Encrypt](https://letsencrypt.org/)
- [Postgres](https://www.postgresql.org/)
- [Python](https://www.python.org/)
- [Sentry](https://sentry.io/)
- [Ubuntu](https://www.ubuntu.com/)

Development Setup
-----------------

The only firm requirement for developing and testing `checkniner` is an
installation of Python 3.7+. The steps below will also assume the presence
of `git`, `virtualenv`, and `pip`.

First let's get the repository and set up the virtual environment.

```shell
$ git clone https://github.com/eallrich/checkniner.git
$ cd checkniner
$ virtualenv --python=python3 .
```

Next we'll provide a few dev [settings](cotracker/cotracker/settings) and install the python dependencies.

```shell
$ echo "export DATABASE_URL='sqlite://$(pwd)/cotracker/dev.db'"       >> bin/activate
$ echo "export DJANGO_SETTINGS_MODULE=cotracker.settings.development" >> bin/activate
$ echo "export PYTHONPATH='$(pwd)/cotracker/'"                        >> bin/activate
$ echo "export SECRET_KEY='$(head -c 15 /dev/urandom | base64)'"      >> bin/activate
$ echo "export SENTRY_DSN=https://key@sentry.io/2"                    >> bin/activate
$ echo "export EXPORT_PREFIX=zyxwvutsr"                               >> bin/activate
$ source bin/activate
$ pip install -r requirements/development.txt
```

Then we have a bit of database set up work.

```shell
$ python cotracker/manage.py migrate --noinput
```

Finally we're ready to run our application!

```shell
$ honcho start
```

### Testing ###

```shell
# Run the tests using the provided script
$ scripts/test
# If desired, generate a visual HTML report of the coverage
$ cd cotracker
$ coverage html --include="./*"
```

Up and Running for Production
-----------------------------

Unlike setting up for development, deploying a production-ready instance is
intended to be as automated as practical. You'll only need to provide:

- A fresh Ubuntu 18.04 64-bit server
- A domain name pointing to the server's IP address
- A [Sentry](https://sentry.io/) DSN
- A secret key to restrict access to exported files

If you have SSH access to the server you can use `scripts/remote_init` to take
care of everything. Otherwise you'll need to connect to the server and do a few
things yourself before picking up with `scripts/setup` - just follow what's in
`scripts/remote_init` and perform those steps manually on your server.

We're going to assume these values for the above requirements:

- `DOMAIN`: `checkouts.example.com`
- `SENTRY_DSN`: `https://key@sentry.io/1`
- `EXPORT_PREFIX`: `zyxwvutsr`

You can read more about these settings (and the others the app supports) in
the [settings documentation](cotracker/cotracker/settings).

The simplest option is to check out this repository locally and then run the
`scripts/remote_init` script. Let's say the server's SSH connection string is
`root@10.31.41.59` and that you've set up SSH keys.

```shell
$ git clone https://github.com/eallrich/checkniner.git
$ checkniner/scripts/remote_init root@10.31.41.59 checkouts.example.com https://key@sentry.io/1 zyxwvutsr
```

After waiting approximately five minutes you should be able to visit your new
instance at https://checkouts.example.com/ and be presented with the login
screen.

### Backups and Restores ###

Details for backing up and restoring the checkniner database are available in
the [scripts/backups readme](scripts/backups).

### Sending Emails ###

The pilot weights feature supports the ability to send notification emails
when a weight value is modified. Sending email is currently accomplished
through the [Mailgun](https://mailgun.com/) API. To enable these email
notifications set the following:

```shell
$ echo "export MAILGUN_SENDER=\"Checkniner <mailgun@example.com>\"" >> bin/activate
$ echo "export MAILGUN_API_URL=https://api.mailgun.net/v3/example.com/messages" >> bin/activate
$ echo "export MAILGUN_API_KEY=key-0123456789abcdef" >> bin/activate
$ echo "export NOTIFY_WEIGHT_TO=receiver@example.com" >> bin/activate
# Optional additional recipients
$ echo "export NOTIFY_WEIGHT_CC=carbon@example.com" >> bin/activate
$ echo "export NOTIFY_WEIGHT_BCC=quiet@example.com" >> bin/activate
```


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/codebreaker.iml" filepath="$PROJECT_DIR$/.idea/codebreaker.iml" />
    </modules>
  </component>
</project>


text:
CC 			= gcc
CFLAGS 		= -c -Wall -pedantic

all: output

output: main.o memManagement.o linkedList.o
	$(CC) memManagement.o linkedList.o  main.o -o lab

main.o: main.c
	$(CC) $(CFLAGS) main.c

memManagement.o: memManagement.c
	$(CC) $(CFLAGS) memManagement.c

linkedList.o: linkedList.c
	$(CC) $(CFLAGS) linkedList.c

clean:
	rm -r *.o lab


text:
import { Component, AfterViewInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

import { RegistrationService } from '../../../providers/registration-service';

// declare const SqPaymentForm;

@Component({
  selector: 'registered-component',
  templateUrl: './registered.html',
  styleUrls: [ './registered.sass' ]
})

export class RegisteredComponent implements AfterViewInit {
  service: RegistrationService;

  info: any;
  shortid: string;
  amount: string;

  applicationId = ''; // Squareup Application ID

  paymentForm: any;
  paidUp: boolean;
  hasCardErrors: string[];
  processingPayment: boolean;
  processingSuccess: boolean;
  findingAccount: boolean;
  hasAccount: boolean;
  noAccountFound: boolean;

  constructor(_service: RegistrationService, _route: ActivatedRoute) {
    this.service = _service;

    window['cardNonceResponseReceived'] = this.cardNonceResponseReceived.bind(this);
    _route.params.subscribe(params => {
      const id = params['id'] || '';
      this.runInit(id);
    });
  }

  ngAfterViewInit() {

  }

  runInit(id: string) {
    this.findingAccount = true;
    this.shortid = id;
    this.service.getRegistration(id).subscribe((data: any) => {
      this.findingAccount = false;

      if (data.length) {
        this.info = data;
        this.hasAccount = true;

        this.paidUp = this.info.paid || false;
        if (!this.paidUp) { this.loadPaymentForm(); }
      } else {
        this.cleanProcessing();
        this.info = null;
        this.paidUp = false;
        this.hasAccount = false;
        this.noAccountFound = true;
      }
    }, err => {
      this.findingAccount = false;

      this.hasAccount = false;
      this.noAccountFound = true;
      console.log('Error', err);
    });
  }

  cleanProcessing() {
    this.hasCardErrors = null;
    this.processingPayment = false;
    this.processingSuccess = false;
  }

  // This function is called when a buyer clicks the Submit button on the webpage
  // to charge their card.
  requestCardNonce(event) {
    if (this.processingPayment) { return; }
    // This prevents the Submit button from submitting its associated form.
    // Instead, clicking the Submit button should tell the SqPaymentForm to generate
    // a card nonce, which the next line does.
    event.preventDefault();

    this.cleanProcessing();
    this.processingPayment = true;
    this.paymentForm.requestCardNonce();
  }

  cardNonceResponseReceived(errors, nonce, _cardData) {
    if (errors) {
      this.processingPayment = false;
      this.hasCardErrors = errors.map(e => e.message);
    } else {
      this.hasCardErrors = null;

      this.service.runPayment(nonce, this.shortid, this.amount).subscribe(result => {
        this.processingPayment = false;
        const status = result.status || '';
        const proc_errors = result.errors || [];

        if (status === 200) {
          this.paymentForm.destroy();
          this.processingSuccess = true;
          this.paidUp = true;
        } else {
          this.hasCardErrors = proc_errors.map(p => p.detail);
        }
      }, err => {
        this.hasCardErrors = [err.message];
      });

    }
  }

  loadPaymentForm() {
    /*
    this.paymentForm = new SqPaymentForm({
      applicationId: this.applicationId,
      inputClass: 'sq-input',
      inputStyles: [
        {
          fontSize: '15px'
        }
      ],
      cardNumber: {
        elementId: 'sq-card-number',
        placeholder: '•••• •••• •••• ••••'
      },
      cvv: {
        elementId: 'sq-cvv',
        placeholder: 'CVV'
      },
      expirationDate: {
        elementId: 'sq-expiration-date',
        placeholder: 'MM/YY'
      },
      postalCode: {
        elementId: 'sq-postal-code'
      },
      callbacks: {

        // Called when the SqPaymentForm completes a request to generate a card
        // nonce, even if the request failed because of an error.
        cardNonceResponseReceived: window['cardNonceResponseReceived'],

        unsupportedBrowserDetected: function() {
          // Fill in this callback to alert buyers when their browser is not supported.
          alert('Sorry, your browser is not supported for purchasing.');
        },

        // Fill in these cases to respond to various events that can occur while a
        // buyer is using the payment form.
        inputEventReceived: function(inputEvent) {
          switch (inputEvent.eventType) {
            case 'focusClassAdded':
              // Handle as desired
              break;
            case 'focusClassRemoved':
              // Handle as desired
              break;
            case 'errorClassAdded':
              // Handle as desired
              break;
            case 'errorClassRemoved':
              // Handle as desired
              break;
            case 'cardBrandChanged':
              // Handle as desired
              break;
            case 'postalCodeChanged':
              // Handle as desired
              break;
          }
        },

        paymentFormLoaded: function() {
          // Fill in this callback to perform actions after the payment form is
          // done loading (such as setting the postal code field programmatically).
          // this.paymentForm.setPostalCode('94103');
        }
      }
    });

    this.paymentForm.build();
    */
  }
}


text:
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.02.24 at 11:39:39 PM CET
//

package com.hack23.cia.model.external.worldbank.data.impl;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.hack23.cia.model.common.api.ModelObject;

/**
 * The Class WorldBankData.
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "WorldBankData", propOrder = {
    "indicator",
    "country",
    "dataValue",
    "yearDate"
})
@Entity(name = "WorldBankData")
@Table(name = "WORLD_BANK_DATA")
@Inheritance(strategy = InheritanceType.JOINED)
public class WorldBankData
    implements ModelObject
{

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

	/** The indicator. */
    protected Indicator indicator;

    /** The country. */
    protected Country country;

    /** The data value. */
    @XmlElement(name = "value")
    protected String dataValue;

    /** The year date. */
    @XmlElement(name = "date")
    protected Integer yearDate;

    /** The hjid. */
    @XmlAttribute(name = "Hjid")
    protected Long hjid;

    /**
	 * Gets the indicator.
	 *
	 * @return the indicator
	 */
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name = "value", column = @Column(name = "INDICATOR_VALUE")),
        @AttributeOverride(name = "id", column = @Column(name = "INDICATOR_ID"))
    })
    public Indicator getIndicator() {
        return indicator;
    }

    /**
	 * Sets the indicator.
	 *
	 * @param value the new indicator
	 */
    public void setIndicator(final Indicator value) {
        this.indicator = value;
    }

    /**
	 * Gets the country.
	 *
	 * @return the country
	 */
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name = "value", column = @Column(name = "COUNTRY_VALUE")),
        @AttributeOverride(name = "id", column = @Column(name = "COUNTRY_ID"))
    })
    public Country getCountry() {
        return country;
    }

    /**
	 * Sets the country.
	 *
	 * @param value the new country
	 */
    public void setCountry(final Country value) {
        this.country = value;
    }

    /**
	 * Gets the data value.
	 *
	 * @return the data value
	 */
    @Basic
    @Column(name = "DATA_VALUE")
    public String getDataValue() {
        return dataValue;
    }

    /**
	 * Sets the data value.
	 *
	 * @param value the new data value
	 */
    public void setDataValue(final String value) {
        this.dataValue = value;
    }

    /**
	 * Gets the year date.
	 *
	 * @return the year date
	 */
    @Basic
    @Column(name = "YEAR_DATE", precision = 10, scale = 0)
    public Integer getYearDate() {
        return yearDate;
    }

    /**
	 * Sets the year date.
	 *
	 * @param value the new year date
	 */
    public void setYearDate(final Integer value) {
        this.yearDate = value;
    }

    /**
	 * With indicator.
	 *
	 * @param value the value
	 * @return the world bank data
	 */
    public WorldBankData withIndicator(final Indicator value) {
        setIndicator(value);
        return this;
    }

    /**
	 * With country.
	 *
	 * @param value the value
	 * @return the world bank data
	 */
    public WorldBankData withCountry(final Country value) {
        setCountry(value);
        return this;
    }

    /**
	 * With data value.
	 *
	 * @param value the value
	 * @return the world bank data
	 */
    public WorldBankData withDataValue(final String value) {
        setDataValue(value);
        return this;
    }

    /**
	 * With year date.
	 *
	 * @param value the value
	 * @return the world bank data
	 */
    public WorldBankData withYearDate(final Integer value) {
        setYearDate(value);
        return this;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public final String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}

    /**
	 * Gets the hjid.
	 *
	 * @return the hjid
	 */
    @Id
    @Column(name = "HJID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getHjid() {
        return hjid;
    }

    /**
	 * Sets the hjid.
	 *
	 * @param value the new hjid
	 */
    public void setHjid(final Long value) {
        this.hjid = value;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
	public boolean equals(final Object object) {
    	return EqualsBuilder.reflectionEquals(this,object,"hjid");
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public final int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

}


text:
import {statementType} from "../_utils";
import * as Statements from "../../../src/abap/2_statements/statements";

const tests = [
  "DELETE DYNPRO lv_dyn.",
];

statementType(tests, "DELETE DYNPRO", Statements.DeleteDynpro);


text:
package org.apache.shindig.gadgets.render;

import org.apache.shindig.common.logging.i18n.MessageKeys;
import org.apache.shindig.common.uri.Uri;
import org.apache.shindig.config.ContainerConfig;
import org.apache.shindig.gadgets.Gadget;
import org.apache.shindig.gadgets.GadgetContext;
import org.apache.shindig.gadgets.GadgetException;
import org.apache.shindig.gadgets.LockedDomainService;
import org.apache.shindig.gadgets.process.ProcessingException;
import org.apache.shindig.gadgets.process.Processor;
import org.apache.shindig.gadgets.spec.View;

import com.google.inject.Inject;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;

/**
 * Validates a rendering request parameters before calling an appropriate renderer.
 */
public class Renderer {
  //class name for logging purpose
  private static final String classname = Renderer.class.getName();
  private static final Logger LOG = Logger.getLogger(classname,MessageKeys.MESSAGES);

  private final Processor processor;
  private final HtmlRenderer renderer;
  private final ContainerConfig containerConfig;
  private final LockedDomainService lockedDomainService;

  @Inject
  public Renderer(Processor processor,
                  HtmlRenderer renderer,
                  ContainerConfig containerConfig,
                  LockedDomainService lockedDomainService) {
    this.processor = processor;
    this.renderer = renderer;
    this.containerConfig = containerConfig;
    this.lockedDomainService = lockedDomainService;
  }

  /**
   * Attempts to render the requested gadget.
   *
   * @return The results of the rendering attempt.
   *
   * TODO: Localize error messages.
   */
  public RenderingResults render(GadgetContext context) {
    if (!validateParent(context)) {
      return RenderingResults.error("Unsupported parent parameter. Check your container code.",
          HttpServletResponse.SC_BAD_REQUEST);
    }

    try {
      Gadget gadget = processor.process(context);

      if (gadget.getCurrentView() == null) {
        return RenderingResults.error("Unable to locate an appropriate view in this gadget. " +
            "Requested: '" + gadget.getContext().getView() +
            "' Available: " + gadget.getSpec().getViews().keySet(), HttpServletResponse.SC_NOT_FOUND);
      }

      if (gadget.getCurrentView().getType() == View.ContentType.URL) {
        if (gadget.requiresCaja()) {
          return RenderingResults.error("Caja does not support url type gadgets.",
            HttpServletResponse.SC_BAD_REQUEST);
        } else if (gadget.sanitizeOutput()) {
          return RenderingResults.error("Type=url gadgets cannot be sanitized.",
            HttpServletResponse.SC_BAD_REQUEST);
        }
        return RenderingResults.mustRedirect(gadget.getCurrentView().getHref());
      }

      if (!lockedDomainService.isGadgetValidForHost(context.getHost(), gadget, context.getContainer())) {
        return RenderingResults.error("Invalid domain", HttpServletResponse.SC_BAD_REQUEST);
      }

      return RenderingResults.ok(renderer.render(gadget));
    } catch (RenderingException e) {
      return logError("render", context.getUrl(), e.getHttpStatusCode(), e);
    } catch (ProcessingException e) {
      return logError("render", context.getUrl(), e.getHttpStatusCode(), e);
    } catch (RuntimeException e) {
      if (e.getCause() instanceof GadgetException) {
        return logError("render", context.getUrl(), ((GadgetException)e.getCause()).getHttpStatusCode(),
            e.getCause());
      }
      throw e;
    }
  }

  private RenderingResults logError(String methodname, Uri gadgetUrl, int statusCode, Throwable t) {
    if (LOG.isLoggable(Level.INFO)) {
      LOG.logp(Level.INFO, classname, methodname, MessageKeys.FAILED_TO_RENDER, new Object[] {gadgetUrl,t.getMessage()});
    }
    return RenderingResults.error(t.getMessage(), statusCode);
  }

  /**
   * Validates that the parent parameter was acceptable.
   *
   * @return True if the parent parameter is valid for the current container.
   */
  private boolean validateParent(GadgetContext context) {
    String container = context.getContainer();
    String parent = context.getParameter("parent");

    if (parent == null) {
      // If there is no parent parameter, we are still safe because no
      // dependent code ever has to trust it anyway.
      return true;
    }

    List<Object> parents = containerConfig.getList(container, "gadgets.parent");
    if (parents.isEmpty()) {
      // Allow all.
      return true;
    }

    // We need to check each possible parent parameter against this regex.
    for (Object pattern : parents) {
      if (Pattern.matches(pattern.toString(), parent)) {
        return true;
      }
    }

    return false;
  }
}


text:
This intention replaces a JDK 5.0 for-each loop which
  iterates over a collection or array with an equivalent for loop that uses an index to
  iterate over the collection or array.


text:
namespace Merchello.Core
{
    using System;

    /// <summary>
    /// Constants for detached published content type.
    /// </summary>
    public static partial class Constants
    {
        /// <summary>
        /// The detached published content type.
        /// </summary>
        public static class DetachedPublishedContentType
        {
            /// <summary>
            /// Gets the default product variant detached published content type key.
            /// </summary>
            public static Guid DefaultProductVariantDetachedPublishedContentTypeKey
            {
                get { return new Guid("1B291A7A-417D-41D1-A044-9051E6F30A15"); }
            }
        }
    }
}


text:
package org.openntf.domino.thread;

import org.openntf.domino.xots.Tasklet;

@Tasklet(session = Tasklet.Session.CLONE)
/**
 * Interface for Workers that write objects asynchronius
 * @author Roland Praml, FOCONIS AG
 *
 * @param <T>
 */
public interface TaskletWorker<T> {

	public void startUp();

	public void tearDown();

	public void process(T t);

}


text:
var playButton = '.jp-play';
var pauseButton = '.jp-pause'
var nextButton = '.jp-next';
var prevButton = '.jp-previous';

function onKeyPress(key) {
    if (key === NEXT) {
        simulateClick(document.querySelector(nextButton));
    } else if (key === PLAY) {
        var isPlaying = document.querySelector(playButton).style.display == 'none';
        var playPauseButton = null;
        if (isPlaying) {
            playPauseButton = document.querySelector(pauseButton);
        } else {
            playPauseButton = document.querySelector(playButton);
        }
        simulateClick(playPauseButton);
    } else if (key === PREV) {
        simulateClick(document.querySelector(prevButton));
    }
}