text:
@class SocketIOClient;

@interface SocketAckEmitter : NSObject

@property (nonatomic, strong) SocketIOClient *socket;
@property (nonatomic, assign) int ackNum;

- (instancetype)initWithAckNum:(SocketIOClient*) socket ackNum:(int)ackNum;

- (void)with:(NSArray*) items;

@end


text:
package net.dv8tion.jda.api.exceptions;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
import net.dv8tion.jda.internal.utils.Checks;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * Indicates that the user is missing a {@link Permission} for some action.
 *
 * @see   net.dv8tion.jda.api.entities.IPermissionHolder#hasPermission(Permission...) IPermissionHolder.hasPermission(Permission...)
 * @see   net.dv8tion.jda.api.entities.IPermissionHolder#hasPermission(GuildChannel, Permission...) IPermissionHolder.hasPermission(GuildChannel, Permission...)
 */
public class InsufficientPermissionException extends PermissionException
{
    private final long guildId;
    private final long channelId;
    private final ChannelType channelType;

    public InsufficientPermissionException(@Nonnull Guild guild, @Nonnull Permission permission)
    {
        this(guild, null, permission);
    }

    public InsufficientPermissionException(@Nonnull Guild guild, @Nonnull Permission permission, @Nonnull String reason)
    {
        this(guild, null, permission, reason);
    }

    public InsufficientPermissionException(@Nonnull GuildChannel channel, @Nonnull Permission permission)
    {
        this(channel.getGuild(), channel, permission);
    }

    public InsufficientPermissionException(@Nonnull GuildChannel channel, @Nonnull Permission permission, @Nonnull String reason)
    {
        this(channel.getGuild(), channel, permission, reason);
    }

    private InsufficientPermissionException(@Nonnull Guild guild, @Nullable GuildChannel channel, @Nonnull Permission permission)
    {
        super(permission, "Cannot perform action due to a lack of Permission. Missing permission: " + permission.toString());
        this.guildId = guild.getIdLong();
        this.channelId = channel == null ? 0 : channel.getIdLong();
        this.channelType = channel == null ? ChannelType.UNKNOWN : channel.getType();
    }

    private InsufficientPermissionException(@Nonnull Guild guild, @Nullable GuildChannel channel, @Nonnull Permission permission, @Nonnull String reason)
    {
        super(permission, reason);
        this.guildId = guild.getIdLong();
        this.channelId = channel == null ? 0 : channel.getIdLong();
        this.channelType = channel == null ? ChannelType.UNKNOWN : channel.getType();
    }

    /**
     * The id for the responsible {@link net.dv8tion.jda.api.entities.Guild} instance.
     *
     * @return The ID as a long
     *
     * @since  4.0.0
     *
     * @see    net.dv8tion.jda.api.JDA#getGuildById(long)
     */
    public long getGuildId()
    {
        return guildId;
    }

    /**
     * The id for the responsible {@link GuildChannel} instance.
     *
     * @return The ID as a long or 0
     *
     * @since  4.0.0
     *
     * @see    #getChannel(net.dv8tion.jda.api.JDA)
     */
    public long getChannelId()
    {
        return channelId;
    }

    /**
     * The {@link ChannelType} for the {@link #getChannelId() channel id}.
     *
     * @return The channel type or {@link ChannelType#UNKNOWN}.
     *
     * @since  4.0.0
     */
    @Nonnull
    public ChannelType getChannelType()
    {
        return channelType;
    }

    /**
     * The {@link net.dv8tion.jda.api.entities.Guild} instance for the {@link #getGuildId() guild id}.
     *
     * @param  api
     *         The shard to perform the lookup in
     *
     * @throws java.lang.IllegalArgumentException
     *         If the provided JDA instance is null
     *
     * @since  4.0.0
     *
     * @return The Guild instance or null
     */
    @Nullable
    public Guild getGuild(@Nonnull JDA api)
    {
        Checks.notNull(api, "JDA");
        return api.getGuildById(guildId);
    }

