text:
from dataclasses import dataclass, field
import gym
from typing import List, Mapping, Any

from ray.rllib.core.rl_module.torch import TorchRLModule
from ray.rllib.core.rl_module.rl_module import RLModule
from ray.rllib.utils.annotations import override
from ray.rllib.utils.nested_dict import NestedDict
from ray.rllib.utils.framework import try_import_torch
from ray.rllib.models.specs.specs_dict import ModelSpec, check_specs
from ray.rllib.models.specs.specs_torch import TorchTensorSpec
from ray.rllib.models.torch.torch_distributions import (
    TorchCategorical,
    TorchDeterministic,
    TorchDiagGaussian,
)

torch, nn = try_import_torch()

def get_ppo_loss(fwd_in, fwd_out):
    # this is not exactly a ppo loss, just something to show that the
    # forward train works
    adv = fwd_in["reward"] - fwd_out["vf"]
    actor_loss = -(fwd_out["logp"] * adv).mean()
    critic_loss = (adv**2).mean()
    loss = actor_loss + critic_loss

    return loss

def get_shared_encoder_config(env):
    return PPOModuleConfig(
        observation_space=env.observation_space,
        action_space=env.action_space,
        encoder_config=FCConfig(
            hidden_layers=[32],
            activation="ReLU",
        ),
        pi_config=FCConfig(
            hidden_layers=[32],
            activation="ReLU",
        ),
        vf_config=FCConfig(
            hidden_layers=[32],
            activation="ReLU",
        ),
    )

def get_separate_encoder_config(env):
    return PPOModuleConfig(
        observation_space=env.observation_space,
        action_space=env.action_space,
        pi_config=FCConfig(
            hidden_layers=[32],
            activation="ReLU",
        ),
        vf_config=FCConfig(
            hidden_layers=[32],
            activation="ReLU",
        ),
    )

@dataclass
class FCConfig:
    """Configuration for a fully connected network.

    Attributes:
        input_dim: The input dimension of the network. It cannot be None.
        output_dim: The output dimension of the network. if None, the last layer would
            be the last hidden layer.
        hidden_layers: The sizes of the hidden layers.
        activation: The activation function to use after each layer (except for the
            output).
        output_activation: The activation function to use for the output layer.
    """

    input_dim: int = None
    output_dim: int = None
    hidden_layers: List[int] = field(default_factory=lambda: [256, 256])
    activation: str = "ReLU"
    output_activation: str = None

@dataclass
class PPOModuleConfig:
    """Configuration for the PPO module.

    Attributes:
        observation_space: The observation space of the environment.
        action_space: The action space of the environment.
        pi_config: The configuration for the policy network.
        vf_config: The configuration for the value network.
        encoder_config: The configuration for the encoder network.
    """

    observation_space: gym.Space = None
    action_space: gym.Space = None
    pi_config: FCConfig = None
    vf_config: FCConfig = None
    encoder_config: FCConfig = None

class FCNet(nn.Module):
    """A simple fully connected network.

    Attributes:
        input_dim: The input dimension of the network. It cannot be None.
        output_dim: The output dimension of the network. if None, the last layer would
            be the last hidden layer.
        hidden_layers: The sizes of the hidden layers.
        activation: The activation function to use after each layer.
    """

    def __init__(self, config: FCConfig):
        super().__init__()
        self.input_dim = config.input_dim
        self.hidden_layers = config.hidden_layers
        self.activation = config.activation
        self.output_activation = config.output_activation

        self.layers = []
        self.layers.append(nn.Linear(self.input_dim, self.hidden_layers[0]))
        for i in range(len(self.hidden_layers) - 1):
            self.layers.append(
                nn.Linear(self.hidden_layers[i], self.hidden_layers[i + 1])
            )
        if config.output_dim is not None:
            self.layers.append(nn.Linear(self.hidden_layers[-1], config.output_dim))

        if config.output_dim is None:
            self.output_dim = config.hidden_layers[-1]
        else:
            self.output_dim = config.output_dim

        self.layers = nn.ModuleList(self.layers)
        self.activation = getattr(nn, self.activation)()
        if self.output_activation is not None:
            self.output_activation = getattr(nn, self.output_activation)()

    def input_specs(self):
        return TorchTensorSpec("b, h", h=self.input_dim)

    @check_specs(input_spec="input_specs")
    def forward(self, x):
        for layer in self.layers[:-1]:
            x = self.activation(layer(x))
        x = self.layers[-1](x)
        if self.output_activation is not None:
            x = self.output_activation(x)
        return x

class SimplePPOModule(TorchRLModule):
    def __init__(self, config: PPOModuleConfig) -> None:
        super().__init__(config)

        assert isinstance(
            self.config.observation_space, gym.spaces.Box
        ), "This simple PPOModule only supports Box observation space."

        assert (
            len(self.config.observation_space.shape) == 1
        ), "This simple PPOModule only supports 1D observation space."

        assert isinstance(
            self.config.action_space, (gym.spaces.Discrete, gym.spaces.Box)
        ), ("This simple PPOModule only supports Discrete and Box action space.",)

        assert self.config.pi_config, "pi_config must be provided."
        assert self.config.vf_config, "vf_config must be provided."

        self.encoder = None
        if self.config.encoder_config:
            encoder_config = self.config.encoder_config
            encoder_config.input_dim = self.config.observation_space.shape[0]
            self.encoder = FCNet(self.config.encoder_config)

        # build pi network
        pi_config = self.config.pi_config
        if not self.encoder:
            pi_config.input_dim = self.config.observation_space.shape[0]
        else:
            pi_config.input_dim = self.encoder.output_dim

        if isinstance(self.config.action_space, gym.spaces.Discrete):
            pi_config.output_dim = self.config.action_space.n
            pi_config.output_activation = "Softmax"
        else:
            pi_config.output_dim = self.config.action_space.shape[0] * 2
        self.pi = FCNet(pi_config)

        # build vf network
        vf_config = self.config.vf_config
        if not self.encoder:
            vf_config.input_dim = self.config.observation_space.shape[0]
        else:
            vf_config.input_dim = self.encoder.output_dim

        vf_config.output_dim = 1
        self.vf = FCNet(vf_config)

        self._is_discrete = isinstance(self.config.action_space, gym.spaces.Discrete)

    @override(RLModule)
    def input_specs_inference(self) -> ModelSpec:
        return self.input_specs_exploration()

    @override(RLModule)
    def output_specs_inference(self) -> ModelSpec:
        return ModelSpec(
            {
                "action_dist": TorchDeterministic,
            }
        )

    @override(RLModule)
    def _forward_inference(self, batch: NestedDict) -> Mapping[str, Any]:
        encoded_state = batch["obs"]
        if self.encoder:
            encoded_state = self.encoder(encoded_state)
        pi_out = self.pi(encoded_state)

        if self._is_discrete:
            action = torch.argmax(pi_out, dim=-1)
        else:
            action, _ = pi_out.chunk(2, dim=-1)

        action_dist = TorchDeterministic(action)
        return {"action_dist": action_dist}

    @override(RLModule)
    def input_specs_exploration(self):
        return ModelSpec(
            {
                "obs": self.encoder.input_specs()
                if self.encoder
                else self.pi.input_specs(),
            }
        )

    @override(RLModule)
    def output_specs_exploration(self) -> ModelSpec:
        return ModelSpec(
            {
                "action_dist": TorchCategorical
                if self._is_discrete
                else TorchDiagGaussian,
            }
        )

    @override(RLModule)
    def _forward_exploration(self, batch: NestedDict) -> Mapping[str, Any]:
        encoded_state = batch["obs"]
        if self.encoder:
            encoded_state = self.encoder(encoded_state)
        pi_out = self.pi(encoded_state)

        if self._is_discrete:
            action_dist = TorchCategorical(pi_out)
        else:
            mu, scale = pi_out.chunk(2, dim=-1)
            action_dist = TorchDiagGaussian(mu, scale.exp())

        return {"action_dist": action_dist}

    @override(RLModule)
    def input_specs_train(self) -> ModelSpec:
        if self._is_discrete:
            action_dim = 1
        else:
            action_dim = self.config.action_space.shape[0]

        return ModelSpec(
            {
                "obs": self.encoder.input_specs()
                if self.encoder
                else self.pi.input_specs(),
                "action": TorchTensorSpec("b, da", da=action_dim),
            }
        )

    @override(RLModule)
    def output_specs_train(self) -> ModelSpec:
        return ModelSpec(
            {
                "action_dist": TorchCategorical
                if self._is_discrete
                else TorchDiagGaussian,
                "logp": TorchTensorSpec("b", dtype=torch.float32),
                "entropy": TorchTensorSpec("b", dtype=torch.float32),
                "vf": TorchTensorSpec("b", dtype=torch.float32),
            }
        )

    @override(RLModule)
    def _forward_train(self, batch: NestedDict) -> Mapping[str, Any]:
        encoded_state = batch["obs"]
        if self.encoder:
            encoded_state = self.encoder(encoded_state)
        pi_out = self.pi(encoded_state)
        vf = self.vf(encoded_state)

        if self._is_discrete:
            action_dist = TorchCategorical(pi_out)
        else:
            mu, scale = pi_out.chunk(2, dim=-1)
            action_dist = TorchDiagGaussian(mu, scale.exp())

        logp = action_dist.logp(batch["action"].squeeze(-1))
        entropy = action_dist.entropy()
        return {
            "action_dist": action_dist,
            "logp": logp,
            "entropy": entropy,
            "vf": vf.squeeze(-1),
        }


text:
function Person(fname, lname, age, gender) {
    this.firstName = fname;
    this.lastName = lname;
    this.age = age;
    this.gender = !gender ? 'male' : 'female';
}

console.log([
    new Person('John', 'Shepard', '26', false),
    new Person('Tali', 'Zhora', '23', true),
    new Person('Garrus', 'Vakarian', '32', false),
    new Person('Liara', 'Tsoni', '103', true),
    new Person('Urdnot', 'Wrex', '58', false),
    new Person('Miranda', 'Lawson', '29', true),
    new Person('James', 'Vega', '30', false),
    new Person('Ashley', 'Williams', '26', true),
    new Person('David', 'Anderson', '53', false),
    new Person('Jeff', 'Moreau', '35', false)
]);

redpajama_set_name: RedPajamaGithub


text:
#include "src/core/lib/iomgr/port.h"

// This test won't work except with posix sockets enabled
#ifdef GRPC_POSIX_SOCKET_TCP_CLIENT

#include "src/core/lib/iomgr/tcp_client.h"

#include <errno.h>
#include <netinet/in.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>

#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>

#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "src/core/lib/iomgr/timer.h"
#include "test/core/util/test_config.h"

static grpc_pollset_set* g_pollset_set;
static gpr_mu* g_mu;
static grpc_pollset* g_pollset;
static int g_connections_complete = 0;
static grpc_endpoint* g_connecting = nullptr;

static grpc_millis test_deadline(void) {
  return grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(10));
}

static void finish_connection() {
  gpr_mu_lock(g_mu);
  g_connections_complete++;
  grpc_core::ExecCtx exec_ctx;
  GPR_ASSERT(
      GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, nullptr)));

  gpr_mu_unlock(g_mu);
}

static void must_succeed(void* /*arg*/, grpc_error* error) {
  GPR_ASSERT(g_connecting != nullptr);
  GPR_ASSERT(error == GRPC_ERROR_NONE);
  grpc_endpoint_shutdown(g_connecting, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
                                           "must_succeed called"));
  grpc_endpoint_destroy(g_connecting);
  g_connecting = nullptr;
  finish_connection();
}

static void must_fail(void* /*arg*/, grpc_error* error) {
  GPR_ASSERT(g_connecting == nullptr);
  GPR_ASSERT(error != GRPC_ERROR_NONE);
  finish_connection();
}

