text:
package com.mixer.interactive.gson;

import com.google.gson.*;
import com.mixer.interactive.event.control.ControlDeleteEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.lang.reflect.Type;
import java.util.HashSet;
import java.util.Set;

/**
 * De-serializes a ControlDeleteEvent.
 *
 * @author      Microsoft Corporation
 *
 * @since       2.0.0
 */
public class ControlDeleteEventAdapter implements JsonDeserializer<ControlDeleteEvent> {

    /**
     * Logger.
     */
    private static final Logger LOG = LogManager.getLogger();

    /**
     * {@inheritDoc}
     *
     * @since   1.0.0
     */
    @Override
    public ControlDeleteEvent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        if (!json.isJsonObject()) {
            LOG.fatal("Unable to parse an ControlDeleteEvent");
            throw new JsonParseException("Unable to parse an ControlDeleteEvent");
        }

        JsonObject jsonObject = json.getAsJsonObject();
        String sceneID = jsonObject.get("sceneID").getAsString();
        Set<String> controlIds = new HashSet<>();
        JsonArray controlsArray = jsonObject.getAsJsonArray("controls");
        for (JsonElement jsonElement : controlsArray) {
            controlIds.add(((JsonObject) jsonElement).get("controlID").getAsString());
        }

        return new ControlDeleteEvent(sceneID, controlIds);
    }
}


text:
package com.github.dieterdepaepe.discussionplanner.domain;

import org.optaplanner.core.api.domain.entity.PlanningEntity;
import org.optaplanner.core.api.domain.variable.PlanningVariable;

/**
 *
 */
@PlanningEntity
public class ParticipantAssignment {
    private int id;
    private Participant participant;
    private int round;
    private Location location;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Participant getParticipant() {
        return participant;
    }

    public void setParticipant(Participant participant) {
        this.participant = participant;
    }

    public int getRound() {
        return round;
    }

    public void setRound(int round) {
        this.round = round;
    }

    @PlanningVariable(valueRangeProviderRefs = "locations")
    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }

    @Override
    public String toString() {
        return participant.getName() + "-R" + round + "@" + location;
    }
}

redpajama_set_name: RedPajamaGithub


text:
//
//  UITextField+BPForms.h
//
//  Copyright (c) 2014 Bogdan Poplauschi
//
//  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.

@import Foundation;
@import UIKit;

@class BPFormInputCell;

/**
 *  The purpose is to add common functionality to all our textfields
 */
@interface UITextField (BPForms)

/**
 *  Retrieve the input cell containing the current text field
 *
 *  @return the instance of the BPFormInputCell or nil
 */
- (BPFormInputCell *)containerInputCell;

/**
 *  Adds an X offset to bounds. Used by `textRectForBounds` and `editingRectForBounds` methods.
 *  The purpose is to avoid text values starting right from the edge.
 *
 *  @param xOffset  x offset in pixels
 *  @param inBounds the input bounds
 *
 *  @return the output bounds
 */
- (CGRect)addXOffset:(CGFloat)xOffset toBounds:(CGRect)inBounds;

@end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Drawing;
using System.Windows.Media.Imaging;
using System.Windows.Data;

namespace PDFToolbox.Converters
{
    public class ImageToSourceConverter :  IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter,
                System.Globalization.CultureInfo culture)
        {

            Image image = value as Image;
            if (image != null)
            {
                MemoryStream ms = new MemoryStream();
                image.Save(ms, image.RawFormat);
                ms.Seek(0, SeekOrigin.Begin);
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = ms;
                bi.EndInit();
                return bi;
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}


text:
class Interface:

    def __init__(self, ifname, ip):
        self.ifname = ifname
        self.ip = ip


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

using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.UnitTests.Classification;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.QuickInfo;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo
{
    [UseExportProvider]
    public abstract class AbstractSemanticQuickInfoSourceTests
    {
        protected static FormattedClassification Text(string text)
            => FormattedClassifications.Text(text);

        protected static string Lines(params string[] lines)
            => string.Join("\r\n", lines);

        protected static FormattedClassification[] ExpectedClassifications(
            params FormattedClassification[] expectedClassifications)
        {
            return expectedClassifications;
        }

        protected static Tuple<string, string>[] NoClassifications()
            => null;

        internal static Action<QuickInfoItem> SymbolGlyph(Glyph expectedGlyph)
        {
            return qi =>
            {
                Assert.Contains(expectedGlyph, qi.Tags.GetGlyphs());
            };
        }

        internal static Action<QuickInfoItem> WarningGlyph(Glyph expectedGlyph)
            => SymbolGlyph(expectedGlyph);

        internal static void AssertSection(
            string expectedText,
            ImmutableArray<QuickInfoSection> sections,
            string textBlockKind,
            FormattedClassification[] expectedClassifications = null)
        {
            var textBlock = sections.FirstOrDefault(tb => tb.Kind == textBlockKind);
            var text = textBlock != null ? textBlock.TaggedParts : ImmutableArray<TaggedText>.Empty;
            AssertTaggedText(expectedText, text, expectedClassifications);
        }

        protected static void AssertTaggedText(
            string expectedText,
            ImmutableArray<TaggedText> taggedText,
#pragma warning disable IDE0060 // Remove unused parameter - https://github.com/dotnet/roslyn/issues/45893
            FormattedClassification[] expectedClassifications = null)
#pragma warning restore IDE0060 // Remove unused parameter
        {
            var actualText = string.Concat(taggedText.Select(tt => tt.Text));
            Assert.Equal(expectedText, actualText);
        }

        protected static Action<QuickInfoItem> MainDescription(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.Description, expectedClassifications);
        }

        protected static Action<QuickInfoItem> Documentation(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.DocumentationComments, expectedClassifications);
        }

        protected static Action<QuickInfoItem> Remarks(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.RemarksDocumentationComments, expectedClassifications);
        }

        protected static Action<QuickInfoItem> Returns(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.ReturnsDocumentationComments, expectedClassifications);
        }

        protected static Action<QuickInfoItem> Value(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.ValueDocumentationComments, expectedClassifications);
        }

        protected static Action<QuickInfoItem> TypeParameterMap(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.TypeParameters, expectedClassifications);
        }

        protected static Action<QuickInfoItem> AnonymousTypes(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.AnonymousTypes, expectedClassifications);
        }

        protected static Action<QuickInfoItem> NullabilityAnalysis(
            string expectedText,
            FormattedClassification[] expectedClassifications = null)
        {
            return item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.NullabilityAnalysis, expectedClassifications);
        }

        protected static Action<QuickInfoItem> NoTypeParameterMap
        {
            get
            {
                return item => AssertSection(string.Empty, item.Sections, QuickInfoSectionKinds.TypeParameters);
            }
        }

        protected static Action<QuickInfoItem> Usage(string expectedText, bool expectsWarningGlyph = false)
        {
            return item =>
            {
                AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.Usage);

                if (expectsWarningGlyph)
                {
                    WarningGlyph(Glyph.CompletionWarning)(item);
                }
                else
                {
                    Assert.DoesNotContain(Glyph.CompletionWarning, item.Tags.GetGlyphs());
                }
            };
        }

        protected static Action<QuickInfoItem> Exceptions(string expectedText)
            => item => AssertSection(expectedText, item.Sections, QuickInfoSectionKinds.Exception);

        protected static Action<QuickInfoItem> Captures(string capturesText)
            => item => AssertSection(capturesText, item.Sections, QuickInfoSectionKinds.Captures);

        protected static async Task<bool> CanUseSpeculativeSemanticModelAsync(Document document, int position)
        {
            var service = document.GetLanguageService<ISyntaxFactsService>();
            var node = (await document.GetSyntaxRootAsync()).FindToken(position).Parent;

            return !service.GetMemberBodySpanForSpeculativeBinding(node).IsEmpty;
        }

        protected abstract Task TestAsync(string markup, params Action<QuickInfoItem>[] expectedResults);
    }
}


