text:
'use strict';

const _ = require('lodash');
const AbstractConnectionManager = require('../abstract/connection-manager');
const SequelizeErrors = require('../../errors');
const Utils = require('../../utils');
const DataTypes = require('../../data-types').mysql;
const momentTz = require('moment-timezone');
const debug = Utils.getLogger().debugContext('connection:mysql');
const parserMap = new Map();

/**
 * MySQL Connection Managger
 *
 * Get connections, validate and disconnect them.
 * AbstractConnectionManager pooling use it to handle MySQL specific connections
 * Use https://github.com/sidorares/node-mysql2 to connect with MySQL server
 *
 * @extends AbstractConnectionManager
 * @return Class<ConnectionManager>
 * @private
 */

class ConnectionManager extends AbstractConnectionManager {
  constructor(dialect, sequelize) {
    super(dialect, sequelize);

    this.sequelize = sequelize;
    this.sequelize.config.port = this.sequelize.config.port || 3306;
    try {
      if (sequelize.config.dialectModulePath) {
        this.lib = require(sequelize.config.dialectModulePath);
      } else {
        this.lib = require('mysql2');
      }
    } catch (err) {
      if (err.code === 'MODULE_NOT_FOUND') {
        throw new Error('Please install mysql2 package manually');
      }
      throw err;
    }

    this.refreshTypeParser(DataTypes);
  }

  // Update parsing when the user has added additional, custom types
  _refreshTypeParser(dataType) {
    for (const type of dataType.types.mysql) {
      parserMap.set(type, dataType.parse);
    }
  }

  _clearTypeParser() {
    parserMap.clear();
  }

  static _typecast(field, next) {
    if (parserMap.has(field.type)) {
      return parserMap.get(field.type)(field, this.sequelize.options, next);
    }
    return next();
  }

  /**
   * Connect with MySQL database based on config, Handle any errors in connection
   * Set the pool handlers on connection.error
   * Also set proper timezone once conection is connected
   *
   * @return Promise<Connection>
   * @private
   */
  connect(config) {
    const connectionConfig = {
      host: config.host,
      port: config.port,
      user: config.username,
      flags: '-FOUND_ROWS',
      password: config.password,
      database: config.database,
      timezone: this.sequelize.options.timezone,
      typeCast: ConnectionManager._typecast.bind(this),
      bigNumberStrings: false,
      supportBigNumbers: true
    };

    if (config.dialectOptions) {
      for (const key of Object.keys(config.dialectOptions)) {
        // JSC : on utilise maxRows dans sequelize, pas besoin de le passer au connecteur mysql: on évite un warning/erreur
        if (key !== 'maxRows') {
          connectionConfig[key] = config.dialectOptions[key];
        }
      }
    }

    // set timezone for this connection
    // but named timezone are not directly supported in mysql, so get its offset first
    let tzOffset = this.sequelize.options.timezone;
    tzOffset = /\//.test(tzOffset) ? momentTz.tz(tzOffset).format('Z') : tzOffset;
    connectionConfig.timezone = tzOffset;
    return new Utils.Promise((resolve, reject) => {
      const connection = this.lib.createConnection(connectionConfig);

      const errorHandler = e => {
        // clean up connect event if there is error
        connection.removeListener('connect', connectHandler);

        if (config.pool.handleDisconnects) {
          debug(`connection error ${e.code}`);

          if (e.code === 'PROTOCOL_CONNECTION_LOST') {
            this.pool.destroy(connection)
              .catch(/Resource not currently part of this pool/, () => {});
            return;
          }
        }

        connection.removeListener('error', errorHandler);
        reject(e);
      };

      const connectHandler = () => {
        if (!config.pool.handleDisconnects) {
          // clean up error event if connected
          connection.removeListener('error', errorHandler);
        }
        resolve(connection);
      };

      connection.on('error', errorHandler);
      connection.once('connect', connectHandler);
    })
      .tap (() => { debug('connection acquired'); })
      .then(connection => {
        return new Utils.Promise((resolve, reject) => {
          connection.query(`SET time_zone = '${tzOffset}'`, err => {
            if (err) { reject(err); } else { resolve(connection); }
          });
        });
      })
      .catch(err => {
        switch (err.code) {
          case 'ECONNREFUSED':
            throw new SequelizeErrors.ConnectionRefusedError(err);
          case 'ER_ACCESS_DENIED_ERROR':
            throw new SequelizeErrors.AccessDeniedError(err);
          case 'ENOTFOUND':
            throw new SequelizeErrors.HostNotFoundError(err);
          case 'EHOSTUNREACH':
            throw new SequelizeErrors.HostNotReachableError(err);
          case 'EINVAL':
            throw new SequelizeErrors.InvalidConnectionError(err);
          default:
            throw new SequelizeErrors.ConnectionError(err);
        }
      });
  }

  disconnect(connection) {
    // Dont disconnect connections with CLOSED state
    if (connection._closing) {
      debug('connection tried to disconnect but was already at CLOSED state');
      return Utils.Promise.resolve();
    }

    return new Utils.Promise((resolve, reject) => {
      connection.end(err => {
        if (err) {
          reject(new SequelizeErrors.ConnectionError(err));
        } else {
          debug('connection disconnected');
          resolve();
        }
      });
    });
  }

  validate(connection) {
    return connection && connection._fatalError === null && connection._protocolError === null && !connection._closing &&
      !connection.stream.destroyed;
  }
}

_.extend(ConnectionManager.prototype, AbstractConnectionManager.prototype);

module.exports = ConnectionManager;
module.exports.ConnectionManager = ConnectionManager;
module.exports.default = ConnectionManager;


text:
import os, sys, imp, time
from waflib import Context, Options, Configure, Utils, Logs, TaskGen, Task, Build, ConfigSet
import waflib.Tools.c

"""
Create a modified waf file in which tasks use timestamps only
see README.txt
"""

# we hard-code a configuration for c but it could be left in the script file too
def configure(conf):
	conf.load('gcc')

def recurse_rep(x, y):
	f = getattr(Context.g_module, x.cmd or x.fun, Utils.nada)
	return f(x)

def start(cwd, version, wafdir):
	# this is the entry point of our small build system

	Logs.init_log()
	Context.waf_dir = wafdir
	Context.out_dir = Context.top_dir = Context.run_dir = cwd
	Context.g_module = Context.load_module(cwd + os.sep + 'wscript')
	Context.g_module.configure = configure
	Context.g_module.root_path = cwd
	Context.Context.recurse = recurse_rep

	Context.g_module.top = Context.g_module.out = '.' # no build directory

	# just parse the options and execute a build
	Options.OptionsContext().execute()

	conf = Context.create_context('configure')
	conf.options = Options.options
	conf.execute()

	bld = Context.create_context('build')
	bld.env = conf.env
	bld.options = Options.options
	bld.environ = os.environ
	bld.execute()

# change the build context so it does not need to write any file
class StatelessBuild(Build.BuildContext):
	def load_envs(self):
		self.env = ConfigSet.ConfigSet()
	def store(self):
		pass
	def restore(self):
		self.init_dirs()
	def execute_build(self):
		# we override this method to hide the messages "leaving directory" (just because)
		self.recurse([self.run_dir])
		self.pre_build()

		self.timer = Utils.Timer()

		if Options.options.progress_bar:
			sys.stderr.write(Logs.colors.cursor_off)
		try:
			self.compile()
		finally:
			if Options.options.progress_bar:
				sys.stderr.write(Logs.colors.cursor_on)
				print('')
		self.post_build()

class SilentConf(Configure.ConfigurationContext):
	# silent configuration
	def __init__(self, **kw):
		# disable the configuration messages from Context.start_msg/end_msg
		self.in_msg = 1
		super(SilentConf, self).__init__(**kw)

	def execute(self):

		# copy-paste from the original method, but without the cache file creation
		self.init_dirs()

		path = os.path.join(self.bldnode.abspath(), 'config.log')
		self.logger = Logs.make_logger(path, 'cfg')

		app = getattr(Context.g_module, 'APPNAME', '')
		if app:
			ver = getattr(Context.g_module, 'VERSION', '')
			if ver:
				app = "%s (%s)" % (app, ver)

		now = time.ctime()
		pyver = sys.hexversion
		systype = sys.platform
		args = " ".join(sys.argv)
		wafver = Context.WAFVERSION
		abi = Context.ABI
		self.to_log(Configure.conf_template % vars())

		super(Configure.ConfigurationContext, self).execute()

# change the superclass of existing tasks to force timestamps (the build has no state)
def status(self):
	for t in self.run_after:
		if not t.hasrun:
			return Task.ASK_LATER

	implicit_deps = []
	try:
		implicit_deps, _ = self.scan()
	except:
		pass

	# we can add one more node, for example:
	implicit_deps.append(self.generator.path.make_node('wscript'))

	for x in self.inputs + self.dep_nodes + implicit_deps:
		for y in self.outputs:
			try:
				if os.stat(x.abspath()).st_mtime > os.stat(y.abspath()).st_mtime:
					return Task.RUN_ME
			except:
				return Task.RUN_ME

	return Task.SKIP_ME
Task.Task.runnable_status = status

# the post build execution does not need to deal with signatures or anything else
Task.Task.post_run = Utils.nada

redpajama_set_name: RedPajamaGithub


text:
package cmd

import (
	"bytes"
	"crypto/md5"
	"encoding/base64"
	"crypto/hmac"
	"crypto/sha1"
	"github.com/tsuru/config"
	"fmt"
	"regexp"
	"strings"
	"time"
)

const (
	X_Megam_EMAIL       = "X-Megam-EMAIL"
	X_Megam_APIKEY      = "X-Megam-APIKEY"
	X_Megam_DATE        = "X-Megam-DATE"
	X_Megam_HMAC        = "X-Megam-HMAC"
	API_GATEWAY_VERSION = "/v1"
	Content_Type               = "Content-Type"
	application_json           = "application/json"
	Accept                     = "Accept"
	application_vnd_megam_json = "application/vnd.megam+json"
)

type Authly struct {
	UrlSuffix string
	Date      string
	Email     string
	APIKey    string
	JSONBody  []byte
	AuthMap   map[string]string
}

func NewAuthly(urlsuffix string, jsonbody []byte) (*Authly, error) {
	email, err := config.GetString("api:email")

	if err != nil {
		return nil, fmt.Errorf("Failed to find the email (%s).", err)
	}

	api_key, err := config.GetString("api:api_key")

	if err != nil {
		return nil, fmt.Errorf("Failed to find the api_key (%s).", err)
	}

	return &Authly{
		UrlSuffix: urlsuffix,
		Date:      time.Now().Format(time.RFC850),
		Email:     email,
		APIKey:    api_key,
		JSONBody:  jsonbody,
		AuthMap:   map[string]string{},
	}, nil
}

func (authly *Authly) AuthHeader() error {
	timeStampedPath := authly.Date + "\n" + API_GATEWAY_VERSION + authly.UrlSuffix
	md5Body := ""
	if len(authly.JSONBody) > 0 {
		md5Body = GetMD5Hash(authly.JSONBody)
	}
	headMap := make(map[string]string)
	headMap[X_Megam_DATE] = authly.Date
	headMap[X_Megam_EMAIL] = authly.Email
	headMap[X_Megam_APIKEY] = authly.APIKey
	headMap[Accept] = application_vnd_megam_json
	headMap[X_Megam_HMAC] = authly.Email + ":" + CalcHMAC(authly.APIKey, (timeStampedPath+"\n"+md5Body))
	headMap["Content-Type"] = "application/json"
	authly.AuthMap = headMap
	return nil
}