void test_succeeds(void) {
  grpc_resolved_address resolved_addr;
  struct sockaddr_in* addr =
      reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
  int svr_fd;
  int r;
  int connections_complete_before;
  grpc_closure done;
  grpc_core::ExecCtx exec_ctx;

  gpr_log(GPR_DEBUG, "test_succeeds");

  memset(&resolved_addr, 0, sizeof(resolved_addr));
  resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
  addr->sin_family = AF_INET;

  /* create a dummy server */
  svr_fd = socket(AF_INET, SOCK_STREAM, 0);
  GPR_ASSERT(svr_fd >= 0);
  GPR_ASSERT(
      0 == bind(svr_fd, (struct sockaddr*)addr, (socklen_t)resolved_addr.len));
  GPR_ASSERT(0 == listen(svr_fd, 1));

  gpr_mu_lock(g_mu);
  connections_complete_before = g_connections_complete;
  gpr_mu_unlock(g_mu);

  /* connect to it */
  GPR_ASSERT(getsockname(svr_fd, (struct sockaddr*)addr,
                         (socklen_t*)&resolved_addr.len) == 0);
  GRPC_CLOSURE_INIT(&done, must_succeed, nullptr, grpc_schedule_on_exec_ctx);
  grpc_tcp_client_connect(&done, &g_connecting, g_pollset_set, nullptr,
                          &resolved_addr, GRPC_MILLIS_INF_FUTURE);

  /* await the connection */
  do {
    resolved_addr.len = static_cast<socklen_t>(sizeof(addr));
    r = accept(svr_fd, reinterpret_cast<struct sockaddr*>(addr),
               reinterpret_cast<socklen_t*>(&resolved_addr.len));
  } while (r == -1 && errno == EINTR);
  GPR_ASSERT(r >= 0);
  close(r);

  gpr_mu_lock(g_mu);

  while (g_connections_complete == connections_complete_before) {
    grpc_pollset_worker* worker = nullptr;
    GPR_ASSERT(GRPC_LOG_IF_ERROR(
        "pollset_work",
        grpc_pollset_work(g_pollset, &worker,
                          grpc_timespec_to_millis_round_up(
                              grpc_timeout_seconds_to_deadline(5)))));
    gpr_mu_unlock(g_mu);
    grpc_core::ExecCtx::Get()->Flush();
    gpr_mu_lock(g_mu);
  }

  gpr_mu_unlock(g_mu);
}

void test_fails(void) {
  grpc_resolved_address resolved_addr;
  struct sockaddr_in* addr =
      reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
  int connections_complete_before;
  grpc_closure done;
  grpc_core::ExecCtx exec_ctx;

  gpr_log(GPR_DEBUG, "test_fails");

  memset(&resolved_addr, 0, sizeof(resolved_addr));
  resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
  addr->sin_family = AF_INET;

  gpr_mu_lock(g_mu);
  connections_complete_before = g_connections_complete;
  gpr_mu_unlock(g_mu);

  /* connect to a broken address */
  GRPC_CLOSURE_INIT(&done, must_fail, nullptr, grpc_schedule_on_exec_ctx);
  grpc_tcp_client_connect(&done, &g_connecting, g_pollset_set, nullptr,
                          &resolved_addr, GRPC_MILLIS_INF_FUTURE);

  gpr_mu_lock(g_mu);

  /* wait for the connection callback to finish */
  while (g_connections_complete == connections_complete_before) {
    grpc_pollset_worker* worker = nullptr;
    grpc_millis polling_deadline = test_deadline();
    switch (grpc_timer_check(&polling_deadline)) {
      case GRPC_TIMERS_FIRED:
        break;
      case GRPC_TIMERS_NOT_CHECKED:
        polling_deadline = 0;
      // fallthrough
      case GRPC_TIMERS_CHECKED_AND_EMPTY:
        GPR_ASSERT(GRPC_LOG_IF_ERROR(
            "pollset_work",
            grpc_pollset_work(g_pollset, &worker, polling_deadline)));
        break;
    }
    gpr_mu_unlock(g_mu);
    grpc_core::ExecCtx::Get()->Flush();
    gpr_mu_lock(g_mu);
  }

  gpr_mu_unlock(g_mu);
}

static void destroy_pollset(void* p, grpc_error* /*error*/) {
  grpc_pollset_destroy(static_cast<grpc_pollset*>(p));
}

int main(int argc, char** argv) {
  grpc_closure destroyed;
  grpc::testing::TestEnvironment env(argc, argv);
  grpc_init();

  {
    grpc_core::ExecCtx exec_ctx;
    g_pollset_set = grpc_pollset_set_create();
    g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
    grpc_pollset_init(g_pollset, &g_mu);
    grpc_pollset_set_add_pollset(g_pollset_set, g_pollset);

    test_succeeds();
    gpr_log(GPR_ERROR, "End of first test");
    test_fails();
    grpc_pollset_set_destroy(g_pollset_set);
    GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
                      grpc_schedule_on_exec_ctx);
    grpc_pollset_shutdown(g_pollset, &destroyed);
  }

  grpc_shutdown();
  gpr_free(g_pollset);
  return 0;
}

#else /* GRPC_POSIX_SOCKET_TCP_CLIENT */

int main(int argc, char** argv) { return 1; }

#endif /* GRPC_POSIX_SOCKET_CLIENT */


text:
layout: base
title:  'Statistics of Polarity in UD_Galician-TreeGal'
udver: '2'
---

## Treebank Statistics: UD_Galician-TreeGal: Features: `Polarity`

This feature is universal.
It occurs with 1 different values: `Neg`.

277 tokens (1%) have a non-empty value of `Polarity`.
11 types (0%) occur at least once with a non-empty value of `Polarity`.
6 lemmas (0%) occur at least once with a non-empty value of `Polarity`.
The feature is used with 3 part-of-speech tags: <tt>ADV</tt> (215; 1% instances), <tt>ADP</tt> (47; 0% instances), <tt>CCONJ</tt> (15; 0% instances).

### `ADV`

215 <tt>ADV</tt> tokens (18% of all `ADV` tokens) have a non-empty value of `Polarity`.

The most frequent other feature values with which `ADV` and `Polarity` co-occurred: <tt>PronType</tt><tt>=EMPTY</tt> (215; 100%).

`ADV` tokens may have the following values of `Polarity`:

* `Neg` (215; 100% of non-empty `Polarity`): non, nunca, tampouco, Nin, endexamais
* `EMPTY` (973): máis, como, tamén, xa, así, aínda, agora, cando, moi, só

### `ADP`

47 <tt>ADP</tt> tokens (1% of all `ADP` tokens) have a non-empty value of `Polarity`.

The most frequent other feature values with which `ADP` and `Polarity` co-occurred: <tt>AdpType</tt><tt>=Prep</tt> (47; 100%).

`ADP` tokens may have the following values of `Polarity`:

* `Neg` (47; 100% of non-empty `Polarity`): sen
* `EMPTY` (3772): de, en, a, por, con, para, sobre, entre, desde, até

### `CCONJ`

15 <tt>CCONJ</tt> tokens (2% of all `CCONJ` tokens) have a non-empty value of `Polarity`.

`CCONJ` tokens may have the following values of `Polarity`:

* `Neg` (15; 100% of non-empty `Polarity`): nin
* `EMPTY` (716): e, ou, quer, máis


text:
title: 'How Are Humans All The Same'
date: 04/09/2019
---

Jesus taught that we should help everyone in need. He did not turn away from anyone who came to Him. Many people came to Jesus that nobody liked. Women who were sinners came to Jesus. So did tax collectors. And people who were very sick. No one wanted to touch them. Roman soldiers came to Jesus too. Religious leaders and children also came to Jesus. What did Jesus do? He welcomed them all. The New Testament church learned that Jesus wanted believers to welcome people too. Jesus wanted His church to welcome other people to accept His gift of everlasting life.

The first Christians slowly started to learn that the Good News was for everyone. Jesus' work on earth, His life, and His death showed His followers something important. He wanted them to do good works. He wanted them to help other people. At first, Jesus' followers had trouble understanding what Jesus wanted them to do. Just look at Peter (Acts 10:9–20). The New Testament church had a hard time understanding this truth too (read Acts 15). But soon they understood that Jesus wanted them to share His love and Good News with everyone.

**What do each of the verses below teach us about our connection to other people? How are we all the same? How should the ideas in these verses change our thoughts and feelings about other people?**

`Malachi 2:10`

`Acts 17:26`

`Romans 3:23`

`Galatians 3:28`

Galatians 3:28 teaches us the same lesson that Jesus taught in the picture story about the good Samaritan. What is its message for us? Jesus does not want us to waste our time arguing about who we should help. He just wants us to go help people. Be ready to be helped by other people too. You may not expect help from them when you go to help them out. But our helping each other is all part of God's big plan to save humans. God's love and His Good News ties everyone together. His love makes us one with other people.

*Women who were sinners came to Jesus. So did tax collectors and Roman soldiers. Jesus welcomed them all.*


text:
using UnityEngine;
using System.Collections;
using Panda;

namespace Panda.Examples.Shooter
{
    public class Unit: MonoBehaviour
    {

        public int team = 0; // Team the unit is in. A unit in a different team is an enemy.
        public float health = 10.0f; // HP
        public GameObject bulletPrefab;
        public GameObject jammedEffectPrefab;
        public float rotationSpeed = 1.0f;
        public float reloadRate = 0.5f; // How many bullet per second get restored.
        public int ammo = 5;

        public GameObject explosionPrefab;
        [HideInInspector]
        public Unit shotBy; // Last unit that shot this unit.

        [HideInInspector]
        public float lastShotTime; // Time when the unit has been shot for the last time.

        [HideInInspector]
        public Unit lastHit; // Last unit this unit shot to.

        [HideInInspector]
        public float lastHitTime; // Last time this unit hit another unit.

        [HideInInspector]
        public NavMeshAgent navMeshAgent;

        [HideInInspector]
        public Vector3 destination; // The movement destination.
        public Vector3 target;      // The position to aim to.

        [HideInInspector]
        public float startHealth;

        [HideInInspector]
        public int startAmmo;

        [HideInInspector]
        public float lastReloadTime; // Last time a bullet has been restored.

        // Use this for initialization
        void Start()
        {
            lastShotTime = lastHitTime = float.NegativeInfinity;

            navMeshAgent = GetComponent<NavMeshAgent>();
            startHealth = health;
            destination = this.transform.position;

            startAmmo = ammo;
            lastReloadTime = float.NegativeInfinity;
        }

        void Update()
        {
            if( (Time.time - lastReloadTime) * reloadRate >= 1.0f )
            {
                ammo++;
                if (ammo > startAmmo) ammo = startAmmo;
                lastReloadTime = Time.time;
            }

        }

        Vector3 GetMousePosition()
        {
            var mousePosition = Input.mousePosition;
            mousePosition.z = -Camera.main.worldToCameraMatrix.MultiplyPoint(this.transform.position).z;
            var pos = Camera.main.ScreenToWorldPoint(mousePosition);
            return pos;
        }

        #region navigation tasks

        [Task]
        public bool IsHealthLessThan( float health )
        {
            return this.health < health;
        }

        [Task]
        public bool IsHealth_PercentLessThan(float percent)
        {
            return (this.health / startHealth)*100.0 < percent;
        }

        [Task]
        public bool HasAmmo()
        {
            return ammo > 0;
        }

        [Task]
        public bool Ammo_LessThan( int i )
        {
            if( Task.isInspected)
                Task.current.debugInfo = string.Format("a={0}", ammo);
            return ammo < i;
        }

        [Task]
        public bool SetDestination(Vector3 p)
        {
            destination =  p;
            navMeshAgent.destination = destination;

            if( Task.isInspected )
                Task.current.debugInfo = string.Format("({0}, {1})", destination.x, destination.y);
            return true;
        }

        [Task]
        public void WaitArrival()
        {
            var task = Task.current;
            float d = navMeshAgent.remainingDistance;
            if (!task.isStarting && navMeshAgent.remainingDistance <= 1e-2)
            {
                task.Succeed();
                d = 0.0f;
            }

            if( Task.isInspected )
                task.debugInfo = string.Format("d-{0:0.00}", d );
        }

        [Task]
        public void MoveTo(Vector3 dst)
        {
            SetDestination(dst);
            if (Task.current.isStarting)
                navMeshAgent.Resume();
            WaitArrival();
        }

        [Task]
        public void MoveTo_Destination()
        {
            MoveTo(destination);
            WaitArrival();
        }

        [Task]
        public bool SetDestination_Mouse()
        {
            var pos = GetMousePosition();
            SetDestination(pos);
            return true;
        }