text:
(function( $ ) {

$.widget("ui.selectmenu", {
	options: {
		appendTo: ".select-group",
		typeAhead: 1000,
		style: 'dropdown',
		positionOptions: null,
		width: null,
		menuWidth: null,
		handleWidth: 26,
		maxHeight: null,
		icons: null,
		format: null,
		escapeHtml: false,
		bgImage: function() {}
	},

	_create: function() {
		var self = this, o = this.options;

		// make / set unique id
		var selectmenuId = this.element.uniqueId().attr( "id" );

		// quick array of button and menu id's
		this.ids = [ selectmenuId, selectmenuId + '-button', selectmenuId + '-menu' ];

		// define safe mouseup for future toggling
		this._safemouseup = true;
		this.isOpen = false;

		// create menu button wrapper
		this.newelement = $( '', {
			'class': 'ui-selectmenu ui-widget ui-state-default ui-corner-all',
			'id' : this.ids[ 1 ],
			'role': 'button',
			'href': '#nogo',
			'tabindex': this.element.attr( 'disabled' ) ? 1 : 0,
			'aria-haspopup': true,
			'aria-owns': this.ids[ 2 ]
		});
		this.newelementWrap = $( "" )
			.append( this.newelement )
			.insertAfter( this.element );

		// transfer tabindex
		var tabindex = this.element.attr( 'tabindex' );
		if ( tabindex ) {
			this.newelement.attr( 'tabindex', tabindex );
		}

		// save reference to select in data for ease in calling methods
		this.newelement.data( 'selectelement', this.element );

		// menu icon
		this.selectmenuIcon = $( '' )
			.prependTo( this.newelement );

		// append status span to button
		this.newelement.prepend( '' );

		// make associated form label trigger focus
		this.element.bind({
			'click.selectmenu':  function( event ) {
				self.newelement.focus();
				event.preventDefault();
			}
		});

		// click toggle for menu visibility
		this.newelement
			.bind( 'mousedown.selectmenu', function( event ) {
				self._toggle( event, true );
				// make sure a click won't open/close instantly
				if ( o.style == "popup" ) {
					self._safemouseup = false;
					setTimeout( function() { self._safemouseup = true; }, 300 );
				}

				event.preventDefault();
			})
			.bind( 'click.selectmenu', function( event ) {
				event.preventDefault();
			})
			.bind( "keydown.selectmenu", function( event ) {
				var ret = false;
				switch ( event.keyCode ) {
					case $.ui.keyCode.ENTER:
						ret = true;
						break;
					case $.ui.keyCode.SPACE:
						self._toggle( event );
						break;
					case $.ui.keyCode.UP:
						if ( event.altKey ) {
							self.open( event );
						} else {
							self._moveSelection( -1 );
						}
						break;
					case $.ui.keyCode.DOWN:
						if ( event.altKey ) {
							self.open( event );
						} else {
							self._moveSelection( 1 );
						}
						break;
					case $.ui.keyCode.LEFT:
						self._moveSelection( -1 );
						break;
					case $.ui.keyCode.RIGHT:
						self._moveSelection( 1 );
						break;
					case $.ui.keyCode.TAB:
						ret = true;
						break;
					case $.ui.keyCode.PAGE_UP:
					case $.ui.keyCode.HOME:
						self.index( 0 );
						break;
					case $.ui.keyCode.PAGE_DOWN:
					case $.ui.keyCode.END:
						self.index( self._optionLis.length );
						break;
					default:
						ret = true;
				}
				return ret;
			})
			.bind( 'keypress.selectmenu', function( event ) {
				if ( event.which > 0 ) {
					self._typeAhead( event.which, 'mouseup' );
				}
				return true;
			})
			.bind( 'mouseover.selectmenu', function() {
				if ( !o.disabled ) $( this ).addClass( 'ui-state-hover' );
			})
			.bind( 'mouseout.selectmenu', function() {
				if ( !o.disabled ) $( this ).removeClass( 'ui-state-hover' );
			})
			.bind( 'focus.selectmenu', function() {
				if ( !o.disabled ) $( this ).addClass( 'ui-state-focus' );
			})
			.bind( 'blur.selectmenu', function() {
				if (!o.disabled) $( this ).removeClass( 'ui-state-focus' );
			});

		// document click closes menu
		$( document ).bind( "mousedown.selectmenu-" + this.ids[ 0 ], function( event ) {
			//check if open and if the clicket targes parent is the same
			if ( self.isOpen && self.ids[ 1 ] != event.target.offsetParent.id ) {
				self.close( event );
			}
		});

		// change event on original selectmenu
		this.element
			.bind( "click.selectmenu", function() {
				self._refreshValue();
			})
			// FIXME: newelement can be null under unclear circumstances in IE8
			// TODO not sure if this is still a problem (fnagel 20.03.11)
			.bind( "focus.selectmenu", function() {
				if ( self.newelement ) {
					self.newelement[ 0 ].focus();
				}
			});

		// set width when not set via options
		if ( !o.width ) {
			o.width = this.element.outerWidth();
		}
		// set menu button width
		this.newelement.width( o.width );

		// hide original selectmenu element
		this.element.hide();

		// create menu portion, append to body
		this.list = $( '
', {
			'class': 'ui-widget ui-widget-content',
			'aria-hidden': true,
			'role': 'listbox',
			'aria-labelledby': this.ids[ 1 ],
			'id': this.ids[ 2 ]
		});
		this.listWrap = $( "
", {
			'class': 'ui-selectmenu-menu'
		}).append( this.list ).appendTo( o.appendTo );

		// transfer menu click to menu button
		this.list
			.bind("keydown.selectmenu", function(event) {
				var ret = false;
				switch ( event.keyCode ) {
					case $.ui.keyCode.UP:
						if ( event.altKey ) {
							self.close( event, true );
						} else {
							self._moveFocus( -1 );
						}
						break;
					case $.ui.keyCode.DOWN:
						if ( event.altKey ) {
							self.close( event, true );
						} else {
							self._moveFocus( 1 );
						}
						break;
					case $.ui.keyCode.LEFT:
						self._moveFocus( -1 );
						break;
					case $.ui.keyCode.RIGHT:
						self._moveFocus( 1 );
						break;
					case $.ui.keyCode.HOME:
						self._moveFocus( ':first' );
						break;
					case $.ui.keyCode.PAGE_UP:
						self._scrollPage( 'up' );
						break;
					case $.ui.keyCode.PAGE_DOWN:
						self._scrollPage( 'down' );
						break;
					case $.ui.keyCode.END:
						self._moveFocus( ':last' );
						break;
					case $.ui.keyCode.ENTER:
					case $.ui.keyCode.SPACE:
						self.close( event, true);
						$( event.target ).parents( 'li:eq(0)' ).trigger( 'mouseup' );
						break;
					case $.ui.keyCode.TAB:
						ret = true;
						self.close( event, true );
						$( event.target ).parents( 'li:eq(0)' ).trigger( 'mouseup' );
						break;
					case $.ui.keyCode.ESCAPE:
						self.close( event, true );
						break;
					default:
						ret = true;
				}
				return ret;
			})
			.bind( 'keypress.selectmenu', function( event ) {
				if ( event.which > 0 ) {
					self._typeAhead( event.which, 'focus' );
				}
				return true;
			})
			// this allows for using the scrollbar in an overflowed list
			.bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; });

		// needed when window is resized
		$( window ).bind( "resize.selectmenu-" + this.ids[ 0 ], $.proxy( self.close, this ) );
	},

	_init: function() {
		var self = this, o = this.options;

		// serialize selectmenu element options
		var selectOptionData = [];
		this.element.find( 'option' ).each( function() {
			var opt = $( this );
			selectOptionData.push({
				value: opt.attr( 'value' ),
				text: self._formatText( opt.text(), opt ),
				selected: opt.attr( 'selected' ),
				disabled: opt.attr( 'disabled' ),
				classes: opt.attr( 'class' ),
				typeahead: opt.attr( 'typeahead'),
				parentOptGroup: opt.parent( 'optgroup' ),
				bgImage: o.bgImage.call( opt )
			});
		});

		// active state class is only used in popup style
		var activeClass = ( self.options.style == "popup" ) ? " ui-state-active" : "";

		// empty list so we can refresh the selectmenu via selectmenu()
		this.list.html( "" );

		// write li's
		if ( selectOptionData.length ) {
			for ( var i = 0; i < selectOptionData.length; i++ ) {
				var thisLiAttr = { role : 'presentation' };
				if ( selectOptionData[ i ].disabled ) {
					thisLiAttr[ 'class' ] = 'ui-state-disabled';
				}
				var thisAAttr = {
					html: selectOptionData[ i ].text || ' ',
					href: '#nogo',
					tabindex : -1,
					role: 'option',
					'aria-selected' : false
				};
				if ( selectOptionData[ i ].disabled ) {
					thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled;
				}
				if ( selectOptionData[ i ].typeahead ) {
					thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead;
				}
				var thisA = $( '', thisAAttr )
					.bind( 'focus.selectmenu', function() {
						$( this ).parent().mouseover();
					})
					.bind( 'blur.selectmenu', function() {
						$( this ).parent().mouseout();
					});
				var thisLi = $( '
', thisLiAttr )
					.append( thisA )
					.data( 'index', i )
					.addClass( selectOptionData[ i ].classes )
					.data( 'optionClasses', selectOptionData[ i ].classes || '' )
					.bind( "mouseup.selectmenu", function( event ) {
						if ( self._safemouseup && !self._disabled( event.currentTarget ) && !self._disabled( $( event.currentTarget ).parents( "ul > li.ui-selectmenu-group " ) ) ) {
							self.index( $( this ).data( 'index' ) );
							self.select( event );
							self.close( event, true );
						}
						return false;
					})
					.bind( "click.selectmenu", function() {
						return false;
					})
					.bind('mouseover.selectmenu', function( e ) {
						// no hover if diabled
						if ( !$( this ).hasClass( 'ui-state-disabled' ) && !$( this ).parent( "ul" ).parent( "li" ).hasClass( 'ui-state-disabled' ) ) {
							e.optionValue = self.element[ 0 ].options[ $( this ).data( 'index' ) ].value;
							self._trigger( "hover", e, self._uiHash() );
							self._selectedOptionLi().addClass( activeClass );
							self._focusedOptionLi().removeClass( 'ui-selectmenu-item-focus ui-state-hover' );
							$( this ).removeClass( 'ui-state-active' ).addClass( 'ui-selectmenu-item-focus ui-state-hover' );
						}
					})
					.bind( 'mouseout.selectmenu', function( e ) {
						if ( $( this ).is( self._selectedOptionLi() ) ) {
							$( this ).addClass( activeClass );
						}
						e.optionValue = self.element[ 0 ].options[ $( this ).data( 'index' ) ].value;
						self._trigger( "blur", e, self._uiHash() );
						$( this ).removeClass( 'ui-selectmenu-item-focus ui-state-hover' );
					});

				// optgroup or not...
				if ( selectOptionData[ i ].parentOptGroup.length ) {
					var optGroupName = 'ui-selectmenu-group-' + this.element.find( 'optgroup' ).index( selectOptionData[ i ].parentOptGroup );
					if ( this.list.find( 'li.' + optGroupName ).length ) {
						this.list.find( 'li.' + optGroupName + ':last ul' ).append( thisLi );
					} else {
						$( '
' + selectOptionData[ i ].parentOptGroup.attr( 'label' ) + '

' )
							.appendTo( this.list )
							.find( 'ul' )
							.append( thisLi );
					}
				} else {
					thisLi.appendTo( this.list );
				}

				// append icon if option is specified
				if ( o.icons ) {
					for ( var j in o.icons ) {
						if (thisLi.is(o.icons[ j ].find)) {
							thisLi
								.data( 'optionClasses', selectOptionData[ i ].classes + ' ui-selectmenu-hasIcon' )
								.addClass( 'ui-selectmenu-hasIcon' );
							var iconClass = o.icons[ j ].icon || "";
							thisLi
								.find( 'a:eq(0)' )
								.prepend( '' );
							if ( selectOptionData[ i ].bgImage ) {
								thisLi.find( 'span' ).css( 'background-image', selectOptionData[ i ].bgImage );
							}
						}
					}
				}
			}
		} else {
			$('

' ).appendTo( this.list );
		}
		// we need to set and unset the CSS classes for dropdown and popup style
		var isDropDown = ( o.style == 'dropdown' );
		this.newelement
			.toggleClass( 'ui-selectmenu-dropdown', isDropDown )
			.toggleClass( 'ui-selectmenu-popup', !isDropDown );
		this.list
			.toggleClass( 'ui-selectmenu-menu-dropdown ui-corner-bottom', isDropDown )
			.toggleClass( 'ui-selectmenu-menu-popup ui-corner-all', !isDropDown )
			// add corners to top and bottom menu items
			.find( 'li:first' )
			.toggleClass( 'ui-corner-top', !isDropDown )
			.end().find( 'li:last' )
			.addClass( 'ui-corner-bottom' );
		this.selectmenuIcon
			.toggleClass( 'ui-icon-triangle-1-s', isDropDown )
			.toggleClass( 'ui-icon-triangle-2-n-s', !isDropDown );

		// set menu width to either menuWidth option value, width option value, or select width
		if ( o.style == 'dropdown' ) {
			this.list.width( o.menuWidth ? o.menuWidth : o.width );
		} else {
			this.list.width( o.menuWidth ? o.menuWidth : o.width - o.handleWidth );
		}

		// reset height to auto
		this.list.css( 'height', 'auto' );
		var listH = this.listWrap.height();
		var winH = $( window ).height();
		// calculate default max height
		var maxH = o.maxHeight ? Math.min( o.maxHeight, winH ) : winH / 3;
		if ( listH > maxH ) this.list.height( maxH );

		// save reference to actionable li's (not group label li's)
		this._optionLis = this.list.find( 'li:not(.ui-selectmenu-group)' );

		// transfer disabled state
		if ( this.element.attr( 'disabled' ) ) {
			this.disable();
		} else {
			this.enable();
		}

		// update value
		this._refreshValue();

		// set selected item so movefocus has intial state
		this._selectedOptionLi().addClass( 'ui-selectmenu-item-focus' );

		// needed when selectmenu is placed at the very bottom / top of the page
		clearTimeout( this.refreshTimeout );
		this.refreshTimeout = window.setTimeout( function () {
			self._refreshPosition();
		}, 200 );
	},

	destroy: function() {
		this.element.removeData( this.widgetName )
			.removeClass( 'ui-selectmenu-disabled' + ' ' + 'ui-state-disabled' )
			.removeAttr( 'aria-disabled' )
			.unbind( ".selectmenu" );

		$( window ).unbind( ".selectmenu-" + this.ids[ 0 ] );
		$( document ).unbind( ".selectmenu-" + this.ids[ 0 ] );

		this.newelementWrap.remove();
		this.listWrap.remove();

		// unbind click event and show original select
		this.element
			.unbind( ".selectmenu" )
			.show();

		// call widget destroy function
		$.Widget.prototype.destroy.apply( this, arguments );
	},

	_typeAhead: function( code, eventType ) {
		var self = this,
			c = String.fromCharCode( code ).toLowerCase(),
			matchee = null,
			nextIndex = null;

		// Clear any previous timer if present
		if ( self._typeAhead_timer ) {
			window.clearTimeout( self._typeAhead_timer );
			self._typeAhead_timer = undefined;
		}
		// Store the character typed
		self._typeAhead_chars = ( self._typeAhead_chars === undefined ? "" : self._typeAhead_chars ).concat( c );
		// Detect if we are in cyciling mode or direct selection mode
		if ( self._typeAhead_chars.length < 2 || ( self._typeAhead_chars.substr( -2, 1 ) === c && self._typeAhead_cycling ) ) {
			self._typeAhead_cycling = true;
			// Match only the first character and loop
			matchee = c;
		} else {
			// We won't be cycling anymore until the timer expires
			self._typeAhead_cycling = false;
			// Match all the characters typed
			matchee = self._typeAhead_chars;
		}

		// We need to determine the currently active index, but it depends on
		// the used context: if it's in the element, we want the actual
		// selected index, if it's in the menu, just the focused one
		var selectedIndex = ( eventType !== 'focus' ? this._selectedOptionLi().data( 'index' ) : this._focusedOptionLi().data( 'index' )) || 0;
		for ( var i = 0; i < this._optionLis.length; i++ ) {
			var thisText = this._optionLis.eq( i ).text().substr( 0, matchee.length ).toLowerCase();
			if ( thisText === matchee ) {
				if ( self._typeAhead_cycling ) {
					if ( nextIndex === null )
						nextIndex = i;
					if ( i > selectedIndex ) {
						nextIndex = i;
						break;
					}
				} else {
					nextIndex = i;
				}
			}
		}

		if ( nextIndex !== null ) {
			// Why using trigger() instead of a direct method to select the index? Because we don't what is the exact action to do,
			// it depends if the user is typing on the element or on the popped up menu
			this._optionLis.eq( nextIndex ).find( "a" ).trigger( eventType );
		}

		self._typeAhead_timer = window.setTimeout( function() {
			self._typeAhead_timer = undefined;
			self._typeAhead_chars = undefined;
			self._typeAhead_cycling = undefined;
		}, self.options.typeAhead );
	},

	// returns some usefull information, called by callbacks only
	_uiHash: function() {
		var index = this.index();
		return {
			index: index,
			option: $( "option", this.element ).get( index ),
			value: this.element[ 0 ].value
		};
	},

	open: function( event ) {
		if ( this.newelement.attr( "aria-disabled" ) != 'true' ) {
			var self = this,
				o = this.options,
				selected = this._selectedOptionLi(),
				link = selected.find("a");

			self._closeOthers( event );
			self.newelement.addClass( 'ui-state-active' );
			self.list.attr( 'aria-hidden', false );
			self.listWrap.addClass( 'ui-selectmenu-open' );

			if ( o.style == "dropdown" ) {
				self.newelement.removeClass( 'ui-corner-all' ).addClass( 'ui-corner-top' );
			} else {
				// center overflow and avoid flickering
				this.list
					.css( "left", -5000 )
					.scrollTop( this.list.scrollTop() + selected.position().top - this.list.outerHeight() / 2 + selected.outerHeight() / 2 )
					.css( "left", "auto" );
			}

			self._refreshPosition();

			if ( link.length ) {
				link[ 0 ].focus();
			}

			self.isOpen = true;
			self._trigger( "open", event, self._uiHash() );
		}
	},

	close: function( event, retainFocus ) {
		if ( this.newelement.is( '.ui-state-active') ) {
			this.newelement.removeClass( 'ui-state-active' );
			this.listWrap.removeClass( 'ui-selectmenu-open' );
			this.list.attr( 'aria-hidden', true );
			if ( this.options.style == "dropdown" ) {
				this.newelement.removeClass( 'ui-corner-top' ).addClass( 'ui-corner-all' );
			}
			if ( retainFocus ) {
				this.newelement.focus();
			}
			this.isOpen = false;
			this._trigger( "close", event, this._uiHash() );
		}
	},

	change: function( event ) {
		this.element.trigger( "change" );
		this._trigger( "change", event, this._uiHash() );
	},

	select: function( event ) {
		if ( this._disabled( event.currentTarget ) ) { return false; }
		this._trigger( "select", event, this._uiHash() );
	},

	widget: function() {
		return this.listWrap.add( this.newelementWrap );
	},

	_closeOthers: function( event ) {
		$( '.ui-selectmenu.ui-state-active' ).not( this.newelement ).each( function() {
			$( this ).data( 'selectelement' ).selectmenu( 'close', event );
		});
		$( '.ui-selectmenu.ui-state-hover' ).trigger( 'mouseout' );
	},

	_toggle: function( event, retainFocus ) {
		if ( this.isOpen ) {
			this.close( event, retainFocus );
		} else {
			this.open( event );
		}
	},

	_formatText: function( text, opt ) {
		if ( this.options.format ) {
			text = this.options.format( text, opt );
		} else if ( this.options.escapeHtml ) {
			text = $( '
' ).text( text ).html();
		}
		return text;
	},

	_selectedIndex: function() {
		return this.element[ 0 ].selectedIndex;
	},

	_selectedOptionLi: function() {
		return this._optionLis.eq( this._selectedIndex() );
	},

	_focusedOptionLi: function() {
		return this.list.find( '.ui-selectmenu-item-focus' );
	},

	_moveSelection: function( amt, recIndex ) {
		// do nothing if disabled
		if ( !this.options.disabled ) {
			var currIndex = parseInt( this._selectedOptionLi().data( 'index' ) || 0, 10 );
			var newIndex = currIndex + amt;
			// do not loop when using up key
			if ( newIndex < 0 ) {
				newIndex = 0;
			}
			if ( newIndex > this._optionLis.size() - 1 ) {
				newIndex = this._optionLis.size() - 1;
			}
			// Occurs when a full loop has been made
			if ( newIndex === recIndex ) {
				return false;
			}

			if ( this._optionLis.eq( newIndex ).hasClass( 'ui-state-disabled' ) ) {
				// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
				( amt > 0 ) ? ++amt : --amt;
				this._moveSelection( amt, newIndex );
			} else {
				this._optionLis.eq( newIndex ).trigger( 'mouseover' ).trigger( 'mouseup' );
			}
		}
	},

	_moveFocus: function( amt, recIndex ) {
		if ( !isNaN( amt ) ) {
			var currIndex = parseInt( this._focusedOptionLi().data( 'index' ) || 0, 10 );
			var newIndex = currIndex + amt;
		} else {
			var newIndex = parseInt( this._optionLis.filter( amt ).data( 'index' ), 10 );
		}

		if ( newIndex < 0 ) {
			newIndex = 0;
		}
		if ( newIndex > this._optionLis.size() - 1 ) {
			newIndex = this._optionLis.size() - 1;
		}

		//Occurs when a full loop has been made
		if ( newIndex === recIndex ) {
			return false;
		}

		var activeID = 'ui-selectmenu-item-' + Math.round( Math.random() * 1000 );

		this._focusedOptionLi().find( 'a:eq(0)' ).attr( 'id', '' );

		if ( this._optionLis.eq( newIndex ).hasClass( 'ui-state-disabled' ) ) {
			// if option at newIndex is disabled, call _moveFocus, incrementing amt by one
			( amt > 0 ) ? ++amt : --amt;
			this._moveFocus( amt, newIndex );
		} else {
			this._optionLis.eq( newIndex ).find( 'a:eq(0)' ).attr( 'id',activeID ).focus();
		}

		this.list.attr( 'aria-activedescendant', activeID );
	},

	_scrollPage: function( direction ) {
		var numPerPage = Math.floor( this.list.outerHeight() / this._optionLis.first().outerHeight() );
		numPerPage = ( direction == 'up' ? -numPerPage : numPerPage );
		this._moveFocus( numPerPage );
	},

	_setOption: function( key, value ) {
		this.options[ key ] = value;
		// set
		if ( key == 'disabled' ) {
			if ( value ) this.close();
			this.element
				.add( this.newelement )
				.add( this.list )[ value ? 'addClass' : 'removeClass' ]( 'ui-selectmenu-disabled ' + 'ui-state-disabled' )
				.attr( "aria-disabled" , value );
		}
	},

	disable: function( index, type ){
			// if options is not provided, call the parents disable function
			if ( typeof( index ) == 'undefined' ) {
				this._setOption( 'disabled', true );
			} else {
				if ( type == "optgroup" ) {
					this._toggleOptgroup( index, false );
				} else {
					this._toggleOption( index, false );
				}
			}
	},

	enable: function( index, type ) {
			// if options is not provided, call the parents enable function
			if ( typeof( index ) == 'undefined' ) {
				this._setOption( 'disabled', false );
			} else {
				if ( type == "optgroup" ) {
					this._toggleOptgroup( index, true );
				} else {
					this._toggleOption( index, true );
				}
			}
	},

	_disabled: function( elem ) {
			return $( elem ).hasClass( 'ui-state-disabled' );
	},

	_toggleOption: function( index, flag ) {
		var optionElem = this._optionLis.eq( index );
		if ( optionElem ) {
				optionElem
					.toggleClass( 'ui-state-disabled', flag )
					.find( "a" ).attr( "aria-disabled", !flag );
			if ( flag ) {
				this.element.find( "option" ).eq( index ).attr( "disabled", "disabled" );
			} else {
				this.element.find( "option" ).eq( index ).removeAttr( "disabled" );
			}
		}
	},

	// true = enabled, false = disabled
	_toggleOptgroup: function( index, flag ) {
			var optGroupElem = this.list.find( 'li.ui-selectmenu-group-' + index );
			if ( optGroupElem ) {
				optGroupElem
					.toggleClass( 'ui-state-disabled', flag )
					.attr( "aria-disabled", !flag );
				if ( flag ) {
					this.element.find( "optgroup" ).eq( index ).attr( "disabled", "disabled" );
				} else {
					this.element.find( "optgroup" ).eq( index ).removeAttr( "disabled" );
				}
			}
	},

	index: function( newIndex ) {
		if ( arguments.length ) {
			if ( !this._disabled( $( this._optionLis[ newIndex ] ) ) && newIndex != this._selectedIndex() ) {
				this.element[ 0 ].selectedIndex = newIndex;
				this._refreshValue();
				this.change();
			} else {
				return false;
			}
		} else {
			return this._selectedIndex();
		}
	},

	value: function( newValue ) {
		if ( arguments.length && newValue != this.element[ 0 ].value ) {
			this.element[ 0 ].value = newValue;
			this._refreshValue();
			this.change();
		} else {
			return this.element[ 0 ].value;
		}
	},

	_refreshValue: function() {
		var activeClass = ( this.options.style == "popup" ) ? " ui-state-active" : "";
		var activeID = 'ui-selectmenu-item-' + Math.round( Math.random() * 1000 );
		// deselect previous
		this.list
			.find( '.ui-selectmenu-item-selected' )
			.removeClass( "ui-selectmenu-item-selected" + activeClass )
			.find('a')
			.attr( 'aria-selected', 'false' )
			.attr( 'id', '' );
		// select new
		this._selectedOptionLi()
			.addClass( "ui-selectmenu-item-selected" + activeClass )
			.find( 'a' )
			.attr( 'aria-selected', 'true' )
			.attr( 'id', activeID );

		// toggle any class brought in from option
		var currentOptionClasses = ( this.newelement.data( 'optionClasses' ) ? this.newelement.data( 'optionClasses' ) : "" );
		var newOptionClasses = ( this._selectedOptionLi().data( 'optionClasses' ) ? this._selectedOptionLi().data( 'optionClasses' ) : "" );
		this.newelement
			.removeClass( currentOptionClasses )
			.data( 'optionClasses', newOptionClasses )
			.addClass( newOptionClasses )
			.find( '.ui-selectmenu-status' )
			.html( this._selectedOptionLi().find( 'a:eq(0)' ).html() );

		this.list.attr( 'aria-activedescendant', activeID );
	},

	_refreshPosition: function() {
		var o = this.options,
			positionDefault = {
				of: this.newelement,
				my: "left top",
				at: "left bottom",
				collision: 'flip'
			};

		// if its a pop-up we need to calculate the position of the selected li
		if ( o.style == "popup" ) {
			var selected = this._selectedOptionLi();
			positionDefault.my = "left top" + ( this.list.offset().top - selected.offset().top - ( this.newelement.outerHeight() + selected.outerHeight() ) / 2 );
			positionDefault.collision = "fit";
		}

		this.listWrap
			.removeAttr( 'style' )
			.zIndex( this.element.zIndex() + 1 )
			.position( $.extend( positionDefault, o.positionOptions ) );
	}
});

})( jQuery );


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
    Public Class WithBlockHighlighterTests
        Inherits AbstractVisualBasicKeywordHighlighterTests

        Friend Overrides Function CreateHighlighter() As IHighlighter
            Return New WithBlockHighlighter()
        End Function

        <WpfFact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
        Public Sub TestWithBlock1()
            Test(<Text>
Class C
Sub M()
{|Cursor:[|With|]|} y
.x = 10
Console.WriteLine(.x)
[|End With|]
End Sub
End Class</Text>)
        End Sub

        <WpfFact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
        Public Sub TestWithBlock2()
            Test(<Text>
Class C
Sub M()
[|With|] y
.x = 10
Console.WriteLine(.x)
{|Cursor:[|End With|]|}
End Sub
End Class</Text>)
        End Sub
    End Class
