text:
package org.ovirt.engine.core.common.businessentities;

import java.io.Serializable;

public class OpenstackNetworkProviderProperties extends TenantProviderProperties {

    private static final long serialVersionUID = -7470940167999871534L;

    private String pluginType;

    private AgentConfiguration agentConfiguration;

    public String getPluginType() {
        return pluginType;
    }

    public void setPluginType(String pluginType) {
        this.pluginType = pluginType;
    }

    /**
     * Convenience method to know if the plugin represented is Linux Bridge.
     *
     * @return false the Linux Bridge plugin is deprecated and replaced by ml2.
     */
    public final boolean isLinuxBridge() {
        return false;
    }

    /**
     * Convenience method to know if the plugin represented is Open vSwitch.
     *
     * @return true iff the plugin type represents a Open vSwitch plugin.
     */
    public final boolean isOpenVSwitch() {
        return OpenstackNetworkPluginType.OPEN_VSWITCH.name().equals(getPluginType());
    }

    public AgentConfiguration getAgentConfiguration() {
        return agentConfiguration;
    }

    public void setAgentConfiguration(AgentConfiguration agentConfiguration) {
        this.agentConfiguration = agentConfiguration;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((getPluginType() == null) ? 0 : getPluginType().hashCode());
        result = prime * result + ((getAgentConfiguration() == null) ? 0 : getAgentConfiguration().hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!super.equals(obj)) {
            return false;
        }
        if (!(obj instanceof OpenstackNetworkProviderProperties)) {
            return false;
        }
        OpenstackNetworkProviderProperties other = (OpenstackNetworkProviderProperties) obj;
        if (!getPluginType().equals(other.getPluginType())) {
            return false;
        }
        if (getAgentConfiguration() == null) {
            if (other.getAgentConfiguration() != null) {
                return false;
            }
        } else if (!getAgentConfiguration().equals(other.getAgentConfiguration())) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("OpenstackNetworkProviderProperties [pluginType=")
                .append(getPluginType())
                .append(", tenantName=")
                .append(getTenantName())
                .append("]");
        return builder.toString();
    }

    public static class MessagingConfiguration implements Serializable {
        private static final long serialVersionUID = -8072430559946539586L;
        private BrokerType brokerType;
        private String address;
        private Integer port;
        private String username;
        private String password;

        public BrokerType getBrokerType() {
            return brokerType;
        }

        public void setBrokerType(BrokerType brokerType) {
            this.brokerType = brokerType;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public Integer getPort() {
            return port;
        }

        public void setPort(Integer port) {
            this.port = port;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
            result = prime * result + ((getPort() == null) ? 0 : getPort().hashCode());
            result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
            result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
            result = prime * result + ((getBrokerType() == null) ? 0 : getBrokerType().hashCode());
            return result;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null) {
                return false;
            }
            if (!(obj instanceof MessagingConfiguration)) {
                return false;
            }
            MessagingConfiguration other = (MessagingConfiguration) obj;
            if (getAddress() == null) {
                if (other.getAddress() != null) {
                    return false;
                }
            } else if (!getAddress().equals(other.getAddress())) {
                return false;
            }
            if (getPassword() == null) {
                if (other.getPassword() != null) {
                    return false;
                }
            } else if (!getPassword().equals(other.getPassword())) {
                return false;
            }
            if (getPort() == null) {
                if (other.getPort() != null) {
                    return false;
                }
            } else if (!getPort().equals(other.getPort())) {
                return false;
            }
            if (getUsername() == null) {
                if (other.getUsername() != null) {
                    return false;
                }
            } else if (!getUsername().equals(other.getUsername())) {
                return false;
            }
            if (getBrokerType() == null) {
                if (other.getBrokerType() != null) {
                    return false;
                }
            } else if (!getBrokerType().equals(other.getBrokerType())) {
                return false;
            }
            return true;
        }
    }

    public static class AgentConfiguration implements Serializable {
        private static final long serialVersionUID = -3588687921167640459L;
        private MessagingConfiguration messagingConfiguration;
        private String networkMappings;

        public MessagingConfiguration getMessagingConfiguration() {
            return messagingConfiguration;
        }

        public void setMessagingConfiguration(MessagingConfiguration messagingConfiguration) {
            this.messagingConfiguration = messagingConfiguration;
        }

        public String getNetworkMappings() {
            return networkMappings;
        }

        public void setNetworkMappings(String networkMappings) {
            this.networkMappings = networkMappings;
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((getNetworkMappings() == null) ? 0 : getNetworkMappings().hashCode());
            result = prime * result + ((getMessagingConfiguration() == null) ? 0 : getMessagingConfiguration().hashCode());
            return result;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null) {
                return false;
            }
            if (!(obj instanceof AgentConfiguration)) {
                return false;
            }
            AgentConfiguration other = (AgentConfiguration) obj;
            if (getNetworkMappings() == null) {
                if (other.getNetworkMappings() != null) {
                    return false;
                }
            } else if (!getNetworkMappings().equals(other.getNetworkMappings())) {
                return false;
            }
            if (getMessagingConfiguration() == null) {
                if (other.getMessagingConfiguration() != null) {
                    return false;
                }
            } else if (!getMessagingConfiguration().equals(other.getMessagingConfiguration())) {
                return false;
            }
            return true;
        }
    }

    public enum BrokerType {
        QPID(
                "qpid_hostname",
                "qpid_port",
                "qpid_username",
                "qpid_password",
                "neutron.openstack.common.rpc.impl_qpid"),
        RABBIT_MQ(
                "rabbit_host",
                "rabbit_port",
                "rabbit_userid",
                "rabbit_password",
                "neutron.openstack.common.rpc.impl_kombu");

        private String hostKey;
        private String portKey;
        private String usernameKey;
        private String passwordKey;
        private String rpcBackendValue;

        private BrokerType(String hostKey, String portKey, String usernameKey, String passwordKey, String rpcBackend) {
            this.hostKey = hostKey;
            this.portKey = portKey;
            this.usernameKey = usernameKey;
            this.passwordKey = passwordKey;
            this.rpcBackendValue = rpcBackend;
        }

        public String getHostKey() {
            return hostKey;
        }

        public String getUsernameKey() {
            return usernameKey;
        }

        public String getPasswordKey() {
            return passwordKey;
        }

        public String getRpcBackendValue() {
            return rpcBackendValue;
        }

        public String getPortKey() {
            return portKey;
        }
    }
}


text:
IPC_ENUM_TRAITS_MAX_VALUE(arc::InstanceBootPhase, arc::InstanceBootPhase::LAST)

IPC_MESSAGE_CONTROL1(ArcInstanceHostMsg_InstanceBootPhase,
                     arc::InstanceBootPhase)

redpajama_set_name: RedPajamaGithub


text:
var BaseEventToolbar = require('../BaseEventToolbar');

module.exports = BaseEventToolbar.extend({});


text:
<?php

namespace Devhelp\Piwik\Api;

use Prophecy\PhpUnit\ProphecyTestCase;
use Prophecy\Prophecy\ObjectProphecy;

class ApiTest extends ProphecyTestCase
{

    /**
     * @var ObjectProphecy
     */
    private $client;

    protected function setUp()
    {
        parent::setUp();

        $this->client = $this->prophesize('Devhelp\Piwik\Api\Client\PiwikClient');
    }

    /**
     * @test
     */
    public function it_returns_method()
    {
        $api = new Api($this->client->reveal(), 'http://my.piwik.pro');

        $this->assertInstanceOf('Devhelp\Piwik\Api\Method\Method', $api->getMethod('MyPlugin.myAction'));
    }
}


text:
#import "NSObject.h"

@class ACAccountStore, NSMutableDictionary, NSTimer;

@interface ABRefreshController : NSObject
{
    ACAccountStore *_accountStore;
    double _refreshDelay;
    NSMutableDictionary *_accountGroupListsToRefreshByObserver;
    NSMutableDictionary *_contactsFiltersToRefreshByObserver;
    NSTimer *_refreshTimer;
}

+ (id)sharedInstance;
- (_Bool)canRefreshSources:(id)arg1;
- (void)refreshEverythingNow;
- (void)refreshAccountGroupList:(id)arg1;
- (void)refreshContactsFilter:(id)arg1;
- (_Bool)_acAccountExistsForIdentifier:(id)arg1;
- (id)refreshableAccountIdentifiersForContactsFilter:(id)arg1;
- (_Bool)canRefreshAccountIdentifier:(id)arg1;
- (void)_refreshGroupListForACAccountWithIdentifier:(id)arg1 isUserRequested:(_Bool)arg2;
- (void)_refreshACAccountWithIdentifier:(id)arg1 isUserRequested:(_Bool)arg2;
- (void)startRefreshingOrphanedAccountsWithAddressBook:(void *)arg1;
- (void)startRefreshingOrphanedAccountsWithAddressBook:(void *)arg1 afterDelay:(_Bool)arg2;
- (void)_actuallyRefreshOrphanedAccountsWithAddressBook:(void *)arg1;
- (void)_resumeAllRefreshes;
- (void)_postponeAllRefreshes;
- (void)cancelAllScheduledRefreshesWithObserver:(void *)arg1;
- (void)scheduleRefreshForAccountGroupList:(id)arg1 withObserver:(void *)arg2;
- (void)scheduleRefreshForContactsFilter:(id)arg1 withObserver:(void *)arg2;
- (_Bool)canRefreshContactsFilter:(id)arg1;
- (void)_addObjectToRefresh:(id)arg1 withObserver:(void *)arg2 toDictionary:(id *)arg3;
- (void)_setRefreshDelay:(double)arg1;
- (id)accountStore;
- (void)_proceedWithRefresh:(id)arg1;
- (void)_invalidateTimer;
- (void)_scheduleRefreshTimerIfNeeded;
- (void)dealloc;
- (id)init;