        [Task]
        public bool SetDestination_WASD()
        {
            bool isSet = false;
            Vector3 dir = Vector3.zero;

            if (Input.GetKey(KeyCode.W))
                dir += Vector3.forward;
            if (Input.GetKey(KeyCode.A))
                dir += Vector3.left;
            if (Input.GetKey(KeyCode.S))
                dir += Vector3.back;
            if (Input.GetKey(KeyCode.D))
                dir += Vector3.right;

            if (dir.magnitude > 0.0f)
            {
                var pos =this.transform.position + dir.normalized;
                SetDestination(pos);
                isSet = true;
            }

            return isSet;
        }

        [Task]
        public bool Stop()
        {
            navMeshAgent.Stop();
            return true;
        }

        [Task]
        public bool LastShotTime_LessThan(float duration)
        {
            var t = (Time.time - lastShotTime);
            if( Task.isInspected )
                Task.current.debugInfo = string.Format("t={0:0.00}", t);
            return t < duration;
        }
        #endregion

        #region combat tasks

        [Task]
        public bool Fire()
        {

            var bulletOb = ammo > 0? GameObject.Instantiate(bulletPrefab): GameObject.Instantiate(jammedEffectPrefab);

            bulletOb.transform.position = this.transform.position;
            bulletOb.transform.rotation = this.transform.rotation;
            if (ammo > 0)
            {

                var bullet = bulletOb.GetComponent<Bullet>();
                bullet.shooter = this.gameObject;

                ammo--;
                lastReloadTime = Time.time;
            }
            else
            {
                lastReloadTime = Time.time + (1.0f/reloadRate);
                bulletOb.transform.parent = this.transform;
            }

            return true;
        }

        [Task]
        public bool SetTarget( Vector3 target )
        {
            this.target = target;
            this.target.y = this.transform.position.y;
            return true;
        }

        [Task]
        public bool SetTarget_Mouse()
        {
            target = GetMousePosition();
            return true;
        }

        [Task]
        bool SetTarget_Destination()
        {
            return SetTarget(destination);
        }

        [Task]
        public void AimAt_Target()
        {
            var targetDelta = (target - this.transform.position);
            var targetDir = targetDelta.normalized;

            if (targetDelta.magnitude > 0.2f)
            {

                Vector3 axis = Vector3.up * Mathf.Sign(Vector3.Cross(this.transform.forward, targetDir).y);

                var rot = Quaternion.AngleAxis(rotationSpeed * Time.deltaTime, axis);
                this.transform.rotation = rot * this.transform.rotation;

                Vector3 newAxis = Vector3.up * Mathf.Sign(Vector3.Cross(this.transform.forward, targetDir).y);

                float dot = Vector3.Dot(axis, newAxis);

                if (dot < 0.01f)
                {// We overshooted the target
                    var snapRot = Quaternion.FromToRotation(this.transform.forward, targetDir);
                    this.transform.rotation = snapRot * this.transform.rotation;
                    Task.current.Succeed();
                }

                var straighUp = Quaternion.FromToRotation(this.transform.up, Vector3.up);
                this.transform.rotation = straighUp * this.transform.rotation;
            }
            else
            {
                Task.current.Succeed();
            }

            if( Task.isInspected )
                Task.current.debugInfo = string.Format("angle={0}", Vector3.Angle(targetDir, this.transform.forward));

        }
        #endregion

        [Task]
        bool Explode()
        {
            ShooterGameController.instance.OnUnitDestroy(this);

            if (explosionPrefab != null)
            {
                var explosion = GameObject.Instantiate(explosionPrefab);
                explosion.transform.position = this.transform.position;
            }

            Destroy(this.gameObject);
            return true;
        }

    }
}


text:
<?hh // strict
namespace Usox\Sharesta;

interface ApiFactoryInterface {

	public function createRouter(
		dict<string,string> $get_vars,
		dict<string,string> $server_vars
	): RouterInterface;

	public function createResponse(int $status_code, ?string $body): ResponseInterface;
}


text:
import { SubmissionType } from "./submission"
import { GraphQLBoolean } from "graphql/type/scalars"

import { pageable } from "relay-cursor-paging"
import { connectionDefinitions, connectionFromArraySlice } from "graphql-relay"
import { GraphQLFieldConfig } from "graphql"
import { ResolverContext } from "types/graphql"

const Submissions: GraphQLFieldConfig<void, ResolverContext> = {
  type: connectionDefinitions({ nodeType: SubmissionType }).connectionType,
  args: {
    ...pageable({}),

    completed: {
      type: GraphQLBoolean,
      defaultValue: true,
    },
  },
  description: "A list of the current user's consignment submissions",
  resolve: (_root, options, { submissionsLoader }) => {
    // TODO: This should get replaced in stitching,
    //       it _does not_ handle pagination at API level, so you'll need a
    //       list size that's a little higher than average while there
    //       are still small amounts of data.
    if (!submissionsLoader) return null
    return submissionsLoader(options).then(body => {
      return connectionFromArraySlice(body, options, {
        arrayLength: body.length,
        sliceStart: 0,
      })
    })
  },
}

export default Submissions


text:
namespace extensions {
namespace api {
namespace oauth2 {
struct OAuth2Info;
}  // namespace oauth2
}  // namespace api

// Parses the "oauth2" manifest key.
class OAuth2ManifestHandler : public ManifestHandler {
 public:
  OAuth2ManifestHandler();

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

  ~OAuth2ManifestHandler() override;

  static const api::oauth2::OAuth2Info& GetOAuth2Info(
      const Extension& extension);

 private:
  // ManifestHandler overrides:
  bool Parse(Extension* extension, std::u16string* error) override;
  base::span<const char* const> Keys() const override;
};

}  // namespace extensions

#endif  // EXTENSIONS_COMMON_MANIFEST_HANDLERS_OAUTH2_MANIFEST_HANDLER_H_


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title></title>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_cart" />
        <input type="hidden" name="add" value="1" />
        <input type="hidden" name="business" value="example@minicartjs.com" />
        <input type="hidden" name="item_name" value="Test Product" />
        <input type="hidden" name="quantity" value="1" />
        <input type="hidden" name="amount" value="1.00" />
        <input type="hidden" name="currency_code" value="USD" />
        <input type="hidden" name="no_shipping" value="2">
        <input type="hidden" name="no_note" value="1">
        <input type="hidden" name="shipping2" value="1.50">
        <input type="hidden" name="shipping" value="2.50">
        Test Product

            <input type="checkbox" id="terms" name="terms" value="" /> I agree to the terms

        <input type="submit" name="submit" value="Add to cart" />
    </form>


text:
namespace PhysBAM
{

class PARTICLE_ATTRIBUTE_COLLECTION;
template<class T, class TV> class PARTICLE_POSITION_ATTRIBUTE;
template<class T, class TV> class PARTICLE_VELOCITY_ATTRIBUTE;
template<class T> class PARTICLE_MASS_ATTRIBUTE;
template<class T> class PARTICLE_ATTRIBUTE;
template<class T> class VECTOR_3D;

template<class T_PARTICLE>
class PARTICLE_ATTRIBUTE_COLLECTION_MAP
{
public:
	int maximum_index;
	int position;
	int velocity;
	int mass;
	int radius;
	int density;
	int temperature;
	int age;
	int id;
	int vorticity;
	int quantized_collision_distance;
	ARRAY<PARTICLE_ATTRIBUTE_UNTEMPLATIZED T_PARTICLE::*> internal_attributes;
	const char current_version;
	bool use_attributes_collection; // If true, particles will Initialize_Attributes_Collection when constructed

	PARTICLE_ATTRIBUTE_COLLECTION_MAP()
		: maximum_index (0), position (0), velocity (0), mass (0), radius (0), density (0), temperature (0), age (0), id (0), vorticity (0), quantized_collision_distance (0), current_version (2)
	{
		T_PARTICLE::Initialize_Attribute_Collection_Map (*this);
		Use_Attribute_Collection (false);
	}

	template<class T_ATTRIBUTE_STATIC_OFFSET>
	void Register_Internal_Attribute (T_ATTRIBUTE_STATIC_OFFSET attribute, int& attribute_slot)
	{
		internal_attributes.Append_Element ( (PARTICLE_ATTRIBUTE_UNTEMPLATIZED T_PARTICLE::*) attribute);
		attribute_slot = -internal_attributes.m;
	}

	// Records map entry for particular particle class (MUST BE CALLED BEFORE ANY PARTICLES ARE INSTANTIATED) e.g. call as
	// SOLIDS_PARTICLE<T,TV>::attribute_map(SOLIDS_PARTICLE<T,TV>::attribute_map.position);
	void Store (int& slot)
	{
		Use_Attribute_Collection (true);

		if (slot == 0) slot = ++maximum_index;
	}

	void Use_Attribute_Collection (const bool use_attributes_collection_input)
	{
		use_attributes_collection = use_attributes_collection_input;
	}

	template<class T, class TV>
	void Allocate_Attributes (PARTICLE_ATTRIBUTE_COLLECTION* attribute_collection)
	{
		attribute_collection->attributes.Resize_Array (maximum_index);
		attribute_collection->template Store<PARTICLE_POSITION_ATTRIBUTE<T, TV> > (position);
		attribute_collection->template Store<PARTICLE_VELOCITY_ATTRIBUTE<T, TV> > (velocity);
		attribute_collection->template Store<PARTICLE_MASS_ATTRIBUTE<T> > (mass);
		attribute_collection->template Store<PARTICLE_ATTRIBUTE<T> > (radius);
		attribute_collection->template Store<PARTICLE_ATTRIBUTE<T> > (density);
		attribute_collection->template Store<PARTICLE_ATTRIBUTE<T> > (temperature);
		attribute_collection->template Store<PARTICLE_ATTRIBUTE<T> > (age);
		attribute_collection->template Store<PARTICLE_ATTRIBUTE<int> > (id);
		attribute_collection->template Store<PARTICLE_ATTRIBUTE<VECTOR_3D<T> > > (vorticity);
		attribute_collection->template Store<PARTICLE_ATTRIBUTE<unsigned short> > (quantized_collision_distance);
	}

	template<class T_ATTRIBUTE>
	T_ATTRIBUTE* Get_Attribute (T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes, const int entry_index)
	{
		if (entry_index < 0) return & (particles->* ( (T_ATTRIBUTE T_PARTICLE::*) internal_attributes (-entry_index)));
		else if (attributes && entry_index > 0) return (T_ATTRIBUTE*) attributes->attributes (entry_index);
		else return 0;
	}

	template<class T_ATTRIBUTE>
	const T_ATTRIBUTE* Get_Attribute (const T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes, const int entry_index) const
	{
		if (entry_index < 0) return & (particles->* ( (T_ATTRIBUTE T_PARTICLE::*) internal_attributes (-entry_index)));
		else if (attributes && entry_index > 0) return (const T_ATTRIBUTE*) attributes->attributes (entry_index);
		else return 0;
	}

	template<class ATTRIBUTE_TYPE_TO_READ, class RW>
	void Read_Helper (std::istream& input_stream, T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes, const int read_map_entry,
			  const int my_map_entry)
	{
		ATTRIBUTE_TYPE_TO_READ* attribute = Get_Attribute<ATTRIBUTE_TYPE_TO_READ> (particles, attributes, my_map_entry);

		if (read_map_entry == 0)
		{
			if (attribute)
			{
				attribute->Resize_Array (particles->number);       // nothing in file, but at least resize to proper size
			}

			return;
		}
		else if (attribute) attribute->template Read<RW> (input_stream);
		else
		{
			ATTRIBUTE_TYPE_TO_READ temporary;        // don't have place to put but need to read it to get to next, so just read and throw away.
			temporary.template Read<RW> (input_stream);
		}
	}