End Namespace


text:
module ParseGlue where

data ParseResult a = OkP a | FailP String
type P a = String -> Int -> ParseResult a

thenP :: P a -> (a -> P b) -> P b
m `thenP`  k = \ s l ->
  case m s l of
    OkP a -> k a s l
    FailP s -> FailP s

returnP :: a -> P a
returnP m _ _ = OkP m

failP :: String -> P a
failP s s' _ = FailP (s ++ ":" ++ s')

data Token =
   TKoparen
 | TKcparen
 | TKosquare
 | TKcsquare
 | TKcomma
 | TKdot
 | TKvline
 | TKampersand
 | TKat
 | TKcolon
 | TKlangle
 | TKrangle
 | TKbang
 | TKquestion
 | TKequal
 | TKtilde
 | TKdollar
 | TKroof
 | TKthf
 | TKaxiom
 | TKlemma
 | TKhypothesis
 | TKdefinition
 | TKconjecture
 | TKtype
 | TKinclude
 | TKuppercasename String
 | TKlowercasename String
 | TKstring String
 | TKEOF


text:
<!DOCTYPE html>

		<meta charset="utf-8">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="author" content="Ina Bankova, Peter Fessel">
		<meta name="description" content="InteractiveSoundGraph is an interactive Browser application. It uses a visual representation in form of a graph to create music.">

		<link rel="canonical" href=""/>

		<meta property="og:title" content="Interactive Sound Graph" />
		<meta property="og:type" content="website" />
		<meta property="og:image" content="" />
		<meta property="og:description" content="" />
		<meta property="og:url" content="">

		<title>Interactive Sound Graph</title>

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

