text:
// @ts-check

const fs = require('fs');
const path = require('path');
const md = require('../markdown');
const docs = require('./documentation');

/** @typedef {import('../markdown').MarkdownNode} MarkdownNode */
/** @typedef {import('../markdown').MarkdownHeaderNode} MarkdownHeaderNode */
/** @typedef {import('../markdown').MarkdownLiNode} MarkdownLiNode */
/** @typedef {import('../markdown').MarkdownTextNode} MarkdownTextNode */

class ApiParser {
  /**
   * @param {string} apiDir
   * @param {string=} paramsPath
   */
  constructor(apiDir, paramsPath) {
    let bodyParts = [];
    for (const name of fs.readdirSync(apiDir)) {
      if (!name.endsWith('.md'))
        continue;
      if (name === 'params.md')
        paramsPath = path.join(apiDir, name);
      else
        bodyParts.push(fs.readFileSync(path.join(apiDir, name)).toString());
    }
    const body = md.parse(bodyParts.join('\n'));
    const params = paramsPath ? md.parse(fs.readFileSync(paramsPath).toString()) : undefined;
    checkNoDuplicateParamEntries(params);
    const api = params ? applyTemplates(body, params) : body;
    /** @type {Map<string, docs.Class>} */
    this.classes = new Map();
    md.visitAll(api, node => {
      if (node.type === 'h1')
        this.parseClass(node);
    });
    md.visitAll(api, node => {
      if (node.type === 'h2')
        this.parseMember(node);
    });
    md.visitAll(api, node => {
      if (node.type === 'h3')
        this.parseArgument(node);
    });
    this.documentation = new docs.Documentation([...this.classes.values()]);
    this.documentation.index();
  }

  /**
   * @param {MarkdownHeaderNode} node
   */
  parseClass(node) {
    let extendsName = null;
    const name = node.text.substring('class: '.length);
    for (const member of node.children) {
      if (member.type.startsWith('h'))
        continue;
      if (member.type === 'li' && member.liType === 'bullet' && member.text.startsWith('extends: [')) {
        extendsName = member.text.substring('extends: ['.length, member.text.indexOf(']'));
        continue;
      }
    }
    const clazz = new docs.Class(extractMetainfo(node), name, [], extendsName, extractComments(node));
    this.classes.set(clazz.name, clazz);
  }

  /**
   * @param {MarkdownHeaderNode} spec
   */
  parseMember(spec) {
    const match = spec.text.match(/(event|method|property|async method|optional method|optional async method): ([^.]+)\.(.*)/);
    if (!match)
      throw new Error('Invalid member: ' + spec.text);
    const name = match[3];
    let returnType = null;
    let optional = false;
    for (const item of spec.children || []) {
      if (item.type === 'li' && item.liType === 'default') {
        const parsed = this.parseType(item);
        returnType = parsed.type;
        optional = parsed.optional;
      }
    }
    if (!returnType)
      returnType = new docs.Type('void');

    const comments = extractComments(spec);
    let member;
    if (match[1] === 'event')
      member = docs.Member.createEvent(extractMetainfo(spec), name, returnType, comments);
    if (match[1] === 'property')
      member = docs.Member.createProperty(extractMetainfo(spec), name, returnType, comments, !optional);
    if (['method', 'async method', 'optional method', 'optional async method'].includes(match[1])) {
      member = docs.Member.createMethod(extractMetainfo(spec), name, [], returnType, comments);
      if (match[1].includes('async'))
        member.async = true;
      if (match[1].includes('optional'))
        member.required = false;
    }
    if (!member)
      throw new Error('Unknown member: ' + spec.text);

    const clazz = /** @type {docs.Class} */(this.classes.get(match[2]));
    const existingMember = clazz.membersArray.find(m => m.name === name && m.kind === member.kind);
    if (existingMember && isTypeOverride(existingMember, member)) {
      for (const lang of member?.langs?.only || []) {
        existingMember.langs.types = existingMember.langs.types || {};
        existingMember.langs.types[lang] = returnType;
      }
    } else {
      clazz.membersArray.push(member);
    }
  }

  /**
   * @param {MarkdownHeaderNode} spec
   */
  parseArgument(spec) {
    const match = spec.text.match(/(param|option): (.*)/);
    if (!match)
      throw `Something went wrong with matching ${spec.text}`;

    // For "test.describe.only.title":
    // - className is "test"
    // - methodName is "describe.only"
    // - argument name is "title"
    const parts = match[2].split('.');
    const className = parts[0];
    const name = parts[parts.length - 1];
    const methodName = parts.slice(1, parts.length - 1).join('.');

    const clazz = this.classes.get(className);
    if (!clazz)
      throw new Error('Invalid class ' + className);
    const method = clazz.membersArray.find(m => m.kind === 'method' && m.name === methodName);
    if (!method)
      throw new Error(`Invalid method ${className}.${methodName} when parsing: ${match[0]}`);
    if (!name)
      throw new Error('Invalid member name ' + spec.text);
    if (match[1] === 'param') {
      const arg = this.parseProperty(spec);
      arg.name = name;
      const existingArg = method.argsArray.find(m => m.name === arg.name);
      if (existingArg && isTypeOverride(existingArg, arg)) {
        if (!arg.langs || !arg.langs.only)
          throw new Error('Override does not have lang: ' + spec.text);
        for (const lang of arg.langs.only) {
          existingArg.langs.overrides = existingArg.langs.overrides || {};
          existingArg.langs.overrides[lang] = arg;
        }
      } else {
        method.argsArray.push(arg);
      }
    } else {
      // match[1] === 'option'
      let options = method.argsArray.find(o => o.name === 'options');
      if (!options) {
        const type = new docs.Type('Object', []);
        options = docs.Member.createProperty({ langs: {}, experimental: false, since: 'v1.0', deprecated: undefined, discouraged: undefined }, 'options', type, undefined, false);
        method.argsArray.push(options);
      }
      const p = this.parseProperty(spec);
      p.required = false;
      // @ts-ignore
      options.type.properties.push(p);
    }
  }

