text:
This cookbook provides some tools that make managing application configuration
more convenient.

## How's That?

When using Chef to configure an application, what's the best mechanism to use to
store that configuration data? Node attributes? Sure, those are good for some
things. What about secrets? chef-vault or encrypted data bag items might be
good, but not for everything. How about data bags? OK, sure. Maybe you just have
a few things in a Hash that you want to add too.

The AppConfig object lets you take data from different sources like this, deep merge
it all together, and output it in ways amenable to using in configuration files.

## Usage

Add this cookbook to your dependencies in metadata.rb:

```ruby
depends "app_config"
```

In a recipe:

```ruby
app_config = AppConfig.new(
  chef_vault_item("secrets", "my_app_secrets"),
  data_bag_item("my_app"),
  node['my_app'],
  { :other_data_for => "my_app" }
)
```

Any list of Hash-like objects will do as arguments.

The AppConfig object inherits from Chef's
[Mash](http://www.rubydoc.info/gems/chef/Mash), and inherits all of those
methods.

### Output Formats

It's best to use a `file` resource along with AppConfig objects:

```ruby
file "my_config.yml" do
  content app_config.to_yaml
end
```

#### to_yaml

Outputs YAML, but doesn't use any of the object indicators (`!ruby/hash:Mash`,
etc.), which can cause problems with some applications that read YAML as
configuration data.

#### to_environment_variables