    /**
     * The {@link GuildChannel} instance for the {@link #getChannelId() channel id}.
     *
     * @param  api
     *         The shard to perform the lookup in
     *
     * @throws java.lang.IllegalArgumentException
     *         If the provided JDA instance is null
     *
     * @since  4.0.0
     *
     * @return The GuildChannel instance or null
     */
    @Nullable
    public GuildChannel getChannel(@Nonnull JDA api)
    {
        Checks.notNull(api, "JDA");
        return api.getGuildChannelById(channelType, channelId);
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace wxMSWImpl
{

// various classes to change some DC property temporarily

// text background and foreground colours
class wxTextColoursChanger
{
public:
    wxTextColoursChanger(HDC hdc, const wxMSWDCImpl& dc)
        : m_hdc(hdc)
    {
        Change(dc.GetTextForeground(), dc.GetTextBackground());
    }

    wxTextColoursChanger(HDC hdc, const wxColour& colFg, const wxColour& colBg)
        : m_hdc(hdc)
    {
        Change(colFg, colBg);
    }

    wxTextColoursChanger(HDC hdc, COLORREF colFg, COLORREF colBg)
        : m_hdc(hdc)
    {
        Change(colFg, colBg);
    }

    ~wxTextColoursChanger()
    {
        if ( m_oldColFg != CLR_INVALID )
            ::SetTextColor(m_hdc, m_oldColFg);
        if ( m_oldColBg != CLR_INVALID )
            ::SetBkColor(m_hdc, m_oldColBg);
    }

protected:
    // this ctor doesn't change mode immediately, call Change() later to do it
    // only if needed
    wxTextColoursChanger(HDC hdc)
        : m_hdc(hdc)
    {
        m_oldColFg =
        m_oldColBg = CLR_INVALID;
    }

    void Change(const wxColour& colFg, const wxColour& colBg)
    {
        Change(colFg.IsOk() ? colFg.GetPixel() : CLR_INVALID,
               colBg.IsOk() ? colBg.GetPixel() : CLR_INVALID);
    }

    void Change(COLORREF colFg, COLORREF colBg)
    {
        if ( colFg != CLR_INVALID )
        {
            m_oldColFg = ::SetTextColor(m_hdc, colFg);
            if ( m_oldColFg == CLR_INVALID )
            {
                wxLogLastError(wxT("SetTextColor"));
            }
        }
        else
        {
            m_oldColFg = CLR_INVALID;
        }

        if ( colBg != CLR_INVALID )
        {
            m_oldColBg = ::SetBkColor(m_hdc, colBg);
            if ( m_oldColBg == CLR_INVALID )
            {
                wxLogLastError(wxT("SetBkColor"));
            }
        }
        else
        {
            m_oldColBg = CLR_INVALID;
        }
    }

private:
    const HDC m_hdc;
    COLORREF m_oldColFg,
             m_oldColBg;

    wxDECLARE_NO_COPY_CLASS(wxTextColoursChanger);
};

// background mode
class wxBkModeChanger
{
public:
    // set background mode to opaque if mode != wxBRUSHSTYLE_TRANSPARENT
    wxBkModeChanger(HDC hdc, int mode)
        : m_hdc(hdc)
    {
        Change(mode);
    }

    ~wxBkModeChanger()
    {
        if ( m_oldMode )
            ::SetBkMode(m_hdc, m_oldMode);
    }

protected:
    // this ctor doesn't change mode immediately, call Change() later to do it
    // only if needed
    wxBkModeChanger(HDC hdc) : m_hdc(hdc) { m_oldMode = 0; }

    void Change(int mode)
    {
        m_oldMode = ::SetBkMode(m_hdc, mode == wxBRUSHSTYLE_TRANSPARENT
                                        ? TRANSPARENT
                                        : OPAQUE);
        if ( !m_oldMode )
        {
            wxLogLastError(wxT("SetBkMode"));
        }
    }

private:
    const HDC m_hdc;
    int m_oldMode;

    wxDECLARE_NO_COPY_CLASS(wxBkModeChanger);
};

} // namespace wxMSWImpl

#endif // _MSW_PRIVATE_DC_H_


text:
//Apache2, 2014-present, WinterDev

using System;
using System.Collections.Generic;
using PixelFarm.Drawing;
using LayoutFarm.UI;
namespace LayoutFarm.CustomWidgets
{

    public class TextBoxContainer : AbstractControlBox
    {

        TextBoxSwitcher _textboxSwitcher;
        TextBoxBase _myTextBox;
        bool _isMaskTextBox;
        CustomTextRun _placeHolder;
        CustomTextRun _textBoxPlaceHolder; //this version we use with single line text only

        string _placeHolderText = "";
        bool _isMultiLine;
        bool _isEditable;
        TextEditing.TextSurfaceEventListener _textSurfaceEventListener;
        public event EventHandler<UIKeyEventArgs> KeyDown;
        public event EventHandler<UIKeyEventArgs> KeyUp;
        public TextBoxContainer(int w, int h, bool multiline, bool maskTextBox = false)
            : base(w, h)
        {
            this.BackColor = Color.White;
            _isMultiLine = multiline;
            _isMaskTextBox = maskTextBox;
            _isEditable = true;

            //NOTE: this version, maskTextBox=> not support multiline
        }
        protected override void OnKeyDown(UIKeyEventArgs e) => KeyDown?.Invoke(this, e);
        protected override void OnKeyUp(UIKeyEventArgs e) => KeyUp?.Invoke(this, e);

        public bool IsMultilineTextBox => _isMultiLine;
        public bool IsEditable
        {
            get => _isEditable;
            set
            {
                _isEditable = value;
            }
        }
        public string PlaceHolderText
        {
            get => _placeHolderText;
            set
            {
                _placeHolderText = value;
                if (_placeHolder != null)
                {
                    _placeHolder.Text = _placeHolderText;
                    this.InvalidateGraphics();
                }
            }
        }
        protected override void OnMouseDown(UIMouseDownEventArgs e)
        {
            base.OnMouseDown(e);
            //when mousedown on control
            //then do focus()
            //evaluate before Focus()
            bool needTextBoxSwitching = _textboxSwitcher != null && _myTextBox == null;

            Focus();

            if (needTextBoxSwitching)
            {
                ((IEventListener)_myTextBox).ListenMouseDown(e);
            }

        }
        public override RenderElement GetPrimaryRenderElement()
        {
            if (!this.HasReadyRenderElement)
            {
                //first time

                RenderElement renderE = base.GetPrimaryRenderElement();
                if (renderE is IContainerRenderElement baseRenderElement)
                {
                    //1. add place holder first
                    _placeHolder = new CustomTextRun(this.Width - 4, this.Height - 4);
                    _placeHolder.Text = _placeHolderText;
                    _placeHolder.SetLocation(1, 1);
                    _placeHolder.TextColor = Color.FromArgb(180, KnownColors.LightGray);
                    baseRenderElement.AddChild(_placeHolder);

                    _textSurfaceEventListener = new TextEditing.TextSurfaceEventListener();
                    _textSurfaceEventListener.KeyDown += textEvListener_KeyDown;

                    TextBoxSwitcher textboxSwitcher = this.TextBoxSwitcher;
                    if (textboxSwitcher != null)
                    {
                        //has textbox switcher
                        //use special 'light-weight' textbox
                        _textBoxPlaceHolder = new CustomTextRun(this.Width - 4, this.Height - 4);
                        baseRenderElement.AddChild(_textBoxPlaceHolder);

                        if (_userText != null)
                        {
                            _textBoxPlaceHolder.Text = _userText;
                            _userText = null;
                        }
                    }
                    else
                    {
                        //no switcher
                        //so use actual text box or mask textbox
                        //2. textbox
                        _myTextBox = _isMaskTextBox ?
                                        (TextBoxBase)(new MaskTextBox(this.Width - 4, this.Height - 4)) :
                                        new TextBox(this.Width - 4, this.Height - 4, _isMultiLine);
                        _myTextBox.BackgroundColor = Color.Transparent;
                        _myTextBox.TextEventListener = _textSurfaceEventListener;
                        baseRenderElement.AddChild(_myTextBox);

                        if (_userText != null)
                        {
                            _myTextBox.Text = _userText;
                            _userText = null;
                        }
                    }
                }
                return renderE;
            }
            else
            {
                return base.GetPrimaryRenderElement();
            }
        }
        void textEvListener_KeyDown(object sender, TextEditing.TextDomEventArgs e)
        {

            if (!string.IsNullOrEmpty(_placeHolderText))
            {
                bool hasSomeText = _myTextBox.HasSomeText;

                if (hasSomeText)
                {
                    //hide place holder
                    if (_placeHolder.Visible)
                    {
                        _placeHolder.SetVisible(false);
                        _placeHolder.InvalidateGraphics();
                    }
                }
                else
                {
                    //show place holder
                    if (!_placeHolder.Visible)
                    {
                        _placeHolder.SetVisible(true);
                        _placeHolder.InvalidateGraphics();
                    }
                }
            }

            //-------------------
            if (e.OriginalKeyEventArgs != null)
            {
                ((IEventListener)this).ListenKeyDown(e.OriginalKeyEventArgs);
            }
        }

        string _userText;

        public string GetText()
        {
            if (_myTextBox != null)
            {
                return _myTextBox.Text;
            }
            else if (_textBoxPlaceHolder != null)
            {
                return _textBoxPlaceHolder.Text;
            }
            else
            {
                return _userText;
            }
        }
        public void SetText(string value)
        {
            if (_myTextBox != null)
            {
                _myTextBox.Text = value;
            }
            else if (_textBoxPlaceHolder != null)
            {
                _textBoxPlaceHolder.Text = value;
            }
            else
            {
                _userText = value;
            }
        }
        public void SetText(IEnumerable<string> lines)
        {
            //TODO: review here, this version
            //support only multiline mode
            if (_myTextBox != null && _isMultiLine)
            {
                _myTextBox.SetText(lines);
            }
            else
            {

#if DEBUG
                System.Diagnostics.Debug.WriteLine("set_text:");
#endif
            }
        }
        public override void Focus()
        {
            if (_textboxSwitcher != null)
            {
                //on focus
                if (_isEditable && _myTextBox == null)
                {
                    if (_textboxSwitcher.UsedBy != null)
                    {
                        _textboxSwitcher.UsedBy.ReleaseSwitchableTextBox();
                        _textboxSwitcher.UsedBy = null;
                    }

                    if (_isMaskTextBox)
                    {
                        _myTextBox = _textboxSwitcher.BorrowMaskTextBox(this.Width - 4, this.Height - 4);

                    }
                    else
                    {
                        _myTextBox = _textboxSwitcher.BorrowTextBox(this.Width - 4, this.Height - 4);
                        _myTextBox.TextEventListener = _textSurfaceEventListener;
                    }

                    if (base.GetPrimaryRenderElement() is IContainerRenderElement baseRenderE)
                    {
                        baseRenderE.AddChild(_myTextBox);
                    }

                    _textBoxPlaceHolder.SetVisible(false);
                    _myTextBox.Text = _textBoxPlaceHolder.Text;
                    _myTextBox.Focus();

                    _textboxSwitcher.UsedBy = this;
                }
            }
            else
            {
                _myTextBox?.Focus();
            }
        }

        protected override void OnLostKeyboardFocus(UIFocusEventArgs e)
        {
            base.OnLostKeyboardFocus(e);
        }
        protected override void OnLostMouseFocus(UIMouseLostFocusEventArgs e)
        {
            base.OnLostMouseFocus(e);
        }
        //
        public TextBoxSwitcher TextBoxSwitcher
        {
            get => _textboxSwitcher;
            set => _textboxSwitcher = value;
        }

        void ReleaseSwitchableTextBox()
        {
            //copy text
            _textBoxPlaceHolder.Text = _myTextBox.Text;
            _myTextBox.TextEventListener = null;

            if (base.GetPrimaryRenderElement() is IContainerRenderElement baseRenderElement)
            {
                baseRenderElement.RemoveChild(_myTextBox.CurrentPrimaryRenderElement);
            }

            _myTextBox.Text = "";//clear

            if (_isMaskTextBox)
            {
                _textboxSwitcher.ReleaseMaskTextBox((MaskTextBox)_myTextBox);
            }
            else
            {
                _textboxSwitcher.ReleaseTextBox((TextBox)_myTextBox);
            }

            _myTextBox = null;
            _textBoxPlaceHolder.SetVisible(true);

        }
    }

    public class TextBoxSwitcher
    {
        Stack<TextBox> _textBoxPool = new Stack<TextBox>();
        Stack<MaskTextBox> _maskTextBoxPool = new Stack<MaskTextBox>();
        TextBoxContainer _usedBy;

        public MaskTextBox BorrowMaskTextBox(int w, int h)
        {
            if (_maskTextBoxPool.Count == 0)
            {
                MaskTextBox maskTextBox = new MaskTextBox(w, h);
                return maskTextBox;
            }
            else
            {
                MaskTextBox maskTextBox = _maskTextBoxPool.Pop();
                maskTextBox.SetSize(w, h);
                return maskTextBox;
            }
        }
        public TextBox BorrowTextBox(int w, int h)
        {
            if (_textBoxPool.Count == 0)
            {
                //create a new one
                //this version support only editable, single line text
                TextBox textbox = new TextBox(w, h, false, true);
                return textbox;
            }
            else
            {
                TextBox box = _textBoxPool.Pop();
                box.SetSize(w, h);
                return box;
            }
        }

        public void ReleaseTextBox(TextBox textbox)
        {
            textbox.TextEventListener = null;//release
            _textBoxPool.Push(textbox);
        }
        public void ReleaseMaskTextBox(MaskTextBox maskTextbox)
        {
            maskTextbox.TextEventListener = null;//release
            _maskTextBoxPool.Push(maskTextbox);
        }

        internal TextBoxContainer UsedBy
        {
            get => _usedBy;
            set
            {
                _usedBy = value;
            }
        }
    }
}


text:
KebabOS.applications.roleManager.application.views.RoleGrid = Ext.extend(Kebab.library.ext.ComplexEditorGridPanel, {

    // Application bootstrap
    bootstrap: null,

    initComponent: function() {

        // json data store
        this.dataStore = new KebabOS.applications.roleManager.application.models.RoleDataStore({
            bootstrap:this.bootstrap
        });

        this.extraTbarButtons = this.buildExtraTbarButtonsData();

        this.addEvents('roleSelected');

        KebabOS.applications.roleManager.application.views.RoleGrid.superclass.initComponent.apply(this, arguments);
    },

    listeners: {
        beforeRender: function() {
            if (this.extraTbarButtons) {
                this.buildExtraTbarButtons();
            }
        },

        afterRender: function() {
            this.store.load({params:{start:0, limit:25}});
            this.onDisableButtonGroup('export');
            this.batchButton.toggle();
            this.getView().fitColumns();
        }
    },
    buildExtraTbarButtonsData: function() {

        return [
            {
                xtype: 'buttongroup',
                title: Kebab.helper.translate('Extra'),
                defaults: {
                    iconAlign: 'top',
                    scale: 'small',
                    width:50,
                    scope: this
                },
                items: [
                    {
                        text: Kebab.helper.translate('See details'),
                        tooltip: Kebab.helper.translate('See the selected record(s) details'),
                        iconCls: 'icon-application-view-detail',
                        handler: function() { // Records selected
                            var sm = this.getSelectionModel();
                            if (sm.getCount()) {
                                this.fireEvent('roleSelected', sm.getSelections());
                            }
                        }
                    }
                ]
            }
        ];
    },

    buildColumns: function() {

        this.editorTextField = new Ext.form.TextField({});
        this.editorTextArea = new Ext.form.TextArea({});

        return [
            this.selectionModel,
            {
                header : 'ID',
                dataIndex :'id',
                align:'center',
                width:12
            }, {
                header : Kebab.helper.translate('Role title'),
                dataIndex :'title',
                editor:this.editorTextField,
                width:30
            },{
                header : Kebab.helper.translate('Role description'),
                dataIndex :'description',
                editor:this.editorTextArea,
                width:120
            },{
                header   : Kebab.helper.translate('User number'),
                dataIndex: 'num_user',
                align:'center',
                width:30
            },{
                header   : Kebab.helper.translate('Story number'),
                dataIndex: 'num_story',
                align:'center',
                width:30
            },{
                header   : Kebab.helper.translate('Active ?'),
                dataIndex: 'active',
                xtype:'checkcolumn',
                width:20
            }
        ]
    },

    onRemove : function(btn, ev) {

        var sm = this.getSelectionModel();

        if (!sm.getCount()) {
            return false;
        } else {
            sm.each(function(selection) {
                if (selection.data.num_user == 0  & selection.data.num_story == 0) { // just remove the unbound records
                   this.store.remove(selection);
                }
            }, this);
        }
    }

});


text:
*Taken from http://libvirt.org/governance.html with minor adjustments.*

The open source community covers people from a wide variety of countries, backgrounds and positions. This global diversity is a great strength for this project, but can also lead to communication issues, which may in turn cause unhappiness. To maximize happiness of the project community taken as a whole, all members (whether users, contributors or committers) are expected to abide by the project's code of conduct. At a high level the code can be summarized as "be excellent to each other". Expanding on this:

**Be respectful:** disagreements between people are to be expected and are usually the sign of healthy debate and engagement. Disagreements can lead to frustration and even anger for some members. Turning to personal insults, intimidation or threatening behavior does not improve the situation. Participants should thus take care to ensure all communications / interactions stay professional at all times.

**Be considerate:** remember that the community has members with a diverse background many of whom have English as a second language. What might appear impolite, may simply be a result of a lack of knowledge of the English language. Bear in mind that actions will have an impact on other community members and the project as a whole, so take potential consequences into account before pursuing a course of action.

**Be forgiving:** humans are fallible and as such prone to make mistakes and inexplicably change their positions at times. Don't assume that other members are acting with malicious intent. Be prepared to forgive people who make mistakes and assist each other in learning from them. Playing a blame game doesn't help anyone.

## Issues
* Before reporting an issue make sure you search first if anybody has already reported a similar issue and whether or not it has been fixed.
* Make sure your issue report sufficiently details the problem.
* Include code samples reproducing the issue.
* Please do not derail or troll issues. Keep the discussion on topic and respect the Code of conduct.
* If you want to tackle any open issue, make sure you let people know you are working on it.

## Development workflow
Go is unlike any other language in that it forces a specific development workflow and project structure. Trying to fight it is useless, frustrating and time consuming. So, you better be prepare to adapt your workflow when contributing to Go projects.

### Prerequisites
* **Go**: To install Go please follow its installation guide at https://golang.org/doc/install
* **Git:** brew install git

### Pull Requests
* Please be generous describing your changes.
* Although it is highly suggested to include tests, they are not a hard requirement in order to get your contributions accepted.
* Keep pull requests small so core developers can review them quickly.

### Workflow for third-party code contributions
* In Github, fork `https://github.com/hooklift/iso9660.git` to your own account
* Get the package using "go get": `go get github.com/hooklift/iso9660`
* Move to where the package was cloned: `cd $GOPATH/src/github.com/hooklift/iso9660`
* Add a git remote pointing to your own fork: `git remote add downstream git@github.com:<your_account>/iso9660.git`
* Create a branch for making your changes, then commit them.
* Push changes to downstream repository, this is your own fork: `git push <mybranch> downstream`
* In Github, from your fork, create the Pull Request and send it upstream.
* You are done.

### Workflow for core developers
Since core developers usually have access to the upstream repository, there is no need for having a workflow like the one for thid-party contributors.

* Get the package using "go get": `go get github.com/hooklift/iso9660`
* Create a branch for making your changes, then commit them.
* Push changes to the repository: `git push origin <mybranch>`
* In Github, create the Pull Request from your branch to master.
* Before merging into master, wait for at least two developers to code review your contribution.


text:
	//let pipeline = vec![Pipeline::ReadFromR2, Pipeline::ParseEsil,
						//Pipeline::CFG, Pipeline::SSA];

	//let test_name = "test1".to_string();
	//let bin_name = Some("./ex-bins/simple2".to_string());
	//let addr = Some("sym.main".to_string());
	//let mut test = Test::new(test_name, bin_name, addr, false, pipeline);
	//test.run();
	//test.dump();
//}


text:
require 'whyvalidationssuckin96/skippable_validation'
require 'whyvalidationssuckin96/attribute_based_validation'
require 'uri'

module WhyValidationsSuckIn96

  # Checks whether a given attribute is a valid URL
  #
  # @example Default usage
  #   setup_validations do
  #     validates_as_url :website
  #   end
  #
  # @example Specifying valid schemes instead of the defaults
  #   setup_validations do
  #     validates_as_url :website, :schemes => %w[ldap mailto]
  #   end
  class ValidatesUrl < Validation
    include WhyValidationsSuckIn96::SkippableValidation
    include WhyValidationsSuckIn96::AttributeBasedValidation

    DefaultOptions = {:message => "is not a valid URL", :schemes => %w[http https]}

    def validate
      super
      uri = URI.parse(attribute_value)
      options[:schemes].include?(uri.scheme) ? pass : fail
    rescue URI::InvalidURIError => e
      fail
    end

  end # Validation

  ValidationBuilder.register_macro :validates_as_url, WhyValidationsSuckIn96::ValidatesUrl
end   # WhyValidationsSuckIn96


text: ALTER TABLE groups DROP COLUMN visible_member_list;


text:
package carriage

import (
	"TruckMonitor-Backend/model"
	"fmt"
)

func convertEmployeeName(employee *model.Employee) (result string) {
	result = fmt.Sprintf("%s %s", employee.Surname, employee.Name)
	if len(employee.Patronymic) > 0 {
		result = fmt.Sprintf("%s %s", result, employee.Patronymic)
	}
	return
}


text:
import React, {Component, PropTypes} from 'react';
import Icon from '../icon';
import Button from 'react-bootstrap/lib/Button';

export default class MobileHeader extends Component {
  render() {
    const {parentRoute, title, goTo, goUp} = this.props;

    return (

        {parentRoute &&
          <Button className="back-btn" bsStyle="link" onClick={() => goUp()}>
            <Icon name="caret-left" />
          </Button>}
        {title && {title}}
         goTo('root')}>

    );
  }
}


text:
package OpenXPKI::Server::Workflow::Validator::PKCS10;

use strict;
use warnings;
use base qw( OpenXPKI::Server::Workflow::Validator );
use Workflow::Exception qw( validation_error );
use Crypt::PKCS10 2.000;
use OpenXPKI::Server::Context qw( CTX );
use OpenXPKI::Debug;
use English;

sub _validate {

    my ( $self, $wf, $pkcs10 ) = @_;

    # allow empty PKCS10 for server-side key generation
    if (not $pkcs10) {
        CTX('log')->application()->debug("PKCS#10 validaton: is empty");
        return 1;
    }

    my $verify_signature = not (defined $self->param('verify_signature') && !$self->param('verify_signature'));

    Crypt::PKCS10->setAPIversion(1);
    my $decoded = Crypt::PKCS10->new($pkcs10,
        ignoreNonBase64 => 1,
        verifySignature => $verify_signature );

    if (!$decoded) {

        my $error = Crypt::PKCS10->error;
        $error =~ s/\s*$//;
        # Log the error
        CTX('log')->application()->error("Invalid PKCS#10 request ($error)");

        # If signature verification was on, check if it only the signature is the problem
        $decoded = Crypt::PKCS10->new($pkcs10,
            ignoreNonBase64 => 1,
            verifySignature => 0 );

        if ($decoded) {
              validation_error("I18N_OPENXPKI_UI_VALIDATOR_PKCS10_SIGNATURE_ERROR");
        }
        validation_error("I18N_OPENXPKI_UI_VALIDATOR_PKCS10_PARSE_ERROR");
    }

    if (!($decoded->subject() || $self->param('empty_subject'))) {
        CTX('log')->application()->error('PKCS#10 has no subject');

        validation_error('I18N_OPENXPKI_UI_VALIDATOR_PKCS10_NO_SUBJECT_ERROR');
    }

    return 1;
}

1;

__END__

=head1 NAME

OpenXPKI::Server::Workflow::Validator::PKCS10

=head1 SYNOPSIS

validator:
  is_valid_pkcs10:
      class: OpenXPKI::Server::Workflow::Validator::PKCS10
      param:
         empty_subject: 0|1
         verify_signature: 0|1
      arg:
         - $pkcs10

=head1 DESCRIPTION

Check the incoming data to be a valid (parseable) pkcs10 request. By default,
the request must have a subject set, you can skip the subject check setting
the parameter empty_subject to a true value.

=head2 Argument

=over

=item $pkcs10

The PEM formatted PKCS#10 request

=back

=head2 Parameter

=over

=item empty_subject

By default, we expect the CSR to have a subject set. Set this to 0 to allow
an empty subject (required with some SCEP clients and Microsoft CA services).

=item verify_signature

Cryptographically verify the signature of the request - default is ON.
(was changed in v2.3 as the module deps have been fixed).

=back


text: $partial("templates/list.html")$


text:
function insert(item, user, request) {

    var opponentId = request.parameters.OpponentUserId;
    var user1Name;
    // Query the users table to find out the username of the originator
    var userTable = tables.getTable("users")
    userTable.where({ UserId: user.userId }).read({
        success: function (results) {
            if (results.length == 0) {
                request.respond(500, "moves/insert.js: User with UserId= " + user.userId + " not found.")
                return;
            }
            if (results.length == 1) {
                // Found a user
                user1Name = results[0].UserName;
                getUserIdAndSendNotification(request, user1Name, opponentId, item);
                request.execute();
                return;
            } else {
                // If UserId has more than one user, pick the first.
                user1Name = results[0].UserName;
                getUserIdAndSendNotification(request, user1Name, opponentId, item);
                request.execute();
                return;
            }
        }
    });
}

function getUserIdAndSendNotification(request, user1Name, user2, item) {
    var userTable = tables.getTable("users")
    userTable.where({ id: user2 }).read({
        success: function (results) {
            if (results.length == 0) {
                request.respond(500, "moves/insert.js: User with id= " + user2 + " not found.")
                return;
            }
            if (results.length == 1) {
                // Found a user
                var userId = results[0].UserId;
                sendNotification(request, user1Name, userId, item);
            } else {
                // If more than one user, pick the first.
                var userId = results[0].UserId;
                sendNotification(request, user1Name, userId, item);
            }
        }
    });
}

function sendNotification(request, user1Name, userId, item) {

    console.log("userId = " + userId)
    // Notify the other user that it's their turn, or that the game is over.
    var pushText = "";
    if (item.GameResult == 0) {
        pushText = " played and now it's your turn!"
        push.wns.sendBadge(userId, "alert", {
            success: function (pushResponse) {
                console.log("Sent badge push:", pushResponse);
            },
            error: function (err)
            { console.log("Badge push failed " + err) }
        });
    }
    else if (item.GameResult == 1) {
        pushText = " played and the game is over! " + item.Winner + " wins!"
    }
    else if (item.GameResult == 2) {
        pushText = " played and the game is over! It's a tie."
    }

    push.wns.sendToastText01(userId, {
        text1: "TicTacToe: " + user1Name + pushText
    }, {
        success: function (pushResponse) {
            console.log("Sent push:", pushResponse);
        },
        error: function (err) {
            console.log("Error pushing notification " + err)
        }
    });

}


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

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

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