Interactive Sound Graph

loopOnloopOff

soundOnsoundOff

clear

info

saveGraph

loadGraph

  choose sound an then klick on the black canvas to create new node

 speed

 UP

 DOWN

sound:

			<select id="banch-select" size="1">
			</select>

				InteractiveSoundGraph is an interactive Browser application. It uses a visual representation in form of a graph to create music.

				You can select different sounds in the bottom area. The sounds are grouped in batches that each represent certain sound categories like drum sounds, synthesizer sounds, fx sounds and so on. The sound with the red label is the currently selected one. Initially this is the most left sound of the batch.

				To create a sound node just click on the canvas and a node representing the sound that is currently selected will be placed on the canvas. If you click 'loopOn' the sound will start to play in a loop.

				You can connect nodes by clicking on the canvas with already existing nodes inside the cursor's outer circle. If the cursor's scope doesn't fit with the nodes you want to connect, you can rearrange the nodes via drag and drop. A new node will then be added with connections to the other nodes. Connected nodes will be played one after another, while graphs that are not connected will all be playing at the same time.

				Made by Peter Fessel and Ina Bankova. This project is open source! Go to it's Github Repository to check out the code.

			You can select different sounds in the bottom area. The sounds are grouped in batches that each represent certain sound categories like drum sounds, synthesizer sounds, fx sounds and so on. The sound with the red label is the currently selected one. Initially this is the most left sound of the batch.

			To create a sound node just click on the canvas and a node representing the sound that is currently selected will be placed on the canvas. If you click 'loopOn' the sound will start to play in a loop.
			To  change the sound for a node, select it, select another sound and then press Enter.
			To delete a sound node just select the node and press Delete.


text:
<?xml version="1.0"?>
<package>
  <name>descartes_moveit</name>
  <version>0.0.1</version>
  <description>Moveit wrapper functions for descartes base types</description>

  <maintainer email="jnicho@swri.org">Jorge Nicho</maintainer>
  <maintainer email="jonathan.meyer@swri.org">Jonathan Meyer</maintainer>
  <maintainer email="sedwards@swri.org">Shaun Edwards</maintainer>

  <license>Apache2</license>

  <author >Shaun Edwards</author>

  <buildtool_depend>catkin</buildtool_depend>

  <build_depend>rosconsole_bridge</build_depend>
  <build_depend>moveit_core</build_depend>
  <build_depend>tf</build_depend>
  <build_depend>cmake_modules</build_depend>
  <build_depend>descartes_core</build_depend>
  <build_depend>descartes_trajectory</build_depend>
  <build_depend>moveit_ros_planning</build_depend>
  <build_depend>pluginlib</build_depend>
  <build_depend>eigen</build_depend>

  <run_depend>rosconsole_bridge</run_depend>
  <run_depend>moveit_core</run_depend>
  <run_depend>tf</run_depend>
  <run_depend>cmake_modules</run_depend>
  <run_depend>descartes_core</run_depend>
  <run_depend>descartes_trajectory</run_depend>
  <run_depend>moveit_ros_planning</run_depend>
  <run_depend>pluginlib</run_depend>

  <test_depend>rosunit</test_depend>

  <export>
    <descartes_core plugin="${prefix}/moveit_adapter_plugins.xml"/>
    <rosdoc config="rosdoc.yaml"/>
  </export>
</package>


text:
<?php

namespace Oro\Bundle\LocaleBundle\Migrations\Data\Demo\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityRepository;
use Oro\Bundle\LocaleBundle\Entity\Localization;
use Oro\Bundle\TranslationBundle\Entity\Language;
use Oro\Bundle\TranslationBundle\Migrations\Data\Demo\ORM\LoadLanguageDemoData;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Intl\Locales;