@end


text:
package com.ing.baker.recipe.scaladsl

import com.ing.baker.recipe.common
import com.ing.baker.recipe.common.InteractionFailureStrategy

import scala.collection.immutable.Seq
import scala.concurrent.duration.FiniteDuration
import scala.language.experimental.macros

object Recipe {
  def apply() : Recipe = macro CommonMacros.recipeImpl

  def apply(name: String): Recipe = {
    Recipe(name, Seq.empty, Set.empty, new common.InteractionFailureStrategy.BlockInteraction, None, None)
  }
}

/**
  * A Recipe combines a set of interactions & events.
  */
case class Recipe private(override val name: String,
                          override val interactions: Seq[common.InteractionDescriptor],
                          override val sensoryEvents: Set[common.Event],
                          override val defaultFailureStrategy: InteractionFailureStrategy,
                          override val eventReceivePeriod: Option[FiniteDuration],
                          override val retentionPeriod: Option[FiniteDuration])
  extends common.Recipe {

  def withInteraction(newInteraction: common.InteractionDescriptor): Recipe = copy(interactions = interactions :+ newInteraction)

  def withInteractions(newInteractions: common.InteractionDescriptor*): Recipe = copy(interactions = interactions ++ newInteractions)

  def withSensoryEvent(newEvent: common.Event): Recipe = copy(sensoryEvents = sensoryEvents + newEvent)

  def withSensoryEvents(newEvents: common.Event*): Recipe = copy(sensoryEvents = sensoryEvents ++ newEvents)

  def withEventReceivePeriod(duration: FiniteDuration): Recipe = copy(eventReceivePeriod = Some(duration))

  def withRetentionPeriod(duration: FiniteDuration): Recipe = copy(retentionPeriod = Some(duration))

  def withDefaultFailureStrategy(defaultFailureStrategy: InteractionFailureStrategy) : Recipe = copy(defaultFailureStrategy = defaultFailureStrategy)
}


text:
const express = require('express')
const router = express.Router()
const models = require('../models')
const response = require('./response')

router.post('/', function (req, res) {
  const player = req.body
  response.create(res, models.Player.create(
    player
  ))
})

router.delete('/:id', function (req, res) {
  response.delete(res, models.Player.destroy({
    where: {
      id: req.params.id
    }
  }))
})

router.get('/:id', function (req, res) {
  response.get(res, models.Player.findById(
    req.params.id, {
      include: [{
        model: models.Team,
        as: 'team'
      }]
    }
  ))
})

router.put('/:id', function (req, res) {
  const player = req.body
  response.update(res, models.Player.update(player, {
    where: {
      id: req.params.id
    }
  }))
})

module.exports = router


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Shipping Engine, by FarragoFiction</title>
    <link rel="stylesheet" href="css/styles.css">
    <link rel="icon" href="favicon.ico">

    Sibling Shipping Sim by a Cactus


text:
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="component" method="upgrade">
	<name>Vidiyal</name>
	<creationDate>Sep 2014</creationDate>
	<author>Sampath kumar</author>
	<authorEmail>mskkec@gmail.com</authorEmail>
	<authorUrl>http://www.vidiyalfoundation.org</authorUrl>
	<copyright>Copyright (c) 2015 vidiyal </copyright>
	<license>GNU GPL v3 </license>
	<version>1.0</version>
	<description>Leatn today for a better tomorrow</description>

	<!-- Public front end files -->
	<files folder="frontend">
		<filename>vidiyal.php</filename>

		<folder>controllers</folder>
		<folder>views</folder>
	</files>

	<!-- Front end translation files -->
	<languages folder="language/frontend">
		<language tag="en-GB">en-GB/en-GB.com_vidiyal.ini</language>
	</languages>

	<!-- SQL query files to execute on installation -->
	<install>
		<sql>
			<file driver="mysql" charset="utf8">sql/install/mysql/install.sql</file>
			<file driver="mysql">sql/install/mysql/install.sql</file>
			<file driver="mysqli" charset="utf8">sql/install/mysql/install.sql</file>
			<file driver="mysqli">sql/install/mysql/install.sql</file>
		</sql>
	</install>

	<!-- SQL query files to execute on uninstallation -->
	<uninstall>
		<sql>
			<file driver="mysql" charset="utf8">sql/install/mysql/uninstall.sql</file>
			<file driver="mysql">sql/install/mysql/uninstall.sql</file>
			<file driver="mysqli" charset="utf8">sql/install/mysql/uninstall.sql</file>
			<file driver="mysqli">sql/install/mysql/uninstall.sql</file>
		</sql>
	</uninstall>

	<!-- Media files -->
	<media destination="com_vidiyal" folder="media">
		<folder>images</folder>
	</media>

	<!-- Administrator back-end section -->
	<administration>
		<!-- Administration menu -->
		<menu view="donors" >COM_VIDIYAL</menu>

		<!-- Back-end files -->
		<files folder="backend">
			<folder>sql</folder>
			<folder>views</folder>

			<filename>access.xml</filename>
			<filename>config.xml</filename>
			<filename>vidiyal.php</filename>
			<filename>fof.xml</filename>
		</files>

		<!-- Back-end translation files -->
		<languages folder="language/backend">
			<language tag="en-GB">en-GB/en-GB.com_vidiyal.ini</language>
			<language tag="en-GB">en-GB/en-GB.com_vidiyal.sys.ini</language>
		</languages>

	</administration>
</extension>


text:
layout: post
title: "Couldn't Stick The Landing"
date: 2015-04-14 04:28:13 -0400
---
Rowan had a flipping good time visiting his cousin Hannah. Too bad he couldn't stick that landing on the last flip.

{% vimeo 124909731 %}


text:
EFFECTS.push({

  SCENE: null, CAMERA: null , RENDERER: null,

  FFT: 64,

  TICK: 0, CLOCK: new THREE.Clock(true),

  PARTICLE_SYSTEM: null,

  /////////////////////////////////////////////////////////////////////////////////

  setup: function() {

    document.getElementById('help').innerHTML = "blank (with particles)
this is a starting point for custom visualizations";

    this.SCENE = new THREE.Scene();

    this.RENDERER = new THREE.WebGLRenderer();
    this.RENDERER.setSize(window.innerWidth, window.innerHeight);

    document.body.appendChild(this.RENDERER.domElement);

    this.CAMERA = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000);
    this.CAMERA.position.z = 100;

    this.PARTICLE_SYSTEM = new THREE.GPUParticleSystem();
    this.SCENE.add(this.PARTICLE_SYSTEM);

  }, //setup

  destroy: function() {

    document.body.removeChild(this.RENDERER.domElement);

  }, //destroy

  input: function(e) {

  }, //input

  tick: function(t) {

    var delta = this.CLOCK.getDelta();

    this.TICK += delta;

    if(this.TICK < 0) this.TICK = 0;

    if(delta > 0) {

      if(delta > 1) delta = 1;

      this.PARTICLE_SYSTEM.spawnParticle({
        position: new THREE.Vector3(),
        //positionRandomness: 100,
        positionRandomness: 0,
        velocity: new THREE.Vector3(),
        velocityRandomness: 2,
        color: 0xffffff,
        colorRandomness: 1,
        turbulence: 0,
        lifetime: 5,
        size: 20,
        sizeRandomness: 50
      });

    } // delta > 0

    this.PARTICLE_SYSTEM.update(this.TICK);

    this.RENDERER.render(this.SCENE, this.CAMERA);

  }, //tick

  beat: function() {

  }, //beat

  resize: function() {

    this.RENDERER.setSize(window.innerWidth, window.innerHeight);

    this.CAMERA = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000);
    this.CAMERA.position.z = 100;
    this.CAMERA.updateProjectionMatrix();

  } //resize

});


text:
- `enqueue` -> adds a new element in the queue
- `deque` -> removes an element from the queue
- `size` -> gets the number of elements in the queue
- `empty` -> shows if the queue is empty or not
- `clear` -> clears the queue


text:
namespace SampleApp2_SetData
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.rdlViewer1 = new fyiReporting.RdlViewer.RdlViewer();
            this.ButtonReloadReport = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // rdlViewer1
            //
            this.rdlViewer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.rdlViewer1.Cursor = System.Windows.Forms.Cursors.Default;
            this.rdlViewer1.Folder = null;
            this.rdlViewer1.HighlightAll = false;
            this.rdlViewer1.HighlightAllColor = System.Drawing.Color.Fuchsia;
            this.rdlViewer1.HighlightCaseSensitive = false;
            this.rdlViewer1.HighlightItemColor = System.Drawing.Color.Aqua;
            this.rdlViewer1.HighlightPageItem = null;
            this.rdlViewer1.HighlightText = null;
            this.rdlViewer1.Location = new System.Drawing.Point(40, 69);
            this.rdlViewer1.Name = "rdlViewer1";
            this.rdlViewer1.PageCurrent = 1;
            this.rdlViewer1.Parameters = null;
            this.rdlViewer1.ReportName = null;
            this.rdlViewer1.ScrollMode = fyiReporting.RdlViewer.ScrollModeEnum.Continuous;
            this.rdlViewer1.SelectTool = false;
            this.rdlViewer1.ShowFindPanel = false;
            this.rdlViewer1.ShowParameterPanel = true;
            this.rdlViewer1.ShowWaitDialog = true;
            this.rdlViewer1.Size = new System.Drawing.Size(731, 381);
            this.rdlViewer1.SourceFile = null;
            this.rdlViewer1.SourceRdl = null;
            this.rdlViewer1.TabIndex = 0;
            this.rdlViewer1.UseTrueMargins = true;
            this.rdlViewer1.Zoom = 0.8775232F;
            this.rdlViewer1.ZoomMode = fyiReporting.RdlViewer.ZoomEnum.FitWidth;
            //
            // ButtonReloadReport
            //
            this.ButtonReloadReport.Location = new System.Drawing.Point(64, 31);
            this.ButtonReloadReport.Name = "ButtonReloadReport";
            this.ButtonReloadReport.Size = new System.Drawing.Size(141, 23);
            this.ButtonReloadReport.TabIndex = 5;
            this.ButtonReloadReport.Text = "Reload Report";
            this.ButtonReloadReport.UseVisualStyleBackColor = true;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(852, 462);
            this.Controls.Add(this.ButtonReloadReport);
            this.Controls.Add(this.rdlViewer1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }

        #endregion

        private fyiReporting.RdlViewer.RdlViewer rdlViewer1;
        internal System.Windows.Forms.Button ButtonReloadReport;
    }
}