Programs like [direnv](http://direnv.net/) and
[dotenv](https://github.com/bkeepers/dotenv), make it easy to load environment
variables from files into your app. With `#to_environment_variables`, you can
write those files. A data structure that looks like:

```ruby
{
  :github_key => "abcde",
  :api_username => "testuser",
  :feature_flag_x => true
}
```

Will output a string that looks like:

```
export GITHUB_KEY="abcde"
export API_USERNAME="testuser"
export FEATURE_FLAG_X="true"
```

This works if you use a flat structure. Strings, numbers, and booleans will all
output as strings. Collection objects like arrays and hashes will be ignored.
Keys will be uppercased, as is conventional with environment variables.

### Sharing Data Across Recipes

If you need to share the config data object between separate recipes, create the
AppConfig object in the first recipe you load and use the `node.run_state`:

```ruby
# recipe A
node.run_state[:app_config] ||= AppConfig.new(...)

# recipe B
include_recipe "my_cookbook:recipe_a"
app_config = node.run_state[:app_config]
```

## Contributing

### Running the Specs

If you're using [ChefDK](http://downloads.chef.io/chef-dk/), run
`chef exec rspec` to run the RSpec tests.

## License

Copyright (c) 2015 Nathan L Smith

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


text:
'use strict';
'use strict';
angular.module('copayApp.services')
  .factory('addressService', function(profileService, $log, $timeout) {
    var root = {};

    root.expireAddress = function(walletId,cb) {
        $log.debug('Cleaning Address ' + walletId );
        cb();
    };

    root._createAddress = function(walletId, cb) {
      var client = profileService.getClient(walletId);

      $log.debug('Creating address for wallet:', walletId);

      client.createAddress(0, function(err, addr) {
        if (err)
            throw "impossible err creating address";
        return cb(null, addr.address);
      });
    };

    root.getAddress = function(walletId, forceNew, cb) {
        if (forceNew) {
            root._createAddress(walletId, function(err, addr) {
				$timeout(function(){
					if (err)
						return cb(err);
					cb(null, addr);
				});
            });
        }
        else {
            var client = profileService.getClient(walletId);
            client.getAddresses({reverse: true, limit: 1, is_change: 0}, function(err, addr) {
				$timeout(function(){
					if (err)
						return cb(err);
					if (addr.length > 0)
						return cb(null, addr[0].address);
					else // issue new address
						root.getAddress(walletId, true, cb);
				});
            });
        }
    };

    return root;
  });

redpajama_set_name: RedPajamaGithub


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

namespace Microsoft.USD.ComponentLibrary.Adapters.Automation
{
    internal static class JavaDataDrivenAdapterConstants
    {
        internal static string ButtonPressedEventName = "ButtonPressed";
        internal static string ButtonReleasedEventName = "ButtonReleased";
        internal static string CaretUpdatedEventName = "CaretUpdated";
        internal static string CHECK_BOX = "check box";
        internal static string CheckBoxClearedEventName = "CheckBoxCleared";
        internal static string CheckBoxSelectedEventName = "CheckBoxSelected";
        internal static string COMBO_BOX = "combo box";
        internal static string DEFAULT_ACTION_NAME = "click";
        internal static string FRENCH_CULTURE_TEXT = "fr";
        internal static string FRENCH_DEFAULT_ACTION_NAME = "cliquez sur";
        internal static string GotFocusEventName = "GotFocus";
        internal static System.Guid IID_JavaAcc = new System.Guid("d946dcd2-331d-328a-b481-f67f6a793e2f");
        internal static string JAB_REG_KEY = @"Software\Microsoft\Installer\Products\9C1AB582C3813A049A5206878BF2103B";
        internal static string JRE_CURRENT_VER_KEY = "CurrentVersion";
        internal static string JRE_REG_KEY = @"Software\JavaSoft\Java Runtime Environment";
        internal static string LABEL = "label";
        internal const string LegacyWindowsAccessBridgeDll = "windowsaccessbridge.dll";
        internal static string LostFocusEventName = "LostFocus";
        internal static string MENU = "menu";
        internal static string MENU_ITEM = "menu item";
        internal static string MenuCanceledEventName = "MenuCanceled";
        internal static string MenuDeSelectedEventName = "MenuDeSelected";
        internal static string MenuSelectedEventName = "MenuSelected";
        internal static string MouseClickedEventName = "MouseClicked";
        internal static string MouseEnteredEventName = "MouseEntered";
        internal static string MouseExitedEventName = "MouseExited";
        internal static string MousePressedEventName = "MousePressed";
        internal static string MouseReleasedEventName = "MouseReleased";
        internal static string PopupMenuCanceledEventName = "PopupMenuCanceled";
        internal static string PopupMenuInvisibleEventName = "PopupMenuInvisible";
        internal static string PopupMenuVisibleEventName = "PopupMenuVisible";
        internal static string PropertyActiveDescendentChangedEventName = "PropertyActiveDescendentChanged";
        internal static string PropertyCaretChangedEventName = "PropertyCaretChanged";
        internal static string PropertyChildChangedEventName = "PropertyChildChanged";
        internal static string PropertyDescriptionChangedEventName = "PropertyDescriptionChanged";
        internal static string PropertyNameChangedEventName = "PropertyNameChanged";
        internal static string PropertySelectionChangedEventName = "PropertySelectionChanged";
        internal static string PropertyStateChangedEventName = "PropertyStateChanged";
        internal static string PropertyTableModelChangedEventName = "PropertyTableModelChanged";
        internal static string PropertyTextChangedEventName = "PropertyTextChanged";
        internal static string PropertyValueChangedEventName = "PropertyValueChanged";
        internal static string PropertyVisibleDataChangedEventName = "PropertyVisibleDataChanged";
        internal static string PUSH_BUTTON = "push button";
        internal static string RADIO_BUTTON = "radio button";
        internal static string RadioButtonClearedEventName = "RadioButtonCleared";
        internal static string RadioButtonSelectedEventName = "RadioButtonSelected";
        internal static string ShutdownEventName = "Shutdown";
        internal static string STATE_COLLAPSED = "collapsed";
        internal static string STATE_EXPANDED = "expanded";
        internal static string STATE_NULL = "(null)";
        internal static string STATE_SELECTED = "selected";
        internal static string SUN_AWT_FRAME_CLASS = "SunAwtFrame";
        internal static int TASK_MEMORY_SIZE = 0x100;
        internal static string TEXT = "text";
        internal static string TOGGLE_BUTTON = "toggle button";
        internal static string TOGGLE_EXPAND_ACTION_NAME = "toggle expand";
        internal static string TOGGLE_POPUP_ACTION_NAME = "togglePopup";
        internal static string TreeNodeCollapsedEventName = "TreeNodeCollapsed";
        internal static string TreeNodeExpandedEventName = "TreeNodeExpanded";
        internal const string windowsAccessBridge32Dll = "windowsaccessbridge-32.dll";
        internal const string WindowsAccessBridge64Dll = "windowsaccessbridge-64.dll";
    }
}


text:
package model;

public class Person {
    private int id;
    private String name;
    private String number;
    private String sort;
    private String email;
    public Person next = null;
    public static int index = 0;
    public Person(int id, String name, String number, String sort, String email){
        this.id = id;
        this.name = name;
        this.number = number;
        this.sort = sort;
        this.email = email;
    }

    public int getId() {
        return id;
    }

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

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}


text:
package redis

import "errors"

// Subscription represents a subscribe or unsubscribe notification.
type Subscription struct {

	// Kind is "subscribe", "unsubscribe", "psubscribe" or "punsubscribe"
	Kind string

	// The channel that was changed.
	Channel string

	// The current number of subscriptions for connection.
	Count int
}

// Message represents a message notification.
type Message struct {

	// The originating channel.
	Channel string

	// The message data.
	Data []byte
}

// PMessage represents a pmessage notification.
type PMessage struct {

	// The matched pattern.
	Pattern string

	// The originating channel.
	Channel string

	// The message data.
	Data []byte
}

// Pong represents a pubsub pong notification.
type Pong struct {
	Data string
}

// PubSubConn wraps a Conn with convenience methods for subscribers.
type PubSubConn struct {
	Conn Conn
}

// Close closes the connection.
func (c PubSubConn) Close() error {
	return c.Conn.Close()
}

// Subscribe subscribes the connection to the specified channels.
func (c PubSubConn) Subscribe(channel ...interface{}) error {
	c.Conn.Send("SUBSCRIBE", channel...)
	return c.Conn.Flush()
}

// PSubscribe subscribes the connection to the given patterns.
func (c PubSubConn) PSubscribe(channel ...interface{}) error {
	c.Conn.Send("PSUBSCRIBE", channel...)
	return c.Conn.Flush()
}

// Unsubscribe unsubscribes the connection from the given channels, or from all
// of them if none is given.
func (c PubSubConn) Unsubscribe(channel ...interface{}) error {
	c.Conn.Send("UNSUBSCRIBE", channel...)
	return c.Conn.Flush()
}

// PUnsubscribe unsubscribes the connection from the given patterns, or from all
// of them if none is given.
func (c PubSubConn) PUnsubscribe(channel ...interface{}) error {
	c.Conn.Send("PUNSUBSCRIBE", channel...)
	return c.Conn.Flush()
}

// Ping sends a PING to the server with the specified data.
//
// The connection must be subscribed to at least one channel or pattern when
// calling this method.
func (c PubSubConn) Ping(data string) error {
	c.Conn.Send("PING", data)
	return c.Conn.Flush()
}

// Receive returns a pushed message as a Subscription, Message, PMessage, Pong
// or error. The return value is intended to be used directly in a type switch
// as illustrated in the PubSubConn example.
func (c PubSubConn) Receive() interface{} {
	reply, err := Values(c.Conn.Receive())
	if err != nil {
		return err
	}

	var kind string
	reply, err = Scan(reply, &kind)
	if err != nil {
		return err
	}

	switch kind {
	case "message":
		var m Message
		if _, err := Scan(reply, &m.Channel, &m.Data); err != nil {
			return err
		}
		return m
	case "pmessage":
		var pm PMessage
		if _, err := Scan(reply, &pm.Pattern, &pm.Channel, &pm.Data); err != nil {
			return err
		}
		return pm
	case "subscribe", "psubscribe", "unsubscribe", "punsubscribe":
		s := Subscription{Kind: kind}
		if _, err := Scan(reply, &s.Channel, &s.Count); err != nil {
			return err
		}
		return s
	case "pong":
		var p Pong
		if _, err := Scan(reply, &p.Data); err != nil {
			return err
		}
		return p
	}
	return errors.New("redigo: unknown pubsub notification")
}


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

package org.chromium.chrome.browser.download;

import static junit.framework.Assert.assertEquals;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;

import org.chromium.base.metrics.test.ShadowRecordHistogram;
import org.chromium.chrome.browser.download.DownloadLaterMetrics.DownloadLaterUiEvent;
import org.chromium.chrome.browser.download.dialogs.DownloadLaterDialogChoice;
import org.chromium.testing.local.LocalRobolectricTestRunner;

/**
 * Unit test for {@link DownloadLaterMetrics}.
 */
@RunWith(LocalRobolectricTestRunner.class)
@Config(manifest = Config.NONE, shadows = {ShadowRecordHistogram.class})
public class DownloadLaterMetricsUnitTest {
    private static final String UI_EVENT_METRIC_NAME = "Download.Later.UI.Events";

    @Before
    public void setUp() {
        ShadowRecordHistogram.reset();
    }

    @After
    public void tearDown() {
        ShadowRecordHistogram.reset();
    }

    @Test
    public void testRecordDownloadLaterUiEvent() {
        DownloadLaterMetrics.recordDownloadLaterUiEvent(
                DownloadLaterUiEvent.DOWNLOAD_LATER_DIALOG_EDIT_CLICKED);
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(UI_EVENT_METRIC_NAME,
                        DownloadLaterUiEvent.DOWNLOAD_LATER_DIALOG_EDIT_CLICKED));
    }

    @Test
    public void testRecordDownloadLaterDialogChoice() {
        DownloadLaterMetrics.recordDownloadLaterDialogChoice(
                DownloadLaterDialogChoice.ON_WIFI, true, -1);
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.Main", DownloadLaterDialogChoice.ON_WIFI));
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.Main.DataSaverOn",
                        DownloadLaterDialogChoice.ON_WIFI));
        assertEquals(0,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.Main.DataSaverOff",
                        DownloadLaterDialogChoice.ON_WIFI));
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        UI_EVENT_METRIC_NAME, DownloadLaterUiEvent.DOWNLOAD_LATER_DIALOG_COMPLETE));

        DownloadLaterMetrics.recordDownloadLaterDialogChoice(
                DownloadLaterDialogChoice.DOWNLOAD_LATER, false, 1024);
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.Main",
                        DownloadLaterDialogChoice.DOWNLOAD_LATER));
        assertEquals(0,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.Main.DataSaverOn",
                        DownloadLaterDialogChoice.DOWNLOAD_LATER));
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.Main.DataSaverOff",
                        DownloadLaterDialogChoice.DOWNLOAD_LATER));
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.ScheduledDownloadSize", 0));
    }

    @Test
    public void testRecordDownloadHomeChangeScheduleChoice() {
        DownloadLaterMetrics.recordDownloadHomeChangeScheduleChoice(
                DownloadLaterDialogChoice.DOWNLOAD_LATER);
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.DownloadHome",
                        DownloadLaterDialogChoice.DOWNLOAD_LATER));
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(UI_EVENT_METRIC_NAME,
                        DownloadLaterUiEvent.DOWNLOAD_HOME_CHANGE_SCHEDULE_COMPLETE));
    }

    @Test
    public void testRecordInfobarChangeScheduleChoice() {
        DownloadLaterMetrics.recordInfobarChangeScheduleChoice(
                DownloadLaterDialogChoice.DOWNLOAD_NOW);
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(
                        "Download.Later.UI.DialogChoice.Infobar",
                        DownloadLaterDialogChoice.DOWNLOAD_NOW));
        assertEquals(1,
                ShadowRecordHistogram.getHistogramValueCountForTesting(UI_EVENT_METRIC_NAME,
                        DownloadLaterUiEvent.DOWNLOAD_INFOBAR_CHANGE_SCHEDULE_COMPLETE));
    }
}