	template<class T, class TV, class RW>
	void Read (std::istream& input_stream, T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes)
	{
		PARTICLE_ATTRIBUTE_COLLECTION_MAP<T_PARTICLE> read_map; // temporary map that says what is in file... where in file is irrelevant, always same order
		char version;
		Read_Binary<RW> (input_stream, version);

		if (version < 1 || version > 2)
		{
			std::cerr << "Unrecognized particle_map version " << version << std::endl;
			exit (1);
		}

		Read_Binary<RW> (input_stream, read_map.position, read_map.velocity, read_map.mass, read_map.radius, read_map.density, read_map.temperature, read_map.age, read_map.id, read_map.vorticity);

		if (version > 1) Read_Binary<RW> (input_stream, read_map.quantized_collision_distance);
		else read_map.quantized_collision_distance = 0;

		Read_Helper<PARTICLE_POSITION_ATTRIBUTE<T, TV>, RW> (input_stream, particles, attributes, read_map.position, position);
		Read_Helper<PARTICLE_VELOCITY_ATTRIBUTE<T, TV>, RW> (input_stream, particles, attributes, read_map.velocity, velocity);
		Read_Helper<PARTICLE_MASS_ATTRIBUTE<T>, RW> (input_stream, particles, attributes, read_map.mass, mass);
		Read_Helper<PARTICLE_ATTRIBUTE<T>, RW> (input_stream, particles, attributes, read_map.radius, radius);
		Read_Helper<PARTICLE_ATTRIBUTE<T>, RW> (input_stream, particles, attributes, read_map.density, density);
		Read_Helper<PARTICLE_ATTRIBUTE<T>, RW> (input_stream, particles, attributes, read_map.temperature, temperature);
		Read_Helper<PARTICLE_ATTRIBUTE<T>, RW> (input_stream, particles, attributes, read_map.age, age);
		Read_Helper<PARTICLE_ATTRIBUTE<int>, RW> (input_stream, particles, attributes, read_map.id, id);
		Read_Helper<PARTICLE_ATTRIBUTE<VECTOR_3D<T> >, RW> (input_stream, particles, attributes, read_map.vorticity, vorticity);
		Read_Helper<PARTICLE_ATTRIBUTE<unsigned short>, RW> (input_stream, particles, attributes, read_map.quantized_collision_distance, quantized_collision_distance);
	}

	template<class ATTRIBUTE_TYPE_TO_WRITE, class RW>
	void Write_Helper (std::ostream& output_stream, const T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes, const int map_entry) const
	{
		const ATTRIBUTE_TYPE_TO_WRITE* attribute = Get_Attribute<ATTRIBUTE_TYPE_TO_WRITE> (particles, attributes, map_entry);

		if (attribute) attribute->template Write<RW> (output_stream, particles->number);
	}

	template<class T, class TV, class RW>
	void Write (std::ostream& output_stream, const T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes) const
	{
		Write_Binary<RW> (output_stream, current_version);
		Write_Binary<RW> (output_stream, position, velocity, mass, radius, density, temperature, age, id, vorticity);
		Write_Binary<RW> (output_stream, quantized_collision_distance);
		Write_Helper<PARTICLE_POSITION_ATTRIBUTE<T, TV>, RW> (output_stream, particles, attributes, position);
		Write_Helper<PARTICLE_VELOCITY_ATTRIBUTE<T, TV>, RW> (output_stream, particles, attributes, velocity);
		Write_Helper<PARTICLE_MASS_ATTRIBUTE<T>, RW> (output_stream, particles, attributes, mass);
		Write_Helper<PARTICLE_ATTRIBUTE<T>, RW> (output_stream, particles, attributes, radius);
		Write_Helper<PARTICLE_ATTRIBUTE<T>, RW> (output_stream, particles, attributes, density);
		Write_Helper<PARTICLE_ATTRIBUTE<T>, RW> (output_stream, particles, attributes, temperature);
		Write_Helper<PARTICLE_ATTRIBUTE<T>, RW> (output_stream, particles, attributes, age);
		Write_Helper<PARTICLE_ATTRIBUTE<int>, RW> (output_stream, particles, attributes, id);
		Write_Helper<PARTICLE_ATTRIBUTE<VECTOR_3D<T> >, RW> (output_stream, particles, attributes, vorticity);
		Write_Helper<PARTICLE_ATTRIBUTE<unsigned short>, RW> (output_stream, particles, attributes, quantized_collision_distance);
	}

	void Print_Helper (std::ostream& output_stream, const T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes, const int map_entry, const std::string& name, const int particle_index) const
	{
		const PARTICLE_ATTRIBUTE_UNTEMPLATIZED* attribute = Get_Attribute<PARTICLE_ATTRIBUTE_UNTEMPLATIZED> (particles, attributes, map_entry);

		if (attribute) attribute->Print (output_stream, name, particle_index);
	}

	void Print (std::ostream& output_stream, const T_PARTICLE* particles, const PARTICLE_ATTRIBUTE_COLLECTION* attributes, const int particle_index) const
	{
		Print_Helper (output_stream, particles, attributes, position, "Position", particle_index);
		Print_Helper (output_stream, particles, attributes, velocity, "Velocity", particle_index);
		Print_Helper (output_stream, particles, attributes, mass, "Mass", particle_index);
		Print_Helper (output_stream, particles, attributes, radius, "Radius", particle_index);
		Print_Helper (output_stream, particles, attributes, density, "Density", particle_index);
		Print_Helper (output_stream, particles, attributes, temperature, "Temperature", particle_index);
		Print_Helper (output_stream, particles, attributes, age, "Age", particle_index);
		Print_Helper (output_stream, particles, attributes, id, "Id", particle_index);
		Print_Helper (output_stream, particles, attributes, vorticity, "Vorticity", particle_index);
		Print_Helper (output_stream, particles, attributes, quantized_collision_distance, "Quantized collision distance", particle_index);
	}

//#####################################################################
};
}
#endif


text:
package com.infinities.keystone4j.catalog.api.command.endpoint;

import com.infinities.keystone4j.catalog.CatalogDriver;
import com.infinities.keystone4j.catalog.api.command.AbstractCatalogCommand;
import com.infinities.keystone4j.exception.Exceptions;
import com.infinities.keystone4j.model.catalog.Endpoint;
import com.infinities.keystone4j.notification.NotifiableCommand;

public class CreateEndpointCommand extends AbstractCatalogCommand implements NotifiableCommand<Endpoint> {

	private final String endpointid;
	private final Endpoint endpoint;

	public CreateEndpointCommand(CatalogDriver catalogDriver, String endpointid, Endpoint endpoint) {
		super(catalogDriver);
		this.endpointid = endpointid;
		this.endpoint = endpoint;
	}

	@Override
	public Endpoint execute() {
		try {
			return this.getCatalogDriver().createEndpoint(endpointid, endpoint);
		} catch (Exception e) {
			throw Exceptions.ServiceNotFoundException.getInstance(null, endpoint.getService().getId());

		}
	}

	@Override
	public Object getArgs(int index) {
		if (index == 1) {
			return endpointid;
		} else if (index == 2) {
			return endpoint;
		}
		throw new IllegalArgumentException("invalid index");
	}

}


text:
import cv

cap = cv.CreateFileCapture("../c/tree.avi")
img = cv.QueryFrame(cap)
print "Got frame of dimensions (", img.width, " x ", img.height, ")"

cv.NamedWindow("win", cv.CV_WINDOW_AUTOSIZE)
cv.ShowImage("win", img)
cv.MoveWindow("win", 200, 200)
cv.WaitKey(0)


text:
<%! from django.utils.translation import ugettext as _ %>
<%! from microsite_configuration import microsite %>

<link rel="stylesheet" type="text/css" href="${static.url('themes/default/css/asic.css')}" />
<%inherit file="main.html" />

<%namespace name='static' file='static_content.html'/>

<%namespace file='main.html' import="login_query"/>

<%! from django.core.urlresolvers import reverse %>
<%! from django.utils import html %>
<%! from django_countries.countries import COUNTRIES %>
<%! from django.utils.translation import ugettext as _ %>
<%! from student.models import UserProfile %>
<%! from django.contrib.auth.models import User %>
<%! from datetime import date %>
<%! from third_party_auth import pipeline, provider %>
<%! import calendar %>

<%block name="pagetitle">${_("Edit profile")}</%block>
<%block name="bodyclass">view-register</%block>

        ${_("Updated Profile")}
        ,
          ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
          ${_("window open")}

      <form id="apply_update_profile_form">

        ## Translators: note that {platform} {cert_name_short} will look something like: "edX certificate". Please do not change the order of these placeholders.

${_("Your data has been correctly updated. You will be redirected to your dashboard page automatically in 2 seconds.")}

        <fieldset>

              <input type="button"  value="${_('Return to dashboard')}" id="return_home"/>

        </fieldset>
      </form>

    <button class="close-modal">

        ## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
        ${_('Close')}

    </button>

        ${_("Unsubscribe from")} ${(" {platform}").format(platform=settings.PLATFORM_NAME)}
        ,
          ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
          ${_("window open")}

      <form id="unsubscribe_form">

        ## Translators: note that {platform} {cert_name_short} will look something like: "edX certificate". Please do not change the order of these placeholders.

${_("If you unsubscribe from the platform, all your personal data will be erased and you'll be no longer able to access your work and progress.As soon as you press the below button, you'll be logged out. Are you sure you want to unsubscribe?")}

        <fieldset>

              <input type="button" class="btn btn-primary" value="${_('Yes, I want to unsubscribe')}" id="unsubscribe_accept"/>

        </fieldset>
      </form>

      ${_("Modify your profile")}
      ${_("Update your personal data")}

        <form action="/edit_profile" method="post">
            <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">

            ${_("Full Name")}:  ${up.name}

            ${_("Email")}:  ${user.email}

          % if settings.REGISTRATION_EXTRA_FIELDS['country'] != 'hidden':

              ${_("Country")}:
              <select id="country" name="country" ${'required aria-required="true"' if settings.REGISTRATION_EXTRA_FIELDS['country'] == 'required' else ''}>
                <option value="">--</option>

                %for code, country_name in COUNTRIES:
                %if ( code != up.country ):
                        <option value="${code}">${ unicode(country_name) }</option>
                  %else:
                        <option selected="selected" value="${code}">${ unicode(country_name) }</option>
                  %endif

                %endfor
              </select>

          % endif

            % if settings.REGISTRATION_EXTRA_FIELDS['level_of_education'] != 'hidden':

              ${_("Highest Level of Education Completed")}:
              <select id="education-level" name="level_of_education" ${'required aria-required="true"' if settings.REGISTRATION_EXTRA_FIELDS['level_of_education'] == 'required' else ''}>
                <option value="">--</option>

                %for code, ed_level in UserProfile.LEVEL_OF_EDUCATION_CHOICES:
                  %if ( code != up.level_of_education  ):
                        <option value="${code}">${_(ed_level)}</option>
                  %else:
                        <option selected="selected" value="${code}">${_(ed_level)}</option>
                  %endif
                %endfor
              </select>

            % endif

            % if settings.REGISTRATION_EXTRA_FIELDS['gender'] != 'hidden':

              ${_("Gender")}:
              <select id="gender" name="gender" ${'required aria-required="true"' if settings.REGISTRATION_EXTRA_FIELDS['gender'] == 'required' else ''}>
                <option value="">--</option>

                %for code, gender in UserProfile.GENDER_CHOICES:
                  %if (code!= up.gender) :
                    <option value="${code}">${_(gender)}</option>
                  %else:
                     <option selected="selected" value="${code}">${_(gender)}</option>
                  %endif

                %endfor
              </select>

            % endif

            % if settings.REGISTRATION_EXTRA_FIELDS['year_of_birth'] != 'hidden':

              ${_("Year of Birth")}:
              <select id="yob" name="year_of_birth" ${'required aria-required="true"' if settings.REGISTRATION_EXTRA_FIELDS['year_of_birth'] == 'required' else ''}>

                <option value="">--</option>

                %for year in UserProfile.VALID_YEARS:
                  %if (year == up.year_of_birth):
                    <option selected="selected" value="${year}">${year}</option>
                  %else:
                    <option value="${year}">${year}</option>
                  %endif
                %endfor

              </select>

          % endif

            % if settings.REGISTRATION_EXTRA_FIELDS['city'] != 'hidden':

            ${_("City")}:
            <textarea id="city" name="city">${up.city or ""}</textarea>

            % endif

            % if settings.REGISTRATION_EXTRA_FIELDS['goals'] != 'hidden':

                ${_("Goals")}:
                <textarea id="goals" name="goals"${'required aria-required="true"' if settings.REGISTRATION_EXTRA_FIELDS['goals'] == 'required' else ''}>${up.goals or ""}</textarea>

            % endif

            % if settings.REGISTRATION_EXTRA_FIELDS['mailing_address'] != 'hidden':

            ${_("Mailing Address")}:
            <textarea id="address-mailing" name="mailing_address">${up.mailing_address or ""}</textarea>

            % endif

                    <button name="_update" type="submit" id="submit_update" class="btn btn-primary">${_("Update Profile")}</button>
                    <button name="_cancel" type="submit" id="submit_cancel" class="btn btn-primary">${_("Cancel Update")}</button>
                    ${_("Unsubscribe")}

         </form>


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.Migrations;
using System.Xml;
using System.Data.Entity.Validation;
using System.Xml.Linq;
using System.Threading;
using StockBuddy.Console;
using StockBuddy.Common.Utilities;
using StockBuddy.Common;
using StockBuddy.Core.Domain;
using StockBuddy.Data;