text:
/// <reference path='fourslash.ts'/>

////declare module "jquery" {
////    function $(s: string): any;
////    export = $;
////}

////import /*1*/$ = require("jquery");
/////*2*/$("a");

////import /*3*/$ = require("jquery");

goTo.marker("1");
verify.referencesCountIs(2);

goTo.marker("2");
verify.referencesCountIs(2);

goTo.marker("3");
verify.referencesCountIs(1);


text:
using NLog;
using NLog.Config;
using System.IO;
using System.Reflection;
using System.Xml;

namespace Global.NLog.Config
{
    using Properties;

    public static class NLogConfig
    {
        public static void ConfigureNLog(string appName, string companyName)
        {
            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(Resources.ConfigName))
            {
                var xml = new StreamReader(stream).ReadToEnd()
                    .Replace("@companyName", companyName).Replace("@appName", appName);

                using (var sr = new StringReader(xml))
                {
                    using (XmlReader xr = XmlReader.Create(sr))
                    {
                        var config = new XmlLoggingConfiguration(xr, null);
                        LogManager.Configuration = config;
                    }
                }
            }
        }
    }
}


text:
var onlineAdsAppControllers = onlineAdsAppControllers || angular.module('onlineAdsAppControllers', []);

onlineAdsAppControllers.controller('UserAllAdsController',
        function userAllAdsController($scope, $rootScope, $route, $location, adsData, ajaxErrorText) {
            $scope.loading = true;
            $scope.noAdsToDisplay = false;

            var adStatus = $location.path().substr(10, $location.path().length);

            /* pagination */
            var currentPage = 1;
            $scope.totalAds = 0;
            $scope.adsPerPage = 3;
            getResultsPage(1);

            $scope.pagination = {
                current: 1
            };

            $scope.pageChanged = function (newPage) {
                getResultsPage(newPage);
            };

            function getResultsPage(pageNumber) {
                adsData.getUserAds(pageNumber, adStatus).then(function (data) {
                    if (data.ads.length === 0) {
                        $scope.noAdsToDisplay = true;
                    } else {
                        $scope.loading = true;
                        $scope.userAdsData = data;
                        $scope.totalAds = parseInt(data.numItems);
                        currentPage = pageNumber;
                    }
                }, function (error) {
                    $rootScope.$broadcast('alertMessage', ajaxErrorText);
                }).finally(function () {
                    $scope.loading = false;
                });
            }

            /* redirect user to edit-ad page */
            $scope.openEditAdMod = function (id) {
                adsData.actionChosen = "edit-ad";
                adsData.adIdToBeEdited = id;
                $location.path('/user/edit-ad-info');
            };

            /* publish again ad*/
            $scope.publishAgainAd = function (id) {
                adsData.publishAgainAd(id).then(function (data) {
                    $route.reload();
                    $rootScope.$broadcast('alertMessage', data.message +
                            "It was moved into your Waiting Approval Ads.");
                }, function (error) {
                    $rootScope.$broadcast('alertMessage', ajaxErrorText);
                });
            };

            /* deactivate ad*/
            $scope.deactivateAd = function (id) {
                adsData.deactivateAd(id).then(function (data) {
                    $route.reload();
                    $rootScope.$broadcast('alertMessage', data.message +
                            "It was moved into your Inactive Ads.");
                }, function (error) {
                    $rootScope.$broadcast('alertMessage', ajaxErrorText);
                });
            };

            /* redirect user to confirm-del page */
            $scope.openDeleteAdConfirmPanel = function (id) {
                adsData.actionChosen = "del-ad";
                adsData.adIdToBeDeleted = id;
                $location.path('/user/confirm-del-ad');
            };
        });


text:
{% extends "layout.html" %}

{% block page_title %}
Reform IdAM V1.x Prototype
{% endblock %}

{% block content %}

  {% include "includes/phase_banner_beta.html" %}

Home

Invite Users

Existing User

  <form action="/invite-edit-confirm" id="user-form" method="post">

Invite Existing User - Details and Services

You are editing:

        fred.blogs@hmcts.net

To edit a different user, please return to the search page.

        <input type="hidden" id="email" name="email" required="true" value="fred.blogs@hmcts.net">

                First name
                Please enter the user's first name

              <input class="form-control" type="text" id="firstname" name="firstname" value="Fred">

                Last name
                Please enter the user's last name

              <input class="form-control" type="text" id="lastname" name="lastname" value="Bloggs">

            <fieldset>

              <legend>
                Private beta services
                Please select one or more additional private beta services to assign this user to. You cannot remove existing private beta services here, this should be done in the manage users section.
              </legend>

                <input disabled checked="checked" id="select-1" type="checkbox" name="assigned-services" value="services-edit.html">
                Divorce Citizen App (DIVORCE)

                <input checked="checked" id="select-2" type="checkbox" name="assigned-services" value="services-edit.html">
                Civil Money Claims Citizen App (CMC_CIT)

            </fieldset>

        <button class="button" type="submit">
          Continue
        </button>

        Invite another user

  </form>

{% endblock %}


text:
using System;
using Koans.Utils;
using Xunit;
using CurrentLesson = Koans.Lessons.Lesson1ObservableStreams;
using System.Reactive.Subjects;

namespace Koans.Tests
{

	public class Lesson1ObservableStreamsTest
	{
		[Fact]
		public void TestAllQuestions()
		{
			KoanUtils.Verify<CurrentLesson>(l => l.SimpleSubscription(), 42);
			KoanUtils.Verify<CurrentLesson>(l => l.WhatGoesInComesOut(), 101);
			KoanUtils.Verify<CurrentLesson>(l => l.ThisIsTheSameAsAnEventStream(), 37);
			KoanUtils.AssertLesson<CurrentLesson>(l => l.HowEventStreamsRelateToObservables(),
												  l =>
												  StringUtils.call =
												  (s, p) => { ((Subject<int>)s).OnNext(((int)p[0])); return 0; });
			KoanUtils.Verify<CurrentLesson>(l => l.EventStreamsHaveMultipleEvents(), 17);
			KoanUtils.Verify<CurrentLesson>(l => l.SimpleReturn(), "Foo");
			KoanUtils.Verify<CurrentLesson>(l => l.TheLastEvent(), "Bar");
			KoanUtils.Verify<CurrentLesson>(l => l.EveryThingCounts(), 7);
			KoanUtils.Verify<CurrentLesson>(l => l.ThisIsStillAnEventStream(), 15);
			KoanUtils.Verify<CurrentLesson>(l => l.AllEventsWillBeRecieved(), "Working 98765");
			KoanUtils.Verify<CurrentLesson>(l => l.DoingInTheMiddle(), "Party");
			KoanUtils.AssertLesson<CurrentLesson>(l => l.NothingListensUntilYouSubscribe(),
			                                      l =>
			                                      StringUtils.call =
			                                      (s, p) => ObservableExtensions.Subscribe((IObservable<int>) s));
			KoanUtils.Verify<CurrentLesson>(l => l.EventsBeforeYouSubscribedDoNotCount(), 7);
			KoanUtils.Verify<CurrentLesson>(l => l.EventsAfterYouUnsubscribDoNotCount(), 3);
			KoanUtils.Verify<CurrentLesson>(l => l.EventsWhileSubscribing(), "you look pretty");
			KoanUtils.AssertLesson<CurrentLesson>(l => l.UnsubscribeAtAnyTime(),
			                                      l =>
			                                      StringUtils.call =
			                                      (s, p) =>
			                                      	{
			                                      		((IDisposable) s).Dispose();
			                                      		return 1;
			                                      	});
			KoanUtils.Verify<CurrentLesson>(l => l.TakeUntilFull(), 5);
		}
	}
}