class LoadLocalizationDemoData extends AbstractFixture implements ContainerAwareInterface, DependentFixtureInterface
{
    /**
     * @var array
     */
    protected $localizations = [
        ['language' => LoadLanguageDemoData::LANG_EN_US, 'formatting' => 'en_US', 'parent' => null],
        ['language' => LoadLanguageDemoData::LANG_EN_CA, 'formatting' => 'en_CA', 'parent' => 'en_US'],
        ['language' => LoadLanguageDemoData::LANG_EN_GB, 'formatting' => 'en_GB', 'parent' => 'en_US'],
        ['language' => LoadLanguageDemoData::LANG_EN_AU, 'formatting' => 'en_AU', 'parent' => 'en_US'],
        ['language' => LoadLanguageDemoData::LANG_ES_AR, 'formatting' => 'es_AR', 'parent' => 'en_US'],
        ['language' => LoadLanguageDemoData::LANG_FR_CA, 'formatting' => 'fr_CA', 'parent' => 'en_CA'],
        ['language' => LoadLanguageDemoData::LANG_FR_FR, 'formatting' => 'fr_FR', 'parent' => 'fr_CA'],
        ['language' => LoadLanguageDemoData::LANG_DE_DE, 'formatting' => 'de_DE', 'parent' => 'en_US'],
    ];

    /**
     * @var ContainerInterface
     */
    protected $container;

    /**
     * {@inheritdoc}
     */
    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }

    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        $registry = [];
        $localeSettings = $this->container->get('oro_locale.settings');
        $localeCode = $localeSettings->getLocale();

        /* @var $repository EntityRepository */
        $repository = $manager->getRepository('OroLocaleBundle:Localization');

        foreach ($this->localizations as $item) {
            /** @var Language $language */
            $language = $this->getReference($item['language']);
            $name = Locales::getName($item['formatting'], $localeCode);

            $localization = $repository->findOneBy(['name' => $name]);

            if (!$localization) {
                $localization = new Localization();
                $localization
                    ->setLanguage($language)
                    ->setFormattingCode($item['formatting'])
                    ->setName($name)
                    ->setDefaultTitle($name);

                if ($item['parent']) {
                    $parentCode = $item['parent'];

                    if (isset($registry[$parentCode])) {
                        $localization->setParentLocalization($registry[$parentCode]);
                    }
                }

                $manager->persist($localization);
            }

            $registry[$language->getCode()] = $localization;

            $this->addReference('localization_' . $language->getCode(), $localization);
        }

        $manager->flush();
    }

    /**
     * {@inheritdoc}
     */
    public function getDependencies()
    {
        return [LoadLanguageDemoData::class];
    }
}


text:
#ifndef MOTION_END_DETECTION_DEBUG_H
#define MOTION_END_DETECTION_DEBUG_H

#include "../../../common/io/outputStream.h"
#include "../pidMotion.h"
#include "../parameters/pidParameter.h"
#include "motionEndDetection.h"
#include "parameters/motionEndDetectionParameter.h"

/**
 * Print a table with all end Motion Detection Parameter
 * @param outputStream the stream in which we write
 * @param parameter the pointer on the structure containing the parameters
 */
void printMotionEndDetectionParameter(OutputStream* outputStream, MotionEndDetectionParameter* parameter);

/**
 * Print an end detection status as a String of chars with a fixed length.
 * @param outputStream the stream in which we write
 * @param motionEndDetectionRegister the register to write
 * @return number of char written
 */
unsigned int appendMotionEndDetectionStatusRegister(OutputStream* outputStream, MotionEndDetectionStatusRegister motionEndDetectionStatusRegister);

/**
 * Print an end detection status as a String of chars with a fixed length in a table data compatible way
 * @param outputStream the stream in which we write
 * @param motionEndDetectionRegister the register to write
 * @param columnSize the width of the column to align data
 * @return number of char written
 */
unsigned int appendMotionEndDetectionStatusRegisterTableData(OutputStream* outputStream,
        MotionEndDetectionStatusRegister motionEndDetectionStatusRegister,
        unsigned int columnSize);

#endif


text:
<!DOCTYPE html>

		<meta charset = "utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Change Password</title>

		<link href = "static/css/bootstrap.min.css" rel = "stylesheet" />
		<!!--Custom CSS-->
        <link href = "static/css/main.css" rel = "stylesheet" />

        <link href="/media/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <link href="/media/favicon.ico" rel="icon" type="image/x-icon" />

Homi Bhabha Centre for Education

Tata Institute of Fundamental Research

            <form id="form-chpass">

					Old Password
					<input type = "password" name="oldpass" class="form-control" id = "form-chpass-oldpass" />

					New Password
					<input type = "password" name="newpass" class="form-control" id = "form-chpass-newpass" />

					Re-enter New Password
					<input type = "password" name="newpassre" class="form-control" id = "form-chpass-newpassre" />

                        <col style="width:50%">
                        <col style="width:50%">

                            <button type="submit" class="btn btn-primary">Confirm</button>
                            <button class="btn btn-default" id="back-button" >Back</button>

			</form>

                                 Copyright © Homi Bhabha Centre for Science Education, TIFR

Mumbai - India


text:
struct SControlRotationJumpData : public ControlCom::IComData {
    MotionID anim_stop_ls, anim_run_ls;
    MotionID anim_stop_rs, anim_run_rs;
    float turn_angle;

    enum EFlags {
        eStopAtOnce = u32(1) << 0, // stop at once
        eRotateOnce = u32(1) << 1, // use only the first stage
    };

    flags32 flags;
};

class CControlRotationJump : public CControl_ComCustom<SControlRotationJumpData> {
    typedef CControl_ComCustom<SControlRotationJumpData> inherited;
    u32 m_time_next_rotation_jump;

    float m_target_velocity;
    float m_start_velocity;
    float m_accel;
    float m_dist;
    float m_time;

    bool m_right_side;

    enum EStage { eStop, eRun, eNone } m_stage;

    IKinematicsAnimated* m_skeleton_animated;

public:
    virtual void reinit();

    virtual void on_event(ControlCom::EEventType, ControlCom::IEventData*);
    virtual void activate();
    virtual void on_release();
    virtual bool check_start_conditions();

private:
    void build_line_first();
    void build_line_second();
    void stop_at_once();
};


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datamigration.models;

import com.azure.core.annotation.Immutable;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Output for the task that validates connection to Azure Database for MySQL and target server requirements. */
@Immutable
public final class ConnectToTargetAzureDbForMySqlTaskOutput {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ConnectToTargetAzureDbForMySqlTaskOutput.class);

    /*
     * Result identifier
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Version of the target server
     */
    @JsonProperty(value = "serverVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String serverVersion;

    /*
     * List of databases on target server
     */
    @JsonProperty(value = "databases", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> databases;

    /*
     * Target server brand version
     */
    @JsonProperty(value = "targetServerBrandVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String targetServerBrandVersion;

    /*
     * Validation errors associated with the task
     */
    @JsonProperty(value = "validationErrors", access = JsonProperty.Access.WRITE_ONLY)
    private List<ReportableException> validationErrors;

    /**
     * Get the id property: Result identifier.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the serverVersion property: Version of the target server.
     *
     * @return the serverVersion value.
     */
    public String serverVersion() {
        return this.serverVersion;
    }

    /**
     * Get the databases property: List of databases on target server.
     *
     * @return the databases value.
     */
    public List<String> databases() {
        return this.databases;
    }

    /**
     * Get the targetServerBrandVersion property: Target server brand version.
     *
     * @return the targetServerBrandVersion value.
     */
    public String targetServerBrandVersion() {
        return this.targetServerBrandVersion;
    }

    /**
     * Get the validationErrors property: Validation errors associated with the task.
     *
     * @return the validationErrors value.
     */
    public List<ReportableException> validationErrors() {
        return this.validationErrors;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (validationErrors() != null) {
            validationErrors().forEach(e -> e.validate());
        }
    }
}


text:
using ::testing::_;
using ::testing::Invoke;
using ::testing::Return;

namespace device {

using mojom::SensorType;

class PlatformSensorFusionTest : public testing::Test {
 public:
  PlatformSensorFusionTest() {
    provider_ = std::make_unique<FakePlatformSensorProvider>();
  }

  PlatformSensorFusionTest(const PlatformSensorFusionTest&) = delete;
  PlatformSensorFusionTest& operator=(const PlatformSensorFusionTest&) = delete;

 protected:
  void CreateAccelerometer() {
    base::test::TestFuture<scoped_refptr<PlatformSensor>> future;
    provider_->CreateSensor(SensorType::ACCELEROMETER, future.GetCallback());
    accelerometer_ = static_cast<FakePlatformSensor*>(future.Get().get());
    EXPECT_TRUE(accelerometer_);
    EXPECT_EQ(SensorType::ACCELEROMETER, accelerometer_->GetType());
  }

  void CreateMagnetometer() {
    base::test::TestFuture<scoped_refptr<PlatformSensor>> future;
    provider_->CreateSensor(SensorType::MAGNETOMETER, future.GetCallback());
    magnetometer_ = static_cast<FakePlatformSensor*>(future.Get().get());
    EXPECT_TRUE(magnetometer_);
    EXPECT_EQ(SensorType::MAGNETOMETER, magnetometer_->GetType());
  }

  void CreateLinearAccelerationFusionSensor() {
    auto fusion_algorithm =
        std::make_unique<LinearAccelerationFusionAlgorithmUsingAccelerometer>();
    CreateFusionSensor(std::move(fusion_algorithm));
  }

  void CreateAbsoluteOrientationEulerAnglesFusionSensor() {
    auto fusion_algorithm = std::make_unique<
        AbsoluteOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndMagnetometer>();
    CreateFusionSensor(std::move(fusion_algorithm));
  }

  void CreateFusionSensor(
      std::unique_ptr<PlatformSensorFusionAlgorithm> fusion_algorithm) {
    base::test::TestFuture<scoped_refptr<PlatformSensor>> future;
    const SensorType type = fusion_algorithm->fused_type();
    PlatformSensorFusion::Create(provider_->GetSensorReadingBuffer(type),
                                 provider_.get(), std::move(fusion_algorithm),
                                 future.GetCallback());
    fusion_sensor_ = static_cast<PlatformSensorFusion*>(future.Get().get());
  }

  base::test::TaskEnvironment task_environment_;
  std::unique_ptr<FakePlatformSensorProvider> provider_;
  scoped_refptr<FakePlatformSensor> accelerometer_;
  scoped_refptr<FakePlatformSensor> magnetometer_;
  scoped_refptr<PlatformSensorFusion> fusion_sensor_;
};

// The following code tests creating a fusion sensor that needs one source
// sensor.

TEST_F(PlatformSensorFusionTest, SourceSensorAlreadyExists) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));
  CreateAccelerometer();
  // Now the source sensor already exists.
  EXPECT_TRUE(provider_->GetSensor(SensorType::ACCELEROMETER));

  CreateLinearAccelerationFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::LINEAR_ACCELERATION, fusion_sensor_->GetType());
}