text:
import * as assert from 'assert';
import { CharacterPair, IndentAction } from 'vs/editor/common/modes/languageConfiguration';
import { OnEnterSupport } from 'vs/editor/common/modes/supports/onEnter';
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions';

suite('OnEnter', () => {

	test('uses brackets', () => {
		let brackets: CharacterPair[] = [
			['(', ')'],
			['begin', 'end']
		];
		let support = new OnEnterSupport({
			brackets: brackets
		});
		let testIndentAction = (beforeText: string, afterText: string, expected: IndentAction) => {
			let actual = support.onEnter(EditorAutoIndentStrategy.Advanced, '', beforeText, afterText);
			if (expected === IndentAction.None) {
				assert.equal(actual, null);
			} else {
				assert.equal(actual!.indentAction, expected);
			}
		};

		testIndentAction('a', '', IndentAction.None);
		testIndentAction('', 'b', IndentAction.None);
		testIndentAction('(', 'b', IndentAction.Indent);
		testIndentAction('a', ')', IndentAction.None);
		testIndentAction('begin', 'ending', IndentAction.Indent);
		testIndentAction('abegin', 'end', IndentAction.None);
		testIndentAction('begin', ')', IndentAction.Indent);
		testIndentAction('begin', 'end', IndentAction.IndentOutdent);
		testIndentAction('begin ', ' end', IndentAction.IndentOutdent);
		testIndentAction(' begin', 'end//as', IndentAction.IndentOutdent);
		testIndentAction('(', ')', IndentAction.IndentOutdent);
		testIndentAction('( ', ')', IndentAction.IndentOutdent);
		testIndentAction('a(', ')b', IndentAction.IndentOutdent);

		testIndentAction('(', '', IndentAction.Indent);
		testIndentAction('(', 'foo', IndentAction.Indent);
		testIndentAction('begin', 'foo', IndentAction.Indent);
		testIndentAction('begin', '', IndentAction.Indent);
	});

	test('uses regExpRules', () => {
		let support = new OnEnterSupport({
			onEnterRules: javascriptOnEnterRules
		});
		let testIndentAction = (oneLineAboveText: string, beforeText: string, afterText: string, expectedIndentAction: IndentAction | null, expectedAppendText: string | null, removeText: number = 0) => {
			let actual = support.onEnter(EditorAutoIndentStrategy.Advanced, oneLineAboveText, beforeText, afterText);
			if (expectedIndentAction === null) {
				assert.equal(actual, null, 'isNull:' + beforeText);
			} else {
				assert.equal(actual !== null, true, 'isNotNull:' + beforeText);
				assert.equal(actual!.indentAction, expectedIndentAction, 'indentAction:' + beforeText);
				if (expectedAppendText !== null) {
					assert.equal(actual!.appendText, expectedAppendText, 'appendText:' + beforeText);
				}
				if (removeText !== 0) {
					assert.equal(actual!.removeText, removeText, 'removeText:' + beforeText);
				}
			}
		};

		testIndentAction('', '\t/**', ' */', IndentAction.IndentOutdent, ' * ');
		testIndentAction('', '\t/**', '', IndentAction.None, ' * ');
		testIndentAction('', '\t/** * / * / * /', '', IndentAction.None, ' * ');
		testIndentAction('', '\t/** /*', '', IndentAction.None, ' * ');
		testIndentAction('', '/**', '', IndentAction.None, ' * ');
		testIndentAction('', '\t/**/', '', null, null);
		testIndentAction('', '\t/***/', '', null, null);
		testIndentAction('', '\t/*******/', '', null, null);
		testIndentAction('', '\t/** * * * * */', '', null, null);
		testIndentAction('', '\t/** */', '', null, null);
		testIndentAction('', '\t/** asdfg */', '', null, null);
		testIndentAction('', '\t/* asdfg */', '', null, null);
		testIndentAction('', '\t/* asdfg */', '', null, null);
		testIndentAction('', '\t/** asdfg */', '', null, null);
		testIndentAction('', '*/', '', null, null);
		testIndentAction('', '\t/*', '', null, null);
		testIndentAction('', '\t*', '', null, null);

		testIndentAction('\t/**', '\t *', '', IndentAction.None, '* ');
		testIndentAction('\t * something', '\t *', '', IndentAction.None, '* ');
		testIndentAction('\t *', '\t *', '', IndentAction.None, '* ');

		testIndentAction('', '\t */', '', IndentAction.None, null, 1);
		testIndentAction('', '\t * */', '', IndentAction.None, null, 1);
		testIndentAction('', '\t * * / * / * / */', '', null, null);

		testIndentAction('\t/**', '\t * ', '', IndentAction.None, '* ');
		testIndentAction('\t * something', '\t * ', '', IndentAction.None, '* ');
		testIndentAction('\t *', '\t * ', '', IndentAction.None, '* ');

		testIndentAction('/**', ' * ', '', IndentAction.None, '* ');
		testIndentAction(' * something', ' * ', '', IndentAction.None, '* ');
		testIndentAction(' *', ' * asdfsfagadfg', '', IndentAction.None, '* ');

		testIndentAction('/**', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
		testIndentAction(' * something', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');
		testIndentAction(' *', ' * asdfsfagadfg * * * ', '', IndentAction.None, '* ');

		testIndentAction('/**', ' * /*', '', IndentAction.None, '* ');
		testIndentAction(' * something', ' * /*', '', IndentAction.None, '* ');
		testIndentAction(' *', ' * /*', '', IndentAction.None, '* ');

		testIndentAction('/**', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
		testIndentAction(' * something', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');
		testIndentAction(' *', ' * asdfsfagadfg * / * / * /', '', IndentAction.None, '* ');

		testIndentAction('/**', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
		testIndentAction(' * something', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
		testIndentAction(' *', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');

		testIndentAction('', ' */', '', IndentAction.None, null, 1);
		testIndentAction('', '\t */', '', IndentAction.None, null, 1);
		testIndentAction('', '\t\t */', '', IndentAction.None, null, 1);
		testIndentAction('', '   */', '', IndentAction.None, null, 1);
		testIndentAction('', '     */', '', IndentAction.None, null, 1);
		testIndentAction('', '\t     */', '', IndentAction.None, null, 1);
		testIndentAction('', ' *--------------------------------------------------------------------------------------------*/', '', IndentAction.None, null, 1);

		// issue #43469
		testIndentAction('class A {', '    * test() {', '', IndentAction.Indent, null, 0);
		testIndentAction('', '    * test() {', '', IndentAction.Indent, null, 0);
		testIndentAction('    ', '    * test() {', '', IndentAction.Indent, null, 0);
		testIndentAction('class A {', '  * test() {', '', IndentAction.Indent, null, 0);
		testIndentAction('', '  * test() {', '', IndentAction.Indent, null, 0);
		testIndentAction('  ', '  * test() {', '', IndentAction.Indent, null, 0);
	});
});


text:
var util = require('util'),
  yeoman = require('../../../../');

// mocha:app generator
//
// Setup the test/ directory.
//

module.exports = Generator;

function Generator(args, options, config) {

  yeoman.generators.Base.apply(this, arguments);

  this.option('assert-framework', {
    type: String,
    defaults: 'chai',
    desc: 'Choose your prefered assertion library'
  });

  this.option('assert-style', {
    desc: 'Choose the asssert style you wish to use (assert, expect, should). Only enabled with chai.',
    type: String,
    defaults: 'expect'
  });

  this.option('ui', {
    desc: 'Choose your style of DSL (bdd, tdd, qunit, or exports)',
    type: String,
    defaults: 'bdd'
  });

  // parse arguments for now, manually
  this.assert_framework = options['assert-framework'] || 'chai';
  this.assert_style = options['assert-style'] || 'expect';
}

util.inherits(Generator, yeoman.generators.Base);

Generator.prototype.setupEnv = function setupEnv() {
  this.directory('.', 'test');
};


text:
<?= $title; ?>

<?php echo validation_errors(); ?>

<?php echo form_open('http://ltelvak17.student.ki.fpv.ukf.sk/rezervacia/create'); ?>

    Dátum:
    <input type="datum" class="form-control" name="datum">

    Čas:
    <input type="cas" class="form-control" name="cas">

    Počet ľudí:
    <input type="pocet_ludi" class="form-control" name="pocet_ludi">

    Zákazník:
    <select name="Zakaznik_idZakaznik" class="form-control">
        <?php foreach($zakaznici as $zakaznik): ?>
            <option value="<?php echo $zakaznik['idZakaznika']; ?>"><?php echo $zakaznik['Meno']; ?></option>
        <?php endforeach; ?>
    </select>

    Športovisko:
    <select name="Sportovisko_idSportovisko" class="form-control">
        <?php foreach($sportovisko as $sportoviska): ?>
            <option value="<?php echo $sportoviska['idSportovisko']; ?>"><?php echo $sportoviska['Nazov_sportoviska']; ?></option>
        <?php endforeach; ?>
    </select>

<button type="submit" class="btn btn-success">Pridať</button> <button type="button" class="btn btn-default" onclick="javascript:window.history.go(-1);">Späť</button>
</form>


text:
{{ shortcode.options.title }}

    <content />


text:
class ProjectActiveTab < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedPaths
  include SharedProject
  include SharedActiveTab

  # Main Tabs

  Then 'the active main tab should be Home' do
    ensure_active_main_tab('Activity')
  end

  Then 'the active main tab should be Settings' do
    ensure_active_main_tab('Settings')
  end

  Then 'the active main tab should be Files' do
    ensure_active_main_tab('Files')
  end

  Then 'the active main tab should be Commits' do
    ensure_active_main_tab('Commits')
  end

  Then 'the active main tab should be Network' do
    ensure_active_main_tab('Network')
  end

  Then 'the active main tab should be Issues' do
    ensure_active_main_tab('Issues')
  end

  Then 'the active main tab should be Merge Requests' do
    ensure_active_main_tab('Merge Requests')
  end

  Then 'the active main tab should be Wall' do
    ensure_active_main_tab('Wall')
  end

  Then 'the active main tab should be Wiki' do
    ensure_active_main_tab('Wiki')
  end

  # Sub Tabs: Home

  Given 'I click the "Team" tab' do
    click_link('Members')
  end

  Given 'I click the "Attachments" tab' do
    click_link('Attachments')
  end

  Given 'I click the "Snippets" tab' do
    click_link('Snippets')
  end

  Given 'I click the "Edit" tab' do
    within '.project-settings-nav' do
      click_link('Project')
    end
  end

  Given 'I click the "Hooks" tab' do
    click_link('Web Hooks')
  end

  Given 'I click the "Deploy Keys" tab' do
    click_link('Deploy Keys')
  end

  Then 'the active sub nav should be Team' do
    ensure_active_sub_nav('Members')
  end

  Then 'the active sub nav should be Edit' do
    ensure_active_sub_nav('Project')
  end

  Then 'the active sub nav should be Hooks' do
    ensure_active_sub_nav('Web Hooks')
  end

  Then 'the active sub nav should be Deploy Keys' do
    ensure_active_sub_nav('Deploy Keys')
  end

  # Sub Tabs: Commits

  Given 'I click the "Compare" tab' do
    click_link('Compare')
  end

  Given 'I click the "Branches" tab' do
    click_link('Branches')
  end

  Given 'I click the "Tags" tab' do
    click_link('Tags')
  end

  Then 'the active sub tab should be Commits' do
    ensure_active_sub_tab('Commits')
  end

  Then 'the active sub tab should be Compare' do
    ensure_active_sub_tab('Compare')
  end

  Then 'the active sub tab should be Branches' do
    ensure_active_sub_tab('Branches')
  end

  Then 'the active sub tab should be Tags' do
    ensure_active_sub_tab('Tags')
  end

  # Sub Tabs: Issues

  Given 'I click the "Milestones" tab' do
    click_link('Milestones')
  end

  Given 'I click the "Labels" tab' do
    click_link('Labels')
  end

  Then 'the active sub tab should be Browse Issues' do
    ensure_active_sub_tab('Browse Issues')
  end

  Then 'the active sub tab should be Milestones' do
    ensure_active_sub_tab('Milestones')
  end

  Then 'the active sub tab should be Labels' do
    ensure_active_sub_tab('Labels')
  end
end


text:
namespace gfx {
namespace {

static constexpr float kTolerance = 1e-5f;

template <typename KeyframeType, typename ValueType, typename TargetType>
std::unique_ptr<AnimationCurve> RetargettedCurve(
    std::vector<std::unique_ptr<KeyframeType>>& keyframes,
    base::TimeDelta t,
    const ValueType& value_at_t,
    const ValueType& new_target_value,
    double scaled_duration,
    TargetType* target,
    const TimingFunction* timing_function) {
  if (SufficientlyEqual(keyframes.back()->Value(), new_target_value))
    return nullptr;

  DCHECK_GE(keyframes.size(), 2u);
  DCHECK_GT(scaled_duration, 0.f);

  // If we haven't progressed to animating between the last 2 keyframes, simply
  // clobber the value for the last keyframe.
  const bool at_last_keyframe =
      (keyframes[keyframes.size() - 2]->Time() * scaled_duration) <= t;
  if (!at_last_keyframe) {
    auto& last_keyframe = keyframes.back();
    auto* keyframe_timing_function = last_keyframe->timing_function();
    last_keyframe = KeyframeType::Create(
        last_keyframe->Time(), new_target_value,
        keyframe_timing_function ? keyframe_timing_function->Clone() : nullptr);
    return nullptr;
  }

  // Ensure that `t` happens between the last two keyframes.
  DCHECK_GE(keyframes[keyframes.size() - 1]->Time() * scaled_duration, t);

  // TODO(crbug.com/1198305): This can be changed to a different / special
  // interpolation curve type to maintain c2 continuity.
  auto curve = AnimationTraits<ValueType>::KeyframedCurveType::Create();
  curve->set_scaled_duration(scaled_duration);
  curve->set_target(target);

  auto generate_timing_function =
      [timing_function]() -> std::unique_ptr<gfx::TimingFunction> {
    if (timing_function)
      return timing_function->Clone();
    return nullptr;
  };

  // Keep the curve duration the same by adding the same first frame.
  curve->AddKeyframe(KeyframeType::Create(keyframes.front()->Time(),
                                          keyframes.front()->Value(),
                                          generate_timing_function()));

  // Snap the current value at `t` so that the current value stays the same.
  curve->AddKeyframe(KeyframeType::Create(t / scaled_duration, value_at_t,
                                          generate_timing_function()));

  // Add a new target at the same time as the last frame.
  curve->AddKeyframe(KeyframeType::Create(
      keyframes.back()->Time(), new_target_value, generate_timing_function()));

  return curve;
}

}  // namespace

Keyframe::Keyframe(base::TimeDelta time,
                   std::unique_ptr<TimingFunction> timing_function)
    : time_(time), timing_function_(std::move(timing_function)) {}

Keyframe::~Keyframe() = default;

base::TimeDelta Keyframe::Time() const {
  return time_;
}

std::unique_ptr<ColorKeyframe> ColorKeyframe::Create(
    base::TimeDelta time,
    SkColor value,
    std::unique_ptr<TimingFunction> timing_function) {
  return base::WrapUnique(
      new ColorKeyframe(time, value, std::move(timing_function)));
}

ColorKeyframe::ColorKeyframe(base::TimeDelta time,
                             SkColor value,
                             std::unique_ptr<TimingFunction> timing_function)
    : Keyframe(time, std::move(timing_function)), value_(value) {}

ColorKeyframe::~ColorKeyframe() = default;

SkColor ColorKeyframe::Value() const {
  return value_;
}

std::unique_ptr<ColorKeyframe> ColorKeyframe::Clone() const {
  std::unique_ptr<TimingFunction> func;
  if (timing_function())
    func = timing_function()->Clone();
  return ColorKeyframe::Create(Time(), Value(), std::move(func));
}

std::unique_ptr<FloatKeyframe> FloatKeyframe::Create(
    base::TimeDelta time,
    float value,
    std::unique_ptr<TimingFunction> timing_function) {
  return base::WrapUnique(
      new FloatKeyframe(time, value, std::move(timing_function)));
}

FloatKeyframe::FloatKeyframe(base::TimeDelta time,
                             float value,
                             std::unique_ptr<TimingFunction> timing_function)
    : Keyframe(time, std::move(timing_function)), value_(value) {}

FloatKeyframe::~FloatKeyframe() = default;

float FloatKeyframe::Value() const {
  return value_;
}

std::unique_ptr<FloatKeyframe> FloatKeyframe::Clone() const {
  std::unique_ptr<TimingFunction> func;
  if (timing_function())
    func = timing_function()->Clone();
  return FloatKeyframe::Create(Time(), Value(), std::move(func));
}

std::unique_ptr<TransformKeyframe> TransformKeyframe::Create(
    base::TimeDelta time,
    const gfx::TransformOperations& value,
    std::unique_ptr<TimingFunction> timing_function) {
  return base::WrapUnique(
      new TransformKeyframe(time, value, std::move(timing_function)));
}

TransformKeyframe::TransformKeyframe(
    base::TimeDelta time,
    const gfx::TransformOperations& value,
    std::unique_ptr<TimingFunction> timing_function)
    : Keyframe(time, std::move(timing_function)), value_(value) {}

TransformKeyframe::~TransformKeyframe() = default;

const gfx::TransformOperations& TransformKeyframe::Value() const {
  return value_;
}

std::unique_ptr<TransformKeyframe> TransformKeyframe::Clone() const {
  std::unique_ptr<TimingFunction> func;
  if (timing_function())
    func = timing_function()->Clone();
  return TransformKeyframe::Create(Time(), Value(), std::move(func));
}

std::unique_ptr<SizeKeyframe> SizeKeyframe::Create(
    base::TimeDelta time,
    const gfx::SizeF& value,
    std::unique_ptr<TimingFunction> timing_function) {
  return base::WrapUnique(
      new SizeKeyframe(time, value, std::move(timing_function)));
}

SizeKeyframe::SizeKeyframe(base::TimeDelta time,
                           const gfx::SizeF& value,
                           std::unique_ptr<TimingFunction> timing_function)
    : Keyframe(time, std::move(timing_function)), value_(value) {}

SizeKeyframe::~SizeKeyframe() = default;

const gfx::SizeF& SizeKeyframe::Value() const {
  return value_;
}

std::unique_ptr<SizeKeyframe> SizeKeyframe::Clone() const {
  std::unique_ptr<TimingFunction> func;
  if (timing_function())
    func = timing_function()->Clone();
  return SizeKeyframe::Create(Time(), Value(), std::move(func));
}

std::unique_ptr<RectKeyframe> RectKeyframe::Create(
    base::TimeDelta time,
    const gfx::Rect& value,
    std::unique_ptr<TimingFunction> timing_function) {
  return base::WrapUnique(
      new RectKeyframe(time, value, std::move(timing_function)));
}

RectKeyframe::RectKeyframe(base::TimeDelta time,
                           const gfx::Rect& value,
                           std::unique_ptr<TimingFunction> timing_function)
    : Keyframe(time, std::move(timing_function)), value_(value) {}

RectKeyframe::~RectKeyframe() = default;

const gfx::Rect& RectKeyframe::Value() const {
  return value_;
}

std::unique_ptr<RectKeyframe> RectKeyframe::Clone() const {
  std::unique_ptr<TimingFunction> func;
  if (timing_function())
    func = timing_function()->Clone();
  return RectKeyframe::Create(Time(), Value(), std::move(func));
}

std::unique_ptr<KeyframedColorAnimationCurve>
KeyframedColorAnimationCurve::Create() {
  return base::WrapUnique(new KeyframedColorAnimationCurve);
}

KeyframedColorAnimationCurve::KeyframedColorAnimationCurve()
    : scaled_duration_(1.0) {}

KeyframedColorAnimationCurve::~KeyframedColorAnimationCurve() = default;

void KeyframedColorAnimationCurve::AddKeyframe(
    std::unique_ptr<ColorKeyframe> keyframe) {
  InsertKeyframe(std::move(keyframe), &keyframes_);
}

base::TimeDelta KeyframedColorAnimationCurve::Duration() const {
  return (keyframes_.back()->Time() - keyframes_.front()->Time()) *
         scaled_duration();
}

base::TimeDelta KeyframedColorAnimationCurve::TickInterval() const {
  return ComputeTickInterval(timing_function_, scaled_duration(), keyframes_);
}

std::unique_ptr<AnimationCurve> KeyframedColorAnimationCurve::Clone() const {
  std::unique_ptr<KeyframedColorAnimationCurve> to_return =
      KeyframedColorAnimationCurve::Create();
  for (const auto& keyframe : keyframes_)
    to_return->AddKeyframe(keyframe->Clone());

  if (timing_function_)
    to_return->SetTimingFunction(timing_function_->Clone());

  to_return->set_scaled_duration(scaled_duration());

  return std::move(to_return);
}

SkColor KeyframedColorAnimationCurve::GetValue(base::TimeDelta t) const {
  if (t <= (keyframes_.front()->Time() * scaled_duration()))
    return keyframes_.front()->Value();

  if (t >= (keyframes_.back()->Time() * scaled_duration()))
    return keyframes_.back()->Value();

  t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(),
                               t);
  size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t);
  double progress =
      TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i);

  return gfx::Tween::ColorValueBetween(progress, keyframes_[i]->Value(),
                                       keyframes_[i + 1]->Value());
}

std::unique_ptr<AnimationCurve> KeyframedColorAnimationCurve::Retarget(
    base::TimeDelta t,
    SkColor new_target) {
  DCHECK(!keyframes_.empty());
  return RetargettedCurve(keyframes_, t, GetValue(t), new_target,
                          scaled_duration(), target(), timing_function_.get());
}

std::unique_ptr<KeyframedFloatAnimationCurve>
KeyframedFloatAnimationCurve::Create() {
  return base::WrapUnique(new KeyframedFloatAnimationCurve);
}

KeyframedFloatAnimationCurve::KeyframedFloatAnimationCurve()
    : scaled_duration_(1.0) {}

KeyframedFloatAnimationCurve::~KeyframedFloatAnimationCurve() = default;

void KeyframedFloatAnimationCurve::AddKeyframe(
    std::unique_ptr<FloatKeyframe> keyframe) {
  InsertKeyframe(std::move(keyframe), &keyframes_);
}

base::TimeDelta KeyframedFloatAnimationCurve::Duration() const {
  return (keyframes_.back()->Time() - keyframes_.front()->Time()) *
         scaled_duration();
}

base::TimeDelta KeyframedFloatAnimationCurve::TickInterval() const {
  return ComputeTickInterval(timing_function_, scaled_duration(), keyframes_);
}

std::unique_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Clone() const {
  std::unique_ptr<KeyframedFloatAnimationCurve> to_return =
      KeyframedFloatAnimationCurve::Create();
  for (const auto& keyframe : keyframes_)
    to_return->AddKeyframe(keyframe->Clone());

  if (timing_function_)
    to_return->SetTimingFunction(timing_function_->Clone());

  to_return->set_scaled_duration(scaled_duration());

  return std::move(to_return);
}

std::unique_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Retarget(
    base::TimeDelta t,
    float new_target) {
  DCHECK(!keyframes_.empty());
  return RetargettedCurve(keyframes_, t, GetValue(t), new_target,
                          scaled_duration(), target(), timing_function_.get());
}

float KeyframedFloatAnimationCurve::GetValue(base::TimeDelta t) const {
  if (t <= (keyframes_.front()->Time() * scaled_duration()))
    return keyframes_.front()->Value();

  if (t >= (keyframes_.back()->Time() * scaled_duration()))
    return keyframes_.back()->Value();

  t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(),
                               t);
  size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t);
  double progress =
      TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i);

  return keyframes_[i]->Value() +
         (keyframes_[i + 1]->Value() - keyframes_[i]->Value()) * progress;
}

std::unique_ptr<KeyframedTransformAnimationCurve>
KeyframedTransformAnimationCurve::Create() {
  return base::WrapUnique(new KeyframedTransformAnimationCurve);
}

KeyframedTransformAnimationCurve::KeyframedTransformAnimationCurve()
    : scaled_duration_(1.0) {}

KeyframedTransformAnimationCurve::~KeyframedTransformAnimationCurve() = default;

void KeyframedTransformAnimationCurve::AddKeyframe(
    std::unique_ptr<TransformKeyframe> keyframe) {
  InsertKeyframe(std::move(keyframe), &keyframes_);
}

base::TimeDelta KeyframedTransformAnimationCurve::Duration() const {
  return (keyframes_.back()->Time() - keyframes_.front()->Time()) *
         scaled_duration();
}

base::TimeDelta KeyframedTransformAnimationCurve::TickInterval() const {
  return ComputeTickInterval(timing_function_, scaled_duration(), keyframes_);
}

std::unique_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Clone()
    const {
  std::unique_ptr<KeyframedTransformAnimationCurve> to_return =
      KeyframedTransformAnimationCurve::Create();
  for (const auto& keyframe : keyframes_)
    to_return->AddKeyframe(keyframe->Clone());

  if (timing_function_)
    to_return->SetTimingFunction(timing_function_->Clone());

  to_return->set_scaled_duration(scaled_duration());

  return std::move(to_return);
}

gfx::TransformOperations KeyframedTransformAnimationCurve::GetValue(
    base::TimeDelta t) const {
  if (t <= (keyframes_.front()->Time() * scaled_duration()))
    return keyframes_.front()->Value();

  if (t >= (keyframes_.back()->Time() * scaled_duration()))
    return keyframes_.back()->Value();

  t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(),
                               t);
  size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t);
  double progress =
      TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i);

  return keyframes_[i + 1]->Value().Blend(keyframes_[i]->Value(), progress);
}