text:
Above all, SQLAlchemy places great emphasis on polite, thoughtful, and
constructive communication between users and developers.
Please see our current Code of Conduct at
[Code of Conduct](https://www.sqlalchemy.org/codeofconduct.html).


text:
package types

import "github.com/coreos/go-semver/semver"

const (
	Version = 1
)

var (
	MaxVersion = semver.Version{
		Major: Version,
	}
)

type Config struct {
	Version  int      `json:"ignitionVersion"`
	Storage  Storage  `json:"storage,omitempty"`
	Systemd  Systemd  `json:"systemd,omitempty"`
	Networkd Networkd `json:"networkd,omitempty"`
	Passwd   Passwd   `json:"passwd,omitempty"`
}


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BEPUutilities")]
[assembly: AssemblyDescription("Extensions and helpers used by various bepu things.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Bepu Entertainment LLC")]
[assembly: AssemblyProduct("BEPUutilities")]
[assembly: AssemblyCopyright("Copyright © 2014, Bepu Entertainment LLC")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c8431ed4-209d-4c02-9328-ca225b760ea6")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("0")]


text:
package io.fabric8.kubernetes.client.server.mock;

import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodBuilder;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder;
import io.fabric8.kubernetes.api.model.extensions.IngressBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext;
import io.fabric8.mockwebserver.crud.Attribute;
import io.fabric8.mockwebserver.crud.AttributeSet;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class KubernetesAttributesExtractorTest {

  @Test
  void shouldHandleNamespacedPathWithResource() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/namespaces/myns/pods/mypod");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("name", "mypod"));
    expected = expected.add(new Attribute("version", "v1"));
    assertTrue(attributes.matches(expected));
    assertFalse(attributes.containsKey(KubernetesAttributesExtractor.API));
  }

  @Test
  void shouldHandleNamespacedPath() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/namespaces/myns/pods");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("namespace", "myns"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleNonNamespacedPath() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/nodes/mynode");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "nodes"));
    expected = expected.add(new Attribute("name", "mynode"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandlePathWithLabelSelectorParam() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/pods?labelSelector=testKey%3DtestValue");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("labels:testKey", "testValue"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandlePathWithFieldSelectorParam() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/pods?fieldSelector=testKey%3DtestValue");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("testKey", "testValue"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleResource() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    Pod pod = new PodBuilder().withNewMetadata().withName("mypod").withNamespace("myns").endMetadata().build();

    AttributeSet attributes = extractor.extract(pod);

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("metadata.namespace", "myns"));
    expected = expected.add(new Attribute("name", "mypod"));
    expected = expected.add(new Attribute("metadata.name", "mypod"));
    expected = expected.add(new Attribute("version", "v1"));
    assertTrue(attributes.matches(expected));
    assertFalse(attributes.containsKey(KubernetesAttributesExtractor.API));
  }

  @Test
  void shouldHandleRawResource() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    String resource = "{\"metadata\":{\"name\":\"myresource\",\"namespace\":\"myns\"}, \"kind\":\"raw\", \"apiVersion\":\"v1\"}";

    AttributeSet attributes = extractor.fromResource(resource);

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("metadata.namespace", "myns"));
    expected = expected.add(new Attribute("name", "myresource"));
    expected = expected.add(new Attribute("metadata.name", "myresource"));
    expected = expected.add(new Attribute("version", "v1"));
    assertTrue(attributes.matches(expected));
    assertFalse(attributes.containsKey(KubernetesAttributesExtractor.API));
  }

  @Test
  void shouldHandleResourceWithLabel() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    Map<String, String> labels = new HashMap<>();
    labels.put("name", "myname");
    Pod pod = new PodBuilder().withNewMetadata().withLabels(labels).endMetadata().build();

    AttributeSet attributes = extractor.extract(pod);

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("labels:name", "myname"));
    assertTrue(attributes.matches(expected));
  }

  /**
   * Default versions are not yet understood
   */
  @Test
  void shouldHandleKindWithoutVersion() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/pods");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleExtensions() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/apis/apps/v1/deployments");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "deployments"));
    expected = expected.add(new Attribute("api", "apps"));
    expected = expected.add(new Attribute("version", "v1"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleIngress() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    extractor.extract(new IngressBuilder().withNewMetadata().endMetadata().build());
    AttributeSet attributes = extractor.fromPath("/apis/extensions/v1beta1/namespaces/myns/ingresses/myingress");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "ingresses"));
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("name", "myingress"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleEndpoints() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/namespaces/myns/endpoints");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "endpoints"));
    expected = expected.add(new Attribute("namespace", "myns"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleIngresses() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/apis/extensions/v1beta1/namespaces/myns/ingresses");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "ingresses"));
    expected = expected.add(new Attribute("namespace", "myns"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleApiGroups() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor
        .fromPath("/apis/autoscaling/v1/namespaces/myns/horizontalpodautoscalers/myhpa");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "horizontalpodautoscalers"));
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("name", "myhpa"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleCrdsTypeUnknown() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/apis/test.com/v1/namespaces/myns/crds/mycrd");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "crds"));
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("name", "mycrd"));
    expected = expected.add(new Attribute("version", "v1"));
    expected = expected.add(new Attribute("api", "test.com"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleCrds() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/apis/test.com/v1/namespaces/myns/crds/mycrd");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "crds"));
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("name", "mycrd"));
    expected = expected.add(new Attribute("api", "test.com"));
    expected = expected.add(new Attribute("version", "v1"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleCustomResources() {
    CustomResourceDefinitionContext crdContext = new CustomResourceDefinitionContext.Builder()
        .withScope("Namespaced")
        .withPlural("crds")
        .withVersion("v1")
        .withGroup("test.com")
        .withKind("crd")
        .build();

    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    CustomResourceDefinitionProcessor processor = new CustomResourceDefinitionProcessor();
    processor.addCrdContext(crdContext);
    extractor.setCustomResourceDefinitionProcessor(processor);
    String resource = "{\"metadata\":{\"name\":\"myresource\",\"namespace\":\"myns\"}, \"kind\":\"crd\", \"apiVersion\":\"test.com/v1\"}";
    AttributeSet attributes = extractor.fromResource(resource);

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "crds"));
    expected = expected.add(new Attribute("namespace", "myns"));
    expected = expected.add(new Attribute("name", "myresource"));
    expected = expected.add(new Attribute("metadata.name", "myresource"));
    expected = expected.add(new Attribute("metadata.namespace", "myns"));
    expected = expected.add(new Attribute("api", "test.com"));
    expected = expected.add(new Attribute("version", "v1"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleCrdSubresources() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    String[] subresources = new String[] { "status", "scale" };

    String basePath = "/apis/test.com/v1/namespaces/myns/crds/mycrd/";
    for (String subresource : subresources) {
      AttributeSet attributes = extractor.fromPath(basePath + subresource);

      AttributeSet expected = new AttributeSet();
      expected = expected.add(new Attribute("plural", "crds"));
      expected = expected.add(new Attribute("namespace", "myns"));
      expected = expected.add(new Attribute("name", "mycrd"));
      assertTrue(attributes.matches(expected),
          "extracted attributes match for " + subresource + " expectation: " + expected);
    }

    AttributeSet attributes = extractor.fromPath(basePath + "somethingRandom");
    assertTrue(attributes.matches(new AttributeSet()),
        "should extract nothing from an unsupported crd subresource");
  }

  @Test
  void shouldHandleNamespacedResourceLabelSelectorsWithOneLabel() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/namespaces/myns/pods/mypod?labelSelector=name%3Dmyname");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("labels:name", "myname"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleLabelSelectorsWithDoubleEquals() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor
        .fromPath("/api/v1/namespaces/myns/pods/mypod?labelSelector=name%3D%3Dmyname");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("labels:name", "myname"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleLabelSelectorsWithTwoLabels() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor
        .fromPath("/api/v1/namespaces/myns/pods/mypod?labelSelector=name%3Dmyname,age%3D37");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("labels:name", "myname"));
    expected = expected.add(new Attribute("labels:age", "37"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleNamespacedResourceFieldSelectorsWithOneField() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor.fromPath("/api/v1/namespaces/myns/pods/mypod?fieldSelector=testKey%3DtestValue");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("testKey", "testValue"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleFieldSelectorsWithDoubleEquals() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor
        .fromPath("/api/v1/namespaces/myns/pods/mypod?fieldSelector=testKey%3D%3DtestValue");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("testKey", "testValue"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleFieldSelectorsWithTwoLabels() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor
        .fromPath("/api/v1/namespaces/myns/pods/mypod?fieldSelector=keyOne%3DvalueOne,keyTwo%3DvalueTwo");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("plural", "pods"));
    expected = expected.add(new Attribute("keyOne", "valueOne"));
    expected = expected.add(new Attribute("keyTwo", "valueTwo"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void shouldHandleLabelSelectorsWithADomain() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    AttributeSet attributes = extractor
        .fromPath("/api/v1/namespaces/myns/pods/mypod?labelSelector=example.com/name%3Dmyname");

    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("labels:example.com/name", "myname"));
    assertTrue(attributes.matches(expected));
  }

  // https://github.com/fabric8io/kubernetes-client/issues/1688

  @Test
  void getDeploymentsWithLabels() {
    KubernetesServer kubernetesServer = new KubernetesServer(false, true);
    kubernetesServer.before();
    KubernetesClient kubernetesClient = kubernetesServer.getClient();
    Map<String, String> labels = new HashMap<>();
    labels.put("app", "core");
    labels.put("apiVersion", "1.7.1");
    labels.put("keepUntil", "12000");
    Deployment deployment1 = new DeploymentBuilder().withNewMetadata().withName("withKeepUntil").addToLabels(labels)
        .endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment1);

    labels.remove("keepUntil");
    Deployment deployment2 = new DeploymentBuilder().withNewMetadata().withName("withoutKeepUntil")
        .addToLabels(labels).endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment2);

    List<Deployment> deployments = kubernetesClient.apps().deployments().withLabel("app", "core").list().getItems();
    assertTrue(deployments.stream().filter(d -> d.getMetadata().getName().equals("withKeepUntil")).findFirst()
        .isPresent());
    assertTrue(deployments.stream().filter(d -> d.getMetadata().getName().equals("withoutKeepUntil")).findFirst()
        .isPresent());
  }

  @Test
  void getDeploymentsWithoutLabels() {
    KubernetesServer kubernetesServer = new KubernetesServer(false, true);
    kubernetesServer.before();
    KubernetesClient kubernetesClient = kubernetesServer.getClient();
    Map<String, String> labels = new HashMap<>();
    labels.put("app", "core");
    labels.put("apiVersion", "1.7.1");
    labels.put("keepUntil", "12000");
    Deployment deployment1 = new DeploymentBuilder().withNewMetadata().withName("withKeepUntil").addToLabels(labels)
        .endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment1);

    labels.remove("keepUntil");
    Deployment deployment2 = new DeploymentBuilder().withNewMetadata().withName("withoutKeepUntil")
        .addToLabels(labels).endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment2);

    List<Deployment> deployments = kubernetesClient.apps().deployments().withoutLabel("keepUntil", "12000").list()
        .getItems();
    assertFalse(deployments.stream().filter(d -> d.getMetadata().getName().equals("withKeepUntil")).findFirst()
        .isPresent());
    assertTrue(deployments.stream().filter(d -> d.getMetadata().getName().equals("withoutKeepUntil")).findFirst()
        .isPresent());
  }

  @Test
  void getDeploymentsWithAndWithoutLabels() {
    KubernetesServer kubernetesServer = new KubernetesServer(false, true);
    kubernetesServer.before();
    KubernetesClient kubernetesClient = kubernetesServer.getClient();
    Map<String, String> labels = new HashMap<>();
    labels.put("app", "core");
    labels.put("apiVersion", "1.7.1");
    labels.put("keepUntil", "12000");
    Deployment deployment1 = new DeploymentBuilder().withNewMetadata().withName("withKeepUntil").addToLabels(labels)
        .endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment1);

    labels.remove("keepUntil");
    Deployment deployment2 = new DeploymentBuilder().withNewMetadata().withName("withoutKeepUntil")
        .addToLabels(labels).endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment2);

    List<Deployment> deployments = kubernetesClient.apps().deployments().withLabel("app", "core")
        .withoutLabel("keepUntil", "12000").list().getItems();
    assertFalse(deployments.stream().filter(d -> d.getMetadata().getName().equals("withKeepUntil")).findFirst()
        .isPresent());
    assertTrue(deployments.stream().filter(d -> d.getMetadata().getName().equals("withoutKeepUntil")).findFirst()
        .isPresent());
  }

  @Test
  void shouldFilterBasedOnLabelExists() {
    KubernetesServer kubernetesServer = new KubernetesServer(false, true);
    kubernetesServer.before();
    KubernetesClient kubernetesClient = kubernetesServer.getClient();
    Map<String, String> labels = new HashMap<>();
    labels.put("app", "core");
    labels.put("apiVersion", "1.7.1");
    labels.put("keepUntil", "12000");
    Deployment deployment1 = new DeploymentBuilder().withNewMetadata().withName("withKeepUntil").addToLabels(labels)
        .endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment1);

    labels.remove("keepUntil");
    Deployment deployment2 = new DeploymentBuilder().withNewMetadata().withName("withoutKeepUntil")
        .addToLabels(labels).endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment2);

    List<Deployment> deployments = kubernetesClient.apps().deployments().withLabel("keepUntil").list().getItems();
    assertTrue(deployments.stream().anyMatch(d -> d.getMetadata().getName().equals("withKeepUntil")));
    assertTrue(deployments.stream().noneMatch(d -> d.getMetadata().getName().equals("withoutKeepUntil")));
  }

  @Test
  void shouldFilterBasedOnLabelNotExists() {
    KubernetesServer kubernetesServer = new KubernetesServer(false, true);
    kubernetesServer.before();
    KubernetesClient kubernetesClient = kubernetesServer.getClient();
    Map<String, String> labels = new HashMap<>();
    labels.put("app", "core");
    labels.put("apiVersion", "1.7.1");
    labels.put("keepUntil", "12000");
    Deployment deployment1 = new DeploymentBuilder().withNewMetadata().withName("withKeepUntil").addToLabels(labels)
        .endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment1);

    labels.remove("keepUntil");
    Deployment deployment2 = new DeploymentBuilder().withNewMetadata().withName("withoutKeepUntil")
        .addToLabels(labels).endMetadata().withNewStatus().withReadyReplicas(2).endStatus().build();
    kubernetesClient.apps().deployments().create(deployment2);

    List<Deployment> deployments = kubernetesClient.apps().deployments().withoutLabel("keepUntil").list().getItems();
    assertEquals(1, deployments.size());
    assertEquals("withoutKeepUntil", deployments.get(0).getMetadata().getName());
  }

  @Test
  void testCustomResourceAttributesExtraction() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();

    // When
    AttributeSet attributes = extractor
        .fromPath("/apis/demo.fabric8.io/v1alpha1/namespaces/ns1/customdatabases");

    // Then
    AttributeSet expected = new AttributeSet();
    expected = expected.add(new Attribute("namespace", "ns1"));
    expected = expected.add(new Attribute("plural", "customdatabases"));
    expected = expected.add(new Attribute("api", "demo.fabric8.io"));
    expected = expected.add(new Attribute("version", "v1alpha1"));
    assertTrue(attributes.matches(expected));
  }

  @Test
  void kubernetesPathIngresses() {
    KubernetesAttributesExtractor extractor = new KubernetesAttributesExtractor();
    Map<String, String> attributes = extractor
        .fromKubernetesPath("/apis/extensions/v1beta1/namespaces/myns/ingresses/myingress");

    assertEquals("ingresses", attributes.get(KubernetesAttributesExtractor.PLURAL));
  }

  @Test
  void testMultipleCrdVersions() throws IOException {
    helpTestMultipleCrdVersions(true);
  }

  @Test
  void testMultipleCrdVersionsUnregistered() throws IOException {
    helpTestMultipleCrdVersions(false);
  }

  private void helpTestMultipleCrdVersions(boolean registered) throws IOException {
    CustomResourceDefinitionContext crdContextV1 = new CustomResourceDefinitionContext.Builder()
        .withScope("Namespaced")
        .withPlural("customdatabases")
        .withVersion("v1")
        .withGroup("demo.fabric8.io")
        .withKind("CustomDatabase")
        .build();

    CustomResourceDefinitionContext crdContextV1Alpha1 = new CustomResourceDefinitionContext.Builder()
        .withScope("Namespaced")
        .withPlural("customdatabases")
        .withVersion("v1alpha1")
        .withGroup("demo.fabric8.io")
        .withKind("CustomDatabase")
        .build();

    KubernetesServer kubernetesServer = new KubernetesServer(false, true,
        registered ? Arrays.asList(crdContextV1, crdContextV1Alpha1) : Collections.emptyList());
    kubernetesServer.before();
    KubernetesClient kubernetesClient = kubernetesServer.getClient();

    GenericKubernetesResource gkr = new GenericKubernetesResource();
    gkr.setMetadata(new ObjectMetaBuilder().withName("v1").build());
    gkr.setKind("CustomDatabase");
    gkr.setApiVersion("demo.fabric8.io/v1");

    kubernetesClient.genericKubernetesResources(crdContextV1).create(gkr);

    gkr.setApiVersion("demo.fabric8.io/v1alpha1");
    kubernetesClient.genericKubernetesResources(crdContextV1Alpha1).create(gkr);

    assertEquals(1, kubernetesClient.genericKubernetesResources(crdContextV1).list().getItems().size());
    assertEquals(1, kubernetesClient.genericKubernetesResources(crdContextV1Alpha1).list().getItems().size());
  }
}