namespace StockBuddy.Con
{
    public class Program
    {
        private static readonly YahooDataProvider _yahooDataProvider = new YahooDataProvider();

        public static int Main(string[] args)
        {
            //Func<Referral, bool> LastNamesMatch = delegate(Referral r)
            //{
            //    string currentUsername = UserUtils.GetCurrentUsername(User.Identity.Name);
            //    string truncatedCurrentUsername = currentUsername.Substring(0, 8);
            //    string referrerUsername = r.ReferrerName.Substring(0, 1) + r.ReferrerName.Substring(r.ReferrerName.IndexOf(" ") + 1, 7);

            //    return referrerUsername.Equals(truncatedCurrentUsername);
            //};

            AutoMapperDomainConfiguration.Configure();
            //var choice = DisplayMenu();

            //if (args[0] == null)
            //{
            //    if (choice == 1)
            //    {
            //        SyncHistory();
            //    }
            //    else if (choice == 2)
            //    {
            //        UpdateQuotes();
            //    }
            //}
            //else
            //{
            //    UpdateQuotes();
            //}

            UpdateQuotes();

            //System.Console.ReadLine();

            return 0;
        }

        private static void SyncHistory()
        {
            var symbols = GetSymbols();
            var historyDictionary = new Dictionary<string, List<Historic>>();
            var oneYearAgo = DateTime.Now.AddYears(-1);
            List<Historic> historics = null;
            var flag = false;

            foreach (var symbol in symbols)
            {
                if (symbol == "OVBC" || flag)
                {
                    flag = true;
                    using (var db = new PeabodyDataContext())
                    {
                        //Delete stale data (more than a year old)
                        var dbStaleHistories = db.Histories.Where(h => h.Symbol == symbol && h.Date < oneYearAgo);
                        db.Histories.RemoveRange(dbStaleHistories);
                        db.SaveChanges();

                        var dbHistories = db.Histories.Where(h => h.Symbol == symbol);

                        // If there's no history for the symbol on the new list, add a year of history
                        if (dbHistories.Count() == 0)
                        {
                            historics = GetHistory(symbol, DateTime.Now.AddYears(-1), DateTime.Now);
                        }
                        else
                        {
                            //if (dbHistories.OrderByDescending(t => t.Date).First().Date == DateTime.Now.Date)
                            //{
                            //    continue;
                            //}

                            // Add history beginning from it's earliest record
                            historics = GetHistory(symbol, dbHistories.OrderByDescending(t => t.Date).First().Date.AddDays(1), DateTime.Now);
                        }

                        // If we were able to pull records from yahoo, add or update database
                        if (historics != null)
                        {
                            var histories = AutoMapper.Mapper.Map<IEnumerable<Historic>, IEnumerable<History>>(historics);

                            db.Histories.AddOrUpdate(histories.ToArray());

                            try
                            {
                                db.SaveChanges();

                                System.Console.WriteLine("{0}", symbol);

                            }
                            catch (DbEntityValidationException e)
                            {
                                foreach (var eve in e.EntityValidationErrors)
                                {
                                    foreach (var ve in eve.ValidationErrors)
                                    {
                                        System.Console.WriteLine("Main --> {0}", ve.ErrorMessage);
                                    }
                                }
                                throw;
                            }
                        }
                    }

                    Thread.Sleep(2000);
                }
            }
        }

        private static void UpdateQuotes()
        {
            var symbols = GetSymbols().ToList();

            while (symbols != null)
            {
                System.Console.Write("\r{0} Remaining", symbols.Count);

                var symbolsChunk = symbols.Take(100).ToList();
                XmlReader xr = _yahooDataProvider.GetLastTradeRealtimeWithTime(symbolsChunk);
                FillStockInfoRealTime(xr, symbolsChunk);
                symbols = symbols.Skip(120).ToList();
            }
        }

        private static void FillStockInfoRealTime(XmlReader xr, IEnumerable<string> symbols)
        {
            try
            {
                XDocument master = XDocument.Load(xr);

                using (var db = new PeabodyDataContext())
                {
                    foreach (var symbol in symbols)
                    {
                        IEnumerable<XElement> elements =
                            from c in master.Root.Elements("results").Descendants("quote")
                            where c.Attribute("symbol").Value.ToLower() == symbol.ToLower()
                            select c;

                        elements = elements.Elements();

                        decimal lastTradePriceOnly;

                        var element = elements.FirstOrDefault(x => x.Name == "LastTradeRealtimeWithTime");

                        if (element != null && !string.IsNullOrEmpty(element.Value))
                        {
                            lastTradePriceOnly = ValueUtils.GetValidDecimal(element);

                        }
                        else
                        {
                            lastTradePriceOnly = ValueUtils.GetValidDecimal(elements.FirstOrDefault(x => x.Name == "LastTradePriceOnly"));
                        }

                        var daysHigh = ValueUtils.GetValidDecimal(elements.FirstOrDefault(x => x.Name == "DaysHigh"));
                        var daysLow = ValueUtils.GetValidDecimal(elements.FirstOrDefault(x => x.Name == "DaysLow"));
                        var volume = ValueUtils.GetValidInteger(elements.FirstOrDefault(x => x.Name == "Volume"));
                        var open = ValueUtils.GetValidDecimal(elements.FirstOrDefault(x => x.Name == "Open"));
                        var previousClose = ValueUtils.GetValidDecimal(elements.FirstOrDefault(x => x.Name == "PreviousClose"));

                        var dateStamp = DateTime.Now.Date;

                        // In case this was left running
                        if(dateStamp.DayOfWeek == DayOfWeek.Saturday)
                        {
                            dateStamp = dateStamp.AddDays(-1);
                        }
                        else if (dateStamp.DayOfWeek == DayOfWeek.Sunday)
                        {
                            dateStamp = dateStamp.AddDays(-2);
                        }

                        db.Histories.AddOrUpdate(h => new { h.Symbol, h.Date }, new StockBuddy.Core.Domain.History { AdustedClosePrice = lastTradePriceOnly, Date = dateStamp, ClosePrice = lastTradePriceOnly, HighPrice = daysHigh, LowPrice = daysLow, OpenPrice = open, PreviousClosePrice = previousClose, Symbol = symbol, Volume = volume });
                    }

                    db.SaveChanges();
                }
            }
            catch
            { }

            finally
            {
                HttpUtils.CloseConnections(xr, true);
            }
        }

        private static List<Historic> GetHistory(string symbol, DateTime startDate, DateTime endDate)
        {
            XmlReader xr = _yahooDataProvider.GetHistoryReader(symbol, GetValidDate(startDate), GetValidDate(endDate));

            List<Historic> history = new List<Historic>();

            try
            {
                xr.ReadToFollowing("quote");

                while (xr.Name != "results" && xr.NodeType != XmlNodeType.EndElement)
                {
                    try
                    {
                        //fill business object
                        Historic historic = FillHistoricInfo(xr, false);

                        historic.Symbol = symbol;

                        //add to collection
                        history.Add(historic);
                    }
                    catch(Exception ex)
                    {
                        System.Console.WriteLine("No data loaded for {0}. FillHistoricInfo --> {1}", symbol, ex.Message);
                        return null;
                    }
                }

                // Set Previous Closes
                for (int i = 0; i < history.Count - 1; i++)
                {
                    history[i].PreviousClose = history[i + 1].Close;
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("GetHistory --> {0}", ex.Message);
            }
            finally
            {
                //close datareader
                HttpUtils.CloseConnections(xr, true);
            }

            return history.Take(250).ToList();
        }

        private static Historic FillHistoricInfo(XmlReader xr, bool closeXmlReader)
        {
            Historic historic = null;
            try
            {
                //read datareader
                bool bContinue = true;
                if (closeXmlReader)
                {
                    bContinue = false;
                    if (!xr.EOF)
                    {
                        bContinue = true;
                    }
                }
                if (bContinue)
                {
                    historic = new Historic();
                    xr.ReadToDescendant("Date");
                    historic.Date = xr.ReadElementContentAsDateTime();
                    historic.Open = xr.ReadElementContentAsDouble();
                    historic.High = xr.ReadElementContentAsDouble();
                    historic.Low = xr.ReadElementContentAsDouble();
                    historic.Close = xr.ReadElementContentAsDouble();
                    historic.Volume = xr.ReadElementContentAsInt();
                    historic.AdjustedClose = xr.ReadElementContentAsDouble();
                    xr.ReadEndElement();
                }
            }
            catch
            {
                throw;
            }

            return historic;
        }

        private static string GetValidDate(DateTime start)
        {
            return start.ToString("yyyy-MM-dd");
        }

        private static List<string> GetSymbols()
        {
            var symbols = new List<string>();

            try
            {
                WebClient client = new WebClient();
                Stream stream = client.OpenRead("ftp://ftp.nasdaqtrader.com/SymbolDirectory/otherlisted.txt");
                StreamReader reader = new StreamReader(stream);
                string otherListed = reader.ReadToEnd();
                reader.Close();
                otherListed = otherListed.Replace("ACT Symbol|Security Name|Exchange|CQS Symbol|ETF|Round Lot Size|Test Issue|NASDAQ Symbol\r\n", "");

                stream = client.OpenRead("ftp://ftp.nasdaqtrader.com/SymbolDirectory/nasdaqlisted.txt");
                reader = new StreamReader(stream);
                string nasdaqListed = reader.ReadToEnd();
                reader.Close();
                nasdaqListed = nasdaqListed.Replace("Symbol|Security Name|Market Category|Test Issue|Financial Status|Round Lot Size\r\n", "");

                var stocksStr = (nasdaqListed + otherListed);

                var stocks = stocksStr.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var stock in stocks)
                {
                    symbols.Add(stock.Split(new char[] { '|' })[0]);
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("GetSymbols --> {0}", ex.Message);
            }

            return symbols;
        }

        private static int DisplayMenu()
        {
            System.Console.WriteLine(" ------------------------------------------");
            System.Console.WriteLine("|               Stock Buddy                |");
            System.Console.WriteLine(" ------------------------------------------");
            System.Console.WriteLine();
            System.Console.WriteLine("1. Sync History");
            System.Console.WriteLine("2. Run Real-Time Updater");
            System.Console.WriteLine("3. Exit");
            System.Console.WriteLine("");
            System.Console.Write("Choice: ");
            var result = System.Console.ReadLine();
            return Convert.ToInt32(result);
        }

        //public static void GetLastTradeRealtimeWithTime(IEnumerable<string> symbols)
        //{
        //    //int count = 0;
        //    //var stockList = new List<Stock>();

        //    //foreach (var symbol in symbols)
        //    //{
        //    //    stockList.Add(stock);
        //    //    count++;

        //    //    if (count % 500 == 0 || count == stocks.Count)
        //    //    {
        //    //        XmlReader xr = _yahooDataProvider.GetLastTradeRealtimeWithTime(ref stockList);
        //    //        FillStockInfoRealTime(xr, true, ref stockList);

        //    //        stockList.Clear();
        //    //    }
        //    //}

        //    while(symbols != null)
        //    {
        //        XmlReader xr = GetLastTradeRealtimeWithTime(symbols.Take(500));
        //        FillStockInfoRealTime(xr, true, ref stockList);
        //        symbols = symbols.Skip(500);
        //    }
        //}
    }
}


text:
local tuple = require "tuple"
tuple.utest()
local t = tuple(1,4,2)
-- check unpack is working out of tuple module
local a,b,c = table.unpack(t)
assert(a == 1 and b == 4 and c == 2)


text:
/* This file contains "borrowed" copy of standard styles. To simplify merging,
 * when altering, please preserve original property value by adding comments. */
input.common[type='checkbox'],
input.common[type='radio'] {
  -webkit-appearance: none;
  border: 1px solid #555;
  border-radius: 1px;
  box-sizing: border-box;
  cursor: default;
  height: 13px;
  margin: 0;
  opacity: 0.4;
  width: 13px;
}

input.common[type='checkbox']:hover,
input.common[type='checkbox']:checked,
input.common[type='radio']:hover,
input.common[type='radio']:checked {
  opacity: 1;
}

input.common[type='checkbox'] {
  position: relative;
}

input.common[type='checkbox']:checked::after {
  background-image: -webkit-image-set(
    url('../images/common/check_no_box.png') 1x,
    url('../images/common/2x/check_no_box.png') 2x);
  background-position: -3px -4px;
  background-repeat: no-repeat;
}

input.common[type='checkbox'].white {
  border: none;
}

input.common[type='checkbox'].white:not(:checked)::after {
  background-image: -webkit-image-set(
    url('../images/common/checkbox_white_unchecked.png') 1x,
    url('../images/common/2x/checkbox_white_unchecked.png') 2x);
  background-position: -1px 0;
}

input.common[type='checkbox'].white:checked::after {
  background-image: -webkit-image-set(
    url('../images/common/checkbox_white_checked.png') 1x,
    url('../images/common/2x/checkbox_white_checked.png') 2x);
  background-position: -1px 0;
}

input.common[type='checkbox']::after {
  content: '';
  display: -webkit-box;
  height: 15px;
  left: -2px;
  position: absolute;
  top: -2px;
  width: 17px;
}

.bubble {
  background: #FFF;
  border-radius: 2px;
  cursor: default;
  outline: 1px solid rgba(0, 0, 0, 0.2);
  padding: 16px;
}

.bubble .pointer {
  background: -webkit-image-set(
    url('../images/common/bubble_point_white.png') 1x,
    url('../images/common/2x/bubble_point_white.png') 2x);
  display: block;
  height: 11px;
  left: 24px;
  margin: 0 0 0 -5px;
  outline: none;
  position: absolute;
  width: 17px;
}

.bubble .pointer:not(.bottom) {
  top: -11px;
}

.bubble .pointer.bottom {
  -webkit-transform: rotate(180deg);
  bottom: -11px;
}

.bubble .close-x {
  background: -webkit-image-set(
    url('../images/common/close_x_gray.png') 1x,
    url('../images/common/2x/close_x_gray.png') 2x);
  height: 21px;
  opacity: 0.3;
  position: absolute;
  right: 3px;
  top: 3px;
  width: 21px;
}

.bubble .close-x:hover {
  opacity: 0.7;
}

.buttonbar {
  display: -webkit-box;
  height: 31px;
}

.buttonbar.right {
  -webkit-box-flex: 1.0;
  -webkit-box-pack: end;
}

.buttonbar button:active img {
  opacity: 1.0;
}

.buttonbar button:hover img {
  opacity: 0.72;
}

.buttonbar button[disabled] img {
  opacity: 0.9;
}

.buttonbar button img {
  display: inline-block;
  margin: -3px 0 0;
  opacity: 0.55;
  vertical-align: middle;
}

.buttonbar button.menubutton span.disclosureindicator {
  -webkit-transform: rotate(90deg);
  float: right;
  margin-left: 7px;
  margin-top: 10px;
  opacity: .8;
  transition: none;
}

span.disclosureindicator {
  background-image: -webkit-image-set(
    url('../images/common/disclosure_arrow_dk_grey.png') 1x,
    url('../images/common/2x/disclosure_arrow_dk_grey.png') 2x);
  background-position: center;
  background-repeat: no-repeat;
  display: inline-block;
  height: 7px;
  width: 5px;
}

/* "chrome-menu" class overrides some standard menu.css styles, to make custom
   menus in FileBrowser look like native ChromeOS menus. */

menu.chrome-menu {
  background-color: rgb(250, 250, 250);
  border: 1px solid rgb(255, 255, 255);
  border-radius: 3px;
  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .5);
  color: rgb(34, 34, 34);
  outline: none;
  overflow: hidden;
  padding: 5px 0;
  transition: opacity 200ms ease-in;
  z-index: 15;
}