bool KeyframedTransformAnimationCurve::PreservesAxisAlignment() const {
  for (const auto& keyframe : keyframes_) {
    if (!keyframe->Value().PreservesAxisAlignment())
      return false;
  }
  return true;
}

bool KeyframedTransformAnimationCurve::MaximumScale(float* max_scale) const {
  DCHECK_GE(keyframes_.size(), 2ul);
  *max_scale = 0.f;
  for (auto& keyframe : keyframes_) {
    float keyframe_scale = 0.f;
    if (!keyframe->Value().ScaleComponent(&keyframe_scale))
      continue;
    *max_scale = std::max(*max_scale, keyframe_scale);
  }
  return *max_scale > 0.f;
}

std::unique_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Retarget(
    base::TimeDelta t,
    const gfx::TransformOperations& new_target) {
  DCHECK(!keyframes_.empty());
  return RetargettedCurve(keyframes_, t, GetValue(t), new_target,
                          scaled_duration(), target(), timing_function_.get());
}

std::unique_ptr<KeyframedSizeAnimationCurve>
KeyframedSizeAnimationCurve::Create() {
  return base::WrapUnique(new KeyframedSizeAnimationCurve);
}

KeyframedSizeAnimationCurve::KeyframedSizeAnimationCurve()
    : scaled_duration_(1.0) {}

