text:
/**
 * @file Promise polyfill
 * @since 0.1.5
 */
/*#ifndef(UMD)*/
"use strict";
/*global _gpfAssert*/ // Assertion method
/*global _gpfCompatibilityInstallGlobal*/ // Install compatible global if missing
/*global _gpfIgnore*/ // Helper to remove unused parameter warning
/*#endif*/

// Ensure the functions are called only once
function _gpfPromiseSafeResolve (fn, onFulfilled, onRejected) {
    var safe = true;
    function makeSafe (callback) {
        return function (value) {
            if (safe) {
                safe = false;
                callback(value);
            }
        };
    }
    try {
        fn(makeSafe(onFulfilled), makeSafe(onRejected));
    } catch (e) {
        /* istanbul ignore else */ // compability.promise.1
        if (safe) {
            safe = false;
            onRejected(e);
        }
    }
}

function _gpfPromiseFinale () {
    /*jshint validthis:true*/
    var me = this; //eslint-disable-line no-invalid-this
    me._handlers.forEach(function (handler) {
        handler.process(me);
    });
    me._handlers = []; // Reset list
}

function _gpfPromiseReject (newValue) {
    /*jshint validthis:true*/
    var me = this; //eslint-disable-line no-invalid-this
    me._state = false;
    me._value = newValue;
    _gpfPromiseFinale.call(me);
}

var _gpfPromiseResolve;

function _gpfPromiseResolveChainIfFunction (newValue, then) {
    /*jshint validthis:true*/
    var me = this; //eslint-disable-line no-invalid-this
    if (typeof then === "function") {
        _gpfPromiseSafeResolve(then.bind(newValue), _gpfPromiseResolve.bind(me), _gpfPromiseReject.bind(me));
        return true;
    }
}

function _gpfPromiseResolveChain (newValue) {
    /*jshint validthis:true*/
    var me = this; //eslint-disable-line no-invalid-this
    if (newValue && ["object", "function"].includes(typeof newValue)) {
        return _gpfPromiseResolveChainIfFunction.call(me, newValue, newValue.then);
    }
}

//Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
_gpfPromiseResolve = function (newValue) {
    /*jshint validthis:true*/
    var me = this; //eslint-disable-line no-invalid-this
    try {
        _gpfAssert(newValue !== me, "A promise cannot be resolved with itself.");
        if (_gpfPromiseResolveChain.call(me, newValue)) {
            return;
        }
        me._state = true;
        me._value = newValue;
        _gpfPromiseFinale.call(me);
    } catch (e) {
        /* istanbul ignore next */ // compability.promise.1
        _gpfPromiseReject.call(me, e);
    }
};

var _GpfPromise = gpf.Promise = function (fn) {
    this._handlers = [];
    _gpfPromiseSafeResolve(fn, _gpfPromiseResolve.bind(this), _gpfPromiseReject.bind(this));
};

function _gpfPromiseHandler () {
}

function _gpfPromiseGetCallbackFromState (handler, promise) {
    if (promise._state) {
        return handler.onFulfilled;
    }
    return handler.onRejected;
}

function _gpfPromiseSettleFromState (handler, promise) {
    if (promise._state) {
        handler.resolve(promise._value);
    } else {
        handler.reject(promise._value);
    }
}

function _gpfPromiseAsyncProcess (promise) {
    /*jshint validthis:true*/
    var me = this; //eslint-disable-line no-invalid-this
    var callback = _gpfPromiseGetCallbackFromState(me, promise),
        result;
    if (callback === null) {
        return _gpfPromiseSettleFromState(me, promise);
    }
    try {
        result = callback(promise._value);
    } catch (e) {
        me.reject(e);
        return;
    }
    me.resolve(result);
}

var _GPF_COMPATIBILITY_PROMISE_NODELAY = 0;

var _gpfPromiseHandlersToProcess = [];

function _gpfPromiseProcessHandlers () {
    while (_gpfPromiseHandlersToProcess.length) {
        var that = _gpfPromiseHandlersToProcess.shift(),
            promise = _gpfPromiseHandlersToProcess.shift();
        _gpfPromiseAsyncProcess.call(that, promise);
    }
}

_gpfPromiseHandler.prototype = {

    onFulfilled: null,

    onRejected: null,

    resolve: null,

    reject: null,

    process: function (promise) {
        /*jshint validthis:true*/
        var me = this; //eslint-disable-line no-invalid-this
        if (promise._state === null) {
            promise._handlers.push(me);
            return;
        }
        if (!_gpfPromiseHandlersToProcess.length) {
            setTimeout(_gpfPromiseProcessHandlers, _GPF_COMPATIBILITY_PROMISE_NODELAY);
        }
        _gpfPromiseHandlersToProcess.push(me, promise);
    }

};

_GpfPromise.prototype = {

    // @property {Boolean|null} state of the promise
    _state: null,

    // @property {*} fufilment value
    _value: null,

    // @property {Handler[]} list of handlers
    _handlers: [],

    then: function (onFulfilled, onRejected) {
        var me = this;
        return new _GpfPromise(function (resolve, reject) {
            var handler = new _gpfPromiseHandler();
            if (undefined !== onFulfilled) {
                handler.onFulfilled = onFulfilled;
            }
            if (undefined !== onRejected) {
                handler.onRejected = onRejected;
            }
            handler.resolve = resolve;
            handler.reject = reject;
            handler.process(me);
        });
    },

    "catch": function (onRejected) {
        return this.then(null, onRejected);
    }

};

_GpfPromise.resolve = function (value) {
    return new _GpfPromise(function (resolve) {
        resolve(value);
    });
};

_GpfPromise.reject = function (value) {
    return new _GpfPromise(function (resolve, reject) {
        _gpfIgnore(resolve);
        reject(value);
    });
};

function _gpfPromiseAllAssign (state, index, result) {
    state.promises[index] = result;
    if (!--state.remaining) {
        state.resolve(state.promises);
    }
}

function _gpfPromiseAllHandle (result, index) {
    /*jshint validthis:true*/
    var me = this; //eslint-disable-line no-invalid-this
    try {
        if (result instanceof _GpfPromise) {
            result.then(function (value) {
                _gpfPromiseAllHandle.call(me, value, index);
            }, me.reject);
            return;
        }
        _gpfPromiseAllAssign(me, index, result);
    } catch (e) {
        /* istanbul ignore next */ // compability.promise.1
        me.reject(e);
    }
}

_GpfPromise.all = function (promises) {
    if (!promises.length) {
        return _GpfPromise.resolve([]);
    }
    return new _GpfPromise(function (resolve, reject) {
        promises.forEach(_gpfPromiseAllHandle.bind({
            resolve: resolve,
            reject: reject,
            remaining: promises.length,
            promises: promises
        }));
    });
};

_GpfPromise.race = function (promises) {
    return new _GpfPromise(function (resolve, reject) {
        promises.forEach(function (promise) {
            promise.then(resolve, reject);
        });
    });
};

_gpfCompatibilityInstallGlobal("Promise", _GpfPromise);

/*#ifndef(UMD)*/

gpf.internals._GpfPromise = _GpfPromise;

/*#endif*/


text:
using Microsoft.Win32.SafeHandles;
using System.Runtime.InteropServices;