    /**
     *

     * The ID of the insight containing the log groups.
     *

     */
    private String insightId;
    /**
     *

     * The maximum number of results to return with a single call. To retrieve the remaining results, make another call
     * with the returned nextToken value.
     *

     */
    private Integer maxResults;
    /**
     *

     * The pagination token to use to retrieve the next page of results for this operation. If this value is null, it
     * retrieves the first page.
     *

     */
    private String nextToken;

    /**
     *

     * The ID of the insight containing the log groups.
     *

     *
     * @param insightId
     *        The ID of the insight containing the log groups.
     */

    public void setInsightId(String insightId) {
        this.insightId = insightId;
    }

    /**
     *

     * The ID of the insight containing the log groups.
     *

     *
     * @return The ID of the insight containing the log groups.
     */

    public String getInsightId() {
        return this.insightId;
    }

    /**
     *

     * The ID of the insight containing the log groups.
     *

     *
     * @param insightId
     *        The ID of the insight containing the log groups.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListAnomalousLogGroupsRequest withInsightId(String insightId) {
        setInsightId(insightId);
        return this;
    }

    /**
     *

     * The maximum number of results to return with a single call. To retrieve the remaining results, make another call
     * with the returned nextToken value.
     *

     *
     * @param maxResults
     *        The maximum number of results to return with a single call. To retrieve the remaining results, make
     *        another call with the returned nextToken value.
     */