text:
awk '
  # Store the first line in prev, so we dont print a blank line
  BEGIN { getline; prev = $0 };
  {
    # Set the output record separator to either \n or space depending on whether
    # the current line begins with whitespace. This means that when we print
    # anything out (such as the previous line which we do in the next step), we
    # will either include a newline or a space depending on whether we want to
    # join the lines or not.
    ORS=($0 ~ /^\S/)?"\n":" ";
    # Print the previous line (either with or without a newline appropriately)
    print prev;
    # Strip any whitespace at the beginning of the current line, before storing
    # it as the previous line. This just means we dont include any preceding
    # whitespace when joining lines together. If we skipped this line, all
    # whitespace would be included when the lines are joined.
    sub(/^\s+/, "", $0);
    # And store the current line as the previous one
    prev = $0
  };
  # At the end, we need to print out the previous line regardless (and with a
  # trailing newline, so we reset the value of ORS)
  END { ORS="\n"; print prev }
'


text:
package com.google.cloud.translate.v3.samples;

// [START translation_v3_generated_translationserviceclient_batchtranslatetext_lro_async]
import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.translate.v3.BatchTranslateMetadata;
import com.google.cloud.translate.v3.BatchTranslateResponse;
import com.google.cloud.translate.v3.BatchTranslateTextRequest;
import com.google.cloud.translate.v3.InputConfig;
import com.google.cloud.translate.v3.LocationName;
import com.google.cloud.translate.v3.OutputConfig;
import com.google.cloud.translate.v3.TranslateTextGlossaryConfig;
import com.google.cloud.translate.v3.TranslationServiceClient;
import java.util.ArrayList;
import java.util.HashMap;

public class AsyncBatchTranslateTextLRO {

  public static void main(String[] args) throws Exception {
    asyncBatchTranslateTextLRO();
  }

  public static void asyncBatchTranslateTextLRO() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
      BatchTranslateTextRequest request =
          BatchTranslateTextRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setSourceLanguageCode("sourceLanguageCode1645917472")
              .addAllTargetLanguageCodes(new ArrayList<String>())
              .putAllModels(new HashMap<String, String>())
              .addAllInputConfigs(new ArrayList<InputConfig>())
              .setOutputConfig(OutputConfig.newBuilder().build())
              .putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
              .putAllLabels(new HashMap<String, String>())
              .build();
      OperationFuture<BatchTranslateResponse, BatchTranslateMetadata> future =
          translationServiceClient.batchTranslateTextOperationCallable().futureCall(request);
      // Do something.
      BatchTranslateResponse response = future.get();
    }
  }
}
// [END translation_v3_generated_translationserviceclient_batchtranslatetext_lro_async]


text:
namespace System.Windows.Forms
{
    using System.Collections.Generic;
    using System.Drawing;
    using System.Linq;
    using System.Text;

    [Obsolete("WIP")]
    public class TextBoxBase : Control
    {
        internal readonly TextCursor cursor;

        /*
         * --------------------line start |
         * -----top offset                |
         *   text                         | item height
         * -----bottom offset             |
         * --------------------line end   |
         */
        internal int itemHeight = 16;
        internal int itemTextBottomOffset = 4;
        internal int itemTextTopOffset = 2;
        internal char[] nextWordStopAtChars = { ' ' }; // Characters that will prevent moving cursor with Ctrl + Arrows.