internal partial class Interop
{
    internal partial class mincore
    {
        [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
        internal static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Routing\Matching;

use Http\Request;
use Routing\Route;

class HostValidator implements ValidatorInterface
{
    /**
     * Validate a given rule against a route and request.
     *
     * @param  \Routing\Route  $route
     * @param  \Http\Request  $request
     * @return bool
     */
    public function matches(Route $route, Request $request)
    {
        $regex = $route->getCompiled()->getHostRegex();

        if (is_null($regex)) return true;

        return preg_match($regex, $request->getHost());
    }

}


text:
package uk.co.itmoore.intellisubsteps.psi.feature;

import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import uk.co.itmoore.intellisubsteps.psi.AbstractSubstepsLexer;

/**
 * Created by ian on 04/07/15.
 */
public class FeatureLexer extends AbstractSubstepsLexer {

    private static final Logger log = LogManager.getLogger(FeatureLexer.class);

    public enum FeatureLexerState{
        STATE_DEFAULT (true),
        STATE_AFTER_TAGS_KEYWORD(true),

        STATE_AFTER_FEATURE_KEYWORD(true),
        STATE_AFTER_FEATURE_NAME(false),

        STATE_AFTER_BACKGROUND_KEYWORD(false),
        STATE_IN_BACKGROUND_STEPS(true),

        STATE_AFTER_SCENARIO_KEYWORD(true),
        STATE_AFTER_SCENARIO_NAME(false),
        STATE_IN_SCENARIO_STEPS(true),

        STATE_AFTER_SCENARIO_OUTLINE_NAME(false),
        STATE_IN_SCENARIO_OUTLINE_STEPS(true),
        STATE_AFTER_SCENARIO_OUTLINE_KEYWORD(true),

        STATE_AFTER_EXAMPLES_KEYWORD(false),
        STATE_IN_TABLE_HEADER_ROW(true),
        STATE_IN_TABLE_VALUE_ROWS(true);

        private FeatureLexerState(boolean resetStateOnNewLine){
            this.resetStateOnNewLine = resetStateOnNewLine;
        }
        public final boolean resetStateOnNewLine;
    }

    private int previousPosition = -1;

    private IElementType myCurrentToken;
    private int myCurrentTokenStart;

    private String[] myKeywords = {"Tags", "Feature", "Background", "Scenario Outline", "Scenario", "Examples"};
    // NB. outline has to come before scenario..

    private FeatureLexerState myState;

    protected void setStartState(int initialState){
        myState = FeatureLexer.FeatureLexerState.values()[initialState];
    }

    public int getState() {
        return myState.ordinal();
    }

    public IElementType getTokenType() {
        return myCurrentToken;
    }

    public int getTokenStart() {
        return myCurrentTokenStart;
    }

    public int getTokenEnd() {
        return myPosition;
    }

    @NotNull
    @Override
    public CharSequence getBufferSequence() {
        return myBuffer;
    }

    @Override
    public int getBufferEnd() {
        return myEndOffset;
    }

    @Override
    public void advance() {

        log.trace("advance");

        if (myPosition > 0){

            if (myPosition == previousPosition){
                log.warn("myPosition same as previousPosition, bailing out to the end..");
                myPosition = myEndOffset;
            }

            previousPosition = myPosition;
        }

        if (myPosition >= myEndOffset) {
            myCurrentToken = null;
            return;
        }

        myCurrentTokenStart = myPosition;
        char c = myBuffer.charAt(myPosition);

        log.trace("char: [" + c + "] @ " + myPosition);

        if (Character.isWhitespace(c)) {
            advanceOverWhitespace();
            myCurrentToken = TokenType.WHITE_SPACE;
            while (myPosition < myEndOffset && Character.isWhitespace(myBuffer.charAt(myPosition))) {
                advanceOverWhitespace();
            }
        }
        else if (c == '#') {
            myCurrentToken = FeatureTokenTypes.COMMENT_TOKEN;
            advanceToEOL();
        }
        else if (c == '|' && (myState == FeatureLexerState.STATE_AFTER_EXAMPLES_KEYWORD
                            || myState == FeatureLexerState.STATE_IN_TABLE_HEADER_ROW
                            || myState == FeatureLexerState.STATE_IN_TABLE_VALUE_ROWS)
                ) {
            myCurrentToken = FeatureTokenTypes.TABLE_SEPARATOR_TOKEN;
            advanceOverWhitespace();

            //Todo - state here depends on the incoming state - could be row or value
            if (myState == FeatureLexerState.STATE_AFTER_EXAMPLES_KEYWORD ) {
                myState = FeatureLexerState.STATE_IN_TABLE_HEADER_ROW;
            }
        }
        else if (c == ':') {
            myCurrentToken = FeatureTokenTypes.COLON_TOKEN;
            myPosition++;
        }
        else {
            log.trace("current state = " + myState + " myPosition: " + myPosition + " myEndOffset: " +  myEndOffset);

            if (myState == FeatureLexerState.STATE_DEFAULT || myState == FeatureLexerState.STATE_AFTER_FEATURE_NAME) {

                for (String keyword : myKeywords) {
                    int length = keyword.length();
                    if (isStringAtPosition(keyword, myBuffer, myPosition, myEndOffset)) {

                        if (myEndOffset - myPosition > length &&
                                Character.isLetterOrDigit(myBuffer.charAt(myPosition + length))) {
                            continue;
                        }
                        myCurrentToken = lookupTokenType(keyword);

                        myPosition += length;
                        myState = determineState(myCurrentToken);

                        return;
                    }
                }
                log.trace("in default state, falling through..");
            }

            if (myState == FeatureLexerState.STATE_IN_TABLE_HEADER_ROW || myState == FeatureLexerState.STATE_IN_TABLE_VALUE_ROWS ) {

                if (myState == FeatureLexerState.STATE_IN_TABLE_HEADER_ROW) {

                    myCurrentToken = FeatureElementTypes.TABLE_HEADER_VALUE;
                } else if (myState == FeatureLexerState.STATE_IN_TABLE_VALUE_ROWS) {

                    myCurrentToken = FeatureElementTypes.TABLE_ROW_VALUE;
                }
                advanceToTableCellBoundary();
            }
            else {
                if (myState == FeatureLexerState.STATE_AFTER_EXAMPLES_KEYWORD) {
                } else if (myState == FeatureLexerState.STATE_AFTER_FEATURE_KEYWORD) {
                    myCurrentToken = FeatureElementTypes.FEATURE_NAME_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_AFTER_FEATURE_NAME;
                } else if (myState == FeatureLexerState.STATE_AFTER_FEATURE_NAME) {
                    myCurrentToken = FeatureElementTypes.FEATURE_DESCRIPTION_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_AFTER_FEATURE_NAME;
                } else if (myState == FeatureLexerState.STATE_AFTER_BACKGROUND_KEYWORD
                        || myState == FeatureLexerState.STATE_IN_BACKGROUND_STEPS) {

                    myCurrentToken = FeatureElementTypes.BACKGROUND_STEP_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_IN_BACKGROUND_STEPS;
                } else if (myState == FeatureLexerState.STATE_AFTER_SCENARIO_KEYWORD) {

                    myCurrentToken = FeatureElementTypes.SCENARIO_NAME_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_AFTER_SCENARIO_NAME;

                } else if (myState == FeatureLexerState.STATE_AFTER_SCENARIO_NAME || myState == FeatureLexerState.STATE_IN_SCENARIO_STEPS) {

                    myCurrentToken = FeatureElementTypes.STEP_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_IN_SCENARIO_STEPS;
                } else if (myState == FeatureLexerState.STATE_AFTER_TAGS_KEYWORD) {

                    myCurrentToken = FeatureElementTypes.TAG_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_DEFAULT;
                } else if (myState == FeatureLexerState.STATE_AFTER_SCENARIO_OUTLINE_KEYWORD) {

                    myCurrentToken = FeatureElementTypes.SCENARIO_OUTLINE_NAME_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_AFTER_SCENARIO_OUTLINE_NAME;
                } else if (myState == FeatureLexerState.STATE_AFTER_SCENARIO_OUTLINE_NAME || myState == FeatureLexerState.STATE_IN_SCENARIO_OUTLINE_STEPS) {

                    myCurrentToken = FeatureElementTypes.STEP_ELEMENT_TYPE;
                    myState = FeatureLexerState.STATE_IN_SCENARIO_OUTLINE_STEPS;
                } else {
                    log.error("advance fell through");
                }
                if (myCurrentToken == null){
                    // if this is null and we can't tell what the token is, just assign to text.  as the text of the feature evolves, hopefully a token will become apparent
                    myCurrentToken = FeatureTokenTypes.TEXT_TOKEN;
                }
                advanceToEOL();
            }
        }

        log.trace("end of advance myState is now: " + myState + " token is: " + myCurrentToken);

    }

    private FeatureLexerState determineState(IElementType myCurrentToken) {

        if (myCurrentToken == FeatureTokenTypes.FEATURE_KEYWORD_TOKEN) {
            return FeatureLexerState.STATE_AFTER_FEATURE_KEYWORD;
        }
        if (myCurrentToken == FeatureTokenTypes.BACKGROUND_KEYWORD_TOKEN) {
            return FeatureLexerState.STATE_AFTER_BACKGROUND_KEYWORD;
        }
        if (myCurrentToken == FeatureTokenTypes.SCENARIO_KEYWORD_TOKEN) {
            return FeatureLexerState.STATE_AFTER_SCENARIO_KEYWORD;
        }
        if (myCurrentToken == FeatureTokenTypes.SCENARIO_OUTLINE_KEYWORD_TOKEN) {
            return FeatureLexerState.STATE_AFTER_SCENARIO_OUTLINE_KEYWORD;
        }
        if (myCurrentToken == FeatureTokenTypes.TAGS_KEYWORD_TOKEN) {
            return FeatureLexerState.STATE_AFTER_TAGS_KEYWORD;
        }
        if (myCurrentToken == FeatureTokenTypes.EXAMPLES_KEYWORD_TOKEN) {
            return FeatureLexerState.STATE_AFTER_EXAMPLES_KEYWORD;
        }

        return FeatureLexerState.STATE_DEFAULT;
    }

    private IElementType lookupTokenType(final String keyword) {

        if (keyword.equals("Feature")) {
            return FeatureTokenTypes.FEATURE_KEYWORD_TOKEN;
        } else if (keyword.equals("Scenario")) {
            return FeatureTokenTypes.SCENARIO_KEYWORD_TOKEN;
        }else if (keyword.equals("Background")) {
            return FeatureTokenTypes.BACKGROUND_KEYWORD_TOKEN;
        }else if (keyword.equals("Scenario Outline")) {
            return FeatureTokenTypes.SCENARIO_OUTLINE_KEYWORD_TOKEN;
        }else if (keyword.equals("Examples")) {
            return FeatureTokenTypes.EXAMPLES_KEYWORD_TOKEN;
        }else if (keyword.equals("Tags")) {
            return FeatureTokenTypes.TAGS_KEYWORD_TOKEN;
        }

        log.error("failed to lookup token type for keyword: " + keyword);
        return null;
    }

    public static boolean isStringAtPosition(String keyword, CharSequence buf, int position, int endOffset) {
        int length = keyword.length();
        return endOffset - position >= length && buf.subSequence(position, position + length).toString().equals(keyword);
    }

    private void advanceToTableCellBoundary(){

        log.trace("advanceToTableCellBoundary");

        if (myPosition < myBuffer.length()-1) {

            myPosition++;
            int mark = myPosition;
            char c = myBuffer.charAt(myPosition);

            while (myPosition < myEndOffset && (c != '|' && c != '\n')) {
                myPosition++;

                // TODO can get an idx out of bounds here

                if (myPosition < myBuffer.length()) {
                    c = myBuffer.charAt(myPosition);
                } else {
                    log.trace("hopefully bailing out here: myBuffer.length(): " + myBuffer.length() + " myEndOffset: " + myEndOffset);
                }
            }
            returnWhitespace(mark);
        }
        else {
            myPosition++;
        }
    }

    private void advanceOverWhitespace() {
        if (myBuffer.charAt(myPosition) == '\n') {

            if (myState ==  FeatureLexerState.STATE_AFTER_FEATURE_NAME){

                // feature descriptions can be multi line, with gaps!
            }
            else if (myState == FeatureLexerState.STATE_IN_TABLE_HEADER_ROW){

                myState = FeatureLexerState.STATE_IN_TABLE_VALUE_ROWS;
            }
            else {

                // reset state if it's blank up to the next keyword, otherwise, we're still in the thing we were in

                String nextContent = bufString.substring(myPosition + 1).trim();
                int nextLineEnd = nextContent.indexOf('\n');
                if (nextLineEnd != -1) {

                    String nextLine = nextContent.substring(0, nextLineEnd);

                    if (nextLine.startsWith("Scenario:") || nextLine.startsWith("Tags:") ||
                            nextLine.startsWith("Scenario Outline:") ||
                            nextLine.startsWith("Background:") || nextLine.startsWith("Examples:")){

                        log.trace("next content line contains a keyword, resetting state");
                        myState = FeatureLexerState.STATE_DEFAULT;
                    }
                }
            }
        }
        myPosition++;
    }

}


text:
@interface HistoryViewController : UIViewController <UITableViewDataSource,UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UITableView *historyInfoTableView;
@property (weak, nonatomic) IBOutlet UIButton *goToMainPageFromHistory;
@property (weak, nonatomic) IBOutlet UIButton *backToHistoryButton;
@property (weak, nonatomic) IBOutlet UITextView *detailInfoForSelectedGame;
@property (weak, nonatomic) IBOutlet UIImageView *imageGame;
@property (weak, nonatomic) IBOutlet UIImageView *bigImage;

@property(strong,nonatomic) KKMusicPlayer* soundPlayer;

@end


text:
using AutoMapper;
using WebTextEditor.BLL.Mappings;

namespace WebTextEditor
{
    /// <summary>
    ///     Automapper configuration.
    /// </summary>
    public static class AutomapperConfig
    {
        /// <summary>
        ///     Perform mapping configuration.
        /// </summary>
        public static void Configure()
        {
            Mapper.Initialize(cfg => { cfg.AddProfile<DocumentsProfile>(); });
        }
    }
}


text:
#ifndef __domFx_surface_init_from_common_h__
#define __domFx_surface_init_from_common_h__

#include <dae/daeDocument.h>
#include <dom/domTypes.h>
#include <dom/domElements.h>

class DAE;

/**
 * This element is an IDREF which specifies the image to use to initialize
 * a specific mip of a 1D or 2D surface, 3D slice, or Cube face.
 */
class domFx_surface_init_from_common_complexType
{
protected:  // Attributes
	xsUnsignedInt attrMip;
	xsUnsignedInt attrSlice;
	domFx_surface_face_enum attrFace;

protected:  // Value
	/**
	 * The xsIDREF value of the text data of this element.
	 */
	xsIDREF _value;

public:	//Accessors and Mutators
	/**
	 * Gets the mip attribute.
	 * @return Returns a xsUnsignedInt of the mip attribute.
	 */
	xsUnsignedInt getMip() const { return attrMip; }
	/**
	 * Sets the mip attribute.
	 * @param atMip The new value for the mip attribute.
	 */
	void setMip( xsUnsignedInt atMip ) { attrMip = atMip; }

	/**
	 * Gets the slice attribute.
	 * @return Returns a xsUnsignedInt of the slice attribute.
	 */
	xsUnsignedInt getSlice() const { return attrSlice; }
	/**
	 * Sets the slice attribute.
	 * @param atSlice The new value for the slice attribute.
	 */
	void setSlice( xsUnsignedInt atSlice ) { attrSlice = atSlice; }

	/**
	 * Gets the face attribute.
	 * @return Returns a domFx_surface_face_enum of the face attribute.
	 */
	domFx_surface_face_enum getFace() const { return attrFace; }
	/**
	 * Sets the face attribute.
	 * @param atFace The new value for the face attribute.
	 */
	void setFace( domFx_surface_face_enum atFace ) { attrFace = atFace; }

	/**
	 * Gets the value of this element.
	 * @return Returns a xsIDREF of the value.
	 */
	xsIDREF &getValue() { return _value; }
	/**
	 * Gets the value of this element.
	 * @return Returns a constant xsIDREF of the value.
	 */
	const xsIDREF &getValue() const { return _value; }
	/**
	 * Sets the _value of this element.
	 * @param val The new value for this element.
	 */
	void setValue( const xsIDREF &val ) { _value = val; }

protected:
	/**
	 * Constructor
	 */
	domFx_surface_init_from_common_complexType(DAE& dae, daeElement* elt) : attrMip(), attrSlice(), attrFace(), _value(*elt) {}
	/**
	 * Destructor
	 */
	virtual ~domFx_surface_init_from_common_complexType() {}
	/**
	 * Overloaded assignment operator
	 */
	domFx_surface_init_from_common_complexType &operator=(const domFx_surface_init_from_common_complexType&) { return *this; }
};

/**
 * An element of type domFx_surface_init_from_common_complexType.
 */
class domFx_surface_init_from_common : public daeElement, public domFx_surface_init_from_common_complexType
{
public:
	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FX_SURFACE_INIT_FROM_COMMON; }
	static daeInt ID() { return 21; }
	virtual daeInt typeID() const { return ID(); }

public:	//Accessors and Mutators
	/**
	 * Gets the mip attribute.
	 * @return Returns a xsUnsignedInt of the mip attribute.
	 */
	xsUnsignedInt getMip() const { return attrMip; }
	/**
	 * Sets the mip attribute.
	 * @param atMip The new value for the mip attribute.
	 */
	void setMip( xsUnsignedInt atMip ) { attrMip = atMip; _validAttributeArray[0] = true; }

	/**
	 * Gets the slice attribute.
	 * @return Returns a xsUnsignedInt of the slice attribute.
	 */
	xsUnsignedInt getSlice() const { return attrSlice; }
	/**
	 * Sets the slice attribute.
	 * @param atSlice The new value for the slice attribute.
	 */
	void setSlice( xsUnsignedInt atSlice ) { attrSlice = atSlice; _validAttributeArray[1] = true; }

	/**
	 * Gets the face attribute.
	 * @return Returns a domFx_surface_face_enum of the face attribute.
	 */
	domFx_surface_face_enum getFace() const { return attrFace; }
	/**
	 * Sets the face attribute.
	 * @param atFace The new value for the face attribute.
	 */
	void setFace( domFx_surface_face_enum atFace ) { attrFace = atFace; _validAttributeArray[2] = true; }

protected:
	/**
	 * Constructor
	 */
	domFx_surface_init_from_common(DAE& dae) : daeElement(dae), domFx_surface_init_from_common_complexType(dae, this) {}
	/**
	 * Destructor
	 */
	virtual ~domFx_surface_init_from_common() {}
	/**
	 * Overloaded assignment operator
	 */
	domFx_surface_init_from_common &operator=(const domFx_surface_init_from_common&) { return *this; }

public: // STATIC METHODS
	/**
	 * Creates an instance of this class and returns a daeElementRef referencing it.
	 * @return a daeElementRef referencing an instance of this object.
	 */
	static DLLSPEC daeElementRef create(DAE& dae);
	/**
	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
	 * If a daeMetaElement already exists it will return that instead of creating a new one.
	 * @return A daeMetaElement describing this COLLADA element.
	 */
	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
};

#endif


text:
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/login/ui/login_button.h"

#include <utility>

#include "ash/login/ui/views_utils.h"
#include "ash/style/ash_color_provider.h"
#include "base/bind.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/controls/focus_ring.h"

namespace ash {

namespace {

// Color of the ink drop ripple.
constexpr SkColor kInkDropRippleColor = SkColorSetARGB(0x0F, 0xFF, 0xFF, 0xFF);

// Color of the ink drop highlight.
constexpr SkColor kInkDropHighlightColor =
    SkColorSetARGB(0x14, 0xFF, 0xFF, 0xFF);

}  // namespace

LoginButton::LoginButton(PressedCallback callback)
    : views::ImageButton(std::move(callback)) {
  SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER);
  SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE);
  views::InkDrop::Get(this)->SetMode(views::InkDropHost::InkDropMode::ON);
  SetHasInkDropActionOnClick(true);
  views::InkDrop::Get(this)->SetCreateHighlightCallback(base::BindRepeating(
      [](Button* host) {
        return std::make_unique<views::InkDropHighlight>(
            gfx::SizeF(host->size()), kInkDropHighlightColor);
      },
      this));
  views::InkDrop::Get(this)->SetCreateRippleCallback(base::BindRepeating(
      [](LoginButton* host) -> std::unique_ptr<views::InkDropRipple> {
        const gfx::Point center = host->GetLocalBounds().CenterPoint();
        const int radius = host->GetInkDropRadius();
        gfx::Rect bounds(center.x() - radius, center.y() - radius, radius * 2,
                         radius * 2);

        return std::make_unique<views::FloodFillInkDropRipple>(
            host->size(), host->GetLocalBounds().InsetsFrom(bounds),
            views::InkDrop::Get(host)->GetInkDropCenterBasedOnLastEvent(),
            kInkDropRippleColor, 1.f /*visible_opacity*/);
      },
      this));