menu.chrome-menu[hidden] {
  display: block;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

menu.chrome-menu.hide-delayed[hidden] {
  transition-delay: 120ms;
  transition-property: opacity, visibility;
}

menu.chrome-menu > :not(hr) {
  background-position: right 10px center;
  background-repeat: no-repeat;
  line-height: 30px;
  padding-left: 20px;
  padding-right: 20px;
}

menu.chrome-menu > .menuitem-button {
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgb(235, 235, 235);
  height: 42px;
  margin: -36px -1px -1px 0;
  min-width: 60px;
  padding: 0;
  position: absolute;
  width: 60px;
}

menu.chrome-menu > .menuitem-button[checked] {
  background-color: rgb(235, 235, 235);
}

menu.chrome-menu > .menuitem-button.left {
  right: 59px;
}

menu.chrome-menu > .menuitem-button.right {
  right: 0;
}

menu.chrome-menu > menuitem[disabled] {
  background-color: rgb(252, 252, 252);
  color: rgb(153, 153, 153);
}

menu.chrome-menu > menuitem:not([disabled])[selected],
menu.chrome-menu > menuitem:not([disabled])[selected]:active {
  background-color: rgb(66, 129, 244);
  color: white;
}

menu.chrome-menu > hr {
  background: rgb(235, 235, 235);
  height: 1px;
  margin: 5px 0;
}

menu.chrome-menu > menuitem[checked] {
  background-image: -webkit-image-set(
    url('../images/common/check_no_box.png') 1x,
    url('../images/common/2x/check_no_box.png') 2x);
}

menu.chrome-menu > [checked]::before {
  display: none;
}

/**
 * Ok/Cancel style buttons
 * Height: 31px (content:21px + border:5px * 2)
 **/
button,
input[type='button'],
input[type='submit'],
select {
  background-color: rgb(250, 250, 250);
  background-image: none;
  background-position: center;
  background-repeat: no-repeat;
  border: 5px solid transparent;
  border-image: -webkit-image-set(
    url('../images/common/button.png') 1x,
    url('../images/common/2x/button.png') 2x) 5 / 5px / 2px repeat;
  box-sizing: content-box;
  color: rgb(34, 34, 34);
  cursor: default;
  height: 21px;
  line-height: 21px;
  margin: 0;
  min-height: 21px;
  min-width: 55px;
  padding: 0 10px;
  position: relative;
  text-align: center;
  z-index: 1;
}

.buttonbar button {
  -webkit-margin-start: 10px;
}

button:hover,
input[type='button']:hover,
input[type='submit']:hover,
select:hover {
  border-image: -webkit-image-set(
    url('../images/common/button_hover.png') 1x,
    url('../images/common/2x/button_hover.png') 2x) 5 / 5px / 2px repeat;
  color: #222;
}

button:active,
input[type='button']:active,
input[type='submit']:active {
  border-image: -webkit-image-set(
    url('../images/common/button_pressed.png') 1x,
    url('../images/common/2x/button_pressed.png') 2x) 5 / 5px / 2px repeat;
  color: #333;
}

button[disabled],
input[type='button'][disabled],
input[type='submit'][disabled],
button[disabled]:hover,
input[type='button'][disabled]:hover,
input[type='submit'][disabled]:hover {
  background-color: rgb(250, 250, 250);
  background-image: none;
  border-image: -webkit-image-set(
    url('../images/common/button.png') 1x,
    url('../images/common/2x/button.png') 2x) 5 / 5px / 2px repeat;
  color: rgb(150, 150, 150);
}

/* Gray progress bar. */
.progress-bar {
  background-color: #e6e6e6;
  border-radius: 3px;
  height: 6px;
}

.progress-track {
  background-color: #888;
  border-radius: 3px;
  height: 6px;
  min-width: 6px;
}

.progress-track.smoothed {
  transition: width 1s linear;
}

/* Icons for the action choice dialog and choosing the default app. */
div.import-photos-to-drive-icon {
  background-image: -webkit-image-set(
    url('../images/media/drive.png') 1x,
    url('../images/media/2x/drive.png') 2x);
}

div.view-files-icon {
  background-image: -webkit-image-set(
    url('../images/icon32.png') 1x,
    url('../images/icon64.png') 2x);
}

div.watch-single-video-icon {
  background-image: -webkit-image-set(
    url('../images/media/watch.png') 1x,
    url('../images/media/2x/watch.png') 2x);
}

/* Pop-up dialogs. */

.cr-dialog-container {
  -webkit-box-align: center;
  -webkit-box-pack: center;
  -webkit-user-select: none;
  display: -webkit-box;
  height: 100%;
  left: 0;
  overflow: hidden;
  position: absolute;
  top: 0;
  transition: opacity 250ms linear;
  width: 100%;
  z-index: 9999;
}

.cr-dialog-frame {
  -webkit-box-orient: vertical;
  background-color: rgb(250, 250, 250);
  border: 1px solid rgb(255, 255, 255);
  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, .5);
  color: rgb(34, 34, 34);
  cursor: default;
  display: -webkit-box;
  padding: 20px;
  position: relative;
  width: 460px;
}

.cr-dialog-frame:focus {
  outline: none;
}

@-webkit-keyframes pulse {
 0% {
   -webkit-transform: scale(1);
 }
 40% {
   -webkit-transform: scale(1.02);
  }
 60% {
   -webkit-transform: scale(1.02);
  }
 100% {
   -webkit-transform: scale(1);
 }
}

.cr-dialog-frame.pulse {
  -webkit-animation-duration: 180ms;
  -webkit-animation-iteration-count: 1;
  -webkit-animation-name: pulse;
  -webkit-animation-timing-function: ease-in-out;
}

.shown > .cr-dialog-frame {
  -webkit-transform: perspective(500px) scale(1)
                     translateY(0) rotateX(0);
  opacity: 1;
}

.cr-dialog-frame {
  -webkit-transform: perspective(500px) scale(0.99)
                     translateY(-20px) rotateX(5deg);
  opacity: 0;
  transition: all 180ms;
  transition-duration: 250ms;
}

.cr-dialog-shield {
  background-color: white;
  bottom: 0;
  display: block;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  transition: opacity 500ms;
}

.shown > .cr-dialog-shield {
  opacity: 0.5;
  transition: opacity 500ms;
}

[hidden] {
  display: none;
}

.cr-dialog-title {
  -webkit-margin-after: 10px;
  -webkit-margin-end: 20px;
  display: block;
  font-size: 125%;
  white-space: nowrap;
  word-wrap: normal;
}

.cr-dialog-text {
  margin: 13px 0;
}

.cr-dialog-text,
.cr-dialog-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr-dialog-frame input {
  box-sizing: border-box;
  width: 100%;
}

.cr-dialog-buttons {
  -webkit-box-orient: horizontal;
  -webkit-box-pack: end;
  display: -webkit-box;
  padding-top: 10px;
}

.cr-dialog-buttons button {
  -webkit-margin-start: 8px;
  line-height: 1.8;
}

.cr-dialog-close {
  background: url('chrome://theme/IDR_CLOSE_DIALOG') center no-repeat;
  display: inline-block;
  height: 44px;
  opacity: 0.7;
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
}

.cr-dialog-close:hover {
  background-image: url('chrome://theme/IDR_CLOSE_DIALOG_H');
}

.cr-dialog-close:active {
  background-image: url('chrome://theme/IDR_CLOSE_DIALOG_P');
}


text:
/**
 * @file   Stream.hpp
 * @brief  Stream class prototype.
 * @author zer0
 * @date   2016-12-27
 * @date   2017-02-01 (Move package: libtbag/uv -> libtbag/uvpp)
 */

#ifndef __INCLUDE_LIBTBAG__LIBTBAG_UVPP_STREAM_HPP__
#define __INCLUDE_LIBTBAG__LIBTBAG_UVPP_STREAM_HPP__

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <libtbag/config.h>
#include <libtbag/predef.hpp>
#include <libtbag/Err.hpp>
#include <libtbag/uvpp/Handle.hpp>