    public void setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
    }

    /**
     *

     * The maximum number of results to return with a single call. To retrieve the remaining results, make another call
     * with the returned nextToken value.
     *

     *
     * @return The maximum number of results to return with a single call. To retrieve the remaining results, make
     *         another call with the returned nextToken value.
     */

    public Integer getMaxResults() {
        return this.maxResults;
    }

    /**
     *

     * The maximum number of results to return with a single call. To retrieve the remaining results, make another call
     * with the returned nextToken value.
     *

     *
     * @param maxResults
     *        The maximum number of results to return with a single call. To retrieve the remaining results, make
     *        another call with the returned nextToken value.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListAnomalousLogGroupsRequest withMaxResults(Integer maxResults) {
        setMaxResults(maxResults);
        return this;
    }

    /**
     *

     * The pagination token to use to retrieve the next page of results for this operation. If this value is null, it
     * retrieves the first page.
     *

     *
     * @param nextToken
     *        The pagination token to use to retrieve the next page of results for this operation. If this value is
     *        null, it retrieves the first page.
     */

    public void setNextToken(String nextToken) {
        this.nextToken = nextToken;
    }

    /**
     *

     * The pagination token to use to retrieve the next page of results for this operation. If this value is null, it
     * retrieves the first page.
     *

     *
     * @return The pagination token to use to retrieve the next page of results for this operation. If this value is
     *         null, it retrieves the first page.
     */

    public String getNextToken() {
        return this.nextToken;
    }

    /**
     *

     * The pagination token to use to retrieve the next page of results for this operation. If this value is null, it
     * retrieves the first page.
     *

     *
     * @param nextToken
     *        The pagination token to use to retrieve the next page of results for this operation. If this value is
     *        null, it retrieves the first page.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListAnomalousLogGroupsRequest withNextToken(String nextToken) {
        setNextToken(nextToken);
        return this;
    }

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

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

        if (obj instanceof ListAnomalousLogGroupsRequest == false)
            return false;
        ListAnomalousLogGroupsRequest other = (ListAnomalousLogGroupsRequest) obj;
        if (other.getInsightId() == null ^ this.getInsightId() == null)
            return false;
        if (other.getInsightId() != null && other.getInsightId().equals(this.getInsightId()) == false)
            return false;
        if (other.getMaxResults() == null ^ this.getMaxResults() == null)
            return false;
        if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false)
            return false;
        if (other.getNextToken() == null ^ this.getNextToken() == null)
            return false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getInsightId() == null) ? 0 : getInsightId().hashCode());
        hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode());
        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
        return hashCode;
    }

    @Override
    public ListAnomalousLogGroupsRequest clone() {
        return (ListAnomalousLogGroupsRequest) super.clone();
    }

}


text:
<?php

namespace phpManufaktur\ConfirmationLog\Data;

class Config
{
    protected $app = null;
    protected static $config = null;

    /**
     * Constructor
     *
     * @param Application $app
     */
    public function __construct($app)
    {
        $this->app = $app;
        $this->loadConfiguration();
    }

    /**
     * Set the default values in self::$config
     *
     */
    protected function setDefaultValues()
    {
        self::$config = array(
            'confirmation' => array(
                'only_once' => true,
                'identifier' => 'USERNAME'
            ),
            'filter' => array(
                'installations' => array(
                    // uses the INSTALLATION_NAMES defined in the config.php of the CLIENTS
                    'active' => true,
                    'groups' => array(
                        'installation_names' => array(

                        )
                    )
                ),
                'persons' => array(
                    // uses the group definitions of the CMS (where this config file is placed)
                    'active' => true,
                    'cms' => array(
                        'identifier' => 'USERNAME', // alternate: EMAIL -> table: cms_users
                        'ignore_groups' => array(
                            'Administrators'
                        )
                    )
                )
            )
        );
    }

    /**
     * Save the configuration file config.confirmation.json
     *
     * @throws \Exception
     */
    public function saveConfiguration()
    {
        if (!is_array(self::$config)) {
            throw new \Exception('`self::$config` must be of type array!');
        }

        file_put_contents(MANUFAKTUR_PATH.'/ConfirmationLog/config.confirmation.json',
            $this->app['utils']->JSONFormat(self::$config));
    }

    /**
     * Load the configuration file config.confirmation.json.
     * If the file not exists create a new one with default values
     *
     */
    public function loadConfiguration()
    {
        if (!file_exists(MANUFAKTUR_PATH.'/ConfirmationLog/config.confirmation.json')) {
            $this->setDefaultValues();
            $this->saveConfiguration();
        }

        self::$config = $this->app['utils']->readJSON(MANUFAKTUR_PATH.'/ConfirmationLog/config.confirmation.json');
    }

    /**
     * Return the configuration array
     *
     * @return array configuration
     */
    public function getConfiguration()
    {
        return self::$config;
    }

    /**
     * Set the configuration to the given array
     *
     * @param array $config
     * @throws \Exception
     */
    public function setConfiguration($config)
    {
        if (!is_array($config)) {
            throw new \Exception('$config must be of type array!');
        }
        self::$config = $config;
    }
}


text:
<?php

// If you don't use Composer, uncomment below
/*
require_once APPPATH . 'third_party/Twig-1.xx.x/lib/Twig/Autoloader.php';
Twig_Autoloader::register();
*/

class Twig
{
    private $config = [];

    private $functions_asis = [
        'base_url', 'site_url'
    ];
    private $functions_safe = [
        'form_open', 'form_close', 'form_error', 'set_value', 'form_hidden'
    ];

    /**
     * @var bool Whether functions are added or not
     */
    private $functions_added = false;

    /**
     * @var Twig_Environment
     */
    private $twig;

    /**
     * @var Twig_Loader_Filesystem
     */
    private $loader;

    public function __construct($params = [])
    {
        // default config
        $this->config = [
            'paths' => [VIEWPATH],
            'cache' => APPPATH . 'cache/twig',
        ];

        $this->config = array_merge($this->config, $params);

        if (isset($params['functions'])) {
            $this->functions_asis =
                array_unique(
                    array_merge($this->functions_asis, $params['functions'])
                );
        }
        if (isset($params['functions_safe'])) {
            $this->functions_safe =
                array_unique(
                    array_merge($this->functions_safe, $params['functions_safe'])
                );
        }
    }

    protected function resetTwig()
    {
        $this->twig = null;
        $this->createTwig();
    }

    protected function createTwig()
    {
        // $this->twig is singleton
        if ($this->twig !== null) {
            return;
        }

        if (ENVIRONMENT === 'production') {
            $debug = false;
        } else {
            $debug = true;
        }

        if ($this->loader === null) {
            $this->loader = new \Twig_Loader_Filesystem($this->config['paths']);
        }

        $twig = new \Twig_Environment($this->loader, [
            'cache'      => $this->config['cache'],
            'debug'      => $debug,
            'autoescape' => true,
        ]);

        if ($debug) {
            $twig->addExtension(new \Twig_Extension_Debug());
        }

        $this->twig = $twig;
    }

    protected function setLoader($loader)
    {
        $this->loader = $loader;
    }

    /**
     * Registers a Global
     *
     * @param string $name  The global name
     * @param mixed  $value The global value
     */
    public function addGlobal($name, $value)
    {
        $this->createTwig();
        $this->twig->addGlobal($name, $value);
    }

    /**
     * Renders Twig Template and Set Output
     *
     * @param string $view   Template filename without `.twig`
     * @param array  $params Array of parameters to pass to the template
     */
    public function display($view, $params = [])
    {
        $CI =& get_instance();
        $CI->output->set_output($this->render($view, $params));
    }

    /**
     * Renders Twig Template and Returns as String
     *
     * @param string $view   Template filename without `.twig`
     * @param array  $params Array of parameters to pass to the template
     * @return string
     */
    public function render($view, $params = [])
    {
        $this->createTwig();
        // We call addFunctions() here, because we must call addFunctions()
        // after loading CodeIgniter functions in a controller.
        $this->addFunctions();

        $view = $view . '.twig';
        return $this->twig->render($view, $params);
    }

    protected function addFunctions()
    {
        // Runs only once
        if ($this->functions_added) {
            return;
        }

        // as is functions
        foreach ($this->functions_asis as $function) {
            if (function_exists($function)) {
                $this->twig->addFunction(
                    new \Twig_SimpleFunction(
                        $function,
                        $function
                    )
                );
            }
        }

        // safe functions
        foreach ($this->functions_safe as $function) {
            if (function_exists($function)) {
                $this->twig->addFunction(
                    new \Twig_SimpleFunction(
                        $function,
                        $function,
                        ['is_safe' => ['html']]
                    )
                );
            }
        }

        // customized functions
        if (function_exists('anchor')) {
            $this->twig->addFunction(
                new \Twig_SimpleFunction(
                    'anchor',
                    [$this, 'safe_anchor'],
                    ['is_safe' => ['html']]
                )
            );
        }

        $this->functions_added = true;
    }

    /**
     * @param string $uri
     * @param string $title
     * @param array  $attributes [changed] only array is acceptable
     * @return string
     */
    public function safe_anchor($uri = '', $title = '', $attributes = [])
    {
        $uri = html_escape($uri);
        $title = html_escape($title);

        $new_attr = [];
        foreach ($attributes as $key => $val) {
            $new_attr[html_escape($key)] = html_escape($val);
        }

        return anchor($uri, $title, $new_attr);
    }