        private readonly Pen cursorPen = new Pen(Color.Black);
        private readonly SolidBrush backBrush = new SolidBrush(Color.Transparent);
        private readonly SolidBrush textBrush = new SolidBrush(Color.Black);

        private ScrollBar vscroll;
        private Color selectionColor = Color.FromArgb(173, 214, 255);
        private int selectionStart;
        private int selectionLength;
        private int selectionLine;
        private int selectionRx1, selectionRx2;
        private List<string> lines = new List<string>();

        public TextBoxBase()
        {
            BackColor = Color.FromArgb(245, 245, 245);

            cursor = new TextCursor(this);
            cursor.ResetCursorPaintMode();

            vscroll = new VScrollBar();
            vscroll.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            vscroll.Location = new Point(Width - vscroll.Width, 0);
            vscroll.Height = Height;

            Controls.Add(vscroll);
        }

        public override Color BackColor
        {
            get { return backBrush.Color; }
            set { backBrush.Color = value; }
        }
        public override Color ForeColor
        {
            get { return textBrush.Color; }
            set { textBrush.Color = value; }
        }
        public override string Text
        {
            get
            {
                var builder = new StringBuilder();
                for (int i = 0; i < lines.Count; i++)
                    builder.Append(lines[i] + Environment.NewLine);
                return builder.ToString();
            }
            set
            {
                lines = new List<string>();
                if (string.IsNullOrEmpty(value))
                {
                    this.lines.Add(string.Empty);
                    return;
                }
                var vlines = value.Replace("\r", "").Split('\n');
                lines.AddRange(vlines);

                PerformLayout();
            }
        }

        protected internal virtual void OnPaintCursor(PaintEventArgs e)
        {
            var itemTextHeight = itemHeight + itemTextTopOffset + itemTextBottomOffset;

            // Paint cursor.
            if (Focused && cursor.renderMode)
            {
                cursorPen.Color = ForeColor;
                var cursorRenderY = GetLineRenderY(cursor.y);
                e.Graphics.DrawLine(cursorPen, cursor.renderX, cursorRenderY, cursor.renderX, cursorRenderY + itemHeight - itemTextTopOffset);
            }
        }

        protected override void OnGotFocus(EventArgs e)
        {
            cursor.ResetCursorPaintMode();

            base.OnGotFocus(e);
        }
        protected override void OnLayout(LayoutEventArgs e)
        {
            base.OnLayout(e);

            UpdateScrolls();
        }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);

            var keyCode = e.KeyCode;
            var ctrlMod = e.Control;
            var shiftMod = e.Shift;
            switch (keyCode)
            {
                // Basic navigation.
                case Keys.Down: CursorMoveDown(ctrlMod, shiftMod); return;
                case Keys.Left: CursorMoveLeft(ctrlMod, shiftMod); return;
                case Keys.Right: CursorMoveRight(ctrlMod, shiftMod); return;
                case Keys.Up: CursorMoveUp(ctrlMod, shiftMod); return;

                case Keys.End: cursor.MoveToLineEnd(); return;
                case Keys.Home: cursor.MoveToLineStart(); return;

                case Keys.Back: CursorRemoveTextToLeft(); return;
                case Keys.Delete: CursorRemoveTextToRight(); return;
                case Keys.Enter:
                    lines.Insert(cursor.y + 1, "");
                    cursor.MoveDown();
                    return;
            }

            var lastChar = KeyHelper.GetLastInputChar();

            CursorInsertText(lastChar.ToString());
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            CursorSetAt(e.X, e.Y);
        }
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (e.Button == MouseButtons.Right)
            {
                var itemCut = new ToolStripMenuItem("Cut");
                itemCut.Enabled = false;

                var itemCopy = new ToolStripMenuItem("Copy");
                itemCopy.Enabled = false;

                var itemPaste = new ToolStripMenuItem("Paste");
                itemPaste.Enabled = false;

                var context = new ContextMenuStrip();

                context.Items.Add(itemCut);
                context.Items.Add(itemCopy);
                context.Items.Add(itemPaste);

                context.Show(this, e.Location);
            }
        }
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            base.OnMouseWheel(e);

            vscroll.Value -= e.Delta * 2;
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            var g = e.Graphics;
            var height = Height;
            var width = Width;
            var itemTextHeight = itemHeight + itemTextTopOffset + itemTextBottomOffset;

            g.FillRectangle(backBrush, 0, 0, width, height);

            // Selection.
            if (selectionLength != 0)
            {
                selectionRx1 = (int)g.MeasureString(SubstringSafe(lines[selectionLine], 0, selectionStart), Font).Width;
                selectionRx2 = (int)g.MeasureString(SubstringSafe(lines[selectionLine], 0, selectionStart + selectionLength), Font).Width;
                g.uwfFillRectangle(selectionColor, selectionRx1, GetLineRenderY(selectionLine), selectionRx2 - selectionRx1, itemTextHeight - itemTextBottomOffset);
            }

            // Cursor.
            cursor.UpdateCursorPaintMode();
            cursor.UpdateRenderLocation(g);

            OnPaintCursor(e);

            // Text.
            var scrollIndex = vscroll.Value;
            var startLineIndex = scrollIndex / itemHeight - 1;
            var endLineIndex = (scrollIndex + vscroll.LargeChange) / itemHeight + 1;

            if (startLineIndex < 0) startLineIndex = 0;

            for (int i = startLineIndex; i < lines.Count && i <= endLineIndex; i++)
                g.uwfDrawString(lines[i], Font, textBrush, 0, GetLineRenderY(i), Width, itemTextHeight);
        }

        private static string SubstringSafe(string s, int start, int length)
        {
            if (start + length > s.Length)
                length = s.Length - start;

            return s.Substring(start, length);
        }

        private int GetLineRenderY(int line)
        {
            return line * itemHeight - itemTextBottomOffset - vscroll.Value;// * vscroll.SmallChange;
        }
        private void CursorEnsureVisible()
        {
            var cursorRx = cursor.y * itemHeight;
            if (cursorRx < vscroll.Value) // To top.
            {
                vscroll.Value = cursorRx;
                return;
            }

            if (cursorRx + vscroll.SmallChange > vscroll.Value + vscroll.LargeChange) // To bottom.
                vscroll.Value = cursorRx - vscroll.LargeChange + vscroll.SmallChange;
        }
        private void CursorInsertText(string value, bool moveCursor = true)
        {
            lines[cursor.y] = lines[cursor.Y].Insert(cursor.x, value);

            if (moveCursor)
            {
                cursor.x += value.Length;
                cursor.renderXRecalculate = true;
                cursor.ResetCursorPaintMode();
            }
        }
        private void CursorMoveDown(bool ctrlMod, bool shiftMod)
        {
            if (ctrlMod)
            {
                vscroll.Value += vscroll.SmallChange;
                return;
            }

            if (shiftMod)
            {
            }
            else
                ResetSelection();

            cursor.MoveDown();
            CursorEnsureVisible();
        }
        private void CursorMoveLeft(bool ctrlMod, bool shiftMod)
        {
            var amount = 1;
            if (ctrlMod)
            {
                var str = lines[cursor.y].Substring(0, cursor.x).TrimEnd(' ');
                for (int i = str.Length - 1; i >= 0; i--, amount++)
                    if (nextWordStopAtChars.Contains(str[i]))
                        break;
            }

            if (shiftMod)
            {
                if (selectionLength == 0)
                {
                    selectionStart = cursor.x;
                    selectionLine = cursor.y;
                }

                selectionLength -= amount;
            }
            else
                ResetSelection();

            cursor.MoveLeft(amount);
            CursorEnsureVisible();
        }
        private void CursorMoveRight(bool ctrlMod, bool shiftMod)
        {
            var amount = 1;
            if (ctrlMod)
            {
                var str = lines[cursor.y].Substring(cursor.x).TrimStart(' ');
                for (int i = 0; i < str.Length; i++, amount++)
                    if (nextWordStopAtChars.Contains(str[i]))
                        break;
            }

            if (shiftMod) // Add chars to select.
            {
                if (selectionLength == 0)
                {
                    selectionStart = cursor.x;
                    selectionLine = cursor.y;
                }

                selectionLength += amount;
            }
            else
                ResetSelection();

            cursor.MoveRight(amount);
            CursorEnsureVisible();
        }
        private void CursorMoveUp(bool ctrlMod, bool shiftMod)
        {
            if (ctrlMod)
            {
                vscroll.Value -= vscroll.SmallChange;
                return;
            }

            if (shiftMod)
            {
            }
            else
                ResetSelection();

            cursor.MoveUp();
            CursorEnsureVisible();
        }
        private void CursorRemoveTextToLeft(int amount = 1) // default 'Backspace' action.
        {
            if (cursor.x < amount)
                amount = cursor.x;

            if (amount == 0)
            {
                // Remove line.
                if (cursor.y > 0)
                {
                    var str = lines[cursor.y];

                    lines.RemoveAt(cursor.Y);
                    cursor.MoveLeft();
                    CursorInsertText(str, false);
                }
                return;
            }

            lines[cursor.Y] = lines[cursor.y].Remove(cursor.x - amount, amount);

            cursor.x -= amount;
            cursor.renderXRecalculate = true;
            cursor.ResetCursorPaintMode();
        }
        private void CursorRemoveTextToRight(int amount = 1) // default 'Delete' action.
        {
            var line = lines[cursor.y];
            if (cursor.x >= line.Length)
            {
                // Copy next line and concat to current one.
                if (cursor.y + 1 < lines.Count)
                {
                    lines[cursor.y] = line + lines[cursor.y + 1];
                    lines.RemoveAt(cursor.y + 1);
                }

                return;
            }

            lines[cursor.y] = line.Remove(cursor.x, amount);
        }
        private void CursorSetAt(int renderX, int renderY)
        {
            ResetSelection();

            cursor.y = (vscroll.Value + renderY) / itemHeight;

            cursor.renderXRecalculate = true;
            cursor.FixLocation();
            cursor.ResetCursorPaintMode();
            cursor.ResolveRenderLocation(renderX);
        }
        private void ResetSelection()
        {
            selectionLength = 0;
        }
        private void UpdateScrolls()
        {
            vscroll.Maximum = itemHeight * lines.Count;
            vscroll.LargeChange = Height;
            vscroll.SmallChange = itemHeight;
        }

        internal class TextCursor
        {
            public bool renderMode;
            public float renderWaitTime = 1f;
            public float renderWaitTimeCurrent;
            public int renderX;
            public bool renderXRecalculate = true;

            internal int x;
            internal int y;

            private readonly TextBoxBase owner;

            private bool resolveX;
            private int resolveXAt;

            public TextCursor(TextBoxBase owner)
            {
                this.owner = owner;
            }

            public int X
            {
                get { return x; }
                set
                {
                    if (x == value)
                        return;
                    x = value;
                    renderXRecalculate = true;
                }
            }
            public int Y
            {
                get { return y; }
                set { y = value; }
            }

            public void FixLocation()
            {
                var checkBotttom = y < owner.lines.Count;
                if (checkBotttom == false)
                    Y = owner.lines.Count - 1;

                var checkTop = y >= 0;
                if (checkTop == false)
                    Y = 0;

                var line = owner.lines[y];

                var checkRight = x < line.Length + 1;
                if (checkRight == false)
                    X = line.Length;

                var checkLeft = x >= 0;
                if (checkLeft == false)
                    X = 0;
            }
            public void MoveDown(int amount = 1)
            {
                y += amount;

                FixLocation();
                ResetCursorPaintMode();
            }
            public void MoveLeft(int amount = 1)
            {
                x -= amount;
                if (x < 0 && y > 0)
                {
                    // Move up.
                    y--;
                    MoveToLineEnd();
                }

                renderXRecalculate = true;
                FixLocation();
                ResetCursorPaintMode();
            }
            public void MoveRight(int amount = 1)
            {
                var nx = amount + x;
                var line = owner.lines[y];
                if (nx >= line.Length + 1) // Try move to next line.
                {
                    if (y + 1 < owner.lines.Count)
                    {
                        MoveToLineStart();
                        MoveDown();
                    }
                }
                else
                {
                    x = nx;
                    renderXRecalculate = true;
                    FixLocation();
                    ResetCursorPaintMode();
                }
            }
            public void MoveUp(int amount = 1)
            {
                y -= amount;

                FixLocation();
                ResetCursorPaintMode();
            }
            public void MoveToLineEnd()
            {
                var estIndex = owner.lines[y].Length;
                if (x == estIndex)
                    return;

                x = estIndex;
                renderXRecalculate = true;
                ResetCursorPaintMode();
            }
            public void MoveToLineStart()
            {
                if (x == 0)
                    return;

                x = 0;
                renderXRecalculate = true;
                ResetCursorPaintMode();
            }
            public void ResetCursorPaintMode()
            {
                renderWaitTimeCurrent = 0;
                renderMode = false;
            }
            public void ResolveRenderLocation(int rx)
            {
                resolveX = true;
                resolveXAt = rx;
            }
            public void Set(int nx, int ny)
            {
                X = nx;
                Y = ny;
            }
            public void UpdateCursorPaintMode()
            {
                renderWaitTimeCurrent -= swfHelper.GetDeltaTime();
                if (!(renderWaitTimeCurrent <= 0)) return;

                renderMode = !renderMode;
                renderWaitTimeCurrent = renderWaitTime;
            }
            public void UpdateRenderLocation(Graphics g)
            {
                if (resolveX)
                {
                    var line = owner.lines[y];
                    var charAt = line.Length;
                    for (int i = 0; i < line.Length; i++)
                    {
                        var str = line.Substring(0, i);
                        var textSize = g.MeasureString(str, owner.Font);
                        if (resolveXAt > textSize.Width - 1)
                            continue;

                        charAt = i - 1;
                        break;
                    }

                    if (charAt < 0)
                        charAt = 0;

                    x = charAt;
                    renderXRecalculate = true;
                    resolveX = false;
                    FixLocation();
                }

                if (renderXRecalculate == false)
                    return;

                if (x == 0)
                {
                    renderX = 0;
                    renderXRecalculate = false;
                }
                else
                {
                    var line = owner.lines[y];
                    var cursorText = line.Substring(0, x);
                    var textSize = g.MeasureString(cursorText, owner.Font);
                    renderX = (int)textSize.Width;
                    renderXRecalculate = false;
                }
            }
        }
    }
}