TEST_F(PlatformSensorFusionTest, SourceSensorWorksSeparately) {
  CreateAccelerometer();
  EXPECT_TRUE(accelerometer_);
  EXPECT_FALSE(accelerometer_->IsActiveForTesting());

  auto client = std::make_unique<testing::NiceMock<MockPlatformSensorClient>>();
  accelerometer_->AddClient(client.get());
  accelerometer_->StartListening(client.get(), PlatformSensorConfiguration(10));
  EXPECT_TRUE(accelerometer_->IsActiveForTesting());

  CreateLinearAccelerationFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::LINEAR_ACCELERATION, fusion_sensor_->GetType());
  EXPECT_FALSE(fusion_sensor_->IsActiveForTesting());

  fusion_sensor_->AddClient(client.get());
  fusion_sensor_->StartListening(client.get(), PlatformSensorConfiguration(10));
  EXPECT_TRUE(fusion_sensor_->IsActiveForTesting());

  fusion_sensor_->StopListening(client.get(), PlatformSensorConfiguration(10));
  EXPECT_FALSE(fusion_sensor_->IsActiveForTesting());

  EXPECT_TRUE(accelerometer_->IsActiveForTesting());

  accelerometer_->RemoveClient(client.get());
  EXPECT_FALSE(accelerometer_->IsActiveForTesting());

  fusion_sensor_->RemoveClient(client.get());
}

namespace {

void CheckConfigsCountForClient(const scoped_refptr<PlatformSensor>& sensor,
                                PlatformSensor::Client* client,
                                size_t expected_count) {
  auto client_entry = sensor->GetConfigMapForTesting().find(client);
  if (sensor->GetConfigMapForTesting().end() == client_entry) {
    EXPECT_EQ(0u, expected_count);
    return;
  }
  EXPECT_EQ(expected_count, client_entry->second.size());
}

}  // namespace

TEST_F(PlatformSensorFusionTest, SourceSensorDoesNotKeepOutdatedConfigs) {
  CreateAccelerometer();
  EXPECT_TRUE(accelerometer_);

  CreateLinearAccelerationFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::LINEAR_ACCELERATION, fusion_sensor_->GetType());

  auto client = std::make_unique<testing::NiceMock<MockPlatformSensorClient>>(
      fusion_sensor_);
  fusion_sensor_->StartListening(client.get(), PlatformSensorConfiguration(10));
  fusion_sensor_->StartListening(client.get(), PlatformSensorConfiguration(20));
  fusion_sensor_->StartListening(client.get(), PlatformSensorConfiguration(30));

  EXPECT_EQ(1u, fusion_sensor_->GetConfigMapForTesting().size());
  EXPECT_EQ(1u, accelerometer_->GetConfigMapForTesting().size());

  CheckConfigsCountForClient(fusion_sensor_, client.get(), 3u);
  // Fusion sensor is a client for its sources, however it must keep only
  // one active configuration for them at a time.
  CheckConfigsCountForClient(accelerometer_, fusion_sensor_.get(), 1u);

  fusion_sensor_->StopListening(client.get(), PlatformSensorConfiguration(30));
  fusion_sensor_->StopListening(client.get(), PlatformSensorConfiguration(20));

  CheckConfigsCountForClient(fusion_sensor_, client.get(), 1u);
  CheckConfigsCountForClient(accelerometer_, fusion_sensor_.get(), 1u);

  fusion_sensor_->StopListening(client.get(), PlatformSensorConfiguration(10));

  CheckConfigsCountForClient(fusion_sensor_, client.get(), 0u);
  CheckConfigsCountForClient(accelerometer_, fusion_sensor_.get(), 0u);
}

TEST_F(PlatformSensorFusionTest, AllSourceSensorsStoppedOnSingleSourceFailure) {
  CreateAccelerometer();
  EXPECT_TRUE(accelerometer_);

  CreateMagnetometer();
  EXPECT_TRUE(magnetometer_);
  // Magnetometer will be started after Accelerometer for the given
  // sensor fusion algorithm.
  ON_CALL(*magnetometer_, StartSensor(_)).WillByDefault(Return(false));

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES,
            fusion_sensor_->GetType());

  auto client = std::make_unique<testing::NiceMock<MockPlatformSensorClient>>(
      fusion_sensor_);
  fusion_sensor_->StartListening(client.get(), PlatformSensorConfiguration(10));

  EXPECT_FALSE(fusion_sensor_->IsActiveForTesting());
  EXPECT_FALSE(accelerometer_->IsActiveForTesting());
  EXPECT_FALSE(magnetometer_->IsActiveForTesting());
}

TEST_F(PlatformSensorFusionTest, SourceSensorNeedsToBeCreated) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));

  CreateLinearAccelerationFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::LINEAR_ACCELERATION, fusion_sensor_->GetType());
}

TEST_F(PlatformSensorFusionTest, SourceSensorIsNotAvailable) {
  // Accelerometer is not available.
  ON_CALL(*provider_, DoCreateSensorInternal(SensorType::ACCELEROMETER, _, _))
      .WillByDefault(
          Invoke([](mojom::SensorType, scoped_refptr<PlatformSensor>,
                    FakePlatformSensorProvider::CreateSensorCallback callback) {
            std::move(callback).Run(nullptr);
          }));

  CreateLinearAccelerationFusionSensor();
  EXPECT_FALSE(fusion_sensor_);
}

// The following code tests creating a fusion sensor that needs two source
// sensors.

TEST_F(PlatformSensorFusionTest, BothSourceSensorsAlreadyExist) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));
  CreateAccelerometer();
  EXPECT_TRUE(provider_->GetSensor(SensorType::ACCELEROMETER));

  EXPECT_FALSE(provider_->GetSensor(SensorType::MAGNETOMETER));
  CreateMagnetometer();
  EXPECT_TRUE(provider_->GetSensor(SensorType::MAGNETOMETER));

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES,
            fusion_sensor_->GetType());
}

TEST_F(PlatformSensorFusionTest, BothSourceSensorsNeedToBeCreated) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));
  EXPECT_FALSE(provider_->GetSensor(SensorType::MAGNETOMETER));

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES,
            fusion_sensor_->GetType());
}

TEST_F(PlatformSensorFusionTest, BothSourceSensorsAreNotAvailable) {
  // Failure.
  ON_CALL(*provider_, DoCreateSensorInternal(_, _, _))
      .WillByDefault(
          Invoke([](mojom::SensorType, scoped_refptr<PlatformSensor>,
                    FakePlatformSensorProvider::CreateSensorCallback callback) {
            std::move(callback).Run(nullptr);
          }));

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_FALSE(fusion_sensor_);
}

TEST_F(PlatformSensorFusionTest,
       OneSourceSensorAlreadyExistsTheOtherSourceSensorNeedsToBeCreated) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));
  CreateAccelerometer();
  EXPECT_TRUE(provider_->GetSensor(SensorType::ACCELEROMETER));
  EXPECT_FALSE(provider_->GetSensor(SensorType::MAGNETOMETER));

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES,
            fusion_sensor_->GetType());
}

TEST_F(PlatformSensorFusionTest,
       OneSourceSensorAlreadyExistsTheOtherSourceSensorIsNotAvailable) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));
  CreateAccelerometer();
  EXPECT_TRUE(provider_->GetSensor(SensorType::ACCELEROMETER));

  // Magnetometer is not available.
  ON_CALL(*provider_, DoCreateSensorInternal(SensorType::MAGNETOMETER, _, _))
      .WillByDefault(
          Invoke([](mojom::SensorType, scoped_refptr<PlatformSensor>,
                    FakePlatformSensorProvider::CreateSensorCallback callback) {
            std::move(callback).Run(nullptr);
          }));

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_FALSE(fusion_sensor_);
}

TEST_F(PlatformSensorFusionTest,
       OneSourceSensorNeedsToBeCreatedTheOtherSourceSensorIsNotAvailable) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));
  // Magnetometer is not available.
  ON_CALL(*provider_, DoCreateSensorInternal(SensorType::MAGNETOMETER, _, _))
      .WillByDefault(
          Invoke([](mojom::SensorType, scoped_refptr<PlatformSensor>,
                    FakePlatformSensorProvider::CreateSensorCallback callback) {
            std::move(callback).Run(nullptr);
          }));

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_FALSE(fusion_sensor_);
}

TEST_F(PlatformSensorFusionTest,
       FusionSensorMaximumSupportedFrequencyIsTheMaximumOfItsSourceSensors) {
  EXPECT_FALSE(provider_->GetSensor(SensorType::ACCELEROMETER));
  CreateAccelerometer();
  scoped_refptr<PlatformSensor> accelerometer =
      provider_->GetSensor(SensorType::ACCELEROMETER);
  EXPECT_TRUE(accelerometer);
  static_cast<FakePlatformSensor*>(accelerometer.get())
      ->set_maximum_supported_frequency(30.0);

  EXPECT_FALSE(provider_->GetSensor(SensorType::MAGNETOMETER));
  CreateMagnetometer();
  scoped_refptr<PlatformSensor> magnetometer =
      provider_->GetSensor(SensorType::MAGNETOMETER);
  EXPECT_TRUE(magnetometer);
  static_cast<FakePlatformSensor*>(magnetometer.get())
      ->set_maximum_supported_frequency(20.0);

  CreateAbsoluteOrientationEulerAnglesFusionSensor();
  EXPECT_TRUE(fusion_sensor_);
  EXPECT_EQ(SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES,
            fusion_sensor_->GetType());
  EXPECT_EQ(30.0, fusion_sensor_->GetMaximumSupportedFrequency());
  auto client = std::make_unique<testing::NiceMock<MockPlatformSensorClient>>(
      fusion_sensor_);
  EXPECT_TRUE(fusion_sensor_->StartListening(
      client.get(), PlatformSensorConfiguration(30.0)));
}

}  //  namespace device


text:
package com.slx.funstream.di.modules;