  /**
   * @param {MarkdownHeaderNode} spec
   */
  parseProperty(spec) {
    const param = childrenWithoutProperties(spec)[0];
    const text = /** @type {string}*/(param.text);
    let typeStart = text.indexOf('<');
    while ('?e'.includes(text[typeStart - 1]))
      typeStart--;
    const name = text.substring(0, typeStart).replace(/\`/g, '').trim();
    const comments = extractComments(spec);
    const { type, optional } = this.parseType(/** @type {MarkdownLiNode} */(param));
    return docs.Member.createProperty(extractMetainfo(spec), name, type, comments, !optional);
  }

  /**
   * @param {MarkdownLiNode} spec
   * @return {{ type: docs.Type, optional: boolean, experimental: boolean }}
   */
  parseType(spec) {
    const arg = parseVariable(spec.text);
    const properties = [];
    for (const child of /** @type {MarkdownLiNode[]} */ (spec.children) || []) {
      const { name, text } = parseVariable(/** @type {string} */(child.text));
      const comments = /** @type {MarkdownNode[]} */ ([{ type: 'text', text }]);
      const childType = this.parseType(child);
      properties.push(docs.Member.createProperty({ langs: {}, experimental: childType.experimental, since: 'v1.0', deprecated: undefined, discouraged: undefined }, name, childType.type, comments, !childType.optional));
    }
    const type = docs.Type.parse(arg.type, properties);
    return { type, optional: arg.optional, experimental: arg.experimental };
  }
}

/**
 * @param {string} line
 * @returns {{ name: string, type: string, text: string, optional: boolean, experimental: boolean }}
 */
function parseVariable(line) {
  let match = line.match(/^`([^`]+)` (.*)/);
  if (!match)
    match = line.match(/^(returns): (.*)/);
  if (!match)
    match = line.match(/^(type): (.*)/);
  if (!match)
    match = line.match(/^(argument): (.*)/);
  if (!match)
    throw new Error('Invalid argument: ' + line);
  const name = match[1];
  let remainder = match[2];
  let optional = false;
  let experimental = false;
  while ('?e'.includes(remainder[0])) {
    if (remainder[0] === '?')
      optional = true;
    else if (remainder[0] === 'e')
      experimental = true;
    remainder = remainder.substring(1);
  }
  if (!remainder.startsWith('<'))
    throw new Error(`Bad argument: "${name}" in "${line}"`);
  let depth = 0;
  for (let i = 0; i < remainder.length; ++i) {
    const c = remainder.charAt(i);
    if (c === '<')
      ++depth;
    if (c === '>')
      --depth;
    if (depth === 0)
      return { name, type: remainder.substring(1, i), text: remainder.substring(i + 2), optional, experimental };
  }
  throw new Error('Should not be reached, line: ' + line);
}

/**
 * @param {MarkdownNode[]} body
 * @param {MarkdownNode[]} params
 */
function applyTemplates(body, params) {
  const paramsMap = new Map();
  for (const node of params)
    paramsMap.set('%%-' + node.text + '-%%', node);

  const visit = (node, parent) => {
    if (node.text && node.text.includes('-inline- = %%')) {
      const [name, key] = node.text.split('-inline- = ');
      const list = paramsMap.get(key);
      const newChildren = [];
      if (!list)
        throw new Error('Bad template: ' + key);
      for (const prop of list.children) {
        const template = paramsMap.get(prop.text);
        if (!template)
          throw new Error('Bad template: ' + prop.text);
        const children = childrenWithoutProperties(template);
        const { name: argName } = parseVariable(children[0].text || '');
        newChildren.push({
          type: node.type,
          text: name + argName,
          children: [...node.children, ...template.children.map(c => md.clone(c))]
        });
      }
      const nodeIndex = parent.children.indexOf(node);
      parent.children = [...parent.children.slice(0, nodeIndex), ...newChildren, ...parent.children.slice(nodeIndex + 1)];
    } else if (node.text && node.text.includes(' = %%')) {
      const [name, key] = node.text.split(' = ');
      node.text = name;
      const template = paramsMap.get(key);
      if (!template)
        throw new Error('Bad template: ' + key);
      node.children.push(...template.children.map(c => md.clone(c)));
    } else if (node.text && node.text.includes('%%-template-')) {
      node.text.replace(/%%-template-[^%]+-%%/, templateName => {
        const template = paramsMap.get(templateName);
        if (!template)
          throw new Error('Bad template: ' + templateName);
        const nodeIndex = parent.children.indexOf(node);
        parent.children = [...parent.children.slice(0, nodeIndex), ...template.children, ...parent.children.slice(nodeIndex + 1)];
      });
    }
    for (const child of node.children || [])
      visit(child, node);
    if (node.children)
      node.children = node.children.filter(child => !child.text || !child.text.includes('-inline- = %%'));
  };

  for (const node of body)
    visit(node, null);

  return body;
}

/**
 * @param {MarkdownHeaderNode} item
 * @returns {MarkdownNode[]}
 */
function extractComments(item) {
  return childrenWithoutProperties(item).filter(c => {
    if (c.type.startsWith('h'))
      return false;
    if (c.type === 'li' && c.liType === 'default')
      return false;
    return true;
  });
}

/**
 * @param {string} apiDir
 * @param {string=} paramsPath
 */
function parseApi(apiDir, paramsPath) {
  return new ApiParser(apiDir, paramsPath).documentation;
}

/**
 * @param {MarkdownHeaderNode} spec
 * @returns {import('./documentation').Metainfo}
 */
function extractMetainfo(spec) {
  return {
    langs: extractLangs(spec),
    since: extractSince(spec),
    experimental: extractExperimental(spec),
    deprecated: extractAttribute(spec, 'deprecated'),
    discouraged: extractAttribute(spec, 'discouraged'),
  };
}

/**
 * @param {MarkdownNode} spec
 * @returns {import('./documentation').Langs}
 */
function extractLangs(spec) {
  for (const child of spec.children || []) {
    if (child.type !== 'li' || child.liType !== 'bullet' || !child.text.startsWith('langs:'))
      continue;

    const only = child.text.substring('langs:'.length).trim();
    /** @type {Object<string, string>} */
    const aliases = {};
    for (const p of child.children || []) {
      const match = /** @type {string}*/(p.text).match(/alias-(\w+)[\s]*:(.*)/);
      if (match)
        aliases[match[1].trim()] = match[2].trim();
    }
    return {
      only: only ? only.split(',').map(l => l.trim()) : undefined,
      aliases,
      types: {},
      overrides: {}
    };
  }
  return {};
}

/**
 * @param {MarkdownHeaderNode} spec
 * @returns {string}
 */
function extractSince(spec) {
  for (const child of spec.children) {
    if (child.type !== 'li' || child.liType !== 'bullet' || !child.text.startsWith('since:'))
      continue;
    return child.text.substring(child.text.indexOf(':') + 1).trim();
  }
  console.error('Missing since: v1.** declaration in node:');
  console.error(spec);
  process.exit(1);
}

/**
 * @param {MarkdownHeaderNode} spec
 * @returns {boolean}
 */
 function extractExperimental(spec) {
  for (const child of spec.children) {
    if (child.type === 'li' && child.liType === 'bullet' && child.text === 'experimental')
      return true;
  }
  return false;
}

/**
 * @param {MarkdownHeaderNode} spec
 * @param {string} name
 * @returns {string | undefined}
 */
 function extractAttribute(spec, name) {
  for (const child of spec.children) {
    if (child.type !== 'li' || child.liType !== 'bullet' || !child.text.startsWith(name + ':'))
      continue;
    return child.text.substring(child.text.indexOf(':') + 1).trim() || undefined;
  }
}

/**
 * @param {MarkdownHeaderNode} spec
 * @returns {MarkdownNode[]}
 */
function childrenWithoutProperties(spec) {
  return (spec.children || []).filter(c => {
    const isProperty = c.type === 'li' && c.liType === 'bullet' && (c.text.startsWith('langs:') || c.text.startsWith('since:') || c.text.startsWith('deprecated:') || c.text.startsWith('discouraged:') || c.text === 'experimental');
    return !isProperty;
  });
}

/**
 * @param {docs.Member} existingMember
 * @param {docs.Member} member
 * @returns {boolean}
 */
function isTypeOverride(existingMember, member) {
  if (!existingMember.langs.only || !member.langs.only)
    return true;
  const existingOnly = existingMember.langs.only;
  if (member.langs.only.every(l => existingOnly.includes(l))) {
    return true;
  } else if (member.langs.only.some(l => existingOnly.includes(l))) {
    throw new Error(`Ambiguous language override for: ${member.name}`);
  }
  return false;
}

/**
 * @param {MarkdownNode[]=} params
 */
function checkNoDuplicateParamEntries(params) {
  if (!params)
    return;
  const entries = new Set();
  for (const node of params) {
    if (entries.has(node.text))
      throw new Error('Duplicate param entry, for language-specific params use prefix (e.g. js-...): ' + node.text);
    entries.add(node.text);
  }
}

module.exports = { parseApi };


text:
'''
Description:
    Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
    For example,
    given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].
Note:
    You must do this in-place without making a copy of the array.
    Minimize the total number of operations.

Tags: Array, Two Pointers
'''

class Solution(object):
    def moveZeroes(self, nums):
        """
        :type nums: List[int]
        :rtype: void Do not return anything, modify nums in-place instead.
        """
        # bubble sort
        passnum = len(nums)-1
        exchanges = True
        while passnum > 0 and exchanges:
            exchanges = False
            for i in range(passnum):
                if nums[i] == 0:
                    exchanges = True
                    nums[i], nums[i+1] = nums[i+1], nums[i]
            passnum = passnum - 1

    def moveZeros2(self, nums):
        pos = 0
        for i in xrange(len(nums)):
            if nums[i]:
                nums[i], nums[pos] = nums[pos], nums[i]
                pos += 1

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Net;
using System.ServiceProcess;
using Elders.Pandora;

namespace PushNotifications.WS
{
    public partial class PushNotificationService : ServiceBase
    {
        public PushNotificationService()
        {
            InitializeComponent();
        }

        public void Debug()
        {
            OnStart(null);
        }

        protected override void OnStart(string[] args)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            var appContext = new ApplicationContext("push-notifications.ws");
            var cfgRepo = new ConsulForPandora(new Uri("http://consul.local.com:8500"));
            var pandora = new Pandora(appContext, cfgRepo);
            LogStartup.Boot(pandora);
            PushNotificationStartUp.Start(pandora);
        }

        protected override void OnStop()
        {
            PushNotificationStartUp.Stop();
        }
    }
}


text:
<?php

namespace ElkArte\sources\subs\ScheduledTask;

if (!defined('ELK'))
	die('No access...');

/**
 * This function does daily cleaning up:
 *
 * - decrements warning levels if it's enabled
 * - consolidate spider statistics
 * - fix MySQL version
 * - regenerate Diffie-Hellman keys for OpenID
 * - remove obsolete login history logs
 *
 * @package ScheduledTasks
 */
class Daily_Maintenance implements Scheduled_Task_Interface
{
	public function run()
	{
		global $modSettings;

		$db = database();

		// First clean out the cache.
		clean_cache('data');

		// If warning decrement is enabled and we have people who have not had a new warning in 24 hours, lower their warning level.
		list (, , $modSettings['warning_decrement']) = explode(',', $modSettings['warning_settings']);
		if ($modSettings['warning_decrement'])
		{
			// Find every member who has a warning level...
			$request = $db->query('', '
				SELECT id_member, warning
				FROM {db_prefix}members
				WHERE warning > {int:no_warning}',
				array(
					'no_warning' => 0,
				)
			);
			$members = array();
			while ($row = $db->fetch_assoc($request))
				$members[$row['id_member']] = $row['warning'];
			$db->free_result($request);

			// Have some members to check?
			if (!empty($members))
			{
				// Find out when they were last warned.
				$request = $db->query('', '
					SELECT id_recipient, MAX(log_time) AS last_warning
					FROM {db_prefix}log_comments
					WHERE id_recipient IN ({array_int:member_list})
						AND comment_type = {string:warning}
					GROUP BY id_recipient',
					array(
						'member_list' => array_keys($members),
						'warning' => 'warning',
					)
				);
				$member_changes = array();
				while ($row = $db->fetch_assoc($request))
				{
					// More than 24 hours ago?
					if ($row['last_warning'] <= time() - 86400)
						$member_changes[] = array(
							'id' => $row['id_recipient'],
							'warning' => $members[$row['id_recipient']] >= $modSettings['warning_decrement'] ? $members[$row['id_recipient']] - $modSettings['warning_decrement'] : 0,
						);
				}
				$db->free_result($request);

				// Have some members to change?
				if (!empty($member_changes))
				{
					require_once(SUBSDIR . '/Members.subs.php');
					foreach ($member_changes as $change)
						updateMemberData($change['id'], array('warning' => $change['warning']));
				}
			}
		}

		// Do any spider stuff.
		if (!empty($modSettings['spider_mode']) && $modSettings['spider_mode'] > 1)
		{
			// We'll need this.
			require_once(SUBSDIR . '/SearchEngines.subs.php');
			consolidateSpiderStats();
		}

		// Check the database version - for some buggy MySQL version.
		$server_version = $db->db_server_info();
		if (DB_TYPE === 'MySQL' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
			updateSettings(array('db_mysql_group_by_fix' => '1'));
		elseif (!empty($modSettings['db_mysql_group_by_fix']))
			removeSettings('db_mysql_group_by_fix');

		// Regenerate the Diffie-Hellman keys if OpenID is enabled.
		if (!empty($modSettings['enableOpenID']))
		{
			require_once(SUBSDIR . '/OpenID.subs.php');
			$openID = new OpenID();
			$openID->setup_DH(true);
		}
		elseif (!empty($modSettings['dh_keys']))
			removeSettings('dh_keys');

		// Clean up some old login history information.
		$db->query('', '
			DELETE FROM {db_prefix}member_logins
			WHERE time > {int:oldLogins}',
			array(
				'oldLogins' => !empty($modSettings['loginHistoryDays']) ? 60 * 60 * $modSettings['loginHistoryDays'] : 108000,
		));

		// Log we've done it...
		return true;
	}
}


text:
public class Edge {

	/** index of vertex u */
	private int u;
	/** index of vertex v */
	private int v;
	/** weight of undirected edge {u,v} */
	private double w;

	/** This constructor sets vertex u to 0, v to 1, and w to 0.0 */
	Edge() {
		this(0, 1, 0.0);
	}

	/** This constructor sets the u-vertex to u,
	   v-vertex to v, and weight to w */
	Edge(int u, int v, double w) {
		this.u = u;
		this.v = v;
		this.w = w;
	}

	/** This method sets the u-vertex to u. */
	public void setU(int u) {
		this.u = u;
	}

	/** This method sets the v-vertex to v. */
	public void setV(int v) {
		this.v = v;
	}

	/** This method sets the weight to w. */
	public void setW(double w) {
		this.w = w;
	}

	/** This method returns the u-vertex. */
	public int getU() {
		return u;
	}

	/** This method returns the v-vertex. */
	public int getV() {
		return v;
	}

	/** This method returns the weight. */
	public double getW() {
		return w;
	}

	/** This method returns a string representation
	   of the edge. */
	public String toString() {
		return "(" + u + "," + v + "," + w + ")";
	}
}


text:
<!DOCTYPE html>

    <title>Template</title>

    <link rel="stylesheet" href="plugins/parsley/parsley.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="plugins/pNotify/pnotify.custom.min.css">
    <link rel="stylesheet" href="plugins/confirm/jquery-confirm.min.css">
    <link rel="stylesheet" href="template.css">
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="dist/css/skins/skin-blue.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

          ALT

          AdminLTE

            Toggle navigation

                  4

You have 4 messages

                            Support Team
                             5 mins

Why not buy a new awesome theme?

                            AdminLTE Design Team
                             2 hours

Why not buy a new awesome theme?

                            Developers
                             Today

Why not buy a new awesome theme?

                            Sales Department
                             Yesterday

Why not buy a new awesome theme?

                            Reviewers
                             2 days

Why not buy a new awesome theme?

See All Messages

                  10

You have 10 notifications

                           5 new members joined today

                           Very long description here that may not fit into the page and may cause design problems

                           5 new members joined

                           25 sales made

                           You changed your username

View all

                  9

You have 9 tasks

                            Design some buttons
                            20%

                              20% Complete

                            Create a nice theme
                            40%

                              40% Complete

                            Some task I need to do
                            60%

                              60% Complete

                            Make beautiful transitions
                            80%

                              80% Complete

                    View all tasks

                  Alexander Pierce

                      Alexander Pierce - Web Developer
                      Member since Nov. 2012

                      Followers

                      Sales

                      Friends

                      Profile

                      Sign out

Alexander Pierce

               Online

          <form action="#" method="get" class="sidebar-form">

              <input type="text" name="q" class="form-control" placeholder="Search...">

                <button type="submit" name="search" id="search-btn" class="btn btn-flat"></button>

          </form>

MAIN NAVIGATION

                 Dashboard

 Dashboard v1

 Dashboard v2

                Layout Options
                4

 Top Navigation

 Boxed

 Fixed

 Collapsed Sidebar

                 Widgets new

                Charts

 ChartJS

 Morris

 Flot

 Inline charts

                UI Elements

 General

 Icons

 Buttons

 Sliders

 Timeline

 Modals

                 Examples

 Invoice

 Profile

 Login

 Register

 Lockscreen

 404 Error

 500 Error

 Blank Page

                 Multilevel

 Level One

                   Level One

 Level Two

                       Level Two

 Level Three

 Level Three

 Level One

 Documentation

LABELS

 Important

 Warning

 Information

            Dashboard
            Control panel

 Home

Dashboard

Quick Example

                <form id="formDados" action="javascript: teste();" autocomplete="off">

                      Email address
                      <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">

                      Password
                      <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">

                      Teste
                      <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">

                      File input
                      <input type="file" id="exampleInputFile">

Example block-level help text here.

                        <input type="checkbox"> Check me out

                    <button type="button" class="btn btn-danger" onclick="cancelar();">Cancelar</button>
                    <button type="submit" class="btn btn-primary pull-right">Salvar</button>

                </form>

                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Modal title

One fine body…

                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="showNotify();">Save changes</button>

          Version 2.3.0

        Copyright © 2014-2015 Almsaeed Studio. All rights reserved.


text:
const update = false;

const giantbomb = require('giantbomb');
const gb = giantbomb('0eaca5252056e2d21c07db2b62036a89c47bc52d');

var { CommandoClient } = require('discord.js-commando');
var path = require('path');

var config = require('config.json')('./config.json');

var client = new CommandoClient({
    commandPrefix: '/',
    unknownCommandResponse: false,
    owner: [config.owner, config.owner2],
    disableEveryone: false
});

client.registry
    .registerDefaultTypes()
    .registerGroups([
        ['mod', 'Moderation']
    ])
    .registerDefaultGroups()
    .registerDefaultCommands()
    .registerCommandsIn(path.join(__dirname, 'commands'));

client.on('ready', () => {
    console.log('Logged in as ' + client.user.username + "!");
    if (update) {
        client.user.setStatus("dnd");
        client.user.setGame('Updating');
    } else {
        client.user.setGame('/help for help!', "https://www.twitch.tv/Spindlyskit");
    }
});

client.login(config.token);


text:
var util         = require('util');
var EventEmitter = require('events').EventEmitter;
var thinkgear = require('node-thinkgear-sockets');
var _            = require('lodash');
var debug        = require('debug')('meshblu-mindwave');

var client = thinkgear.createClient({ enableRawOutput: true });
var connected = false;

var MESSAGE_SCHEMA = {};

var OPTIONS_SCHEMA = {
  type: 'object',
  properties: {
    broadcastInterval : {
      type : 'number',
      required : true,
      default : 100
    }
  }
};

var DEFAULT_OPTIONS = {
  broadcastInterval: 100
};

function Plugin(){
  self = this;
  self.options = DEFAULT_OPTIONS;
  self.messageSchema = MESSAGE_SCHEMA;
  self.optionsSchema = OPTIONS_SCHEMA;
  return self;
}
util.inherits(Plugin, EventEmitter);

Plugin.prototype.onMessage = function(message){
  var payload = message.payload;
};

Plugin.prototype.onConfig = function(device){
  var self = this;
  self.setOptions(device.options||DEFAULT_OPTIONS);
};

Plugin.prototype.setOptions = function(options){
  debug('setting options', options);
  var self = this;
  self.options = options;

  if(!connected){
    debug('connected to mindwave');
    var throttledEmit = _.throttle(function(payload){
      self.emit('message', payload);
    }, self.options.broadcastInterval || 100);

    client.on('data', function (result) {
      var data = {
        devices : '*',
        payload : result
      };
      throttledEmit(data);
    });

    client.on('blink_data', function (result) {
      var data = {
        devices : '*',
        payload : result
      };
      throttledEmit(data);
    });

    self.getMindwaveConnection();

    client.on('end', function () {
      connected = false;
      console.error('mindwave client disconnected');
    });
  }
};

Plugin.prototype.getMindwaveConnection = function(){
  if(!connected){
    client.connect();
    connected = true;
  }
};

module.exports = {
  options: DEFAULT_OPTIONS,
  messageSchema: MESSAGE_SCHEMA,
  optionsSchema: OPTIONS_SCHEMA,
  Plugin: Plugin
};


text:
'use strict'

describe('Testing the app.transform.value.js service', function() {
	beforeEach(angular.mock.module('app'))

	it('should be working transformvalue first name service',
		inject(['transformvalue', function(transformvalue) {
			expect(transformvalue.name(user.fullName).first()).toBe('israel');
		}
	]))

	it('should be working transformvalue lastName service',
		inject(['transformvalue', function(transformvalue) {
			expect(transformvalue.name(user.fullName).last()).toBe('soares');
		}
	]))

	it('should be working transformvalue.phone(param).countryCode() service',
		inject(['transformvalue', function(transformvalue) {
			expect(transformvalue.phone(user.cellphoneTypeOne).countryCode()).toBe('55');
		}
	]))

	it('should be working transformvalue.phone(param).areaCode() service',
		inject(['transformvalue', function(transformvalue) {
			expect(transformvalue.phone(user.cellphoneTypeOne).areaCode()).toBe('11');
		}
	]))

	it('should be working transformvalue.phone(param).number() service',
		inject(['transformvalue', function(transformvalue) {
			expect(transformvalue.phone(user.cellphoneTypeOne).number()).toBe('123456789');
		}
	]))

	it('should be working transformvalue.cpf(param) service',
		inject(['transformvalue', function(transformvalue) {
			expect(transformvalue.cpf(user.cpf)).toBe('123.456.789-01');
		}
	]))
})


text:
import SFAdapter from 'ember-salesforce-adapter/adapters/sf-adapter';
// import SFModels from 'npm:salesforce-ember-models';
// import mocks from 'npm:sforce-mocks';

export default SFAdapter;


text:
using System;
using System.Linq;
using System.Text.RegularExpressions;
using MarkdownDeep;
using Nustache.Core;
using RazorEngine;
using RazorEngine.Templating;
using Swank.Web.Assets;

namespace Swank.Extensions
{
    public static class TemplatingExtensions
    {
        public static string RenderMustache<T>(this string template, T model)
        {
            return Render.StringToString(template.NormalizeLineBreaks(), model);
        }

        public static void CompileRazor<T>(this string template)
        {
            template = template.NormalizeLineBreaks();
            var name = template.Hash();
            if (Engine.Razor.IsTemplateCached(name, typeof(T))) return;
            Engine.Razor.Compile(template, name, typeof(T));
        }

        public static string RenderRazor<T>(this string template, T model)
        {
            template = template.NormalizeLineBreaks();
            var name = template.Hash();
            return Engine.Razor.IsTemplateCached(name, typeof(T))
                ? Engine.Razor.Run(name, typeof(T), model)
                : Engine.Razor.RunCompile(template, name, typeof(T), model);
        }

        public static string RenderAndCompileRazor<T>(this string template, T model)
        {
            template = template.NormalizeLineBreaks();
            return Engine.Razor.RunCompile(template, template.Hash(), typeof(T), model);
        }

        // Markdown

        public static string AddMarkdownExtension(this string filename)
        {
            return filename.EndsWith(MarkdownAsset.Extension) ?
                filename : filename + MarkdownAsset.Extension;
        }

        public static string TransformMarkdownBlock(this string markdown)
        {
            return markdown.IsNullOrEmpty() ? markdown :
                new Markdown
                {
                    AutoHeadingIDs = true,
                    ExtraMode = true
                }.Transform(markdown
                    .RenderMarkdownFencedCodeBlocks()
                    .ConvertEmojisToHtml())
                .HtmlDecode().Trim();
        }

        public static string TransformMarkdownInline(this string markdown)
        {
            return markdown.TransformMarkdownBlock().UnwrapParagraphTags();
        }

        private static readonly Regex FragmentIdRegex = new Regex("\\s");

        public static string ToFragmentId(this string value)
        {
            return value.IsNullOrEmpty() ? value :
                FragmentIdRegex.Replace(value, "-").ToLower();
        }

        private static readonly Regex FencedCodeBlocksRegex =
            new Regex(@"^((`{3}\s*?)(\w+)?(\s*([\w\W]+?)\n*)\2)\n*",
                RegexOptions.Multiline);

        public static string RenderMarkdownFencedCodeBlocks(this string source)
        {
            return source.IsNullOrEmpty() ? source :
                FencedCodeBlocksRegex.Replace(source, x =>
                    $"
" +
                    x.Groups[4].Value.Trim() + "
");
        }

        // Html

        public static string UnwrapParagraphTags(this string text)
        {
            return string.IsNullOrEmpty(text) ? text :
                Regex.Replace(text, "(^
|
$)", "", RegexOptions.IgnoreCase);
        }

        public static string ConvertNbspHtmlEntityToSpaces(this string text)
        {
            return Regex.Replace(text, " ", " ", RegexOptions.IgnoreCase);
        }

        public static string ConvertBrHtmlTagsToLineBreaks(this string text)
        {
            return Regex.Replace(text, "
", "\r\n", RegexOptions.IgnoreCase);
        }

        public static string RemoveWhitespace(this string text)
        {
            if (string.IsNullOrEmpty(text)) return text;
            return text.Split(new[] { "\r\n", "\r", "\n" },
                    StringSplitOptions.RemoveEmptyEntries)
                .Select(x => x.Trim())
                .Where(x => !string.IsNullOrEmpty(x))
                .Aggregate((a, i) => a + i);
        }

        public static string NormalizeLineBreaks(this string value)
        {
            return value.Replace("\r\n", "\n")
                .Replace("\r", "\n")
                .Replace("\n", "\r\n");
        }

        public static string ConvertEmojisToHtml(this string text)
        {
            return Macros.Aggregate(text, (t, m) => t.Replace(
                $":{m}:", $""));
        }

        private static readonly string[] Macros = { "-1", "+1", "8ball", "100", "1234",
            "a", "ab", "abc", "abcd", "accept", "aerial_tramway", "airplane",
            "alarm_clock", "alien", "ambulance", "anchor", "angel", "anger", "angry",
            "anguished", "ant", "apple", "aquarius", "aries", "arrow_backward",
            "arrow_double_down", "arrow_double_up", "arrow_down_small", "arrow_down",
            "arrow_forward", "arrow_heading_down", "arrow_heading_up", "arrow_left",
            "arrow_lower_left", "arrow_lower_right", "arrow_right_hook", "arrow_right",
            "arrow_up_down", "arrow_up_small", "arrow_up", "arrow_upper_left",
            "arrow_upper_right", "arrows_clockwise", "arrows_counterclockwise", "art",
            "articulated_lorry", "astonished", "atm", "b", "baby_bottle", "baby_chick",
            "baby_symbol", "baby", "back", "baggage_claim", "balloon", "ballot_box_with_check",
            "bamboo", "banana", "bangbang", "bank", "bar_chart", "barber", "baseball",
            "basketball", "bath", "bathtub", "battery", "bear", "bee", "beer", "beers",
            "beetle", "beginner", "bell", "bento", "bicyclist", "bike", "bikini", "bird",
            "birthday", "black_circle", "black_joker", "black_medium_small_square", "black_medium_square",
            "black_nib", "black_small_square", "black_square_button", "black_square", "blossom",
            "blowfish", "blue_book", "blue_car", "blue_heart", "blush", "boar", "boat", "bomb",
            "book", "bookmark_tabs", "bookmark", "books", "boom", "boot", "bouquet", "bow",
            "bowling", "bowtie", "boy", "bread", "bride_with_veil", "bridge_at_night", "briefcase",
            "broken_heart", "bug", "bulb", "bullettrain_front", "bullettrain_side", "bus", "busstop",
            "bust_in_silhouette", "busts_in_silhouette", "cactus", "cake", "calendar", "calling",
            "camel", "camera", "cancer", "candy", "capital_abcd", "capricorn", "car", "card_index",
            "carousel_horse", "cat", "cat2", "cd", "chart_with_downwards_trend", "chart_with_upwards_trend",
            "chart", "checkered_flag", "cherries", "cherry_blossom", "chestnut", "chicken",
            "children_crossing", "chocolate_bar", "christmas_tree", "church", "cinema", "circus_tent",
            "city_sunrise", "city_sunset", "cl", "clap", "clapper", "clipboard", "clock1", "clock2",
            "clock3", "clock4", "clock5", "clock6", "clock7", "clock8", "clock9", "clock10", "clock11",
            "clock12", "clock130", "clock230", "clock330", "clock430", "clock530", "clock630", "clock730",
            "clock830", "clock930", "clock1030", "clock1130", "clock1230", "closed_book",
            "closed_lock_with_key", "closed_umbrella", "cloud", "clubs", "cn", "cocktail", "coffee",
            "cold_sweat", "collision", "computer", "confetti_ball", "confounded", "confused",
            "congratulations", "construction_worker", "construction", "convenience_store", "cookie",
            "cool", "cop", "copyright", "corn", "couple_with_heart", "couple", "couplekiss", "cow",
            "cow2", "credit_card", "crescent_moon", "crocodile", "crossed_flags", "crown", "cry",
            "crying_cat_face", "crystal_ball", "cupid", "curly_loop", "currency_exchange", "curry",
            "custard", "customs", "cyclone", "dancer", "dancers", "dango", "dart", "dash", "date",
            "de", "deciduous_tree", "department_store", "diamond_shape_with_a_dot_inside", "diamonds",
            "disappointed_relieved", "disappointed", "dizzy_face", "dizzy", "do_not_litter", "dog", "dog2",
            "dollar", "dolls", "dolphin", "donut", "door", "doughnut", "dragon_face", "dragon", "dress",
            "dromedary_camel", "droplet", "dvd", "e-mail", "ear_of_rice", "ear", "earth_africa",
            "earth_americas", "earth_asia", "egg", "eggplant", "eight_pointed_black_star", "eight_spoked_asterisk",
            "eight", "electric_plug", "elephant", "email", "end", "envelope", "es", "euro", "european_castle",
            "european_post_office", "evergreen_tree", "exclamation", "expressionless", "eyeglasses", "eyes",
            "facepunch", "factory", "fallen_leaf", "family", "fast_forward", "fax", "fearful", "feelsgood"
                , "feet", "ferris_wheel", "file_folder", "finnadie", "fire_engine", "fire", "fireworks",
            "first_quarter_moon_with_face", "first_quarter_moon", "fish_cake", "fish", "fishing_pole_and_fish",
            "fist", "five", "flags", "flashlight", "floppy_disk", "flower_playing_cards", "flushed", "foggy",
            "football", "fork_and_knife", "fountain", "four_leaf_clover", "four", "fr", "free",
            "fried_shrimp", "fries", "frog", "frowning", "fu", "fuelpump", "full_moon_with_face", "full_moon",
            "game_die", "gb", "gem", "gemini", "ghost", "gift_heart", "gift", "girl", "globe_with_meridians",
            "goat", "goberserk", "godmode", "golf", "grapes", "green_apple", "green_book", "green_heart",
            "grey_exclamation", "grey_question", "grimacing", "grin", "grinning", "guardsman", "guitar",
            "gun", "haircut", "hamburger", "hammer", "hamster", "hand", "handbag", "hankey", "hash",
            "hatched_chick", "hatching_chick", "headphones", "hear_no_evil", "heart_decoration", "heart_eyes_cat",
            "heart_eyes", "heart", "heartbeat", "heartpulse", "hearts", "heavy_check_mark", "heavy_division_sign",
            "heavy_dollar_sign", "heavy_exclamation_mark", "heavy_minus_sign", "heavy_multiplication_x",
            "heavy_plus_sign", "helicopter", "herb", "hibiscus", "high_brightness", "high_heel",
            "hocho", "honey_pot", "honeybee", "horse_racing", "horse", "hospital", "hotel", "hotsprings",
            "hourglass_flowing_sand", "hourglass", "house_with_garden", "house", "hurtrealbad", "hushed",
            "ice_cream", "icecream", "id", "ideograph_advantage", "imp", "inbox_tray", "incoming_envelope",
            "information_desk_person", "information_source", "innocent", "interrobang", "iphone", "it",
            "izakaya_lantern", "jack_o_lantern", "japan", "japanese_castle", "japanese_goblin", "japanese_ogre",
            "jeans", "joy_cat", "joy", "jp", "key", "keycap_ten", "kimono", "kiss", "kissing_cat",
            "kissing_closed_eyes", "kissing_face", "kissing_heart", "kissing_smiling_eyes", "kissing", "koala",
            "koko", "kr", "large_blue_circle", "large_blue_diamond", "large_orange_diamond",
            "last_quarter_moon_with_face", "last_quarter_moon", "laughing", "leaves", "ledger", "left_luggage",
            "left_right_arrow", "leftwards_arrow_with_hook", "lemon", "leo", "leopard", "libra", "light_rail",
            "link", "lips", "lipstick", "lock_with_ink_pen", "lock", "lollipop", "loop", "loudspeaker",
            "love_hotel", "love_letter", "low_brightness", "m", "mag_right", "mag", "mahjong",
            "mailbox_closed", "mailbox_with_mail", "mailbox_with_no_mail", "mailbox", "man_with_gua_pi_mao",
            "man_with_turban", "man", "mans_shoe", "maple_leaf", "mask", "massage", "meat_on_bone", "mega",
            "melon", "memo", "mens", "metal", "metro", "microphone", "microscope", "milky_way", "minibus",
            "minidisc", "mobile_phone_off", "money_with_wings", "moneybag", "monkey_face", "monkey", "monorail",
            "mortar_board", "mount_fuji", "mountain_bicyclist", "mountain_cableway", "mountain_railway", "mouse",
            "mouse2", "movie_camera", "moyai", "muscle", "mushroom", "musical_keyboard", "musical_note",
            "musical_score", "mute", "nail_care", "name_badge", "neckbeard", "necktie",
            "negative_squared_cross_mark", "neutral_face", "new_moon_with_face", "new_moon", "new", "newspaper",
            "ng", "nine", "no_bell", "no_bicycles", "no_entry_sign", "no_entry", "no_good", "no_mobile_phones",
            "no_mouth", "no_pedestrians", "no_smoking", "non-potable_water", "nose",
            "notebook_with_decorative_cover", "notebook", "notes", "nut_and_bolt", "o", "o2", "ocean",
            "octocat", "octopus", "oden", "office", "ok_hand", "ok_woman", "ok", "older_man",
            "older_woman", "on", "oncoming_automobile", "oncoming_bus", "oncoming_police_car", "oncoming_taxi",
            "one", "open_file_folder", "open_hands", "open_mouth", "ophiuchus", "orange_book",
            "outbox_tray", "ox", "package", "page_facing_up", "page_with_curl", "pager", "palm_tree",
            "panda_face", "paperclip", "parking", "part_alternation_mark", "partly_sunny", "passport_control",
            "paw_prints", "peach", "pear", "pencil", "pencil2", "penguin", "pensive", "performing_arts",
            "persevere", "person_frowning", "person_with_blond_hair", "person_with_pouting_face", "phone",
            "pig_nose", "pig", "pig2", "pill", "pineapple", "pisces", "pizza", "plus1", "point_down",
            "point_left", "point_right", "point_up_2", "point_up", "police_car", "poodle", "poop",
            "post_office", "postal_horn", "postbox", "potable_water", "pouch", "poultry_leg",
            "pound", "pouting_cat", "pray", "princess", "punch", "purple_heart", "purse", "pushpin",
            "put_litter_in_its_place", "question", "rabbit", "rabbit2", "racehorse", "radio_button", "radio",
            "rage", "rage1", "rage2", "rage3", "rage4", "railway_car", "rainbow", "raised_hand",
            "raised_hands", "raising_hand", "ram", "ramen", "rat", "recycle", "red_car", "red_circle",
            "registered", "relaxed", "relieved", "repeat_one", "repeat", "restroom", "revolving_hearts",
            "rewind", "ribbon", "rice_ball", "rice_cracker", "rice_scene", "rice", "ring", "rocket",
            "roller_coaster", "rooster", "rose", "rotating_light", "round_pushpin", "rowboat", "ru",
            "rugby_football", "runner", "running_shirt_with_sash", "running", "sa", "sagittarius",
            "sailboat", "sake", "sandal", "santa", "satellite", "satisfied", "saxophone", "school_satchel",
            "school", "scissors", "scorpius", "scream_cat", "scream", "scroll", "seat", "secret",
            "see_no_evil", "seedling", "seven", "shaved_ice", "sheep", "shell", "ship", "shipit",
            "shirt", "shit", "shoe", "shower", "signal_strength", "simple_smile", "six_pointed_star",
            "six", "ski", "skull", "sleeping", "sleepy", "slot_machine", "small_blue_diamond",
            "small_orange_diamond", "small_red_triangle_down", "small_red_triangle", "smile_cat", "smile",
            "smiley_cat", "smiley", "smiling_imp", "smirk_cat", "smirk", "smoking", "snail", "snake",
            "snowboarder", "snowflake", "snowman", "sob", "soccer", "soon", "sos", "sound",
            "space_invader", "spades", "spaghetti", "sparkle", "sparkler", "sparkles", "sparkling_heart",
            "speak_no_evil", "speaker", "speech_balloon", "speedboat", "squirrel", "star", "star2",
            "stars", "station", "statue_of_liberty", "steam_locomotive", "stew", "straight_ruler",
            "strawberry", "stuck_out_tongue_closed_eyes", "stuck_out_tongue_winking_eye", "stuck_out_tongue",
            "sun_with_face", "sunflower", "sunglasses", "sunny", "sunrise_over_mountains", "sunrise",
            "surfer", "sushi", "suspect", "suspension_railway", "sweat_drops", "sweat_smile", "sweat",
            "sweet_potato", "swimmer", "symbols", "syringe", "tada", "tanabata_tree", "tangerine",
            "taurus", "taxi", "tea", "telephone_receiver", "telephone", "telescope", "tennis",
            "tent", "thought_balloon", "three", "thumbsdown", "thumbsup", "ticket", "tiger",
            "tiger2", "tired_face", "tm", "toilet", "tokyo_tower", "tomato", "tongue", "top",
            "tophat", "tractor", "traffic_light", "train", "train2", "tram", "triangular_flag_on_post",
            "triangular_ruler", "trident", "triumph", "trolleybus", "trollface", "trophy", "tropical_drink",
            "tropical_fish", "truck", "trumpet", "tshirt", "tulip", "turtle", "tv", "twisted_rightwards_arrows",
            "two_hearts", "two_men_holding_hands", "two_women_holding_hands", "two", "u6e80", "u7a7a",
            "u55b6", "u5272", "u5408", "u6307", "u6708", "u6709", "u7121", "u7533", "u7981", "uk",
            "umbrella", "unamused", "underage", "unlock", "up", "us", "v", "vertical_traffic_light",
            "vhs", "vibration_mode", "video_camera", "video_game", "violin", "virgo", "volcano", "vs",
            "walking", "waning_crescent_moon", "waning_gibbous_moon", "warning", "watch", "water_buffalo",
            "watermelon", "wave", "wavy_dash", "waxing_crescent_moon", "waxing_gibbous_moon", "wc", "weary",
            "wedding", "whale", "whale2", "wheelchair", "white_check_mark", "white_circle", "white_flower",
            "white_large_square", "white_medium_small_square", "white_medium_square", "white_small_square",
            "white_square_button", "wind_chime", "wine_glass", "wink", "wolf", "woman", "womans_clothes",
            "womans_hat", "womens", "worried", "wrench", "x", "yellow_heart", "yen", "yum", "zap",
            "zero", "zzz.png" };
    }
}


text:
package org.apache.uima.fit.util;

import static java.lang.Integer.MAX_VALUE;
import static java.util.Arrays.asList;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.BEGINNING_WITH;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.COLOCATED;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.COVERED_BY;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.COVERING;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.ENDING_WITH;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.FOLLOWING;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.OVERLAPPING;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.OVERLAPPING_AT_BEGIN;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.OVERLAPPING_AT_END;
import static org.apache.uima.fit.util.AnnotationPredicateTestData.RelativePosition.PRECEDING;

import java.util.List;

import org.apache.uima.fit.util.SelectionAssert.TestCase;

public class AnnotationPredicateTestData {
  public static enum RelativePosition {
    COLOCATED, OVERLAPPING, OVERLAPPING_AT_BEGIN, OVERLAPPING_AT_END, COVERING, COVERED_BY, PRECEDING, FOLLOWING, BEGINNING_WITH, ENDING_WITH
  }

  // Used as fixed references for the annotation relation cases.
  private static final int BEGIN = 10;
  private static final int END = 20;
  private static final int Z_POS = 10;

  public static final TestCase T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13;

  public static final List<TestCase> NON_ZERO_WIDTH_TEST_CASES = asList(
          T1 = new TestCase("1) Y begins and ends after X (### [---])",
                  p -> p.apply(BEGIN, END, END + 1, MAX_VALUE), asList(PRECEDING)),
          T2 = new TestCase("2) Y begins at X's end and ends after X (###[---])",
                  p -> p.apply(BEGIN, END, END, MAX_VALUE), asList(PRECEDING)),
          T3 = new TestCase("3) Y begins within and ends after X (##[#--])",
                  p -> p.apply(BEGIN, END, END - 1, MAX_VALUE),
                  asList(OVERLAPPING, OVERLAPPING_AT_BEGIN)),
          T4 = new TestCase("4) Y begins and ends at X's boundries ([###])",
                  p -> p.apply(BEGIN, END, BEGIN, END),
                  asList(OVERLAPPING, COLOCATED, COVERED_BY, COVERING, BEGINNING_WITH,
                          ENDING_WITH)),
          T5 = new TestCase("5) Y begins and ends within X (#[#]#)",
                  p -> p.apply(BEGIN, END, BEGIN + 1, END - 1), asList(OVERLAPPING, COVERING)),
          T6 = new TestCase("6) Y begins at and ends before X's boundries ([##]#)",
                  p -> p.apply(BEGIN, END, BEGIN, END - 1),
                  asList(OVERLAPPING, COVERING, BEGINNING_WITH, OVERLAPPING_AT_END)),
          T7 = new TestCase("7) Y begins after and ends at X's boundries (#[##])",
                  p -> p.apply(BEGIN, END, BEGIN + 1, END),
                  asList(OVERLAPPING, COVERING, ENDING_WITH, OVERLAPPING_AT_BEGIN)),
          T8 = new TestCase("8) Y begins before and ends after X's boundries ([-###-])",
                  p -> p.apply(BEGIN, END, BEGIN - 1, END + 1), asList(OVERLAPPING, COVERED_BY)),
          T9 = new TestCase("9) X starts where Y begins and ends within Y ([##-])",
                  p -> p.apply(BEGIN, END, BEGIN, END + 1),
                  asList(OVERLAPPING, COVERED_BY, BEGINNING_WITH)),
          T10 = new TestCase("10) X starts within Y and ends where Y ends ([-##])",
                  p -> p.apply(BEGIN, END, BEGIN - 1, END),
                  asList(OVERLAPPING, COVERED_BY, ENDING_WITH)),
          T11 = new TestCase("11) Y begins before and ends within X ([--#]##)",
                  p -> p.apply(BEGIN, END, 0, BEGIN + 1), asList(OVERLAPPING, OVERLAPPING_AT_END)),
          T12 = new TestCase("12) Y begins before and ends where X begins ([---]###)",
                  p -> p.apply(BEGIN, END, 0, BEGIN), asList(FOLLOWING)),
          T13 = new TestCase("13) Y begins and ends before X begins ([---] ###)",
                  p -> p.apply(BEGIN, END, 0, BEGIN - 1), asList(FOLLOWING)));

  public static final TestCase TZ1, TZ2, TZ3, TZ4, TZ5, TZ6, TZ7, TZ8, TZ9, TZ10, TZ11;

  public static final List<TestCase> ZERO_WIDTH_TEST_CASES = asList(
          TZ1 = new TestCase("Z1) Zero-width X before Y start (# [---])",
                  p -> p.apply(Z_POS, Z_POS, Z_POS + 10, Z_POS + 20), asList(PRECEDING)),
          TZ2 = new TestCase("Z2) Zero-width Y after X's end (### |)",
                  p -> p.apply(BEGIN, END, END + 1, END + 1), asList(PRECEDING)),
          TZ3 = new TestCase("Z3) Zero-width X at Y's start (#---])",
                  p -> p.apply(Z_POS, Z_POS, Z_POS, Z_POS + 10),
                  asList(PRECEDING, OVERLAPPING, COVERED_BY, BEGINNING_WITH)),
          TZ4 = new TestCase("Z4) Zero-width X at Y's end ([---#)",
                  p -> p.apply(Z_POS, Z_POS, Z_POS - 10, Z_POS),
                  asList(FOLLOWING, OVERLAPPING, COVERED_BY, ENDING_WITH)),
          TZ5 = new TestCase("Z5) Zero-width Y where X begins (|###)",
                  p -> p.apply(BEGIN, END, BEGIN, BEGIN),
                  asList(FOLLOWING, OVERLAPPING, COVERING, BEGINNING_WITH)),
          TZ6 = new TestCase("Z6) Zero-width Y within X (#|#)",
                  p -> p.apply(BEGIN, END, BEGIN + 1, BEGIN + 1), asList(OVERLAPPING, COVERING)),
          TZ7 = new TestCase("Z7) Zero-width Y at X's end (###|)",
                  p -> p.apply(BEGIN, END, END, END),
                  asList(PRECEDING, OVERLAPPING, COVERING, ENDING_WITH)),
          TZ8 = new TestCase("Z8) Zero-width X with Y (-|-)",
                  p -> p.apply(Z_POS, Z_POS, Z_POS - 5, Z_POS + 5),
                  asList(OVERLAPPING, COVERED_BY)),
          TZ9 = new TestCase("Z9) Zero-width X after Y's end ([---] #)",
                  p -> p.apply(Z_POS, Z_POS, Z_POS - 10, Z_POS - 5), asList(FOLLOWING)),
          TZ10 = new TestCase("Z10) Zero-width Y before X begins (| ###)",
                  p -> p.apply(BEGIN, END, BEGIN - 1, BEGIN - 1), asList(FOLLOWING)),
          TZ11 = new TestCase("Z11) Zero-width X matches zero-width Y start/end (#)",
                  p -> p.apply(Z_POS, Z_POS, Z_POS, Z_POS),
                  asList(FOLLOWING, PRECEDING, OVERLAPPING, COVERED_BY, COVERING, COLOCATED,
                          BEGINNING_WITH, ENDING_WITH)));
}


text:
package com.cloud.agent.resource.secondarystorage;

import com.cloud.legacymodel.storage.DownloadCompleteCallback;
import com.cloud.legacymodel.storage.TemplateDownloadStatus;

public interface TemplateDownloader extends Runnable {

    long DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES = 50L * 1024L * 1024L * 1024L;

    /**
     * Initiate download, resuming a previous one if required
     *
     * @param resume   resume if necessary
     * @param callback completion callback to be called after download is complete
     * @return bytes downloaded
     */
    long download(boolean resume, DownloadCompleteCallback callback);

    /**
     * @return
     */
    boolean stopDownload();

    /**
     * @return percent of file downloaded
     */
    int getDownloadPercent();

    /**
     * Get the status of the download
     *
     * @return status of download
     */
    TemplateDownloadStatus getStatus();

    void setStatus(TemplateDownloadStatus status);

    /**
     * Get time taken to download so far
     *
     * @return time in seconds taken to download
     */
    long getDownloadTime();

    /**
     * Get bytes downloaded
     *
     * @return bytes downloaded so far
     */
    long getDownloadedBytes();

    /**
     * Get the error if any
     *
     * @return error string if any
     */
    String getDownloadError();

    void setDownloadError(String string);

    /**
     * Get local path of the downloaded file
     *
     * @return local path of the file downloaded
     */
    String getDownloadLocalPath();

    void setResume(boolean resume);

    boolean isInited();

    long getMaxTemplateSizeInBytes();
}


text:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <getopt.h>

// my headers
#include "daemon.h"
#include "wsdd_param.h"
#include "net_utils.h"
#include "smacros.h"

// gsoap headers
#include "wsdd.nsmap"
#include "wsddapi.h"

static const char *help_str =
        " ===============  Help  ===============\n"
        " Daemon name:  " DAEMON_NAME          "\n"
        " Daemon  ver:  " DAEMON_VERSION_STR   "\n"
#ifdef  DEBUG
        " Build  mode:  debug\n"
#else
        " Build  mode:  release\n"
#endif
        " Build  date:  " __DATE__ "\n"
        " Build  time:  " __TIME__ "\n\n"
        "Options:                      description:\n\n"
        "       --no_chdir             Don't change the directory to '/'\n"
        "       --no_fork              Don't do fork\n"
        "       --no_close             Don't close standart IO files\n"
        "       --pid_file [value]     Set pid file name\n"
        "       --log_file [value]     Set log file name\n\n"
        "       --if_name  [interface] Set Network Interface for add to multicast group\n"
        "       --endpoint [uuid]      Set UUID for WS-Discovery (default generated a random)\n"
        "       --type     [type]      Set Type of ONVIF service\n"
        "       --scope    [scopes]    Set Scope(s) of ONVIF service\n"
        "       --xaddr    [URL]       Set address (or template URL) of ONVIF service [in template mode %s\n"
        "                              will be changed to IP of interfasec (see opt if_name)]\n"
        "       --metdata_ver [ver]    Set Meta data version of ONVIF service (default = 0)\n"
        "  -v,  --version              Display daemon version\n"
        "  -h,  --help                 Display this help\n\n";

// indexes for long_opt function
enum
{
    cmd_opt_help    = 'h',
    cmd_opt_version = 'v',

    //daemon options
    cmd_opt_no_chdir,
    cmd_opt_no_fork,
    cmd_opt_no_close,
    cmd_opt_pid_file,
    cmd_opt_log_file,

    //WS-Discovery Service options
    cmd_opt_if_name,
    cmd_opt_endpoint,
    cmd_opt_type,
    cmd_opt_scope,
    cmd_opt_xaddr,
    cmd_opt_metdata_ver
};

static const char *short_opts = "hv";

static const struct option long_opts[] =
{
    { "version",      no_argument,       NULL, cmd_opt_version  },
    { "help",         no_argument,       NULL, cmd_opt_help     },

    //daemon options
    { "no_chdir",     no_argument,       NULL, cmd_opt_no_chdir },
    { "no_fork",      no_argument,       NULL, cmd_opt_no_fork  },
    { "no_close",     no_argument,       NULL, cmd_opt_no_close },
    { "pid_file",     required_argument, NULL, cmd_opt_pid_file },
    { "log_file",     required_argument, NULL, cmd_opt_log_file },

    //WS-Discovery Service options
    { "if_name",      required_argument, NULL, cmd_opt_if_name     },
    { "endpoint",     required_argument, NULL, cmd_opt_endpoint    },
    { "type",         required_argument, NULL, cmd_opt_type        },
    { "scope",        required_argument, NULL, cmd_opt_scope       },
    { "xaddr",        required_argument, NULL, cmd_opt_xaddr       },
    { "metdata_ver",  required_argument, NULL, cmd_opt_metdata_ver },

    { NULL,           no_argument,       NULL, 0  }
};

static struct soap*         soap_srv;
static struct wsdd_param_t  wsdd_param;

void free_resources()
{
    //Here we free resources

    send_bye(soap_srv, &wsdd_param);
    soap_wsdd_listen(soap_srv, 1);

    soap_destroy(soap_srv);
    soap_end(soap_srv);

    unlink(daemon_info.pid_file);
}

void daemon_exit_handler(int sig)
{
    UNUSED(sig);
    free_resources();

    exit(EXIT_SUCCESS); // good job (we interrupted (finished) main loop)
}

void init_signals(void)
{
    struct sigaction sa;

    memset(&sa, 0, sizeof(sa));
    sa.sa_handler = daemon_exit_handler;
    if( sigaction(SIGTERM, &sa, NULL) != 0 )
        daemon_error_exit("Can't set daemon_exit_handler: %m\n");

    signal(SIGCHLD, SIG_IGN); // ignore child
    signal(SIGTSTP, SIG_IGN); // ignore tty signals
    signal(SIGTTOU, SIG_IGN);
    signal(SIGTTIN, SIG_IGN);
    signal(SIGHUP,  SIG_IGN);
}

void check_param()
{
    if(!wsdd_param.if_name)
        daemon_error_exit("Error: network interface not set (see opt --if_name)\n");

    if(!wsdd_param.type)
        daemon_error_exit("Error: type of ONVIF service not set (see opt --type)\n");

    if(!wsdd_param.scope)
        daemon_error_exit("Error: scope of ONVIF service not set (see opt --scope)\n");

    if(!wsdd_param.xaddr)
        daemon_error_exit("Error: URL of ONVIF service not set (see opt --xaddr)\n");
}

void get_endpoint(void)
{
    if(wsdd_param.endpoint)
        return; // good job user set endpoint from cmd

    wsdd_param.endpoint = get_rand_endpoint(soap_srv);

    if(!wsdd_param.endpoint)
        daemon_error_exit("Error: cant get random UUID\n");
}

void processing_cmd(int argc, char *argv[])
{
    int opt;

    while( (opt = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1 )
    {
        switch( opt )
        {

            case cmd_opt_help:
                        puts(help_str);
                        exit_if_not_daemonized(EXIT_SUCCESS);
                        break;

            case cmd_opt_version:
                        puts(DAEMON_NAME "  version  " DAEMON_VERSION_STR "\n");
                        exit_if_not_daemonized(EXIT_SUCCESS);
                        break;

                 //daemon options
            case cmd_opt_no_chdir:
                        daemon_info.no_chdir = 1;
                        break;

            case cmd_opt_no_fork:
                        daemon_info.no_fork = 1;
                        break;

            case cmd_opt_no_close:
                        daemon_info.no_close_stdio = 1;
                        break;

            case cmd_opt_pid_file:
                        daemon_info.pid_file = optarg;
                        break;

            case cmd_opt_log_file:
                        daemon_info.log_file = optarg;
                        break;

                 //WS-Discovery Service options
            case cmd_opt_if_name:
                        wsdd_param.if_name = optarg;
                        break;

            case cmd_opt_endpoint:
                        wsdd_param.endpoint = optarg;
                        break;

            case cmd_opt_type:
                        wsdd_param.type = optarg;
                        break;

            case cmd_opt_scope:
                        wsdd_param.scope = optarg;
                        break;

            case cmd_opt_xaddr:
                        wsdd_param.xaddr = optarg;
                        break;

            case cmd_opt_metdata_ver:
                        wsdd_param.metadata_ver = strtoul(optarg, NULL, 10);
                        break;

            default:
                        puts("for more detail see help\n\n");
                        exit_if_not_daemonized(EXIT_FAILURE);
                        break;
        }
    }
}

void init_gsoap()
{
    // init gsoap server for WS-Discovery service

    soap_srv = soap_new1(SOAP_IO_UDP);

    if(!soap_srv)
        daemon_error_exit("Can't get mem for soap: %m\n");

    in_addr_t addr               = inet_addr(WSDD_MULTICAST_IP);
    soap_srv->ipv4_multicast_if  = (char *)&addr;  // see setsockopt IPPROTO_IP IP_MULTICAST_IF
    soap_srv->ipv6_multicast_if  = addr;           // multicast sin6_scope_id
    soap_srv->ipv4_multicast_ttl = 1;              // see setsockopt IPPROTO_IP, IP_MULTICAST_TTL
    soap_srv->connect_flags      = SO_BROADCAST;   // for UDP multicast
    soap_srv->bind_flags         = SO_REUSEADDR;

    if(!soap_valid_socket(soap_bind(soap_srv, NULL, WSDD_SERVER_PORT, 100)))
    {
        soap_print_fault(soap_srv, stderr);
        exit(EXIT_FAILURE);
    }

    soap_srv->user = &wsdd_param;  // set our data for handlers

    // Join the multicast group 239.255.255.250 on the local interface
    // Note that this IP_ADD_MEMBERSHIP option must be
    // called for each local interface over which the multicast
    // datagrams are to be received.
    struct ip_mreqn mcast;
    mcast.imr_multiaddr.s_addr = inet_addr(WSDD_MULTICAST_IP);
    if( get_addr_of_if(wsdd_param.if_name, AF_INET, &mcast.imr_address) != 0 )
    {
        daemon_error_exit("Cant get addr for interface error: %m\n");
    }

    setsockopt(soap_srv->master, IPPROTO_IP, IP_MULTICAST_IF, &mcast.imr_address.s_addr, sizeof(struct in_addr));

    if(setsockopt(soap_srv->master, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mcast, sizeof(mcast)) != 0 )
    {
        daemon_error_exit("Cant adding multicast group error: %m\n");
    }
}

void init(void *data)
{
    UNUSED(data);
    init_signals();

    check_param();
    init_gsoap();

    // init static wsdd_param
    get_endpoint();

    send_hello(soap_srv, &wsdd_param);
}

int main(int argc, char *argv[])
{
    processing_cmd(argc, argv);
    daemonize2(init, NULL);

    while( !daemon_info.terminated )
    {
        if(soap_wsdd_listen(soap_srv, 1))
            soap_print_fault(soap_srv, stderr); // report the problem
    }

    free_resources();

    return EXIT_SUCCESS; // good job (we interrupted (finished) main loop)
}


text:
DECLARE_bool(fst_compat_symbols);

namespace fst {

constexpr int64 kNoSymbol = -1;

// WARNING: Reading via symbol table read options should
//          not be used. This is a temporary work around for
//          reading symbol ranges of previously stored symbol sets.
struct SymbolTableReadOptions {
  SymbolTableReadOptions() {}

  SymbolTableReadOptions(
      std::vector<std::pair<int64, int64>> string_hash_ranges,
      const std::string &source)
      : string_hash_ranges(std::move(string_hash_ranges)), source(source) {}

  std::vector<std::pair<int64, int64>> string_hash_ranges;
  std::string source;
};

struct SymbolTableTextOptions {
  explicit SymbolTableTextOptions(bool allow_negative_labels = false);

  bool allow_negative_labels;
  std::string fst_field_separator;
};

namespace internal {

extern const int kLineLen;

// List of symbols with a dense hash for looking up symbol index, rehashing at
// 75% occupancy.
class DenseSymbolMap {
 public:
  // Argument type for symbol lookups and inserts.

#ifdef OPENFST_HAVE_STD_STRING_VIEW
  using KeyType = std::string_view;
#else
  using KeyType = const std::string &;
#endif  // OPENFST_HAVE_STD_STRING_VIEW

  DenseSymbolMap();

  DenseSymbolMap(const DenseSymbolMap &x);

  std::pair<int64, bool> InsertOrFind(KeyType key);

  int64 Find(KeyType key) const;

  size_t Size() const { return symbols_.size(); }

  const std::string &GetSymbol(size_t idx) const { return symbols_[idx]; }

  void RemoveSymbol(size_t idx);

 private:
  // num_buckets must be power of 2.
  void Rehash(size_t num_buckets);

  std::hash<typename std::remove_const<
      typename std::remove_reference<KeyType>::type>::type>
      str_hash_;
  int64 empty_;
  std::vector<std::string> symbols_;
  std::vector<int64> buckets_;
  uint64 hash_mask_;
};

class SymbolTableImpl {
 public:
  using SymbolType = DenseSymbolMap::KeyType;

  explicit SymbolTableImpl(const std::string &name)
      : name_(name),
        available_key_(0),
        dense_key_limit_(0),
        check_sum_finalized_(false) {}

  SymbolTableImpl(const SymbolTableImpl &impl)
      : name_(impl.name_),
        available_key_(impl.available_key_),
        dense_key_limit_(impl.dense_key_limit_),
        symbols_(impl.symbols_),
        idx_key_(impl.idx_key_),
        key_map_(impl.key_map_),
        check_sum_finalized_(false) {}

  int64 AddSymbol(SymbolType symbol, int64 key);

  int64 AddSymbol(SymbolType symbol) {
    return AddSymbol(symbol, available_key_);
  }

  // Removes the symbol with the given key. The removal is costly
  // (O(NumSymbols)) and may reduce the efficiency of Find() because of a
  // potentially reduced size of the dense key interval.
  void RemoveSymbol(int64 key);

  static SymbolTableImpl *ReadText(
      std::istream &strm, const std::string &name,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions());

  static SymbolTableImpl* Read(std::istream &strm,
                               const SymbolTableReadOptions &opts);

  bool Write(std::ostream &strm) const;

  // Return the string associated with the key. If the key is out of
  // range (<0, >max), return an empty string.
  std::string Find(int64 key) const {
    int64 idx = key;
    if (key < 0 || key >= dense_key_limit_) {
      const auto it = key_map_.find(key);
      if (it == key_map_.end()) return "";
      idx = it->second;
    }
    if (idx < 0 || idx >= symbols_.Size()) return "";
    return symbols_.GetSymbol(idx);
  }

  // Returns the key associated with the symbol; if the symbol
  // does not exists, returns kNoSymbol.
  int64 Find(SymbolType symbol) const {
    int64 idx = symbols_.Find(symbol);
    if (idx == kNoSymbol || idx < dense_key_limit_) return idx;
    return idx_key_[idx - dense_key_limit_];
  }

  bool Member(int64 key) const { return !Find(key).empty(); }

  bool Member(SymbolType symbol) const { return Find(symbol) != kNoSymbol; }

  int64 GetNthKey(ssize_t pos) const {
    if (pos < 0 || pos >= symbols_.Size()) return kNoSymbol;
    if (pos < dense_key_limit_) return pos;
    return Find(symbols_.GetSymbol(pos));
  }

  const std::string &Name() const { return name_; }

  void SetName(const std::string &new_name) { name_ = new_name; }

  const std::string &CheckSum() const {
    MaybeRecomputeCheckSum();
    return check_sum_string_;
  }

  const std::string &LabeledCheckSum() const {
    MaybeRecomputeCheckSum();
    return labeled_check_sum_string_;
  }

  int64 AvailableKey() const { return available_key_; }

  size_t NumSymbols() const { return symbols_.Size(); }

 private:
  // Recomputes the checksums (both of them) if we've had changes since the last
  // computation (i.e., if check_sum_finalized_ is false).
  // Takes ~2.5 microseconds (dbg) or ~230 nanoseconds (opt) on a 2.67GHz Xeon
  // if the checksum is up-to-date (requiring no recomputation).
  void MaybeRecomputeCheckSum() const;

  std::string name_;
  int64 available_key_;
  int64 dense_key_limit_;

  DenseSymbolMap symbols_;
  // Maps index to key for index >= dense_key_limit:
  //   key = idx_key_[index - dense_key_limit]
  std::vector<int64> idx_key_;
  // Maps key to index for key >= dense_key_limit_.
  //  index = key_map_[key]
  std::map<int64, int64> key_map_;

  mutable bool check_sum_finalized_;
  mutable std::string check_sum_string_;
  mutable std::string labeled_check_sum_string_;
  mutable Mutex check_sum_mutex_;
};

}  // namespace internal

// Symbol (string) to integer (and reverse) mapping.
//
// The SymbolTable implements the mappings of labels to strings and reverse.
// SymbolTables are used to describe the alphabet of the input and output
// labels for arcs in a Finite State Transducer.
//
// SymbolTables are reference-counted and can therefore be shared across
// multiple machines. For example a language model grammar G, with a
// SymbolTable for the words in the language model can share this symbol
// table with the lexical representation L o G.
class SymbolTable {
 public:
  using SymbolType = internal::SymbolTableImpl::SymbolType;

  // Constructs symbol table with an optional name.
  explicit SymbolTable(const std::string &name = "<unspecified>")
      : impl_(std::make_shared<internal::SymbolTableImpl>(name)) {}

  virtual ~SymbolTable() {}

  // Reads a text representation of the symbol table from an istream. Pass a
  // name to give the resulting SymbolTable.
  static SymbolTable *ReadText(
      std::istream &strm, const std::string &name,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions()) {
    auto *impl = internal::SymbolTableImpl::ReadText(strm, name, opts);
    return impl ? new SymbolTable(impl) : nullptr;
  }

  // Reads a text representation of the symbol table.
  static SymbolTable *ReadText(
      const std::string &filename,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions()) {
    std::ifstream strm(filename, std::ios_base::in);
    if (!strm.good()) {
      LOG(ERROR) << "SymbolTable::ReadText: Can't open file: " << filename;
      return nullptr;
    }
    return ReadText(strm, filename, opts);
  }

  // WARNING: Reading via symbol table read options should not be used. This is
  // a temporary work-around.
  static SymbolTable* Read(std::istream &strm,
                           const SymbolTableReadOptions &opts) {
    auto *impl = internal::SymbolTableImpl::Read(strm, opts);
    return (impl) ? new SymbolTable(impl) : nullptr;
  }

  // Reads a binary dump of the symbol table from a stream.
  static SymbolTable *Read(std::istream &strm, const std::string &source) {
    SymbolTableReadOptions opts;
    opts.source = source;
    return Read(strm, opts);
  }

  // Reads a binary dump of the symbol table.
  static SymbolTable *Read(const std::string &filename) {
    std::ifstream strm(filename,
                            std::ios_base::in | std::ios_base::binary);
    if (!strm.good()) {
      LOG(ERROR) << "SymbolTable::Read: Can't open file: " << filename;
      return nullptr;
    }
    return Read(strm, filename);
  }

  // DERIVABLE INTERFACE

  // Creates a reference counted copy.
  virtual SymbolTable *Copy() const { return new SymbolTable(*this); }

  // Adds a symbol with given key to table. A symbol table also keeps track of
  // the last available key (highest key value in the symbol table).
  virtual int64 AddSymbol(SymbolType symbol, int64 key) {
    MutateCheck();
    return impl_->AddSymbol(symbol, key);
  }

  // Adds a symbol to the table. The associated value key is automatically
  // assigned by the symbol table.
  virtual int64 AddSymbol(SymbolType symbol) {
    MutateCheck();
    return impl_->AddSymbol(symbol);
  }

  // Adds another symbol table to this table. All key values will be offset
  // by the current available key (highest key value in the symbol table).
  // Note string symbols with the same key value will still have the same
  // key value after the symbol table has been merged, but a different
  // value. Adding symbol tables do not result in changes in the base table.
  virtual void AddTable(const SymbolTable &table);

  // Returns the current available key (i.e., highest key + 1) in the symbol
  // table.
  virtual int64 AvailableKey() const { return impl_->AvailableKey(); }

  // Return the label-agnostic MD5 check-sum for this table. All new symbols
  // added to the table will result in an updated checksum. Deprecated.
  virtual const std::string &CheckSum() const { return impl_->CheckSum(); }

  virtual int64 GetNthKey(ssize_t pos) const { return impl_->GetNthKey(pos); }

  // Returns the string associated with the key; if the key is out of
  // range (<0, >max), returns an empty string.
  virtual std::string Find(int64 key) const { return impl_->Find(key); }

  // Returns the key associated with the symbol; if the symbol does not exist,
  // kNoSymbol is returned.
  virtual int64 Find(SymbolType symbol) const { return impl_->Find(symbol); }

  // Same as CheckSum(), but returns an label-dependent version.
  virtual const std::string &LabeledCheckSum() const {
    return impl_->LabeledCheckSum();
  }

  virtual bool Member(int64 key) const { return impl_->Member(key); }

  virtual bool Member(SymbolType symbol) const { return impl_->Member(symbol); }

  // Returns the name of the symbol table.
  virtual const std::string &Name() const { return impl_->Name(); }

  // Returns the current number of symbols in table (not necessarily equal to
  // AvailableKey()).
  virtual size_t NumSymbols() const { return impl_->NumSymbols(); }

  virtual void RemoveSymbol(int64 key) {
    MutateCheck();
    return impl_->RemoveSymbol(key);
  }

  // Sets the name of the symbol table.
  virtual void SetName(const std::string &new_name) {
    MutateCheck();
    impl_->SetName(new_name);
  }

  virtual bool Write(std::ostream &strm) const { return impl_->Write(strm); }

  virtual bool Write(const std::string &filename) const {
    if (!filename.empty()) {
      std::ofstream strm(filename,
                               std::ios_base::out | std::ios_base::binary);
      if (!strm) {
        LOG(ERROR) << "SymbolTable::Write: Can't open file: " << filename;
        return false;
      }
      if (!Write(strm)) {
        LOG(ERROR) << "SymbolTable::Write: Write failed: " << filename;
        return false;
      }
      return true;
    } else {
      return Write(std::cout);
    }
  }

  // Dump a text representation of the symbol table via a stream.
  virtual bool WriteText(std::ostream &strm,
      const SymbolTableTextOptions &opts = SymbolTableTextOptions()) const;

  // Dump a text representation of the symbol table.
  virtual bool WriteText(const std::string &filename) const {
    if (!filename.empty()) {
      std::ofstream strm(filename);
      if (!strm) {
        LOG(ERROR) << "SymbolTable::WriteText: Can't open file: " << filename;
        return false;
      }
      if (!WriteText(strm)) {
        LOG(ERROR) << "SymbolTable::WriteText: Write failed: " << filename;
        return false;
      }
      return true;
    } else {
      return WriteText(std::cout);
    }
  }

 private:
  explicit SymbolTable(internal::SymbolTableImpl *impl) : impl_(impl) {}

  void MutateCheck() {
    if (!impl_.unique()) impl_.reset(new internal::SymbolTableImpl(*impl_));
  }

  const internal::SymbolTableImpl *Impl() const { return impl_.get(); }

 private:
  std::shared_ptr<internal::SymbolTableImpl> impl_;
};

// Iterator class for symbols in a symbol table.
class SymbolTableIterator {
 public:
  explicit SymbolTableIterator(const SymbolTable &table)
      : table_(table),
        pos_(0),
        nsymbols_(table.NumSymbols()),
        key_(table.GetNthKey(0)) {}

  ~SymbolTableIterator() {}

  // Returns whether iterator is done.
  bool Done() const { return (pos_ == nsymbols_); }

  // Return the key of the current symbol.
  int64 Value() const { return key_; }

  // Return the string of the current symbol.
  std::string Symbol() const { return table_.Find(key_); }

  // Advances iterator.
  void Next() {
    ++pos_;
    if (pos_ < nsymbols_) key_ = table_.GetNthKey(pos_);
  }

  // Resets iterator.
  void Reset() {
    pos_ = 0;
    key_ = table_.GetNthKey(0);
  }

 private:
  const SymbolTable &table_;
  ssize_t pos_;
  size_t nsymbols_;
  int64 key_;
};

// Relabels a symbol table as specified by the input vector of pairs
// (old label, new label). The new symbol table only retains symbols
// for which a relabeling is explicitly specified.
//
// TODO(allauzen): consider adding options to allow for some form of implicit
// identity relabeling.
template <class Label>
SymbolTable *RelabelSymbolTable(const SymbolTable *table,
    const std::vector<std::pair<Label, Label>> &pairs) {
  auto *new_table = new SymbolTable(
      table->Name().empty() ? std::string()
                            : (std::string("relabeled_") + table->Name()));
  for (const auto &pair : pairs) {
    new_table->AddSymbol(table->Find(pair.first), pair.second);
  }
  return new_table;
}

// Returns true if the two symbol tables have equal checksums. Passing in
// nullptr for either table always returns true.
bool CompatSymbols(const SymbolTable *syms1, const SymbolTable *syms2,
                   bool warning = true);

// Symbol Table serialization.

void SymbolTableToString(const SymbolTable *table, std::string *result);

SymbolTable *StringToSymbolTable(const std::string &str);

}  // namespace fst

#endif  // FST_SYMBOL_TABLE_H_


text:
'use strict';
var FS = require('fs');
var PATH = require('path');
var child_process = require('child_process');
const _checkRuler = (ruler, string) => {
    if (Object.prototype.toString.call(ruler) === '[object RegExp]') {
        return ruler.test(string);
    } else {
        return string.indexOf(ruler) > -1;
    }
}
var io = {
    /**
     * 递归处理文件,文件夹
     * @param  {[string]} rootPath       [入口路径]
     * @param  {[function]} walkHandler    [回调函数,回调data和_count两个开参]
     * @param  {[array]} ignoreFiles    [忽略文件,可以使用正则或string: default: 参见defaultIgnoreFiles]
     * @param  {[boolean]} preventDefault [是否忽略默认忽略的文件, default: false]
     * @param  {[number]} maxCount       [最大遍历到的文件,方便调试 default: Infinity]
     */
    walkSync: (rootPath, walkHandler, ignoreFiles, preventDefault, maxCount) => {
        if (typeof rootPath === 'object') {
            let config = rootPath;
            rootPath = config.rootPath;
            walkHandler = config.walkHandler;
            ignoreFiles = config.ignoreFiles;
            preventDefault = config.preventDefault;
            maxCount = config.maxCount;
        }
        let defaultIgnoreFiles = preventDefault ? [] : [/\.svn\/$/, /\.git\/$/, /\.idea\/$/, /.gitignore$/, /.npmignore$/, /node_modules\/$/, /\.DS_Store$/];
        maxCount = maxCount || Infinity;
        rootPath = PATH.resolve(rootPath);
        ignoreFiles = ignoreFiles || [];
        ignoreFiles = defaultIgnoreFiles.concat(ignoreFiles);

        let _count = 0;
        const walk = (path) => {
            let data = {
                type: 'file',
                path: path,
                absolutePath: path,
                relativePath: PATH.relative(rootPath, path),
                rootPath: rootPath + '/',
            };
            try {
                if (FS.statSync(path).isDirectory(path)) {
                    data.type = 'directory';
                    data.path += '/';
                    data.absolutePath += '/';
                    data.relativePath += '/';
                }
            } catch (err) {
                console.log('stat error:', path, err);
            }
            walkHandler(data, _count);
            if (data.type === 'directory') {
                try {
                    let files = FS.readdirSync(path);
                    $i: for (let i = 0, len = files.length; i < len; ++i) {
                        if (_count >= maxCount) {
                            return;
                        }
                        let file = files[i];
                        let absolutePath = PATH.join(path, file);
                        let relativePath = PATH.relative(rootPath, absolutePath);
                        try {
                            if (FS.statSync(absolutePath).isDirectory(absolutePath)) {
                                relativePath += '/';
                            }
                        } catch (err) {}
                        if (absolutePath === process.argv[1]) { // 跳过脚本自己
                            continue;
                        }
                        $j: for (let j = 0, len = ignoreFiles.length; j < len; ++j) {
                            if (_checkRuler(ignoreFiles[j], relativePath)) {
                                // console.log(i, j, absolutePath);
                                continue $i;
                            }
                        }
                        ++_count && walk(absolutePath);
                    }
                } catch (err) {
                    console.log('read dir error:', path, err);
                }
            }
        }
        walk(rootPath);
    },
}
module.exports = io;


text:
/*
Theme Name: UnderStrap
Theme URI: http://understrap.com
Author: Holger Koenemann
Author URI: http://www.holgerkoenemann.de
Description: Combination of Automattic´s _s theme and Bootstrap 4. Made as a solid starting point for your next theme project and WordPress website. Use it as starter theme or as a parent theme. It is up to you. Including Font Awesome support, built-in widget slider and much more you need for basic websites. IMPORTANT: All developer dependencies are not bundled with this install file. Just download the .zip, extract it and run "npm install" and "gulp copy-assets" inside the extracted /understrap folder.
That downloads everything and moves it in place so that you can recompile your CSS and JS files;
A developer version (with Gulp/node and Sass sources) is available on gitHub: https://github.com/holger1411/understrap
A child theme is available on Github, too: https://github.com/holger1411/understrap-child;
Version: 0.5.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: understrap
Tags: one-column, custom-menu, featured-images, theme-options, translation-ready

This theme, like WordPress, is licensed under the GPL.
UnderStrap is based on Underscores http://underscores.me/, (C) 2012-2016 Automattic, Inc.

Resource Licenses:
Font Awesome: http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
Bootstrap: http://getbootstrap.com | https://github.com/twbs/bootstrap/blob/master/LICENSE (Code licensed under MIT, documentation under CC BY 3.0.)
Owl Carousel 2: http://www.owlcarousel.owlgraphic.com/ | https://github.com/smashingboxes/OwlCarousel2/blob/develop/LICENSE (Code licensed under MIT)
and of course
jQuery: https://jquery.org | (Code licensed under MIT)
WP Bootstrap Navwalker by Edward McIntyre: https://github.com/twittem/wp-bootstrap-navwalker | GNU GPL
*/

/*
This file is just used to identify the theme in WordPress.
The compiled CSS output can be found in /css/theme.css
The SASS sources for it can be found in /sass/
The dependencies can be found in /src/ after running "gulp copy-assets" terminal command

...and now go out and play!
*/


text:
package kr.ac.kaist.se.tardis.scheduler.api;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.IdClass;

@Entity
@IdClass(TaskJobInfoId.class)
public class TaskJobInfo extends JobInfo {

	@Id
	@Column(name = "taskid")
	private String taskId;

	@Id
	@Enumerated(EnumType.STRING)
	private JobType jobType;

	public TaskJobInfo() {
		//default constructor for JPA
	}

	public String getTaskId() {
		return taskId;
	}

	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}

	@Override
	public JobType getJobType() {
		return jobType;
	}

	@Override
	public void setJobType(JobType jobType) {
		this.jobType = jobType;
	}

	@Override
	public String getId() {
		return taskId;
	}

	@Override
	public void setId(String id) {
		this.taskId = id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((jobType == null) ? 0 : jobType.hashCode());
		result = prime * result + ((taskId == null) ? 0 : taskId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TaskJobInfo other = (TaskJobInfo) obj;
		if (jobType != other.jobType)
			return false;
		if (taskId == null) {
			if (other.taskId != null)
				return false;
		} else if (!taskId.equals(other.taskId))
			return false;
		return true;
	}

}


text:
<?php

namespace NetSuite\Classes;

class ItemFulfillmentItem {
    /**
     * @var string
     */
    public $jobName;
    /**
     * @var boolean
     */
    public $itemReceive;
    /**
     * @var string
     */
    public $itemName;
    /**
     * @var string
     */
    public $description;
    /**
     * @var \NetSuite\Classes\RecordRef
     */
    public $department;
    /**
     * @var \NetSuite\Classes\RecordRef
     */
    public $class;
    /**
     * @var \NetSuite\Classes\RecordRef
     */
    public $location;
    /**
     * @var float
     */
    public $onHand;
    /**
     * @var float
     */
    public $quantity;
    /**
     * @var string
     */
    public $unitsDisplay;
    /**
     * @var string
     */
    public $createPo;
    /**
     * @var \NetSuite\Classes\InventoryDetail
     */
    public $inventoryDetail;
    /**
     * @var string
     */
    public $binNumbers;
    /**
     * @var string
     */
    public $serialNumbers;
    /**
     * @var string
     */
    public $poNum;
    /**
     * @var \NetSuite\Classes\RecordRef
     */
    public $item;
    /**
     * @var integer
     */
    public $orderLine;
    /**
     * @var float
     */
    public $quantityRemaining;
    /**
     * @var \NetSuite\Classes\CustomFieldList
     */
    public $options;
    /**
     * @var integer
     */
    public $shipGroup;
    /**
     * @var boolean
     */
    public $itemIsFulfilled;
    /**
     * @var \NetSuite\Classes\RecordRef
     */
    public $shipAddress;
    /**
     * @var \NetSuite\Classes\RecordRef
     */
    public $shipMethod;
    /**
     * @var \NetSuite\Classes\CustomFieldList
     */
    public $customFieldList;
    static $paramtypesmap = array(
        "jobName" => "string",
        "itemReceive" => "boolean",
        "itemName" => "string",
        "description" => "string",
        "department" => "RecordRef",
        "class" => "RecordRef",
        "location" => "RecordRef",
        "onHand" => "float",
        "quantity" => "float",
        "unitsDisplay" => "string",
        "createPo" => "string",
        "inventoryDetail" => "InventoryDetail",
        "binNumbers" => "string",
        "serialNumbers" => "string",
        "poNum" => "string",
        "item" => "RecordRef",
        "orderLine" => "integer",
        "quantityRemaining" => "float",
        "options" => "CustomFieldList",
        "shipGroup" => "integer",
        "itemIsFulfilled" => "boolean",
        "shipAddress" => "RecordRef",
        "shipMethod" => "RecordRef",
        "customFieldList" => "CustomFieldList",
    );
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.azurestackhci.models;

import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Status of Arc Extension for a particular node in HCI Cluster. */
@Immutable
public final class PerNodeExtensionState {
    /*
     * Name of the node in HCI Cluster.
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * Fully qualified resource ID for the particular Arc Extension on this
     * node.
     */
    @JsonProperty(value = "extension", access = JsonProperty.Access.WRITE_ONLY)
    private String extension;

    /*
     * State of Arc Extension in this node.
     */
    @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY)
    private NodeExtensionState state;

    /**
     * Get the name property: Name of the node in HCI Cluster.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the extension property: Fully qualified resource ID for the particular Arc Extension on this node.
     *
     * @return the extension value.
     */
    public String extension() {
        return this.extension;
    }

    /**
     * Get the state property: State of Arc Extension in this node.
     *
     * @return the state value.
     */
    public NodeExtensionState state() {
        return this.state;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }
}


text:
"""Top-level presubmit script for skia/

See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.
"""

def GetPreferredTryMasters(project, change):
  return {
    'tryserver.blink': {
      'linux_blink_rel': set(['defaulttests']),
    },
  }