  SetInstallFocusRingOnFocus(true);
  views::FocusRing::Get(this)->SetColorId(ui::kColorAshFocusRing);
  login_views_utils::ConfigureRectFocusRingCircleInkDrop(
      this, views::FocusRing::Get(this), absl::nullopt);
}

LoginButton::~LoginButton() = default;

int LoginButton::GetInkDropRadius() const {
  return std::min(GetLocalBounds().width(), GetLocalBounds().height()) / 2;
}

}  // namespace ash


text:
package com.worizon.jsonrpc.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation to expose an interface as Remote. All interfaces required to be called
 * as a remote service via the proxy api must be annotated as {@literal @}Remote.
 *
 * @author Enric Cecilla
 * @since 1.0.0
 */
@Retention(RetentionPolicy.RUNTIME )
@Target(ElementType.TYPE)
public @interface Remote {

}


text:
package com.bangalore.barcamp.activity;

import java.util.Collections;
import java.util.List;

import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ListView;

import com.bangalore.barcamp.BCBUtils;
import com.bangalore.barcamp.MessagesListAdapter;
import com.bangalore.barcamp.R;
import com.bangalore.barcamp.data.BCBUpdatesMessage;
import com.bangalore.barcamp.database.MessagesDataSource;

public class UpdateMessagesActivity extends BCBActivityBaseClass {

	public static final String FROM_NOTIFICATION = "fromNotification";
	public static String EXTRA_POS = "pos";
	MessageLoadingTask task;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.slot_details_list);

		BCBUtils.createActionBarOnActivity(this);
		BCBUtils.addNavigationActions(this);
		if (getIntent().getBooleanExtra(FROM_NOTIFICATION, false)) {
		}

	}

	@Override
	protected void onResume() {
		super.onResume();
		task = new MessageLoadingTask();
		task.execute();
	}

	class MessageLoadingTask extends
			AsyncTask<Void, Void, List<BCBUpdatesMessage>> {

		@Override
		protected List<BCBUpdatesMessage> doInBackground(Void... params) {
			MessagesDataSource ds = new MessagesDataSource(
					UpdateMessagesActivity.this);
			ds.open();
			List<BCBUpdatesMessage> list = ds.getAllMessages();
			Collections.reverse(list);
			ds.close();
			return list;
		}

		@Override
		protected void onPostExecute(List<BCBUpdatesMessage> result) {
			super.onPostExecute(result);
			ListView listview = (ListView) findViewById(R.id.listView1);
			MessagesListAdapter adapter = new MessagesListAdapter(
					UpdateMessagesActivity.this, R.layout.updates_list_item,
					result);
			listview.setAdapter(adapter);
		}

	}
}


text:
require 'spec_helper'

describe AccessGranted::Role do
  subject { AccessGranted::Role }

  it "requires a role name" do
    expect { subject.new }.to raise_error(ArgumentError)
  end

  it "creates a default role without conditions" do
    expect(subject.new(:member).conditions).to be_nil
  end

  describe "#applies_to?" do
    it "matches user when no conditions given" do
      role = subject.new(:member)
      user = double("User")
      expect(role.applies_to?(user)).to eq(true)
    end

    it "matches user by hash conditions" do
      role = subject.new(:moderator,  { is_moderator: true })
      user = double("User", is_moderator: true)
      expect(role.applies_to?(user)).to eq(true)
    end

    it "doesn't match user if any of hash conditions is not met" do
      role = subject.new(:moderator, { is_moderator: true, is_admin: true })
      user = double("User", is_moderator: true, is_admin: false)
      expect(role.applies_to?(user)).to eq(false)
    end

    it "matches user by Proc conditions" do
      role = subject.new(:moderator, proc {|user| user.is_moderator? })
      user = double("User", is_moderator?: true)
      expect(role.applies_to?(user)).to eq(true)
    end
  end

  describe "#can" do
    before :each do
      @role = AccessGranted::Role.new(:member)
    end

    it "forbids creating actions with the same name" do
      @role.can :read, String
      expect { @role.can :read, String }.to raise_error AccessGranted::DuplicatePermission
    end

    it "accepts :manage shortcut for CRUD actions" do
      @role.can :manage, String
      expect(@role.permissions.map(&:action)).to include(:read, :create, :update, :destroy)
    end

    describe "when action is an Array" do
      it "creates multiple permissions" do
        @role.can [:read, :create], String
        expect(@role.permissions.size).to eq(2)
      end
    end

    describe "when no conditions given" do
      it "should be able to read a class" do
        @role.can :read, String
        expect(@role.find_permission(:read, String)).to_not be_nil
      end

      it "should be able to read instance of class" do
        @role.can :read, String
        expect(@role.find_permission(:read, "text")).to_not be_nil
      end
    end

    describe "when conditions given" do
      it "should be able to read when conditions match" do
        sub = double("Element", published: true)
        @role.can :read, sub.class, { published: true }
        expect(@role.find_permission(:read, sub)).to_not be_nil
      end
    end
  end
end