    /**
     * @return \Twig_Environment
     */
    public function getTwig()
    {
        $this->createTwig();
        return $this->twig;
    }
}


text:
<?php

namespace Oro\Bundle\AddressBundle\Tests\Unit\Entity\Repository;

use Doctrine\Common\EventManager;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query;
use Gedmo\Translatable\TranslatableListener;
use Oro\Bundle\AddressBundle\Entity\Country;
use Oro\Bundle\AddressBundle\Entity\Repository\RegionRepository;

class RegionRepositoryTest extends \PHPUnit\Framework\TestCase
{
    const ENTITY_NAME = 'RegionEntityName';

    /**
     * @var RegionRepository
     */
    protected $repository;

    /**
     * @var TranslatableListener|\PHPUnit\Framework\MockObject\MockObject
     */
    protected $translatableListener;

    /**
     * @var EventManager|\PHPUnit\Framework\MockObject\MockObject
     */
    protected $eventManager;

    /**
     * @var EntityManager|\PHPUnit\Framework\MockObject\MockObject
     */
    protected $entityManager;

    /**
     * @var array
     */
    protected $testRegions = ['one', 'two', 'three'];

    protected function setUp()
    {
        $this->translatableListener = $this->createMock(TranslatableListener::class);
        $this->eventManager = $this->createMock(EventManager::class);

        $this->entityManager = $this->createMock(EntityManager::class);
        $this->entityManager->expects($this->any())
            ->method('getEventManager')
            ->willReturn($this->eventManager);

        $this->repository = new RegionRepository($this->entityManager, new ClassMetadata(self::ENTITY_NAME));
    }

    /**
     * Tests both getCountryRegionsQueryBuilder and getCountryRegions
     */
    public function testGetCountryRegions()
    {
        $entityAlias = 'r';
        $country = new Country('iso2Code');
        $locale = 'de_DE';

        $this->translatableListener->expects($this->once())
            ->method('getListenerLocale')
            ->willReturn($locale);

        $this->eventManager->expects($this->any())
            ->method('getListeners')
            ->willReturn([[$this->translatableListener]]);

        $query = $this->getMockBuilder('Doctrine\ORM\AbstractQuery')
            ->disableOriginalConstructor()
            ->setMethods(['setHint', 'execute'])
            ->getMockForAbstractClass();
        $query->expects($this->exactly(2))
            ->method('setHint')
            ->withConsecutive(
                [
                    Query::HINT_CUSTOM_OUTPUT_WALKER,
                    'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'
                ],
                [
                    TranslatableListener::HINT_TRANSLATABLE_LOCALE,
                    $locale
                ]
            );
        $query->expects($this->once())->method('execute')
            ->will($this->returnValue($this->testRegions));

        $queryBuilder = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
            ->disableOriginalConstructor()
            ->setMethods(['select', 'from', 'where', 'orderBy', 'setParameter', 'getQuery'])
            ->getMock();
        $queryBuilder->expects($this->once())->method('select')->with($entityAlias)
            ->will($this->returnSelf());
        $queryBuilder->expects($this->once())->method('from')->with(self::ENTITY_NAME, $entityAlias)
            ->will($this->returnSelf());
        $queryBuilder->expects($this->once())->method('where')->with('r.country = :country')
            ->will($this->returnSelf());
        $queryBuilder->expects($this->once())->method('orderBy')->with('r.name', 'ASC')
            ->will($this->returnSelf());
        $queryBuilder->expects($this->once())->method('setParameter')->with('country', $country)
            ->will($this->returnSelf());
        $queryBuilder->expects($this->once())->method('getQuery')
            ->will($this->returnValue($query));

        $this->entityManager->expects($this->once())
            ->method('createQueryBuilder')
            ->will($this->returnValue($queryBuilder));

        $actualRegions = $this->repository->getCountryRegions($country);
        $this->assertEquals($this->testRegions, $actualRegions);
    }

    /**
     * @expectedException \Gedmo\Exception\RuntimeException
     * @expectedExceptionMessage The translation listener could not be found
     */
    public function testGetCountryRegionsException()
    {
        $country = new Country('iso2Code');

        $this->eventManager->expects($this->any())
            ->method('getListeners')
            ->willReturn([[]]);

        $query = $this->getMockBuilder('Doctrine\ORM\AbstractQuery')
            ->disableOriginalConstructor()
            ->setMethods(['setHint', 'execute'])
            ->getMockForAbstractClass();
        $query->expects($this->once())
            ->method('setHint')
            ->with(
                Query::HINT_CUSTOM_OUTPUT_WALKER,
                'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'
            );

        $queryBuilder = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
            ->disableOriginalConstructor()
            ->setMethods(['select', 'from', 'where', 'orderBy', 'setParameter', 'getQuery'])
            ->getMock();
        $queryBuilder->expects($this->once())->method('select')->willReturnSelf();
        $queryBuilder->expects($this->once())->method('from')->willReturnSelf();
        $queryBuilder->expects($this->once())->method('where')->willReturnSelf();
        $queryBuilder->expects($this->once())->method('orderBy')->willReturnSelf();
        $queryBuilder->expects($this->once())->method('setParameter')->willReturnSelf();
        $queryBuilder->expects($this->once())->method('getQuery')
            ->willReturn($query);

        $this->entityManager->expects($this->once())
            ->method('createQueryBuilder')
            ->will($this->returnValue($queryBuilder));

        $this->repository->getCountryRegions($country);
    }
}


text:
<!Doctype html>

<link rel="stylesheet" type="text/css" href="stylesheets/dbc1.css">

 I am the first heading

 I am the second heading

 I am the third heading

 I am the fourth heading

 I am the fifth heading

 I am the sixth heading

 I am a short paragraph

So am I

Hey, me to!

This paragraph is in bold

And this one is in italics

 This is a link to google that will open in this window.

 This is a link to google that will open in a new window or tab.

	 This is a link to my email

That is a bad picture of me

Here it is again, but now it also links to my github page

This paragraph
 has a line break

 Here is an unordered list of some of my favorite anime series

Mushi Shi

Gurren Lagan

Future Diaries

Darker than Black

Baccano!

Here is an ordered list of some of my favorite anime movies, although not neccessarily in ranked order

Princess Mononoke

Metropolis

Spirited Away

Grave of the Fireflies

The Cowboy Bebop movie


text:
from .base import *  # noqa

ALLOWED_HOSTS = INTERNAL_IPS = [
    'localhost',
    '127.0.0.1',
    '0.0.0.0',
]

# Required for viewing the debug toolbar in docker, since the IP address is unknown.
DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TOOLBAR_CALLBACK': lambda x: True,
}

INSTALLED_APPS += ['debug_toolbar']  # noqa

MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware']  # noqa

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'name',
        'USER': 'root',
        'PASSWORD': 'root',
        'HOST': 'mariadb',
    }
}


text:
#ifndef NGX_HTTP_PYTHON_HANDLER_H
#define NGX_HTTP_PYTHON_HANDLER_H

#include <nginx.h>
#include <ngx_http.h>

#include "ngx_http_python_module.h"

ngx_int_t ngx_http_python_rewrite_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_rewrite_file_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_rewrite_inline_handler(ngx_http_request_t *r);

ngx_int_t ngx_http_python_access_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_access_file_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_access_inline_handler(ngx_http_request_t *r);

ngx_int_t ngx_http_python_content_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_content_file_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_content_inline_handler(ngx_http_request_t *r);

ngx_int_t ngx_http_python_log_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_log_file_handler(ngx_http_request_t *r);
ngx_int_t ngx_http_python_log_inline_handler(ngx_http_request_t *r);

#endif