KeyframedSizeAnimationCurve::~KeyframedSizeAnimationCurve() = default;

void KeyframedSizeAnimationCurve::AddKeyframe(
    std::unique_ptr<SizeKeyframe> keyframe) {
  InsertKeyframe(std::move(keyframe), &keyframes_);
}

base::TimeDelta KeyframedSizeAnimationCurve::Duration() const {
  return (keyframes_.back()->Time() - keyframes_.front()->Time()) *
         scaled_duration();
}

base::TimeDelta KeyframedSizeAnimationCurve::TickInterval() const {
  return ComputeTickInterval(timing_function_, scaled_duration(), keyframes_);
}

std::unique_ptr<AnimationCurve> KeyframedSizeAnimationCurve::Clone() const {
  std::unique_ptr<KeyframedSizeAnimationCurve> to_return =
      KeyframedSizeAnimationCurve::Create();
  for (const auto& keyframe : keyframes_)
    to_return->AddKeyframe(keyframe->Clone());

  if (timing_function_)
    to_return->SetTimingFunction(timing_function_->Clone());

  to_return->set_scaled_duration(scaled_duration());

  return std::move(to_return);
}

gfx::SizeF KeyframedSizeAnimationCurve::GetValue(base::TimeDelta t) const {
  if (t <= (keyframes_.front()->Time() * scaled_duration()))
    return keyframes_.front()->Value();

  if (t >= (keyframes_.back()->Time() * scaled_duration()))
    return keyframes_.back()->Value();

  t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(),
                               t);
  size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t);
  double progress =
      TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i);

  return gfx::Tween::SizeFValueBetween(progress, keyframes_[i]->Value(),
                                       keyframes_[i + 1]->Value());
}