text:
![Work In Progress](https://img.shields.io/badge/Status-%20Work%20in%20Progress-blue.svg?style=flat-squared)

### Summary ###

This is a collection of solutions to exercises on low level programming,
reverse engineering, cryptography and binary exploitation.

### Contributing ###

Any sort of contribution is welcome as I'm likely to have missed something
along the road.

### License ###

Copyright (c) 2017 shxdow


text:
package org.apache.ignite.internal.processors.affinity;

import java.util.concurrent.ConcurrentSkipListMap;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
import org.junit.Test;

import static org.apache.ignite.IgniteSystemProperties.IGNITE_AFFINITY_HISTORY_SIZE;
import static org.apache.ignite.IgniteSystemProperties.getInteger;

/**
 * Tests for {@link GridAffinityProcessor}.
 */
@GridCommonTest(group = "Affinity Processor")
public class GridAffinityProcessorMemoryLeakTest extends GridCommonAbstractTest {
    /** Max value for affinity history size name. Should be the same as in GridAffinityAssignmentCache.MAX_HIST_SIZE */
    private final int MAX_HIST_SIZE = getInteger(IGNITE_AFFINITY_HISTORY_SIZE, 500);

    /** Cache name. */
    private static final String CACHE_NAME = "cache";

    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

        CacheConfiguration cacheCfg = defaultCacheConfiguration();

        cacheCfg.setName(CACHE_NAME);

        cacheCfg.setStoreKeepBinary(true);

        cacheCfg.setCacheMode(CacheMode.LOCAL);

        cfg.setCacheConfiguration(cacheCfg);

        return cfg;
    }

    /** {@inheritDoc} */
    @Override protected void afterTestsStopped() throws Exception {
        stopAllGrids();
    }

    /**
     * Test affinity functions caching and clean up.
     *
     * @throws Exception In case of any exception.
     */
    @Test
    public void testAffinityProcessor() throws Exception {
        Ignite ignite = startGrid(0);

        IgniteKernal grid = (IgniteKernal)grid(0);

        IgniteCache<String, String> cache;

        IgniteCache<String, String> globalCache = getOrCreateGlobalCache(ignite);

        IgniteDataStreamer<String, String> globalStreamer;

        int count = MAX_HIST_SIZE * 4;

        int size;

        do {
            try {
                cache = createLocalCache(ignite, count);

                cache.put("Key" + count, "Value" + count);

                cache.destroy();

                globalStreamer = createGlobalStreamer(ignite, globalCache);

                globalStreamer.addData("GlobalKey" + count, "GlobalValue" + count);

                globalStreamer.flush();

                globalStreamer.close();

                size = ((ConcurrentSkipListMap)GridTestUtils.getFieldValue(grid.context().affinity(), "affMap")).size();

                assertTrue("Cache has size that bigger then expected [size=" + size + "" +
                    ", expLimit=" + MAX_HIST_SIZE * 3 + "]", size < MAX_HIST_SIZE * 3);
            }
            catch (Exception e) {
                fail("Error was handled [" + e.getMessage() + "]");
            }
        }
        while (count-- > 0);
    }

    /**
     * Creates global cache.
     *
     * @param ignite instance of {@code Ignite}.
     * @param id unique id for local cache.
     * @return local cache instance.
     */
    private static IgniteCache<String, String> createLocalCache(Ignite ignite, long id) {
        final String cacheName = "localCache" + id;

        final CacheConfiguration<String, String> cCfg = new CacheConfiguration<>();

        cCfg.setName(cacheName);

        cCfg.setCacheMode(CacheMode.LOCAL);

        cCfg.setGroupName("some group");

        ignite.destroyCache(cacheName); // Local cache is not really local - reference can be kept by other nodes if restart during the load happens.

        return ignite.createCache(cCfg).withKeepBinary();
    }

    /**
     * Gets or creates global cache.
     *
     * @param ignite instance of {@code Ignite}.
     * @return global cache instance.
     */
    private static IgniteCache<String, String> getOrCreateGlobalCache(Ignite ignite) {
        final String cacheName = "GlobalCache";

        final CacheConfiguration<String, String> cCfg = new CacheConfiguration<>();

        cCfg.setName(cacheName);

        cCfg.setStoreKeepBinary(true);

        cCfg.setCacheMode(CacheMode.PARTITIONED);

        cCfg.setOnheapCacheEnabled(false);

        cCfg.setCopyOnRead(false);

        cCfg.setBackups(0);

        cCfg.setWriteBehindEnabled(false);

        cCfg.setReadThrough(false);

        return ignite.getOrCreateCache(cCfg).withKeepBinary();
    }

    /**
     * Creates streamer for global cache.
     *
     * @param ignite instance of {@code Ignite}.
     * @param cache instance of global cache.
     * @return instance of {@code IgniteDataStreamer}.
     */
    private static IgniteDataStreamer<String, String> createGlobalStreamer(Ignite ignite,
        IgniteCache<String, String> cache) {
        IgniteDataStreamer<String, String> streamer = ignite.dataStreamer(cache.getName());

        streamer.allowOverwrite(true);

        streamer.skipStore(true);

        streamer.keepBinary(false);

        return streamer;
    }
}


text:
package com.intellij.ui.components.panels;

import javax.swing.SwingConstants;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager2;
import java.util.ArrayList;

/**
 * This class is intended to lay out added components horizontally.
 * It allows to add them into the LEFT, CENTER, or RIGHT group, which are aligned separately.
 * Every group can contain any amount of components. The specified gap is added between components,
 * and the double gap is added between groups of components.
 *
NB!: this class must be modified together with the VerticalLayout class accordingly

 *
 * @author Sergey.Malenkov
 * @see VerticalLayout
 */
public final class HorizontalLayout implements LayoutManager2 {
  public static final String LEFT = "LEFT";
  public static final String RIGHT = "RIGHT";
  public static final String CENTER = "CENTER";

  private final ArrayList<Component> myLeft = new ArrayList<>();
  private final ArrayList<Component> myRight = new ArrayList<>();
  private final ArrayList<Component> myCenter = new ArrayList<>();
  private final int myAlignment;
  private final int myGap;

  /**
   * Creates a layout with the specified gap.
   * All components will have preferred widths,
   * but their heights will be set according to the container.
   *
   * @param gap horizontal gap between components
   */
  public HorizontalLayout(int gap) {
    myGap = gap;
    myAlignment = -1;
  }

  /**
   * Creates a layout with the specified gap and vertical alignment.
   * All components will have preferred sizes.
   *
   * @param gap       horizontal gap between components
   * @param alignment vertical alignment for components
   *
   * @see SwingConstants#TOP
   * @see SwingConstants#BOTTOM
   * @see SwingConstants#CENTER
   */
  public HorizontalLayout(int gap, int alignment) {
    myGap = gap;
    switch (alignment) {
      case SwingConstants.TOP:
      case SwingConstants.BOTTOM:
      case SwingConstants.CENTER:
        myAlignment = alignment;
        break;
      default:
        throw new IllegalArgumentException("unsupported alignment: " + alignment);
    }
  }

  @Override
  public void addLayoutComponent(Component component, Object constraints) {
    if ((constraints == null) || (constraints instanceof String)) {
      addLayoutComponent((String)constraints, component);
    }
    else {
      throw new IllegalArgumentException("unsupported constraints: " + constraints);
    }
  }

  @Override
  public Dimension maximumLayoutSize(Container target) {
    return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  }

  @Override
  public float getLayoutAlignmentX(Container target) {
    return .5f;
  }

  @Override
  public float getLayoutAlignmentY(Container target) {
    return .5f;
  }

  @Override
  public void invalidateLayout(Container target) {
  }

  @Override
  public void addLayoutComponent(String name, Component component) {
    synchronized (component.getTreeLock()) {
      if (name == null || LEFT.equalsIgnoreCase(name)) {
        myLeft.add(component);
      }
      else if (CENTER.equalsIgnoreCase(name)) {
        myCenter.add(component);
      }
      else if (RIGHT.equalsIgnoreCase(name)) {
        myRight.add(component);
      }
      else {
        throw new IllegalArgumentException("unsupported name: " + name);
      }
    }
  }

  @Override
  public void removeLayoutComponent(Component component) {
    myLeft.remove(component);
    myRight.remove(component);
    myCenter.remove(component);
  }

  @Override
  public Dimension preferredLayoutSize(Container container) {
    return getPreferredSize(container, true);
  }

  @Override
  public Dimension minimumLayoutSize(Container container) {
    return getPreferredSize(container, false);
  }

  @Override
  public void layoutContainer(Container container) {
    synchronized (container.getTreeLock()) {
      Dimension left = getPreferredSize(myLeft);
      Dimension right = getPreferredSize(myRight);
      Dimension center = getPreferredSize(myCenter);

      Insets insets = container.getInsets();
      int width = container.getWidth() - insets.left - insets.right;
      int height = container.getHeight() - insets.top - insets.bottom;

      int leftX = 0;
      if (left != null) {
        leftX = myGap + layout(myLeft, 0, height, insets);
      }
      int rightX = width;
      if (right != null) {
        rightX -= right.width;
      }
      if (rightX < leftX) {
        rightX = leftX;
      }
      if (center != null) {
        int centerX = (width - center.width) / 2;
        if (centerX > leftX) {
          int centerRightX = centerX + center.width + myGap + myGap;
          if (centerRightX > rightX) {
            centerX = rightX - center.width - myGap - myGap;
          }
        }
        if (centerX < leftX) {
          centerX = leftX;
        }
        centerX = myGap + layout(myCenter, centerX, height, insets);
        if (rightX < centerX) {
          rightX = centerX;
        }
      }
      if (right != null) {
        layout(myRight, rightX, height, insets);
      }
    }
  }

  private int layout(ArrayList<Component> list, int x, int height, Insets insets) {
    for (Component component : list) {
      if (component.isVisible()) {
        Dimension size = component.getPreferredSize();
        int y = 0;
        if (myAlignment == -1) {
          size.height = height;
        }
        else if (myAlignment != SwingConstants.TOP) {
          y = height - size.height;
          if (myAlignment == SwingConstants.CENTER) {
            y /= 2;
          }
        }
        component.setBounds(x + insets.left, y + insets.top, size.width, size.height);
        x += size.width + myGap;
      }
    }
    return x;
  }

  private static Dimension join(Dimension result, int gap, Dimension size) {
    if (size == null) {
      return result;
    }
    if (result == null) {
      return new Dimension(size);
    }
    result.width += gap + size.width;
    if (result.height < size.height) {
      result.height = size.height;
    }
    return result;
  }

  private Dimension getPreferredSize(ArrayList<Component> list) {
    Dimension result = null;
    for (Component component : list) {
      if (component.isVisible()) {
        result = join(result, myGap, component.getPreferredSize());
      }
    }
    return result;
  }

  private Dimension getPreferredSize(Container container, boolean aligned) {
    synchronized (container.getTreeLock()) {
      Dimension left = getPreferredSize(myLeft);
      Dimension right = getPreferredSize(myRight);
      Dimension center = getPreferredSize(myCenter);
      Dimension result = join(join(join(null, myGap + myGap, left), myGap + myGap, center), myGap + myGap, right);
      if (result == null) {
        result = new Dimension();
      }
      else if (aligned && center != null) {
        int leftWidth = left == null ? 0 : left.width;
        int rightWidth = right == null ? 0 : right.width;
        result.width += Math.abs(leftWidth - rightWidth);
      }
      Insets insets = container.getInsets();
      result.width += insets.left + insets.right;
      result.height += insets.top + insets.bottom;
      return result;
    }
  }
}


