text:
#include "StorageInterface.h"
#include "debug.h"
#include <climits>

#define default_io_threads 2
#define default_low_watermark 20000
#define default_high_watermark 17000000
#define bytes_high_watermark 17000000 //>128elements^3D * 8B_Double

StorageInterface::StorageInterface(int nodePort, std::string contact_points) {
    CassFuture *connect_future = NULL;
    cluster = cass_cluster_new();
    session = cass_session_new();

    // add contact points
    if (contact_points.empty()) contact_points = "127.0.0.1";
    cass_cluster_set_contact_points(cluster, contact_points.c_str());
    cass_cluster_set_port(cluster, nodePort);
    cass_cluster_set_token_aware_routing(cluster, cass_true);

    char *env_path = std::getenv("WRITE_IO_THREADS");
    if (env_path != nullptr) cass_cluster_set_num_threads_io(cluster, (int32_t) std::atoi(env_path));
    else cass_cluster_set_num_threads_io(cluster, default_io_threads);

    env_path = std::getenv("WRITE_LOW_WATERMARK");
    if (env_path != nullptr) cass_cluster_set_pending_requests_low_water_mark(cluster, (int32_t) std::atoi(env_path));
    else cass_cluster_set_pending_requests_low_water_mark(cluster, (int32_t) default_low_watermark);

    env_path = std::getenv("WRITE_HIGH_WATERMARK");
    if (env_path != nullptr) cass_cluster_set_pending_requests_high_water_mark(cluster, (int32_t) std::atoi(env_path));
    else cass_cluster_set_pending_requests_high_water_mark(cluster, (int32_t) default_high_watermark);

    cass_cluster_set_write_bytes_high_water_mark(cluster, bytes_high_watermark); //>128elements^3D * 8B_Double

    //unsigned int uiRequestTimeoutInMS = 30000;
    //cass_cluster_set_core_connections_per_host (cluster, 4);
    //cass_cluster_set_request_timeout (cluster, uiRequestTimeoutInMS);

    // Provide the cluster object as configuration to connect the session
    connect_future = cass_session_connect(session, cluster);
    CassError rc = cass_future_error_code(connect_future);
    if (rc != CASS_OK) {
        std::string msg(cass_error_desc(rc));
        const char *dmsg;
        size_t l;
        cass_future_error_message(connect_future, &dmsg, &l);
        std::string msg2(dmsg, l);
        throw ModuleException(msg + " - " + msg2);
    }
    cass_future_free(connect_future);

    // Query tokens
    std::string node = contact_points.substr(0, contact_points.find_first_of(","));
    set_tokens_per_host(node.c_str(), nodePort);
}

StorageInterface::~StorageInterface() {
    disconnectCassandra();
}

int StorageInterface::disconnectCassandra() {
    if (session != NULL) {
        CassFuture *close_future = cass_session_close(session);
        cass_future_free(close_future);
        cass_session_free(session);
        cass_cluster_free(cluster);
        session = NULL;
    }
    return 0;
}

CacheTable *StorageInterface::make_cache(const TableMetadata *table_meta,
                                         config_map &config) {
    if (!session) throw ModuleException("StorageInterface not connected to any node");
    return new CacheTable(table_meta, session, config);
}

CacheTable *StorageInterface::make_cache(const char *table, const char *keyspace,
                                         std::vector<config_map> &keys_names,
                                         std::vector<config_map> &columns_names,
                                         config_map &config) {
    if (!session) throw ModuleException("StorageInterface not connected to any node");
    TableMetadata *table_meta = new TableMetadata(table, keyspace, keys_names, columns_names, session);
    return new CacheTable(table_meta, session, config);
}

Writer *StorageInterface::make_writer(const char *table, const char *keyspace,
                                      std::vector<config_map> &keys_names,
                                      std::vector<config_map> &columns_names,
                                      config_map &config) {
    if (!session) throw ModuleException("StorageInterface not connected to any node");
    TableMetadata *table_meta = new TableMetadata(table, keyspace, keys_names, columns_names, session);
    return new Writer(table_meta, session, config);

}

Writer *StorageInterface::make_writer_stream(const char *table, const char *keyspace,
                                      std::vector<config_map> &keys_names,
                                      std::vector<config_map> &columns_names,
                                      const char* topic,
                                      config_map &config) {
    Writer* myWriter = make_writer(table, keyspace, keys_names, columns_names, config);
    myWriter->enable_stream(topic, (std::map<std::string,std::string>&) config);
    return myWriter;
}
void StorageInterface::enable_writer_stream(Writer *target, const char *topic, config_map &config) {
    target->enable_stream(topic, (std::map<std::string,std::string>&)config);
}

Writer *StorageInterface::make_writer(const TableMetadata *table_meta,
                                      config_map &config) {
    if (!session) throw ModuleException("StorageInterface not connected to any node");
    return new Writer(table_meta, session, config);

}

//ArrayDataStore *StorageInterface::make_array_store(const char *table, const char *keyspace, config_map &config) {
//    return new ArrayDataStore(table, keyspace, session, config);
//}

MetaManager *StorageInterface::make_meta_manager(const char *table, const char *keyspace,
                                                 std::vector<config_map> &keys_names,
                                                 std::vector<config_map> &columns_names,
                                                 config_map &config) {
    if (!session){
        std::cerr<<"StorageInterface not connected to any node"<<std::endl;
        throw ModuleException("StorageInterface not connected to any node");
    }

    TableMetadata *table_meta = new TableMetadata(table, keyspace, keys_names, columns_names, session);
    return new MetaManager(table_meta, session, config);
}

/*** ITERATOR METHODS AND SETUP ***/

/***
 * This one retrives the keys comprised on its ranges and the columns if any, assuming partid is keys_names[0]
 * @param table
 * @param keyspace
 * @param keys_names
 * @param columns_names
 * @param tokens
 * @param prefetch_size
 * @return
 */
Prefetch *StorageInterface::get_iterator(const char *table, const char *keyspace,
                                         std::vector<config_map> &keys_names,
                                         std::vector<config_map> &columns_names,
                                         const std::vector<std::pair<int64_t, int64_t>> &tokens,
                                         config_map &config) {
    if (!session) throw ModuleException("StorageInterface not connected to any node");
    TableMetadata *table_meta = new TableMetadata(table, keyspace, keys_names, columns_names, session);
    return new Prefetch(tokens, table_meta, session, config);
}

Prefetch *StorageInterface::get_iterator(const TableMetadata *table_meta,
                                         const std::vector<std::pair<int64_t, int64_t>> &tokens,
                                         config_map &config) {
    if (!session) throw ModuleException("StorageInterface not connected to any node");
    return new Prefetch(tokens, table_meta, session, config);
}

Prefetch *StorageInterface::get_iterator(const TableMetadata *table_meta,
                                         config_map &config) {
    if (!session) throw ModuleException("StorageInterface not connected to any node");
    return new Prefetch(token_ranges, table_meta, session, config);
}
/* Query 'peer' and 'tokens' columns from 'table' at 'node:nodePort'
 * Results are stored in 'tokensInCluster' field */
void StorageInterface::query_tokens( const char * peer, const char* tokens, const char* table, const char * node, int nodePort) {
    char stmnt[80];

    sprintf(stmnt, "Select %s, %s from %s", peer, tokens, table);
	CassStatement* statement  = cass_statement_new(stmnt,0);
    // Pick the firs contact_point
    if (cass_statement_set_host(statement, node, nodePort) != CASS_OK) {
        std::cerr<< "query_tokens ooops setting host "<< node << ":"<<nodePort<<std::endl;
        exit(1);
    }
	CassFuture* query_future = cass_session_execute(session, statement);

    cass_statement_free(statement);

    const CassResult* result = cass_future_get_result(query_future);
    if (result == NULL) {
        const char* error_message;
        size_t error_message_length;
        cass_future_error_message(query_future, &error_message, &error_message_length);
        std::cerr<<error_message<<std::endl;
        exit(1);
    }

    cass_future_free(query_future);

    CassIterator* row_iterator = cass_iterator_from_result(result);

    while (cass_iterator_next(row_iterator)) {
        const CassRow* row = cass_iterator_get_row(row_iterator);
        CassInet peer_n;
        char * str_peer = (char*) malloc(sizeof(char*)*80);
        bool found = false;
        cass_value_get_inet(cass_row_get_column_by_name(row, peer), &peer_n);
        cass_inet_string(peer_n, str_peer);
        //printf("peer: %s\n",str_peer);

        const CassValue* col = cass_row_get_column_by_name(row, tokens);
        if (cass_value_is_collection(col)) {
            uint32_t rows = 0;
            CassIterator* col_it = cass_iterator_from_collection(col);
            while(cass_iterator_next(col_it)) {
                const CassValue *item = cass_iterator_get_value(col_it);
                const char *str;
                size_t size;
                cass_value_get_string(item, &str, &size);
                //printf("token: %s %s\n", str, str_peer);
                rows++;

                struct tokenHost x;
                x.token = strtoll(str, NULL, 10);
                x.host  = str_peer;
                std::vector< struct tokenHost >::iterator i;
                found = false;
                i = tokensInCluster.begin();
                while (!found && i < tokensInCluster.end()){
                    if (x.token < (*i).token) {
                        tokensInCluster.insert(i, x);
                        found = true;
                    }
                    i++;
                }
                if (!found) {
                    tokensInCluster.push_back(x);
                }
            }
            cass_iterator_free(col_it);
            //printf("num tokens: %u\n", rows);
        } else {
            std::cerr << "tokens is not a collection" << std::endl;
            exit(1);
        }
    }

    cass_result_free(result);
    cass_iterator_free(row_iterator);

}

/* tokensInCluster setter
 * To enforce the execution of all queries to the same node, node and nodePort are required */
void StorageInterface::set_tokens_per_host(const char * node, int nodePort) {
    query_tokens("listen_address", "tokens", "system.local", node, nodePort);
    query_tokens("peer"          , "tokens", "system.peers", node, nodePort);
    generate_token_ranges();
}

void StorageInterface::get_tokens_per_host(std::vector< struct tokenHost > &tokensInCluster) {
    tokensInCluster = this->tokensInCluster;
}

/**
    Makes proper tokens ranges ensuring that in a tuple (a,b) a <= b
    Given a list of tokens [-1, 0, 10]
    Returns a rationalized list [(min, -1) (-1, 0),(0,10),(10, max)] */
void StorageInterface::generate_token_ranges() {
    if (tokensInCluster.size() == 0) {
        return;
    }
    int64_t token1 = tokensInCluster[0].token;
    int64_t token2;
    if (token1 > LONG_MIN) {
        token_ranges.push_back(std::pair<int64_t, int64_t>(LONG_MIN, token1));
    }
    for (uint32_t i=1; (i < tokensInCluster.size() - 1) ; i++) {
        token2 = tokensInCluster[i].token;
        token_ranges.push_back(std::pair<int64_t, int64_t>(token1,token2));
        token1 = token2;
    }
    if (token2 < LONG_MAX) {
        token_ranges.push_back(std::pair<int64_t, int64_t>(token2,LONG_MAX));
    }
}
std::vector<std::pair<int64_t,int64_t>> StorageInterface::get_token_ranges() const {
    return token_ranges;
}