std::unique_ptr<AnimationCurve> KeyframedSizeAnimationCurve::Retarget(
    base::TimeDelta t,
    const gfx::SizeF& new_target) {
  DCHECK(!keyframes_.empty());
  return RetargettedCurve(keyframes_, t, GetValue(t), new_target,
                          scaled_duration(), target(), timing_function_.get());
}

std::unique_ptr<KeyframedRectAnimationCurve>
KeyframedRectAnimationCurve::Create() {
  return base::WrapUnique(new KeyframedRectAnimationCurve);
}

KeyframedRectAnimationCurve::KeyframedRectAnimationCurve()
    : scaled_duration_(1.0) {}

KeyframedRectAnimationCurve::~KeyframedRectAnimationCurve() = default;

void KeyframedRectAnimationCurve::AddKeyframe(
    std::unique_ptr<RectKeyframe> keyframe) {
  InsertKeyframe(std::move(keyframe), &keyframes_);
}

base::TimeDelta KeyframedRectAnimationCurve::Duration() const {
  return (keyframes_.back()->Time() - keyframes_.front()->Time()) *
         scaled_duration();
}

base::TimeDelta KeyframedRectAnimationCurve::TickInterval() const {
  return ComputeTickInterval(timing_function_, scaled_duration(), keyframes_);
}