text:
#ifdef GPG_COMPATIBLE

#ifndef __TAG2_SUB33__
#define __TAG2_SUB33__

#include "Subpacket.h"

namespace OpenPGP {
    namespace Subpacket {
        namespace Tag2 {
            // This is not official (yet)
            // http://gnupg-devel.gnupg.narkive.com/Z0EFUBU7/issuer-fingerprint-was-vanity-keys
            //
            // 5.2.3.27. IssuerFingerprint
            //
            //    (N-octet Key Fingerprint)
            //
            //     The OpenPGP Fingerprint of the key issuing the signature. For
            //     current versions of OpenPGP N has the value 20. Future versions of
            //     OpenPGP may specify a different scheme for the fingerprint and thus
            //     another value for N. Implementations should thus be prepared for
            //     other fingerprint lengths but honor this Subpacket only if N is 20.

            class Sub33 : public Sub {
                private:
                    uint8_t version;
                    std::string issuer_fingerprint;

                public:
                    typedef std::shared_ptr <Sub33> Ptr;

                    Sub33();
                    Sub33(const std::string & data);
                    void read(const std::string & data);
                    std::string show(const std::size_t indents = 0, const std::size_t indent_size = 4) const;
                    std::string raw() const;

                    uint8_t get_version() const;
                    std::string get_issuer_fingerprint() const;

                    void set_version(const uint8_t ver);
                    void set_issuer_fingerprint(const std::string & fingerprint);

                    Sub::Ptr clone() const;
            };
        }
    }
}

#endif

#endif