text:
<?php

namespace Fnayou\InstapushPHP\Api;

use Fnayou\InstapushPHP\Exception\ApiException;
use Fnayou\InstapushPHP\InstapushClient;
use Fnayou\InstapushPHP\Model\ApiError;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * Class AbstractApi.
 */
abstract class AbstractApi
{
    /** @var \Fnayou\InstapushPHP\InstapushClient */
    private $instapushClient;

    /** @var \Psr\Http\Message\RequestInterface */
    private $request;

    /** @var \Psr\Http\Message\ResponseInterface */
    private $response;

    /**
     * @param \Fnayou\InstapushPHP\InstapushClient $instapushClient
     */
    public function __construct(InstapushClient $instapushClient)
    {
        $this->instapushClient = $instapushClient;
    }

    /**
     * @return \Fnayou\InstapushPHP\InstapushClient
     */
    public function getInstapushClient()
    {
        return $this->instapushClient;
    }

    /**
     * @return \Psr\Http\Message\RequestInterface
     */
    public function getRequest()
    {
        return $this->request;
    }

    /**
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function getResponse()
    {
        return $this->response;
    }

    /**
     * @param \Fnayou\InstapushPHP\InstapushClient $instapushClient
     *
     * @return $this
     */
    protected function setInstapushClient(InstapushClient $instapushClient)
    {
        $this->instapushClient = $instapushClient;

        return $this;
    }

    /**
     * @param \Psr\Http\Message\RequestInterface $request
     *
     * @return $this
     */
    protected function setRequest(RequestInterface $request)
    {
        $this->request = $request;

        return $this;
    }

    /**
     * @param \Psr\Http\Message\ResponseInterface $response
     *
     * @return $this
     */
    protected function setResponse(ResponseInterface $response)
    {
        $this->response = $response;

        return $this;
    }

    /**
     * @param string $path
     * @param array  $parameters
     * @param array  $headers
     *
     * @return $this
     */
    protected function doGet(string $path, array $parameters = [], array $headers = [])
    {
        if (0 < \count($parameters)) {
            $path .= '?'.\http_build_query($parameters);
        }

        $request = $this
            ->getInstapushClient()
            ->getRequestFactory()
            ->createRequest('GET', $path, $headers);

        $this->setRequest($request);

        $response = $this
            ->getInstapushClient()
            ->getHttpClient()
            ->sendRequest($request);

        $this->setResponse($response);

        return $this;
    }

    /**
     * @param string $path
     * @param array  $parameters
     * @param array  $headers
     *
     * @return $this
     */
    protected function doPost(string $path, array $parameters = [], array $headers = [])
    {
        $body = \json_encode($parameters);

        $request = $this
            ->getInstapushClient()
            ->getRequestFactory()
            ->createRequest('POST', $path, $headers, $body);

        $this->setRequest($request);

        $response = $this
            ->getInstapushClient()
            ->getHttpClient()
            ->sendRequest($request);

        $this->setResponse($response);

        return $this;
    }

    /**
     * @param string $class
     *
     * @return mixed
     */
    protected function transformResponse(string $class = null)
    {
        if (200 !== $this->getResponse()->getStatusCode()
            && 201 !== $this->getResponse()->getStatusCode()
        ) {
            return $this->handleException();
        }

        if (null === $this->getInstapushClient()->getTransformer() || null === $class) {
            return \json_decode($this->getResponse()->getBody()->getContents(), true);
        }

        return $this->getInstapushClient()->getTransformer()->transform($this->getResponse(), $class);
    }

    /**
     * @throws \Fnayou\InstapushPHP\Exception\ApiException
     *
     * @return \Fnayou\InstapushPHP\Model\ApiError
     */
    protected function handleException()
    {
        $this->handleNotJsonException($this->getResponse());

        if (false === $this->getInstapushClient()->isHandleException()) {
            return $this
                ->getInstapushClient()
                ->getTransformer()
                ->transform($this->getResponse(), ApiError::class);
        }

        $content = \json_decode($this->getResponse()->getBody()->__toString(), true);

        $message = true === isset($content['msg']) ? $content['msg'] : 'An unexpected error occurred : '.$content;

        throw new ApiException($message, $this->getRequest(), $this->getResponse());
    }

    /**
     * @param ResponseInterface $response
     *
     * @throws \Fnayou\InstapushPHP\Exception\ApiException
     */
    protected function handleNotJsonException(ResponseInterface $response)
    {
        if (true !== $response->hasHeader('Content-Type')
            || 'application/json' !== $response->getHeaderLine('Content-Type')
        ) {
            throw new ApiException(
                \sprintf(
                    'Waiting for json response but %s given',
                    $response->getHeaderLine('Content-Type')
                ),
                $this->getRequest(),
                $response
            );
        }
    }
}


text:
package com.jetbrains.edu.learning.actions;

import com.intellij.ide.BrowserUtil;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
import com.jetbrains.edu.learning.stepic.EduStepikUtils;
import icons.EducationalCoreIcons;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