std::unique_ptr<AnimationCurve> KeyframedRectAnimationCurve::Clone() const {
  std::unique_ptr<KeyframedRectAnimationCurve> to_return =
      KeyframedRectAnimationCurve::Create();
  for (const auto& keyframe : keyframes_)
    to_return->AddKeyframe(keyframe->Clone());

  if (timing_function_)
    to_return->SetTimingFunction(timing_function_->Clone());

  to_return->set_scaled_duration(scaled_duration());

  return std::move(to_return);
}

gfx::Rect KeyframedRectAnimationCurve::GetValue(base::TimeDelta t) const {
  if (t <= (keyframes_.front()->Time() * scaled_duration()))
    return keyframes_.front()->Value();

  if (t >= (keyframes_.back()->Time() * scaled_duration()))
    return keyframes_.back()->Value();

  t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(),
                               t);
  size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t);
  double progress =
      TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i);

  return gfx::Tween::RectValueBetween(progress, keyframes_[i]->Value(),
                                      keyframes_[i + 1]->Value());
}

std::unique_ptr<AnimationCurve> KeyframedRectAnimationCurve::Retarget(
    base::TimeDelta t,
    const gfx::Rect& new_target) {
  DCHECK(!keyframes_.empty());
  return RetargettedCurve(keyframes_, t, GetValue(t), new_target,
                          scaled_duration(), target(), timing_function_.get());
}