text:
package io.bootique.metrics.health;

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

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class HealthCheckRegistryTest {

    private HealthCheck success;
    private HealthCheck inactive;
    private HealthCheck failure;
    private HealthCheck failureTh;
    private HealthCheck slowSuccess;

    @BeforeEach
    public void before() {
        this.success = mock(HealthCheck.class);
        when(success.safeCheck()).thenReturn(HealthCheckOutcome.ok());
        when(success.isActive()).thenReturn(true);

        this.inactive = mock(HealthCheck.class);
        when(inactive.safeCheck()).thenReturn(HealthCheckOutcome.ok());
        when(inactive.isActive()).thenReturn(false);

        this.failure = mock(HealthCheck.class);
        when(failure.safeCheck()).thenReturn(HealthCheckOutcome.critical("uh"));
        when(failure.isActive()).thenReturn(true);

        this.failureTh = mock(HealthCheck.class);
        when(failureTh.safeCheck()).thenReturn(HealthCheckOutcome.critical(new Throwable("uh")));
        when(failureTh.isActive()).thenReturn(true);

        this.slowSuccess = mock(HealthCheck.class);
        when(slowSuccess.isActive()).thenReturn(true);
        when(slowSuccess.safeCheck()).then(i -> {
            Thread.sleep(500);
            return HealthCheckOutcome.ok();
        });
    }

    private HealthCheckRegistry createRegistry(HealthCheck... checks) {

        Map<String, HealthCheck> healthChecks = new HashMap<>();
        for (int i = 0; i < checks.length; i++) {
            healthChecks.put(String.valueOf(i), checks[i]);
        }

        return new HealthCheckRegistry(healthChecks);
    }

    @Test
    public void testFiltered() {
        HealthCheckRegistry original = createRegistry(success, failure);
        HealthCheckRegistry filtered = original.filtered(s -> "1".equals(s));
        assertNotSame(original, filtered);

        Map<String, HealthCheckOutcome> originalResult = original.runHealthChecks();
        Map<String, HealthCheckOutcome> filteredResult = filtered.runHealthChecks();

        assertEquals(2, originalResult.size());
        assertEquals(1, filteredResult.size());
        assertEquals(HealthCheckStatus.CRITICAL, filteredResult.get("1").getStatus());
    }

    @Test
    public void testRunHealthChecks_Serial() {
        HealthCheckRegistry registry = createRegistry(success, failure);

        Map<String, HealthCheckOutcome> results = registry.runHealthChecks();
        assertEquals(2, results.size());
        assertEquals(HealthCheckStatus.OK, results.get("0").getStatus());
        assertEquals(HealthCheckStatus.CRITICAL, results.get("1").getStatus());
    }

    @Test
    public void testRunHealthChecks_Serial_Inactive() {
        HealthCheckRegistry registry = createRegistry(success, inactive);

        Map<String, HealthCheckOutcome> results = registry.runHealthChecks();
        assertEquals(1, results.size());
        assertEquals(HealthCheckStatus.OK, results.get("0").getStatus());
    }

    @Test
    public void testRunHealthChecks_Parallel() {

        HealthCheckRegistry registry = createRegistry(success, failure, failureTh);

        Map<String, HealthCheckOutcome> results = runParallel(registry, 3, 10000);
        assertEquals(3, results.size());
        assertEquals(HealthCheckStatus.OK, results.get("0").getStatus());
        assertEquals(HealthCheckStatus.CRITICAL, results.get("1").getStatus());
        assertEquals(HealthCheckStatus.CRITICAL, results.get("2").getStatus());
    }

    @Test
    public void testRunHealthChecks_Parallel_Inactive() {

        HealthCheckRegistry registry = createRegistry(success, inactive, failure);

        Map<String, HealthCheckOutcome> results = runParallel(registry, 3, 10000);
        assertEquals(2, results.size());
        assertEquals(HealthCheckStatus.OK, results.get("0").getStatus(), () -> "Unexpected HC: " + results.get("0"));
        assertEquals(HealthCheckStatus.CRITICAL, results.get("2").getStatus(), () -> "Unexpected HC: " + results.get("2"));
    }

    @Test
    public void testRunHealthChecks_ParallelTimeout() {

        HealthCheckRegistry registry = createRegistry(slowSuccess, success, slowSuccess);
        Map<String, HealthCheckOutcome> results = runParallel(registry, 3, 80);

        assertEquals(3, results.size());

        assertEquals(HealthCheckStatus.CRITICAL, results.get("0").getStatus());
        assertEquals("health check timed out", results.get("0").getMessage());

        assertEquals(HealthCheckStatus.OK, results.get("1").getStatus());

        assertEquals(HealthCheckStatus.CRITICAL, results.get("2").getStatus());
        assertEquals("health check timed out", results.get("2").getMessage());
    }

    private Map<String, HealthCheckOutcome> runParallel(HealthCheckRegistry registry, int threads, long timeoutMs) {
        ExecutorService threadPool = Executors.newFixedThreadPool(threads);

        try {
            return registry.runHealthChecks(threadPool, timeoutMs, TimeUnit.MILLISECONDS);
        } finally {
            threadPool.shutdownNow();
        }
    }
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>

	<meta charset="utf-8">
	<title>Data My Fucking User</title>

Coba dulu


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

namespace GuildfordBoroughCouncil
{
    /// <summary>
    /// A Base36 De- and Encoder
    /// </summary>
    /// <remarks>
    /// http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/
    /// </remarks>
    public partial class Convert
    {
        private const string Base36CharList = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        //private static char[] Base36CharArray = Base36CharList.ToCharArray();

        /// <summary>
        /// Encode the given number into a Base36 string
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static String ToBase36(long input)
        {
            if (input < 0) throw new ArgumentOutOfRangeException("input", input, "input cannot be negative");

            char[] clistarr = Base36CharList.ToCharArray();
            var result = new Stack<char>();
            while (input != 0)
            {
                result.Push(clistarr[input % 36]);
                input /= 36;
            }
            return new string(result.ToArray());
        }

        /// <summary>
        /// Decode the Base36 Encoded string into a number
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static Int64 FromBase36(string input)
        {
            var reversed = input.ToUpper().Reverse();
            long result = 0;
            int pos = 0;
            foreach (char c in reversed)
            {
                result += Base36CharList.IndexOf(c) * (long)Math.Pow(36, pos);
                pos++;
            }
            return result;
        }
    }
}


text:
namespace ck {

// Number of GEMMs: YTilda * XTilda
// GemmM = C
// GemmN = N * HTildaSlice * WTildaSlice
// GemmK = K * YDotSlice * XDotSlice
template <index_t GridSize,
          index_t BlockSize,
          typename Float,
          typename AccFloat,
          typename InGlobalDesc,
          typename WeiGlobalDesc,
          typename OutGlobalDesc,
          typename ConvStrides,
          typename ConvDilations,
          typename InLeftPads,
          typename InRightPads,
          index_t GemmMPerBlock,
          index_t GemmNPerBlock,
          index_t GemmKPerBlock,
          index_t GemmMPerThread,
          index_t GemmNPerThread,
          index_t GemmKPerThread,
          index_t GemmMLevel0Cluster,
          index_t GemmNLevel0Cluster,
          index_t GemmMLevel1Cluster,
          index_t GemmNLevel1Cluster,
          index_t ThreadGemmDataPerRead_GemmM,
          index_t ThreadGemmDataPerRead_GemmN,
          typename GemmABlockCopyThreadSliceLengths_GemmK_GemmM,
          typename GemmABlockCopyThreadClusterLengths_GemmK_GemmM,
          index_t GemmABlockCopySrcDataPerRead_GemmM,
          index_t GemmABlockCopyDstDataPerWrite_GemmM,
          typename GemmBBlockCopyThreadSliceLengths_GemmK_GemmN,
          typename GemmBBlockCopyThreadClusterLengths_GemmK_GemmN,
          index_t GemmBBlockCopySrcDataPerRead_GemmN,
          index_t GemmBBlockCopyDstDataPerWrite_GemmN,
          index_t GemmCThreadCopyDstDataPerWrite_GemmN1>
struct GridwiseConvolutionBackwardDataImplicitGemm_v4r1_ncdhw_kczyx_nkdhw
{
    __host__ __device__ static constexpr index_t GetNumberOfGemm()
    {
        constexpr index_t ConvStrideD = ConvStrides{}[0];
        constexpr index_t ConvStrideH = ConvStrides{}[1];
        constexpr index_t ConvStrideW = ConvStrides{}[2];

        constexpr index_t ConvDilationD = ConvDilations{}[0];
        constexpr index_t ConvDilationH = ConvDilations{}[1];
        constexpr index_t ConvDilationW = ConvDilations{}[2];

        constexpr index_t GcdStrideDilationD = math::gcd(ConvStrideD, ConvDilationD);
        constexpr index_t GcdStrideDilationH = math::gcd(ConvStrideH, ConvDilationH);
        constexpr index_t GcdStrideDilationW = math::gcd(ConvStrideW, ConvDilationW);

        constexpr index_t ZTilda = ConvStrideD / GcdStrideDilationD;
        constexpr index_t YTilda = ConvStrideH / GcdStrideDilationH;
        constexpr index_t XTilda = ConvStrideW / GcdStrideDilationW;

        return ZTilda * YTilda * XTilda;
    }

    __host__ __device__ static constexpr auto
    GetGemmSizeImpl(index_t iZTilda, index_t iYTilda, index_t iXTilda)
    {
        constexpr index_t N  = InGlobalDesc::GetLengths()[0];
        constexpr index_t C  = InGlobalDesc::GetLengths()[1];
        constexpr index_t Di = InGlobalDesc::GetLengths()[2];
        constexpr index_t Hi = InGlobalDesc::GetLengths()[3];
        constexpr index_t Wi = InGlobalDesc::GetLengths()[4];

        constexpr index_t K  = OutGlobalDesc::GetLengths()[1];
        constexpr index_t Do = OutGlobalDesc::GetLengths()[2];
        constexpr index_t Ho = OutGlobalDesc::GetLengths()[3];
        constexpr index_t Wo = OutGlobalDesc::GetLengths()[4];

        constexpr index_t Z = WeiGlobalDesc::GetLengths()[2];
        constexpr index_t Y = WeiGlobalDesc::GetLengths()[3];
        constexpr index_t X = WeiGlobalDesc::GetLengths()[4];

        constexpr index_t ConvStrideD = ConvStrides{}[0];
        constexpr index_t ConvStrideH = ConvStrides{}[1];
        constexpr index_t ConvStrideW = ConvStrides{}[2];

        constexpr index_t ConvDilationD = ConvDilations{}[0];
        constexpr index_t ConvDilationH = ConvDilations{}[1];
        constexpr index_t ConvDilationW = ConvDilations{}[2];

        constexpr index_t GcdStrideDilationD = math::gcd(ConvStrideD, ConvDilationD);
        constexpr index_t GcdStrideDilationH = math::gcd(ConvStrideH, ConvDilationH);
        constexpr index_t GcdStrideDilationW = math::gcd(ConvStrideW, ConvDilationW);

        constexpr index_t ZTilda = ConvStrideD / GcdStrideDilationD;
        constexpr index_t YTilda = ConvStrideH / GcdStrideDilationH;
        constexpr index_t XTilda = ConvStrideW / GcdStrideDilationW;

        constexpr index_t ZDot = math::integer_divide_ceil(Z, ZTilda);
        constexpr index_t YDot = math::integer_divide_ceil(Y, YTilda);
        constexpr index_t XDot = math::integer_divide_ceil(X, XTilda);

        constexpr index_t DTilda =
            Do + math::integer_divide_ceil(ConvDilationD * (Z - 1), ConvStrideD);
        constexpr index_t HTilda =
            Ho + math::integer_divide_ceil(ConvDilationH * (Y - 1), ConvStrideH);
        constexpr index_t WTilda =
            Wo + math::integer_divide_ceil(ConvDilationW * (X - 1), ConvStrideW);

        // only work on HTilda and WTilda that contribute to non-padding area of input tensor
        constexpr index_t iDTildaLeft = math::integer_divide_floor(
            math::max(0, InLeftPads{}[0] - ConvDilationD * (ZTilda - 1)), ConvStrides{}[0]);
        constexpr index_t iHTildaLeft = math::integer_divide_floor(
            math::max(0, InLeftPads{}[1] - ConvDilationH * (YTilda - 1)), ConvStrides{}[1]);
        constexpr index_t iWTildaLeft = math::integer_divide_floor(
            math::max(0, InLeftPads{}[2] - ConvDilationW * (XTilda - 1)), ConvStrides{}[2]);

        constexpr index_t iDTildaRight = math::min(
            DTilda, math::integer_divide_ceil(InLeftPads{}[0] + Di - 1, ConvStrides{}[0]) + 1);
        constexpr index_t iHTildaRight = math::min(
            HTilda, math::integer_divide_ceil(InLeftPads{}[1] + Hi - 1, ConvStrides{}[1]) + 1);
        constexpr index_t iWTildaRight = math::min(
            WTilda, math::integer_divide_ceil(InLeftPads{}[2] + Wi - 1, ConvStrides{}[2]) + 1);

        constexpr index_t DTildaSlice = iDTildaRight - iDTildaLeft;
        constexpr index_t HTildaSlice = iHTildaRight - iHTildaLeft;
        constexpr index_t WTildaSlice = iWTildaRight - iWTildaLeft;

        // GemmM and GemmN
        constexpr index_t GemmM = C;
        constexpr index_t GemmN = N * DTildaSlice * HTildaSlice * WTildaSlice;

        // GemmK is different for each GEMM
        index_t ZDotSlice = (iZTilda + 1) * ZDot <= Z ? ZDot : Z % ZDot;
        index_t YDotSlice = (iYTilda + 1) * YDot <= Y ? YDot : Y % YDot;
        index_t XDotSlice = (iXTilda + 1) * XDot <= X ? XDot : X % XDot;

        index_t GemmK = K * ZDotSlice * YDotSlice * XDotSlice;

        return Array<index_t, 3>{GemmM, GemmN, GemmK};
    }

    // care ,i don't know how to modify
    __host__ __device__ static constexpr auto GetGemmSize(index_t gemm_id)
    {

        constexpr index_t ConvStrideW = ConvStrides{}[2];

        constexpr index_t ConvDilationW = ConvDilations{}[2];

        constexpr index_t GcdStrideDilationW = math::gcd(ConvStrideW, ConvDilationW);

        constexpr index_t XTilda = ConvStrideW / GcdStrideDilationW;

        constexpr index_t ConvStrideH        = ConvStrides{}[1];
        constexpr index_t ConvDilationH      = ConvDilations{}[1];
        constexpr index_t GcdStrideDilationH = math::gcd(ConvStrideH, ConvDilationH);
        constexpr index_t YTilda             = ConvStrideH / GcdStrideDilationH;

        index_t iZTilda = gemm_id / (XTilda * YTilda);
        index_t iYTilda = (gemm_id % (XTilda * YTilda)) / XTilda;
        index_t iXTilda = (gemm_id % (XTilda * YTilda)) % XTilda;

        return GetGemmSizeImpl(iZTilda, iYTilda, iXTilda);
    }

    template <index_t iZTilda, index_t iYTilda, index_t iXTilda>
    __device__ static void RunImpl(Float* __restrict__ p_in_global,
                                   const Float* __restrict__ p_wei_global,
                                   const Float* __restrict__ p_out_global)
    {
        constexpr auto in_n_c_di_hi_wi_global_desc  = InGlobalDesc{};
        constexpr auto wei_k_c_z_y_x_global_desc    = WeiGlobalDesc{};
        constexpr auto out_n_k_do_ho_wo_global_desc = OutGlobalDesc{};

        constexpr index_t N  = in_n_c_di_hi_wi_global_desc.GetLengths()[0];
        constexpr index_t C  = in_n_c_di_hi_wi_global_desc.GetLengths()[1];
        constexpr index_t Di = in_n_c_di_hi_wi_global_desc.GetLengths()[2];
        constexpr index_t Hi = in_n_c_di_hi_wi_global_desc.GetLengths()[3];
        constexpr index_t Wi = in_n_c_di_hi_wi_global_desc.GetLengths()[4];

        constexpr index_t K  = out_n_k_do_ho_wo_global_desc.GetLengths()[1];
        constexpr index_t Do = out_n_k_do_ho_wo_global_desc.GetLengths()[2];
        constexpr index_t Ho = out_n_k_do_ho_wo_global_desc.GetLengths()[3];
        constexpr index_t Wo = out_n_k_do_ho_wo_global_desc.GetLengths()[4];

        constexpr index_t Z = wei_k_c_z_y_x_global_desc.GetLengths()[2];
        constexpr index_t Y = wei_k_c_z_y_x_global_desc.GetLengths()[3];
        constexpr index_t X = wei_k_c_z_y_x_global_desc.GetLengths()[4];

        constexpr index_t ConvStrideD = ConvStrides{}[0];
        constexpr index_t ConvStrideH = ConvStrides{}[1];
        constexpr index_t ConvStrideW = ConvStrides{}[2];

        constexpr index_t ConvDilationD = ConvDilations{}[0];
        constexpr index_t ConvDilationH = ConvDilations{}[1];
        constexpr index_t ConvDilationW = ConvDilations{}[2];

        //\todo static_assert for global vector load/store
        // statc_assert();

        constexpr index_t GcdStrideDilationD = math::gcd(ConvStrideD, ConvDilationD);
        constexpr index_t GcdStrideDilationH = math::gcd(ConvStrideH, ConvDilationH);
        constexpr index_t GcdStrideDilationW = math::gcd(ConvStrideW, ConvDilationW);

        constexpr index_t ZTilda = ConvStrideD / GcdStrideDilationD;
        constexpr index_t YTilda = ConvStrideH / GcdStrideDilationH;
        constexpr index_t XTilda = ConvStrideW / GcdStrideDilationW;

        constexpr index_t ZDot = math::integer_divide_ceil(Z, ZTilda);
        constexpr index_t YDot = math::integer_divide_ceil(Y, YTilda);
        constexpr index_t XDot = math::integer_divide_ceil(X, XTilda);

        constexpr index_t DTilda =
            Do + math::integer_divide_ceil(ConvDilationD * (Z - 1), ConvStrideD);
        constexpr index_t HTilda =
            Ho + math::integer_divide_ceil(ConvDilationH * (Y - 1), ConvStrideH);
        constexpr index_t WTilda =
            Wo + math::integer_divide_ceil(ConvDilationW * (X - 1), ConvStrideW);

        // only work on HTilda and WTilda that contribute to non-padding area of input tensor
        constexpr index_t iDTildaLeft = math::integer_divide_floor(
            math::max(0, InLeftPads{}[0] - ConvDilationD * (ZTilda - 1)), ConvStrides{}[0]);
        constexpr index_t iHTildaLeft = math::integer_divide_floor(
            math::max(0, InLeftPads{}[1] - ConvDilationH * (YTilda - 1)), ConvStrides{}[1]);
        constexpr index_t iWTildaLeft = math::integer_divide_floor(
            math::max(0, InLeftPads{}[2] - ConvDilationW * (XTilda - 1)), ConvStrides{}[2]);

        constexpr index_t iDTildaRight = math::min(
            DTilda, math::integer_divide_ceil(InLeftPads{}[0] + Di - 1, ConvStrides{}[0]) + 1);
        constexpr index_t iHTildaRight = math::min(
            HTilda, math::integer_divide_ceil(InLeftPads{}[1] + Hi - 1, ConvStrides{}[1]) + 1);
        constexpr index_t iWTildaRight = math::min(
            WTilda, math::integer_divide_ceil(InLeftPads{}[2] + Wi - 1, ConvStrides{}[2]) + 1);

        constexpr index_t DTildaSlice = iDTildaRight - iDTildaLeft;
        constexpr index_t HTildaSlice = iHTildaRight - iHTildaLeft;
        constexpr index_t WTildaSlice = iWTildaRight - iWTildaLeft;

        // weight out-of-bound check can be skipped
        constexpr bool wei_skip_out_of_bound_check = true;

        // weight tensor
        constexpr auto wei_k_c_zdot_ztilda_ydot_ytilda_xdot_xtilda_global_desc =
            transform_tensor_descriptor(
                wei_k_c_z_y_x_global_desc,
                make_tuple(PassThrough<K>{},
                           PassThrough<C>{},
                           Embed<Z,
                                 Sequence<ZDot, ZTilda>,
                                 Sequence<ConvStrideD / GcdStrideDilationD, 1, 0>,
                                 wei_skip_out_of_bound_check>{},
                           Embed<Y,
                                 Sequence<YDot, YTilda>,
                                 Sequence<ConvStrideH / GcdStrideDilationH, 1, 0>,
                                 wei_skip_out_of_bound_check>{},
                           Embed<X,
                                 Sequence<XDot, XTilda>,
                                 Sequence<ConvStrideW / GcdStrideDilationW, 1, 0>,
                                 wei_skip_out_of_bound_check>{}),
                make_tuple(
                    Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}, Sequence<4>{}),
                make_tuple(Sequence<0>{},
                           Sequence<1>{},
                           Sequence<2, 3>{},
                           Sequence<4, 5>{},
                           Sequence<6, 7>{}));

#if !CK_EXPERIMENTAL_IMPLICIT_GEMM_BACKWARD_DATA_V4R1_OUTPUT_SKIP_OUT_OF_BOUND_CHECK
        constexpr bool out_skip_out_of_bound_check = false;
#else
        //\todo sometimes output tensor out-of-bound check can be skipped, find out all such
        // situations
        constexpr bool out_skip_out_of_bound_check = true;
#endif

        // output tensor
        constexpr auto out_n_k_zdot_dtilda_ydot_htilda_xdot_wtilda_global_desc =
            transform_tensor_descriptor(
                out_n_k_do_ho_wo_global_desc,
                make_tuple(PassThrough<N>{},
                           PassThrough<K>{},
                           Embed<Do,
                                 Sequence<ZDot, DTilda>,
                                 Sequence<-ConvDilationD / GcdStrideDilationD, 1, 0>,
                                 out_skip_out_of_bound_check>{},
                           Embed<Ho,
                                 Sequence<YDot, HTilda>,
                                 Sequence<-ConvDilationH / GcdStrideDilationH, 1, 0>,
                                 out_skip_out_of_bound_check>{},
                           Embed<Wo,
                                 Sequence<XDot, WTilda>,
                                 Sequence<-ConvDilationW / GcdStrideDilationW, 1, 0>,
                                 out_skip_out_of_bound_check>{}),
                make_tuple(
                    Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}, Sequence<4>{}),
                make_tuple(Sequence<0>{},
                           Sequence<1>{},
                           Sequence<2, 3>{},
                           Sequence<4, 5>{},
                           Sequence<6, 7>{}));

        constexpr auto out_n_k_zdot_dtildaslice_ydot_htildaslice_xdot_wtildaslice_global_desc =
            transform_tensor_descriptor(
                out_n_k_zdot_dtilda_ydot_htilda_xdot_wtilda_global_desc,
                make_tuple(PassThrough<N>{},
                           PassThrough<K>{},
                           PassThrough<ZTilda>{},
                           PassThrough<YTilda>{},
                           PassThrough<XTilda>{},
                           Slice<Sequence<DTilda, HTilda, WTilda>,
                                 Sequence<iDTildaLeft, iHTildaLeft, iWTildaLeft>,
                                 Sequence<iDTildaRight, iHTildaRight, iWTildaRight>>{}),
                make_tuple(Sequence<0>{},
                           Sequence<1>{},
                           Sequence<2>{},
                           Sequence<4>{},
                           Sequence<6>{},
                           Sequence<3, 5, 7>{}),
                make_tuple(Sequence<0>{},
                           Sequence<1>{},
                           Sequence<2>{},
                           Sequence<4>{},
                           Sequence<6>{},
                           Sequence<3, 5, 7>{}));

#if !CK_EXPERIMENTAL_IMPLICIT_GEMM_BACKWARD_DATA_V4R1_INPUT_SKIP_OUT_OF_BOUND_CHECK
        constexpr bool in_skip_out_of_bound_check = false;
#else
        //\todo sometimes input out-of-bound check can be skipped, find out all such situations
        constexpr bool in_skip_out_of_bound_check = true;
#endif

        // input tensor
        constexpr auto in_n_c_dip_hip_wip_global_desc = transform_tensor_descriptor(
            in_n_c_di_hi_wi_global_desc,
            make_tuple(
                PassThrough<N>{},
                PassThrough<C>{},
                Pad<Sequence<Di, Hi, Wi>, InLeftPads, InRightPads, in_skip_out_of_bound_check>{}),
            make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2, 3, 4>{}),
            make_tuple(Sequence<0>{}, Sequence<1>{}, Sequence<2, 3, 4>{}));

        constexpr index_t Dip = in_n_c_dip_hip_wip_global_desc.GetLengths()[2];
        constexpr index_t Hip = in_n_c_dip_hip_wip_global_desc.GetLengths()[3];
        constexpr index_t Wip = in_n_c_dip_hip_wip_global_desc.GetLengths()[4];

        constexpr auto in_n_c_ztilda_dtilda_ytilda_htilda_xtilda_wtilda_global_desc =
            transform_tensor_descriptor(
                in_n_c_dip_hip_wip_global_desc,
                make_tuple(PassThrough<N>{},
                           PassThrough<C>{},
                           Embed<Dip,
                                 Sequence<ZTilda, DTilda>,
                                 Sequence<ConvDilationD, ConvStrideD, 0>,
                                 in_skip_out_of_bound_check>{},
                           Embed<Hip,
                                 Sequence<YTilda, HTilda>,
                                 Sequence<ConvDilationH, ConvStrideH, 0>,
                                 in_skip_out_of_bound_check>{},
                           Embed<Wip,
                                 Sequence<XTilda, WTilda>,
                                 Sequence<ConvDilationW, ConvStrideW, 0>,
                                 in_skip_out_of_bound_check>{}),
                make_tuple(
                    Sequence<0>{}, Sequence<1>{}, Sequence<2>{}, Sequence<3>{}, Sequence<4>{}),
                make_tuple(Sequence<0>{},
                           Sequence<1>{},
                           Sequence<2, 3>{},
                           Sequence<4, 5>{},
                           Sequence<6, 7>{}));

        constexpr auto in_n_c_ztilda_dtildaslice_ytilda_htildaslice_xtilda_wtildaslice_global_desc =
            transform_tensor_descriptor(
                in_n_c_ztilda_dtilda_ytilda_htilda_xtilda_wtilda_global_desc,
                make_tuple(PassThrough<N>{},
                           PassThrough<C>{},
                           PassThrough<ZTilda>{},
                           PassThrough<YTilda>{},
                           PassThrough<XTilda>{},
                           Slice<Sequence<DTilda, HTilda, WTilda>,
                                 Sequence<iDTildaLeft, iHTildaLeft, iWTildaLeft>,
                                 Sequence<iDTildaRight, iHTildaRight, iWTildaRight>>{}),
                make_tuple(Sequence<0>{},
                           Sequence<1>{},
                           Sequence<2>{},
                           Sequence<4>{},
                           Sequence<6>{},
                           Sequence<3, 5, 7>{}),
                make_tuple(Sequence<0>{},
                           Sequence<1>{},
                           Sequence<2>{},
                           Sequence<4>{},
                           Sequence<6>{},
                           Sequence<3, 5, 7>{}));

        // GEMM
        constexpr index_t ZDotSlice = (iZTilda + 1) * ZDot <= Z ? ZDot : Z % ZDot;
        constexpr index_t YDotSlice = (iYTilda + 1) * YDot <= Y ? YDot : Y % YDot;
        constexpr index_t XDotSlice = (iXTilda + 1) * XDot <= X ? XDot : X % XDot;

        // A matrix
        constexpr auto
            wei_k_c_zdotslice_ztidaslice_ydotslice_ytidaslice_xdotslice_xtildaslice_global_desc =
                transform_tensor_descriptor(
                    wei_k_c_zdot_ztilda_ydot_ytilda_xdot_xtilda_global_desc,
                    make_tuple(PassThrough<K>{},
                               PassThrough<C>{},
                               Slice<Sequence<ZDot, YDot, XDot>,
                                     Sequence<0, 0, 0>,
                                     Sequence<ZDotSlice, YDotSlice, XDotSlice>>{},
                               Slice<Sequence<ZTilda, YTilda, XTilda>,
                                     Sequence<iZTilda, iYTilda, iXTilda>,
                                     Sequence<iZTilda + 1, iYTilda + 1, iXTilda + 1>>{}),
                    make_tuple(
                        Sequence<0>{}, Sequence<1>{}, Sequence<2, 4, 6>{}, Sequence<3, 5, 7>{}),
                    make_tuple(
                        Sequence<0>{}, Sequence<1>{}, Sequence<2, 4, 6>{}, Sequence<3, 5, 7>{}));

        constexpr auto wei_gemmk_gemmm_global_desc = transform_tensor_descriptor(
            wei_k_c_zdotslice_ztidaslice_ydotslice_ytidaslice_xdotslice_xtildaslice_global_desc,
            make_tuple(Merge<Sequence<K, ZDotSlice, YDotSlice, XDotSlice>>{},
                       Merge<Sequence<C, 1, 1, 1>>{}),
            make_tuple(Sequence<0, 2, 4, 6>{}, Sequence<1, 3, 5, 7>{}),
            make_tuple(Sequence<0>{}, Sequence<1>{}));

        // B matrix
        constexpr auto
            out_n_k_zdotslice_dtildaslice_ydotslice_htildaslice_xdotslice_wtildaslice_global_desc =
                transform_tensor_descriptor(
                    out_n_k_zdot_dtildaslice_ydot_htildaslice_xdot_wtildaslice_global_desc,
                    make_tuple(PassThrough<N>{},
                               PassThrough<K>{},
                               PassThrough<DTildaSlice>{},
                               PassThrough<HTildaSlice>{},
                               PassThrough<WTildaSlice>{},
                               Slice<Sequence<ZDot, YDot, XDot>,
                                     Sequence<0, 0, 0>,
                                     Sequence<ZDotSlice, YDotSlice, XDotSlice>>{}),
                    make_tuple(Sequence<0>{},
                               Sequence<1>{},
                               Sequence<3>{},
                               Sequence<5>{},
                               Sequence<7>{},
                               Sequence<2, 4, 6>{}),
                    make_tuple(Sequence<0>{},
                               Sequence<1>{},
                               Sequence<3>{},
                               Sequence<5>{},
                               Sequence<7>{},
                               Sequence<2, 4, 6>{}));

        constexpr auto out_gemmk_gemmn_global_desc = transform_tensor_descriptor(
            out_n_k_zdotslice_dtildaslice_ydotslice_htildaslice_xdotslice_wtildaslice_global_desc,
            make_tuple(Merge<Sequence<K, ZDotSlice, YDotSlice, XDotSlice>>{},
                       Merge<Sequence<N, DTildaSlice, HTildaSlice, WTildaSlice>>{}),
            make_tuple(Sequence<1, 2, 4, 6>{}, Sequence<0, 3, 5, 7>{}),
            make_tuple(Sequence<0>{}, Sequence<1>{}));

        // C matrix
        constexpr auto
            in_n_c_ztildaslice_dtildaslice_ytildaslice_htildaslice_xtildaslice_wtildaslice_global_desc =
                transform_tensor_descriptor(
                    in_n_c_ztilda_dtildaslice_ytilda_htildaslice_xtilda_wtildaslice_global_desc,
                    make_tuple(PassThrough<N>{},
                               PassThrough<C>{},
                               PassThrough<DTildaSlice>{},
                               PassThrough<HTildaSlice>{},
                               PassThrough<WTildaSlice>{},
                               Slice<Sequence<ZTilda, YTilda, XTilda>,
                                     Sequence<iZTilda, iYTilda, iXTilda>,
                                     Sequence<iZTilda + 1, iYTilda + 1, iXTilda + 1>>{}),
                    make_tuple(Sequence<0>{},
                               Sequence<1>{},
                               Sequence<3>{},
                               Sequence<5>{},
                               Sequence<7>{},
                               Sequence<2, 4, 6>{}),
                    make_tuple(Sequence<0>{},
                               Sequence<1>{},
                               Sequence<3>{},
                               Sequence<5>{},
                               Sequence<7>{},
                               Sequence<2, 4, 6>{}));

        constexpr auto in_gemmm_gemmn_global_desc = transform_tensor_descriptor(
            in_n_c_ztildaslice_dtildaslice_ytildaslice_htildaslice_xtildaslice_wtildaslice_global_desc,
            make_tuple(Merge<Sequence<C, 1, 1, 1>>{},
                       Merge<Sequence<N, DTildaSlice, HTildaSlice, WTildaSlice>>{}),
            make_tuple(Sequence<1, 2, 4, 6>{}, Sequence<0, 3, 5, 7>{}),
            make_tuple(Sequence<0>{}, Sequence<1>{}));

        constexpr auto gridwise_gemm =
            GridwiseGemmTransposedANormalBNormalC_v1<GridSize,
                                                     BlockSize,
                                                     Float,
                                                     AccFloat,
                                                     decltype(wei_gemmk_gemmm_global_desc),
                                                     decltype(out_gemmk_gemmn_global_desc),
                                                     decltype(in_gemmm_gemmn_global_desc),
                                                     InMemoryDataOperation::Set,
                                                     GemmMPerBlock,
                                                     GemmNPerBlock,
                                                     GemmKPerBlock,
                                                     GemmMPerThread,
                                                     GemmNPerThread,
                                                     GemmKPerThread,
                                                     GemmMLevel0Cluster,
                                                     GemmNLevel0Cluster,
                                                     GemmMLevel1Cluster,
                                                     GemmNLevel1Cluster,
                                                     ThreadGemmDataPerRead_GemmM,
                                                     ThreadGemmDataPerRead_GemmN,
                                                     GemmABlockCopyThreadSliceLengths_GemmK_GemmM,
                                                     GemmABlockCopyThreadClusterLengths_GemmK_GemmM,
                                                     Sequence<0, 1>,
                                                     Sequence<0, 1>,
                                                     1,
                                                     GemmABlockCopySrcDataPerRead_GemmM,
                                                     GemmABlockCopyDstDataPerWrite_GemmM,
                                                     GemmBBlockCopyThreadSliceLengths_GemmK_GemmN,
                                                     GemmBBlockCopyThreadClusterLengths_GemmK_GemmN,
                                                     Sequence<0, 1>,
                                                     Sequence<0, 1>,
                                                     1,
                                                     GemmBBlockCopySrcDataPerRead_GemmN,
                                                     GemmBBlockCopyDstDataPerWrite_GemmN,
                                                     Sequence<0, 1, 2, 3>,
                                                     3,
                                                     GemmCThreadCopyDstDataPerWrite_GemmN1>{};

        gridwise_gemm.Run(p_wei_global, p_out_global, p_in_global);
    }

    template <index_t GemmId>
    __device__ static void Run(Float* __restrict__ p_in_global,
                               const Float* __restrict__ p_wei_global,
                               const Float* __restrict__ p_out_global)
    {
        constexpr index_t ConvStrideD = ConvStrides{}[0];
        constexpr index_t ConvStrideH = ConvStrides{}[1];
        constexpr index_t ConvStrideW = ConvStrides{}[2];

        constexpr index_t ConvDilationD = ConvDilations{}[0];
        constexpr index_t ConvDilationH = ConvDilations{}[1];
        constexpr index_t ConvDilationW = ConvDilations{}[2];

        constexpr index_t GcdStrideDilationD = math::gcd(ConvStrideD, ConvDilationD);
        constexpr index_t GcdStrideDilationH = math::gcd(ConvStrideH, ConvDilationH);
        constexpr index_t GcdStrideDilationW = math::gcd(ConvStrideW, ConvDilationW);

        constexpr index_t ZTilda = ConvStrideD / GcdStrideDilationD;
        constexpr index_t YTilda = ConvStrideH / GcdStrideDilationH;
        constexpr index_t XTilda = ConvStrideW / GcdStrideDilationW;

        constexpr index_t iZTilda = GemmId / (XTilda * YTilda);
        constexpr index_t iYTilda = (GemmId % (XTilda * YTilda)) / XTilda;
        constexpr index_t iXTilda = (GemmId % (XTilda * YTilda)) % XTilda;

        static_assert(iZTilda < ZTilda && iYTilda < YTilda && iXTilda < XTilda,
                      "wrong! iYtilda, iXtilda");

        RunImpl<iZTilda, iYTilda, iXTilda>(p_in_global, p_wei_global, p_out_global);
    }
};

} // namespace ck
#endif