/* Returns the host associated to a 'token' */
char * StorageInterface::get_host_per_token(int64_t token) {
    //std::cout<<"JCOSTA =================" << std::endl;
    struct tokenHost *th = NULL; //tokensInCluster.find(token)
    bool found = false;
    uint32_t i=0;
    for (; (i < tokensInCluster.size() - 1) && (!found); i++) {
        //printf("token: %ld %s\n", tokensInCluster[i].token, tokensInCluster[i].host);
        if (tokensInCluster[i].token   >= token ) {
            found = true;
            th = &tokensInCluster[i];
        }
    }
    if (!found) {
        th = &tokensInCluster[i];
    }
    //printf("JCOSTA token found %ld -> %ld %s\n", token, th->token, th->host);
    return th->host;
}


text:
[![Gitter](https://badges.gitter.im/couchbase/couchbase-lite-java-core.svg)](https://gitter.im/couchbase/couchbase-lite-java-core?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

The [Couchbase Lite Android](https://github.com/couchbase/couchbase-lite-android) library is split into two parts:

* [couchbase-lite-java-core](https://github.com/couchbase/couchbase-lite-java-core) - this module, which has no dependencies on the Android API, and is usable in non-Android contexts.
* [couchbase-lite-android](https://github.com/couchbase/couchbase-lite-android) - which has dependencies on the Android API.

Likewise, the [Couchbase Lite Java](https://github.com/couchbase/couchbase-lite-java) library is split into two parts:

* [couchbase-lite-java-core](https://github.com/couchbase/couchbase-lite-java-core) - this module, which has no dependencies on the Android API, and is usable in non-Android contexts.
* [couchbase-lite-java-native](https://github.com/couchbase/couchbase-lite-java-native) - which contains a native wrapper of SQLite.

See the [Project Structure](https://github.com/couchbase/couchbase-lite-android/wiki/Project-structure) wiki page for more information.

# How to build

```
$ ./gradlew build
```

redpajama_set_name: RedPajamaGithub


text:
name: Yahoo!
website: http://www.yahoo.com/
image: /images/companies/yahoo.gif
active: true
---


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

[
            Download

            ]
            | [
            Documentation Home
            ] | [
            Release Notes

            ]

MAR Validator

The aim of this document is to explain briefly how the Module Validator (MAR Validator)
            tool works.

Content

                Introduction

                Usage

                Conclusion

Introduction

        MAR Validator is a graphical tool available with WSO2 Application Server that
        allows the user to validate a Web Services Module (known as a MAR file, due to the .mar extension).

Usage

Validating a module before is deployed can come quite handy,
            because it will provide an assurance of the validity of the module in question.
            Using MAR Validator is quite easy, and as with the other tools
            provided on the WSO2 Application Server front page,
            you don't even need to sign in.

Click on
            MAR Validator
            and you will be taken to the following screen.

            There are two different ways in which we can provide the tool with the module which needs
            to be validated. We can either provide a module archive (a .mar file) or a module descriptor
            (a module.xml file).

First lets consider the scenario of validating a module archive (MAR file).

click on the
        Browse
            on the "Select a MAR" box to search your file system for
            the .mar file which represents the module archive you want to validate. Once
            you have selected it, click on the Validate MAR button to validate the module.xml inside it.

        Note: In case of a MAR Validation what actually happens is that the module.xml file inside the
            archive is extracted and validated.

Next, lets consider the other option, namely, directly pointing to a module.xml file to validate.

Click on the
        Browse button in the "Select a module.xml" box to search your file system for
            the module.xml file which you want to validate. Once you have selected it, click on
            "Validate
            Module.xml"
            button to validate the module descriptor.

In both of the above methods, when the validation process has completed,
            you will be taken to the results page.
            This page will display the validation results in tabular form.

If we take a closer look at the inner workings of the validation process, in
            module.xml validation,
            the tool parses the input module.xml against a schema and looks for any invalidities.
            If any are found, they are presented in a tabular form.

Conclusion

MAR validation provides a handy method of validating a MAR archive or a module.xml file
            and viewing the results in a
            tabular form.


text:
package com.android.wang.coolweather.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.android.wang.coolweather.service.AutoUpdateService;

/**
 * Created by Administrator on 2016/5/11.
 */
public class AutoUpdateReceive extends BroadcastReceiver {
    @Override
    public void onReceive(Context context,Intent intent)
    {
       Intent i=new Intent(context,AutoUpdateService.class);
        context.startService(i);

    }
}


text:
layout: post
title: "Markup: Syntax Highlighting"
author: mmistakes
tags: [Highlight, Markdown]
---

Syntax highlighting[^1] is a feature that displays source code.
This feature facilitates writing in a structured language such as a programming language or a markup language as it makes import things visually distinct.

### GFM Code Blocks

GitHub Flavored Markdown [fenced code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) are supported. To modify styling and highlight colors edit `/_sass/syntax.scss`.

```css
#container {
  float: left;
  margin: 0 -240px 0 0;
  width: 100%;
}
```

{% highlight scss linenos %}
.highlight {
  margin: 0;
  padding: 1em;
  font-family: $monospace;
  font-size: $type-size-7;
  line-height: 1.8;
}
{% endhighlight %}

```html
{% raw %}<nav class="pagination" role="navigation">
  {% if page.previous %}
    <a href="{{ site.url }}{{ page.previous.url }}" class="btn" title="{{ page.previous.title }}">Previous article</a>
  {% endif %}
  {% if page.next %}
    <a href="{{ site.url }}{{ page.next.url }}" class="btn" title="{{ page.next.title }}">Next article</a>
  {% endif %}
</nav><!-- /.pagination -->{% endraw %}
```

```ruby
module Jekyll
  class TagIndex < Page
    def initialize(site, base, dir, tag)
      @site = site
      @base = base
      @dir = dir
      @name = 'index.html'
      self.process(@name)
      self.read_yaml(File.join(base, '_layouts'), 'tag_index.html')
      self.data['tag'] = tag
      tag_title_prefix = site.config['tag_title_prefix'] || 'Tagged: '
      tag_title_suffix = site.config['tag_title_suffix'] || '–'
      self.data['title'] = "#{tag_title_prefix}#{tag}"
      self.data['description'] = "An archive of posts tagged #{tag}."
    end
  end
end
```

### Code Blocks in Lists

Indentation matters. Be sure the indent of the code block aligns with the first non-space character after the list item marker (e.g., `1.`). Usually this will mean indenting 3 spaces instead of 4.

1. Do step 1.
2. Now do this:

   ```ruby
   def print_hi(name)
     puts "Hi, #{name}"
   end
   print_hi('Tom')
   #=> prints 'Hi, Tom' to STDOUT.
   ```

3. Now you can do this.

### GitHub Gist Embed

An example of a Gist embed below:

<script src="https://gist.github.com/sylhare/dad7ed1ef3d13614c77c4ebadf8a11c3.js"></script>

Here is how it looks like:

{% highlight html %}
{% raw %}
   <script src="https://gist.github.com/sylhare/dad7ed1ef3d13614c77c4ebadf8a11c3.js">
   </script>
{% endraw %}
{% endhighlight %}

<br>

[^1]: {% include citation.html key="highlight" %}


text:
int sporth_scrambler(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;

    sp_ftbl *ft_s, *ft_d;
    const char *src, *dst;

    switch(pd->mode){
        case PLUMBER_CREATE:
            plumber_add_ugen(pd, SPORTH_SCRAMBLER, NULL);
            if(sporth_check_args(stack, "ss") != SPORTH_OK) {
                plumber_print(pd, "Init: not enough arguments for gen_line\n");
                return PLUMBER_NOTOK;
            }

            src = sporth_stack_pop_string(stack);
            dst = sporth_stack_pop_string(stack);

            if(plumber_ftmap_search(pd, src, &ft_s) != PLUMBER_OK) {
                plumber_print(pd,
                    "scrambler: could not find ftable %s",
                    src);
            }

            sp_gen_scrambler(pd->sp, ft_s, &ft_d);
            plumber_ftmap_add(pd, dst, ft_d);
            break;

        case PLUMBER_INIT:
            sporth_stack_pop_string(stack);
            sporth_stack_pop_string(stack);
            break;

        case PLUMBER_COMPUTE:
            break;

        case PLUMBER_DESTROY:
            break;

        default:
           break;
    }
    return PLUMBER_OK;
}


text:
<md-toolbar layout="row">

{{task.title}}

  </md-toolbar>

ID: {{task.id}}

Description:

{{task.description}}


text:
package org.kohsuke.groovy.sandbox.impl;

import org.codehaus.groovy.syntax.Types;

import java.util.HashMap;
import java.util.Map;

import static org.codehaus.groovy.syntax.Types.*;

/**
 * Additional relationship between operators.
 *
 * @author Kohsuke Kawaguchi
 * @see Types
 */
public class Ops {
    private static final Map<Integer,Integer> compoundAssignmentToBinaryOperator = new HashMap<Integer, Integer>();

    public static int compoundAssignmentToBinaryOperator(int type) {
        Integer o = compoundAssignmentToBinaryOperator.get(type);
        if (o==null)    throw new IllegalArgumentException(""+type);
        return o;
    }

    private static final Map<Integer,String> binaryOperatorMethods = new HashMap<Integer, String>();

    public static String binaryOperatorMethods(int type) {
        String v = binaryOperatorMethods.get(type);
        if (v==null)    throw new IllegalArgumentException(""+type);
        return v;
    }

    public static boolean isComparisionOperator(int type) {
        return Types.ofType(type,COMPARISON_OPERATOR);
    }

    public static boolean isRegexpComparisonOperator(int type) {
        return Types.ofType(type,REGEX_COMPARISON_OPERATOR);
    }

    public static boolean isLogicalOperator(int type) {
        return Types.ofType(type,LOGICAL_OPERATOR);
    }

    // see http://groovy.codehaus.org/Operator+Overloading
    static {
        Map<Integer, Integer> c = compoundAssignmentToBinaryOperator;
        c.put(PLUS_EQUAL,PLUS);
        c.put(MINUS_EQUAL,MINUS);
        c.put(MULTIPLY_EQUAL,MULTIPLY);
        c.put(DIVIDE_EQUAL,DIVIDE);
        c.put(INTDIV_EQUAL,INTDIV);
        c.put(MOD_EQUAL,MOD);
        c.put(POWER_EQUAL,POWER);

        c.put(LEFT_SHIFT_EQUAL, LEFT_SHIFT);
        c.put(RIGHT_SHIFT_EQUAL, RIGHT_SHIFT);
        c.put(RIGHT_SHIFT_UNSIGNED_EQUAL, RIGHT_SHIFT_UNSIGNED);

        c.put(BITWISE_OR_EQUAL, BITWISE_OR);
        c.put(BITWISE_AND_EQUAL, BITWISE_AND);
        c.put(BITWISE_XOR_EQUAL, BITWISE_XOR);

        // see BinaryExpressionHelper.eval
        Map<Integer, String> b = binaryOperatorMethods;
        b.put(PLUS,"plus");
        b.put(MINUS,"minus");
        b.put(MULTIPLY,"multiply");
        b.put(POWER,"power");
        b.put(DIVIDE,"div");
        b.put(MOD,"mod");
        b.put(BITWISE_OR,"or");
        b.put(BITWISE_AND,"and");
        b.put(BITWISE_XOR,"xor");
        b.put(LEFT_SHIFT,"leftShift");
        b.put(RIGHT_SHIFT,"rightShift");
        b.put(RIGHT_SHIFT_UNSIGNED,"rightShiftUnsigned");

        b.put(COMPARE_EQUAL,"compareEqual");
        b.put(COMPARE_NOT_EQUAL,"compareNotEqual");
        b.put(COMPARE_LESS_THAN,"compareLessThan");
        b.put(COMPARE_LESS_THAN_EQUAL,"compareLessThanEqual");
        b.put(COMPARE_GREATER_THAN,"compareGreaterThan");
        b.put(COMPARE_GREATER_THAN_EQUAL,"compareGreaterThanEqual");
        b.put(COMPARE_TO,"compareTo");

        b.put(FIND_REGEX,"findRegex");
        b.put(MATCH_REGEX,"matchRegex");
    }
}


text:
/**
 * Global
 */
const DIR = __dirname;
const LIBS_DIR = `${DIR}/js/libs`;
const CONF_DIR = `${DIR}/../config`;

/**
 * Npm
 */
const _ = require('lodash');
const moment = require('moment');
const ReState = require(`${LIBS_DIR}/re.state`);
const Storage = require(`${LIBS_DIR}/storage`);
const Gmail = require(`${LIBS_DIR}/singlegmail`);
const Common = require(`${LIBS_DIR}/common`);
const Curl = require(`${LIBS_DIR}/curl`);
const Helper = require(`${LIBS_DIR}/helper`);
const View = require(`${LIBS_DIR}/view`);
const LocalDb = require(`${LIBS_DIR}/localDb`);
const Communicator = require(`${LIBS_DIR}/communicator`);
const Logger = require(`${LIBS_DIR}/logger`);
const Notice = require(`${LIBS_DIR}/notice`);

const communicator = new Communicator();
const state = new ReState(communicator);
const logger = new Logger();
const storage = new Storage();
const db = new LocalDb('mailer');

/**
 * front
 */
const $$ = (e) => {
  return document.querySelector(e);
};

/**
 * config
 */
const dbSchemas = [];
require('fs').readdir(`${CONF_DIR}/db`, (e, files) => {
  files.forEach((file) => {
    const version = file.split('.')[1];
    dbSchemas.push(require(`${CONF_DIR}/db/${file}`));
  });
  console.log(dbSchemas);
  db.init(dbSchemas);
});


text:
namespace test {

class TestAppListControllerDelegate : public AppListControllerDelegate {
 public:
  TestAppListControllerDelegate();
  ~TestAppListControllerDelegate() override;

  int64_t GetAppListDisplayId() override;
  void DismissView() override;
  aura::Window* GetAppListWindow() override;
  bool IsAppPinned(const std::string& app_id) override;
  void PinApp(const std::string& app_id) override;
  void UnpinApp(const std::string& app_id) override;
  Pinnable GetPinnable(const std::string& app_id) override;
  bool IsAppOpen(const std::string& app_id) const override;
  void DoShowAppInfoFlow(Profile* profile,
                         const std::string& extension_id) override;
  void CreateNewWindow(bool incognito,
                       bool should_trigger_session_restore) override;
  void OpenURL(Profile* profile,
               const GURL& url,
               ui::PageTransition transition,
               WindowOpenDisposition deposition) override;

  void Reset();

  bool did_dismiss_view() const { return did_dismiss_view_; }
  const GURL& last_opened_url() const { return last_opened_url_; }

 private:
  bool did_dismiss_view_ = false;
  GURL last_opened_url_;
};

}  // namespace test

#endif  // CHROME_BROWSER_UI_APP_LIST_TEST_TEST_APP_LIST_CONTROLLER_DELEGATE_H_


text:
import redis
import os
import sys

def main():
    """
    Recordings now get closed after inaction
    Adding r:user:coll:rec:open for 10 mins to all ensure current recordings have a chance to be added to
    """
    r = redis.StrictRedis.from_url(os.environ['REDIS_BASE_URL'], decode_responses=True)

    count = 30

    if len(sys.argv) > 1 and sys.argv[1] == '-d':
        print('Dry Run')
        dry = True
    else:
        print('Adding u:{user}:{coll}:{rec}:open keys')
        dry = False

    for key in r.scan_iter('r:*:cdxj'):
        open_key = key.rsplit(':', 1)[0] + ':open'
        print('setex {0} {1} 1'.format(open_key, count))

        if not dry:
            r.set(open_key, 1, ex=count)

        count = count + 1

if __name__ == "__main__":
    main()


text:
package com.boundary.camel.component.ssh;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.component.ssh.FileKeyPairProvider;
import org.apache.sshd.common.KeyPairProvider;
import org.junit.Test;

public class SshComponentSecurityTest extends SshComponentTestSupport {

    @Test
    public void testRsa() throws Exception {
        final String msg = "test\n";
    	SshxConfiguration config = new SshxConfiguration();
    	config.setCommand(msg);
    	config.setHost("localhost");
    	config.setPort(port);

        MockEndpoint mock = getMockEndpoint("mock:rsa");
        mock.expectedMinimumMessageCount(1);
        //TODO: Better tests to ensure what is received
        //mock.expectedBodiesReceived(config);

        template.sendBody("direct:ssh-rsa", config);

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testRsaFile() throws Exception {
        final String msg = "test\n";
    	SshxConfiguration config = new SshxConfiguration();
    	config.setCommand(msg);
    	config.setHost("localhost");
    	config.setPort(port);

        MockEndpoint mock = getMockEndpoint("mock:rsaFile");
        mock.expectedMinimumMessageCount(1);
        //TODO: Better tests to ensure what is received
        //mock.expectedBodiesReceived(config);

        template.sendBody("direct:ssh-rsaFile", config);

        assertMockEndpointsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() {
                onException(Exception.class)
                        .handled(true)
                        .to("mock:error");

                SshxComponent sshComponent = new SshxComponent();
                sshComponent.setHost("localhost");
                sshComponent.setPort(port);
                sshComponent.setUsername("smx");
                sshComponent.setKeyPairProvider(new FileKeyPairProvider(new String[]{"src/test/resources/hostkey.pem"}));
                sshComponent.setKeyType(KeyPairProvider.SSH_RSA);

                getContext().addComponent("ssh-rsa", sshComponent);

                from("direct:ssh-rsa")
                        .to("ssh-rsa:test")
                        .to("mock:rsa");

                from("direct:ssh-rsaFile")
                        .to("ssh://smx@localhost:" + port + "?certResource=file:src/test/resources/hostkey.pem")
                        .to("mock:rsaFile");
            }
        };
    }
}


text:
1. Download data from [NCAA](http://web1.ncaa.org/stats/StatsSrv/rankings?sportCode=MBB)
  *  Selection Division
  *  Select reporting week (I would go with through most recent week)
  *  For statistic category, use the dropdown list for Team and select "All Statistics"
  *  Click Show Report(CSV - Spreadsheet) and save this file into the raw_data directory as all_data.csv


text:
<!DOCTYPE html>

  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>Update: Asterisk TFoT v3 Progressing Nicely · Leif Madsen</title>

  <link rel="stylesheet" href="http://blog.leifmadsen.com/css/poole.css">
  <link rel="stylesheet" href="http://blog.leifmadsen.com/css/hyde.css">
  <link rel="stylesheet" href="http://blog.leifmadsen.com/css/poole-overrides.css">
  <link rel="stylesheet" href="http://blog.leifmadsen.com/css/hyde-overrides.css">
  <link rel="stylesheet" href="http://blog.leifmadsen.com/css/hyde-x.css">
  <link rel="stylesheet" href="http://blog.leifmadsen.com/css/highlight/monokai.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://blog.leifmadsen.com/touch-icon-144-precomposed.png">
  <link href="http://blog.leifmadsen.com/favicon.png" rel="icon">

  <meta name="description" content="Leif Madsen's Blog">
  <meta name="keywords" content="blog,leif,madsen,canada,containers,asterisk,development,devops,infrastructure,implementation engineer">

Leif Madsen

I’m not clever enough for a tagline.

Blog

Copyright © 2017 License

       Powered by Hugo and Hyde-X

Update: Asterisk TFoT v3 Progressing Nicely

Jim and I have been working feverishly for the past few days, and the only thing that can cure it is more cowbell! Or probably more accurately, more writing!

We’ve been making some good progress on rewriting a couple of chapters so far, and tweaking a few other ones. We’re in the process of finishing up the first drafts of the new installation chapter and the initial configuration chapter, and I’ve started work on a chapter about queues. I hope to have about 50% of the queue chapter done by the end of today.

Last night Jim and myself went out to have a pint and to talk about the book, and we both realized how much our consulting experience is going to impact the quality of the book, and the ability to better define a set of best practices. I certainly think this edition of the book will surmount the quality of the first two editions, and the entire community will benefit from it. I’m really excited about it.

Hopefully we can make some good pushes over the next couple of months and get a draft of the book done early in the new year, which should set us up for a release in the spring. It’s amazing how much work and time goes into creating books; the people who do this for a living are certainly a special kind of people.

Since our plan is to more openly develop the book and get the community more actively involved in the testing and proofreading of the book, I’ll be sure to post an update here as soon as we have something available for reading.


text:
using UnityEngine;
using System.Collections;

[AddComponentMenu("2D Toolkit/Demo/tk2dDemoRuntimeSpriteController")]
public class tk2dDemoRuntimeSpriteController : MonoBehaviour {

	// Texture for runtime sprite collection demo
	public Texture2D runtimeTexture;

	// Texture packer textures
	public Texture2D texturePackerTexture;
	public TextAsset texturePackerExportFile;

	// This object will be destroyed on startup
	public GameObject destroyOnStart;

	tk2dBaseSprite spriteInstance = null;
	tk2dSpriteCollectionData spriteCollectionInstance = null;

	// Use this for initialization
	void Start () {
		if (destroyOnStart != null) {
			Destroy(destroyOnStart);
		}
	}

	// Update is called once per frame
	void Update () {

	}

	void DestroyData() {
		if (spriteInstance != null) {
			Destroy(spriteInstance.gameObject);
		}
		if (spriteCollectionInstance != null) {
			Destroy(spriteCollectionInstance.gameObject);
		}
	}

	void DoDemoTexturePacker(tk2dSpriteCollectionSize spriteCollectionSize) {
		if (GUILayout.Button("Import")) {
			DestroyData();

			// Create atlas
			spriteCollectionInstance = tk2dSpriteCollectionData.CreateFromTexturePacker(spriteCollectionSize, texturePackerExportFile.text, texturePackerTexture );

			GameObject go = new GameObject("sprite");
			go.transform.localPosition = new Vector3(-1, 0, 0);
			spriteInstance = go.AddComponent<tk2dSprite>();
			spriteInstance.SetSprite(spriteCollectionInstance, "sun");

			go = new GameObject("sprite2");
			go.transform.parent = spriteInstance.transform;
			go.transform.localPosition = new Vector3(2, 0, 0);
			tk2dSprite sprite = go.AddComponent<tk2dSprite>();
			sprite.SetSprite(spriteCollectionInstance, "2dtoolkit_logo");

			go = new GameObject("sprite3");
			go.transform.parent = spriteInstance.transform;
			go.transform.localPosition = new Vector3(1, 1, 0);
			sprite = go.AddComponent<tk2dSprite>();
			sprite.SetSprite(spriteCollectionInstance, "button_up");

			go = new GameObject("sprite4");
			go.transform.parent = spriteInstance.transform;
			go.transform.localPosition = new Vector3(1, -1, 0);
			sprite = go.AddComponent<tk2dSprite>();
			sprite.SetSprite(spriteCollectionInstance, "Rock");
		}
	}

	void DoDemoRuntimeSpriteCollection(tk2dSpriteCollectionSize spriteCollectionSize) {
		if (GUILayout.Button("Use Full Texture")) {
			DestroyData();

			// Create a sprite, using the entire texture as the sprite
			Rect region = new Rect(0, 0, runtimeTexture.width, runtimeTexture.height);
			Vector2 anchor = new Vector2(region.width / 2, region.height / 2);
			GameObject go = tk2dSprite.CreateFromTexture(runtimeTexture, spriteCollectionSize, region, anchor);
			spriteInstance = go.GetComponent<tk2dSprite>();
			spriteCollectionInstance = spriteInstance.Collection;
		}

		if (GUILayout.Button("Extract Region)")) {
			DestroyData();

			// Create a sprite, using a region of the texture as the sprite
			Rect region = new Rect(79, 243, 215, 200);
			Vector2 anchor = new Vector2(region.width / 2, region.height / 2);
			GameObject go = tk2dSprite.CreateFromTexture(runtimeTexture, spriteCollectionSize, region, anchor);
			spriteInstance = go.GetComponent<tk2dSprite>();
			spriteCollectionInstance = spriteInstance.Collection;
		}

		if (GUILayout.Button("Extract multiple Sprites")) {
			DestroyData();

			string[] names = new string[] {
				"Extracted region",
				"Another region",
				"Full sprite",
			};
			Rect[] regions = new Rect[] {
				new Rect(79, 243, 215, 200),
				new Rect(256, 0, 64, 64),
				new Rect(0, 0, runtimeTexture.width, runtimeTexture.height)
			};
			Vector2[] anchors = new Vector2[] {
				new Vector2(regions[0].width / 2, regions[0].height / 2),
				new Vector2(0, regions[1].height),
				new Vector2(0, regions[1].height)
			};

			// Create a sprite collection with multiple sprites, using regions of the texture
			spriteCollectionInstance = tk2dSpriteCollectionData.CreateFromTexture(runtimeTexture, spriteCollectionSize, names, regions, anchors);
			GameObject go = new GameObject("sprite");
			go.transform.localPosition = new Vector3(-1, 0, 0);
			spriteInstance = go.AddComponent<tk2dSprite>();
			spriteInstance.SetSprite(spriteCollectionInstance, 0);

			go = new GameObject("sprite2");
			go.transform.parent = spriteInstance.transform;
			go.transform.localPosition = new Vector3(2, 0, 0);
			tk2dSprite sprite = go.AddComponent<tk2dSprite>();
			sprite.SetSprite(spriteCollectionInstance, "Another region");
		}
	}

	void OnGUI() {
		tk2dSpriteCollectionSize spriteCollectionSize = tk2dSpriteCollectionSize.Explicit(5, 640);
		// If using the tk2dCamera using pixels per meter, use this:
		//tk2dSpriteCollectionSize spriteCollectionSize = tk2dSpriteCollectionSize.PixelsPerMeter( 20 );

		GUILayout.BeginHorizontal();

		GUILayout.BeginVertical("box");
		GUILayout.Label("Runtime Sprite Collection");
		DoDemoRuntimeSpriteCollection( spriteCollectionSize );
		GUILayout.EndVertical();

		GUILayout.BeginVertical("box");
		GUILayout.Label("Texture Packer Import");
		DoDemoTexturePacker( spriteCollectionSize );
		GUILayout.EndVertical();

		GUILayout.EndHorizontal();
	}
}


text:
<?php
class Blowfish{
    private $key;
    private $cipher;

    function __construct($pass){
        $this->cipher = mcrypt_module_open('blowfish','','cbc','');
        $ks = mcrypt_enc_get_key_size($this->cipher);
        $this->key = pack('H*',sha1($pass));
    }

    function encryptString($plaintext, $iv = ''){
        if ($iv == '') {
            $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this->cipher));
        }
        else {
            $iv = pack("H*", $iv);
        }
        mcrypt_generic_init($this->cipher, $this->key, $iv);
        $bs = mcrypt_enc_get_block_size($this->cipher); // get block size
        $plaintext = mb_convert_encoding($plaintext,'UTF-16BE'); // set to 2 byte, network order
        $pkcs = $bs - (strlen($plaintext) % $bs); // get pkcs5 pad length
        $pkcs = str_repeat(chr($pkcs), $pkcs); // create padding string
        $plaintext = $plaintext.$pkcs; // append pkcs5 padding to the data
        $result = mcrypt_generic($this->cipher, $plaintext);
        mcrypt_generic_deinit($this->cipher);
        return $iv.$result;
    }

    function decryptString($ciphertext){
        $bs = mcrypt_enc_get_block_size($this->cipher); // get block size
        $iv_size = mcrypt_enc_get_iv_size($this->cipher);
        if ((strlen($ciphertext) % $bs) != 0) { // check string is proper size
            exit(1);
        }
        $iv = substr($ciphertext, 0, $iv_size); // retrieve IV
        $ciphertext = substr($ciphertext, $iv_size);
        mcrypt_generic_init($this->cipher, $this->key, $iv);
        $result = mdecrypt_generic($this->cipher, $ciphertext); // decrypt
        //echo var_dump(unpack('c*',$iv))."\n";
        $padding = ord(substr($result,-1)); // retrieve padding
        $result = substr($result,0,$padding * -1); // and remove it
        mcrypt_generic_deinit($this->cipher);
        return $result;
    }

    function __destruct(){
        mcrypt_module_close($this->cipher);
    }

	public static function encrypt($string, $password = encryptionKey){
		$obj = new self($password);
		return bin2hex($obj->encryptString($string));
	}

	public static function decrypt($string, $password = encryptionKey){
		$obj = new self($password);
		return $obj->decryptString(pack("H*", $string));
	}
}
?>


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Arch. Protistenk. 125(1-4): 333 (1982)

#### Original name
Caldariomyces fumago Woron., 1927

### Remarks
null


text:
#include "CustomSceneEvent.h"

namespace Visualization {

const QEvent::Type CustomSceneEvent::EventType = static_cast<QEvent::Type> (QEvent::registerEventType());

CustomSceneEvent::CustomSceneEvent(QEvent::Type type)
	: QEvent(type)
{
}

CustomSceneEvent::CustomSceneEvent(EventFunction f)
	: QEvent(EventType), f_(f)
{
}

CustomSceneEvent::~CustomSceneEvent()
{
}

void CustomSceneEvent::execute()
{
	if (f_) f_();
}

} /* namespace Visualization */


text:
from oslo_serialization import jsonutils

from aodhclient import utils
from aodhclient.v2 import alarm_cli
from aodhclient.v2 import base

class AlarmManager(base.Manager):

    url = "v2/alarms"

    @staticmethod
    def _filtersdict_to_url(filters):
        urls = []
        for k, v in sorted(filters.items()):
            url = "q.field=%s&q.op=eq&q.value=%s" % (k, v)
            urls.append(url)
        return '&'.join(urls)

    def list(self, filters=None, limit=None,
             marker=None, sorts=None):
        """List alarms.

        :param filters: A dict includes filters parameters, for example,
                        {'type': 'gnocchi_resources_threshold',
                         'severity': 'low'} represent filters to query alarms
                        with type='gnocchi_resources_threshold' and
                        severity='low'.
        :type filters: dict
        :param limit: maximum number of resources to return
        :type limit: int
        :param marker: the last item of the previous page; we return the next
                       results after this value.
        :type marker: str
        :param sorts: list of resource attributes to order by.
        :type sorts: list of str
        """
        pagination = utils.get_pagination_options(limit, marker, sorts)
        filter_string = (self._filtersdict_to_url(filters) if
                         filters else "")
        url = self.url
        options = []
        if filter_string:
            options.append(filter_string)
        if pagination:
            options.append(pagination)
        if options:
            url += "?" + "&".join(options)
        return self._get(url).json()

    def query(self, query=None):
        """Query alarms.

        :param query: A json format complex query expression, like this:
                      '{"=":{"type":"gnocchi_resources_threshold"}}', this
                      expression is used to query all the
                      gnocchi_resources_threshold type alarms.
        :type query: json
        """
        query = {'filter': query}
        url = "v2/query/alarms"
        return self._post(url,
                          headers={'Content-Type': "application/json"},
                          data=jsonutils.dumps(query)).json()

    def get(self, alarm_id):
        """Get an alarm

        :param alarm_id: ID of the alarm
        :type alarm_id: str
        """
        return self._get(self.url + '/' + alarm_id).json()

    @staticmethod
    def _clean_rules(alarm_type, alarm):
        for rule in alarm_cli.ALARM_TYPES:
            if rule != alarm_type:
                alarm.pop('%s_rule' % rule, None)

    def create(self, alarm):
        """Create an alarm

        :param alarm: the alarm
        :type alarm: dict
        """
        self._clean_rules(alarm['type'], alarm)
        return self._post(
            self.url, headers={'Content-Type': "application/json"},
            data=jsonutils.dumps(alarm)).json()

    def update(self, alarm_id, alarm_update):
        """Update an alarm

        :param alarm_id: ID of the alarm
        :type alarm_id: str
        :param attributes: Attributes of the alarm
        :type attributes: dict
        """
        alarm = self._get(self.url + '/' + alarm_id).json()
        if 'type' not in alarm_update:
            self._clean_rules(alarm['type'], alarm_update)
        else:
            self._clean_rules(alarm_update['type'], alarm_update)

        if 'threshold_rule' in alarm_update:
            alarm['threshold_rule'].update(alarm_update.get('threshold_rule'))
            alarm_update.pop('threshold_rule')
        elif 'event_rule' in alarm_update:
            if ('type' in alarm_update and
                    alarm_update['type'] != alarm['type']):
                alarm.pop('%s_rule' % alarm['type'], None)
                alarm['event_rule'] = alarm_update['event_rule']
            else:
                alarm['event_rule'].update(alarm_update.get('event_rule'))
            alarm_update.pop('event_rule')
        elif 'gnocchi_resources_threshold_rule' in alarm_update:
            if ('type' in alarm_update and
                    alarm_update['type'] != alarm['type']):
                alarm.pop('%s_rule' % alarm['type'], None)
                alarm['gnocchi_resources_threshold_rule'] = alarm_update[
                    'gnocchi_resources_threshold_rule']
            else:
                alarm['gnocchi_resources_threshold_rule'].update(
                    alarm_update.get('gnocchi_resources_threshold_rule'))
            alarm_update.pop('gnocchi_resources_threshold_rule')
        elif 'gnocchi_aggregation_by_metrics_threshold_rule' in alarm_update:
            if ('type' in alarm_update and
                    alarm_update['type'] != alarm['type']):
                alarm.pop('%s_rule' % alarm['type'], None)
                alarm['gnocchi_aggregation_by_metrics_threshold_rule'] = \
                    alarm_update[
                        'gnocchi_aggregation_by_metrics_threshold_rule']
            else:
                alarm['gnocchi_aggregation_by_metrics_threshold_rule'].update(
                    alarm_update.get(
                        'gnocchi_aggregation_by_metrics_threshold_rule'))
            alarm_update.pop('gnocchi_aggregation_by_metrics_threshold_rule')
        elif 'gnocchi_aggregation_by_resources_threshold_rule' in alarm_update:
            if ('type' in alarm_update and
                    alarm_update['type'] != alarm['type']):
                alarm.pop('%s_rule' % alarm['type'], None)
                alarm['gnocchi_aggregation_by_resources_threshold_rule'] = \
                    alarm_update[
                        'gnocchi_aggregation_by_resources_threshold_rule']
            else:
                alarm['gnocchi_aggregation_by_resources_threshold_rule'].\
                    update(alarm_update.get(
                        'gnocchi_aggregation_by_resources_threshold_rule'))
            alarm_update.pop(
                'gnocchi_aggregation_by_resources_threshold_rule')
        elif 'composite_rule' in alarm_update:
            if ('type' in alarm_update and
                    alarm_update['type'] != alarm['type']):
                alarm.pop('%s_rule' % alarm['type'], None)
            if alarm_update['composite_rule'] is not None:
                alarm['composite_rule'] = alarm_update[
                    'composite_rule']
            alarm_update.pop('composite_rule')
        elif 'loadbalancer_member_health_rule' in alarm_update:
            if ('type' in alarm_update and
                    alarm_update['type'] != alarm['type']):
                alarm.pop('%s_rule' % alarm['type'], None)
            if alarm_update['loadbalancer_member_health_rule'] is not None:
                alarm['loadbalancer_member_health_rule'] = alarm_update[
                    'loadbalancer_member_health_rule']
            alarm_update.pop('loadbalancer_member_health_rule')

        alarm.update(alarm_update)

        return self._put(
            self.url + '/' + alarm_id,
            headers={'Content-Type': "application/json"},
            data=jsonutils.dumps(alarm)).json()

    def delete(self, alarm_id):
        """Delete an alarm

        :param alarm_id: ID of the alarm
        :type alarm_id: str
        """
        self._delete(self.url + '/' + alarm_id)

    def get_state(self, alarm_id):
        """Get the state of an alarm

        :param alarm_id: ID of the alarm
        :type alarm_id: str
        """
        return self._get(self.url + '/' + alarm_id + '/state').json()

    def set_state(self, alarm_id, state):
        """Set the state of an alarm

        :param alarm_id: ID of the alarm
        :type alarm_id: str
        :param state: the state to be updated to the alarm
        :type state: str
        """
        return self._put(self.url + '/' + alarm_id + '/state',
                         headers={'Content-Type': "application/json"},
                         data='"%s"' % state
                         ).json()


text:
<?php

namespace Jacoby\Intervention;

use Jacoby\Intervention\UserInterface\Admin;
use Jacoby\Intervention\UserInterface\Application;
use Jacoby\Intervention\UserInterface\Export;
use Jacoby\Intervention\UserInterface\Support\RegisterPage;
use Jacoby\Intervention\UserInterface\Support\UserColorSchemeCustomProps;

/**
 * UserInterface
 *
 * Interface for Intervention options.
 *
 * @package WordPress
 * @subpackage Intervention
 * @since 2.0.0
 *
 * @link https://developer.wordpress.org/reference/functions/add_submenu_page/
 */
class UserInterface
{
    /**
     * Initialize
     */
    public function __construct()
    {
        $this->routeAdmin = new Admin();
        $this->routeExport = new Export();
        $this->routeApplication = new Application();

        /**
         * Register custom `wp-admin` page.
         */
        $this->registerPage();

        /**
         * Load text domain for `json` language files.
         */
        $this->registerLanguages();

        /**
         * REST routes required for React fetch requests.
         */
        $this->registerRestApis();

        /**
         * Enqueue scripts and styles required for React app.
         */
        $this->registerResources();

        /**
         * Register user color scheme custom props to match the block editor.
         */
        new UserColorSchemeCustomProps();
    }

    /**
     * Register Page
     *
     * Register custom `wp-admin` page for Intervention.
     *
     * @link https://developer.wordpress.org/reference/hooks/admin_menu/
     * @link https://developer.wordpress.org/reference/functions/add_submenu_page/
     * @link https://developer.wordpress.org/reference/hooks/admin_footer_text/
     */
    public function registerPage()
    {
        add_action('admin_menu', function () {
            $page = new RegisterPage();

            add_submenu_page(
                $page->getParentSlug(),
                $page->getPageTitle(),
                $page->getMenuTitle(),
                $page->getCapabilities(),
                $page->getSlug(),
                [$page, 'render'],
            );
        });
    }

    /**
     * Register REST APIs
     *
     * REST routes required for React fetch requests.
     *
     * @link https://developer.wordpress.org/reference/hooks/rest_api_init/
     * @link https://developer.wordpress.org/reference/classes/wp_rest_server/
     */
    public function registerRestApis()
    {
        add_action('rest_api_init', function () {
            $core = [
                'methods' => \WP_REST_Server::EDITABLE,
                'permission_callback' => function () {
                    return current_user_can('manage_options');
                },
            ];

            register_rest_route('intervention/v2', '/admin', array_merge(
                $core,
                ['callback' => [$this->routeAdmin, 'request']],
            ));

            register_rest_route('intervention/v2', '/application', array_merge(
                $core,
                ['callback' => [$this->routeApplication, 'request']],
            ));

            register_rest_route('intervention/v2', '/exportAdminOptions', array_merge(
                $core,
                ['callback' => [$this->routeExport, 'requestAdminOptions']],
            ));

            register_rest_route('intervention/v2', '/export', array_merge(
                $core,
                ['callback' => [$this->routeExport, 'request']],
            ));
        });
    }

    /**
     * Register Languages
     *
     * Load text domain for `json` language files.
     *
     * @link https://developer.wordpress.org/reference/hooks/plugins_loaded/
     * @link https://developer.wordpress.org/reference/functions/load_plugin_textdomain/
     * @link https://pascalbirchler.com/internationalization-in-wordpress-5-0/
     */
    public function registerLanguages()
    {
        add_action('plugins_loaded', function () {
            load_plugin_textdomain('intervention', false, dirname(plugin_basename(__DIR__)) . '/languages/');
        });
    }

    /**
     * Register Resources
     *
     * Enqueue scripts and styles required for React app.
     *
     * @link https://developer.wordpress.org/reference/hooks/admin_enqueue_scripts/
     * @link https://developer.wordpress.org/reference/functions/wp_register_script/
     * @link https://developer.wordpress.org/reference/functions/wp_localize_script/
     * @link https://developer.wordpress.org/reference/functions/wp_set_script_translations/
     * @link https://developer.wordpress.org/reference/functions/wp_enqueue_script/
     */
    public function registerResources()
    {
        add_action('admin_enqueue_scripts', function () {
            $screen = get_current_screen();

            if ($screen->id !== 'tools_page_intervention') {
                return;
            }

            /**
             * Register script.
             */
            wp_register_script('intervention-scripts-user-interface', mix('assets/scripts/user-interface.js'), ['wp-i18n', 'wp-components', 'wp-element', 'wp-api-fetch']);

            /**
             * Localization for our script.
             */
            wp_localize_script('intervention-scripts-user-interface', 'intervention', [
                'nonce' => wp_create_nonce('wp_rest'),
                'route' => [
                    'admin' => [
                        'url' => esc_url_raw(rest_url('intervention/v2/admin')),
                        'data' => $this->routeAdmin->getLocalizedData(),
                    ],
                    'application' => [
                        'url' => esc_url_raw(rest_url('intervention/v2/application')),
                    ],
                    'exportAdminOptions' => [
                        'url' => esc_url_raw(rest_url('intervention/v2/exportAdminOptions')),
                    ],
                    'export' => [
                        'url' => esc_url_raw(rest_url('intervention/v2/export')),
                        'data' => $this->routeExport->getLocalizedData(),
                    ],
                ],
            ]);

            /**
             * Load script `json` translations.
             */
            wp_set_script_translations('intervention-scripts-user-interface', 'intervention', INTERVENTION_DIR . '/languages');

            /**
             * Enqueue script.
             */
            wp_enqueue_script('intervention-scripts-user-interface');

            /**
             * Register styles.
             */
            wp_register_style('intervention/styles/user-interface', mix('assets/styles/user-interface.css'), ['wp-components']);
            wp_enqueue_style('intervention/styles/user-interface');
        });
    }
}


text:
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:exslt="http://exslt.org/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd" version="3.3" ID="P0b002ee183a90393">
<name type="corporate">
 <namePart>United States Government Printing Office</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">printer</roleTerm>
  <roleTerm type="code" authority="marcrelator">prt</roleTerm>
</role>
 <role>
  <roleTerm type="text" authority="marcrelator">distributor</roleTerm>
  <roleTerm type="code" authority="marcrelator">dst</roleTerm>
</role>
</name>
<name type="corporate">
 <namePart>United States</namePart>
 <namePart>United States District Court Eastern District of California</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">author</roleTerm>
  <roleTerm type="code" authority="marcrelator">aut</roleTerm>
</role>
 <description>Government Organization</description>
</name>
<typeOfResource>text</typeOfResource>
<genre authority="marcgt">government publication</genre>
<language>
 <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</language>
<extension>
 <collectionCode>USCOURTS</collectionCode>
 <category>Judicial Publications</category>
 <branch>judicial</branch>
 <dateIngested>2013-01-13</dateIngested>
</extension>
<originInfo>
 <publisher>Administrative Office of the United States Courts</publisher>
 <dateIssued encoding="w3cdtf">2013-01-11</dateIssued>
 <issuance>monographic</issuance>
</originInfo>
<physicalDescription>
 <note type="source content type">deposited</note>
 <digitalOrigin>born digital</digitalOrigin>
</physicalDescription>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="uri">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-1_12-cv-00185</identifier>
<identifier type="local">P0b002ee183a90393</identifier>
<recordInfo>
 <recordContentSource authority="marcorg">DGPO</recordContentSource>
 <recordCreationDate encoding="w3cdtf">2013-01-13</recordCreationDate>
 <recordChangeDate encoding="w3cdtf">2013-01-13</recordChangeDate>
 <recordIdentifier source="DGPO">USCOURTS-caed-1_12-cv-00185</recordIdentifier>
 <recordOrigin>machine generated</recordOrigin>
 <languageOfCataloging>
  <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</languageOfCataloging>
</recordInfo>
<accessCondition type="GPO scope determination">fdlp</accessCondition>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-caed-1_12-cv-00185</accessId>
 <courtType>District</courtType>
 <courtCode>caed</courtCode>
 <courtCircuit>9th</courtCircuit>
 <courtState>California</courtState>
 <courtSortOrder>2061</courtSortOrder>
 <caseNumber>1:12-cv-00185</caseNumber>
 <caseOffice>Fresno</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>490</natureSuitCode>
 <natureSuit>Cable/ Satellite TV</natureSuit>
 <cause>47:553 Unauthorized Reception of Cable Service</cause>
 <party fullName="Cazadores Grill" lastName="Cazadores Grill" role="Defendant"></party>
 <party fullName="G&G Closed Circuit Events, LLC" lastName="G&G Closed Circuit Events, LLC" role="Plaintiff"></party>
 <party firstName="Aquiles" fullName="Aquiles Ramirez" lastName="Ramirez" role="Cross Defendant"></party>
 <party firstName="Aquiles" fullName="Aquiles Ramirez" lastName="Ramirez" role="Defendant"></party>
 <party firstName="Claudia" fullName="Claudia Ramirez" lastName="Ramirez" role="Cross Claimant"></party>
 <party firstName="Claudia" fullName="Claudia Ramirez" lastName="Ramirez" role="Defendant"></party>
</extension>
<titleInfo>
 <title>G&G Closed Circuit Events, LLC v. Ramirez et al</title>
 <partNumber>1:12-cv-00185</partNumber>
</titleInfo>
<location>
 <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-1_12-cv-00185/content-detail.html</url>
</location>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="preferred citation">1:12-cv-00185;12-185</identifier>
<name type="corporate">
 <namePart>United States District Court Eastern District of California</namePart>
 <namePart>9th Circuit</namePart>
 <namePart>Fresno</namePart>
 <affiliation>U.S. Courts</affiliation>
 <role>
  <roleTerm authority="marcrelator" type="text">author</roleTerm>
  <roleTerm authority="marcrelator" type="code">aut</roleTerm>
</role>
</name>
<name type="personal">
 <displayForm>Cazadores Grill</displayForm>
 <namePart type="family">Cazadores Grill</namePart>
 <namePart type="given"></namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Defendant</description>
</name>
<name type="personal">
 <displayForm>G&G Closed Circuit Events, LLC</displayForm>
 <namePart type="family">G&G Closed Circuit Events, LLC</namePart>
 <namePart type="given"></namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Plaintiff</description>
</name>
<name type="personal">
 <displayForm>Aquiles Ramirez</displayForm>
 <namePart type="family">Ramirez</namePart>
 <namePart type="given">Aquiles</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Cross Defendant</description>
</name>
<name type="personal">
 <displayForm>Aquiles Ramirez</displayForm>
 <namePart type="family">Ramirez</namePart>
 <namePart type="given">Aquiles</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Defendant</description>
</name>
<name type="personal">
 <displayForm>Claudia Ramirez</displayForm>
 <namePart type="family">Ramirez</namePart>
 <namePart type="given">Claudia</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Cross Claimant</description>
</name>
<name type="personal">
 <displayForm>Claudia Ramirez</displayForm>
 <namePart type="family">Ramirez</namePart>
 <namePart type="given">Claudia</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Defendant</description>
</name>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-caed-1_12-cv-00185</accessId>
 <courtType>District</courtType>
 <courtCode>caed</courtCode>
 <courtCircuit>9th</courtCircuit>
 <courtState>California</courtState>
 <courtSortOrder>2061</courtSortOrder>
 <caseNumber>1:12-cv-00185</caseNumber>
 <caseOffice>Fresno</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>490</natureSuitCode>
 <natureSuit>Cable/ Satellite TV</natureSuit>
 <cause>47:553 Unauthorized Reception of Cable Service</cause>
 <party fullName="Cazadores Grill" lastName="Cazadores Grill" role="Defendant"></party>
 <party fullName="G&G Closed Circuit Events, LLC" lastName="G&G Closed Circuit Events, LLC" role="Plaintiff"></party>
 <party firstName="Aquiles" fullName="Aquiles Ramirez" lastName="Ramirez" role="Cross Defendant"></party>
 <party firstName="Aquiles" fullName="Aquiles Ramirez" lastName="Ramirez" role="Defendant"></party>
 <party firstName="Claudia" fullName="Claudia Ramirez" lastName="Ramirez" role="Cross Claimant"></party>
 <party firstName="Claudia" fullName="Claudia Ramirez" lastName="Ramirez" role="Defendant"></party>
 <state>California</state>
</extension>
<relatedItem type="constituent" ID="id-USCOURTS-caed-1_12-cv-00185-0" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-0/mods.xml">
 <titleInfo>
  <title>G&G Closed Circuit Events, LLC v. Ramirez et al</title>
  <subTitle>ORDER Striking 24 Answer of Defendant Aquiles Ramirez dba Cazadores Grill signed by Chief Judge Anthony W. Ishii on 10/02/2012. (Flores, E)</subTitle>
  <partNumber>0</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2012-10-04</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-caed-1_12-cv-00185-0.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee183a935a8</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-0</identifier>
 <identifier type="former granule identifier">caed-1_12-cv-00185_0.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-0/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-1_12-cv-00185/pdf/USCOURTS-caed-1_12-cv-00185-0.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:12-cv-00185; G&G Closed Circuit Events, LLC v. Ramirez et al; </searchTitle>
  <courtName>United States District Court Eastern District of California</courtName>
  <state>California</state>
  <accessId>USCOURTS-caed-1_12-cv-00185-0</accessId>
  <sequenceNumber>0</sequenceNumber>
  <dateIssued>2012-10-04</dateIssued>
  <docketText>ORDER Striking 24 Answer of Defendant Aquiles Ramirez dba Cazadores Grill signed by Chief Judge Anthony W. Ishii on 10/02/2012. (Flores, E)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-caed-1_12-cv-00185-1" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-1/mods.xml">
 <titleInfo>
  <title>G&G Closed Circuit Events, LLC v. Ramirez et al</title>
  <subTitle>ORDER Denying Plaintiff's 16 Motion to Strike Affirmative Defenses of Defendant Claudia Ramirez, signed by Magistrate Judge Sandra M. Snyder on 1/2/2013. (Gaumnitz, R)</subTitle>
  <partNumber>1</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2013-01-03</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-caed-1_12-cv-00185-1.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee183a935aa</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-1</identifier>
 <identifier type="former granule identifier">caed-1_12-cv-00185_1.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-1/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-1_12-cv-00185/pdf/USCOURTS-caed-1_12-cv-00185-1.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:12-cv-00185; G&G Closed Circuit Events, LLC v. Ramirez et al; </searchTitle>
  <courtName>United States District Court Eastern District of California</courtName>
  <state>California</state>
  <accessId>USCOURTS-caed-1_12-cv-00185-1</accessId>
  <sequenceNumber>1</sequenceNumber>
  <dateIssued>2013-01-03</dateIssued>
  <docketText>ORDER Denying Plaintiff's 16 Motion to Strike Affirmative Defenses of Defendant Claudia Ramirez, signed by Magistrate Judge Sandra M. Snyder on 1/2/2013. (Gaumnitz, R)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-caed-1_12-cv-00185-2" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-2/mods.xml">
 <titleInfo>
  <title>G&G Closed Circuit Events, LLC v. Ramirez et al</title>
  <subTitle>ORDER SETTING ASIDE Default of Defendant Aquiles Ramirez signed by Magistrate Judge Sandra M. Snyder on 1/2/2013. (Sant Agata, S)</subTitle>
  <partNumber>2</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2013-01-03</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-caed-1_12-cv-00185-2.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee183a935ab</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-2</identifier>
 <identifier type="former granule identifier">caed-1_12-cv-00185_2.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-2/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-1_12-cv-00185/pdf/USCOURTS-caed-1_12-cv-00185-2.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:12-cv-00185; G&G Closed Circuit Events, LLC v. Ramirez et al; </searchTitle>
  <courtName>United States District Court Eastern District of California</courtName>
  <state>California</state>
  <accessId>USCOURTS-caed-1_12-cv-00185-2</accessId>
  <sequenceNumber>2</sequenceNumber>
  <dateIssued>2013-01-03</dateIssued>
  <docketText>ORDER SETTING ASIDE Default of Defendant Aquiles Ramirez signed by Magistrate Judge Sandra M. Snyder on 1/2/2013. (Sant Agata, S)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-caed-1_12-cv-00185-3" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-3/mods.xml">
 <titleInfo>
  <title>G&G Closed Circuit Events, LLC v. Ramirez et al</title>
  <subTitle>STIPULATION Of Dismissal Of Plaintiff's Complaint Against Defendants Claudia Ramirez And Aquiles Ramirez, individually and d/b/a Cazadores Grill, ORDER, signed by District Judge Anthony W. Ishii on 1/11/2013. CASE CLOSED.(Fahrney, E)</subTitle>
  <partNumber>3</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2013-01-11</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-caed-1_12-cv-00185-3.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee183a935a9</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-3</identifier>
 <identifier type="former granule identifier">caed-1_12-cv-00185_3.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-1_12-cv-00185/USCOURTS-caed-1_12-cv-00185-3/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-1_12-cv-00185/pdf/USCOURTS-caed-1_12-cv-00185-3.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:12-cv-00185; G&G Closed Circuit Events, LLC v. Ramirez et al; </searchTitle>
  <courtName>United States District Court Eastern District of California</courtName>
  <state>California</state>
  <accessId>USCOURTS-caed-1_12-cv-00185-3</accessId>
  <sequenceNumber>3</sequenceNumber>
  <dateIssued>2013-01-11</dateIssued>
  <docketText>STIPULATION Of Dismissal Of Plaintiff's Complaint Against Defendants Claudia Ramirez And Aquiles Ramirez, individually and d/b/a Cazadores Grill, ORDER, signed by District Judge Anthony W. Ishii on 1/11/2013. CASE CLOSED.(Fahrney, E)</docketText>
</extension>
</relatedItem>
</mods>


text:
using System.Collections.Generic;

using Amazon.SimpleEmail.Model;
using Amazon.Runtime.Internal.Transform;

namespace Amazon.SimpleEmail.Model.Internal.MarshallTransformations
{
     /// <summary>
     ///   VerifyEmailIdentityResult Unmarshaller
     /// </summary>
    internal class VerifyEmailIdentityResultUnmarshaller : IUnmarshaller<VerifyEmailIdentityResult, XmlUnmarshallerContext>, IUnmarshaller<VerifyEmailIdentityResult, JsonUnmarshallerContext>
    {
        public VerifyEmailIdentityResult Unmarshall(XmlUnmarshallerContext context)
        {
            VerifyEmailIdentityResult verifyEmailIdentityResult = new VerifyEmailIdentityResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;

            if (context.IsStartOfDocument)
               targetDepth += 2;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return verifyEmailIdentityResult;
                }
            }

            return verifyEmailIdentityResult;
        }

        public VerifyEmailIdentityResult Unmarshall(JsonUnmarshallerContext context)
        {
            return null;
        }

        private static VerifyEmailIdentityResultUnmarshaller instance;

        public static VerifyEmailIdentityResultUnmarshaller GetInstance()
        {
            if (instance == null)
               instance = new VerifyEmailIdentityResultUnmarshaller();

            return instance;
        }
    }
}


text:
#include "third_party/blink/renderer/core/css/css_computed_style_declaration.h"

#include "base/memory/values_equivalent.h"
#include "third_party/blink/renderer/core/css/computed_style_css_value_mapping.h"
#include "third_party/blink/renderer/core/css/css_identifier_value.h"
#include "third_party/blink/renderer/core/css/css_primitive_value.h"
#include "third_party/blink/renderer/core/css/css_primitive_value_mappings.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/css/css_selector.h"
#include "third_party/blink/renderer/core/css/css_variable_data.h"
#include "third_party/blink/renderer/core/css/parser/css_parser.h"
#include "third_party/blink/renderer/core/css/parser/css_selector_parser.h"
#include "third_party/blink/renderer/core/css/properties/css_property_ref.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/pseudo_element.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/html_frame_owner_element.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"

namespace blink {

namespace {

CSSValueID CssIdentifierForFontSizeKeyword(int keyword_size) {
  DCHECK_NE(keyword_size, 0);
  DCHECK_LE(keyword_size, 8);
  return static_cast<CSSValueID>(static_cast<int>(CSSValueID::kXxSmall) +
                                 keyword_size - 1);
}

void LogUnimplementedPropertyID(const CSSProperty& property) {
  DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, property_id_set, ());
  if (property.PropertyID() == CSSPropertyID::kVariable)
    return;
  if (!property_id_set.insert(property.PropertyID()).is_new_entry)
    return;

  DLOG(ERROR) << "Blink does not yet implement getComputedStyle for '"
              << property.GetPropertyName() << "'.";
}

}  // namespace

const Vector<const CSSProperty*>&
CSSComputedStyleDeclaration::ComputableProperties(
    const ExecutionContext* execution_context) {
  DEFINE_STATIC_LOCAL(Vector<const CSSProperty*>, properties, ());
  if (properties.IsEmpty()) {
    CSSProperty::FilterWebExposedCSSPropertiesIntoVector(
        execution_context, kCSSComputableProperties,
        std::size(kCSSComputableProperties), properties);
  }
  return properties;
}

CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(
    Node* n,
    bool allow_visited_style,
    const String& pseudo_element_name)
    : CSSStyleDeclaration(n ? n->GetExecutionContext() : nullptr),
      node_(n),
      pseudo_element_specifier_(
          CSSSelectorParser::ParsePseudoElement(pseudo_element_name, n)),
      allow_visited_style_(allow_visited_style) {
  pseudo_argument_ =
      PseudoElementHasArguments(pseudo_element_specifier_)
          ? CSSSelectorParser::ParsePseudoElementArgument(pseudo_element_name)
          : g_null_atom;
}

CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration() = default;

String CSSComputedStyleDeclaration::cssText() const {
  // CSSStyleDeclaration.cssText should return empty string for computed style.
  return String();
}

void CSSComputedStyleDeclaration::setCSSText(const ExecutionContext*,
                                             const String&,
                                             ExceptionState& exception_state) {
  exception_state.ThrowDOMException(
      DOMExceptionCode::kNoModificationAllowedError,
      "These styles are computed, and therefore read-only.");
}

const CSSValue*
CSSComputedStyleDeclaration::GetFontSizeCSSValuePreferringKeyword() const {
  if (!node_)
    return nullptr;

  node_->GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kEditing);

  const ComputedStyle* style =
      node_->EnsureComputedStyle(pseudo_element_specifier_);
  if (!style)
    return nullptr;

  if (int keyword_size = style->GetFontDescription().KeywordSize()) {
    return CSSIdentifierValue::Create(
        CssIdentifierForFontSizeKeyword(keyword_size));
  }

  return ZoomAdjustedPixelValue(style->GetFontDescription().ComputedPixelSize(),
                                *style);
}

bool CSSComputedStyleDeclaration::IsMonospaceFont() const {
  if (!node_)
    return false;

  const ComputedStyle* style =
      node_->EnsureComputedStyle(pseudo_element_specifier_);
  if (!style)
    return false;

  return style->GetFontDescription().IsMonospace();
}
const ComputedStyle* CSSComputedStyleDeclaration::ComputeComputedStyle() const {
  Node* styled_node = StyledNode();
  DCHECK(styled_node);
  const ComputedStyle* style = styled_node->EnsureComputedStyle(
      styled_node->IsPseudoElement() ? kPseudoIdNone
                                     : pseudo_element_specifier_,
      pseudo_argument_);
  if (style && style->IsEnsuredOutsideFlatTree()) {
    UseCounter::Count(node_->GetDocument(),
                      WebFeature::kGetComputedStyleOutsideFlatTree);
  }
  return style;
}

const Vector<AtomicString>* CSSComputedStyleDeclaration::GetVariableNames()
    const {
  if (auto* style = ComputeComputedStyle())
    return &style->GetVariableNames();
  return nullptr;
}

wtf_size_t CSSComputedStyleDeclaration::GetVariableNamesCount() const {
  if (auto* style = ComputeComputedStyle())
    return style->GetVariableNamesCount();
  return 0;
}

Node* CSSComputedStyleDeclaration::StyledNode() const {
  if (!node_)
    return nullptr;

  if (auto* node_element = DynamicTo<Element>(node_.Get())) {
    if (PseudoElement* element =
            node_element->GetPseudoElement(pseudo_element_specifier_))
      return element;
  }
  return node_.Get();
}

LayoutObject* CSSComputedStyleDeclaration::StyledLayoutObject() const {
  auto* node = StyledNode();
  if (!node)
    return nullptr;

  if (pseudo_element_specifier_ != kPseudoIdNone && node == node_.Get())
    return nullptr;

  return node->GetLayoutObject();
}

const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValue(
    CSSPropertyID property_id) const {
  if (property_id == CSSPropertyID::kVariable) {
    // TODO(https://crbug.com/980160): Disallow calling this function with
    // kVariable.
    return nullptr;
  }
  return GetPropertyCSSValue(CSSPropertyName(property_id));
}

const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValue(
    const AtomicString& custom_property_name) const {
  return GetPropertyCSSValue(CSSPropertyName(custom_property_name));
}

HeapHashMap<AtomicString, Member<const CSSValue>>
CSSComputedStyleDeclaration::GetVariables() const {
  const ComputedStyle* style = ComputeComputedStyle();
  if (!style)
    return {};
  DCHECK(StyledNode());
  return ComputedStyleCSSValueMapping::GetVariables(
      *style, StyledNode()->GetDocument().GetPropertyRegistry());
}

void CSSComputedStyleDeclaration::UpdateStyleAndLayoutTreeIfNeeded(
    const CSSPropertyName* property_name) const {
  Node* styled_node = StyledNode();
  if (!styled_node)
    return;

  Document& document = styled_node->GetDocument();

  if (HTMLFrameOwnerElement* owner = document.LocalOwner()) {
    // We are inside an iframe. If any of our ancestor iframes needs a style
    // and/or layout update, we need to make that up-to-date to resolve viewport
    // media queries and generate boxes as we might be moving to/from
    // display:none in some element in the chain of ancestors.
    //
    // TODO(futhark@chromium.org): There is an open question what the computed
    // style should be in a display:none iframe. If the property we are querying
    // is not layout dependent, we will not update the iframe layout box here.
    bool is_for_layout_dependent_property =
        property_name && !property_name->IsCustomProperty() &&
        CSSProperty::Get(property_name->Id()).IsLayoutDependentProperty();
    if (is_for_layout_dependent_property) {
      owner->GetDocument().UpdateStyleAndLayout(
          DocumentUpdateReason::kJavaScript);
      // The style recalc could have caused the styled node to be discarded or
      // replaced if it was a PseudoElement so we need to update it.
      styled_node = StyledNode();
    }
  }

  document.UpdateStyleAndLayoutTreeForNode(styled_node);
}

void CSSComputedStyleDeclaration::UpdateStyleAndLayoutIfNeeded(
    const CSSProperty* property) const {
  Node* styled_node = StyledNode();
  if (!styled_node)
    return;

  bool is_for_layout_dependent_property =
      property && property->IsLayoutDependent(styled_node->GetComputedStyle(),
                                              StyledLayoutObject());

  if (is_for_layout_dependent_property) {
    styled_node->GetDocument().UpdateStyleAndLayoutForNode(
        styled_node, DocumentUpdateReason::kJavaScript);
  }
}

const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValue(
    const CSSPropertyName& property_name) const {
  Node* styled_node = StyledNode();
  if (!styled_node)
    return nullptr;

  UpdateStyleAndLayoutTreeIfNeeded(&property_name);

  CSSPropertyRef ref(property_name, styled_node->GetDocument());
  if (!ref.IsValid())
    return nullptr;
  const CSSProperty& property_class = ref.GetProperty();

  UpdateStyleAndLayoutIfNeeded(&property_class);

  const ComputedStyle* style = ComputeComputedStyle();

  if (!style)
    return nullptr;

  const CSSValue* value = property_class.CSSValueFromComputedStyle(
      *style, StyledLayoutObject(), allow_visited_style_);
  if (value)
    return value;

  LogUnimplementedPropertyID(property_class);
  return nullptr;
}

String CSSComputedStyleDeclaration::GetPropertyValue(
    CSSPropertyID property_id) const {
  const CSSValue* value = GetPropertyCSSValue(property_id);
  if (value)
    return value->CssText();
  return "";
}

unsigned CSSComputedStyleDeclaration::length() const {
  if (!node_ || !node_->InActiveDocument())
    return 0;

  wtf_size_t variable_count = 0;

  if (RuntimeEnabledFeatures::CSSEnumeratedCustomPropertiesEnabled()) {
    UpdateStyleAndLayoutTreeIfNeeded(nullptr /* property_name */);
    UpdateStyleAndLayoutIfNeeded(nullptr /* property */);
    variable_count = GetVariableNamesCount();
  }

  return ComputableProperties(GetExecutionContext()).size() + variable_count;
}

String CSSComputedStyleDeclaration::item(unsigned i) const {
  if (i >= length())
    return "";

  const auto& standard_names = ComputableProperties(GetExecutionContext());

  if (i < standard_names.size())
    return standard_names[i]->GetPropertyNameString();

  DCHECK(RuntimeEnabledFeatures::CSSEnumeratedCustomPropertiesEnabled());
  DCHECK(GetVariableNames());
  const auto& variable_names = *GetVariableNames();
  CHECK_LT(i - standard_names.size(), variable_names.size());

  return variable_names[i - standard_names.size()];
}

bool CSSComputedStyleDeclaration::CssPropertyMatches(
    CSSPropertyID property_id,
    const CSSValue& property_value) const {
  if (property_id == CSSPropertyID::kFontSize &&
      (property_value.IsPrimitiveValue() ||
       property_value.IsIdentifierValue()) &&
      node_) {
    // This is only used by editing code.
    node_->GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kEditing);
    const ComputedStyle* style =
        node_->EnsureComputedStyle(pseudo_element_specifier_);
    if (style && style->GetFontDescription().KeywordSize()) {
      CSSValueID size_value = CssIdentifierForFontSizeKeyword(
          style->GetFontDescription().KeywordSize());
      auto* identifier_value = DynamicTo<CSSIdentifierValue>(property_value);
      if (identifier_value && identifier_value->GetValueID() == size_value)
        return true;
    }
  }
  const CSSValue* value = GetPropertyCSSValue(property_id);
  return base::ValuesEquivalent(value, &property_value);
}

MutableCSSPropertyValueSet* CSSComputedStyleDeclaration::CopyProperties()
    const {
  return CopyPropertiesInSet(ComputableProperties(GetExecutionContext()));
}

MutableCSSPropertyValueSet* CSSComputedStyleDeclaration::CopyPropertiesInSet(
    const Vector<const CSSProperty*>& properties) const {
  HeapVector<CSSPropertyValue, 256> list;
  list.ReserveInitialCapacity(properties.size());
  for (unsigned i = 0; i < properties.size(); ++i) {
    CSSPropertyName name = properties[i]->GetCSSPropertyName();
    const CSSValue* value = GetPropertyCSSValue(name);
    if (value)
      list.push_back(CSSPropertyValue(name, *value, false));
  }
  return MakeGarbageCollected<MutableCSSPropertyValueSet>(list.data(),
                                                          list.size());
}

CSSRule* CSSComputedStyleDeclaration::parentRule() const {
  return nullptr;
}

String CSSComputedStyleDeclaration::getPropertyValue(
    const String& property_name) {
  CSSPropertyID property_id =
      CssPropertyID(GetExecutionContext(), property_name);
  if (!IsValidCSSPropertyID(property_id))
    return String();
  if (property_id == CSSPropertyID::kVariable) {
    const CSSValue* value = GetPropertyCSSValue(AtomicString(property_name));
    if (value)
      return value->CssText();
    return String();
  }
#if DCHECK_IS_ON
  DCHECK(CSSProperty::Get(property_id).IsEnabled());
#endif
  return GetPropertyValue(property_id);
}

String CSSComputedStyleDeclaration::getPropertyPriority(const String&) {
  // All computed styles have a priority of not "important".
  return "";
}

String CSSComputedStyleDeclaration::GetPropertyShorthand(const String&) {
  return "";
}

bool CSSComputedStyleDeclaration::IsPropertyImplicit(const String&) {
  return false;
}

void CSSComputedStyleDeclaration::setProperty(const ExecutionContext*,
                                              const String& name,
                                              const String&,
                                              const String&,
                                              ExceptionState& exception_state) {
  exception_state.ThrowDOMException(
      DOMExceptionCode::kNoModificationAllowedError,
      "These styles are computed, and therefore the '" + name +
          "' property is read-only.");
}

String CSSComputedStyleDeclaration::removeProperty(
    const String& name,
    ExceptionState& exception_state) {
  exception_state.ThrowDOMException(
      DOMExceptionCode::kNoModificationAllowedError,
      "These styles are computed, and therefore the '" + name +
          "' property is read-only.");
  return String();
}

const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValueInternal(
    CSSPropertyID property_id) {
  return GetPropertyCSSValue(property_id);
}

const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValueInternal(
    const AtomicString& custom_property_name) {
  DCHECK_EQ(CSSPropertyID::kVariable,
            CssPropertyID(GetExecutionContext(), custom_property_name));
  return GetPropertyCSSValue(custom_property_name);
}

String CSSComputedStyleDeclaration::GetPropertyValueInternal(
    CSSPropertyID property_id) {
  return GetPropertyValue(property_id);
}

void CSSComputedStyleDeclaration::SetPropertyInternal(
    CSSPropertyID id,
    const String&,
    const String&,
    bool,
    SecureContextMode,
    ExceptionState& exception_state) {
  exception_state.ThrowDOMException(
      DOMExceptionCode::kNoModificationAllowedError,
      "These styles are computed, and therefore the '" +
          CSSUnresolvedProperty::Get(id).GetPropertyNameString() +
          "' property is read-only.");
}

void CSSComputedStyleDeclaration::Trace(Visitor* visitor) const {
  visitor->Trace(node_);
  CSSStyleDeclaration::Trace(visitor);
}

}  // namespace blink


text:
<?php

declare(strict_types=1);

namespace Mcfedr\QueueManagerBundle\Manager;

/**
 * @internal
 */
trait SqsClientTrait
{
    private string $defaultUrl;

    /**
     * @var string[]
     */
    private array $queues;

    private function setOptions(array $options): void
    {
        $this->defaultUrl = $options['default_url'];
        $this->queues = $options['queues'];
        if (!\array_key_exists('default', $this->queues)) {
            $this->queues['default'] = $this->defaultUrl;
        }
    }
}


text:
import React from "react";
import classes from "../style-guide.scss";

const Typography = () => (
  <div className={`${classes.wrapper} ${classes.typographySection}`}>

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5

Heading 6

      This is a paragraph using "Roboto Light" (Currently our default font weight) with italic, underlined and bold{" "}
      text.

      This is a paragraph using "Roboto Regular" with italic, underlined and bold{" "}
      text.

);

export default Typography;


text:
#if !defined(CETTY_HANDLER_CODEC_HTTP_HTTPMESSAGE_H)
#define CETTY_HANDLER_CODEC_HTTP_HTTPMESSAGE_H

/*
 * Copyright (c) 2010-2011 frankee zhou (frankee.zhou at gmail dot com)
 * Distributed under under the Apache License, version 2.0 (the "License").
 */

#include "cetty/util/ReferenceCounter.h"
#include "cetty/buffer/ChannelBuffer.h"
#include "cetty/handler/codec/http/HttpHeader.h"

namespace cetty { namespace handler { namespace codec { namespace http {

using namespace cetty::buffer;

class HttpHeader;
class HttpVersion;

/**
 * An HTTP message which provides common properties for {@link HttpRequest} and
 * {@link HttpResponse}.
 *
 *
 * @author Andy Taylor (andy.taylor@jboss.org)
 * @author Trustin Lee
 * @author Frankee Zhou
 *
 * @see HttpHeaders
 *
 * @apiviz.landmark
 * @apiviz.has org.jboss.netty.handler.codec.http.HttpChunk oneway - - is followed by
 */

class HttpMessage : public cetty::util::ReferenceCounter<HttpMessage> {
public:
    typedef HttpHeader::IntList       IntList;
    typedef HttpHeader::StringList    StringList;
    typedef HttpHeader::NameValueList NameValueList;

public:
    virtual ~HttpMessage() {}

    /**
     * Returns the http Header of this message.
     */
    virtual HttpHeader& header() = 0;

	/**
     * Returns the http Header of this message.
     */
    virtual const HttpHeader& header() const = 0;

    /**
     * Returns the header value with the specified header name.  If there are
     * more than one header value for the specified header name, the first
     * value is returned.
     *
     * @return the header value or <tt>null</tt> if there is no such header
     *
     */
    virtual const std::string& getHeader(const std::string& name) const = 0;

    /**
     * Returns the header values with the specified header name.
     *
     * @return the {@link List} of header values.  An empty list if there is no
     *         such header.
     */
    virtual StringList getHeaders(const std::string& name) const = 0;

	/**
     * Get the header values with the specified header name.
	 *
	 * @param name the specified header name
	 * @param header the {@link StringList} of header values.
	 *               An empty list if there is no such header.
     *
     */
    virtual void getHeaders(const std::string& name, StringList& headers) const = 0;

    /**
     * Returns the all header names and values that this message contains.
     *
     * @return the {@link List} of the header name-value pairs.  An empty list
     *         if there is no header in this message.
     */
    virtual NameValueList getHeaders() const = 0;

	/**
     * Get the all header names and values that this message contains.
     *
     * @param nameValues The {@link NameValueList} of the header name-value pairs.
	 *                   An empty list if there is no header in this message.
     */
    virtual void getHeaders(NameValueList& nameValues) const = 0;

    /**
     * Returns <tt>true</tt> if and only if there is a header with the specified
     * header name.
     */
    virtual bool containsHeader(const std::string& name) const = 0;

    /**
     * Returns the {@link Set} of all header names that this message contains.
     */
    virtual StringList getHeaderNames() const = 0;

	/**
     * Get the {@link StringList} of all header names that this message contains.
     */
    virtual void getHeaderNames(StringList& names) const = 0;

    /**
     * Adds a new header with the specified name and string value.
     */
    virtual void addHeader(const std::string& name, const std::string& value) = 0;

	/**
     * Adds a new header with the specified name and int value.
     */
    virtual void addHeader(const std::string& name, int value) = 0;

    /**
     * Sets a new header with the specified name and value.  If there is an
     * existing header with the same name, the existing header is removed.
     */
    virtual void setHeader(const std::string& name, const std::string& value) = 0;

	/**
     * Sets a new header with the specified name and value.  If there is an
     * existing header with the same name, the existing header is removed.
     */
    virtual void setHeader(const std::string& name, int value) = 0;

    /**
     * Sets a new header with the specified name and values.  If there is an
     * existing header with the same name, the existing header is removed.
     */
    virtual void setHeader(const std::string& name, const StringList& values) = 0;

	/**
     * Sets a new header with the specified name and values.  If there is an
     * existing header with the same name, the existing header is removed.
     */
    virtual void setHeader(const std::string& name, const IntList& values) = 0;

    /**
     * Removes the header with the specified name.
     */
    virtual void removeHeader(const std::string& name) = 0;

    /**
     * Removes the header with the specified name and value.
     * If only one value with the name, then move the name item completely,
     * otherwise only remove the value.
     */
    virtual void removeHeader(const std::string& name, const std::string& value) = 0;

    /**
     * Removes all headers from this message.
     */
    virtual void clearHeaders() = 0;

    /**
     * Returns the protocol version of this message.
     */
    virtual const HttpVersion& getProtocolVersion() const = 0;

    /**
     * Sets the protocol version of this message.
     */
    virtual void setProtocolVersion(const HttpVersion& version) = 0;

    /**
     * Returns the content of this message.  If there is no content or
     * {@link #isChunked()} returns <tt>true</tt>, an
     * {@link ChannelBuffers#EMPTY_BUFFER} is returned.
     */
    virtual const ChannelBufferPtr& getContent() const = 0;

    /**
     * Sets the content of this message.  If <tt>null</tt> is specified,
     * the content of this message will be set to {@link ChannelBuffers#EMPTY_BUFFER}.
     */
    virtual void setContent(const ChannelBufferPtr& content) = 0;

    /**
     * Returns <tt>true</tt> if and only if this message does not have any
     * content but the {@link HttpChunk}s, which is generated by
     * {@link HttpMessageDecoder} consecutively, contain the actual content.
     *

     * Please note that this method will keep returning <tt>true</tt> if the
     * <tt>"Transfer-Encoding"</tt> of this message is <tt>"chunked"</tt>, even if
     * you attempt to override this property by calling {@link #setChunked(bool)}
     * with <tt>false</tt>.
     */
    virtual bool isChunked() const = 0;

    /**
     * Sets if this message does not have any content but the
     * {@link HttpChunk}s, which is generated by {@link HttpMessageDecoder}
     * consecutively, contain the actual content.
     *

     * If this method is called with <tt>true</tt>, the content of this message
     * becomes {@link ChannelBuffers#EMPTY_BUFFER}.
     *

     * Even if this method is called with <tt>false</tt>, {@link #isChunked()}
     * will keep returning <tt>true</tt> if the <tt>"Transfer-Encoding"</tt> of
     * this message is <tt>"chunked"</tt>.
     */
    virtual void setChunked(bool chunked) = 0;

    virtual std::string toString() const = 0;
};

typedef boost::intrusive_ptr<HttpMessage> HttpMessagePtr;

}}}}

#endif //#if !defined(CETTY_HANDLER_CODEC_HTTP_HTTPMESSAGE_H)


text:
package com.intellij.psi.impl;

import consulo.util.dataholder.Key;
import com.intellij.psi.PsiFile;

public interface PsiFileEx extends PsiFile{
  Key<Boolean> BATCH_REFERENCE_PROCESSING = Key.create("BATCH_REFERENCE_PROCESSING");

  boolean isContentsLoaded();
  void onContentReload();

  void markInvalidated();
}


text:
package com.talvish.tales.system.alerts;
//
public class AlertState {
//	// the associated rule
//	// the length of time the various levels have successfully fired
//	// the values in the rule being shown, and what they ahve been at each measurement point
//	// maybe make them fixed size so that we aren't continually adding/removing data at runtime
//
//	// do we have different modes as well
//
//	// this really isn't about alerts, this is about status, but woudl be used internally as well (or externally
//	// can we maek it so the evaluation can be had both from internal data
//	// as well as from reading the data from the status pages, so we can do what we want, internal or external
//
//	// do we store the monitoring interval (each item can be done at differnet rates)
//
//
//	// so 'alert blocks' are really just the state of hte alert rules
//	//
//
//
}