bool SufficientlyEqual(float lhs, float rhs) {
  return base::IsApproximatelyEqual(lhs, rhs, kTolerance);
}

bool SufficientlyEqual(const TransformOperations& lhs,
                       const TransformOperations& rhs) {
  return lhs.ApproximatelyEqual(rhs, kTolerance);
}

bool SufficientlyEqual(const SizeF& lhs, const SizeF& rhs) {
  return base::IsApproximatelyEqual(lhs.width(), rhs.width(), kTolerance) &&
         base::IsApproximatelyEqual(lhs.height(), rhs.height(), kTolerance);
}

bool SufficientlyEqual(SkColor lhs, SkColor rhs) {
  return lhs == rhs;
}

bool SufficientlyEqual(const Rect& lhs, const Rect& rhs) {
  return lhs == rhs;
}

}  // namespace gfx


text:
@(filledForm: Form[com.hunorkovacs.koauth.domain.KoauthRequest])(signatureBase: String, header: String)

@import com.hunorkovacs.koauth.domain.OauthParams._
@import views.html.helper

<!DOCTYPE html>

        <title>Accessing Protected Resources</title>
        <link rel="stylesheet" href="assets/stylesheets/main.css">

Complement and sign an OAuth 1.0 request for accessing protected resources

(the most frequently used one)

        @helper.form(action = routes.Application.oauthenticatePost) {

                    Method:
                    <input type="text" name="method" value="@filledForm("method").value">

                    URL:
                    <input type="text" name="url" value="@filledForm("url").value">

                    Consumer Key:
                    <input type="text" name="@ConsumerKeyName" value="@filledForm(ConsumerKeyName).value">

                    Consumer Secret:
                    <input type="text" name="@ConsumerSecretName" value="@filledForm(ConsumerSecretName).value">

                    Token:
                    <input type="text" name="@TokenName" value="@filledForm(TokenName).value">

                    Token Secret:
                    <input type="text" name="@TokenSecretName" value="@filledForm(TokenSecretName).value">

                    Signature Method:
                    <input type="text" name="@SignatureMethodName" value="@filledForm(SignatureMethodName).value"
                    readonly>

                    Timestamp:
                    <input type="text" name="@TimestampName" value="@filledForm(TimestampName).value" readonly>

                    Nonce:
                    <input type="text" name="@NonceName" value="@filledForm(NonceName).value" readonly>

                    Version:
                    <input type="text" name="@VersionName" value="@filledForm(VersionName).value" readonly>

                    <input type="submit" name="submit">

                    Signature Base:
                    <textarea readonly >@signatureBase</textarea>

                    Authorization Header:
                    <textarea readonly >@header</textarea>

        }


text:
module CelluloidIOPGListener
  # Usage:
  #
  #   Given a yaml config file of this format:
  #
  #     listening_group:
  #     -
  #       listener_active: <%= ENV["LISTENER_ACTIVE"] || false %>
  #       type: HerokuConnectListener::SalesforceAccountClient
  #       as: insert_client
  #       args:
  #         database_url: <%= ENV["DATABASE_URL"] %>
  #           redis_url: <%= ENV["REDISTOGO_URL"] || "redis://localhost:6379/" %>
  #         callback_method: notify_callback
  #         channel: <%= ENV["SCHEMA_NAME"] %>_account_insert
  #
  #   Create a Supervision Container such as:
  #
  #     class ListeningGroup < Celluloid::Supervision::Container
  #       config_path = options[:config_path] || "config/settings.yml"
  #       config      = YAML::load(ERB.new(File.read(config_path)).result)
  #       supervise CelluloidIOPGListener::SuperviseSignature.new(
  #                     type: config["type"],
  #                     as: config["as"],
  #                     args: config["args"]
  #                 ).signature
  #     end
  #
  #     ListeningGroup.run
  #
  class SuperviseSignature
    KEYS_WITH_SYMBOL_VALUES = %( callback_method )
    attr_reader :type
    attr_reader :as
    attr_reader :args

    def initialize(type:, as:, args:)
      @type = Kernel.const_get(type)
      @as = as.to_sym
      if has_database_url?(args)
        args.merge!(convert_database_url_to_hash(db_url: args.delete("database_url")))
      end
      @args = []
      @args << symbolize_keys(args)
    end

    def signature
      {
          type: type,
          as: as,
          args: args
      }
    end

    private

    def symbolize_key(key, value, hash)
      if KEYS_WITH_SYMBOL_VALUES.include?(key)
        hash[key.to_sym] = value.to_sym
      else
        hash[key.to_sym] = value
      end
    end
    def symbolize_keys(args)
      args.inject({}) do |memo, (key, value)|
        symbolize_key(key, value, memo)
        memo
      end
    end
    def has_database_url?(args)
      args.is_a?(Hash) && !args["database_url"].nil?
    end

    # returns a hash of connection info extracted from the database url (as on Heroku)
    def convert_database_url_to_hash(db_url:)
      uri = URI.parse(db_url)
      connection_info = {}
      connection_info["dbname"]   = (uri.path || "").split("/")[1]
      connection_info["user"]     = uri.user
      connection_info["password"] = uri.password
      connection_info["host"]     = uri.host
      connection_info["port"]     = uri.port
      connection_info
    end
  end
end