text:
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ElementRef, Input, Output, ContentChild, ContentChildren, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Footer, PrimeTemplate, SharedModule } from 'primeng/api';
import { RippleModule } from 'primeng/ripple';
import { trigger, state, style, transition, animate } from '@angular/animations';

let idx = 0;
class Panel {
    constructor(el) {
        this.el = el;
        this.collapsed = false;
        this.expandIcon = 'pi pi-plus';
        this.collapseIcon = 'pi pi-minus';
        this.showHeader = true;
        this.toggler = "icon";
        this.collapsedChange = new EventEmitter();
        this.onBeforeToggle = new EventEmitter();
        this.onAfterToggle = new EventEmitter();
        this.transitionOptions = '400ms cubic-bezier(0.86, 0, 0.07, 1)';
        this.id = `p-panel-${idx++}`;
    }
    ngAfterContentInit() {
        this.templates.forEach((item) => {
            switch (item.getType()) {
                case 'header':
                    this.headerTemplate = item.template;
                    break;
                case 'content':
                    this.contentTemplate = item.template;
                    break;
                case 'footer':
                    this.footerTemplate = item.template;
                    break;
                case 'icons':
                    this.iconTemplate = item.template;
                    break;
                default:
                    this.contentTemplate = item.template;
                    break;
            }
        });
    }
    onHeaderClick(event) {
        if (this.toggler === 'header') {
            this.toggle(event);
        }
    }
    onIconClick(event) {
        if (this.toggler === 'icon') {
            this.toggle(event);
        }
    }
    toggle(event) {
        if (this.animating) {
            return false;
        }
        this.animating = true;
        this.onBeforeToggle.emit({ originalEvent: event, collapsed: this.collapsed });
        if (this.toggleable) {
            if (this.collapsed)
                this.expand(event);
            else
                this.collapse(event);
        }
        event.preventDefault();
    }
    expand(event) {
        this.collapsed = false;
        this.collapsedChange.emit(this.collapsed);
    }
    collapse(event) {
        this.collapsed = true;
        this.collapsedChange.emit(this.collapsed);
    }
    getBlockableElement() {
        return this.el.nativeElement.children[0];
    }
    onToggleDone(event) {
        this.animating = false;
        this.onAfterToggle.emit({ originalEvent: event, collapsed: this.collapsed });
    }
}
Panel.decorators = [
    { type: Component, args: [{
                selector: 'p-panel',
                template: `

                {{header}}
                <ng-content select="p-header"></ng-content>
                <ng-container *ngTemplateOutlet="headerTemplate"></ng-container>

                    <ng-template *ngTemplateOutlet="iconTemplate"></ng-template>
                    <button *ngIf="toggleable" type="button" [attr.id]="id + '-label'" class="p-panel-header-icon p-panel-toggler p-link" pRipple
                        (click)="onIconClick($event)" (keydown.enter)="onIconClick($event)" [attr.aria-controls]="id + '-content'" role="tab" [attr.aria-expanded]="!collapsed">

                    </button>

                    <ng-content></ng-content>
                    <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>

                    <ng-content select="p-footer"></ng-content>
                    <ng-container *ngTemplateOutlet="footerTemplate"></ng-container>

    `,
                animations: [
                    trigger('panelContent', [
                        state('hidden', style({
                            height: '0',
                            overflow: 'hidden'
                        })),
                        state('void', style({
                            height: '{{height}}'
                        }), { params: { height: '0' } }),
                        state('visible', style({
                            height: '*'
                        })),
                        transition('visible <=> hidden', [style({ overflow: 'hidden' }), animate('{{transitionParams}}')]),
                        transition('void => hidden', animate('{{transitionParams}}')),
                        transition('void => visible', animate('{{transitionParams}}'))
                    ])
                ],
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
                styles: [".p-panel-header{align-items:center;display:flex;justify-content:space-between}.p-panel-title{line-height:1}.p-panel-header-icon{align-items:center;cursor:pointer;display:inline-flex;justify-content:center;overflow:hidden;position:relative;text-decoration:none}"]
            },] }
];
Panel.ctorParameters = () => [
    { type: ElementRef }
];
Panel.propDecorators = {
    toggleable: [{ type: Input }],
    header: [{ type: Input }],
    collapsed: [{ type: Input }],
    style: [{ type: Input }],
    styleClass: [{ type: Input }],
    expandIcon: [{ type: Input }],
    collapseIcon: [{ type: Input }],
    showHeader: [{ type: Input }],
    toggler: [{ type: Input }],
    collapsedChange: [{ type: Output }],
    onBeforeToggle: [{ type: Output }],
    onAfterToggle: [{ type: Output }],
    transitionOptions: [{ type: Input }],
    footerFacet: [{ type: ContentChild, args: [Footer,] }],
    templates: [{ type: ContentChildren, args: [PrimeTemplate,] }]
};
class PanelModule {
}
PanelModule.decorators = [
    { type: NgModule, args: [{
                imports: [CommonModule, SharedModule, RippleModule],
                exports: [Panel, SharedModule],
                declarations: [Panel]
            },] }
];