// -------------------
NAMESPACE_LIBTBAG_OPEN
// -------------------

namespace uvpp {

// Forward declaration.
struct ShutdownRequest;
struct WriteRequest;

/**
 * @var BACKLOG_LIMIT
 *
 * backlog indicates the number of connections the kernel might queue.
 */
#if defined(SOMAXCONN)
TBAG_CONSTEXPR int const BACKLOG_LIMIT = SOMAXCONN;
#else
TBAG_CONSTEXPR int const BACKLOG_LIMIT = 128;
#endif

/**
 * Stream class prototype.
 *
 * @author zer0
 * @date   2016-12-27
 */
class TBAG_API Stream : public Handle
{
public:
    using Parent = Handle;

public:
    Stream(uhandle type);
    virtual ~Stream();

public:
    /** Contains the amount of queued bytes waiting to be sent. */
    std::size_t getWriteQueueSize() const TBAG_NOEXCEPT;

public:
    /** Returns true if the stream is readable, false otherwise. */
    bool isReadable() const TBAG_NOEXCEPT;

    /** Returns true if the stream is writable, false otherwise. */
    bool isWritable() const TBAG_NOEXCEPT;

public:
    /** Enable or disable blocking mode for a stream. */
    Err setBlocking(bool enable = true);

public:
    /** Shutdown the outgoing (write) side of a duplex stream. */
    Err shutdown(ShutdownRequest & request);

    /** Start listening for incoming connections. */
    Err listen(int backlog = BACKLOG_LIMIT);

    /** This call is used in conjunction with uv_listen() to accept incoming connections. */
    Err accept(Stream & client);

    /** Read data from an incoming stream. */
    Err startRead();

    /** Stop reading data from the stream. */
    Err stopRead();

    /** Write data to stream. Buffers are written in order. */
    Err write(WriteRequest & request, binf const * infos, std::size_t infos_size);
    Err write(WriteRequest & request, char const * buffer, std::size_t size);

    /**
     * Same as uv_write(), but won't queue a write request if it can't be completed immediately.
     *
     * @return
     *  Number of bytes written.
     */
    std::size_t tryWrite(binf * infos, std::size_t infos_size, Err * result = nullptr);
    std::size_t tryWrite(char const * buffer, std::size_t size, Err * result = nullptr);

public:
    virtual void onShutdown(ShutdownRequest & request, Err code);
    virtual void onConnection(Err code);
    virtual binf onAlloc(std::size_t suggested_size);
    virtual void onRead(Err code, char const * buffer, std::size_t size);
    virtual void onWrite(WriteRequest & request, Err code);
};

} // namespace uvpp

// --------------------
NAMESPACE_LIBTBAG_CLOSE
// --------------------

#endif // __INCLUDE_LIBTBAG__LIBTBAG_UVPP_STREAM_HPP__


text:
define(['exports', './_tslib', 'aurelia-framework', 'aurelia-event-aggregator', './ui-internal', 'resize-observer-polyfill'], function (exports, _tslib, aureliaFramework, aureliaEventAggregator, uiInternal, ResizeObserver) { 'use strict';

  ResizeObserver = ResizeObserver && ResizeObserver.hasOwnProperty('default') ? ResizeObserver['default'] : ResizeObserver;

  var UIContent = (function () {
      function UIContent(element) {
          this.element = element;
      }
      UIContent.prototype.attached = function () {
          var _this = this;
          this.obResize = new ResizeObserver(function () {
              return _this.element.dispatchEvent(uiInternal.UIInternal.createEvent("resize", _this.element.getBoundingClientRect()));
          });
          this.obResize.observe(this.element);
      };
      UIContent.prototype.detached = function () {
          this.obResize.disconnect();
      };
      UIContent = _tslib.__decorate([
          aureliaFramework.customElement("ui-content"),
          aureliaFramework.inlineView("<template class=\"ui-section__content\" ref=\"vmElement\"><slot></slot></template>"),
          _tslib.__metadata("design:paramtypes", [Element])
      ], UIContent);
      return UIContent;
  }());

  var UISection = (function () {
      function UISection(element) {
          if (element.hasAttribute("centered")) {
              element.classList.add("ui-section--centered");
          }
      }
      UISection = _tslib.__decorate([
          aureliaFramework.customElement("ui-section"),
          aureliaFramework.inlineView("<template class=\"ui-section au-animate animate-slide-in-right animate-slide-out-left\" role=\"main\"><slot></slot></template>"),
          _tslib.__metadata("design:paramtypes", [Element])
      ], UISection);
      return UISection;
  }());

  var UISectionFoot = (function () {
      function UISectionFoot() {
      }
      UISectionFoot = _tslib.__decorate([
          aureliaFramework.customElement("ui-section-foot"),
          aureliaFramework.inlineView("<template class=\"ui-section__foot\"><slot></slot></template>")
      ], UISectionFoot);
      return UISectionFoot;
  }());

  var UISectionHead = (function () {
      function UISectionHead() {
      }
      UISectionHead = _tslib.__decorate([
          aureliaFramework.customElement("ui-section-head"),
          aureliaFramework.inlineView("<template class=\"ui-section__head\"><slot></slot></template>")
      ], UISectionHead);
      return UISectionHead;
  }());

  var UIPage = (function () {
      function UIPage() {
          this.pageTitle = "";
      }
      _tslib.__decorate([
          aureliaFramework.bindable(),
          _tslib.__metadata("design:type", String)
      ], UIPage.prototype, "pageTitle", void 0);
      UIPage = _tslib.__decorate([
          aureliaFramework.customElement("ui-page"),
          aureliaFramework.inlineView("<template class=\"ui-page au-animate animate-slide-in-right animate-slide-out-left\" role=\"main\">\n
${pageTitle}
\n  <slot name=\"page-alert\"></slot>\n
<slot></slot>
\n</template>")
      ], UIPage);
      return UIPage;
  }());
  var Page = [UIPage, UISection, UISectionHead, UISectionFoot, UIContent];

  exports.Page = Page;

});
//# sourceMappingURL=ui-page.js.map


text: package com.example.idea.plugin.skeleton;


text:
class Levels : public Effect{
  public:
    Levels();
    void run(Adafruit_NeoPixel *strip, EffectData data);
};
#endif


text:
#ifndef MDAMINTERVALITERATOR_H
#define MDAMINTERVALITERATOR_H
/* -*-C++-*-
********************************************************************************
*
* File:         MdamIntervalIterator.h
* Description:  MDAM Interval Iterator
*
*
* Created:      9/11/96
* Language:     C++
*
*
*
*
********************************************************************************
*/

// -----------------------------------------------------------------------------

#include "MdamEnums.h"
#include "MdamIntervalList.h"
#include "MdamEndPoint.h"
#include "MdamIntervalListIterator.h"

// *****************************************************************************
// MdamIntervalIterator : MDAM Interval Iterator
//
// This iterator returns the next endpoint on each call.  Within an interval
// it returns the begin endpoint followed by the end endpoint. Then it
// continues with the next interval in an interval list until the interval
// list is exhausted.
// So, this iterator makes an interval list appear to be an ordered set of
// endpoints and presents the endpoints one at a time.
// *****************************************************************************

class MdamIntervalIterator
{

public:

  // Constructor.
  NA_EIDPROC MdamIntervalIterator(const MdamIntervalList * intervalListPtr,
					 const Int32 logicalIntervalListNumber);

  // Destructor.
  NA_EIDPROC ~MdamIntervalIterator();

  // Iteration operator returns the next endpoint on each call.
  NA_EIDPROC NABoolean operator()(MdamEndPoint & mdamEndPoint);

private:

  // Logical interval list number.
  const Int32 logicalIntervalListNumber_;

  // Pointer to the current interval.
  MdamInterval * intervalPtr_;

  // endPointType_ is used to keep track of which of the two endpoints
  // is the current one for iteration purposes.
  MdamEnums::MdamEndPointType endPointType_;

  // Iterator to return intervals from the interval list.
  MdamIntervalListIterator intervalListIterator_;

}; // class MdamIntervalIterator

#endif /* MDAMINTERVALITERATOR_H */


text:
#if !defined(_MSC_VER) || _MSC_VER >= 1000
#error "Use this header only with Microsoft Visual C++ 16-bits compilers!"
#endif /* _MSC_VER */

#ifndef _STDINT_H_
#define _STDINT_H_

#include <limits.h>

#if defined(__cplusplus) && !defined(NO_QWORD)
#define NO_OPRINTF
#include "qword.h"
#define LLONG_MIN (_QWORD(0x00000001, 0x80000000))
#define LLONG_MAX (_QWORD(0xFFFFFFFF, 0x7FFFFFFF))
#define ULLONG_MAX (_QWORD(0xFFFFFFFF, 0xFFFFFFFF))
#endif

/* 7.18.1 Integer types */

/* 7.18.1.1 Exact-width integer types */
typedef signed char       int8_t;
typedef signed short      int16_t;
typedef signed long       int32_t;
/* typedef signed long long  int64_t; */
typedef unsigned char     uint8_t;
typedef unsigned short    uint16_t;
typedef unsigned long     uint32_t;
/* typedef unsigned long long uint64_t; */
#ifdef _QWORD_H_
typedef QWORD uint64_t;
#define _UINT64_T_DEFINED
#endif

/* 7.18.1.2 Minimum-width integer types */
typedef int8_t    int_least8_t;
typedef int16_t   int_least16_t;
typedef int32_t   int_least32_t;
/* typedef int64_t   int_least64_t; */
typedef uint8_t   uint_least8_t;
typedef uint16_t  uint_least16_t;
typedef uint32_t  uint_least32_t;
/* typedef uint64_t  uint_least64_t; */
#ifdef _UINT64_T_DEFINED
typedef uint64_t  uint_least64_t;
#endif

/* 7.18.1.3 Fastest minimum-width integer types */
typedef int8_t    int_fast8_t;
typedef int16_t   int_fast16_t;
typedef int32_t   int_fast32_t;
/* typedef int64_t   int_fast64_t; */
typedef uint8_t   uint_fast8_t;
typedef uint16_t  uint_fast16_t;
typedef uint32_t  uint_fast32_t;
/* typedef uint64_t  uint_fast64_t; */
#ifdef _UINT64_T_DEFINED
typedef uint64_t  uint_fast64_t;
#endif

/* 7.18.1.4 Integer types capable of holding object pointers */
#if defined(_M_I86TM) || defined(_M_I86SM) || defined(_M_I86MM)
/* Tiny, small and medium memory models have 16-bits data pointers */
#define INTPRTR_BIT 16
   typedef int16_t  intptr_t;
   typedef uint16_t uintptr_t;
#else
/* Compact, large and huge memory models have 32-bits data pointers */
#define INTPRTR_BIT 32
   typedef int32_t  intptr_t;
   typedef uint32_t uintptr_t;
#endif

/* 7.18.1.5 Greatest-width integer types */
typedef int32_t   intmax_t;
#ifdef _UINT64_T_DEFINED
typedef uint64_t  uintmax_t;
#else
typedef uint32_t  uintmax_t;
#endif

/* 7.18.2 Limits of specified-width integer types */

#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)

/* 7.18.2.1 Limits of exact-width integer types */
#define INT8_MIN     ((int8_t)SCHAR_MIN)
#define INT8_MAX     SCHAR_MAX
#define INT16_MIN    ((int16_t)SHRT_MIN)
#define INT16_MAX    SHRT_MAX
#define INT32_MIN    ((int32_t)LONG_MIN)
#define INT32_MAX    LONG_MAX
/* #define INT64_MIN    ((int64_t)LLONG_MIN) */
/* #define INT64_MAX    LLONG_MAX */
#define UINT8_MAX    UCHAR_MAX
#define UINT16_MAX   USHRT_MAX
#define UINT32_MAX   ULONG_MAX
/* #define UINT64_MAX   ULLONG_MAX */
#ifdef _UINT64_T_DEFINED
#define UINT64_MAX   ULLONG_MAX
#endif

/* 7.18.2.2 Limits of minimum-width integer types */
#define INT_LEAST8_MIN    INT8_MIN
#define INT_LEAST8_MAX    INT8_MAX
#define INT_LEAST16_MIN   INT16_MIN
#define INT_LEAST16_MAX   INT16_MAX
#define INT_LEAST32_MIN   INT32_MIN
#define INT_LEAST32_MAX   INT32_MAX
/* #define INT_LEAST64_MIN   INT64_MIN */
/* #define INT_LEAST64_MAX   INT64_MAX */
#define UINT_LEAST8_MAX   UINT8_MAX
#define UINT_LEAST16_MAX  UINT16_MAX
#define UINT_LEAST32_MAX  UINT32_MAX
/* #define UINT_LEAST64_MAX  UINT64_MAX */
#ifdef _UINT64_T_DEFINED
#define UINT_LEAST64_MAX  UINT64_MAX
#endif

/* 7.18.2.3 Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN    INT8_MIN
#define INT_FAST8_MAX    INT8_MAX
#define INT_FAST16_MIN   INT16_MIN
#define INT_FAST16_MAX   INT16_MAX
#define INT_FAST32_MIN   INT32_MIN
#define INT_FAST32_MAX   INT32_MAX
/* #define INT_FAST64_MIN   INT64_MIN */
/* #define INT_FAST64_MAX   INT64_MAX */
#define UINT_FAST8_MAX   UINT8_MAX
#define UINT_FAST16_MAX  UINT16_MAX
#define UINT_FAST32_MAX  UINT32_MAX
/* #define UINT_FAST64_MAX  UINT64_MAX */
#ifdef _UINT64_T_DEFINED
#define UINT_FAST64_MAX  UINT64_MAX
#endif

/* 7.18.2.4 Limits of integer types capable of holding object pointers */
#if INTPRTR_BIT == 16
#define INTPTR_MIN   INT16_MIN
#define INTPTR_MAX   INT16_MAX
#define UINTPTR_MAX  UINT16_MAX
#else
#define INTPTR_MIN   INT32_MIN
#define INTPTR_MAX   INT32_MAX
#define UINTPTR_MAX  UINT32_MAX
#endif

/* 7.18.2.5 Limits of greatest-width integer types */
#define INTMAX_MIN   INT32_MIN
#define INTMAX_MAX   INT32_MAX
#ifdef _UINT64_T_DEFINED
#define UINTMAX_MAX  UINT64_MAX
#else
#define UINTMAX_MAX  UINT32_MAX
#endif

/* 7.18.3 Limits of other integer types */

#if INTPRTR_BIT == 16
#define PTRDIFF_MIN  INT16_MIN
#define PTRDIFF_MAX  INT16_MAX
#else
#define PTRDIFF_MIN  INT32_MIN
#define PTRDIFF_MAX  INT32_MAX
#endif

#define SIG_ATOMIC_MIN  INT_MIN
#define SIG_ATOMIC_MAX  INT_MAX

#ifndef SIZE_MAX
#if INTPRTR_BIT == 16
#define SIZE_MAX  UINT16_MAX
#else
#define SIZE_MAX  UINT32_MAX
#endif
#endif

#ifndef WCHAR_MIN
#define WCHAR_MIN  0
#endif
#ifndef WCHAR_MAX
#define WCHAR_MAX  UINT16_MAX
#endif

#define WINT_MIN  0
#define WINT_MAX  UINT16_MAX

#endif /* __STDC_LIMIT_MACROS */

/* 7.18.4 Limits of other integer types */

#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)

/* 7.18.4.1 Macros for minimum-width integer constants */

#define INT8_C(val)  val
#define INT16_C(val) val
#define INT32_C(val) val##L
/* #define INT64_C(val) val##LL */

#define UINT8_C(val)  val
#define UINT16_C(val) val
#define UINT32_C(val) val##UL
/* #define UINT64_C(val) val##ULL */
#ifdef _UINT64_T_DEFINED
#ifdef _QWORD_H_
#define UINT64_C(val) _QWORD(val)
#else
#define UINT64_C(val) val##ULL
#endif
#endif

/* 7.18.4.2 Macros for greatest-width integer constants */
#define INTMAX_C   INT32_C
#ifdef _UINT64_T_DEFINED
#define UINTMAX_C  UINT64_C
#else
#define UINTMAX_C  UINT32_C
#endif

#endif /* __STDC_CONSTANT_MACROS */

#endif /* _STDINT_H_ */


text:
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {

// RandenPoolSeedSeq is a custom seed sequence type where generate() fills the
// provided buffer via the RandenPool entropy source.
class RandenPoolSeedSeq {
 private:
  struct ContiguousTag {};
  struct BufferTag {};

  // Generate random unsigned values directly into the buffer.
  template <typename Contiguous>
  void generate_impl(ContiguousTag, Contiguous begin, Contiguous end) {
    const size_t n = static_cast<size_t>(std::distance(begin, end));
    auto* a = &(*begin);
    RandenPool<uint8_t>::Fill(
        absl::MakeSpan(reinterpret_cast<uint8_t*>(a), sizeof(*a) * n));
  }

  // Construct a buffer of size n and fill it with values, then copy
  // those values into the seed iterators.
  template <typename RandomAccessIterator>
  void generate_impl(BufferTag, RandomAccessIterator begin,
                     RandomAccessIterator end) {
    const size_t n = std::distance(begin, end);
    absl::InlinedVector<uint32_t, 8> data(n, 0);
    RandenPool<uint32_t>::Fill(absl::MakeSpan(data.begin(), data.end()));
    std::copy(std::begin(data), std::end(data), begin);
  }

 public:
  using result_type = uint32_t;

  size_t size() { return 0; }

  template <typename OutIterator>
  void param(OutIterator) const {}

  template <typename RandomAccessIterator>
  void generate(RandomAccessIterator begin, RandomAccessIterator end) {
    // RandomAccessIterator must be assignable from uint32_t
    if (begin != end) {
      using U = typename std::iterator_traits<RandomAccessIterator>::value_type;
      // ContiguousTag indicates the common case of a known contiguous buffer,
      // which allows directly filling the buffer. In C++20,
      // std::contiguous_iterator_tag provides a mechanism for testing this
      // capability, however until Abseil's support requirements allow us to
      // assume C++20, limit checks to a few common cases.
      using TagType = absl::conditional_t<
          (std::is_pointer<RandomAccessIterator>::value ||
           std::is_same<RandomAccessIterator,
                        typename std::vector<U>::iterator>::value),
          ContiguousTag, BufferTag>;

      generate_impl(TagType{}, begin, end);
    }
  }
};

// Each instance of NonsecureURBGBase<URBG> will be seeded by variates produced
// by a thread-unique URBG-instance.
template <typename URBG, typename Seeder = RandenPoolSeedSeq>
class NonsecureURBGBase {
 public:
  using result_type = typename URBG::result_type;

  // Default constructor
  NonsecureURBGBase() : urbg_(ConstructURBG()) {}

  // Copy disallowed, move allowed.
  NonsecureURBGBase(const NonsecureURBGBase&) = delete;
  NonsecureURBGBase& operator=(const NonsecureURBGBase&) = delete;
  NonsecureURBGBase(NonsecureURBGBase&&) = default;
  NonsecureURBGBase& operator=(NonsecureURBGBase&&) = default;

  // Constructor using a seed
  template <class SSeq, typename = typename absl::enable_if_t<
                            !std::is_same<SSeq, NonsecureURBGBase>::value>>
  explicit NonsecureURBGBase(SSeq&& seq)
      : urbg_(ConstructURBG(std::forward<SSeq>(seq))) {}

  // Note: on MSVC, min() or max() can be interpreted as MIN() or MAX(), so we
  // enclose min() or max() in parens as (min)() and (max)().
  // Additionally, clang-format requires no space before this construction.

  // NonsecureURBGBase::min()
  static constexpr result_type(min)() { return (URBG::min)(); }

  // NonsecureURBGBase::max()
  static constexpr result_type(max)() { return (URBG::max)(); }

  // NonsecureURBGBase::operator()()
  result_type operator()() { return urbg_(); }

  // NonsecureURBGBase::discard()
  void discard(unsigned long long values) {  // NOLINT(runtime/int)
    urbg_.discard(values);
  }

  bool operator==(const NonsecureURBGBase& other) const {
    return urbg_ == other.urbg_;
  }

  bool operator!=(const NonsecureURBGBase& other) const {
    return !(urbg_ == other.urbg_);
  }

 private:
  static URBG ConstructURBG() {
    Seeder seeder;
    return URBG(seeder);
  }

  template <typename SSeq>
  static URBG ConstructURBG(SSeq&& seq) {  // NOLINT(runtime/references)
    auto salted_seq =
        random_internal::MakeSaltedSeedSeq(std::forward<SSeq>(seq));
    return URBG(salted_seq);
  }

  URBG urbg_;
};

}  // namespace random_internal
ABSL_NAMESPACE_END
}  // namespace absl