public class StudyOpenTaskInStepikAction extends StudyActionWithShortcut {
  public static final String SHORTCUT = "ctrl alt pressed HOME";
  public static final String ACTION_ID = "Edu.OpenTaskInStepik";
  private static final String TEXT = "Open this task in Stepik";

  public StudyOpenTaskInStepikAction() {
    super(getTextWithShortcuts(), TEXT, EducationalCoreIcons.Stepik);
  }

  @NotNull
  private static String getTextWithShortcuts() {
    return TEXT + "(" + KeymapUtil.getShortcutText(new KeyboardShortcut(KeyStroke.getKeyStroke(SHORTCUT), null)) + ")";
  }

  @Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) {
      return;
    }
    Task currentTask = StudyUtils.getCurrentTask(project);

    String link = EduStepikUtils.getLink(currentTask);
    if (link != null) {
      BrowserUtil.browse(link);
    }
  }

  @Override
  public void update(AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    StudyUtils.updateAction(e);
    Project project = e.getProject();
    if (project == null) {
      presentation.setVisible(false);
      return;
    }
    Task currentTask = StudyUtils.getCurrentTask(project);

    String link = EduStepikUtils.getLink(currentTask);
    boolean visible = link != null;
    presentation.setVisible(visible);
    presentation.setEnabled(visible);
    if (visible) {
      presentation.setText(getTextWithShortcuts() + '\n' + link);
    }
  }

  @NotNull
  @Override
  public String getActionId() {
    return ACTION_ID;
  }

  @Override
  public String[] getShortcuts() {
    return new String[]{SHORTCUT};
  }
}


text:
set -e
set -u
set -x

curdir="$(dirname "$0")"
platform=$(uname)
if [[ "$platform" == "Linux" ]]; then
    subdir='linux/'
    makecmd='make && make install'
    sudo apt-get install libssl-dev libpam-dev
    pwd
    cd $curdir/$subdir
    make && make install
elif [[ "$platform" == "Darwin" ]]; then
    subdir='osx/prebuilt/'
    makecmd='./install.sh'
    cd $curdir/$subdir
    ./install.sh
fi

cd -


text:
using Internal.Runtime.Augments;
using System.Runtime.CompilerServices;
using System.Text;

namespace System
{
    internal static partial class SR
    {
        //
        // Lower level libraries like System.Private.CoreLib, System.Private.Uri and other System.Private.* libraries.
        // cannot depend on System.Resources.ResourceManager directly, so we'll call Windows Runtime ResourceManager
        // directly using Internal.Runtime.Augments.
        // For other assemblies, we use System.Resources.ResourceManager to do the resources lookup. it is important to
        // not have such assemblies depend on internal contracts as we can decide to make these assemblies portable.
        //

        private static object s_resourceMap;
        private const string MoreInfoLink = @". For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485";

        private static object ResourceMap
        {
            get
            {
                return s_resourceMap = s_resourceMap ?? WinRTInterop.Callbacks.GetResourceMap(s_resourcesName);
            }
        }

        // This method is used to decide if we need to append the exception message parameters to the message when calling SR.Format.
        // by default it returns false. We overwrite the implementation of this method to return true through IL transformer
        // when compiling ProjectN app as retail build.
        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool UsingResourceKeys()
        {
            return false;
        }

        // TODO: Resouce generation tool should be modified to call this version in release build
        [MethodImpl(MethodImplOptions.NoInlining)]
        internal static string GetResourceString(string resourceKey)
        {
            return WinRTInterop.Callbacks.GetResourceString(ResourceMap, resourceKey, null);
        }

        internal static string GetResourceString(string resourceKey, string defaultString)
        {
            string resourceString = GetResourceString(resourceKey);

            // if we are running on desktop, GetResourceString will just return resourceKey. so
            // in this case we'll return defaultString (if it is not null).
            if (defaultString != null && resourceKey.Equals(resourceString))
            {
                return defaultString;
            }

            if (resourceString == null)
            {
                // It is not expected to have resourceString is null at this point.
                // this means our framework resources is missing while it is expected to be there.
                // we have to throw on that or otherwise we'll eventually get stack overflow exception.
                // we have to use hardcode the exception message here as we cannot lookup the resources for other keys.
                // We cannot throw MissingManifestResourceException as we cannot depend on the System.Resources here.

                throw new InvalidProgramException("Unable to find resource for the key " + resourceKey + ".");
            }

            return resourceString;
        }

        internal static string Format(string resourceFormat, params object[] args)
        {
            if (args != null)
            {
                if (UsingResourceKeys())
                {
                    return resourceFormat + string.Join(", ", args) + MoreInfoLink;
                }

                return string.Format(resourceFormat, args);
            }

            return resourceFormat;
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        internal static string Format(string resourceFormat, object p1)
        {
            if (UsingResourceKeys())
            {
                return string.Join(", ", resourceFormat, p1) + MoreInfoLink;
            }

            return string.Format(resourceFormat, p1);
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        internal static string Format(string resourceFormat, object p1, object p2)
        {
            if (UsingResourceKeys())
            {
                return string.Join(", ", resourceFormat, p1, p2) + MoreInfoLink;
            }

            return string.Format(resourceFormat, p1, p2);
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        internal static string Format(string resourceFormat, object p1, object p2, object p3)
        {
            if (UsingResourceKeys())
            {
                return string.Join(", ", resourceFormat, p1, p2, p3) + MoreInfoLink;
            }
            return string.Format(resourceFormat, p1, p2, p3);
        }
    }
}


text:
<?php
namespace app\boot;

/**
 * Starts, destroys and regenerates session.
 *
 * @author     Serhan Polat
 * @version    2.0
 */

class Session
{
    /**
     * Refresh / regenerate interval in seconds
     */
    public $refreshInterval = 900;

    function __construct() {}

    function __clone() {}

    public function destroy()
    {
        session_unset();
        session_destroy();
    }

    public function refresh()
    {
        if (session_status() == PHP_SESSION_NONE) {
            session_start();
        }
        if (isset($_SESSION['session_created'])) {
            if (TIME - $_SESSION['session_created'] > $this->refreshInterval) {
                session_regenerate_id();
            }
        } else {
            $_SESSION['session_created'] = TIME;
        }
    }
}


text:
int main(int argc, char *argv[])
{
  printf("Hello Yocto World...\n");

  LibHelloWorld();

  return 0;
}


text:
"""add indexes on FK referencing l_areas.id_area

Revision ID: e0ac4c9f5c0a
Revises: 6afe74833ed0
Create Date: 2021-09-15 09:26:08.125615

"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = 'e0ac4c9f5c0a'
down_revision = '6afe74833ed0'
branch_labels = None
depends_on = None

def upgrade():
    op.create_index('index_li_grids_id_area',
        schema='ref_geo', table_name='li_grids', columns=['id_area'])
    op.create_index('index_li_municipalities_id_area',
        schema='ref_geo', table_name='li_municipalities', columns=['id_area'])

def downgrade():
    op.drop_index('index_li_grids_id_area', schema='ref_geo', table_name='li_grids')
    op.drop_index('index_li_municipalities_id_area', schema='ref_geo', table_name='li_municipalities')


text:
<template id="dice-roller-3" >

<slot></slot>

</template>


text:
package ge.edu.freeuni.sdp.iot.service.camera_object_recognizer.service;

import com.microsoft.azure.storage.StorageException;
import ge.edu.freeuni.sdp.iot.service.camera_object_recognizer.data.Repository;
import ge.edu.freeuni.sdp.iot.service.camera_object_recognizer.data.RepositoryFactory;
import ge.edu.freeuni.sdp.iot.service.camera_object_recognizer.model.ObjectEntity;
import ge.edu.freeuni.sdp.iot.service.camera_object_recognizer.proxy.ProxyFactory;

import javax.validation.constraints.NotNull;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Path("/houses/{house_id}/objects")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class ObjectService extends Services {

    @GET
    public List<ObjectDo> getList(@PathParam("house_id") String houseId) throws StorageException {

        if (!houseExists(houseId))
            throw new NotFoundException();
        List<ObjectDo> result = new ArrayList<>();
        for (ObjectEntity obj : getRepository().getAll(houseId)) {
            result.add(obj.toDo());
        }
        return result;
    }

    @POST
    public ObjectDo addObject(@PathParam("house_id") String houseId, @NotNull ObjectDo obj) throws StorageException {
        if (!houseExists(houseId) || obj.getType() == null)
            throw new NotFoundException();
        obj.setId(UUID.randomUUID().toString());
        try {
            getRepository().insertOrUpdate(ObjectEntity.fromDo(houseId, obj));
        } catch (StorageException e) {
            throw new InternalServerErrorException();
        }
        return obj;
    }

    @GET
    @Path("{object_id}")
    public ObjectDo getObjectById(@PathParam("house_id") String houseId,
                                  @PathParam("object_id") String objectId) throws StorageException {
        ObjectEntity entity = getRepository().find(houseId, objectId);
        if (!houseExists(houseId) || entity == null)
            throw new NotFoundException();
        return entity.toDo();
    }

    @PUT
    @Path("{object_id}")
    public ObjectDo updateObjectById(@PathParam("house_id") String houseId,
                                     @PathParam("object_id") String objectId,
                                     @NotNull ObjectDo obj) throws StorageException {
        ObjectDo objectDo = getObjectById(houseId, objectId);
        // all errors are handled in get object by id
        objectDo.setType(obj.getType());
        getRepository().insertOrUpdate(ObjectEntity.fromDo(houseId, objectDo));
        return objectDo;
    }

    @DELETE
    @Path("{object_id}")
    public Response deleteObjectById(@PathParam("house_id") String houseId,
                                     @PathParam("object_id") String objectId) throws StorageException {
        getObjectById(houseId, objectId);
        // all errors are handled in get object by id
        getRepository().delete(houseId, objectId);
        return Response.ok().build();
    }

}