/**
 * Generated bundle index. Do not edit.
 */

export { Panel, PanelModule };
//# sourceMappingURL=primeng-panel.js.map


text:
const argv = require('yargs').argv;
const babel = require('babel-core');
const fs = require('fs');
const path = require('path');

// Define file names
//==================
const input = path.resolve(process.cwd(), argv.i);
const inputMap = `${input}.map`;
const output = path.resolve(process.cwd(), argv.o);
const outputMap = `${output}.map`;

console.info(`MINIFY: ${path.basename(input)}`);

// Read input code and its source map
//===================================
const inputCode = fs.readFileSync(input, { encoding: 'utf8' });
const inputSourceMap = JSON.parse(
  fs.readFileSync(inputMap, { encoding: 'utf8' })
);

// Generate options
//=================
const options = {
  presets: ['babili', !!argv.es5 && ['es2015', { modules: false }], 'stage-2'],
  comments: false,
  minified: true,
  compact: true,
  sourceMaps: true,
  inputSourceMap,
};

options.presets = options.presets.filter(a => !!a);

// Transform code
//===============
const result = babel.transform(inputCode, options);

// Add sourcemap URL to transformed code
const outputCode = `${result.code}\n\n//# sourceMappingURL=${path.basename(outputMap)}`;

// Write output files
//===================
fs.writeFileSync(output, outputCode);
fs.writeFileSync(outputMap, JSON.stringify(result.map));