import com.google.gson.Gson;
import com.slx.funstream.chat.SmileRepo;
import com.slx.funstream.di.PerApp;
import com.slx.funstream.rest.APIUtils;
import com.slx.funstream.rest.FSRestClient;
import com.slx.funstream.rest.StreamsRepo;
import com.slx.funstream.rest.services.FunstreamApi;
import com.slx.funstream.utils.RxBus;

import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;
import retrofit2.CallAdapter;
import retrofit2.Converter;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

@Module
public class FunstreamApiModule {

	@Provides
	@PerApp
	SmileRepo provideSmileRepo(FunstreamApi funstreamApi, RxBus rxBus) {
		return new SmileRepo(funstreamApi, rxBus);
	}

	@Provides
	@PerApp
	StreamsRepo provideStreamsRepo(FunstreamApi funstreamApi) {
		return new StreamsRepo(funstreamApi);
	}

	@Provides
	@PerApp
	Converter.Factory provideConverter(Gson gson) {
		return GsonConverterFactory.create(gson);
	}

	@Provides
	@PerApp
	CallAdapter.Factory provideCallAdapterFactory() {
		return RxJava2CallAdapterFactory.create();
	}

	@Provides
	@PerApp
	FSRestClient provideFSRestClient(OkHttpClient client, Converter.Factory convFactory,
	                                 CallAdapter.Factory callAdapterFactory) {
		return new FSRestClient(client, convFactory, callAdapterFactory, APIUtils.FUNSTREAM_API_ENDPOINT);
	}

	@Provides
	@PerApp
	FunstreamApi provideFunstreamApi(FSRestClient client) {
		return client.getApiService();
	}
}


text:
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <stdint.h>
#include "rofi.h"
#include "dialogs/dmenu.h"
#include "helper.h"

struct range_pair
{
    unsigned int start;
    unsigned int stop;
};
typedef struct _DmenuModePrivateData
{
    char              *prompt;
    unsigned int      selected_line;
    char              *message;
    char              *format;
    struct range_pair * urgent_list;
    unsigned int      num_urgent_list;
    struct range_pair * active_list;
    unsigned int      num_active_list;
    // List with entries.
    char              **cmd_list;
    unsigned int      cmd_list_length;
} DmenuModePrivateData;

static char **get_dmenu ( unsigned int *length )
{
    char buffer[1024];
    char **retv = NULL;

    *length = 0;

    while ( fgets_s ( buffer, 1024, stdin, (char) config.separator ) != NULL ) {
        retv                  = g_realloc ( retv, ( ( *length ) + 2 ) * sizeof ( char* ) );
        retv[( *length )]     = g_strdup ( buffer );
        retv[( *length ) + 1] = NULL;

        // Filter out line-end.
        if ( retv[( *length )][strlen ( buffer ) - 1] == '\n' ) {
            retv[( *length )][strlen ( buffer ) - 1] = '\0';
        }

        ( *length )++;
        // Stop when we hit 2³¹ entries.
        if ( ( *length ) == INT_MAX ) {
            return retv;
        }
    }

    return retv;
}

static char ** dmenu_mode_get_data ( unsigned int *length, Switcher *sw )
{
    DmenuModePrivateData *rmpd = (DmenuModePrivateData *) sw->private_data;
    if ( rmpd->cmd_list == NULL ) {
        rmpd->cmd_list_length = 0;
        rmpd->cmd_list        = get_dmenu ( &( rmpd->cmd_list_length ) );
    }
    *length = rmpd->cmd_list_length;
    return rmpd->cmd_list;
}

static void parse_pair ( char  *input, struct range_pair  *item )
{
    int index = 0;
    for ( char *token = strsep ( &input, "-" ); token != NULL; token = strsep ( &input, "-" ) ) {
        if ( index == 0 ) {
            item->start = item->stop = (unsigned int) strtoul ( token, NULL, 10 );
            index++;
        }
        else {
            if ( token[0] == '\0' ) {
                item->stop = 0xFFFFFFFF;
            }
            else{
                item->stop = (unsigned int) strtoul ( token, NULL, 10 );
            }
        }
    }
}

static void parse_ranges ( char *input, struct range_pair **list, unsigned int *length )
{
    char *endp;
    for ( char *token = strtok_r ( input, ",", &endp ); token != NULL; token = strtok_r ( NULL, ",", &endp ) ) {
        // Make space.
        *list = g_realloc ( ( *list ), ( ( *length ) + 1 ) * sizeof ( struct range_pair ) );
        // Parse a single pair.
        parse_pair ( token, &( ( *list )[*length] ) );

        ( *length )++;
    }
}

static const char *get_display_data ( unsigned int index, void *data, G_GNUC_UNUSED int *state )
{
    Switcher             *sw    = (Switcher *) data;
    DmenuModePrivateData *pd    = (DmenuModePrivateData *) sw->private_data;
    char                 **retv = (char * *) pd->cmd_list;
    for ( unsigned int i = 0; i < pd->num_active_list; i++ ) {
        if ( index >= pd->active_list[i].start && index <= pd->active_list[i].stop ) {
            *state |= ACTIVE;
        }
    }
    for ( unsigned int i = 0; i < pd->num_urgent_list; i++ ) {
        if ( index >= pd->urgent_list[i].start && index <= pd->urgent_list[i].stop ) {
            *state |= URGENT;
        }
    }
    return retv[index];
}

/**
 * @param format The format string used. See below for possible syntax.
 * @param string The selected entry.
 * @param selected_line The selected line index.
 * @param filter The entered filter.
 *
 * Function that outputs the selected line in the user-specified format.
 * Currently the following formats are supported:
 *   * i: Print the index (0-(N-1))
 *   * d: Print the index (1-N)
 *   * s: Print input string.
 *   * q: Print quoted input string.
 *   * f: Print the entered filter.
 *   * F: Print the entered filter, quoted
 *
 * This functions outputs the formatted string to stdout, appends a newline (\n) character and
 * calls flush on the file descriptor.
 */
static void dmenu_output_formatted_line ( const char *format, const char *string, int selected_line,
                                          const char *filter )
{
    for ( int i = 0; format && format[i]; i++ ) {
        if ( format[i] == 'i' ) {
            fprintf ( stdout, "%d", selected_line );
        }
        else if ( format[i] == 'd' ) {
            fprintf ( stdout, "%d", ( selected_line + 1 ) );
        }
        else if ( format[i] == 's' ) {
            fputs ( string, stdout );
        }
        else if ( format[i] == 'q' ) {
            char *quote = g_shell_quote ( string );
            fputs ( quote, stdout );
            g_free ( quote );
        }
        else if ( format[i] == 'f' ) {
            fputs ( filter, stdout );
        }
        else if ( format[i] == 'F' ) {
            char *quote = g_shell_quote ( filter );
            fputs ( quote, stdout );
            g_free ( quote );
        }
        else {
            fputc ( format[i], stdout );
        }
    }
    fputc ( '\n', stdout );
    fflush ( stdout );
}
static void dmenu_mode_free ( Switcher *sw )
{
    if ( sw->private_data == NULL ) {
        return;
    }
    DmenuModePrivateData *pd = (DmenuModePrivateData *) sw->private_data;

    g_strfreev ( pd->cmd_list );
    g_free ( pd->urgent_list );
    g_free ( pd->active_list );

    g_free ( pd );
    sw->private_data = NULL;
}

static void dmenu_mode_init ( Switcher *sw )
{
    if ( sw->private_data != NULL ) {
        return;
    }
    sw->private_data = g_malloc0 ( sizeof ( DmenuModePrivateData ) );
    DmenuModePrivateData *pd = (DmenuModePrivateData *) sw->private_data;

    pd->prompt        = "dmenu ";
    pd->selected_line = UINT32_MAX;

    find_arg_str ( "-mesg", &( pd->message ) );

    // Check prompt
    find_arg_str (  "-p", &( pd->prompt ) );
    find_arg_uint (  "-selected-row", &( pd->selected_line ) );
    // By default we print the unescaped line back.
    pd->format = "s";

    // Allow user to override the output format.
    find_arg_str ( "-format", &( pd->format ) );
    // Urgent.
    char *str = NULL;
    find_arg_str (  "-u", &str );
    if ( str != NULL ) {
        parse_ranges ( str, &( pd->urgent_list ), &( pd->num_urgent_list ) );
    }
    // Active
    str = NULL;
    find_arg_str (  "-a", &str );
    if ( str != NULL ) {
        parse_ranges ( str, &( pd->active_list ), &( pd->num_active_list ) );
    }

    // DMENU COMPATIBILITY
    find_arg_uint (  "-l", &( config.menu_lines ) );

    /**
     * Dmenu compatibility.
     * `-b` put on bottom.
     */
    if ( find_arg ( "-b" ) >= 0 ) {
        config.location = 6;
    }
    /* -i case insensitive */
    config.case_sensitive = TRUE;
    if ( find_arg ( "-i" ) >= 0 ) {
        config.case_sensitive = FALSE;
    }
}

Switcher dmenu_mode =
{
    .name         = "dmenu",
    .keycfg       = NULL,
    .keystr       = NULL,
    .modmask      = AnyModifier,
    .init         = dmenu_mode_init,
    .get_data     = dmenu_mode_get_data,
    .result       = NULL,
    .destroy      = dmenu_mode_free,
    .token_match  = token_match,
    .mgrv         = get_display_data,
    .private_data = NULL,
    .free         = NULL
};