func CalcHMAC(secret string, message string) string {
    key := []byte(secret)
    h := hmac.New(sha1.New, key)
    h.Write([]byte(message))
    sumh := h.Sum(nil)

    sumi := make([]string, len(sumh))
    for i := 0; i < len(sumh); i++ {
    	sumi[i] = ("00" + fmt.Sprintf("%x",(sumh[i] & 0xff)))
    	sumi[i]=sumi[i][len(sumi[i])-2: len(sumi[i])]
    }
    outs := strings.Join(sumi, "")
    return outs
  }

func GetMD5Hash(text []byte) string {
	hasher := md5.New()
	hasher.Write(text)
	return base64.StdEncoding.EncodeToString(hasher.Sum(nil))

}

func CalcBase64(data string) string {
	var buf bytes.Buffer
	encoder := base64.NewEncoder(base64.StdEncoding, &buf)
	encoder.Write([]byte(data))
	encoder.Close()
	return buf.String()
}

func GetURL(path string) (string, error) {
	var prefix string
	target, err := config.GetString("api:server")
	if err != nil {
		return "", err
	}
	if m, _ := regexp.MatchString("^https?://", target); !m {
		prefix = "http://"
	}
	return prefix + strings.TrimRight(target, "/") + strings.TrimRight(API_GATEWAY_VERSION, "/") + path, nil
}

/*
type ServiceModel struct {
	Service   string
	Instances []string
}

func ShowServicesInstancesList(b []byte) ([]byte, error) {
	var services []ServiceModel
	err := json.Unmarshal(b, &services)
	if err != nil {
		return []byte{}, err
	}
	if len(services) == 0 {
		return []byte{}, nil
	}
	table := NewTable()
	table.Headers = Row([]string{"Services", "Instances"})
	for _, s := range services {
		insts := strings.Join(s.Instances, ", ")
		r := Row([]string{s.Service, insts})
		table.AddRow(r)
	}
	return table.Bytes(), nil
}*/


text:
{{title}}<s></s>

        <form class="clearfix" (ngSubmit)="manualChargeList(1)">

            关键字
            <input type="text" name="searchItem"  [(ngModel)]="filterData.searchItem" placeholder="编号">

            业务类型
            <select-box [options]="financeFunction.MunualChargeTypeOptions"  (optionSelect)="filterData.type = $event"></select-box>

            状态
            <select-box [options]="financeFunction.MunualChargeStatusOptions" (optionSelect)="filterData.status = $event"></select-box>

          <button class="text-btn text-sub" type="submit">搜索</button>
        </form>

            编号
            充值管理员
            账户
            充值额度
            创建时间
            业务类型
            描述
            状态
            操作

            {{item.sn}}
            {{item.admin_name}}
            {{item.mobile}}
            {{item.quota}}
            {{item.create_time}}
            {{financeFunction.getMunualChargeType(item.type)}}
            {{item.described}}
            {{financeFunction.getManualChargeListStatus(item.status)}}

                审核
                复核

没有符合条件的数据

        <pagination-controls (pageChange)="manualChargeList($event)" previousLabel="上一页"
                             nextLabel="下一页"></pagination-controls>


text:
'use babel';

let InteractiveConfigurationPanel = null;
let RandomTipPanel = null;
let isInitialized = false

function initialize() {
  if (isInitialized) return
  atom.themes.requireStylesheet(require.resolve('../styles/user-support-helper.less'));

  isInitialied = true
}

function initializeInteractiveConfiguration() {
  initialize()

  if (InteractiveConfigurationPanel !== null) return ;
  InteractiveConfigurationPanel = require('./interactive-configuration-panel');
}
function initializeRandomTips() {
  initialize()

  if (RandomTipPanel !== null) return;
  RandomTipPanel = require('./random-tip-panel');
}

export default class UserSupportHelper {
  constructor() {
    this.tips = []
  }

  destroy() {
    if (this.configurationPanel !== null) {
      this.configurationPanel.destroy();
    }
    for (const tip of tips) tip.destory()
  }

  getInteractiveConfigurationPanel() {
    initializeInteractiveConfiguration();

    if (!this.configurationPanel) {
      this.configurationPanel = new InteractiveConfigurationPanel()
    }
    return this.configurationPanel;
  }

  createRandomTipPanel(configurationPrefix, words) {
    initializeRandomTips();

    const panel = new RandomTipPanel(configurationPrefix, words);
    this.tips.push(panel)

    return panel;
  }
};