text:
[![Build Status](https://travis-ci.org/wearefractal/vinyl.png?branch=master)](https://travis-ci.org/wearefractal/vinyl)

[![NPM version](https://badge.fury.io/js/vinyl.png)](http://badge.fury.io/js/vinyl)

## Information

Package	vinyl

Description
A virtual file format

Node Version
>= 0.9

## File

```javascript
var File = require('vinyl');

var coffeeFile = new File({
  cwd: "/",
  base: "/test/",
  path: "/test/file.coffee"
  contents: new Buffer("test = 123")
});
```

### constructor(options)

#### options.cwd

Type: `String`
Default: `process.cwd()`

#### options.base

Used for relative pathing. Typically where a glob starts.

Type: `String`
Default: `options.cwd`

#### options.path

Full path to the file.

Type: `String`
Default: `null`

#### options.stat

The result of an fs.stat call. See [fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information.

Type: `fs.Stats`
Default: `null`

#### options.contents

File contents.

Type: `Buffer, Stream, or null`
Default: `null`

### isBuffer()

Returns true if file.contents is a Buffer.

### isStream()

Returns true if file.contents is a Stream.

### isNull()

Returns true if file.contents is null.

### clone()

Returns a new File object with all attributes cloned.

### pipe(stream[, opt])

If file.contents is a Buffer, it will write it to the stream.

If file.contents is a Stream, it will pipe it to the stream.

If file.contents is null, it will do nothing.

If opt.end is true, the destination stream will not be ended (same as node core).

Returns the stream.

### inspect()

Returns a pretty String interpretation of the File. Useful for console.log.

### relative

Returns path.relative for the file base and file path.

Example:

```javascript
var file = new File({
  cwd: "/",
  base: "/test/",
  path: "/test/file.coffee"
});

console.log(file.relative); // file.coffee
```

## LICENSE

(MIT License)

Copyright (c) 2013 Fractal <contact@wearefractal.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


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

namespace StackifyLib.Models
{

    /// <summary>
    /// Helper class for logging a message and object both
    /// </summary>
    [Serializable]
    public class LogMessage
    {
        public object json { get; set; }
        public string message { get; set; }

        public override string ToString()
        {
            if (json != null)
            {
                return message + " " + JsonConvert.SerializeObject(json);
            }
            else
            {
                return message;
            }
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK;
using Sharp2D.Game.Worlds;
using Newtonsoft.Json;
using Sharp2D.Core.Interfaces;

namespace Sharp2D
{
    public class TiledObject : ICollidable, IDisposable, ICloneable
    {
        public event EventHandler OnCollision;

        [JsonProperty(PropertyName="ellipse")]
        public bool IsEllipse { get; private set; }

        [JsonProperty(PropertyName = "height")]
        public float Height { get; set; }

        [JsonProperty(PropertyName = "width")]
        public float Width { get; set; }

        [JsonProperty(PropertyName = "name")]
        public string Name { get; private set; }

        [JsonProperty(PropertyName = "visible")]
        public bool IsVisible { get; set; }

        [JsonProperty(PropertyName = "x")]
        public float X { get; set; }

        [JsonProperty(PropertyName = "y")]
        public float Y { get; set; }

        [JsonProperty(PropertyName = "type")]
        public string RawType { get; private set; }

        [JsonProperty(PropertyName = "polygon")]
        public List<Vector2> Polygon { get; private set; }

        [JsonProperty(PropertyName = "isBound")]
        public bool IsBound { get; private set; }

        [JsonProperty(PropertyName = "properties")]
        public Dictionary<string, string> Properties { get; private set; }

        [JsonIgnore]
        public bool IsSquare
        {
            get
            {
                return !IsEllipse && Polygon == null;
            }
        }

        [JsonIgnore]
        public TiledWorld World { get; internal set; }

        private Hitbox _hitbox;
        public Hitbox Hitbox
        {
            get
            {
                if (_hitbox == null)
                    _hitbox = new Hitbox(Name, Polygon);

                return _hitbox;
            }
            set
            {
                _hitbox = value;
            }
        }

        public TEnum GetTypeAsEnum<TEnum>() where TEnum : struct, IConvertible, IFormattable
        {
            if (!typeof(TEnum).IsEnum)
            {
                throw new ArgumentException("TEnum must be a type of Enum!");
            }

            TEnum result;
            Enum.TryParse<TEnum>(RawType, true, out result);
            return result;
        }

        public CollisionResult CollidesWith(ICollidable c)
        {
            return Hitbox.CheckCollision(this, c, new Vector2(0, 0));
        }

        public void Dispose()
        {
            if (Polygon != null)
                Polygon.Clear();
            if (Properties != null)
                Properties.Clear();

            _hitbox = null;
        }

        public object Clone()
        {
            TiledObject obj = new TiledObject();

            obj.IsEllipse = IsEllipse;
            obj.Height = Height;
            obj.Width = Width;
            obj.Name = Name;
            obj.IsVisible = IsVisible;
            obj.X = X;
            obj.Y = Y;
            obj.RawType = RawType;
            obj.Polygon = Polygon;
            obj.IsBound = IsBound;
            obj.Properties = Properties;
            obj.World = World;
            obj._hitbox = _hitbox;

            return obj;
        }
    }
}


text:
package com.ilivoo.common.recache.config;

interface AttributeNames {
    String ID = "id";

    String NAME = "name";

    String REF = "ref";

    String BASE_PACKAGE = "base-package";

    String ACCESSOR = "accessor";

    String MONITOR = "monitor";
}


text:
<fiv-selector-header></fiv-selector-header>

Home


text:
using MapDomain.Common;
using MapDomain.Exceptions;
using MapDomain.ValueObjects;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Text;

namespace MapDomain.Entities
{
    public class MapObject
    {
        private readonly string id;
        private readonly Map map;
        private Location location;
        private Location destination;

        public MapObject(IMapObjectRepositoryData data, Map map)
        {
            this.map = map;
            this.id = data.Id;
            this.location = new Location(data.LocationX, data.LocationY);
            this.destination = new Location(data.DestinationX, data.DestinationY);
        }

        public MapObject(string id, Map map)
        {
            this.id = id;
            this.map = map;
        }

        public string Id
        {
            get => id;
        }

        public void SetPosition(Location location)
        {
            ValidateLocation(location);
            SetLocation(location);
            SetDestination(location);
        }

        private void SetLocation(Location location)
        {
            this.location = location;
        }

        public void GoTo(Location destination)
        {
            ValidateLocation(destination);
            SetDestination(destination);
        }

        private void SetDestination(Location destination)
        {
            this.destination = destination;
        }

        private void ValidateLocation(Location location)
        {
            if(location.X < 0 || location.X >= map.Width || location.Y < 0 || location.Y >= map.Height)
            {
                throw new BadLocationException();
            }
        }

        public bool IsMoving
        {
            get => location != destination;
        }

        public bool IsVisible
        {
            get
            {
                var currentSegment = map[location.X, location.Y];
                return currentSegment.Type != SegmentType.Forest;
            }
        }

        //public void SetSpeedCoefficient(float coefficient)
        //{

        //}

        public void UpdateMoving(TimeSpan elapsedTime)
        {
            if(!IsMoving)
            {
                return;
            }

            var elapsedSeconds = (float)elapsedTime.TotalSeconds;
            location = CalculateNextLocation(elapsedSeconds);
        }

        private Location CalculateNextLocation(float elapsedSeconds)
        {
            var speed = GetSpeed();
            var fromVector = new Vector2(location.X, location.Y);
            var toVector = new Vector2(destination.X, destination.Y);
            var traveledDistance = speed * elapsedSeconds;
            var totalDistance = Vector2.Distance(fromVector, toVector);
            var traveledPart = traveledDistance / totalDistance;
            var isFinish = traveledPart >= 1;

            if (isFinish)
            {
                return destination;
            }

            var movingVector = toVector - fromVector;
            var traveledVector = movingVector * traveledPart;
            var resultVector = fromVector + traveledVector;
            return new Location(resultVector.X, resultVector.Y);
        }

        private float GetSpeed()
        {
            var segment = map[location.X, location.Y];
            return segment.Speed;
        }

        public void FillRepositoryData(IMapObjectRepositoryData data)
        {
            data.Id = id;
            data.LocationX = location.X;
            data.LocationY = location.Y;
            data.DestinationX = destination.X;
            data.DestinationY = destination.Y;
        }
    }
}


text:
require 'rails_helper'

# frozen_string_literal: true
RSpec.describe User, type: :model do
  it { is_expected.to validate_presence_of :email    }
  it { is_expected.to validate_presence_of :password }

  describe 'setting default role' do
    context 'no role is set' do
      it 'assigns default of :user' do
        user = create :user
        expect(user.role).to eq 'user'
      end
    end

    context 'admin role is set' do
      it 'assigns admin role' do
        user = create :user, role: :admin
        expect(user.role).to eq 'admin'
      end
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
	<attribute name="title" type="string" value="Union cldc and lflx"/>
  <aggregation type="union">
    <scan location="nc/" suffix="mean.nc"/>
  </aggregation>
</netcdf>


text:
{% extends 'base.html' %}

{% block content %}

Bash Logs

        <button class="js-fr-offcanvas-open" aria-controls="help_box">

            Help
        </button>

Anomaly Detection Configuration

Select commands

<form class="pure-form" method="post" action="{% url 'bash:configure_anomaly_detection_select_commands_save_selected' %}">
    {% csrf_token %}

    <input type="hidden" name="configuration_id" value="{{ configuration_id }}"/>

        {% if all_commands_statistics %}

                        <button type="button" class="custab-head-button">Command</button>
                        <button type="button" class="custab-head-button">Summary count</button>

                    {% for c in all_commands_statistics %}

                        {{ c.command_name|truncatechars:55  }}
                         {{ c.summary_count }}

                            <input id="table_check_button_{{ c.command_name_id }}" type="checkbox" name="checks" value="{{ c.command_name_id }}"
                             {% if c.command_name_id in selected_commands %}
                                checked="checked"
                             {% endif %}
                             />

                    {% endfor %}

        {% else %}

                Empty commands set.

        {% endif %}

            <button type="submit" class="pure-button button-success">

                Select
            </button>

</form>

        <form class="pure-form" method="post" action="{% url 'bash:configure_anomaly_detection_select_commands_save_selected' %}">
            {% csrf_token %}

            <input type="hidden" name="configuration_id" value="{{ configuration_id }}"/>
            <input type="hidden" name="select_default_commands" value="true"/>

            <button type="submit" class="pure-button pure-button-primary">

                Select the most frequent commands (max 100)
            </button>
        </form>

        Please select commands used to recognise user sessions.

    <button class="fr-offcanvas-close js-fr-offcanvas-close">

        Close
    </button>

{% endblock %}


text:
// tslint:disable: no-unused-expression

import JoinStream = require( './index' );

// TESTS //

// The constructor returns a stream...
{
	new JoinStream(); // $ExpectType Transform
	new JoinStream( { 'objectMode': true } ); // $ExpectType Transform
}

// The constructor is callable...
{
	const joinStream = JoinStream;
	joinStream(); // $ExpectType Transform
	joinStream( { 'objectMode': true } ); // $ExpectType Transform
}

// The constructor has an `objectMode` method which returns a stream...
{
	JoinStream.objectMode(); // $ExpectType Transform
	JoinStream.objectMode( { 'objectMode': true } ); // $ExpectType Transform
}

// The constructor has a `factory` method which returns a function for creating streams...
{
	let f = JoinStream.factory();
	f(); // $ExpectType Transform
	f(); // $ExpectType Transform
	f(); // $ExpectType Transform

	f = JoinStream.factory( {} );
	f(); // $ExpectType Transform
	f(); // $ExpectType Transform
	f(); // $ExpectType Transform

	f = JoinStream.factory( { 'objectMode': true } );
	f(); // $ExpectType Transform
	f(); // $ExpectType Transform
	f(); // $ExpectType Transform
}

// The compiler throws an error if the constructor is provided an argument which is not an options object...
{
	new JoinStream( 'abc' ); // $ExpectError
	new JoinStream( 123 ); // $ExpectError
	new JoinStream( true ); // $ExpectError
	new JoinStream( false ); // $ExpectError
	new JoinStream( [] ); // $ExpectError
	new JoinStream( null ); // $ExpectError
}

// The compiler throws an error if the `objectMode` method is provided an argument which is not an options object...
{
	JoinStream.objectMode( 'abc' ); // $ExpectError
	JoinStream.objectMode( 123 ); // $ExpectError
	JoinStream.objectMode( true ); // $ExpectError
	JoinStream.objectMode( false ); // $ExpectError
	JoinStream.objectMode( [] ); // $ExpectError
	JoinStream.objectMode( null ); // $ExpectError
}

// The compiler throws an error if the `factory` method is provided an argument which is not an options object...
{
	JoinStream.factory( 'abc' ); // $ExpectError
	JoinStream.factory( 123 ); // $ExpectError
	JoinStream.factory( true ); // $ExpectError
	JoinStream.factory( false ); // $ExpectError
	JoinStream.factory( [] ); // $ExpectError
	JoinStream.factory( null ); // $ExpectError
}

// The compiler throws an error if the function returned by the `factory` method is provided input arguments...
{
	let f = JoinStream.factory();
	f( 2.0 ); // $ExpectError

	f = JoinStream.factory( {} );
	f( 2.0 ); // $ExpectError

	f = JoinStream.factory( { 'objectMode': true } );
	f( 2.0 ); // $ExpectError
}


text:
#include <aws/storagegateway/model/DescribeUploadBufferRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::StorageGateway::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

DescribeUploadBufferRequest::DescribeUploadBufferRequest() :
    m_gatewayARNHasBeenSet(false)
{
}

Aws::String DescribeUploadBufferRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_gatewayARNHasBeenSet)
  {
   payload.WithString("GatewayARN", m_gatewayARN);

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection DescribeUploadBufferRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "StorageGateway_20130630.DescribeUploadBuffer"));
  return headers;

}


text:
<?php

namespace Everon\Rest;

use Everon\DataMapper;
use Everon\Dependency;

class Filter implements Interfaces\Filter
{
    use Dependency\Injection\Factory;

    /**
     * @inheritdoc
     */
    public function toCriteria(array $filter)
    {
        try {
            $CriteriaBuilder = $this->getFactory()->buildCriteriaBuilder();

            if (empty($filter)) {
                return $CriteriaBuilder;
            }

            $where_item = array_shift($filter);
            @list($column, $operator, $value) = $where_item;
            $CriteriaBuilder->where($column, $operator, $value);

            foreach ($filter as $item) {
                @list($column, $operator, $value, $glue) = $item;
                $glue = isset($glue) === false ? 'AND' : strtoupper($glue);

                if ($glue === DataMapper\Criteria\Builder::GLUE_AND) {
                    $CriteriaBuilder->andWhere($column, $operator, $value);
                }

                if ($glue === DataMapper\Criteria\Builder::GLUE_OR) {
                    $CriteriaBuilder->orWhere($column, $operator, $value);
                }
            }

            return $CriteriaBuilder;
        }
        catch (\Exception $e) {
            throw new Exception\Filter($e);
        }
    }
}


text:
WWFarmer.Menu = function (game) {};

WWFarmer.Menu.prototype = {
	create: function () {
		this.logoBackground = this.add.sprite(0, 0, "logo-background");

		this.startButton = this.add.button(this.world.centerX, 650, "start-button", this.toPrologue, this, 1, 0, 1, 0);
		this.startButton.anchor.set(0.5);
		this.startButton.scale.set(2.25);
		this.startButton.alpha = 0;
		this.add.tween(this.startButton).to({alpha: 1}, 500, "Linear", true);

		this.helpButton = this.add.button(this.world.centerX, 830, "help-button", this.toHelp, this, 1, 0, 1, 0);
		this.helpButton.anchor.set(0.5);
		this.helpButton.scale.set(2.25);
		this.helpButton.alpha = 0;
		this.add.tween(this.helpButton).to({alpha: 1}, 500, "Linear", true);

		this.creditButton = this.add.button(this.world.centerX, 1010, "credit-button", this.toCredit, this, 1, 0, 1, 0);
		this.creditButton.anchor.set(0.5);
		this.creditButton.scale.set(2.25);
		this.creditButton.alpha = 0;
		this.add.tween(this.creditButton).to({alpha: 1}, 500, "Linear", true);

		this.toggleBgSoundButton = this.add.sprite(700, 20, "toggle-music-button", 0);
		this.toggleBgSoundButton.anchor.set(1, 0);
		this.toggleBgSoundButton.inputEnabled = true;
		this.toggleBgSoundButton.alpha = 0;
		this.toggleBgSoundButton.events.onInputDown.add(this.toggleBgSound, this);
		this.add.tween(this.toggleBgSoundButton).to({alpha: 1}, 500, "Linear", true);
	},
	toPrologue: function () {
		this.state.start("Prologue");
	},
	toHelp: function () {
		this.state.start("Help");
	},
	toCredit: function () {
		this.state.start("Credit");
	},
	toggleBgSound: function () {
		WWFarmer.bgSoundPlay = !WWFarmer.bgSoundPlay;

		if (WWFarmer.bgSoundPlay) {
			WWFarmer.bgSound.play();
			this.toggleBgSoundButton.frame = 0;
		} else {
			WWFarmer.bgSound.stop();
			this.toggleBgSoundButton.frame = 1;
		}
	}
};


text:
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
require 'rubygems'
require 'merb-core'
require 'merb-core/plugins'
require "spec" # Satisfies Autotest and anyone else not using the Rake tasks

use_test :rspec
use_template_engine :erb

Merb.disable(:initfile)
Merb.start_environment(
  :testing      => true,
  :adapter      => 'runner',
  :environment  => ENV['MERB_ENV'] || 'test',
  :merb_root    => File.dirname(__FILE__) / 'fixture',
  :log_file     => File.dirname(__FILE__) / '..' / "merb_test.log"
)

Spec::Runner.configure do |config|
end


text:
title: Migrating to Apollo Client 3.0
---

This article walks you through migrating your application to Apollo Client 3.0 from previous versions of Apollo Client.

To illustrate the migration process, we've also made this video that uses the example app from our [full-stack tutorial](https://www.apollographql.com/docs/tutorial/introduction/) as a starting point, updating it from Apollo client 2.6 to 3.0:
<iframe width="560" height="315" src="https://www.youtube.com/embed/dlKzlksOUtU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

## What's new in 3.0

* Apollo Client is now distributed as the `@apollo/client` package (previous versions are distributed as `apollo-client`).
* The `@apollo/client` package includes both React hooks and GraphQL request handling, which previously required installing separate packages.
* Apollo Client's cache (`InMemoryCache`) is more flexible and performant. It now supports garbage collection, storage of both normalized and non-normalized data, and the customization of cached data with new `TypePolicy` and `FieldPolicy` APIs.
* The update also includes numerous bug fixes and optimizations, as described in the [changelog](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md).

## Installation

> **WARNING:** Apollo Client 3.0 is a major-version release that includes **breaking changes**. If you are updating an existing application to use Apollo Client 3.0, please see the [changelog](https://github.com/apollographql/apollo-client/blob/master/CHANGELOG.md) for details about these changes.

Install Apollo Client 3.0 with the following command:

```
npm install @apollo/client
```

If you're installing Apollo Client 3.0 in a project that already uses an earlier version, follow the instructions in each section of [Updating imports](#updating-imports) that applies to a library you are currently using.

## Updating imports

The `@apollo/client` library includes functionality that previously required installing additional packages. As part of migrating to Apollo Client 3.0, follow the instructions below for each library your application currently uses.

### @apollo/react-hoc and @apollo/react-components

React Apollo HOC and component functionality is now included in the `@apollo/client` package:

```js
import { Query, Mutation, Subscription } from '@apollo/client/react/components';
import { graphql } from '@apollo/client/react/hoc';
```

As part of migrating, we recommend removing all `@apollo/react-hoc` and `@apollo/react-components` dependencies.

### @apollo/react-hooks

All `@apollo/react-hooks` functionality is included in the `@apollo/client` package. For example:

```js
import { ApolloProvider, useQuery, useApolloClient } from '@apollo/client'
```

As part of migrating, we recommend removing all `@apollo/react-hooks` dependencies.

### @apollo/react-ssr

React Apollo's SSR utilities (like `getDataFromTree`, `getMarkupFromTree`, and `renderToStringWithData`) are included in the `@apollo/client` package. Access them via `@apollo/client/react/ssr`:

```js
import { renderToStringWithData } from '@apollo/client/react/ssr';
```

As part of migrating, we recommend removing all `@apollo/react-ssr` dependencies.

### @apollo/react-testing

React Apollo's testing utilities (like `MockedProvider`) are included in the `@apollo/client` package. Access them via `@apollo/client/testing`:

```js
import { MockedProvider } from '@apollo/client/testing';
```

As part of migrating, we recommend removing all `@apollo/react-testing` dependencies.

### apollo-boost

The Apollo Boost project is now retired, because Apollo Client 3.0 provides a similarly straightforward setup. We recommend removing all `apollo-boost` dependencies and modifying your `ApolloClient` constructor as needed.

### apollo-client

With Apollo Client 3.0, the `apollo-client` package is retired in favor of `@apollo/client`. As part of migrating, remove all `apollo-client` dependencies.

### apollo-link and apollo-link-http

All `apollo-link`, `apollo-link-http`, and `apollo-link-http-common` functionality is included in the `@apollo/client` package. For example:

```js
import { ApolloLink, HttpLink, from, split, execute } from '@apollo/client';
```

As part of migrating, we recommend removing all `apollo-link`, `apollo-link-http`, and `apollo-link-http-common` dependencies.

If you want to configure your own link chain, the `ApolloClient` constructor still accepts a link option. Otherwise, the `ApolloClient` constructor now also supports `uri`, `headers`, and `credentials` options. For example:

```js
const client = new ApolloClient({
  cache,
  uri: 'http://localhost:4000/graphql',
  headers: {
    authorization: localStorage.getItem('token') || '',
    'client-name': 'Space Explorer [web]',
    'client-version': '1.0.0',
  },
  ...
});
```

These options are passed into a new `HttpLink` instance behind the scenes, which `ApolloClient` is then configured to use.

### apollo-link-*

The separate `apollo-link-*` packages, that were previously maintained in the https://github.com/apollographql/apollo-link repo, have been merged into the Apollo Client project. These links now have their own nested `@apollo/client` entry points. Imports should be updated as follows:

* `apollo-link-batch` is now `@apollo/client/link/batch`
* `apollo-link-batch-http` is now `@apollo/client/link/batch-http`
* `apollo-link-context` is now `@apollo/client/link/context`
* `apollo-link-error` is now `@apollo/client/link/error`
* `apollo-link-retry` is now `@apollo/client/link/retry`
* `apollo-link-schema` is now `@apollo/client/link/schema`
* `apollo-link-ws` is now `@apollo/client/link/ws`

It is important to note that Apollo Client 3 no longer allows `@client` fields to be passed through a Link chain. While Apollo Client 2 made it possible to intercept `@client` fields in Link's like `apollo-link-state` and `apollo-link-schema`, Apollo Client 3 enforces that `@client` fields are local only. This helps ensure Apollo Client's local state story is easier to understand, and prevents unwanted fields from accidentally ending up in network requests ([PR #5982](https://github.com/apollographql/apollo-client/pull/5982)).

### graphql-anywhere

The `graphql-anywhere` package's functionality is no longer included with Apollo Client. You can continue to use the `graphql-anywhere` package, but Apollo no longer uses it and will not actively support it moving forward.

### graphql-tag

The `@apollo/client` package includes `graphql-tag` as a dependency and re-exports `gql`. To simplify your dependencies, we recommend importing gql from `@apollo/client` and removing all `graphql-tag` dependencies.

### react-apollo

`react-apollo` v3 is an umbrella package that re-exports the following packages:

- `@apollo/react-common`
- `@apollo/react-hooks`
- `@apollo/react-components`
- `@apollo/react-hoc`
- `@apollo/react-ssr`
- `@apollo/react-testing`

The `react-apollo` package has been deprecated, and the functionality offered by each of the above packages can now be accessed from `@apollo/client` directly:

- `@apollo/react-hooks` -> now available directly from `@apollo/client`
- `@apollo/react-components` -> now available from `@apollo/client/react/components`
- `@apollo/react-hoc` -> now available from `@apollo/client/react/hoc`
- `@apollo/react-ssr` -> now available from `@apollo/client/react/ssr`
- `@apollo/react-testing` -> now available from `@apollo/client/testing`

## Using individual components of Apollo Client 3

Apollo Client 3.0 provides multiple entry points for you to import from. If you only use a particular part of Apollo Client's functionality, you can import that functionality from its corresponding entry point. By doing so, modern bundlers can omit the remainder of the `@apollo/client` package from your bundle and reduce its size considerably.

### Using Apollo Client without React

Apollo Client 3.0 includes built-in support for React hooks, but it absolutely still supports non-React view layers. To use Apollo Client 3.0 with Vue, Angular, or another view layer of your choosing, import `ApolloClient` from the `@apollo/client/core` entry point:

```js
import { ApolloClient } from '@apollo/client/core';
```

### Using apollo-utilities without the rest of Apollo Client

The `apollo-utilities` package has been removed, but you can access the utilities themselves from the `@apollo/client/utilities` entry point:

```js
import { isReference, isInlineFragment } from '@apollo/client/utilities';
```

### Using apollo-cache and/or apollo-cache-inmemory without the rest of Apollo Client

The `apollo-cache` and `apollo-cache-inmemory` packages have been removed, but if you're interested in using Apollo Client's cache by itself, you can access their contents with the `@apollo/client/cache` entry point:

```js
import { ApolloCache, InMemoryCache } from '@apollo/client/cache';
```

## Cache improvements

Apollo Client 3.0 introduces powerful improvements to its caching system. Most of these improvements are backward compatible, so most applications will continue to work without any changes to caching logic. However, we highly recommend learning more about the capabilities of the Apollo Client 3.0 cache.

* [Configuring the cache](../caching/cache-configuration/)
* [Interacting with cached data](../caching/cache-interaction/)

### Breaking cache changes

The following cache changes are **not** backward compatible. Take them into consideration before you upgrade to Apollo Client 3.0.

* By default, the `InMemoryCache` no longer merges the fields of two objects unless those objects have the same unique identifier and that identifier is present in both objects. Additionally, the values of fields with the same name are no longer merged recursively by default. You can define a custom `merge`  function for a field to handle both of these changes for a particular field. You can read more about these changes in [Merging non-normalized objects](../caching/cache-field-behavior/#merging-non-normalized-objects). ([PR #5603](https://github.com/apollographql/apollo-client/pull/5603)).
* All cache results are now frozen/immutable, as promised in the [Apollo Client 2.6 blog post](https://blog.apollographql.com/whats-new-in-apollo-client-2-6-b3acf28ecad1) ([PR #5153](https://github.com/apollographql/apollo-client/pull/5153)).
* `FragmentMatcher`, `HeuristicFragmentMatcher`, and `IntrospectionFragmentMatcher` have all been removed. We recommend using the `InMemoryCache`'s `possibleTypes` option instead. For more information, see [Defining possibleTypes manually](../data/fragments/#defining-possibletypes-manually) ([PR #5073](https://github.com/apollographql/apollo-client/pull/5073)).
* The internal representation of normalized data in the cache has changed. If you're using `apollo-cache-inmemory`'s public API, then these changes shouldn't impact you. If you are manipulating cached data directly instead, review [PR #5146](https://github.com/apollographql/apollo-client/pull/5146) for details.
* `client|cache.writeData` have been fully removed. `client|cache.writeQuery`, `client|cache.writeFragment`, and/or `cache.modify` can be used to update the cache. For example:

  ```js
    client.writeData({
      data: {
        cartItems: []
      }
    });
  ```

  can be converted to:

  ```js
    client.writeQuery({
      query: gql`
        query GetCartItems {
          cartItems
        }
      `,
      data: {
        cartItems: []
      }
    });
  ```

  For more details around why `writeData` has been removed, see [PR #5923](https://github.com/apollographql/apollo-client/pull/5923).


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Code Coverage for C:\wamp\ZfDealsApp/vendor/DluTwBootstrap/src/DluTwBootstrap/GenUtil.php</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

C:\wamp\ZfDealsApp /

vendor /

DluTwBootstrap /

src /

DluTwBootstrap /

GenUtil.php

Code Coverage

Classes and Traits

Functions and Methods

Lines

      Total

0.00%

0 / 1

0.00%

0 / 5

      CRAP

0.00%

0 / 49

      GenUtil

0.00%

0 / 1

0.00%

0 / 5

      272

0.00%

0 / 49

       addWords($words, $text)

0.00%

0 / 1

      42

0.00%

0 / 20

       addWordsToArrayItem($words, array $ay, $key)

0.00%

0 / 1

      6

0.00%

0 / 7

       escapeWords($words, $escaper)

0.00%

0 / 1

      12

0.00%

0 / 8

       singleSpace($words)

0.00%

0 / 1

      12

0.00%

0 / 8

       getWordsArray($words)

0.00%

0 / 1

      6

0.00%

0 / 6

1
	<?php

2
	namespace DluTwBootstrap;

3

4
	use DluTwBootstrap\Exception\InvalidParameterTypeException;

5
	use DluTwBootstrap\Exception\InvalidParameterException;

6

7

16
	class GenUtil

17
	{

18
	    /**

19
	     * If missing in the text, adds the space separated words to the text and returns the text

20
	     * Words are compared in case insensitive manner

21
	     * @param string|array $words A single word, space separated words or an array of words

22
	     * @param string $text

23
	     * @throws Exception\InvalidParameterTypeException

24
	     * @return string

25
	     */

26
	    public function addWords($words, $text)

27
	    {

28
	        $text   = (string)$text;

29
	        if (is_null($words)) {

30
	            $words  = '';

31
	        }

32
	        if (is_string($words)) {

33
	            $words  = $this->getWordsArray($words);

34
	        }

35
	        if (!is_array($words)) {

36
	            throw new InvalidParameterTypeException(sprintf("%s expects either a string or an array as the 'spec' parameter.", __METHOD__));

37
	        }

38
	        $currentWords       = $this->getWordsArray($text);

39
	        $currentWordsLower  = $this->getWordsArray(strtolower($text));

40
	        foreach ($words as $word) {

41
	            $wordLower  = strtolower($word);

42
	            if (!in_array($wordLower, $currentWordsLower)) {

43
	                $currentWords[]         = $word;

44
	                $currentWordsLower[]    = $wordLower;

45
	            }

46
	        }

47
	        $text   = implode(' ', $currentWords);

48
	        return $text;

49
	    }

50

51
	    /**

52
	     * Adds space separated words to an array item, if the words are missing there

53
	     * If the array item does not exist, creates it

54
	     * Returns the resulting array

55
	     * @param string|array $words A single word, space separated words or an array of words

56
	     * @param array $ay

57
	     * @param string $key

58
	     * @return array

59
	     */

60
	    public function addWordsToArrayItem($words, array $ay, $key)

61
	    {

62
	        if (!array_key_exists($key, $ay)) {

63
	            $ay[$key]   = '';

64
	        }

65
	        $text       = $ay[$key];

66
	        $text       = $this->addWords($words, $text);

67
	        $ay[$key]   = $text;

68
	        return $ay;

69
	    }

70

71
	    /**

72
	     * Breaks the submitted $words into individual words, escapes them with the escaper and returns space separated words

73
	     * The spaces between words are NOT escaped

74
	     * @param string $words

75
	     * @param callable $escaper

76
	     * @return string

77
	     * @throws Exception\InvalidParameterException

78
	     */

79
	    public function escapeWords($words, $escaper)

80
	    {

81
	        if (!is_callable($escaper)) {

82
	            throw new InvalidParameterException(sprintf('%s: The escaper must be a callable.', __METHOD__));

83
	        }

84
	        $wordsAy    = $this->getWordsArray($words);

85
	        foreach ($wordsAy as $key => $word) {

86
	            $wordsAy[$key]  = $escaper($word);

87
	        }

88
	        $words  = implode(' ', $wordsAy);

89
	        return $words;

90
	    }

91

92
	    /**

93
	     * Trims the parameter, replaces all whitespace characters with a single space and returns the resulting string

94
	     * @param string $words

95
	     * @return string

96
	     * @throws Exception\InvalidParameterTypeException

97
	     */

98
	    public function singleSpace($words)

99
	    {

100
	        if (is_null($words)) {

101
	            $words  = '';

102
	        }

103
	        if (!is_string($words)) {

104
	            throw new InvalidParameterTypeException(sprintf('%s: Words parameter must be a string.', __METHOD__));

105
	        }

106
	        $words   = trim($words);

107
	        $words   = preg_replace('/\s+/', ' ', $words);

108
	        return $words;

109
	    }

110

111
	    /**

112
	     * Breaks the $words string into individual words and returns them in an array

113
	     * @param string $words

114
	     * @return array

115
	     */

116
	    public function getWordsArray($words)

117
	    {

118
	        $words      = $this->singleSpace($words);

119
	        if (empty($words)) {

120
	            $wordsAy    = array();

121
	        } else {

122
	            $wordsAy    = explode(' ', $words);

123
	        }

124
	        return $wordsAy;

125
	    }

Legend

     Executed
     Not Executed
     Dead Code

     Generated by PHP_CodeCoverage 1.2.17 using PHP 5.4.12 and PHPUnit 3.7.37 at Thu Jul 31 11:41:39 UTC 2014.


text:
require 'spec_helper'

class SimpleStateMachine
  include AASM

  aasm do
    state :init, :initial => true
    state :failed

    event :failed do
      transitions :from => :init, :to => :failed
    end
  end
end

describe "event naming" do
  let(:state_machine) { SimpleStateMachine.new }

  it "allows an event of failed without blowing the stack" do
    state_machine.failed

    expect { state_machine.failed }.to raise_error(AASM::InvalidTransition)
  end
end