text:
import { MathUtils } from '../../../../../build/yuka.module.js';

/**
* Controls the flow of Blackjack games.
*
* @author {@link https://github.com/Mugen87|Mugen87}
*/
class BlackjackEnvironment {

	constructor( natural = false ) {

		this.actionSpace = [ ACTIONS.STICK, ACTIONS.HIT ];
		this.observationSpace = generateObservationSpace();

		this.player = null;
		this.dealer = null;

		this.natural = natural;

		this.reset();

	}

	reset() {

		this.player = drawHand();
		this.dealer = drawHand();

		return getState( this.player, this.dealer );

	}

	step( action ) {

		const player = this.player;
		const dealer = this.dealer;

		let done = false;
		let reward = 0;

		if ( this.actionSpace.includes( action ) === false ) throw new Error( 'Invalid Action' );

		if ( action === ACTIONS.HIT ) {

			// hit: add a card to players hand and return

			player.push( drawCard() );

			if ( isBust( player ) ) {

				done = true;
				reward = - 1;

			}

		} else {

			// stick: play out the dealers hand, and score

			done = true;

			while ( sumHand( this.dealer ) < 17 ) {

				this.dealer.push( drawCard() );

			}

			const scorePlayer = score( player );
			const scoreDealer = score( dealer );

			reward = compare( scorePlayer, scoreDealer );

			if ( this.natural && isNatural( player ) && reward === 1 ) {

				reward = 1.5;

			}

		}

		const state = getState( player, dealer );

		return { state, reward, done };

	}

}

// private

const deck = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 ]; // 1 = ace, 2-10 = number cards, jack/queen/king = 10
const playerStates = [ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 ]; // player sum
const dealerStates = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; // dealer sum
const aceStates = [ 0, 1 ]; // unusable / usable

function compare( a, b ) {

	return Number( a > b ) - Number( a < b );

}

function drawCard() {

	const index = MathUtils.randInt( 0, deck.length - 1 );
	return deck[ index ];

}

function drawHand() {

	return [ drawCard(), drawCard() ];

}

function generateObservationSpace() {

	const space = [];

	for ( let i = 0; i < playerStates.length; i ++ ) {

		const playerState = playerStates[ i ];

		for ( let j = 0; j < dealerStates.length; j ++ ) {

			const dealerState = dealerStates[ j ];

			for ( let k = 0; k < aceStates.length; k ++ ) {

				const aceState = aceStates[ k ];

				space.push( playerState + '-' + dealerState + '-' + aceState );

			}

		}

	}

	return space;

}

function getState( player, dealer ) {

	return [ sumHand( player ), dealer[ 0 ], isUsableAce( player ) ];

}

function isBust( hand ) {

	return sumHand( hand ) > 21;

}

function isNatural( hand ) {

	return hand.includes( 1 ) && hand.includes( 10 );

}

function isUsableAce( hand ) {

	return hand.includes( 1 ) && sum( hand ) + 10 <= 21;

}

function score( hand ) {

	return isBust( hand ) ? 0 : sumHand( hand );

}

function sum( hand ) {

	return hand.reduce( ( a, c ) => a + c );

}

function sumHand( hand ) {

	const s = sum( hand );

	return isUsableAce( hand ) ? s + 10 : s;

}

const ACTIONS = Object.freeze( {
	STICK: 0,
	HIT: 1
} );

export { BlackjackEnvironment, ACTIONS };


text:
package org.chaos.fx.cnbeta.hotcomment;

import android.text.TextUtils;

import org.chaos.fx.cnbeta.R;
import org.chaos.fx.cnbeta.net.model.HotComment;
import org.chaos.fx.cnbeta.widget.ListAdapter;

/**
 * @author Chaos
 *         2015/11/14.
 */
class HotCommentAdapter extends ListAdapter<HotComment, HotCommentViewHolder> {