text:
[![Build Status](https://github.com/PrismJS/prism-themes/workflows/CI/badge.svg)](https://github.com/PrismJS/prism-themes/actions)
[![npm](https://img.shields.io/npm/dw/prism-themes.svg)](https://www.npmjs.com/package/prism-themes)

This repository lists a selection of additional themes for the [Prism syntax highlighting library](http://prismjs.com/).

## How to use a theme

To use one of the themes, just include the theme's CSS file in your page. Example:

```html
<!DOCTYPE html>
<html>
    <head>
        ...
        <link href="themes/prism-ghcolors.css" rel="stylesheet" />
    </head>
    <body>
        ...
        <script src="prism.js"></script>
    </body>
</html>
```

## Contributing new themes

Please see our [Contributing guide](CONTRIBUTING.md) for details. Thank you for contributing!!

## Available themes

* [__CB__](themes/prism-cb.css) (originally by [C. Bavota](https://bitbucket.org/cbavota), adapted by [atelierbram](https://github.com/atelierbram))

[![CB](screenshots/prism-cb.png)](themes/prism-cb.css)

* [__GHColors__](themes/prism-ghcolors.css) (by [aviaryan](https://github.com/aviaryan))

[![GHColors](screenshots/prism-ghcolors.png)](themes/prism-ghcolors.css)

* [__Pojoaque__](themes/prism-pojoaque.css) (originally by [Jason Tate](http://web-cms-designs.com/ftopict-10-pojoaque-style-for-highlight-js-code-highlighter.html), adapted by [atelierbram](https://github.com/atelierbram))

[![Pojoaque](screenshots/prism-pojoaque.png)](themes/prism-pojoaque.css)

* [__Xonokai__](themes/prism-xonokai.css) (originally by [Maxime Thirouin (MoOx)](https://github.com/MoOx), adapted by [atelierbram](https://github.com/atelierbram))

[![Xonokai](screenshots/prism-xonokai.png)](themes/prism-xonokai.css)

* [__Ateliersulphurpool-light__](themes/prism-base16-ateliersulphurpool.light.css) (by [Bram de Haan](https://github.com/atelierbram))

[![Ateliersulphurpool-light](screenshots/prism-base16-ateliersulphurpool.light.png)](themes/prism-base16-ateliersulphurpool.light.css)

* [__Hopscotch__](themes/prism-hopscotch.css) (by [Jan T. Sott](https://github.com/idleberg))

[![Hopscotch](screenshots/prism-hopscotch.png)](themes/prism-hopscotch.css)

* [__Atom Dark__](themes/prism-atom-dark.css) (by [gibsjose](https://github.com/gibsjose), based on [Atom Dark Syntax theme](https://github.com/atom/atom-dark-syntax))

[![Atom Dark](screenshots/prism-atom-dark.png)](themes/prism-atom-dark.css)

* [__Duotone Dark__](themes/prism-duotone-dark.css) (by [Simurai](https://github.com/simurai), based on [Duotone Dark Syntax theme for Atom](https://github.com/simurai/duotone-dark-syntax))

[![Duotone Dark](screenshots/prism-duotone-dark.png)](themes/prism-duotone-dark.css)

* [__Duotone Sea__](themes/prism-duotone-sea.css) (by [Simurai](https://github.com/simurai), based on [DuoTone Dark Sea Syntax theme for Atom](https://github.com/simurai/duotone-dark-sea-syntax))

[![Duotone Sea](screenshots/prism-duotone-sea.png)](themes/prism-duotone-sea.css)

* [__Duotone Space__](themes/prism-duotone-space.css) (by [Simurai](https://github.com/simurai), based on [DuoTone Dark Space Syntax theme for Atom](https://github.com/simurai/duotone-dark-space-syntax))

[![Duotone Space](screenshots/prism-duotone-space.png)](themes/prism-duotone-space.css)

* [__Duotone Earth__](themes/prism-duotone-earth.css) (by [Simurai](https://github.com/simurai), based on [DuoTone Dark Earth Syntax theme for Atom](https://github.com/simurai/duotone-dark-earth-syntax))

[![Duotone Earth](screenshots/prism-duotone-earth.png)](themes/prism-duotone-earth.css)

* [__Duotone Forest__](themes/prism-duotone-forest.css) (by [Simurai](https://github.com/simurai), based on [DuoTone Dark Forest Syntax theme for Atom](https://github.com/simurai/duotone-dark-forest-syntax))

[![Duotone Forest](screenshots/prism-duotone-forest.png)](themes/prism-duotone-forest.css)

* [__Duotone Light__](themes/prism-duotone-light.css) (by [Simurai](https://github.com/simurai), based on [DuoTone Light Syntax theme](https://github.com/simurai/duotone-light-syntax))

[![Duotone Light](screenshots/prism-duotone-light.png)](themes/prism-duotone-light.css)

* [__VS__](themes/prism-vs.css) (by [andrewlock](https://github.com/andrewlock))

[![VS](screenshots/prism-vs.png)](themes/prism-vs.css)

* [__VS Code Dark+__](themes/prism-vsc-dark-plus.css) (by [tabuckner](https://github.com/tabuckner))

[![VS](screenshots/prism-vsc-dark-plus.png)](themes/prism-vsc-dark-plus.css)

* [__Darcula__](themes/prism-darcula.css) (by [service-paradis](https://github.com/service-paradis), based on Jetbrains' Darcula theme)

[![Darcula](screenshots/prism-darcula.png)](themes/prism-darcula.css)

* [__a11y Dark__](themes/prism-a11y-dark.css) (by [ericwbailey](https://github.com/ericwbailey))

[![a11y Dark](screenshots/prism-a11y-dark.png)](themes/prism-a11y-dark.css)

* [__Dracula__](themes/prism-dracula.css) (by [Byverdu](https://github.com/byverdu))

[![Dracula](screenshots/prism-dracula.png)](themes/prism-dracula.css)

* [__Synthwave '84__](themes/prism-synthwave84.css) (originally by [Robb Owen](https://github.com/robb0wen), adapted by [Marc Backes](https://github.com/themarcba))

[![Synthwave '84](screenshots/prism-synthwave84.png)](themes/prism-synthwave84.css)

* [__Shades of Purple__](themes/prism-shades-of-purple.css) (by [Ahmad Awais](https://github.com/ahmadawais))

[![Shades of Purple](screenshots/prism-shades-of-purple.png)](themes/prism-shades-of-purple.css)

* [__Material Dark__](themes/prism-material-dark.css) (by [dutchenkoOleg](https://github.com/dutchenkoOleg))

[![Material Dark](screenshots/prism-material-dark.png)](themes/prism-material-dark.css)

* [__Material Light__](themes/prism-material-light.css) (by [dutchenkoOleg](https://github.com/dutchenkoOleg))

[![Material Light](screenshots/prism-material-light.png)](themes/prism-material-light.css)

* [__Material Oceanic__](themes/prism-material-oceanic.css) (by [dutchenkoOleg](https://github.com/dutchenkoOleg))

[![Material Oceanic](screenshots/prism-material-oceanic.png)](themes/prism-material-oceanic.css)

* [__Nord__](themes/prism-nord.css) (originally by [Nord](https://www.nordtheme.com/), adapted by [Zane Hitchcox](https://github.com/zwhitchcox) and [Gabriel Ramos](https://github.com/gabrieluizramos))

[![Nord](screenshots/prism-nord.png)](themes/prism-nord.css)

* [__Coldark Cold__](themes/prism-coldark-cold.css) (by [Armand Philippot](https://github.com/ArmandPhilippot), based on [Coldark](https://github.com/ArmandPhilippot/coldark))

[![Coldark Cold](screenshots/prism-coldark-cold.png)](themes/prism-coldark-cold.css)

* [__Coldark Dark__](themes/prism-coldark-dark.css) (by [Armand Philippot](https://github.com/ArmandPhilippot), based on [Coldark](https://github.com/ArmandPhilippot/coldark))

[![Coldark Dark](screenshots/prism-coldark-dark.png)](themes/prism-coldark-dark.css)

* [__Coy without shadows__](themes/prism-coy-without-shadows.css) (by [RunDevelopment](https://github.com/RunDevelopment), based on Tim Shedor's Coy theme)

[![Coy without shadows](screenshots/prism-coy-without-shadows.png)](themes/prism-coy-without-shadows.css)

* [__Gruvbox Dark__](themes/prism-gruvbox-dark.css) (by [Azat S.](https://github.com/azat-io))

[![Gruvbox Dark](screenshots/prism-gruvbox-dark.png)](themes/prism-gruvbox-dark.css)

* [__Gruvbox Light__](themes/prism-gruvbox-light.css) (by [Michael Schnerring](https://github.com/schnerring))

[![Gruvbox Light](screenshots/prism-gruvbox-light.png)](themes/prism-gruvbox-light.css)

* [__Lucario__](themes/prism-lucario.css) (by [Christopher Kapic](https://github.com/christopher-kapic), based on [Raphael Amorim's](https://github.com/raphamorim) [Lucario Theme](https://github.com/raphamorim/lucario))

[![Lucario](screenshots/prism-lucario.png)](themes/prism-lucario.css)

* [__Night Owl__](themes/prism-night-owl.css) (by [Souvik Mandal](https://github.com/SimpleIndian), based on [Sarah Drasner's](https://github.com/sdras) [Night Owl Theme](https://github.com/sdras/night-owl-vscode-theme))

[![Night Owl](screenshots/prism-night-owl.png)](themes/prism-night-owl.css)

* [__Holi Theme__](themes/prism-holi-theme.css) (by [Ayush Saini](https://github.com/AyushSaini00), based on [Holi Theme for VS Code](https://github.com/AyushSaini00/holi-theme))

[![Holi Theme](screenshots/prism-holi-theme.png)](themes/prism-holi-theme.css)

* [__Z-Touch__](themes/prism-z-touch.css) (by [Zeel Codder](https://github.com/zeel-codder))

[![Z-Touch](screenshots/prism-z-touch.png)](themes/prism-z-touch.css)

* [__Solarized Dark Atom__](themes/prism-solarized-dark-atom.css) (by [Pranay Chauhan](https://github.com/PranayChauhan2516), based on [Solarized Dark Theme by Atom](https://github.com/atom/solarized-dark-syntax))

[![Solarized Dark Atom](screenshots/prism-solarized-dark-atom.png)](themes/prism-solarized-dark-atom.css)

* [__One Dark__](themes/prism-one-dark.css) (by [Hoon Wei Ting](https://github.com/hoonweiting), based on [Atom's One Dark Syntax](https://github.com/atom/atom/tree/master/packages/one-dark-syntax))

[![One Dark](screenshots/prism-one-dark.png)](themes/prism-one-dark.css)

* [__One Light__](themes/prism-one-light.css) (by [Hoon Wei Ting](https://github.com/hoonweiting), based on [Atom's One Light Syntax](https://github.com/atom/atom/tree/master/packages/one-light-syntax))

[![One Light](screenshots/prism-one-light.png)](themes/prism-one-light.css)

* [__Laserwave__](themes/prism-laserwave.css) (originally by [Jared Jones](https://github.com/Jaredk3nt), adapted by [Simon Jespersen](https://github.com/simjes))

[![Laserwave](screenshots/prism-laserwave.png)](themes/prism-laserwave.css)


text:
#ifndef _ACTIVE_TRANSPORT_FAILOVER_FAILOVERTRANSPORTFACTORY_H_
#define _ACTIVE_TRANSPORT_FAILOVER_FAILOVERTRANSPORTFACTORY_H_

#include <activemq/util/Config.h>

#include <activemq/transport/AbstractTransportFactory.h>
#include <activemq/transport/Transport.h>
#include <activemq/wireformat/WireFormat.h>
#include <decaf/net/URI.h>
#include <decaf/util/Properties.h>

namespace activemq {
namespace transport {
namespace failover {

    using decaf::lang::Pointer;

    /**
     * Creates an instance of a FailoverTransport.
     *
     * @since 3.0
     */
    class AMQCPP_API FailoverTransportFactory : public AbstractTransportFactory {
    public:

        virtual ~FailoverTransportFactory() {}

        virtual Pointer<Transport> create(const decaf::net::URI& location);

        virtual Pointer<Transport> createComposite(const decaf::net::URI& location);

    protected:

        virtual Pointer<Transport> doCreateComposite(const decaf::net::URI& location,
                                                     const decaf::util::Properties& properties);

    };

}}}

#endif /* _ACTIVE_TRANSPORT_FAILOVER_FAILOVERTRANSPORTFACTORY_H_ */


text:
package org.springframework.cloud.contract.spec.internal;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class QueryParameters {

	private List<QueryParameter> parameters = new LinkedList<QueryParameter>();

	public void parameter(Map<String, Object> singleParameter) {
		Iterator<Map.Entry<String, Object>> iterator = singleParameter.entrySet().iterator();
		if (iterator.hasNext()) {
			Map.Entry<String, Object> first = iterator.next();
			if (first != null) {
				parameters.add(QueryParameter.build(first.getKey(), first.getValue()));
			}
		}
	}

	public void parameter(String parameterName, Object parameterValue) {
		parameters.add(QueryParameter.build(parameterName, parameterValue));
	}

	public List<QueryParameter> getParameters() {
		return parameters;
	}

	public void setParameters(List<QueryParameter> parameters) {
		this.parameters = parameters;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		QueryParameters that = (QueryParameters) o;
		return Objects.equals(parameters, that.parameters);
	}

	@Override
	public int hashCode() {
		return Objects.hash(parameters);
	}

	@Override
	public String toString() {
		return "QueryParameters{" + "\nparameters=" + parameters + '}';
	}

}


text:
import cloneDeep from 'lodash.clonedeep';
import get from 'lodash.get';
import isEqual from 'lodash.isequal';
import set from 'lodash.set';
import forEachDeep from './forEachDeep';

export const PATH_SEPARATOR = '/';

function compact(list) {
    return Object.keys(list).filter((item) => {
        let keep = true;
        item.split(PATH_SEPARATOR).reduce((previous, next) => {
            const path = previous.concat(next);
            keep = !list[previous.join(PATH_SEPARATOR)];
            return path;
        }, []);

        return keep;
    });
}

export function findSimilarPaths(left, right) {
    const paths = {};
    forEachDeep(right, (rightValue, key, path) => {
        if (!isEqual(rightValue, get(left, path))) {
            return;
        }
        paths[path.join(PATH_SEPARATOR)] = true; // we do not use an array for performance issue
    });

    return compact(paths);
}

export default function compressObject(left, right, ref) {
    const output = cloneDeep(right);

    findSimilarPaths(left, output)
        .map(path => path.split(PATH_SEPARATOR))
        .map(path => set(output, path, ref));

    return output;
}


text:
#pragma once
#include <aws/elasticfilesystem/EFS_EXPORTS.h>
#include <aws/elasticfilesystem/EFSRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace Http
{
    class URI;
} //namespace Http
namespace EFS
{
namespace Model
{

  /*
  */
  class AWS_EFS_API DescribeMountTargetsRequest : public EFSRequest
  {
  public:
    DescribeMountTargetsRequest();
    Aws::String SerializePayload() const override;

    void AddQueryStringParameters(Aws::Http::URI& uri) const override;

    /*

Optional. Maximum number of mount targets to return in the response. It must be an integer with a value greater than zero.

    */
    inline long GetMaxItems() const{ return m_maxItems; }

    /*

Optional. Maximum number of mount targets to return in the response. It must be an integer with a value greater than zero.

    */
    inline void SetMaxItems(long value) { m_maxItemsHasBeenSet = true; m_maxItems = value; }

    /*

Optional. Maximum number of mount targets to return in the response. It must be an integer with a value greater than zero.

    */
    inline DescribeMountTargetsRequest& WithMaxItems(long value) { SetMaxItems(value); return *this;}

    /*

Optional. String. Opaque pagination token returned from a previous DescribeMountTargets operation. If present, it specifies to continue the list from where the previous returning call left off.

    */
    inline const Aws::String& GetMarker() const{ return m_marker; }

    /*

Optional. String. Opaque pagination token returned from a previous DescribeMountTargets operation. If present, it specifies to continue the list from where the previous returning call left off.

    */
    inline void SetMarker(const Aws::String& value) { m_markerHasBeenSet = true; m_marker = value; }

    /*

Optional. String. Opaque pagination token returned from a previous DescribeMountTargets operation. If present, it specifies to continue the list from where the previous returning call left off.

    */
    inline void SetMarker(Aws::String&& value) { m_markerHasBeenSet = true; m_marker = value; }

    /*

Optional. String. Opaque pagination token returned from a previous DescribeMountTargets operation. If present, it specifies to continue the list from where the previous returning call left off.

    */
    inline void SetMarker(const char* value) { m_markerHasBeenSet = true; m_marker.assign(value); }

    /*

Optional. String. Opaque pagination token returned from a previous DescribeMountTargets operation. If present, it specifies to continue the list from where the previous returning call left off.

    */
    inline DescribeMountTargetsRequest& WithMarker(const Aws::String& value) { SetMarker(value); return *this;}

    /*

Optional. String. Opaque pagination token returned from a previous DescribeMountTargets operation. If present, it specifies to continue the list from where the previous returning call left off.

    */
    inline DescribeMountTargetsRequest& WithMarker(Aws::String&& value) { SetMarker(value); return *this;}

    /*

Optional. String. Opaque pagination token returned from a previous DescribeMountTargets operation. If present, it specifies to continue the list from where the previous returning call left off.

    */
    inline DescribeMountTargetsRequest& WithMarker(const char* value) { SetMarker(value); return *this;}

    /*

String. The ID of the file system whose mount targets you want to list.

    */
    inline const Aws::String& GetFileSystemId() const{ return m_fileSystemId; }

    /*

String. The ID of the file system whose mount targets you want to list.

    */
    inline void SetFileSystemId(const Aws::String& value) { m_fileSystemIdHasBeenSet = true; m_fileSystemId = value; }

    /*

String. The ID of the file system whose mount targets you want to list.

    */
    inline void SetFileSystemId(Aws::String&& value) { m_fileSystemIdHasBeenSet = true; m_fileSystemId = value; }

    /*

String. The ID of the file system whose mount targets you want to list.

    */
    inline void SetFileSystemId(const char* value) { m_fileSystemIdHasBeenSet = true; m_fileSystemId.assign(value); }

    /*

String. The ID of the file system whose mount targets you want to list.

    */
    inline DescribeMountTargetsRequest& WithFileSystemId(const Aws::String& value) { SetFileSystemId(value); return *this;}

    /*

String. The ID of the file system whose mount targets you want to list.

    */
    inline DescribeMountTargetsRequest& WithFileSystemId(Aws::String&& value) { SetFileSystemId(value); return *this;}

    /*

String. The ID of the file system whose mount targets you want to list.

    */
    inline DescribeMountTargetsRequest& WithFileSystemId(const char* value) { SetFileSystemId(value); return *this;}

  private:
    long m_maxItems;
    bool m_maxItemsHasBeenSet;
    Aws::String m_marker;
    bool m_markerHasBeenSet;
    Aws::String m_fileSystemId;
    bool m_fileSystemIdHasBeenSet;
  };

} // namespace Model
} // namespace EFS
} // namespace Aws


text:
import $ from 'jquery'
import EventBaseView from './base'
import contestProvider from '../../providers/contest'
import identityProvider from '../../providers/identity'
import categoryProvider from '../../providers/category'
import postProvider from '../../providers/post'
import supervisorProvider from '../../providers/supervisor'
import taskProvider from '../../providers/task'
import taskCategoryProvider from '../../providers/task-category'
import teamProvider from '../../providers/team'
import teamTaskReviewProvider from '../../providers/team-task-review'
import teamTaskHitProvider from '../../providers/team-task-hit'

import taskValueProvider from '../../providers/task-value'
import taskRewardSchemeProvider from '../../providers/task-reward-scheme'
import taskFileProvider from '../../providers/task-file'

import remoteCheckerProvider from '../../providers/remote-checker'

class EventLiveView extends EventBaseView {
  constructor () {
    super()

    this.onUpdateContest = null
    this.onUpdateTeamScore = null
    this.onCreateTeamTaskHit = null

    this.onCreateTeamTaskHitAttempt = null

    this.onCreateTeamTaskReview = null

    this.onCreateCategory = null
    this.onUpdateCategory = null
    this.onDeleteCategory = null

    this.onCreatePost = null
    this.onUpdatePost = null
    this.onDeletePost = null

    this.onCreateSupervisor = null
    this.onDeleteSupervisor = null
    this.onUpdateSupervisorPassword = null
    this.onLoginSupervisor = null
    this.onLogoutSupervisor = null

    this.onCreateTask = null
    this.onUpdateTask = null
    this.onOpenTask = null
    this.onCloseTask = null

    this.onCreateTaskCategory = null
    this.onDeleteTaskCategory = null

    this.onCreateTeam = null
    this.onUpdateTeamEmail = null
    this.onUpdateTeamProfile = null
    this.onUpdateTeamPassword = null
    this.onUpdateTeamLogo = null
    this.onQualifyTeam = null
    this.onDisqualifyTeam = null
    this.onLoginTeam = null
    this.onLogoutTeam = null

    this.onCreateRemoteChecker = null
    this.onUpdateRemoteChecker = null
    this.onDeleteRemoteChecker = null

    this.onCreateTaskValue = null
    this.onUpdateTaskValue = null

    this.onCreateTaskRewardScheme = null
    this.onUpdateTaskRewardScheme = null

    this.onCreateTaskFile = null
    this.onDeleteTaskFile = null

    this.container = null
  }

  appendLog (eventName, eventData, createdAt) {
    const htmlString = super.renderEvent(eventName, eventData, createdAt)
    if (htmlString) {
      this.container.insertAdjacentHTML('beforeend', htmlString)
    }
  }

  subscribeToTeamTaskReviewEvents () {
    this.onCreateTeamTaskReview = (e, createdAt) => {
      this.appendLog('createTeamTaskReview', e, createdAt)
      return false
    }

    teamTaskReviewProvider.subscribe()
    teamTaskReviewProvider.on('createTeamTaskReview', this.onCreateTeamTaskReview)
  }

  subscribeToTeamTaskHitEvents () {
    teamTaskHitProvider.subscribe()

    this.onCreateTeamTaskHit = (e, createdAt) => {
      this.appendLog('createTeamTaskHit', e, createdAt)
      return false
    }

    teamTaskHitProvider.on('createTeamTaskHit', this.onCreateTeamTaskHit)

    this.onCreateTeamTaskHitAttempt = (e, createdAt) => {
      this.appendLog('createTeamTaskHitAttempt', e, createdAt)
      return false
    }

    teamTaskHitProvider.on('createTeamTaskHitAttempt', this.onCreateTeamTaskHitAttempt)
  }

  subscribeToContestEvents () {
    this.onUpdateContest = (e, createdAt) => {
      this.appendLog('updateContest', e, createdAt)
      return false
    }

    contestProvider.on('updateContest', this.onUpdateContest)
  }

  subscribeToCategoryEvents () {
    categoryProvider.subscribe()

    this.onCreateCategory = (e, createdAt) => {
      this.appendLog('createCategory', e, createdAt)
      return false
    }

    categoryProvider.on('createCategory', this.onCreateCategory)

    this.onUpdateCategory = (e, createdAt) => {
      this.appendLog('updateCategory', e, createdAt)
      return false
    }

    categoryProvider.on('updateCategory', this.onUpdateCategory)

    this.onDeleteCategory = (e, createdAt) => {
      this.appendLog('deleteCategory', e, createdAt)
      return false
    }

    categoryProvider.on('deleteCategory', this.onDeleteCategory)
  }

  subscribeToPostEvents () {
    postProvider.subscribe()

    this.onCreatePost = (e, createdAt) => {
      this.appendLog('createPost', e, createdAt)
      return false
    }

    postProvider.on('createPost', this.onCreatePost)

    this.onUpdatePost = (e, createdAt) => {
      this.appendLog('updatePost', e, createdAt)
      return false
    }

    postProvider.on('updatePost', this.onUpdatePost)

    this.onDeletePost = (e, createdAt) => {
      this.appendLog('deletePost', e, createdAt)
      return false
    }

    postProvider.on('deletePost', this.onDeletePost)
  }

  subscribeToSupervisorEvents () {
    supervisorProvider.subscribe()

    this.onCreateSupervisor = (e, createdAt) => {
      this.appendLog('createSupervisor', e, createdAt)
      return false
    }

    supervisorProvider.on('createSupervisor', this.onCreateSupervisor)

    this.onDeleteSupervisor = (e, createdAt) => {
      this.appendLog('deleteSupervisor', e, createdAt)
      return false
    }

    supervisorProvider.on('deleteSupervisor', this.onDeleteSupervisor)

    this.onUpdateSupervisorPassword = (e, createdAt) => {
      this.appendLog('updateSupervisorPassword', e, createdAt)
      return false
    }

    supervisorProvider.on('updateSupervisorPassword', this.onUpdateSupervisorPassword)

    this.onLoginSupervisor = (e, createdAt) => {
      this.appendLog('loginSupervisor', e, createdAt)
      return false
    }

    supervisorProvider.on('loginSupervisor', this.onLoginSupervisor)

    this.onLogoutSupervisor = (e, createdAt) => {
      this.appendLog('logoutSupervisor', e, createdAt)
      return false
    }

    supervisorProvider.on('logoutSupervisor', this.onLogoutSupervisor)
  }

  subscribeToTaskEvents () {
    taskProvider.subscribe()

    this.onCreateTask = (e, createdAt) => {
      this.appendLog('createTask', e, createdAt)
      return false
    }

    taskProvider.on('createTask', this.onCreateTask)

    this.onUpdateTask = (e, createdAt) => {
      this.appendLog('updateTask', e, createdAt)
      return false
    }

    taskProvider.on('updateTask', this.onUpdateTask)

    this.onOpenTask = (e, createdAt) => {
      this.appendLog('openTask', e, createdAt)
      return false
    }

    taskProvider.on('openTask', this.onOpenTask)

    this.onCloseTask = (e, createdAt) => {
      this.appendLog('closeTask', e, createdAt)
      return false
    }

    taskProvider.on('closeTask', this.onCloseTask)
  }

  subscribeToTaskCategoryEvents () {
    taskCategoryProvider.subscribe()

    this.onCreateTaskCategory = (e, createdAt) => {
      this.appendLog('createTaskCategory', e, createdAt)
      return false
    }

    taskCategoryProvider.on('createTaskCategory', this.onCreateTaskCategory)

    this.onDeleteTaskCategory = (e, createdAt) => {
      this.appendLog('deleteTaskCategory', e, createdAt)
      return false
    }

    taskCategoryProvider.on('deleteTaskCategory', this.onDeleteTaskCategory)
  }

  subscribeToTeamEvents () {
    teamProvider.subscribe()

    this.onCreateTeam = (e, createdAt) => {
      this.appendLog('createTeam', e, createdAt)
      return false
    }

    teamProvider.on('createTeam', this.onCreateTeam)

    this.onUpdateTeamEmail = (e, createdAt) => {
      this.appendLog('updateTeamEmail', e, createdAt)
      return false
    }

    teamProvider.on('updateTeamEmail', this.onUpdateTeamEmail)

    this.onUpdateTeamProfile = (e, createdAt) => {
      this.appendLog('updateTeamProfile', e, createdAt)
      return false
    }

    teamProvider.on('updateTeamProfile', this.onUpdateTeamProfile)

    this.onUpdateTeamPassword = (e, createdAt) => {
      this.appendLog('updateTeamPassword', e, createdAt)
      return false
    }

    teamProvider.on('updateTeamPassword', this.onUpdateTeamPassword)

    this.onUpdateTeamLogo = (e, createdAt) => {
      this.appendLog('updateTeamLogo', e, createdAt)
      return false
    }

    teamProvider.on('updateTeamLogo', this.onUpdateTeamLogo)

    this.onQualifyTeam = (e, createdAt) => {
      this.appendLog('qualifyTeam', e, createdAt)
      return false
    }

    teamProvider.on('qualifyTeam', this.onQualifyTeam)

    this.onDisqualifyTeam = (e, createdAt) => {
      this.appendLog('disqualifyTeam', e, createdAt)
      return false
    }

    teamProvider.on('disqualifyTeam', this.onDisqualifyTeam)

    this.onLoginTeam = (e, createdAt) => {
      this.appendLog('loginTeam', e, createdAt)
      return false
    }

    teamProvider.on('loginTeam', this.onLoginTeam)

    this.onLogoutTeam = (e, createdAt) => {
      this.appendLog('logoutTeam', e, createdAt)
      return false
    }

    teamProvider.on('logoutTeam', this.onLogoutTeam)

    this.onLinkTeamCTFtime = (e, createdAt) => {
      this.appendLog('linkTeamCTFtime', e, createdAt)
      return false
    }

    teamProvider.on('linkTeamCTFtime', this.onLinkTeamCTFtime)
  }

  subscribeToRemoteCheckerEvents () {
    remoteCheckerProvider.subscribe()

    this.onCreateRemoteChecker = (e, createdAt) => {
      this.appendLog('createRemoteChecker', e, createdAt)
      return false
    }

    remoteCheckerProvider.on('createRemoteChecker', this.onCreateRemoteChecker)

    this.onUpdateRemoteChecker = (e, createdAt) => {
      this.appendLog('updateRemoteChecker', e, createdAt)
      return false
    }

    remoteCheckerProvider.on('updateRemoteChecker', this.onUpdateRemoteChecker)

    this.onDeleteRemoteChecker = (e, createdAt) => {
      this.appendLog('deleteRemoteChecker', e, createdAt)
      return false
    }

    remoteCheckerProvider.on('deleteRemoteChecker', this.onDeleteRemoteChecker)
  }

  subscribeToTaskValueEvents () {
    taskValueProvider.subscribe(identityProvider.getIdentity())

    this.onCreateTaskValue = (e, createdAt) => {
      this.appendLog('createTaskValue', e, createdAt)
      return false
    }

    taskValueProvider.on('createTaskValue', this.onCreateTaskValue)

    this.onUpdateTaskValue = (e, createdAt) => {
      this.appendLog('updateTaskValue', e, createdAt)
      return false
    }

    taskValueProvider.on('updateTaskValue', this.onUpdateTaskValue)
  }

  subscribeToTaskRewardSchemeEvents () {
    taskRewardSchemeProvider.subscribe(identityProvider.getIdentity())

    this.onCreateTaskRewardScheme = (e, createdAt) => {
      this.appendLog('createTaskRewardScheme', e, createdAt)
      return false
    }

    taskRewardSchemeProvider.on('createTaskRewardScheme', this.onCreateTaskRewardScheme)

    this.onUpdateTaskRewardScheme = (e, createdAt) => {
      this.appendLog('updateTaskRewardScheme', e, createdAt)
      return false
    }

    taskRewardSchemeProvider.on('updateTaskRewardScheme', this.onUpdateTaskRewardScheme)
  }

  subscribeToTaskFileEvents () {
    taskFileProvider.subscribe()

    this.onCreateTaskFile = (e, createdAt) => {
      this.appendLog('createTaskFile', e, createdAt)
      return false
    }

    taskFileProvider.on('createTaskFile', this.onCreateTaskFile)

    this.onDeleteTaskFile = (e, createdAt) => {
      this.appendLog('deleteTaskFile', e, createdAt)
      return false
    }

    taskFileProvider.on('deleteTaskFile', this.onDeleteTaskFile)
  }

  present () {
    $
      .when(
        identityProvider.initIdentity(),
        contestProvider.initContest(),
        categoryProvider.initCategories(),
        postProvider.initPosts(),
        taskProvider.initTaskPreviews(),
        taskCategoryProvider.initTaskCategories(),
        taskValueProvider.initTaskValues(),
        taskRewardSchemeProvider.initTaskRewardSchemes(),
        teamProvider.initTeams(),
        remoteCheckerProvider.initRemoteCheckers()
      )
      .done((identity, contest) => {
        this.subscribeToContestEvents()
        this.subscribeToCategoryEvents()
        this.subscribeToPostEvents()
        this.subscribeToSupervisorEvents()
        this.subscribeToRemoteCheckerEvents()
        this.subscribeToTaskEvents()
        this.subscribeToTaskCategoryEvents()
        this.subscribeToTaskValueEvents()
        this.subscribeToTaskRewardSchemeEvents()
        this.subscribeToTeamEvents()
        this.subscribeToTeamTaskReviewEvents()
        this.subscribeToTeamTaskHitEvents()
        this.subscribeToTaskFileEvents()

        this.container = document.getElementById('volgactf-qualifier-events')
      })
  }
}

export default new EventLiveView()


text:
<?php

namespace Drupal\cacheflush_entity\Tests;

use Drupal\simpletest\WebTestBase;

/**
 * Test cacheflush entity functionality.
 *
 * @group cacheflush
 */
class CacheFlushEntityTest extends WebTestBase {

  /**
   * A user with permission to administer feeds and create content.
   *
   * @var \Drupal\user\Entity\User
   */
  protected $adminUser;

  /**
   * Modules to install.
   *
   * @var array
   */
  public static $modules = ['cacheflush_entity'];

  /**
   * Sets up the test.
   */
  protected function setUp() {
    parent::setUp(self::$modules);
    $this->adminUser = $this->createUser();
  }

  /**
   * Tests CRUD functions for cacheflush entity.
   */
  public function testCrudFunctions() {

    $this->drupalLogin($this->adminUser);

    $user = $this->createUser();

    // Create test entities for the user and unrelated to a user.
    $entity = cacheflush_create(['title' => 'test']);
    $entity->setOwnerId($user->user_id);
    $entity->save();

    $entity = cacheflush_create(['title' => 'test2']);
    $entity->setOwnerId($this->adminUser->user_id);
    $entity->save();

    $entity = cacheflush_create(['title' => 'test']);
    $entity->setOwnerId(NULL);
    $entity->save();

    $entities = array_values(cacheflush_load_multiple_by_properties(['title' => 'test']));
    $this->assertEqual($entities[0]->getTitle(), 'test', 'Created and loaded entity.');
    $this->assertEqual($entities[1]->getTitle(), 'test', 'Created and loaded entity.');

    $loaded = cacheflush_load($entity->id());
    $this->assertEqual($loaded->id(), $entity->id(), 'Loaded the entity unrelated to a user.');

    $entities = array_values(cacheflush_load_multiple_by_properties(['title' => 'test2']));
    cacheflush_delete($entities[0]->id());

    $entities = array_values(cacheflush_load_multiple_by_properties(['title' => 'test2']));
    $this->assertEqual($entities, [], 'Entity successfully deleted.');

    $entity->save();
    $this->assertEqual($entity->id(), $loaded->id(), 'Entity successfully updated.');

    // Try deleting multiple test entities by deleting all.
    $ids = array_keys(cacheflush_load_multiple());
    cacheflush_delete_multiple($ids);

    $this->drupalLogout();
  }

}


text:
if(-not $IsWindows)
{
    return
}

Describe "Help work with ExecutionPolicy Restricted " -Tags "Feature" {

    # Validate that 'Get-Help Get-Disk' returns one result when the execution policy is 'Restricted' on Nano
    # From an internal bug - [Regression] Get-Help returns multiple matches when there is an exact match

    # Skip the test if Storage module is not available, return a pseudo result
    # ExecutionPolicy only works on windows
    It "Test for Get-Help Get-Disk" -skip:(!(Test-Path (Join-Path -Path $PSHOME -ChildPath Modules\Storage\Storage.psd1)) -or -not $IsWindows) {

            try
            {
                $currentExecutionPolicy = Get-ExecutionPolicy
                Get-Module -Name Storage | Remove-Module -Force -ErrorAction Stop

                # 'Get-Help Get-Disk' should return one result back
                Set-ExecutionPolicy -ExecutionPolicy Restricted -Force -ErrorAction Stop
                (Get-Help -Name Get-Disk -ErrorAction Stop).Name | Should Be 'Get-Disk'
            }
            catch {
                $_.ToString | should be null
            }
            finally
            {
                Set-ExecutionPolicy $currentExecutionPolicy -Force
            }
    }
}

Describe "Validate ExecutionPolicy cmdlets in PowerShell" -Tags "CI" {

    BeforeAll {

        #Generate test data
        $drive = 'TestDrive:\'
        $testDirectory =  Join-Path $drive ("MultiMachineTestData\Commands\Cmdlets\Security_TestData\ExecutionPolicyTestData")
        if(Test-Path $testDirectory)
        {
            Remove-Item -Force -Recurse $testDirectory -ea SilentlyContinue
        }
        $null = New-Item $testDirectory -ItemType Directory -Force
        $remoteTestDirectory = $testDirectory

        $InternetSignatureCorruptedScript = Join-Path -Path $remoteTestDirectory -ChildPath InternetSignatureCorruptedScript.ps1
        $InternetSignedScript = Join-Path -Path $remoteTestDirectory -ChildPath InternetSignedScript.ps1
        $InternetUnsignedScript = Join-Path -Path $remoteTestDirectory -ChildPath InternetUnsignedScript.ps1
        $IntranetSignatureCorruptedScript = Join-Path -Path $remoteTestDirectory -ChildPath IntranetSignatureCorruptedScript.ps1
        $IntranetSignedScript = Join-Path -Path $remoteTestDirectory -ChildPath IntranetSignedScript.ps1
        $IntranetUnsignedScript = Join-Path -Path $remoteTestDirectory -ChildPath IntranetUnsignedScript.ps1
        $LocalSignatureCorruptedScript = Join-Path -Path $remoteTestDirectory -ChildPath LocalSignatureCorruptedScript.ps1
        $LocalSignedScript = Join-Path -Path $remoteTestDirectory -ChildPath LocalSignedScript.ps1
        $LocalUnsignedScript = Join-Path -Path $remoteTestDirectory -ChildPath LocalUnsignedScript.ps1
        $TrustedSignatureCorruptedScript = Join-Path -Path $remoteTestDirectory -ChildPath TrustedSignatureCorruptedScript.ps1
        $TrustedSignedScript = Join-Path -Path $remoteTestDirectory -ChildPath TrustedSignedScript.ps1
        $TrustedUnsignedScript = Join-Path -Path $remoteTestDirectory -ChildPath TrustedUnsignedScript.ps1
        $UntrustedSignatureCorruptedScript = Join-Path -Path $remoteTestDirectory -ChildPath UntrustedSignatureCorruptedScript.ps1
        $UntrustedSignedScript = Join-Path -Path $remoteTestDirectory -ChildPath UntrustedSignedScript.ps1
        $UntrustedUnsignedScript = Join-Path -Path $remoteTestDirectory -ChildPath UntrustedUnsignedScript.ps1
        $MyComputerSignatureCorruptedScript = Join-Path -Path $remoteTestDirectory -ChildPath MyComputerSignatureCorruptedScript.ps1
        $MyComputerSignedScript = Join-Path -Path $remoteTestDirectory -ChildPath MyComputerSignedScript.ps1
        $MyComputerUnsignedScript = Join-Path -Path $remoteTestDirectory -ChildPath MyComputerUnsignedScript.ps1

        $fileType = @{
            "Local" = -1
            "MyComputer" = 0
            "Intranet" = 1
            "Trusted" = 2
            "Internet" = 3
            "Untrusted" = 4
        }

        $testFilesInfo = @(
            @{
                FilePath = $InternetSignatureCorruptedScript
                FileType = $fileType.Internet
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $InternetSignedScript
                FileType = $fileType.Internet
                AddSignature = $true
                Corrupted = $false
            }
            @{
                FilePath = $InternetUnsignedScript
                FileType = $fileType.Internet
                AddSignature = $false
                Corrupted = $false
            }
            @{
                FilePath = $IntranetSignatureCorruptedScript
                FileType = $fileType.Intranet
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $IntranetSignedScript
                FileType = $fileType.Intranet
                AddSignature = $true
                Corrupted = $false
            }
            @{
                FilePath = $IntranetUnsignedScript
                FileType = $fileType.Intranet
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $LocalSignatureCorruptedScript
                FileType = $fileType.Local
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $LocalSignedScript
                FileType = $fileType.Local
                AddSignature = $true
                Corrupted = $false
            }
            @{
                FilePath = $LocalUnsignedScript
                FileType = $fileType.Local
                AddSignature = $false
                Corrupted = $false
            }
            @{
                FilePath = $TrustedSignatureCorruptedScript
                FileType = $fileType.Trusted
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $TrustedSignedScript
                FileType = $fileType.Trusted
                AddSignature = $true
                Corrupted = $false
            }
            @{
                FilePath = $TrustedUnsignedScript
                FileType = $fileType.Trusted
                AddSignature = $false
                Corrupted = $false
            }
             @{
                FilePath = $UntrustedSignatureCorruptedScript
                FileType = $fileType.Untrusted
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $UntrustedSignedScript
                FileType = $fileType.Untrusted
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $UntrustedUnsignedScript
                FileType = $fileType.Untrusted
                AddSignature = $true
                Corrupted = $false
            }
             @{
                FilePath = $MyComputerSignatureCorruptedScript
                FileType = $fileType.MyComputer
                AddSignature = $true
                Corrupted = $true
            }
            @{
                FilePath = $MyComputerSignedScript
                FileType = $fileType.MyComputer
                AddSignature = $true
                Corrupted = $false
            }
            @{
                FilePath = $MyComputerUnsignedScript
                FileType = $fileType.MyComputer
                AddSignature = $false
                Corrupted = $false
            }
        )

        #Generate Test Data on remote machine and get the execution policy

            function createTestFile
            {
                param (
                [string]
                $FilePath,

                [int]
                $FileType,

                [switch]
                $AddSignature,

                [switch]
                $Corrupted
                )

                $null = New-Item -Path $filePath -ItemType File

                $content = "`"Hello`"" + "`r`n"
                if($AddSignature)
                {
                    if($Corrupted)
                    {
                        # Add corrupted signature
                        $content += @"
# SIG # Begin signature block
# MIIPTAYJKoZIhvcNAQcCoIIPPTCCDzkCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUYkdwUPVVR4frPbdbTE8ZPwfD
# +XegggyDMIIGFTCCA/2gAwIBAgITMwAAABrJQBS8Ii1KJQAAAAAAGjANBgkqhkiG
# 9w0BAQsFADCBkDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAO
# BgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjE6
# MDgGA1UEAxMxTWljcm9zb2Z0IFRlc3RpbmcgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRo
# b3JpdHkgMjAxMDAeFw0xNDAyMDQxODAyMjVaFw0xODAyMDQxODAyMjVaM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gYDVQQDExdNU0lUIFRlc3QgQ29kZVNpZ24gQ0EgMwITQwMG
# LpbRsruqZJ+lAAABAwYuljAJBgUrDgMCGgUAoHAwEAYKKwYBBAGCNwIBDDECMAAw
# GQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisG
# AQQBgjcCARUwIwYJKoZIhvcNAQkEMRYEFDFRa0VJKJQ1h2LG6dYzXKpBneOfMA0G
# CSqGSIb3DQEBAQUABIIBAHbWmEOWfj37SNw8NDnAAg7bl0L3oyGVKPWysRnriHC9
# aYImucAy2QXKo6YUWxHMqFvRPFrF07qkTDV249iC+L8gb1X0wwq/YuWWFbdN2J8s
# 4CnN6I4Ff2AF4Co34MZGhtIHd3D7H1oPMelTlHQOc5CXyB/wkduoNgS0GCoeZXSK
# DdMuN7dbru3PvCxe0ShzRwxBOa4EWZ6dHDAQRdrxkK2vVLWHg+6th8lRNnCJQeb+
# 03tMRItnm/sAmKR9PCWm4YZob3ug9T9Qa1K00TuNskjXO+G2S2mjhFC5+HGKjLZd
# bJydl0MIIMBtlLEGa4CcFtszxaww5Cx+YtCbxPp3iII=
# SIG # End signature block
"@
                    }
                    else
                    {
                        # Add correct signature
                        $content += @"
# SIG # Begin signature block
# MIIPTAYJKoZIhvcNAQcCoIIPPTCCDzkCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUYkdwUPVVR4frPbdbTE8ZPwfD
# +XegggyDMIIGFTCCA/2gAwIBAgITMwAAABrJQBS8Ii1KJQAAAAAAGjANBgkqhkiG
# 9w0BAQsFADCBkDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAO
# BgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb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BmTCBgTETMBEGCgmSJomT8ixkARkWA2NvbTEZMBcGCgmSJomT8ixkARkW
# CW1pY3Jvc29mdDEUMBIGCgmSJomT8ixkARkWBGNvcnAxFzAVBgoJkiaJk/IsZAEZ
# FgdyZWRtb25kMSAwHgYDVQQDExdNU0lUIFRlc3QgQ29kZVNpZ24gQ0EgMwITQwMG
# LpbRsruqZJ+lAAABAwYuljAJBgUrDgMCGgUAoHAwEAYKKwYBBAGCNwIBDDECMAAw
# GQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisG
# AQQBgjcCARUwIwYJKoZIhvcNAQkEMRYEFDFRa0VJKJQ1h2LG6dYzXKpBneOfMA0G
# CSqGSIb3DQEBAQUABIIBAHbWmEOWfj37SNw8NDnAAg7bl0L3oyGVKPWysRnriHC9
# aYImucAy2QXKo6YUWxHMqFvRPFrF07qkTDV249iC+L8gb1X0wwq/YuWWFbdN2J8s
# 4CnN6I4Ff2AF4Co34MZGhtIHd3D7H1oPMelTlHQOc5CXyB/wkduoNgS0GCoeZXSK
# DdMuN7dbru3PvCxe0ShzRwxBOa4EWZ6dHDAQRdrxkK2vVLWHg+6th8lRNnCJQeb+
# 03tMRItnm/sAmKR9PCWm4YZob3ug9T9Qa1K00TuNskjXO+G2S2mjhFC5+HGKjLZd
# bJydl0MIIMBtlLEGa4CcFtszxaww5Cx+YtCbxPp3iII=
# SIG # End signature block
"@
                    }
                }

                set-content $filePath -Value $content

                ## Valida File types and their corresponding int values are :
                ##
                ##    Local = -1
                ##    MyComputer = 0
                ##    Intranet = 1
                ##    Trusted = 2
                ##    Internet = 3
                ##    Untrusted = 4
                ## We need to add alternate streams in all files except for the local file

                if(-1 -ne $FileType)
                {
                    $alternateStreamContent = @"
[ZoneTransfer]
ZoneId=$FileType
"@
                    Add-Content -Path $filePath -Value $alternateStreamContent -stream Zone.Identifier
                }
            }

            foreach($fileInfo in $testFilesInfo)
            {
                createTestFile -FilePath $fileInfo.filePath -FileType $fileInfo.fileType -AddSignature:$fileInfo.AddSignature -Corrupted:$fileInfo.corrupted
            }

            #Get Execution Policy
            $originalExecPolicy = Get-ExecutionPolicy
            $originalExecutionPolicy =  $originalExecPolicy
    }
    AfterAll {
        #Clean up

            $testDirectory = $remoteTestDirectory

            Remove-Item $testDirectory -Recurse -Force -ea SilentlyContinue
            Remove-Item function:createTestFile -ea SilentlyContinue
    }
    Context "Validate that 'Restricted' execution policy works on OneCore powershell" {

        BeforeAll {
            Set-ExecutionPolicy Restricted -Force -Scope Process | Out-Null
        }

        AfterAll {
            Set-ExecutionPolicy $originalExecutionPolicy -Force -Scope Process | Out-Null
        }

        function Test-RestrictedExecutionPolicy
        {
            param ($testScript)

            $TestTypePrefix = "Test 'Restricted' execution policy."

            It "$TestTypePrefix Running $testScript script should raise PSSecurityException" -skip:(-not $IsWindows) {

                $scriptName = $testScript

                $exception = $null
                try {
                    & $scriptName
                }
                catch
                {
                    $exception = $_
                }

                $exceptionType = $exception.Exception.getType()
                $result = $exceptionType

                $result |  Should be "System.Management.Automation.PSSecurityException"
            }
        }

        $testScripts = @(
            $InternetSignatureCorruptedScript
            $InternetSignedScript
            $InternetUnsignedScript
            $IntranetSignatureCorruptedScript
            $IntranetSignedScript
            $IntranetUnsignedScript
            $LocalSignatureCorruptedScript
            $localSignedScript
            $LocalUnsignedScript
            $TrustedSignatureCorruptedScript
            $TrustedSignedScript
            $UntrustedSignatureCorruptedScript
            $UntrustedSignedScript
            $UntrustedUnsignedScript
            $TrustedUnsignedScript
            $MyComputerSignatureCorruptedScript
            $MyComputerSignedScript
            $MyComputerUnsignedScript
        )

        foreach($testScript in $testScripts)
        {
            Test-RestrictedExecutionPolicy $testScript
        }
    }

    AfterAll {
        # Clean up
        $testDirectory = $remoteTestDirectory

        Remove-Item $testDirectory -Recurse -Force -ea SilentlyContinue
        Remove-Item function:createTestFile -ea SilentlyContinue
    }
    Context "Validate that 'Unrestricted' execution policy works on OneCore powershell" {

        BeforeAll {
            Set-ExecutionPolicy Unrestricted -Force -Scope Process | Out-Null
        }

        AfterAll {
            Set-ExecutionPolicy $originalExecutionPolicy -Force -Scope Process | Out-Null
        }

        function Test-UnrestrictedExecutionPolicy {

            param($testScript, $expected)

            $TestTypePrefix = "Test 'Unrestricted' execution policy."

            It "$TestTypePrefix Running $testScript script should return $expected" -skip:(-not $IsWindows) {
                $scriptName = $testScript

                $result = & $scriptName

                $result |  Should be $expected
            }
        }

        $expected = "Hello"
        $testScripts = @(
            $IntranetSignatureCorruptedScript
            $IntranetSignedScript
            $IntranetUnsignedScript
            $LocalSignatureCorruptedScript
            $localSignedScript
            $LocalUnsignedScript
            $TrustedSignatureCorruptedScript
            $TrustedSignedScript
            $TrustedUnsignedScript
            $MyComputerSignatureCorruptedScript
            $MyComputerSignedScript
            $MyComputerUnsignedScript
        )

        foreach($testScript in $testScripts) {
            Test-UnrestrictedExecutionPolicy $testScript $expected
        }
    }

    Context "Validate that 'ByPass' execution policy works on OneCore powershell" {

        BeforeAll {
            Set-ExecutionPolicy Bypass -Force -Scope Process | Out-Null
        }

        AfterAll {
            Set-ExecutionPolicy $originalExecutionPolicy -Force -Scope Process | Out-Null
        }

        function Test-ByPassExecutionPolicy {

            param($testScript, $expected)

            $TestTypePrefix = "Test 'ByPass' execution policy."

            It "$TestTypePrefix Running $testScript script should return $expected"  -skip:(-not $IsWindows)  {
                $scriptName = $testScript

                $result = & $scriptName
                return $result

                $result |  Should be $expected
            }
        }

        $expected = "Hello"
        $testScripts = @(
            $InternetSignatureCorruptedScript
            $InternetSignedScript
            $InternetUnsignedScript
            $IntranetSignatureCorruptedScript
            $IntranetSignedScript
            $IntranetUnsignedScript
            $LocalSignatureCorruptedScript
            $LocalSignedScript
            $LocalUnsignedScript
            $TrustedSignatureCorruptedScript
            $TrustedSignedScript
            $TrustedUnsignedScript
            $UntrustedSignatureCorruptedScript
            $UntrustedSignedScript
            $UntrustedUnSignedScript
            $MyComputerSignatureCorruptedScript
            $MyComputerSignedScript
            $MyComputerUnsignedScript
        )
        foreach($testScript in $testScripts) {
            Test-ByPassExecutionPolicy $testScript $expected
        }
    }

    Context "'RemoteSigned' execution policy works on OneCore powershell" {

        BeforeAll {
                Set-ExecutionPolicy RemoteSigned -Force -Scope Process | Out-Null
        }

        AfterAll {
            Set-ExecutionPolicy $originalExecutionPolicy -Force -Scope Process
        }

        function Test-RemoteSignedExecutionPolicy {

            param($testScript, $expected, $error)

            $TestTypePrefix = "Test 'RemoteSigned' execution policy."

            It "$TestTypePrefix Running $testScript script should return $expected" -skip:(-not $IsWindows) {
                $scriptName=$testScript

                $scriptResult = $null
                $exception = $null

                try
                {
                    $scriptResult = & $scriptName
                }
                catch
                {
                    $exception = $_
                }

                $errorType = $null
                if($null -ne $exception)
                {
                    $errorType = $exception.exception.getType()
                    $scriptResult = $null
                }
                $result = @{
                    "result" = $scriptResult
                    "exception" = $errorType
                }

                $actualResult = $result."result"
                $actualError = $result."exception"

                $actualResult |  Should be $expected
                $actualError | Should be $error
            }
        }
        $message = "Hello"
        $error = "System.Management.Automation.PSSecurityException"
        $testData = @(
        @{
            testScript = $LocalUnsignedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $LocalSignatureCorruptedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $LocalSignedScript
            expected = "Hello"
            error = $null
        }
        @{
            testScript = $MyComputerUnsignedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $MyComputerSignatureCorruptedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $myComputerSignedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $TrustedUnsignedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $TrustedSignatureCorruptedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $TrustedSignedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $IntranetUnsignedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $IntranetSignatureCorruptedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $IntranetSignedScript
            expected = $message
            error = $null
        }
        @{
            testScript = $InternetUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $InternetSignatureCorruptedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $UntrustedUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $UntrustedSignatureCorruptedScript
            expected = $null
            error = $error
        }
        )

        foreach($testCase in $testData) {
            Test-RemoteSignedExecutionPolicy @testCase
        }
    }

    Context "Validate that 'AllSigned' execution policy works on OneCore powershell" {

        BeforeAll {
            Set-ExecutionPolicy AllSigned -Force -Scope Process
        }

        AfterAll {
            Set-ExecutionPolicy $originalExecutionPolicy -Force -Scope Process
        }

        function Test-AllSignedExecutionPolicy {

            param($testScript, $error)

            $TestTypePrefix = "Test 'AllSigned' execution policy."

            It "$TestTypePrefix Running $testScript script should return $error" -skip:(-not $IsWindows) {

                $scriptName = $testScript

                $exception = $null
                try
                {
                    & $scriptName
                }
                catch
                {
                    $exception = $_
                }
                $errorType = $null

                if($null -ne $exception)
                {
                    $errorType = $exception.exception.getType()
                }

                $result = $errorType

                $result | Should be $error
            }
        }
        $error = "System.Management.Automation.PSSecurityException"
        $testData = @(
        @{
            testScript = $LocalUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $LocalSignatureCorruptedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $MyComputerUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $MyComputerSignatureCorruptedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $TrustedUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $TrustedSignatureCorruptedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $IntranetUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $IntranetSignatureCorruptedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $InternetUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $InternetSignatureCorruptedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $UntrustedUnsignedScript
            expected = $null
            error = $error
        }
        @{
            testScript = $UntrustedSignatureCorruptedScript
            expected = $null
            error = $error
        }
        )
        foreach($testScript in $testScripts) {
            Test-AllSignedExecutionPolicy $testScript $error
        }
    }
}

Describe "Validate Set-ExecutionPolicy -Scope" -Tags "CI" {

    BeforeAll {
        $originalPolicies = Get-ExecutionPolicy -list

        # Calls Set-ExecutionPolicy with a known-bad Scope and expects failure.
        # It is defined here so that it will be available at It scope.
        function VerfiyBlockedSetExecutionPolicy
        {
            param(
                [string]
                $policyScope
            )
            $fqeid = ""
            try {
                Set-ExecutionPolicy -Scope $policyScope -ExecutionPolicy Restricted
            }
            catch {
                $fqeid = $_.FullyQualifiedErrorId
            }

            $fqeid | Should Be "CantSetGroupPolicy,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand"
        }
    }

    AfterAll {
        foreach ($scopedPolicy in $originalPolicies)
        {
            if (($scopedPolicy.Scope -eq "Process") -or
                ($scopedPolicy.Scope -eq "CurrentUser"))
            {
                try {
                    Set-ExecutionPolicy -Scope $scopedPolicy.Scope -ExecutionPolicy $scopedPolicy.ExecutionPolicy -Force
                }
                catch {
                    if ($_.FullyQualifiedErrorId -ne "ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand")
                    {
                        # Re-throw unrecognized exceptions. Otherwise, swallow
                        # the exception that warns about overridden policies
                        throw $_
                    }
                }
            }
            elseif($scopedPolicy.Scope -eq "LocalMachine")
            {
                try {
                    Set-ExecutionPolicy -Scope $scopedPolicy.Scope -ExecutionPolicy $scopedPolicy.ExecutionPolicy -Force
                }
                catch {
                    if ($_.FullyQualifiedErrorId -eq "System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand")
                    {
                        # Do nothing. Depending on the ownership of the file,
                        # regular users may or may not be able to set its
                        # value.
                        #
                        # When targetting the Registry, regular users cannot
                        # modify this value.
                    }
                    elseif ($_.FullyQualifiedErrorId -ne "ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand")
                    {
                        # Re-throw unrecognized exceptions. Otherwise, swallow
                        # the exception that warns about overridden policies
                        throw $_
                    }
                }
            }
        }
    }

    It "-Scope MachinePolicy is not Modifiable" {
        VerfiyBlockedSetExecutionPolicy "MachinePolicy"
    }

    It "-Scope UserPolicy is not Modifiable" {
        VerfiyBlockedSetExecutionPolicy "UserPolicy"
    }

    It "-Scope Process is Settable" {
        Set-ExecutionPolicy -Scope Process -ExecutionPolicy ByPass
        Get-ExecutionPolicy -Scope Process | Should Be "ByPass"
    }

    It "-Scope CurrentUser is Settable" {
        Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy ByPass
        Get-ExecutionPolicy -Scope CurrentUser | Should Be "ByPass"
    }

    # This test requires Administrator privileges on Windows.
    It "-Scope LocalMachine is Settable" {
        Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy ByPass
        Get-ExecutionPolicy -Scope LocalMachine | Should Be "ByPass"
    }
}

Describe "Validate that 'ConvertTo-SecureString -Key' and 'ConvertFrom-SecureString -Key' work on NanoServer and IoT" -Tags "CI" {

    It "ConvertTo-SecureString should return back the SecureString that was constructed from 'ValidateConvertSecureString'." -skip:(-not $IsWindows) {

        $testString = "ValidateConvertSecureString"
        $secureString = ConvertTo-SecureString -String "ValidateConvertSecureString" -AsPlainText -Force
        $key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)

        $encryptedString = ConvertFrom-SecureString -SecureString $secureString -Key $key
        $decryptedString = ConvertTo-SecureString -String $encryptedString -Key $key

        $cred = [pscredential]::new("domain\user", $decryptedString)
        $netCred = $cred.GetNetworkCredential()
        $password = $netCred.Password

        $password | Should be $testString
    }
}


text:
/*
 * Module Name: Replication
 *
 * Filename: replication.h
 *
 * Abstract:
 *
 * replication api
 *
 */

#ifndef __REPLICATION_H__
#define __REPLICATION_H__

#ifdef __cplusplus
extern "C" {
#endif

extern VMDIR_REPLICATION_AGREEMENT * gVmdirReplAgrs;

///////////////////////////////////////////////////////////////////////////////
// replication library initialize / shutdown
///////////////////////////////////////////////////////////////////////////////
/*
 * Initialize replication library
 */
DWORD
VmDirReplicationLibInit(
    VOID
    );

DWORD
VmDirReplAgrEntryToInMemory(
    PVDIR_ENTRY                     pEntry,
    PVMDIR_REPLICATION_AGREEMENT *  ppReplAgr);

DWORD
VmDirConstructReplAgr(
    PVDIR_SCHEMA_CTX                pSchemaCtx,
    PCSTR                           pszReplURI,
    PCSTR                           pszLastLocalUsnProcessed,
    PCSTR                           pszReplAgrDN,
    PVMDIR_REPLICATION_AGREEMENT *  ppReplAgr);

VOID
VmDirFreeReplicationAgreement(
    PVMDIR_REPLICATION_AGREEMENT    pReplAgr
    );

VOID
VmDirRemoveDeletedRAsFromCache();

#ifdef __cplusplus
}
#endif

#endif /* __REPLICATION_H__ */


text:
if [[ ! $BUCKET_PATH ]]; then
  echo "Please define BUCKET_PATH"
fi

echo "Cleaning up" && \
rm -rf /var/data/tabixtemp/*

echo "Copying VCF files from ${BUCKET_PATH}"
gsutil -m cp $BUCKET_PATH/* /var/data/tabixtemp/

echo "Files copied:"
ls /var/data/tabixtemp

echo "Creating tabix index..."
`for i in /var/data/tabixtemp/*gz; do tabix -f -p vcf $i & done`;

echo "Done creating indexes for: "
ls /var/data/tabixtemp

echo "Copying files to storage bucket ${BUCKET_PATH}"
gsutil -m cp /var/data/tabixtemp/*tbi $BUCKET_PATH/

echo "Cleaning up" && \
rm -rf /var/data/tabixtemp/*

echo "Exiting"


text:
/*
 Return true if the string in the first element of the array contains all of the
 letters of the string in the second element of the array.

For example, ["hello", "Hello"], should return true because all of the letters in
the second string are present in the first, ignoring case.

The arguments ["hello", "hey"] should return false because the string "hello" does not contain a "y".

Lastly, ["Alien", "line"], should return true because all of the letters in "line" are present in "Alien".

Useful Method
String.indexOf();
*/

const mutation = (arr) => {
    //Converts to Lowercase
    let input = arr[0].toLowerCase();
    let check = arr[1].toLowerCase();

    //Loop to iterate in the length of the second index
    for(var i = 0; i < check.length; i++){
        //If the index of the 0th indexOf 1th is  less than zero, then it doesnt exist.
        if(input.indexOf(check[i]) <0){
            return console.log(false);
        }
    }
    return console.log(true);

}

mutation(["hello", "hey"]);// should return false.
mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]);// should return true.
mutation(["Mary", "Army"]); // should return true
mutation(["voodoo", "no"]);// should return false.


text:
package com.bbva.kltt.apirest.generator.test.example.output.language;

import java.util.List;

import com.bbva.kltt.apirest.core.generator.output.language.IOutputLanguageItems;
import com.bbva.kltt.apirest.core.generator.output.parameters.OutputParameter;
import com.bbva.kltt.apirest.core.generator.output.parameters.OutputParameters;
import com.bbva.kltt.apirest.core.parsed_info.ParsedInfoHandler;
import com.bbva.kltt.apirest.core.parsed_info.parameters.Parameter;
import com.bbva.kltt.apirest.core.parsed_info.parameters.ParameterBody;
import com.bbva.kltt.apirest.core.parsed_info.parameters.ParameterFormData;
import com.bbva.kltt.apirest.core.parsed_info.parameters.ParameterHeader;
import com.bbva.kltt.apirest.core.parsed_info.parameters.ParameterPath;
import com.bbva.kltt.apirest.core.parsed_info.parameters.ParameterQuery;
import com.bbva.kltt.apirest.core.util.ConstantsCommon;
import com.bbva.kltt.apirest.core.util.ConstantsOutput;
import com.bbva.kltt.apirest.generator.java.output.language.OutputLanguageParametersJava;
import com.bbva.kltt.apirest.generator.test.example.output.parameters.OutputParameterTestExample;
import com.bbva.kltt.apirest.generator.test.example.output.parameters.OutputParametersTestExample;
import com.bbva.kltt.apirest.generator.test.example.util.ConstantsOutputTestExample;

/**
 * ------------------------------------------------
 * @author Francisco Manuel Benitez Chico
 * ------------------------------------------------
 */
public class OutputLanguageParametersTestExample extends OutputLanguageParametersJava
{
	/**
	 * Public constructor
	 * @param parsedInfoHandler   with the parsed information handler
	 * @param outputLanguageItems with the output language items
	 */
	public OutputLanguageParametersTestExample(final ParsedInfoHandler parsedInfoHandler, final IOutputLanguageItems outputLanguageItems)
	{
		super(parsedInfoHandler, outputLanguageItems) ;
	}

	@Override
	public OutputParameters createNewOutputParameters(final List<OutputParameter> outputParamList)
	{
		return new OutputParametersTestExample(this.getOutputLangSeparators(), outputParamList) ;
	}

	@Override
	public OutputParameter createNewOutputParameter(final Parameter parameter)
	{
		final String type		= this.getTypeOutputFile(parameter) ;
		final String annotation = this.getAnnotation(parameter) ;

		return new OutputParameterTestExample(parameter.getItem(), parameter.getDescription(), type, parameter.getName(), annotation) ;
	}

	/**
	 * @param parameter with the parameter
	 * @return the annotation
	 */
	private String getAnnotation(final Parameter parameter)
	{
		final StringBuilder annotation = new StringBuilder() ;

		String annotationName = ConstantsCommon.STRING_EMPTY ;
		if (parameter instanceof ParameterBody)
		{
			annotationName = ConstantsOutputTestExample.SPRING_ANN_REQUEST_BODY ;
		}
		else if (parameter instanceof ParameterFormData || parameter instanceof ParameterQuery)
		{
			annotationName = ConstantsOutputTestExample.SPRING_ANN_REQUEST_PARAM ;
		}
		else if (parameter instanceof ParameterHeader)
		{
			annotationName = ConstantsOutputTestExample.SPRING_ANN_REQUEST_HEADER ;
		}
		else if (parameter instanceof ParameterPath)
		{
			annotationName = ConstantsOutputTestExample.SPRING_ANN_PATH_VARIABLE ;
		}

		// Add the annotation name
		annotation.append(annotationName) ;

		final String annotationParams = this.getAnnotationParams(parameter.getAlias(), parameter.isRequired(), annotationName) ;
		if (annotationParams != null && !annotationParams.isEmpty())
		{
			annotation.append(ConstantsCommon.STRING_PARENTH_OPENED) ;
			annotation.append(annotationParams) ;
			annotation.append(ConstantsCommon.STRING_PARENTH_CLOSED) ;
		}

		return annotation.toString() ;
	}

	/**
	 * @param aliasName      with the alias
	 * @param required       as true if the parameter is required
	 * @param annotationName with the annotation name
	 * @return the annotation parameters
	 */
	protected String getAnnotationParams(final String aliasName, final boolean required, final String annotationName)
	{
		final StringBuilder outcome = new StringBuilder() ;

		// Set the annotation "value" if it is not a @RequestBody
		boolean valueAnnotationFilled = !ConstantsOutputTestExample.SPRING_ANN_REQUEST_BODY.equals(annotationName) ;
		if (valueAnnotationFilled)
		{
			outcome.append(this.setAnnotationValue(aliasName)) ;
			valueAnnotationFilled = !ConstantsCommon.STRING_EMPTY.equals(outcome.toString()) ;
		}

		// The only annotation that not accepts the "required" value is "@PathVariable"
		if (!ConstantsOutputTestExample.SPRING_ANN_PATH_VARIABLE.equals(annotationName))
		{
			outcome.append(this.setAnnotationRequired(required, valueAnnotationFilled)) ;
		}

		return outcome.toString() ;
	}

	/**
	 * @param aliasName      with the alias
	 * @return the annotation value filled
	 */
	private StringBuilder setAnnotationValue(final String aliasName)
	{
		final StringBuilder outcome = new StringBuilder() ;

		if (aliasName != null && !aliasName.isEmpty())
		{
			outcome.append(ConstantsOutput.COMMON_ANNOTATION_ALIAS_PAR) ;
			outcome.append(ConstantsCommon.STRING_EQUAL) ;
			outcome.append(ConstantsCommon.STRING_DOUBLE_QUOTE) ;
			outcome.append(aliasName) ;
			outcome.append(ConstantsCommon.STRING_DOUBLE_QUOTE) ;
		}

		return outcome ;
	}

	/**
	 * @param required 				as true if the parameter is required
	 * @param valueAnnotationFilled as true if the value annotation was filled
	 * @return the annotation value filled
	 */
	private StringBuilder setAnnotationRequired(final boolean required, final boolean valueAnnotationFilled)
	{
		final StringBuilder outcome = new StringBuilder() ;

		if (valueAnnotationFilled)
		{
			outcome.append(ConstantsCommon.STRING_COMMA) ;
			outcome.append(ConstantsCommon.STRING_BLANK) ;
		}

		outcome.append(ConstantsOutput.COMMON_ANNOTATION_REQUI_PAR) ;
		outcome.append(ConstantsCommon.STRING_EQUAL) ;
		outcome.append(required) ;

		return outcome ;
	}

	/**
	 * @param parameter with the parameter
	 * @return the output type
	 */
	private String getTypeOutputFile(final Parameter parameter)
	{
		String type = this.getOutputLanguageItems().getFullTypeOutput(parameter.getItem()) ;

		if (parameter instanceof ParameterFormData && ConstantsCommon.TYPE_FILE.equalsIgnoreCase(parameter.getType()))
		{
			type = ConstantsOutputTestExample.SPRING_FORM_DATA_MULTPART ;
		}

		return type ;
	}
}


text:
using System.Web.Mvc;

namespace ResourcesFirstTranslations.Web.Areas.Administration
{
    public class AdministrationAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Administration";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Administration_default",
                "Administration/{controller}/{action}/{id}",
                new { controller="AdminstrationHome", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}


text:
title: "NBA Live 07"
header:
  teaser: /assets/images/nbalive07.jpg
---

![NBA Live 07](/assets/images/nbalive07.jpg)

**Publisher:** Electronic Arts
**Developer:** EA Canada
**Genre(s):** Sports, Basketball
**Players:** 4
**ESRB Rating:** E (Everyone)
**Release Date:** September 25, 2006
**Platform:** Xbox 360

NBA LIVE 07 plays as good as it looks with gameplay advancements that build upon the depth and authenticity that the NBA LIVE franchise has delivered for more than a decade. NBA LIVE 07 introduces the next generation of basketball gameplay with EA SPORTS Total Freestyle Control, a new feature that gives users more control over athletes than ever. By introducing a next generation AI system that is both intuitive and intelligent, combined with advancements to fan-favorite features like All-Star Weekend and Dynasty Mode, NBA LIVE 07 continues to deliver its award-winning gameplay experience. This year NBA LIVE 07 partners with the worldwide leader in sports to deliver more ESPN content in-game while you play than ever before.

Contributions:

- Responsible for maintaining and updating the game's database.
- Implemented all backend logic for Create-A-Player mode.
- Responsible for all game screens were properly localized.
- Successfully debugged and shipped game to market.


text:
package jetbrains.exodus.log;

import org.junit.Assert;
import org.junit.Test;

public class LogUtilTests {

    @Test
    public void testLogFilename() {
        Assert.assertEquals(LogUtil.LOG_FILE_NAME_WITH_EXT_LENGTH, LogUtil.getLogFilename(0).length());
        Assert.assertEquals("00000000000.xd", LogUtil.getLogFilename(0));
        Assert.assertEquals("00000000001.xd", LogUtil.getLogFilename(LogUtil.LOG_BLOCK_ALIGNMENT));
        Assert.assertEquals("7vvvvvvvvvv.xd", LogUtil.getLogFilename(Long.MAX_VALUE / LogUtil.LOG_BLOCK_ALIGNMENT * LogUtil.LOG_BLOCK_ALIGNMENT));
        Assert.assertEquals("0ok2m96adc9.xd", LogUtil.getLogFilename(LogUtil.LOG_BLOCK_ALIGNMENT * 0x3141592653589L));
    }

    @Test
    public void testLogFileAddress() {
        Assert.assertEquals(0L, LogUtil.getAddress("00000000000.xd"));
        Assert.assertEquals((long) LogUtil.LOG_BLOCK_ALIGNMENT, LogUtil.getAddress("00000000001.xd"));
        Assert.assertEquals(Long.MAX_VALUE / LogUtil.LOG_BLOCK_ALIGNMENT * LogUtil.LOG_BLOCK_ALIGNMENT, LogUtil.getAddress("7vvvvvvvvvv.xd"));
        Assert.assertEquals(LogUtil.LOG_BLOCK_ALIGNMENT * 0x3141592653589L, LogUtil.getAddress("0ok2m96adc9.xd"));
    }

    @Test
    public void testLogFilenameAddressAlignment() {
        boolean wasException = false;
        String logFilename = null;
        try {
            logFilename = LogUtil.getLogFilename(1);
        } catch (Exception e) {
            wasException = true;
        }
        Assert.assertNull(logFilename);
        Assert.assertTrue(wasException);
    }

    @Test
    public void testValidLogFileNames() {
        Assert.assertTrue(isValidLogFileName("00000000000.xd"));
        Assert.assertFalse(isValidLogFileName("00000000000"));
        Assert.assertFalse(isValidLogFileName("00000000000.x"));
        Assert.assertFalse(isValidLogFileName("00000000000.db"));
        Assert.assertTrue(isValidLogFileName("00000000001.xd"));
        Assert.assertTrue(isValidLogFileName("7vvvvvvvvvv.xd"));
        Assert.assertTrue(isValidLogFileName("0ok2m96acd9.xd"));
        Assert.assertFalse(isValidLogFileName("wok2m96adc9.xd"));
        Assert.assertFalse(isValidLogFileName("0ok2z96adc9.xd"));
    }

    private static boolean isValidLogFileName(final String filename) {
        boolean result = true;
        try {
            LogUtil.getAddress(filename);
        } catch (Exception e) {
            result = false;
        }
        return result;
    }
}