#endif  // ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_


text:
import { DestinyAccount } from 'app/accounts/destiny-account';
import ShowPageLoading from 'app/dim-ui/ShowPageLoading';
import { t } from 'app/i18next-t';
import { useLoadStores } from 'app/inventory/store/hooks';
import React from 'react';
import { useLocation, useParams } from 'react-router';
import Armory from './Armory';

export default function ArmoryPage({ account }: { account: DestinyAccount }) {
  const { itemHash: itemHashString } = useParams();
  const itemHash = parseInt(itemHashString ?? '', 10);
  const { search } = useLocation();
  const storesLoaded = useLoadStores(account);
  if (!storesLoaded) {
    return <ShowPageLoading message={t('Loading.Profile')} />;
  }

  const searchParams = new URLSearchParams(search);
  const perksString = searchParams.get('perks') ?? '';
  const sockets = perksString.split(',').reduce((memo, n, i) => {
    const perkHash = parseInt(n, 10);
    if (perkHash !== 0) {
      memo[i] = perkHash;
    }
    return memo;
  }, {});

  return (
    <div className="dim-page">
      <Armory key={itemHash} itemHash={itemHash} realItemSockets={sockets} />
    </div>
  );
}


text:
package log

import "github.com/containerd/containerd/log"

// Trace logs a message at level Trace on the standard logger.
func Trace(args ...interface{}) {
	log.Trace(log.L, args...)
}

// Tracef logs a message at level Trace on the standard logger.
func Tracef(format string, args ...interface{}) {
	log.Tracef(log.L, format, args...)
}


text:
<?php
class indexClassAction extends ActionNot{

	public function initAction()
	{
		$this->mweblogin(0, true);
	}

	public function defaultAction()
	{
		$this->title = getconfig('apptitle','信呼');
	}

	public function editpassAction()
	{

	}

	public function testAction()
	{

	}

	/**
	*	用户信息
	*/
	public function userinfoAction()
	{
		$uid = (int)$this->get('uid');
		$urs = m('admin')->getone($uid, '`id`,`name`,`deptallname`,`ranking`,`tel`,`email`,`mobile`,`sex`,`face`');
		if(!$urs)exit('not user');
		if(isempt($urs['face']))$urs['face']='images/noface.png';
		$this->assign('arr', $urs);
	}
}


text:
namespace whiskey {
PassResult VerificationScopeLocal::onRunPre(Node &node, MessageContext &msgs) {
	return PassResult::Good;
}

PassResult VerificationScopeLocal::onRunPost(Node &node, MessageContext &msgs) {
	return PassResult::Good;
}

VerificationScopeLocal::VerificationScopeLocal() : VerificationScope("VerificationScopeLocal", {"VerificationASTForm"}) {}
}


text:
/**
 * Created by jin on 8/16/17.
 */

import {Pipe, PipeTransform} from '@angular/core'

/*
 * 截取字符串长度
 * Takes an exponent argument that defaults to 1.
 * Usage:
 *   value | exponentialStrength:exponent
 * Example:
 *   {{ 2 | exponentialStrength:10 }}
 *   formats to: 1024
 */

@Pipe({name: 'max'})
export class MaxPipe implements PipeTransform {
    transform(value: string, ...args: any[]): any {
        if (!value) { return value }

        const allowed = args[0]
        const received = value.length

        if (received > allowed && allowed !== 0) {
            const toCut = allowed - received
            return value.slice(0, toCut)
        }

        return value
    }
}


text: include!(concat!(env!("OUT_DIR"), "/parser/grammar.rs"));