    HotCommentAdapter() {
        super(R.layout.hot_comment_item);
    }

    @Override
    protected void convert(HotCommentViewHolder holder, HotComment comment) {
        holder.title.setText(comment.getTitle());
        String username = TextUtils.isEmpty(comment.getUsername())
                ? mContext.getString(R.string.anonymous) : comment.getUsername();
        holder.comment.setText(String.format(
                mContext.getString(R.string.hot_comment_content), username, comment.getComment()));
    }

}

redpajama_set_name: RedPajamaGithub


text:
"""Unit test for keytabs2
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import base64
import os
import sqlite3
import shutil
import tempfile
import unittest

import mock

# Disable W0611: Unused import
import treadmill.tests.treadmill_test_skip_windows  # pylint: disable=W0611

from treadmill import keytabs2
from treadmill.keytabs2 import client as kt2_client
from treadmill.keytabs2 import locker as kt2_locker
from treadmill.keytabs2 import receiver as kt2_receiver

class Keytabs2Test(unittest.TestCase):
    """Tests for module teadmill.keytabs2"""

    def setUp(self):
        self.spool_dir = tempfile.mkdtemp()
        self.sqlite3_dir = tempfile.mkdtemp()
        self.database = os.path.join(self.sqlite3_dir, 'test.db')

    def tearDown(self):
        shutil.rmtree(self.spool_dir)
        shutil.rmtree(self.sqlite3_dir)

    @mock.patch('kazoo.client.KazooClient')
    @mock.patch('treadmill.discovery.iterator')
    @mock.patch('treadmill.gssapiprotocol.jsonclient.GSSAPIJsonClient')
    @mock.patch('treadmill.keytabs2.write_keytab')
    def test_request_keytabs(self, mock_write_keytab, mock_client_class,
                             mock_iterator, mock_zk):
        """Test request_keytabs"""
        os.environ['TREADMILL_ID'] = 'treadmill'
        app_name = 'proida.foo'
        spool_dir = self.spool_dir

        mock_iterator.return_value = [('foo:tcp:keytabs', '127.0.0.1:12345')]
        mock_json_client = mock.Mock()
        mock_client_class.return_value = mock_json_client

        # test connection error
        mock_json_client.connect.return_value = False

        with self.assertRaises(keytabs2.KeytabClientError):
            kt2_client.request_keytabs(mock_zk, app_name, spool_dir, 'foo')
        mock_json_client.connect.assert_called_once()

        # test server internal error
        mock_json_client.reset_mock()
        mock_json_client.connect.return_value = True
        mock_json_client.read_json.return_value = {
            'success': False,
            'message': 'ops..',
        }
        with self.assertRaises(keytabs2.KeytabClientError):
            kt2_client.request_keytabs(mock_zk, app_name, spool_dir, 'foo')
        mock_json_client.write_json.assert_called_once_with(
            {
                'action': 'get',
                'app': app_name,
            }
        )

        # test valid keytabs with arbitrary bytes
        keytab_1 = base64.b64encode(os.urandom(10))
        keytab_2 = base64.b64encode(os.urandom(10))
        mock_json_client.read_json.return_value = {
            'success': True,
            'keytabs': {
                'ktname_1': keytab_1,
                'ktname_2': keytab_2,
            },
        }
        kt2_client.request_keytabs(mock_zk, app_name, spool_dir, 'foo')
        mock_write_keytab.assert_has_calls(
            [
                mock.call(os.path.join(self.spool_dir, 'ktname_1'), keytab_1),
                mock.call(os.path.join(self.spool_dir, 'ktname_2'), keytab_2),
            ],
            any_order=True,
        )

    def test_compare_data(self):
        """test compare data
        """
        stored = []
        desired = [(1, 1), (2, 2)]

        # pylint: disable=protected-access
        (add, modify, delete) = kt2_receiver._compare_data(stored, desired)
        self.assertEqual(add, desired)
        self.assertEqual(modify, [])
        self.assertEqual(delete, [])

        stored = [(1, 1)]
        desired = [(1, 1), (2, 2)]
        (add, modify, delete) = kt2_receiver._compare_data(stored, desired)
        self.assertEqual(add, [(2, 2)])
        self.assertEqual(modify, [])
        self.assertEqual(delete, [])

        stored = [(2, 2), (3, 3)]
        desired = [(1, 1), (2, 3), (4, 4)]
        (add, modify, delete) = kt2_receiver._compare_data(stored, desired)
        self.assertEqual(add, [(1, 1), (4, 4)])
        self.assertEqual(modify, [(2, 3)])
        self.assertEqual(delete, [(3, 3)])

        stored = [(2, 2), (3, 3)]
        desired = [(1, 1), (2, 3)]
        (add, modify, delete) = kt2_receiver._compare_data(stored, desired)
        self.assertEqual(add, [(1, 1)])
        self.assertEqual(modify, [(2, 3)])
        self.assertEqual(delete, [(3, 3)])

    @mock.patch('pwd.getpwnam', mock.Mock())
    @mock.patch('os.chown', mock.Mock())
    def test_sync_relations(self):
        """Test sync_relations"""
        data = [
            ('proid1', 'vip1.com'),
            ('proid2', 'vip2.com'),
        ]

        receiver = kt2_receiver.KeytabReceiver(
            self.spool_dir, self.database, 'owner'
        )
        receiver.sync('owner', data)

        conn = sqlite3.connect(self.database)
        cur = conn.cursor()
        rows = cur.execute(
            'SELECT proid, vip FROM keytab_proid'
        ).fetchall()
        self.assertEqual(data, rows)

        data = [
            ('proid1', 'vip1.com'),
            ('proid3', 'vip2.com'),
            ('proid2', 'vip3.com'),
        ]
        receiver.sync('owner', data)

        cur = conn.cursor()
        rows = cur.execute(
            'SELECT proid, vip FROM keytab_proid order by vip'
        ).fetchall()
        self.assertEqual(data, rows)

        conn.close()

    @mock.patch('socket.gethostbyname', mock.Mock(return_value='192.168.1.1'))
    def test_translate_vip(self):
        """test translate keytab magic string to vip address
        """
        # pylint: disable=protected-access
        self.assertEqual('192.168.1.1',
                         kt2_locker._translate_vip('host#myhost@realm'))

        # test wrong keytab format
        with self.assertRaises(keytabs2.KeytabLockerError):
            kt2_locker._translate_vip('host#myhost#realm')

    @mock.patch('pwd.getpwnam', mock.Mock())
    @mock.patch('os.chown', mock.Mock())
    @mock.patch('treadmill.zkutils.with_retry',
                mock.Mock(return_value={'keytabs': ['vip1.com']}))
    @mock.patch('treadmill.keytabs2.locker._translate_vip',
                mock.Mock(side_effect=['192.168.1.1', '192.168.2.1']))
    def test_locker(self):
        """test locker method
        """
        locker = kt2_locker.KeytabLocker(
            self.spool_dir, self.database, mock.Mock()
        )
        with self.assertRaises(keytabs2.KeytabLockerError):
            # pylint: disable=protected-access
            locker._get_app_keytabs('foo/xxxx@xxx', 'foo.bar')

        data = [
            ('proid1', '192.168.1.1'),
            ('proid2', '192.168.1.2'),
        ]

        receiver = kt2_receiver.KeytabReceiver(
            self.spool_dir, self.database, 'owner'
        )
        receiver.sync('owner', data)

        # first test, vip 192.168.1.1 is in the db
        keytabs = locker.query('host/xxxx@xxx', 'proid1.xxx')
        self.assertEqual(['vip1.com'], keytabs)

        # second test, vip 192.168.2.1 is not in sqlite db
        with self.assertRaises(keytabs2.KeytabLockerError):
            locker.query('host/xxxx@xxx', 'proid1.yyy')

if __name__ == '__main__':
    unittest.main()


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* Sneha H Wakode
* Used to create layour pages for the view
* Integrates the pages fragments in a single layout of pages
*/
class Layout
{
	protected $CI;
	protected $theme;
	protected $template;

	public function __construct()
	{
        $this->CI =& get_instance();

        // Used to get the default theme and view template
        $this->theme = $this->CI->config->item('theme');
        $this->template = 'layout/templates/' . $this->CI->config->item('template');
	}

	/*
	* Sneha Wakode
	* Used to load the pages fragment for the home pages layout
	*/
	public function home_layout($page = "")
	{
		if($page !== "") {
			$this->CI->load->view($this->template.'/header/header');
			$this->CI->load->view($this->template.'/header/common_js');
			$this->CI->load->view($this->template.'/header/menu');
			$this->CI->load->view($page);
			$this->CI->load->view($this->template.'/footer/footer_links');
			$this->CI->load->view($this->template.'/footer/footer');
		} else {
			$this->CI->load->view($this->template.'/header/header');
			$this->CI->load->view($this->template.'/header/common_js');
			$this->CI->load->view($this->template.'/header/menu');
			$this->CI->load->view($this->template.'/footer/footer_links');
			$this->CI->load->view($this->template.'/footer/footer');
		}
	}

	/*
	* Sneha Wakode
	* Used to create general/common pages
	*/
	public function general_layout($page = "")
	{
		if($page !== "") {
			$this->CI->load->view($this->template.'/header/header_general');
			$this->CI->load->view($this->template.'/header/common_js');
			$this->CI->load->view($this->template.'/header/menu');
			$this->CI->load->view($page);
			$this->CI->load->view($this->template.'/footer/footer_links');
			$this->CI->load->view($this->template.'/footer/footer');
		}
	}

	/**
	 * Used to load elements of page
	 *
	 * @return void
	 **/
	public function view_element($page = '')
	{
		if($page !== '') {
			$this->CI->load->view($this->template.'/pages/'.$page);
		}
	}

	/**
	* Used to load common pages without top menu
	**/
	public function template_page($page = '', $data = '')
	{
		if($page !== '') {
			$this->CI->load->view($this->template.'/header/header_general');
			$this->CI->load->view($this->template.'/header/common_js');
			$this->CI->load->view($this->template.'/pages/'.$page, $data);
			$this->CI->load->view($this->template.'/footer/footer');
		}
	}

}

/* End of file Layout.php */
/* Location: .//opt/lampp/htdocs/demo/blog/libraries/Layout.php */


text:
PLAY_TORRENT_URL

PLAY_TORRENT_URL_MSG

		<input st-input-focus type="text" ng-model="torrent.url" placeholder="{{ 'TORRENT_PLACEHOLDER' | translate }}" value="">

PLAY_TORRENT


text:
import axios from 'axios'

export default {
	namespaced: true,

	state: {
		id: null,
		name: null,
		previouslySelectedName: null,
		ready: false,
	},

	getters: {
		id(state) {
			return state.id
		},

		name(state) {
			return state.name
		},

		previouslySelectedName(state) {
			return state.previouslySelectedName
		},

		ready(state) {
			return state.ready
		},
	},

	mutations: {
		setId(state, id) {
			state.id = id
		},

		setName(state, name) {
			state.name = name
		},

		setPreviouslySelectedName(state, previouslySelectedName) {
			state.previouslySelectedName = previouslySelectedName
		},

		setReady(state, ready) {
			state.ready = ready
		},
	},

	actions: {
		setPlayer({ commit }, { id, name }) {
			commit('setId', id)
			commit('setName', name)
		},

		setName({ commit }, name) {
			commit('setName', name)
		},

		setPreviouslySelectedName({ commit }, previouslySelectedName) {
			commit('setPreviouslySelectedName', previouslySelectedName)
		},

		setReady({ commit }, ready) {
			commit('setReady', ready)
		},

		async toggleReady({ commit, state }, ready) {
			ready = ! state.ready

			await axios.put('/api/ready', { ready })

			commit('setReady', ready)
		},
	},
}


text:
using System;
using OpenSage.Mathematics;
using Veldrid;
using Rectangle = OpenSage.Mathematics.Rectangle;

namespace OpenSage.Gui.Wnd.Images
{
    public sealed class Image
    {
        private readonly ImageSource _source;
        private readonly bool _grayscale;
        private Texture _texture;
        private Size _size;

        public string Name { get; }

        public Size NaturalSize => _source.NaturalSize;

        internal Image(string name, ImageSource source, bool grayscale = false)
        {
            Name = name;
            _source = source;
            _grayscale = grayscale;
        }

        internal void SetSize(in Size size)
        {
            var actualSize = _source.NaturalSize.Width > size.Width
                ? _source.NaturalSize
                : size;

            if (_size == actualSize)
            {
                return;
            }

            _texture = _source.GetTexture(actualSize);
            if(size.Width == 0 || size.Height == 0)
            {
                return;
            }

            if (_texture == null)
            {
                throw new InvalidOperationException();
            }

            _size = actualSize;
        }

        public Image WithGrayscale(bool grayscale)
        {
            return new Image(Name, _source, grayscale);
        }

        internal void Draw(DrawingContext2D drawingContext, in Rectangle destinationRect)
        {
            if (_texture == null)
            {
                // TODO: crashes in multiplayer mode
                return;
                // throw new InvalidOperationException();
            }
            drawingContext.DrawImage(_texture, null, destinationRect, grayscale: _grayscale);
        }
    }
}


text:
package com.planet_ink.coffee_mud.Abilities.Thief;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

@SuppressWarnings("rawtypes")
public class Thief_SilentOpen extends ThiefSkill
{
	@Override public String ID() { return "Thief_SilentOpen"; }
	private final static String localizedName = CMLib.lang()._("Silent Open");
	@Override public String name() { return localizedName; }
	@Override protected int canAffectCode(){return 0;}
	@Override protected int canTargetCode(){return Ability.CAN_ITEMS|Ability.CAN_EXITS;}
	@Override public int abstractQuality(){return Ability.QUALITY_INDIFFERENT;}
	@Override public int classificationCode(){return Ability.ACODE_THIEF_SKILL|Ability.DOMAIN_STEALTHY;}
	private static final String[] triggerStrings =_i(new String[] {"SILENTOPEN","SOPEN"});
	@Override public String[] triggerStrings(){return triggerStrings;}
	@Override public int usageType(){return USAGE_MOVEMENT|USAGE_MANA;}
	public int code=0;

	@Override public int abilityCode(){return code;}
	@Override public void setAbilityCode(int newCode){code=newCode;}

	@Override
	public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel)
	{
		if((commands.size()<1)&&(givenTarget==null))
		{
			mob.tell(_("What would you like to open?"));
			return false;
		}
		final Environmental item=super.getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_UNWORNONLY);
		if(item==null) return false;
		if((item instanceof MOB)
		||(item instanceof Area)
		||(item instanceof Room))
		{
			mob.tell(_("You can't open that!"));
			return false;
		}

		if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
			return false;

		final boolean success=proficiencyCheck(mob,0,auto);

		if(success)
		{
			final CMMsg msg=CMClass.getMsg(mob,item,this,CMMsg.MSG_THIEF_ACT,_("<S-NAME> open(s) <T-NAME>."),CMMsg.NO_EFFECT,null,CMMsg.NO_EFFECT,null);
			if(mob.location().okMessage(mob,msg))
			{
				mob.location().send(mob,msg);
				CMLib.commands().postOpen(mob,item,true);
			}
		}
		else
		{
			beneficialVisualFizzle(mob,item,_("<S-NAME> attempt(s) to open <T-NAME> quietly, but fail(s)."));
			CMLib.commands().postOpen(mob,item,false);
		}
		return success;
	}
}


text:
import Link from 'next/link'
import css from './other.module.css'

export default function Other() {
  return (

      <Link href="/">
        index page
      </Link>

        Blue

  )
}


text:
<?php
namespace Amqp\Base\Config;

class Exception extends \Exception {}


text:
require 'ansible/ruby/modules/base'

module Ansible
  module Ruby
    module Modules
      # Create or delete a Rackspace Cloud Monitoring check associated with an existing rax_mon_entity. A check is a specific test or measurement that is performed, possibly from different monitoring zones, on the systems you monitor. Rackspace monitoring module flow | rax_mon_entity -> *rax_mon_check* -> rax_mon_notification -> rax_mon_notification_plan -> rax_mon_alarm
      class Rax_mon_check < Base
        # @return [:present, :absent, nil] Ensure that a check with this C(label) exists or does not exist.
        attribute :state
        validates :state, expression_inclusion: {:in=>[:present, :absent], :message=>"%{value} needs to be :present, :absent"}, allow_nil: true

        # @return [Object] ID of the rax_mon_entity to target with this check.
        attribute :entity_id
        validates :entity_id, presence: true

        # @return [Object] Defines a label for this check, between 1 and 64 characters long.
        attribute :label
        validates :label, presence: true

        # @return [:"remote.dns", :"remote.ftp-banner", :"remote.http", :"remote.imap-banner", :"remote.mssql-banner", :"remote.mysql-banner", :"remote.ping", :"remote.pop3-banner", :"remote.postgresql-banner", :"remote.smtp-banner", :"remote.smtp", :"remote.ssh", :"remote.tcp", :"remote.telnet-banner", :"agent.filesystem", :"agent.memory", :"agent.load_average", :"agent.cpu", :"agent.disk", :"agent.network", :"agent.plugin"] The type of check to create. C(remote.) checks may be created on any rax_mon_entity. C(agent.) checks may only be created on rax_mon_entities that have a non-null C(agent_id).
        attribute :check_type
        validates :check_type, presence: true, expression_inclusion: {:in=>[:"remote.dns", :"remote.ftp-banner", :"remote.http", :"remote.imap-banner", :"remote.mssql-banner", :"remote.mysql-banner", :"remote.ping", :"remote.pop3-banner", :"remote.postgresql-banner", :"remote.smtp-banner", :"remote.smtp", :"remote.ssh", :"remote.tcp", :"remote.telnet-banner", :"agent.filesystem", :"agent.memory", :"agent.load_average", :"agent.cpu", :"agent.disk", :"agent.network", :"agent.plugin"], :message=>"%{value} needs to be :\"remote.dns\", :\"remote.ftp-banner\", :\"remote.http\", :\"remote.imap-banner\", :\"remote.mssql-banner\", :\"remote.mysql-banner\", :\"remote.ping\", :\"remote.pop3-banner\", :\"remote.postgresql-banner\", :\"remote.smtp-banner\", :\"remote.smtp\", :\"remote.ssh\", :\"remote.tcp\", :\"remote.telnet-banner\", :\"agent.filesystem\", :\"agent.memory\", :\"agent.load_average\", :\"agent.cpu\", :\"agent.disk\", :\"agent.network\", :\"agent.plugin\""}

        # @return [Object, nil] Comma-separated list of the names of the monitoring zones the check should run from. Available monitoring zones include mzdfw, mzhkg, mziad, mzlon, mzord and mzsyd. Required for remote.* checks; prohibited for agent.* checks.
        attribute :monitoring_zones_poll

        # @return [Object, nil] One of `target_hostname` and `target_alias` is required for remote.* checks, but prohibited for agent.* checks. The hostname this check should target. Must be a valid IPv4, IPv6, or FQDN.
        attribute :target_hostname

        # @return [Object, nil] One of `target_alias` and `target_hostname` is required for remote.* checks, but prohibited for agent.* checks. Use the corresponding key in the entity's `ip_addresses` hash to resolve an IP address to target.
        attribute :target_alias

        # @return [Object, nil] Additional details specific to the check type. Must be a hash of strings between 1 and 255 characters long, or an array or object containing 0 to 256 items.
        attribute :details

        # @return [Symbol, nil] If "yes", ensure the check is created, but don't actually use it yet.
        attribute :disabled
        validates :disabled, type: Symbol

        # @return [Object, nil] Hash of arbitrary key-value pairs to accompany this check if it fires. Keys and values must be strings between 1 and 255 characters long.
        attribute :metadata

        # @return [Object, nil] The number of seconds between each time the check is performed. Must be greater than the minimum period set on your account.
        attribute :period

        # @return [Object, nil] The number of seconds this check will wait when attempting to collect results. Must be less than the period.
        attribute :timeout
      end
    end
  end
end


text:
w,h=guiGetScreenSize()

subtitlesT = {}
subtitlesT.subtitle=""
subtitlesT.showingSubtitle=false
subtitlesT.outline=2
subtitlesT.color=tocolor(255,255,255,255)

function subtitlesT.debug(cmd,text)
subtitlesT.setSubtitle(tostring(text),5000)
end

function subtitlesT.setSubtitle(text,time,r,g,b,a)
if isTimer(subtitlesT.timer) then killTimer(subtitlesT.timer) end
subtitlesT.showingSubtitle=true
subtitlesT.subtitle=text
subtitlesT.timer=setTimer(subtitlesT.clearSubtitle,time,1)
subtitlesT.color=tocolor(r,g,b,a)
end

function subtitlesT.clearSubtitle()
subtitlesT.showingSubtitle=false
subtitlesT.subtitle=nil
end

function subtitlesT.render ()

--dxDrawText("t#32FF32e#3232FFs#32FF32t" --[[colorful test]] , 0, 1000*0.75, w, h, tocolor(240,151,63,255), 2, "default", "center", "center", false, false, false, true)

if subtitlesT.showingSubtitle == true then
--x=w--/2*2
x=0
y=h*0.75

local tempSubtitle=removeHex(subtitlesT.subtitle)

dxDrawText(tempSubtitle,x+subtitlesT.outline,y+subtitlesT.outline,w,h,tocolor(0,0,0,255),2,"default-bold","center", "center", false, false, false, true)
dxDrawText(tempSubtitle,x-subtitlesT.outline,y+subtitlesT.outline,w,h,tocolor(0,0,0,255),2,"default-bold","center", "center", false, false, false, true)
dxDrawText(tempSubtitle,x+subtitlesT.outline,y-subtitlesT.outline,w,h,tocolor(0,0,0,255),2,"default-bold","center", "center", false, false, false, true)
dxDrawText(tempSubtitle,x-subtitlesT.outline,y-subtitlesT.outline,w,h,tocolor(0,0,0,255),2,"default-bold","center", "center", false, false, false, true)

dxDrawText(subtitlesT.subtitle,x,y,w,h,subtitlesT.color,2,"default-bold","center", "center", false, false, false, true)
end
--dxDrawText( string text, float left, float top [, float right=left, float bottom=top, int color=white,                   float scale=1, mixed font="default", string alignX="left", string alignY="top",                  bool clip=false, bool wordBreak=false, bool postGUI=false,                  bool colorCoded=false, bool subPixelPositioning=false,                   float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ] )

end

--addCommandHandler("debug",subtitlesT.debug)

addEvent("story.subtitles.setSubtitle",true)
addEventHandler( "story.subtitles.setSubtitle", root, subtitlesT.setSubtitle )