int dmenu_switcher_dialog ( void )
{
    dmenu_mode.init ( &dmenu_mode );
    DmenuModePrivateData *pd             = (DmenuModePrivateData *) dmenu_mode.private_data;
    char                 *input          = NULL;
    int                  retv            = FALSE;
    int                  restart         = FALSE;
    unsigned int         cmd_list_length = 0;
    char                 **cmd_list      = dmenu_mode.get_data ( &( cmd_list_length ), &dmenu_mode );

    int                  only_selected = FALSE;
    if ( find_arg ( "-only-match" ) >= 0 || find_arg ( "-no-custom" ) >= 0 ) {
        only_selected = TRUE;
        if ( cmd_list_length == 0 ) {
            return TRUE;
        }
    }
    /* copy filter string */
    input = g_strdup ( config.filter );

    char *select = NULL;
    find_arg_str ( "-select", &select );
    if ( select != NULL ) {
        char         **tokens = tokenize ( select, config.case_sensitive );
        unsigned int i        = 0;
        for ( i = 0; i < cmd_list_length; i++ ) {
            if ( token_match ( tokens, cmd_list[i], config.case_sensitive, 0, NULL ) ) {
                pd->selected_line = i;
                break;
            }
        }
        g_strfreev ( tokens );
    }

    do {
        unsigned int next_pos = pd->selected_line;
        int          mretv    = menu ( &dmenu_mode, &input, pd->prompt, &( pd->selected_line ), &next_pos, pd->message );
        // Special behavior.
        // TODO clean this up!
        if ( only_selected ) {
            /**
             * Select item mode.
             */
            restart = 1;
            if ( ( mretv & ( MENU_OK | MENU_QUICK_SWITCH ) ) && cmd_list[pd->selected_line] != NULL ) {
                dmenu_output_formatted_line ( pd->format, cmd_list[pd->selected_line], pd->selected_line, input );
                retv = TRUE;
                if ( ( mretv & MENU_QUICK_SWITCH ) ) {
                    retv = 10 + ( mretv & MENU_LOWER_MASK );
                }
                return retv;
            }
            else if ( ( mretv & MENU_CANCEL ) == MENU_CANCEL ) {
                // In no custom mode we allow canceling.
                restart = ( find_arg ( "-only-match" ) >= 0 );
            }
            pd->selected_line = next_pos - 1;
            continue;
        }
        // We normally do not want to restart the loop.
        restart = FALSE;
        // Normal mode
        if ( ( mretv & MENU_OK  ) && cmd_list[pd->selected_line] != NULL ) {
            dmenu_output_formatted_line ( pd->format, cmd_list[pd->selected_line], pd->selected_line, input );
            if ( ( mretv & MENU_SHIFT ) ) {
                restart = TRUE;
                // Move to next line.
                pd->selected_line = MIN ( next_pos, cmd_list_length - 1 );
            }
            retv = TRUE;
        }
        // Custom input
        else if ( ( mretv & ( MENU_CUSTOM_INPUT ) ) ) {
            dmenu_output_formatted_line ( pd->format, input, -1, input );
            if ( ( mretv & MENU_SHIFT ) ) {
                restart = TRUE;
                // Move to next line.
                pd->selected_line = MIN ( next_pos, cmd_list_length - 1 );
            }

            retv = TRUE;
        }
        // Quick switch with entry selected.
        else if ( ( mretv & MENU_QUICK_SWITCH ) && pd->selected_line < UINT32_MAX ) {
            dmenu_output_formatted_line ( pd->format, cmd_list[pd->selected_line], pd->selected_line, input );

            restart = FALSE;
            retv    = 10 + ( mretv & MENU_LOWER_MASK );
        }
        // Quick switch without entry selected.
        else if ( ( mretv & MENU_QUICK_SWITCH ) && pd->selected_line == UINT32_MAX ) {
            dmenu_output_formatted_line ( pd->format, input, -1, input );

            restart = FALSE;
            retv    = 10 + ( mretv & MENU_LOWER_MASK );
        }
    } while ( restart );

    g_free ( input );
    dmenu_mode.destroy ( &dmenu_mode );
    return retv;
}


text:
<?php
namespace EddieJaoude\Zf2Logger\Tests\Zf2LoggerTest;

use EddieJaoude\Zf2Logger\Module;
use Zend\Mvc\MvcEvent;

/**
 * Class ModuleTest
 *
 * @package EddieJaoude\Zf2Logger\Tests\Zf2LoggerTest
 */
class ModuleTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @var \EddieJaoude\Zf2Logger\Module
     */
    private $instance;

    public function setUp()
    {
        $this->instance = new Module();
    }

    public function testInstance()
    {
        $this->assertInstanceOf('\EddieJaoude\Zf2Logger\Module', $this->instance);
    }

    public function testGetAutoloaderConfig()
    {
        $response = $this->instance->getAutoloaderConfig();

        $this->assertTrue(array_key_exists('EddieJaoude\Zf2Logger', $response['Zend\Loader\StandardAutoloader']['namespaces']));
    }

    public function testGetServiceConfig()
    {
        $response = $this->instance->getServiceConfig();

        $this->assertTrue(array_key_exists('factories', $response));
        $this->assertTrue(array_key_exists('EddieJaoude\Zf2Logger', $response['factories']));
        $this->assertTrue(is_callable($response['factories']['EddieJaoude\Zf2Logger']));
    }

    public function testOnBootstrap()
    {
        $mvcEvent = \Mockery::mock('Zend\Mvc\MvcEvent');
        $mvcEvent->shouldReceive('getApplication')
            ->andReturn(\Mockery::self());

        $mvcEvent->shouldReceive('getServiceManager')
            ->andReturn(\Mockery::self());

        $writer = new \Zend\Log\Writer\Mock;

        $logger = new \Zend\Log\Logger;
        $logger->addWriter($writer);

        $mvcEvent->shouldReceive('get')
        ->with('EddieJaoude\Zf2Logger')
            ->andReturn($logger);

        $eventManager = \Mockery::mock('Zend\EventManager\EventManager')->shouldDeferMissing();

        $mvcEvent->shouldReceive('getEventManager')
            ->andReturn($eventManager);

        $this->instance->onBootstrap($mvcEvent);

        $this->assertEquals(array('route', 'finish'), $eventManager->getEvents());
    }
}


text:
Pattern: Redirecting to/from command name

Issue: -

## Description

You are using file redirection, but the filename is an unquoted command name. Instead of running the command and feeding data to it, this just writes to a file with the same name.

To run the command and feed data to it, determine how it gets its data:

* If the command reads from STDIN, simply use a pipe as in the first example.
* If the command reads multiple arguments, use a pipe to `xargs` as in the second example

Note that `xargs` has many pitfalls when it comes to spaces and quotes. `cat file | xargs rm`  will appear to work during testing, but fails for filenames like `My File.txt` or `Can't_Fight_This_Feeling.mp3`. The example uses the GNU extension `-d '\n'` to more safely handle these names.

Example of **incorrect** code:

```sh
cat file > tr -d '\r'
cat file > rm
```

Example of **correct** code:

```sh
cat file | tr -d '\r'         # tr reads stdin
cat file | xargs -d '\n' rm   # rm reads arguments
```

## Exceptions

If you actually did want to write a file named after a command, simply quote the filename to let ShellCheck know you meant it literally and not as a command name. This does not change anything about how the script works:

```sh
# Write to a file literally named 'rm', does not try to delete anything
echo "A potentially dangerous command" > "rm"
```

## Further Reading

* [ShellCheck - SC2238](https://github.com/koalaman/shellcheck/wiki/SC2238)


text:
/* eslint-disable */
import Benchmark from "benchmark";
import createMapper from "../lib/index";

const mapper = createMapper()
  .map("fieldName").to("field.name")
  .map("fieldId").to("field.id")
  .map(["fieldName", "fieldId"]).to("merged", (name, id) => { `${name}-${id}` });

const source = {
  fieldName: "my name",
  fieldId: "abc"
};

mapper.execute(source);

const suite = new Benchmark.Suite();

// add tests
suite
  .add("map and run", () => {
    const map = createMapper();

    map("fieldName").to("field.name", value => value);
    map("fieldId").to("field.id", value => value);
    map(["fieldName", "fieldId"]).to("merged", (name, id) => { `${name}-${id}` });

    map.execute(source);
  })
  // .add("using arrayMaps with old code", () => {
  //   arrayFromExistingMode.execute(source);
  // })
  // .add("using arrayMaps with new code", () => {
  //   arrayFromExperimentMode.execute(source);
  // })
  // .add("using experiment", () => {
  //   experimentMode.execute(source);
  // })
  .add("just wrapping object-mapper", () => {
    mapper.execute(source);
  })
  // add listeners
  .on("cycle", function (event) {
    console.log(String(event.target));
  })
  .on("complete", result => {
    console.log(suite["0"].name, suite["0"].count, suite["0"].times);
    console.log(suite["1"].name, suite["1"].count, suite["1"].times);

  })
  // run async
  .run({ "async": false });


text:
using namespace System;

namespace DesignPatterns {
  namespace Behavioral {
    // The 'Handler' abstract class
    class Handler abstract_ {
    public:
      void SetSuccessor($<Handler> successor) {this->successor = successor;}

      virtual void HandleRequest(int request) const = 0;

    protected:
      $<Handler> successor;
    };

    // The 'ConcreteHandler1' class
    class ConcreteHandler1 : public Handler {
    public:
      void HandleRequest(int request) const override {
        if (request >= 0 && request < 10)
          Console::WriteLine("{0} handled request {1}", this->GetType().Name, request);
        else if (this->successor != null)
          successor->HandleRequest(request);
      }
    };

    // The 'ConcreteHandler2' class
    class ConcreteHandler2 : public Handler {
    public:
      void HandleRequest(int request) const override {
        if (request >= 10 && request < 20)
          Console::WriteLine("{0} handled request {1}", this->GetType().Name, request);
        else if (this->successor != null)
          successor->HandleRequest(request);
      }
    };

    // The 'ConcreteHandler3' class
    class ConcreteHandler3 : public Handler {
    public:
      void HandleRequest(int request) const override {
        if (request >= 20 && request < 30)
          Console::WriteLine("{0} handled request {1}", this->GetType().Name, request);
        else if (this->successor != null)
          successor->HandleRequest(request);
      }
    };

    // MainApp startup_ class for Behavioral
    // Chain Of Responsability Design Pattern.
    class MainApp {
    public:
      // Entry point into console application.
      static void Main() {
        // Setup Chain of Responsibility
        $<Handler> h1 = new_<ConcreteHandler1>();
        $<Handler> h2 = new_<ConcreteHandler2>();
        $<Handler> h3 = new_<ConcreteHandler3>();
        h1->SetSuccessor(h2);
        h2->SetSuccessor(h3);

        // Generate and process request
        int requests[] = { 2, 5, 14, 22, 18, 3, 27, 20 };

        for (int request : requests)
          h1->HandleRequest(request);
      }
    };
  }
}

// Specify the Main entry point to System
startup_(DesignPatterns::Behavioral::MainApp);

// This code produces the following output:
//
// ConcreteHandler1 handled request 2
// ConcreteHandler1 handled request 5
// ConcreteHandler2 handled request 14
// ConcreteHandler3 handled request 22
// ConcreteHandler2 handled request 18
// ConcreteHandler1 handled request 3
// ConcreteHandler3 handled request 27
// ConcreteHandler3 handled request 20


text:
import en_US from '../../date-picker/locale/en_US';
export default en_US;