text:
..
 This work is licensed under a Creative Commons Attribution 3.0 Unported
 License.

 http://creativecommons.org/licenses/by/3.0/legalcode

========================================
Support for incremental backup in Cinder
========================================
Launchpad Blueprint:
  https://blueprints.launchpad.net/cinder/+spec/incremental-backup

Problem description
====================
The current implementation of Cinder Backup functionality only supports full
backup and restore of a given volume. There is no provision to backup changes
only that happened since last backup. As the volumes grow bigger and over,
all changes to volumes between backups stay relatively small, copying
entire volumes during backups will be resource intensive and do not scale well
for larger deployments. This specification discusses implementation of
incremental backup feature in detail.

Use Cases
=========

Proposed change
================
Cinder backup API, by default uses Swift as its backend. When a volume is
backed up to Swift, Swift creates a manifest file that describes the contents
of the backup volume. The manifest file contains header (metadata) and array
of pointers to the volume backup files. Since Swift has an upper limit on the
object size, Cinder backup API splits the volume data into individual chunks
of Swift object size and uploads these individual chunks to Swift. Cinder
volume backup manifest file includes these list of objects, their corresponding
objects, the logical offset of each object within the volume and a message
digest of each chunk to detect any unwarranted changes to objects. During
restore operation, Cinder reconstructs the volume based on the manifest and
individual chunks referenced in the manifest.

To support incremental backup functionality, we introduce another object called
shafile to the list of backup files. shafile file helps track changes to the
volume since last backup. This new object holds SHA256s of the
volume. A brief description of SHA-2 or SHA256 can be found at
http://en.wikipedia.org/wiki/SHA-2. The backup manifest file will have a
reference to this object. During a full backup operation, Cinder divides up the
volume into fixed blocks of user configurable block size. It calculates SHA256
of each block and compiles a list of SHAs and uploads the shafile to the backup
container.

To keep the incremental backup implementation simple, an incremental operation
is only performed with respect to a full backup. During incremental backup,
cinder reads the shafile of the full backup. It creates a new shafile from
the current volume data and compares the new shafile with full backup shafile
to calculate the blocks that are changed since last full backup.

We will use existing manifest mechanism to capture the delta. Since
full backups do not contain any holes, offset+lengths of each chunk of
the volume describe the full length of the volume logical address. However
with incremental backup, this model is challenged and the offset/chunk of
individual files become sparse. The absence of offset/length in a manifest
represents the data that is not modified since last backup. One potential
drawback of this approach is if changes to volume are fragmented, incremental
backup may result in too many objects in Swift. However object stores
like Swift are built to handle many small objects effectively.

The new shafile is uploaded as part of the incremental backup.

The manifest header identifies this backup as incremental backup and hence
contains a reference to the full backup container.

Following changes are made to the manifest header of the backup

::

        metadata['version'] = self.DRIVER_VERSION
        metadata['backup_id'] = backup['id']
        metadata['volume_id'] = volume_id
        metadata['backup_name'] = backup['display_name']
        metadata['backup_description'] = backup['display_description']
        metadata['created_at'] = str(backup['created_at'])

        # Changes to metadata section of manifest
        metadata['shafile'] = <shafilename>  # Path to shafile name. Or
                                             # can be hardcoded to "shafile"
                                             # in the container

        metadata['backup_type'] = "incrementa/full" # backup type
        metadata['full_container'] = <object path> # path of full backup

Restore API is not expected to change, however restore implementation will be
changed to handle incremental backup. To keep the restore from incremental
backup simple and easy to test, the restore operation first performs restore
of the full volume from the full backup copy and then apply incremental
changes at offset and length as described in the incremental backup manifest.

Snapshot based backups::

 Since existing backup implementation copies the data directly from the volume,
 it requires the volume to be detached from the instance. For most cloud
 workloads this may be sufficient but other workloads that cannot tolerate
 prolonged downtimes, a snapshot based backup solution can be a viable
 alternative. Snapshot based backup will perform a point in time copy of the
 volume and backup the data from point in time copy. This approach does not
 require volume to be detached from the instance. Rest of the backup and
 restore functionality remain the same.

 As an alternative, snapshot based backup can be implemented by extending
 existing backup functionality to snapshot volumes. This approach can be lot
 more simpler than backup API taking snapshot of the volume and then managing
 the snapshots.

Alternatives
------------
Incremental backup offers two important benefits:
 1. Use less storage when storing backup images
 2. Use less network bandwidth and improve overall efficiency of backup process
    in terms of CPU and time utilization

The first benefit can be achieved as a post processing of the backup images to
remove duplication or by using dedupe enabled backup storage. However the
second benefit cannot be achieved unless Cinder backup supports incremental
backup.

Data model impact
-----------------
No perceived data model changes

REST API impact
---------------
No new APIs are proposed. Instead existing backup API will be enhanced to
accept additional option called "--incr" with <path to full backup container>"
as its argument.

::

 cinder backup-create <volumeid> --incr <full backup container>
   Performs incremental backup

 cinder backup-create <volumeid> --snapshot
   Optionally backup-create will backup a snapshot of the volume. Snapshot
   based backups can be performed while the volume is still attached to the
   instance.

 cinder backup-create <volumeid> --snapshot --incr <full backup container>
   Optionally backup-create will perform incremental backup from volume
   snapshot

No anticipated changes to restore api

Security impact
---------------
None

Notifications impact
--------------------
None

Other end user impact
---------------------
python-cinderclient will be modified to accept "--incr" option. It may
include some validation code to validate if the full backup container path
is valid

Currently backup functionality is not integrated with OpenStack dashboard. When
it happens, the dashboard will provide an option for user to choose incremental
backup

Performance Impact
------------------
Except for calculating SHAs during full backup operation, there is no other
performance impact on existing API. The performance penalty can be easily
offset by the efficiency gained by incremental backup. Also new hardware
support CPU instructions to calculate SHAs which alleviates some stress on
the CPU cycles.

Other deployer impact
---------------------
None

Developer impact
----------------
None

Implementation
==============

Assignee(s)
-----------
Primary assignee:
muralibalcha(murali.balcha@triliodata.com)

Other contributors:
giribasava(giri.basava@triliodata.com)

Work Items
----------
1. python-cinderclient
   That accepts "--incr" option and some validation code

2. cinder/api
   Which parses the "--incr" option

3. cinder/backup/api.py
   backup api signature is modified

4. cinder/backup/manager.py

5. cinder/backup/driver/swift.py
   Heavy lifting is done here.
   Both backup and restore apis will be modified.

Dependencies
============

None

Testing
=======

Unit tests will be added for incremental backup.

Testing will primarily focus on the following:
 1. SHA file generation
 2. Creating various changes to the original volume. These include

  1. Changes to first block
  2. Changes to last block
  3. Changes to odd number of successive blocks
  4. Changes to even number of successive blocks
  5. Changes spread across multiple sections of the volume

 3. Perform 1 incremental
 4. Peform multiple incremental backups
 5. Restore series of incremental backups and compare the contents
 6. Perform full backup, then incremental, then full and then incremenal
    restore the volume from various backups.

Documentation Impact
====================

Need to document new option in the block storage manual.

References
==========

None


text:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
	<info organisation="org.easytesting"
		module="fest"
		revision="1.0.8"
		status="release"
		publication="20110217203501"
	>
		<license name="Apache License, Version 2.0" url="LICENSE.txt" />
		<description homepage="http://fest.easytesting.org">
		Parent POM for all FEST Modules
		</description>
		<m:properties__project.build.sourceEncoding>UTF-8</m:properties__project.build.sourceEncoding>
		<m:dependency.management__junit__junit__scope>test</m:dependency.management__junit__junit__scope>
		<m:dependency.management__junit__junit__version>4.8.2</m:dependency.management__junit__junit__version>
		<m:maven.plugins>org.apache.maven.plugins__maven-resources-plugin__null|org.apache.maven.plugins__maven-compiler-plugin__null|org.apache.maven.plugins__maven-site-plugin__null|org.apache.maven.plugins__maven-surefire-plugin__null|com.atlassian.maven.plugins__maven-clover2-plugin__null|org.apache.maven.plugins__maven-source-plugin__null|org.apache.maven.plugins__maven-javadoc-plugin__null|org.apache.maven.plugins__maven-dependency-plugin__null|null__maven-assembly-plugin__null</m:maven.plugins>
	</info>
	<configurations>
		<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
		<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
		<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
		<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
		<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
		<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
		<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
		<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
		<conf name="optional" visibility="public" description="contains all optional dependencies"/>
	</configurations>
	<publications>
	</publications>
</ivy-module>

redpajama_set_name: RedPajamaGithub


text:
describe Chatbox do
  describe '.deliver_message!' do
    before do
      @from = double 'entity', chatbox_id: 1
      @to = double 'entity', chatbox_id: 2
      @draft = double 'draft', deliver!: nil
      allow(Chatbox::Draft).to receive(:new).and_return @draft
    end

    it 'instantiates a draft with the configured store' do
      store = double 'store'
      Chatbox.configure { |config| config.store = store }
      expect(Chatbox::Draft).to receive(:new).with from: @from, to: @to, body: 'Hi', store: store
      Chatbox.deliver_message! from: @from, to: @to, body: 'Hi'
    end

    it 'delivers the draft' do
      expect(@draft).to receive :deliver!
      Chatbox.deliver_message! from: @from, to: @to, body: 'Hi'
    end
  end
end


text:
/**
 * UserController.js
 *
 * @module      :: Controller
 * @description :: Provides the base user
 *                 actions used to make waterlock work.
 *
 * @docs        :: http://waterlock.ninja/documentation
 */

module.exports = require('waterlock').actions.user({

  /**
 * @api {post} /user/ Creates User base on the information provided
 * @apiName PostUser
 * @apiGroup User
 *
 * @apiParam {Number} id Users unique ID.
 *
 * @apiSuccess {String} firstname Firstname of the User.
 * @apiSuccess {String} lastname  Lastadaname of the User.
 */
  create: function (req, res) {
    return sails.hooks.blueprints.middleware.create(req, res)
  }
})


text:
package org.jfrog.hudson.util.publisher;

import hudson.model.AbstractProject;
import hudson.tasks.Publisher;

/**
 * Created by user on 29/12/2014.
 */
public class PublisherFindImpl<T extends Publisher> implements PublisherFind<T> {
    public T find(AbstractProject<?, ?> project, Class<T> type) {
        for (Publisher publisher : project.getPublishersList()) {
            if (type.isInstance(publisher)) {
                return type.cast(publisher);
            }
        }
        return null;
    }
}


text:
<?php

$cwd = getcwd();
chdir(__DIR__);

define('ENVIRONMENT', isset($_SERVER['ENV']) ? $_SERVER['ENV'] : 'development');

$goRoot             = '../../';
$system_path        = $goRoot . 'vendor/cirevolution/system/src/System';
$application_folder = $goRoot . 'app';
$doc_root           = $goRoot . 'public';

if (realpath($system_path) !== false) {
    $system_path = realpath($system_path) . '/';
}
$system_path = rtrim($system_path, '/') . '/';

define('BASEPATH', str_replace("\\", "/", $system_path));
define('FCPATH', $doc_root . '/');
define('APPPATH', $application_folder . '/');
define('ROOOTPATH', $goRoot);
define('VIEWPATH', $application_folder . '/views/');

require(BASEPATH . 'Core/Common.php');

if (file_exists(ROOOTPATH . 'config/' . ENVIRONMENT . '/constants.php')) {
    require(ROOOTPATH . 'config/' . ENVIRONMENT . '/constants.php');
} else {
    require(ROOOTPATH . 'config/constants.php');
}

$charset = strtoupper(config_item('charset'));
ini_set('default_charset', $charset);

if (extension_loaded('mbstring')) {
    define('MB_ENABLED', TRUE);
    // mbstring.internal_encoding is deprecated starting with PHP 5.6
    // and it's usage triggers E_DEPRECATED messages.
    @ini_set('mbstring.internal_encoding', $charset);
    // This is required for mb_convert_encoding() to strip invalid characters.
    // That's utilized by CI_Utf8, but it's also done for consistency with iconv.
    mb_substitute_character('none');
} else {
    define('MB_ENABLED', FALSE);
}

// There's an ICONV_IMPL constant, but the PHP manual says that using
// iconv's predefined constants is "strongly discouraged".
if (extension_loaded('iconv')) {
    define('ICONV_ENABLED', TRUE);
    // iconv.internal_encoding is deprecated starting with PHP 5.6
    // and it's usage triggers E_DEPRECATED messages.
    @ini_set('iconv.internal_encoding', $charset);
} else {
    define('ICONV_ENABLED', FALSE);
}

$GLOBALS['CFG'] = & load_class('Config', 'Core');
$GLOBALS['UNI'] = & load_class('Utf8', 'Core');
$GLOBALS['SEC'] = & load_class('Security', 'Core');

load_class('Loader', 'Core');
load_class('Router', 'Core');
load_class('Input', 'Core');
load_class('Lang', 'Core');

require(BASEPATH . 'Core/Controller.php');

function &get_instance()
{
    return Controller::get_instance();
}

chdir($cwd);

return new Controller();


text:
package org.codelogger.utils;

import java.util.Random;

/**
 * A useful to handle math, likes get random value, number to string, and so on.
 *
 * @author DengDefei
 *
 */
public class MathUtils {

    private MathUtils() {

    }

    private static Random random = new Random();

    /**
     * Returns a natural integer value between 0 and integer max value.
     *
     * @return a natural integer value between 0 and integer max value.
     */
    public static int randomInt() {

        return random.nextInt(Integer.MAX_VALUE);
    }

    /**
     * Returns a natural integer value between 0 and given max value.
     *
     * @param max
     *            the max value to random.
     * @return a natural integer value between 0 and given max value.
     */
    public static int randomInt(final int max) {

        return random.nextInt(max + 1);
    }

    /**
     * Returns a natural integer number between given minimum value and max
     * value.
     *
     * @param min
     *            the minimum value to random.
     * @param max
     *            the max value to random.
     * @return a natural integer number between given minimum value and max
     *         value.
     */
    public static int randomInt(final int min, final int max) {

        return (int) Math.round(Math.random() * (max - min) + min);
    }

    /**
     * Returns a random long value.
     *
     * @return a random long value.
     */
    public static long randomLong() {

        return random.nextLong();
    }

    /**
     * Returns a natural long value between 0 and given max value.
     *
     * @param max
     *            the max value to random.
     * @return a natural long value between 0 and given max value.
     */
    public static long randomLong(final long max) {

        return randomLong(0, max);
    }

    /**
     * Returns a natural long value between given minimum value and max value.
     *
     * @param min
     *            the minimum value to random.
     * @param max
     *            the max value to random.
     * @return a natural long value between given minimum value and max value.
     */
    public static long randomLong(final long min, final long max) {

        return Math.round(Math.random() * (max - min) + min);
    }

    /**
     * Returns a double value between 0.0 and 1.0 from this random number.
     *
     * @return a double value between 0.0 and 1.0 from this random number.
     */
    public static double randomDouble() {

        return random.nextDouble();
    }

    /**
     * Returns a float value between 0.0 and 1.0 from this random number.
     *
     * @return a float value between 0.0 and 1.0 from this random number.
     */
    public static float randomFloat() {

        return random.nextFloat();
    }

    /**
     * Returns a long number by round up with specify number.

     * Returns 0 if number == null.

     * e.g: average is 3.5, then return 4.
     *
     * @param number
     *            number to be handled.
     * @return a long number by round up with specify number.
     */
    public static <T extends Number> long RoundUp(final T number) {

        if (number == null) {
            return 0;
        }
        double value = number.doubleValue();
        if (value % 1 == 0) {
            return (long) value;
        } else {
            return (long) (value + 1);
        }
    }

    /**
     * Returns a long number by round down with specify number.

     * Returns 0 if number == null.

     * e.g: average is 3.5, then return 3.
     *
     * @param number
     *            number to be handled.
     * @return a long number by round down with specify number.
     */
    public static <T extends Number> long RoundDown(final T number) {

        if (number == null) {
            return 0;
        }
        return number.longValue();
    }

    /**
     * Returns a double average number by given dividend and divisor.

     * Returns 0 if dividend == null or divisor == null.

     * Returns 1 if dividend == divisor or divisor == 0.
     *
     * @param dividend
     *            number to be handled.
     * @param divisor
     *            number to be handled.
     * @return a double average number by given dividend and divisor.
     */
    public static <T extends Number> double divide(final T dividend, final T divisor) {

        if (JudgeUtils.hasNull(dividend, divisor)) {
            return 0d;
        }
        if (JudgeUtils.equals(dividend, divisor) || divisor.doubleValue() == 0) {
            return 1d;
        }
        return dividend.doubleValue() / divisor.doubleValue();
    }

    /**
     * Returns a long average number by round up with specify dividend and
     * divisor.

     * Returns 0 if dividend == null or divisor == null.

     * Returns 1 if dividend == divisor or divisor == 0.

     * e.g: average is 3.5, then return 4.
     *
     * @param dividend
     *            number to be handled.
     * @param divisor
     *            number to be handled.
     * @return a long average number by given dividend and divisor.
     */
    public static <T extends Number> long divideRoundUp(final T dividend, final T divisor) {

        double average = divide(dividend, divisor);
        return RoundUp(average);
    }

    /**
     * Returns a long average number by round down with specify dividend and
     * divisor.

     * Returns 0 if dividend == null or divisor == null.

     * Returns 1 if dividend == divisor or divisor == 0.

     * e.g: average is 3.5, then return 3.
     *
     * @param dividend
     *            number to be handled.
     * @param divisor
     *            number to be handled.
     * @return a long average number by given dividend and divisor.
     */
    public static <T extends Number> long divideRoundDown(final T dividend, final T divisor) {

        return (long) divide(dividend, divisor);
    }

    /**
     * Judge divisor is an aliquot part of dividend.
 判断被除数是否能被除数整除。
     *
     * @param dividend
     *            number to be handled.被除数。
     * @param divisor
     *            number to be handled.除数。
     * @return true if divisor is an aliquot part of dividend, otherwise
     *         false.是否能被整除。
     */
    public static <T extends Number> boolean isAliquot(final T dividend, final T divisor) {

        return dividend.doubleValue() % divisor.doubleValue() == 0;
    }
}


text:
class Main {
	public static void main(String[] args) {
		Foo a = new Foo();
		Bar b = new Bar();
		Foo c = new Bar();
	}
}


text:
'use strict';

import * as assert from 'assert';
import glob = require('vs/base/common/glob');

suite('Glob', () => {
	test('simple', function () {
		var p = 'node_modules';

		assert(glob.match(p, 'node_modules'));
		assert(!glob.match(p, 'node_module'));
		assert(!glob.match(p, '/node_modules'));
		assert(!glob.match(p, 'test/node_modules'));

		p = 'test.txt';
		assert(glob.match(p, 'test.txt'));
		assert(!glob.match(p, 'test?txt'));
		assert(!glob.match(p, '/text.txt'));
		assert(!glob.match(p, 'test/test.txt'));

		p = 'test(.txt';
		assert(glob.match(p, 'test(.txt'));
		assert(!glob.match(p, 'test?txt'));

		p = 'qunit';

		assert(glob.match(p, 'qunit'));
		assert(!glob.match(p, 'qunit.css'));
		assert(!glob.match(p, 'test/qunit'));

		// Absolute

		p = '/DNXConsoleApp/**/*.cs';
		assert(glob.match(p, '/DNXConsoleApp/Program.cs'));
		assert(glob.match(p, '/DNXConsoleApp/foo/Program.cs'));

		p = 'C:/DNXConsoleApp/**/*.cs';
		assert(glob.match(p, 'C:\\DNXConsoleApp\\Program.cs'));
		assert(glob.match(p, 'C:\\DNXConsoleApp\\foo\\Program.cs'));
	});

	test('dot hidden', function () {
		var p = '.*';

		assert(glob.match(p, '.git'));
		assert(glob.match(p, '.hidden.txt'));
		assert(!glob.match(p, 'git'));
		assert(!glob.match(p, 'hidden.txt'));
		assert(!glob.match(p, 'path/.git'));
		assert(!glob.match(p, 'path/.hidden.txt'));

		p = '**/.*';
		assert(glob.match(p, '.git'));
		assert(glob.match(p, '.hidden.txt'));
		assert(!glob.match(p, 'git'));
		assert(!glob.match(p, 'hidden.txt'));
		assert(glob.match(p, 'path/.git'));
		assert(glob.match(p, 'path/.hidden.txt'));
		assert(!glob.match(p, 'path/git'));
		assert(!glob.match(p, 'pat.h/hidden.txt'));

		p = '._*';

		assert(glob.match(p, '._git'));
		assert(glob.match(p, '._hidden.txt'));
		assert(!glob.match(p, 'git'));
		assert(!glob.match(p, 'hidden.txt'));
		assert(!glob.match(p, 'path/._git'));
		assert(!glob.match(p, 'path/._hidden.txt'));

		p = '**/._*';
		assert(glob.match(p, '._git'));
		assert(glob.match(p, '._hidden.txt'));
		assert(!glob.match(p, 'git'));
		assert(!glob.match(p, 'hidden._txt'));
		assert(glob.match(p, 'path/._git'));
		assert(glob.match(p, 'path/._hidden.txt'));
		assert(!glob.match(p, 'path/git'));
		assert(!glob.match(p, 'pat.h/hidden._txt'));
	});

	test('file pattern', function () {
		var p = '*.js';

		assert(glob.match(p, 'foo.js'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(!glob.match(p, '/node_modules/foo.js'));
		assert(!glob.match(p, 'foo.jss'));
		assert(!glob.match(p, 'some.js/test'));

		p = 'html.*';
		assert(glob.match(p, 'html.js'));
		assert(glob.match(p, 'html.txt'));
		assert(!glob.match(p, 'htm.txt'));

		p = '*.*';
		assert(glob.match(p, 'html.js'));
		assert(glob.match(p, 'html.txt'));
		assert(glob.match(p, 'htm.txt'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(!glob.match(p, '/node_modules/foo.js'));

		p = 'node_modules/test/*.js';
		assert(glob.match(p, 'node_modules/test/foo.js'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(!glob.match(p, '/node_module/test/foo.js'));
		assert(!glob.match(p, 'foo.jss'));
		assert(!glob.match(p, 'some.js/test'));
	});

	test('star', function () {
		var p = 'node*modules';

		assert(glob.match(p, 'node_modules'));
		assert(glob.match(p, 'node_super_modules'));
		assert(!glob.match(p, 'node_module'));
		assert(!glob.match(p, '/node_modules'));
		assert(!glob.match(p, 'test/node_modules'));

		p = '*';
		assert(glob.match(p, 'html.js'));
		assert(glob.match(p, 'html.txt'));
		assert(glob.match(p, 'htm.txt'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(!glob.match(p, '/node_modules/foo.js'));
	});

	test('questionmark', function () {
		var p = 'node?modules';

		assert(glob.match(p, 'node_modules'));
		assert(!glob.match(p, 'node_super_modules'));
		assert(!glob.match(p, 'node_module'));
		assert(!glob.match(p, '/node_modules'));
		assert(!glob.match(p, 'test/node_modules'));

		p = '?';
		assert(glob.match(p, 'h'));
		assert(!glob.match(p, 'html.txt'));
		assert(!glob.match(p, 'htm.txt'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(!glob.match(p, '/node_modules/foo.js'));
	});

	test('globstar', function () {
		var p = '**/*.js';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'folder/foo.js'));
		assert(glob.match(p, '/node_modules/foo.js'));
		assert(!glob.match(p, 'foo.jss'));
		assert(!glob.match(p, 'some.js/test'));
		assert(!glob.match(p, '/some.js/test'));
		assert(!glob.match(p, '\\some.js\\test'));

		p = 'test/**';
		assert(glob.match(p, 'test'));
		assert(glob.match(p, 'test/foo.js'));
		assert(glob.match(p, 'test/other/foo.js'));
		assert(!glob.match(p, 'est/other/foo.js'));

		p = '**';
		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'folder/foo.js'));
		assert(glob.match(p, '/node_modules/foo.js'));
		assert(glob.match(p, 'foo.jss'));
		assert(glob.match(p, 'some.js/test'));

		p = 'test/**/*.js';
		assert(glob.match(p, 'test/foo.js'));
		assert(glob.match(p, 'test/other/foo.js'));
		assert(glob.match(p, 'test/other/more/foo.js'));
		assert(!glob.match(p, 'test/foo.ts'));
		assert(!glob.match(p, 'test/other/foo.ts'));
		assert(!glob.match(p, 'test/other/more/foo.ts'));

		p = '**/**/*.js';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'folder/foo.js'));
		assert(glob.match(p, '/node_modules/foo.js'));
		assert(!glob.match(p, 'foo.jss'));
		assert(!glob.match(p, 'some.js/test'));

		p = '**/node_modules/**/*.js';

		assert(!glob.match(p, 'foo.js'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(glob.match(p, 'node_modules/foo.js'));
		assert(glob.match(p, 'node_modules/some/folder/foo.js'));
		assert(!glob.match(p, 'node_modules/some/folder/foo.ts'));
		assert(!glob.match(p, 'foo.jss'));
		assert(!glob.match(p, 'some.js/test'));

		p = '{**/node_modules/**,**/.git/**,**/bower_components/**}';

		assert(glob.match(p, 'node_modules'));
		assert(glob.match(p, '/node_modules'));
		assert(glob.match(p, '/node_modules/more'));
		assert(glob.match(p, 'some/test/node_modules'));
		assert(glob.match(p, 'some\\test\\node_modules'));
		assert(glob.match(p, 'C:\\\\some\\test\\node_modules'));
		assert(glob.match(p, 'C:\\\\some\\test\\node_modules\\more'));

		assert(glob.match(p, 'bower_components'));
		assert(glob.match(p, 'bower_components/more'));
		assert(glob.match(p, '/bower_components'));
		assert(glob.match(p, 'some/test/bower_components'));
		assert(glob.match(p, 'some\\test\\bower_components'));
		assert(glob.match(p, 'C:\\\\some\\test\\bower_components'));
		assert(glob.match(p, 'C:\\\\some\\test\\bower_components\\more'));

		assert(glob.match(p, '.git'));
		assert(glob.match(p, '/.git'));
		assert(glob.match(p, 'some/test/.git'));
		assert(glob.match(p, 'some\\test\\.git'));
		assert(glob.match(p, 'C:\\\\some\\test\\.git'));

		assert(!glob.match(p, 'tempting'));
		assert(!glob.match(p, '/tempting'));
		assert(!glob.match(p, 'some/test/tempting'));
		assert(!glob.match(p, 'some\\test\\tempting'));
		assert(!glob.match(p, 'C:\\\\some\\test\\tempting'));
	});

	test('brace expansion', function () {
		var p = '*.{html,js}';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'foo.html'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(!glob.match(p, '/node_modules/foo.js'));
		assert(!glob.match(p, 'foo.jss'));
		assert(!glob.match(p, 'some.js/test'));

		p = '*.{html}';

		assert(glob.match(p, 'foo.html'));
		assert(!glob.match(p, 'foo.js'));
		assert(!glob.match(p, 'folder/foo.js'));
		assert(!glob.match(p, '/node_modules/foo.js'));
		assert(!glob.match(p, 'foo.jss'));
		assert(!glob.match(p, 'some.js/test'));

		p = '{node_modules,testing}';
		assert(glob.match(p, 'node_modules'));
		assert(glob.match(p, 'testing'));
		assert(!glob.match(p, 'node_module'));
		assert(!glob.match(p, 'dtesting'));

		p = '**/{foo,bar}';
		assert(glob.match(p, 'foo'));
		assert(glob.match(p, 'bar'));
		assert(glob.match(p, 'test/foo'));
		assert(glob.match(p, 'test/bar'));
		assert(glob.match(p, 'other/more/foo'));
		assert(glob.match(p, 'other/more/bar'));

		p = '{foo,bar}/**';
		assert(glob.match(p, 'foo'));
		assert(glob.match(p, 'bar'));
		assert(glob.match(p, 'foo/test'));
		assert(glob.match(p, 'bar/test'));
		assert(glob.match(p, 'foo/other/more'));
		assert(glob.match(p, 'bar/other/more'));

		p = '{**/*.d.ts,**/*.js}';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'testing/foo.js'));
		assert(glob.match(p, 'testing\\foo.js'));
		assert(glob.match(p, '/testing/foo.js'));
		assert(glob.match(p, '\\testing\\foo.js'));
		assert(glob.match(p, 'C:\\testing\\foo.js'));

		assert(glob.match(p, 'foo.d.ts'));
		assert(glob.match(p, 'testing/foo.d.ts'));
		assert(glob.match(p, 'testing\\foo.d.ts'));
		assert(glob.match(p, '/testing/foo.d.ts'));
		assert(glob.match(p, '\\testing\\foo.d.ts'));
		assert(glob.match(p, 'C:\\testing\\foo.d.ts'));

		assert(!glob.match(p, 'foo.d'));
		assert(!glob.match(p, 'testing/foo.d'));
		assert(!glob.match(p, 'testing\\foo.d'));
		assert(!glob.match(p, '/testing/foo.d'));
		assert(!glob.match(p, '\\testing\\foo.d'));
		assert(!glob.match(p, 'C:\\testing\\foo.d'));

		p = '{**/*.d.ts,**/*.js,path/simple.jgs}';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'testing/foo.js'));
		assert(glob.match(p, 'testing\\foo.js'));
		assert(glob.match(p, '/testing/foo.js'));
		assert(glob.match(p, 'path/simple.jgs'));
		assert(!glob.match(p, '/path/simple.jgs'));
		assert(glob.match(p, '\\testing\\foo.js'));
		assert(glob.match(p, 'C:\\testing\\foo.js'));

		p = '{**/*.d.ts,**/*.js,foo.[0-9]}';

		assert(glob.match(p, 'foo.5'));
		assert(glob.match(p, 'foo.8'));
		assert(!glob.match(p, 'bar.5'));
		assert(!glob.match(p, 'foo.f'));
		assert(glob.match(p, 'foo.js'));

		p = 'prefix/{**/*.d.ts,**/*.js,foo.[0-9]}';

		assert(glob.match(p, 'prefix/foo.5'));
		assert(glob.match(p, 'prefix/foo.8'));
		assert(!glob.match(p, 'prefix/bar.5'));
		assert(!glob.match(p, 'prefix/foo.f'));
		assert(glob.match(p, 'prefix/foo.js'));
	});

	test('expression support (single)', function () {
		var siblings = ['test.html', 'test.txt', 'test.ts', 'test.js'];

		// { "**/*.js": { "when": "$(basename).ts" } }
		var expression: glob.IExpression = {
			'**/*.js': {
				when: '$(basename).ts'
			}
		};

		assert.equal('**/*.js', glob.match(expression, 'test.js', siblings));
		assert(!glob.match(expression, 'test.js', []));
		assert(!glob.match(expression, 'test.js', ['te.ts']));
		assert(!glob.match(expression, 'test.js'));

		expression = {
			'**/*.js': {
				when: ''
			}
		};

		assert(!glob.match(expression, 'test.js', siblings));

		expression = <any>{
			'**/*.js': {
			}
		};

		assert.equal('**/*.js', glob.match(expression, 'test.js', siblings));

		expression = {};

		assert(!glob.match(expression, 'test.js', siblings));
	});

	test('expression support (multiple)', function () {
		var siblings = ['test.html', 'test.txt', 'test.ts', 'test.js'];

		// { "**/*.js": { "when": "$(basename).ts" } }
		var expression: glob.IExpression = {
			'**/*.js': { when: '$(basename).ts' },
			'**/*.as': true,
			'**/*.foo': false,
			'**/*.bananas': { bananas: true }
		};

		assert.equal('**/*.js', glob.match(expression, 'test.js', siblings));
		assert.equal('**/*.as', glob.match(expression, 'test.as', siblings));
		assert.equal('**/*.bananas', glob.match(expression, 'test.bananas', siblings));
		assert.equal('**/*.bananas', glob.match(expression, 'test.bananas'));
		assert(!glob.match(expression, 'test.foo', siblings));
	});

	test('brackets', function () {
		var p = 'foo.[0-9]';

		assert(glob.match(p, 'foo.5'));
		assert(glob.match(p, 'foo.8'));
		assert(!glob.match(p, 'bar.5'));
		assert(!glob.match(p, 'foo.f'));

		p = 'foo.[^0-9]';

		assert(!glob.match(p, 'foo.5'));
		assert(!glob.match(p, 'foo.8'));
		assert(!glob.match(p, 'bar.5'));
		assert(glob.match(p, 'foo.f'));
	});

	test('backslash agnostic', function () {
		var p = 'testing/this/foo.txt';

		assert(glob.match(p, 'testing/this/foo.txt'));
		assert(glob.match(p, 'testing\\this\\foo.txt'));
		assert(glob.match(p, 'testing/this\\foo.txt'));
	});

	test('prefix agnostic', function () {
		var p = '**/*.js';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, '/foo.js'));
		assert(glob.match(p, '\\foo.js'));
		assert(glob.match(p, 'testing/foo.js'));
		assert(glob.match(p, 'testing\\foo.js'));
		assert(glob.match(p, '/testing/foo.js'));
		assert(glob.match(p, '\\testing\\foo.js'));
		assert(glob.match(p, 'C:\\testing\\foo.js'));

		assert(!glob.match(p, 'foo.ts'));
		assert(!glob.match(p, 'testing/foo.ts'));
		assert(!glob.match(p, 'testing\\foo.ts'));
		assert(!glob.match(p, '/testing/foo.ts'));
		assert(!glob.match(p, '\\testing\\foo.ts'));
		assert(!glob.match(p, 'C:\\testing\\foo.ts'));

		assert(!glob.match(p, 'foo.js.txt'));
		assert(!glob.match(p, 'testing/foo.js.txt'));
		assert(!glob.match(p, 'testing\\foo.js.txt'));
		assert(!glob.match(p, '/testing/foo.js.txt'));
		assert(!glob.match(p, '\\testing\\foo.js.txt'));
		assert(!glob.match(p, 'C:\\testing\\foo.js.txt'));

		assert(!glob.match(p, 'testing.js/foo'));
		assert(!glob.match(p, 'testing.js\\foo'));
		assert(!glob.match(p, '/testing.js/foo'));
		assert(!glob.match(p, '\\testing.js\\foo'));
		assert(!glob.match(p, 'C:\\testing.js\\foo'));

		p = '**/foo.js';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, '/foo.js'));
		assert(glob.match(p, '\\foo.js'));
		assert(glob.match(p, 'testing/foo.js'));
		assert(glob.match(p, 'testing\\foo.js'));
		assert(glob.match(p, '/testing/foo.js'));
		assert(glob.match(p, '\\testing\\foo.js'));
		assert(glob.match(p, 'C:\\testing\\foo.js'));
	});

	test('cached properly', function () {
		var p = '**/*.js';

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'testing/foo.js'));
		assert(glob.match(p, 'testing\\foo.js'));
		assert(glob.match(p, '/testing/foo.js'));
		assert(glob.match(p, '\\testing\\foo.js'));
		assert(glob.match(p, 'C:\\testing\\foo.js'));

		assert(!glob.match(p, 'foo.ts'));
		assert(!glob.match(p, 'testing/foo.ts'));
		assert(!glob.match(p, 'testing\\foo.ts'));
		assert(!glob.match(p, '/testing/foo.ts'));
		assert(!glob.match(p, '\\testing\\foo.ts'));
		assert(!glob.match(p, 'C:\\testing\\foo.ts'));

		assert(!glob.match(p, 'foo.js.txt'));
		assert(!glob.match(p, 'testing/foo.js.txt'));
		assert(!glob.match(p, 'testing\\foo.js.txt'));
		assert(!glob.match(p, '/testing/foo.js.txt'));
		assert(!glob.match(p, '\\testing\\foo.js.txt'));
		assert(!glob.match(p, 'C:\\testing\\foo.js.txt'));

		assert(!glob.match(p, 'testing.js/foo'));
		assert(!glob.match(p, 'testing.js\\foo'));
		assert(!glob.match(p, '/testing.js/foo'));
		assert(!glob.match(p, '\\testing.js\\foo'));
		assert(!glob.match(p, 'C:\\testing.js\\foo'));

		// Run again and make sure the regex are properly reused

		assert(glob.match(p, 'foo.js'));
		assert(glob.match(p, 'testing/foo.js'));
		assert(glob.match(p, 'testing\\foo.js'));
		assert(glob.match(p, '/testing/foo.js'));
		assert(glob.match(p, '\\testing\\foo.js'));
		assert(glob.match(p, 'C:\\testing\\foo.js'));

		assert(!glob.match(p, 'foo.ts'));
		assert(!glob.match(p, 'testing/foo.ts'));
		assert(!glob.match(p, 'testing\\foo.ts'));
		assert(!glob.match(p, '/testing/foo.ts'));
		assert(!glob.match(p, '\\testing\\foo.ts'));
		assert(!glob.match(p, 'C:\\testing\\foo.ts'));

		assert(!glob.match(p, 'foo.js.txt'));
		assert(!glob.match(p, 'testing/foo.js.txt'));
		assert(!glob.match(p, 'testing\\foo.js.txt'));
		assert(!glob.match(p, '/testing/foo.js.txt'));
		assert(!glob.match(p, '\\testing\\foo.js.txt'));
		assert(!glob.match(p, 'C:\\testing\\foo.js.txt'));

		assert(!glob.match(p, 'testing.js/foo'));
		assert(!glob.match(p, 'testing.js\\foo'));
		assert(!glob.match(p, '/testing.js/foo'));
		assert(!glob.match(p, '\\testing.js\\foo'));
		assert(!glob.match(p, 'C:\\testing.js\\foo'));
	});

	test('invalid glob', function () {
		var p = '**/*(.js';

		assert(!glob.match(p, 'foo.js'));
	});

	test('split glob aware', function () {
		assert.deepEqual(glob.splitGlobAware('foo,bar', ','), ['foo', 'bar']);
		assert.deepEqual(glob.splitGlobAware('foo', ','), ['foo']);
		assert.deepEqual(glob.splitGlobAware('{foo,bar}', ','), ['{foo,bar}']);
		assert.deepEqual(glob.splitGlobAware('foo,bar,{foo,bar}', ','), ['foo', 'bar', '{foo,bar}']);
		assert.deepEqual(glob.splitGlobAware('{foo,bar},foo,bar,{foo,bar}', ','), ['{foo,bar}', 'foo', 'bar', '{foo,bar}']);

		assert.deepEqual(glob.splitGlobAware('[foo,bar]', ','), ['[foo,bar]']);
		assert.deepEqual(glob.splitGlobAware('foo,bar,[foo,bar]', ','), ['foo', 'bar', '[foo,bar]']);
		assert.deepEqual(glob.splitGlobAware('[foo,bar],foo,bar,[foo,bar]', ','), ['[foo,bar]', 'foo', 'bar', '[foo,bar]']);
	});
});


text:
import { platform } from 'substance'
import isDocumentArchive from './_isDocumentArchive'
import _require from './_require'

// FIXME: this file should only get bundled in commonjs version
let fsExtra
if (platform.inNodeJS || platform.inElectron) {
  fsExtra = _require('fs-extra')
}

export default async function cloneArchive (archiveDir, newArchiveDir, opts = {}) {
  // make sure that the given path is a dar
  if (await isDocumentArchive(archiveDir, opts)) {
    await fsExtra.copy(archiveDir, newArchiveDir)
    return true
  } else {
    throw new Error(archiveDir + ' is not a valid document archive.')
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 323624 $ -->

<appendix xml:id="yaf.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 &reftitle.constants;
 &extension.constants;
 <para>
  <variablelist>
   <varlistentry xml:id="constant.yaf-version">
    <term>
     <constant>YAF_VERSION</constant>
     (<type>string</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-environ">
    <term>
     <constant>YAF_ENVIRON</constant>
     (<type>string</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-startup-failed">
    <term>
     <constant>YAF_ERR_STARTUP_FAILED</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-route-failed">
    <term>
     <constant>YAF_ERR_ROUTE_FAILED</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-dispatch-failed">
    <term>
     <constant>YAF_ERR_DISPATCH_FAILED</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-autoload-failed">
    <term>
     <constant>YAF_ERR_AUTOLOAD_FAILED</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-notfound-module">
    <term>
     <constant>YAF_ERR_NOTFOUND_MODULE</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-notfound-controller">
    <term>
     <constant>YAF_ERR_NOTFOUND_CONTROLLER</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-notfound-action">
    <term>
     <constant>YAF_ERR_NOTFOUND_ACTION</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-notfound-view">
    <term>
     <constant>YAF_ERR_NOTFOUND_VIEW</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-call-failed">
    <term>
     <constant>YAF_ERR_CALL_FAILED</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
   <varlistentry xml:id="constant.yaf-err-type-error">
    <term>
     <constant>YAF_ERR_TYPE_ERROR</constant>
     (<type>integer</type>)
    </term>
    <listitem>
     <simpara>
     </simpara>
    </listitem>
   </varlistentry>
  </variablelist>
 </para>
</appendix>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->


text:
import { snapIt } from '../../../test';

const component = 'card';

describe(component, () => {
  const snap = snapIt(component);

  describe('renders', () => {
    snap('a card', '<blaze-card></blaze-card>');
    snap(
      'all the child elements correctly',
      `<blaze-card>
      <blaze-image></blaze-image>
      <blaze-card-header>

          Heading

Sub-heading

      </blaze-card-header>
      <blaze-card-body>

          Lorem ipsum dolor sit amet, feugiat corpora ex eam. Inciderint eloquentiam sea et.

      </blaze-card-body>
      <blaze-card-footer>

          <button class="c-button c-button--block c-button--brand">Button</button>
          <button class="c-button c-button--block c-button--info">Button</button>

      </blaze-card-footer>
    </blaze-card>`
    );
    snap(
      'all the child elements correctly',
      `<blaze-card>
      <blaze-media-item>
        <blaze-media-image src="https://placehold.it/80"></blaze-media-image>
        <blaze-media-body>

Title
            Subtitle

            Lorem ipsum dolor sit amet, feugiat corpora ex eam. Lorem ipsum dolor sit amet, feugiat corpora ex eam. Lorem ipsum dolor
            sit amet, feugiat corpora ex eam.

        </blaze-media-body>
      </blaze-media-item>
    </blaze-card>`
    );
  });
});


text:
import Ember from 'ember';
import { getDependentPropertyKeys, getVal } from 'ember-cpm/utils';
import { printConsoleMessage } from './utils';

const { runInDebug, computed } = Ember;

export default function EmberDeprecate_deprecateProperty() {
  let propertyArguments = getDependentPropertyKeys(
    Array.prototype.slice.call(arguments)
  );
  let [originalProp] = arguments;
  propertyArguments.push(function(key) {
    runInDebug(
      function() {
        printConsoleMessage(
          `Deprecated property: ${this.constructor.toString()} - ${key}`
        );
      }.bind(this)
    );
    return getVal.call(this, originalProp);
  });
  return computed.apply(this, propertyArguments);
}


text:
require "chef/exceptions"
require "chef/platform/priority_map"

class Chef
  #
  # Provider Resolution
  # ===================
  #
  # Provider resolution is the process of taking a Resource object and an
  # action, and determining the Provider class that should be instantiated to
  # handle the action.
  #
  # If the resource has its `provider` set, that is used.
  #
  # Otherwise, we take the lists of Providers that have registered as
  # providing the DSL through `provides :dsl_name, <filters>` or
  # `Chef.set_resource_priority_array :dsl_name, <filters>`.  We filter each
  # list of Providers through:
  #
  # 1. The filters it was registered with (such as `os: 'linux'` or
  #    `platform_family: 'debian'`)
  # 2. `provides?(node, resource)`
  # 3. `supports?(resource, action)`
  #
  # Anything that passes the filter and returns `true` to provides and supports,
  # is considered a match.  The first matching Provider in the *most recently
  # registered list* is selected and returned.
  #
  class ProviderResolver

    attr_reader :node
    attr_reader :resource
    attr_reader :action

    def initialize(node, resource, action)
      @node = node
      @resource = resource
      @action = action
    end

    def resolve
      maybe_explicit_provider(resource) ||
        maybe_custom_resource(resource) ||
        maybe_dynamic_provider_resolution(resource, action) ||
        raise(Chef::Exceptions::ProviderNotFound, "Cannot find a provider for #{resource} on #{node["platform"]} version #{node["platform_version"]}")
    end

    # Does NOT call provides? on the resource (it is assumed this is being
    # called *from* provides?).
    def provided_by?(provider_class)
      potential_handlers.include?(provider_class)
    end

    def enabled_handlers
      @enabled_handlers ||= potential_handlers.select { |handler| !overrode_provides?(handler) || handler.provides?(node, resource) }
    end

    # TODO deprecate this and allow actions to be passed as a filter to
    # `provides` so we don't have to have two separate things.
    # @api private
    def supported_handlers
      enabled_handlers.select { |handler| handler.supports?(resource, action) }
    end

    private

    def potential_handlers
      handler_map.list(node, resource.resource_name).uniq
    end

    # The list of handlers, with any in the priority_map moved to the front
    def prioritized_handlers
      @prioritized_handlers ||= begin
        supported_handlers = self.supported_handlers
        if supported_handlers.empty?
          # We always require a provider to be able to call define_resource_requirements on.  In the why-run case we need
          # a provider to say "assuming /etc/init.d/whatever would have been installed" and in the non-why-run case we
          # need to make a best guess at "cannot find /etc/init.d/whatever".  We are essentially defining a "default" provider
          # for the platform, which is the best we can do, but which might give misleading errors, but we cannot read minds.
          Chef::Log.trace "No providers responded true to `supports?` for action #{action} on resource #{resource}, falling back to enabled handlers so we can return something anyway."
          supported_handlers = enabled_handlers
        end

        prioritized = priority_map.list(node, resource.resource_name).flatten(1)
        prioritized &= supported_handlers # Filter the priority map by the actual enabled handlers
        prioritized |= supported_handlers # Bring back any handlers that aren't in the priority map, at the *end* (ordered set)
        prioritized
      end
    end

    # if its a custom resource, just grab the action class
    def maybe_custom_resource(resource)
      resource.class.action_class if resource.class.custom_resource?
    end

    # if resource.provider is set, just return one of those objects
    def maybe_explicit_provider(resource)
      resource.provider if resource.provider
    end

    # try dynamically finding a provider based on querying the providers to see what they support
    def maybe_dynamic_provider_resolution(resource, action)
      Chef::Log.trace "Providers for generic #{resource.resource_name} resource enabled on node include: #{enabled_handlers}"

      handler = prioritized_handlers.first

      if handler
        Chef::Log.trace "Provider for action #{action} on resource #{resource} is #{handler}"
      else
        Chef::Log.trace "Dynamic provider resolver FAILED to resolve a provider for action #{action} on resource #{resource}"
      end

      handler
    end

    def priority_map
      Chef.provider_priority_map
    end

    def handler_map
      Chef.provider_handler_map
    end

    def overrode_provides?(handler)
      handler.method(:provides?).owner != Chef::Provider.method(:provides?).owner
    end
  end
end


text:
'use strict'

/**
 * Represents a single battery.
 */
class Battery {
  /**
   * Creates a new Battery object.
   *
   * @param {string} id                   The id of the battery as provided by the OS.
   * @param {number} powerLevel           The power level of the battery in percent
   * @param {String} chargeStatus         The battery's status. Either 'charging', 'discharging',
   *                                      'full' or 'unknown'
   * @param {number} [remainingTime=null] The estimated remaining (dis-)charge time in minutes
   */
  constructor (id, powerLevel, chargeStatus, remainingTime = null) {
    this.id = id
    this.powerLevel = powerLevel
    this.remainingTime = typeof remainingTime === 'number' && isFinite(remainingTime)
      ? remainingTime
      : null

    switch (chargeStatus) {
      case 'charging':
      case 'discharging':
      case 'full':
        this.chargeStatus = chargeStatus
        break
      default:
        this.chargeStatus = 'unknown'
    }
  }

  /**
   * True if a remaining time was set.
   */
  get isTimeAvailable () {
    return typeof this.remainingTime === 'number'
  }

  /**
   * The remaining (dis-)charge time in whole hours, rounded down.
   *
   * Is null if `isTimeAvailable` is `false`.
   */
  get remainingTimeHours () {
    return this.isTimeAvailable ? Math.floor(this.remainingTime / 60) : null
  }

  /**
   * The remaining (dis-)charge time in minutes after subtracting the remaining hours, rounded down.
   *
   * Is null if `isTimeAvailable` is `false`.
   */
  get remainingTimeMinutes () {
    return this.isTimeAvailable ? Math.floor(this.remainingTime % 60) : null
  }
}

module.exports = { Battery }


text:
/* global __fbBatchedBridge, self, importScripts, postMessage, onmessage: true */ // eslint-disable-line

/* eslint-disable */

/**
 * IMPORTANT: Do not add "use strict"
 * https://github.com/callstack/haul/issues/278
 *
 * Some libraries like react-native-safe-module try to patch native modules to mock them
 * and prevent crashes, but don't account for the case when `requireNativeComponent` returns
 * a string. In strict mode, trying to modify properties of the string primitive throws an
 * error - "Cannot create property...". This breaks some modules like Lottie which use
 * react-native-safe-module
 */

class DebuggerWorker {
  constructor() {
    this.shouldQueueMessages = false;
    this.messageQueue = [];
    this.visibilityState = undefined;
    this.hasWarned = false;
    this.platform = undefined;
    this.initialUrl = undefined;

    self.bundleRegistryLoad = (...args) => this.bundleRegistryLoad(...args);
  }

  bundleRegistryOnLoad(bundleName) {
    if (typeof __fbBatchedBridge === 'object') {
      // Notify BundleRegistry that bundle was loaded. For some reason `__callFunction`
      // must be used instead of `callFunctionReturnFlushedQueue`. Otherwise the native side
      // would never receive event to update the UI, which would remain unchanged.
      __fbBatchedBridge.__callFunction(
        'BundleRegistry',
        'bundleRegistryOnLoad',
        [bundleName]
      );
    }
  }

  loadScript(bundleName, url) {
    try {
      importScripts(url);
      this.bundleRegistryOnLoad(bundleName);
    } catch (error) {
      console.error(`Failed to evaluate additional bundle: ${bundleName} (${url})`);
      throw error;
    }
  }

  bundleRegistryLoad(bundleName, sync) {
    if (self[bundleName]) {
      return;
    }

    if (!this.platform) {
      throw new Error(`Could not detect platform from URL: ${this.initialUrl}`);
    }

    const url = `${self.location.origin}/${bundleName}.bundle?platform=${this.platform}`;
    if (sync) {
      this.loadScript(bundleName, url);
    } else {
      // Fake async bundle loading, since it has no point when debugging and causes bugs.
      setTimeout(() => {
        this.loadScript(bundleName, url);
      }, 0);
    }
  };

  showVisibilityWarning() {
    // Wait until `YellowBox` gets initialized before displaying the warning.
    if (this.hasWarned || console.warn.toString().includes('[native code]')) {
      return;
    }
    this.hasWarned = true;
    const warning = 'Remote debugger is in a background tab which may cause apps to ' +
      'perform slowly. Fix this by foregrounding the tab (or opening it in ' +
      'a separate window).';
    console.warn(warning);
  }

  getPlatformFromURL(url) {
    let platform = (url.match(/platform=([a-zA-Z]*)/) || ['', undefined])[1];
    if (!platform) {
      // Try to get platform from bundle filename
      const [, filename] = /^https?:\/\/.+\/(.+)$/.exec(url) || [
        '',
        '',
      ];
      const segments = filename.split('.');
      if (segments.length > 2) {
        platform = segments[segments.length - 2];
      }
    }

    return platform;
  }

  executeApplicationScript(message, sendReply) {
    for (const key in message.inject) {
      self[key] = JSON.parse(message.inject[key]);
    }

    // Detect platform from initial bundle URL
    if (!this.platform) {
      this.platform = this.getPlatformFromURL(message.url);
    }
    this.initialUrl = message.url;
    this.shouldQueueMessages = true;

    let error;
    const scriptURL = new URL(message.url);
    if (typeof self !== 'undefined' && self.location) {
      scriptURL.host = self.location.host;
    }

    try {
      importScripts(scriptURL.href);
    } catch (e) {
      error = e;
      if (self.ErrorUtils) {
        self.ErrorUtils.reportFatalError(e);
      } else {
        console.error(e);
      }
    } finally {
      sendReply(null, error);
      this.processEnqueuedMessages();
    }
  }

  setDebuggerVisibility({ visibilityState }) {
    this.visibilityState = visibilityState;
  }

  processMessage(message) {
    if (this.visibilityState === 'hidden') {
      this.showVisibilityWarning();
    }

    const { data } = message;
    const sendReply = (result, error) => {
      self.postMessage({ replyID: data.id, result, error });
    };
    const handler = this[data.method];

    // Special cased handlers
    if (handler) {
      handler.call(this, data, sendReply);
      return;
    }

    // Other methods get called on the bridge
    let returnValue = [[], [], [], 0];
    try {
      if (typeof __fbBatchedBridge === 'object') {
        returnValue = __fbBatchedBridge[data.method].apply(
          null,
          data.arguments
        );
      }
    } finally {
      sendReply(JSON.stringify(returnValue));
    }
  }

  processEnqueuedMessages() {
    while (this.messageQueue.length) {
      const message = this.messageQueue.shift();
      this.processMessage(message);
    }
    this.shouldQueueMessages = false;
  }

  handleMessage(message) {
    if (this.shouldQueueMessages) {
      this.messageQueue.push(message);
    } else {
      this.processMessage(message);
    }
  }
}

onmessage = (() => {
  const worker = new DebuggerWorker();
  return (message) => {
    worker.handleMessage(message);
  };
})();


text:
<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2016/05/ProvisioningSchema">
  <pnp:Preferences Generator="OfficeDevPnP.Core, Version=2.6.1608.0, Culture=neutral, PublicKeyToken=null" />
  <pnp:Templates ID="CONTAINER-SPECIALTEAM">
    <pnp:ProvisioningTemplate ID="SPECIALTEAM" Version="1">
      <pnp:SitePolicy>HBI</pnp:SitePolicy>
      <pnp:WebSettings NoCrawl="false" SiteLogo="SiteAssets/Logo.png" AlternateCSS="Resources/Themes/Contoso/Contoso.css" MasterPageUrl="_catalogs/MasterPage/CustomMaster.master" />
      <pnp:PropertyBagEntries>
        <pnp:PropertyBagEntry Key="KEY1" Value="value1" Overwrite="false" />
        <pnp:PropertyBagEntry Key="KEY2" Value="value2" Overwrite="false" />
      </pnp:PropertyBagEntries>
      <pnp:Security ClearSubscopes="false">
        <pnp:AdditionalAdministrators>
          <pnp:User Name="user@contoso.com" />
          <pnp:User Name="U_SHAREPOINT_ADMINS" />
        </pnp:AdditionalAdministrators>
        <pnp:AdditionalOwners>
          <pnp:User Name="user@contoso.com" />
          <pnp:User Name="U_SHAREPOINT_ADMINS" />
        </pnp:AdditionalOwners>
        <pnp:AdditionalMembers>
          <pnp:User Name="user@contoso.com" />
          <pnp:User Name="U_SHAREPOINT_ADMINS" />
        </pnp:AdditionalMembers>
        <pnp:AdditionalVisitors>
          <pnp:User Name="user@contoso.com" />
          <pnp:User Name="U_SHAREPOINT_ADMINS" />
        </pnp:AdditionalVisitors>
        <pnp:Permissions />
      </pnp:Security>
      <pnp:SiteFields>
        <Field ID="{23203E97-3BFE-40CB-AFB4-07AA2B86BF45}" Type="Text" Name="ProjectID" DisplayName="Project ID" Group="Base.Foundation.Columns" MaxLength="255" AllowDeletion="TRUE" />
        <Field ID="{B01B3DBC-4630-4ED1-B5BA-321BC7841E3D}" Type="Text" Name="ProjectName" DisplayName="Project Name" Group="Base.Foundation.Columns" MaxLength="255" AllowDeletion="TRUE" />
        <Field ID="{A5DE9600-B7A6-42DD-A05E-10D4F1500208}" Type="Text" Name="ProjectManager" DisplayName="Project Manager" Group="Base.Foundation.Columns" MaxLength="255" AllowDeletion="TRUE" />
        <Field ID="{F1A1715E-6C52-40DE-8403-E9AAFD0470D0}" Type="Text" Name="DocumentDescription" DisplayName="Document Description" Group="Base.Foundation.Columns" MaxLength="255" AllowDeletion="TRUE" />
      </pnp:SiteFields>
      <pnp:ContentTypes>
        <pnp:ContentType ID="0x01005D4F34E4BE7F4B6892AEBE088EDD215E" Name="General Project Document" Description="General Project Document Content Type" Group="Base Foundation Content Types">
          <pnp:FieldRefs>
            <pnp:FieldRef ID="23203e97-3bfe-40cb-afb4-07aa2b86bf45" />
            <pnp:FieldRef ID="b01b3dbc-4630-4ed1-b5ba-321bc7841e3d" />
            <pnp:FieldRef ID="a5de9600-b7a6-42dd-a05e-10d4f1500208" />
            <pnp:FieldRef ID="f1a1715e-6c52-40de-8403-e9aafd0470d0" />
          </pnp:FieldRefs>
        </pnp:ContentType>
      </pnp:ContentTypes>
      <pnp:Lists>
        <pnp:ListInstance Title="Project Documents" Description="Project Documents are stored here" DocumentTemplate="" OnQuickLaunch="true" TemplateType="101" Url="Lists/ProjectDocuments" EnableVersioning="true" MinorVersionLimit="0" MaxVersionLimit="0" DraftVersionVisibility="0">
          <pnp:ContentTypeBindings>
            <pnp:ContentTypeBinding ContentTypeID="0x01005D4F34E4BE7F4B6892AEBE088EDD215E" Default="true" />
          </pnp:ContentTypeBindings>
        </pnp:ListInstance>
        <pnp:ListInstance Title="General Documents" Description="Project Documents are stored here" DocumentTemplate="" OnQuickLaunch="true" TemplateType="101" Url="Lists/GeneralDocuments" EnableVersioning="true" MinorVersionLimit="0" MaxVersionLimit="0" DraftVersionVisibility="0" RemoveExistingContentTypes="true">
          <pnp:ContentTypeBindings>
            <pnp:ContentTypeBinding ContentTypeID="0x01005D4F34E4BE7F4B6892AEBE088EDD215E" Default="true" />
          </pnp:ContentTypeBindings>
        </pnp:ListInstance>
      </pnp:Lists>
      <pnp:Features>
        <pnp:SiteFeatures>
          <pnp:Feature ID="b50e3104-6812-424f-a011-cc90e6327318" />
          <pnp:Feature ID="9c0834e1-ba47-4d49-812b-7d4fb6fea211" />
          <pnp:Feature ID="0af5989a-3aea-4519-8ab0-85d91abe39ff" Deactivate="true" />
        </pnp:SiteFeatures>
        <pnp:WebFeatures>
          <pnp:Feature ID="7201d6a4-a5d3-49a1-8c19-19c4bac6e668" />
          <pnp:Feature ID="961d6a9c-4388-4cf2-9733-38ee8c89afd4" />
          <pnp:Feature ID="e2f2bb18-891d-4812-97df-c265afdba297" />
          <pnp:Feature ID="4aec7207-0d02-4f4f-aa07-b370199cd0c7" Deactivate="true" />
        </pnp:WebFeatures>
      </pnp:Features>
      <pnp:CustomActions>
        <pnp:SiteCustomActions>
          <pnp:CustomAction Name="CA_SITE_SETTINGS_SITECLASSIFICATION" Description="Site Classification Application" Group="SiteTasks" Location="Microsoft.SharePoint.SiteSettings" Title="Site Classification" Sequence="1000" Rights="ManageWeb" Url="https://spmanaged.azurewebsites.net/pages/index.aspx?SPHostUrl={0}" RegistrationType="None">
            <pnp:CommandUIExtension />
          </pnp:CustomAction>
          <pnp:CustomAction Name="CA_STDMENU_SITECLASSIFICATION" Description="Site Classification Application" Group="SiteActions" Location="Microsoft.SharePoint.StandardMenu" Title="Site Classification" Sequence="1000" Rights="ManageWeb" Url="https://spmanaged.azurewebsites.net/pages/index.aspx?SPHostUrl={0}" RegistrationType="None">
            <pnp:CommandUIExtension />
          </pnp:CustomAction>
        </pnp:SiteCustomActions>
        <pnp:WebCustomActions>
          <pnp:CustomAction Name="CA_SUBSITE_OVERRIDE" Description="Override new sub-site link" Group="SiteTasks" Location="Microsoft.SharePoint.SiteSettings" Title="SubSite Overide" Sequence="1000" Rights="ManageWeb" Url="https://spmanaged.azurewebsites.net/pages/index.aspx?SPHostUrl={0}" RegistrationType="None">
            <pnp:CommandUIExtension />
          </pnp:CustomAction>
        </pnp:WebCustomActions>
      </pnp:CustomActions>
      <pnp:Files>
        <pnp:File Src="Logo.png" Folder="SiteAssets" Overwrite="true" />
        <pnp:File Src="CustomPage.aspx" Folder="SitePages" Overwrite="true" />
        <pnp:File Src="CustomMaster.master" Folder="_catalogs/MasterPage" Overwrite="true" />
        <pnp:File Src="Custom.spcolor" Folder="_catalogs/Theme/15" Overwrite="true" />
        <pnp:File Src="Custom.spfont" Folder="_catalogs/Theme/15" Overwrite="true" />
      </pnp:Files>
      <pnp:ComposedLook Name="Custom Look" ColorFile="_catalogs/Theme/15/Custom.spcolor" FontFile="_catalogs/Theme/15/Custom.spfont" BackgroundFile="Resources/Themes/Contoso/contosobg.jpg" Version="1" />
      <pnp:Providers>
        <pnp:Provider Enabled="true" HandlerType="OfficeDev.PnP.Provisioning.Providers.FakeProvider, OfficeDev.PnP.Provisioning.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
          <pnp:Configuration>
            <MyProviderConfiguration id="SampleConfig" xmlns="http://schemas.somecompany.com/MyProviderConfiguration">
              <ChildNode Attribute="value">TextContent</ChildNode>
            </MyProviderConfiguration>
          </pnp:Configuration>
        </pnp:Provider>
      </pnp:Providers>
    </pnp:ProvisioningTemplate>
  </pnp:Templates>
</pnp:Provisioning>


text:
<?php

/**
 * @category     Inchoo
 * @package     Inchoo Featured Products
 * @author        Domagoj Potkoc, Inchoo Team <web@inchoo.net>
 * @modified    Mladen Lotar <mladen.lotar@surgeworks.com>, Vedran Subotic <vedran.subotic@surgeworks.com>
 */
class Inchoo_FeaturedProducts_Block_Adminhtml_Edit_Renderer_Name extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {

    protected $_values;

    /**
     * Renders grid column
     *
     * @param   Varien_Object $row
     * @return  string
     */
    public function render(Varien_Object $row) {

        $action_name = $this->getRequest()->getActionName();

        if ($action_name == 'exportCsv' || $action_name == 'exportXml') {
            return $row->getName();
        }

        $href = $this->getUrl('*/catalog_product/edit', array(
            'store' => $this->getRequest()->getParam('store'),
            'id' => $row->getId()));

        $html = '' . $row->getName() . '';

        return $html;
    }

}


text:
package net.buycraft.plugin.bungeecord.util;

import lombok.experimental.UtilityClass;
import net.buycraft.plugin.bungeecord.BuycraftPlugin;

import java.util.LinkedHashMap;
import java.util.Map;

@UtilityClass
public class KeenUtils {
    private static String getMCVersion(String version) {
        int start = version.indexOf("(MC:");
        return version.substring(start + 5, version.length() - 1);
    }

    public static void postServerInformation(BuycraftPlugin plugin) {
        // account id, server id, plugin version, server version, online/offline mode, platform
        Map<String, Object> serverData = new LinkedHashMap<>();
        Map<String, Object> accountData = new LinkedHashMap<>();
        Map<String, Object> pluginData = new LinkedHashMap<>();

        // Server data
        serverData.put("id", plugin.getServerInformation().getServer().getId());
        serverData.put("platform", "bungeecord");
        serverData.put("platform_version", plugin.getProxy().getVersion());
        serverData.put("online_mode", plugin.getProxy().getConfig().isOnlineMode());

        // Plugin data
        pluginData.put("version", plugin.getDescription().getVersion());

        // Account data
        accountData.put("id", plugin.getServerInformation().getAccount().getId());

        // Combine and send to Keen IO
        Map<String, Object> keenData = new LinkedHashMap<>();
        keenData.put("server", serverData);
        keenData.put("account", accountData);
        keenData.put("plugin", pluginData);

        plugin.getKeenClient().addEvent("server_startups", keenData);
    }
}


text:
#include "Effekseer.InternalScript.h"
#include "Utils/Effekseer.BinaryReader.h"
#include <assert.h>

namespace Effekseer
{

bool InternalScript::IsValidOperator(int value) const
{
	if (0 <= value && value <= 5)
		return true;
	if (11 <= value && value <= 12)
		return true;
	if (21 <= value && value <= 22)
		return true;
	if (31 <= value && value <= 32)
		return true;
	if (50 == value)
		return true;

	return false;
}

bool InternalScript::IsValidRegister(int index) const
{
	if (index < 0)
		return false;

	if (static_cast<uint32_t>(index) < registers_.size())
		return true;

	if (0x1000 + 0 <= index && index <= 0x1000 + 3)
		return true;

	if (0x1000 + 0x100 + 0 <= index && index <= 0x1000 + 0x100 + 0)
		return true;

	if (0x1000 + 0x200 + 0 <= index && index <= 0x1000 + 0x200 + 4)
		return true;

	return false;
}

float InternalScript::GetRegisterValue(int index,
									   const std::array<float, 4>& externals,
									   const std::array<float, 1>& globals,
									   const std::array<float, 5>& locals) const
{
	auto ind = static_cast<uint32_t>(index);
	if (ind < registers_.size())
	{
		return registers_[ind];
	}
	else if (0x1000 + 0 <= ind && ind <= 0x1000 + 3)
	{
		return externals[ind - 0x1000];
	}
	else if (0x1000 + 0x100 + 0 <= ind && ind <= 0x1000 + 0x100 + 0)
	{
		return globals[ind - 0x1000 - 0x100];
	}
	else if (0x1000 + 0x200 + 0 <= ind && ind <= 0x1000 + 0x200 + 4)
	{
		return locals[ind - 0x1000 - 0x200];
	}

	assert(false);
	return 0.0f;
}

InternalScript::InternalScript()
{
}

InternalScript ::~InternalScript()
{
}
bool InternalScript::Load(uint8_t* data, int size)
{
	if (data == nullptr || size <= 0)
		return false;
	BinaryReader<true> reader(data, static_cast<size_t>(size));

	int32_t registerCount = 0;

	reader.Read(version_);
	reader.Read(runningPhase);
	reader.Read(registerCount);
	reader.Read(operatorCount_);

	for (size_t i = 0; i < 4; i++)
		reader.Read(outputRegisters_[i]);

	if (registerCount < 0)
		return false;

	registers_.resize(registerCount);

	for (size_t i = 0; i < 4; i++)
	{
		if (!IsValidRegister(outputRegisters_[i]))
		{
			return false;
		}
	}

	reader.Read(operators, static_cast<int32_t>(size - reader.GetOffset()));

	if (reader.GetStatus() == BinaryReaderStatus::Failed)
		return false;

	// check operators
	auto operatorReader = BinaryReader<true>(operators.data(), operators.size());

	for (int i = 0; i < operatorCount_; i++)
	{
		// type
		OperatorType type;
		operatorReader.Read(type);

		if (reader.GetStatus() == BinaryReaderStatus::Failed)
			return false;

		if (!IsValidOperator((int)type))
			return false;

		int32_t inputCount = 0;
		operatorReader.Read(inputCount);

		int32_t outputCount = 0;
		operatorReader.Read(outputCount);

		int32_t attributeCount = 0;
		operatorReader.Read(attributeCount);

		// input
		for (int j = 0; j < inputCount; j++)
		{
			int index = 0;
			operatorReader.Read(index);
			if (!IsValidRegister(index))
			{
				return false;
			}
		}

		// output
		for (int j = 0; j < outputCount; j++)
		{
			int index = 0;
			operatorReader.Read(index);
			if ((index < 0 || index >= static_cast<int32_t>(registers_.size())))
			{
				return false;
			}
		}

		// attribute
		for (int j = 0; j < attributeCount; j++)
		{
			int index = 0;
			operatorReader.Read(index);
		}
	}

	if (operatorReader.GetStatus() != BinaryReaderStatus::Complete)
		return false;

	isValid_ = true;

	return true;
}

std::array<float, 4> InternalScript::Execute(const std::array<float, 4>& externals,
											 const std::array<float, 1>& globals,
											 const std::array<float, 5>& locals,
											 RandFuncCallback* randFuncCallback,
											 RandWithSeedFuncCallback* randSeedFuncCallback,
											 void* userData) const
{
	// Because this is a temporary registers
	auto& registers = const_cast<std::vector<float>&>(registers_);

	std::array<float, 4> ret;
	ret.fill(0.0f);

	if (!isValid_)
	{
		return ret;
	}

	size_t offset = 0;
	for (int i = 0; i < operatorCount_; i++)
	{
		// type
		OperatorType type;
		memcpy(&type, operators.data() + offset, sizeof(OperatorType));
		offset += sizeof(int);

		int32_t inputCount = 0;
		memcpy(&inputCount, operators.data() + offset, sizeof(int));
		offset += sizeof(int);

		int32_t outputCount = 0;
		memcpy(&outputCount, operators.data() + offset, sizeof(int));
		offset += sizeof(int);

		int32_t attributeCount = 0;
		memcpy(&attributeCount, operators.data() + offset, sizeof(int));
		offset += sizeof(int);

		auto inputOffset = offset;
		auto outputOffset = inputOffset + inputCount * sizeof(int);
		auto attributeOffset = outputOffset + outputCount * sizeof(int);
		offset = attributeOffset + attributeCount * sizeof(int);

		std::array<float, 8> tempInputs;
		if (inputCount > tempInputs.size())
			return ret;

		for (int j = 0; j < inputCount; j++)
		{
			int index = 0;
			memcpy(&index, operators.data() + inputOffset, sizeof(int));
			inputOffset += sizeof(int);

			tempInputs[j] = GetRegisterValue(index, externals, globals, locals);
		}

		for (int j = 0; j < outputCount; j++)
		{
			int index = 0;
			memcpy(&index, operators.data() + outputOffset, sizeof(int));
			outputOffset += sizeof(int);

			if (type == OperatorType::Add)
				registers[index] = tempInputs[0] + tempInputs[1];
			else if (type == OperatorType::Sub)
				registers[index] = tempInputs[0] - tempInputs[1];
			else if (type == OperatorType::Mul)
				registers[index] = tempInputs[0] * tempInputs[1];
			else if (type == OperatorType::Div)
				registers[index] = tempInputs[0] / tempInputs[1];
			else if (type == OperatorType::Mod)
			{
				registers[index] = fmodf(tempInputs[0], tempInputs[1]);
			}
			else if (type == OperatorType::Sine)
			{
				registers[index] = sinf(tempInputs[j]);
			}
			else if (type == OperatorType::Cos)
			{
				registers[index] = cosf(tempInputs[j]);
			}
			else if (type == OperatorType::UnaryAdd)
			{
				registers[index] = tempInputs[0];
			}
			else if (type == OperatorType::UnarySub)
			{
				registers[index] = -tempInputs[0];
			}
			else if (type == OperatorType::Rand)
			{
				registers[index] = randFuncCallback(userData);
			}
			else if (type == OperatorType::Rand_WithSeed)
			{
				registers[index] = randSeedFuncCallback(userData, tempInputs[j]);
			}
			else if (type == OperatorType::Step)
			{
				auto edge = tempInputs[0];
				auto x = tempInputs[1];
				registers[index] = x >= edge ? 1.0f : 0.0f;
			}
			else if (type == OperatorType::Constant)
			{
				float att = 0;
				memcpy(&att, operators.data() + attributeOffset, sizeof(int));
				registers[index] = att;
			}
		}
	}

	for (size_t i = 0; i < 4; i++)
	{
		ret[i] = GetRegisterValue(outputRegisters_[i], externals, globals, locals);
	}

	return ret;
}

} // namespace Effekseer


text:
const util = require('util');
const base64url = require('base64url');
const crypto = require('crypto');

exports.sign = function jwsSign() {
  var opts, header, payload, secretOrKey;
  if (arguments.length === 2) {
    secretOrKey = arguments[1];
    header = {
      alg: algorithmFromSecret(secretOrKey)
    };
    return jwsSign({
      header: header,
      payload: arguments[0],
      secret: secretOrKey,
    });
  }

  if (arguments.length === 1) {
    opts = arguments[0];
    header = opts.header;
    payload = opts.payload;
    if (typeof payload === 'object')
      payload = JSON.stringify(payload);
    const signers = {
      HS256: jwsHS256Sign,
      RS256: jwsRS256Sign,
      EC256: jwsEC256Sign,
      none: jwsNoneSign,
    };
    const signerFn = signers[header.alg];
    return signerFn(header, payload, (opts.secret || opts.key))
  }
}

function jwsSecuredInput(header, payload) {
  const encodedHeader = base64url(header);
  const encodedPayload = base64url(payload);
  return util.format('%s.%s', encodedHeader, encodedPayload);
}

function algorithmFromSecret(secretOrKey) {
  secretOrKey = secretOrKey.toString();
  const RSA_INDICATOR = '-----BEGIN RSA PRIVATE KEY-----';
  const EC_INDICATOR = '-----BEGIN EC PRIVATE KEY-----';
  if (secretOrKey.indexOf(RSA_INDICATOR) > -1)
    return 'RS256';
  if (secretOrKey.indexOf(EC_INDICATOR) > -1)
    return 'EC256';
  return 'HS256';
}

function jwsNoneSign(header, payload) {
  header = JSON.stringify(header);
  return jwsOutput(header, payload, '');
}

// The latest version of openssl doesn't yet support `ecdsa-with-sha256`
// as a message digest algorithm, only `ecdsa-with-sha1` (despite the
// fact it supports both separately). Once that is implemented, we can
// implement this.
function jwsEC256Sign(header, payload, key) {
  throw "Not implemented, yet";
}

function jwsRS256Sign(header, payload, key) {
  header = JSON.stringify(header);
  const signature = createRS256Signature(header, payload, key);
  return jwsOutput(header, payload, signature);
}

function createRS256Signature(header, payload, key) {
  const signer = crypto.createSign('RSA-SHA256', key);
  const securedInput = jwsSecuredInput(header, payload);
  const signature = (signer.update(securedInput), signer.sign(key, 'base64'));
  return base64url.fromBase64(signature);
}

function jwsHS256Sign(header, payload, secret) {
  header = JSON.stringify(header);
  const signature = createHS256Signature(header, payload, secret);
  return jwsOutput(header, payload, signature);
}

function createHS256Signature(header, payload, secret) {
  const hmac = crypto.createHmac('SHA256', secret);
  const securedInput = jwsSecuredInput(header, payload);
  const signature = (hmac.update(securedInput), hmac.digest('base64'));
  return base64url.fromBase64(signature);
}

function jwsOutput(header, payload, signature) {
  return util.format(
    '%s.%s.%s',
    base64url(header),
    base64url(payload),
    signature);
}

exports.verify = function jwsVerify(jwsObject, secretOrKey) {
  const parts = jwsObject.split('.');
  const encodedHeader = parts[0];
  const encodedPayload = parts[1];
  const encodedSignature = parts[2];
  const rawHeader = base64url.decode(encodedHeader);
  const payload = base64url.decode(encodedPayload);
  const header = JSON.parse(rawHeader);
  const verifiers = {
    HS256: jwsHS256Verify,
    RS256: jwsRS256Verify,
    none: jwsNoneVerify,
  };
  const verifierFn = verifiers[header.alg];
  return verifierFn(rawHeader, payload, secretOrKey, encodedSignature)
}

function jwsHS256Verify(header, payload, secret, expectedSignature) {
  const calculatedSignature =
    createHS256Signature(header, payload, secret);
  return expectedSignature === calculatedSignature;
}

function jwsRS256Verify(header, payload, publicKey, signature) {
  const verifier = crypto.createVerify('RSA-SHA256');
  const securedInput = jwsSecuredInput(header, payload);
  signature = base64url.toBase64(signature);
  verifier.update(securedInput);
  return verifier.verify(publicKey, signature, 'base64');
}

function jwsNoneVerify() { return true };
exports.validate = exports.verify;


text:
"""Social login/registration view."""
import logging

from pyramid.view import view_config
from pyramid.httpexceptions import HTTPRedirection
from pyramid.security import NO_PERMISSION_REQUIRED
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import IntegrityError
import pyramid_basemodel

from pyramid_fullauth.views import BaseView
from pyramid_fullauth.models import User
from pyramid_fullauth.models import AuthenticationProvider
from pyramid_fullauth.events import BeforeSocialRegister
from pyramid_fullauth.events import AfterSocialRegister
from pyramid_fullauth.events import AfterSocialLogIn
from pyramid_fullauth.events import SocialAccountAlreadyConnected
from pyramid_fullauth import tools

LOG = logging.getLogger(__name__)

@view_config(
    context="velruse.AuthenticationComplete",
    permission=NO_PERMISSION_REQUIRED,
    renderer="pyramid_fullauth:resources/templates/register.mako",
)
class SocialLoginViews(BaseView):
    """Social login views definition."""

    def set_provider(self, user, provider_name, user_provider_id):
        """
        Set authentication provider on user.

        This method will connect given provider with given user,
        unless provider_id has already been used on another user.

        :param pyramid_fullauth.user.User user: user object
        :param str provider_name: provider name
        :param str user_provider_id: user id delivered by given provider

        :returns: whether user got/was connected or the connection was made with another user.
        :rtype: bool
        """
        if user.id:
            try:
                provider_auth = (
                    pyramid_basemodel.Session.query(AuthenticationProvider)
                    .filter(
                        AuthenticationProvider.user_id == user.id,
                        AuthenticationProvider.provider == provider_name,
                    )
                    .one()
                )
                if provider_auth.provider_id != user_provider_id:
                    return False
                return True
            except NoResultFound:
                pass

        provider_auth = AuthenticationProvider(provider=provider_name, provider_id=user_provider_id)
        user.providers.append(provider_auth)
        pyramid_basemodel.Session.flush()
        return True

    def __call__(self):
        """
        Authorize user in a social network.

        When authorization with facebook or twitter is done successfully
        action tries to find existing user in database,
        if it exists - login this user, otherwise creates new user.
        """
        context = self.request.context
        response_values = {
            "status": False,
            "csrf_token": self.request.session.get_csrf_token(),
        }
        user = self.request.user

        if user:
            # Lets try to connect our user
            return self._connect_user(response_values)
        try:
            user = (
                pyramid_basemodel.Session.query(User)
                .join(AuthenticationProvider)
                .filter(
                    AuthenticationProvider.provider == context.provider_name,
                    AuthenticationProvider.provider_id == context.profile["accounts"][0]["userid"],
                )
                .one()
            )
        except NoResultFound:
            user = None

        # If the user for the provider was not found then check
        # if in the DB exists user with the same email
        if not user:
            user = self._register_user()
            try:
                self.request.registry.notify(AfterSocialRegister(self.request, user, context.profile, response_values))
            except HTTPRedirection as redirect:
                # it's a redirect, let's follow it!
                return redirect

        # if we're here, user exists,
        try:
            self.request.registry.notify(AfterSocialLogIn(self.request, user, context.profile))
        except HTTPRedirection as redirect:
            # it's a redirect, let's follow it!
            return self.request.login_perform(user, location=redirect.location)
        else:
            return self.request.login_perform(user)

    def _connect_user(self, response_values):
        """
        Connect user to social account.

        :param dict response_values:

        :returns: response values with any message,
            or HTTPRedirection if raised in SocialAccountAlreadyConnected
        :rtype: dict
        """
        context = self.request.context
        user = self.request.user
        try:
            if not self.set_provider(user, context.provider_name, context.profile["accounts"][0]["userid"]):
                response_values["msg"] = self.request._(
                    "Your account is already connected to other ${provider} account.",
                    domain="pyramid_fullauth",
                    mapping={"provider": context.provider_name},
                )
            else:
                response_values["status"] = True
                response_values["msg"] = self.request._(
                    "Your account has been connected to ${provider} account.",
                    domain="pyramid_fullauth",
                    mapping={"provider": context.provider_name},
                )
        except IntegrityError:
            response_values["msg"] = self.request._(
                "This ${provider} account is already connected with other account.",
                domain="pyramid_fullauth",
                mapping={"provider": context.provider_name},
            )
            try:
                self.request.registry.notify(
                    SocialAccountAlreadyConnected(self.request, user, context.profile, response_values)
                )
            except HTTPRedirection as redirect:
                # it's a redirect, let's follow it!
                return redirect
        return response_values

    def _register_user(self):
        """Actually register new user in the system based on context values."""
        context = self.request.context
        email = self._email_from_context(context)

        try:
            user = pyramid_basemodel.Session.query(User).filter(User.email == email).one()
            # If we are here that means that in the DB exists user with the same email but without the provider
            # then we connect social account to this user
            if not self.set_provider(user, context.provider_name, context.profile["accounts"][0]["userid"]):
                # authenticating user with different social account than assigned,
                # recogniced by same email address used
                LOG.debug(
                    """Authenticated %d connected to %s id %s, with %s""",
                    user.id,
                    context.provider_name,
                    user.provider_id(context.provider_name),
                    context.profile["accounts"][0]["userid"],
                )
            pyramid_basemodel.Session.flush()
        except NoResultFound:
            length_min = self.config["register"]["password"]["length_min"]
            user = User(
                email=email,
                password=tools.password_generator(length_min),
                address_ip=self.request.remote_addr,
            )
            self.request.registry.notify(BeforeSocialRegister(self.request, user, context.profile))
            self.set_provider(user, context.provider_name, context.profile["accounts"][0]["userid"])
            pyramid_basemodel.Session.add(user)
            pyramid_basemodel.Session.flush()
            user.is_active = True
        return user

    def _email_from_context(self, context):
        """
        Extract or generate email from context values.

        :param velruse.AuthenticationComplete context: velruse context
        """
        # getting verified email from provider
        if "verifiedEmail" in context.profile:
            return context.profile["verifiedEmail"]
        # getting first of the emails provided by social login provider
        if "emails" in context.profile and context.profile["emails"] and "value" in context.profile["emails"][0]:
            return context.profile["emails"][0]["value"]
        # generating some random email address based on social userid and provider domain
        return f"{context.profile['accounts'][0]['userid']}@{context.profile['accounts'][0]['domain']}"


text:
    <form class="form-inline form-signin form-password" action="./?action=resetPassword" method="post" >

Enter your user name to reset your password, a confirmation email will be sent to your email address

        <input type="text" name="username" placeholder="Username" />
        <input class="btn btn-primary" type="submit" />
        <input type="reset" value="Back" class="btn" onclick="history.go(-1);">
    </form>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Azure.Messaging.EventHubs;
using Orleans.Serialization;

namespace Orleans.ServiceBus.Providers
{
    /// <summary>
    /// Extends EventData to support streaming
    /// </summary>
    public static class EventDataExtensions
    {
        private const string EventDataPropertyStreamNamespaceKey = "StreamNamespace";

        /// <summary>
        /// Adds stream namespace to the EventData
        /// </summary>
        /// <param name="eventData"></param>
        /// <param name="streamNamespace"></param>
        public static void SetStreamNamespaceProperty(this EventData eventData, string streamNamespace)
        {
            eventData.Properties[EventDataPropertyStreamNamespaceKey] = streamNamespace;
        }

        /// <summary>
        /// Gets stream namespace from the EventData
        /// </summary>
        /// <param name="eventData"></param>
        /// <returns></returns>
        public static string GetStreamNamespaceProperty(this EventData eventData)
        {
            object namespaceObj;
            if (eventData.Properties.TryGetValue(EventDataPropertyStreamNamespaceKey, out namespaceObj))
            {
                return (string)namespaceObj;
            }
            return null;
        }

        /// <summary>
        /// Serializes event data properties
        /// </summary>
        /// <param name="eventData"></param>
        /// <param name="serializationManager"></param>
        /// <returns></returns>
        public static byte[] SerializeProperties(this EventData eventData, SerializationManager serializationManager)
        {
            var writeStream = new BinaryTokenStreamWriter();
            serializationManager.Serialize(eventData.Properties.Where(kvp => !string.Equals(kvp.Key, EventDataPropertyStreamNamespaceKey, StringComparison.Ordinal)).ToList(), writeStream);
            var result = writeStream.ToByteArray();
            writeStream.ReleaseBuffers();
            return result;
        }

        /// <summary>
        /// Deserializes event data properties
        /// </summary>
        /// <param name="bytes"></param>
        /// <param name="serializationManager"></param>
        /// <returns></returns>
        public static IDictionary<string, object> DeserializeProperties(this ArraySegment<byte> bytes, SerializationManager serializationManager)
        {
            var stream = new BinaryTokenStreamReader(bytes);
            return serializationManager.Deserialize<List<KeyValuePair<string, object>>>(stream).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
        }
    }
}


text:
EditorPlayerStyle = EditorPlayerStyle or class(MissionScriptEditor)
function EditorPlayerStyle:create_element()
    self.super.create_element(self)
    self._element.class = "ElementPlayerStyle"
    self._element.values.style = ""
end
function EditorPlayerStyle:_build_panel()
	self:_create_panel()
	self:ComboCtrl("style", {"_scrubs"}, {help = "Select a style from the combobox"})
	self:Text("Change player style.")
end


text:
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Core.BackOffice;
using Core.Clients;
using Core.Kyc;

namespace LkeServices.Kyc
{
    public class SrvKycStatusManager
    {
        private readonly IKycRepository _kycRepository;
        private readonly IMenuBadgesRepository _menuBadgesRepository;
        private readonly IPersonalDataRepository _personalDataRepository;

        public SrvKycStatusManager(IKycRepository kycRepository, IMenuBadgesRepository menuBadgesRepository,
            IPersonalDataRepository personalDataRepository)
        {
            _kycRepository = kycRepository;
            _menuBadgesRepository = menuBadgesRepository;
            _personalDataRepository = personalDataRepository;
        }

        private async Task UpdateKycBadge()
        {
            var count = (await _kycRepository.GetClientsByStatus(KycStatus.Pending)).Count();
            await _menuBadgesRepository.SaveBadgeAsync(MenuBadges.Kyc, count.ToString());
        }

        public async Task ChangeKycStatus(string clientId, KycStatus kycStatus)
        {
            await _kycRepository.SetStatusAsync(clientId, kycStatus);
            await UpdateKycBadge();
        }

        public async Task<IEnumerable<IPersonalData>> GetAccountsToCheck()
        {
            var ids = await _kycRepository.GetClientsByStatus(KycStatus.Pending);
            return await _personalDataRepository.GetAsync(ids);
        }

    }

}


text:
DownloadTargetInfo::DownloadTargetInfo()
    : target_disposition(download::DownloadItem::TARGET_DISPOSITION_OVERWRITE),
      danger_type(download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS),
      danger_level(safe_browsing::DownloadFileType::NOT_DANGEROUS),
      is_filetype_handled_safely(false),
      result(download::DOWNLOAD_INTERRUPT_REASON_NONE),
      mixed_content_status(
          download::DownloadItem::MixedContentStatus::UNKNOWN) {}

DownloadTargetInfo::~DownloadTargetInfo() {}


text:
package com.chrisgammage.gwtjitsu.client.events;

import com.google.gwt.event.shared.EventHandler;

/**
 * Created with IntelliJ IDEA.
 * User: gammagec
 * Date: 11/1/12
 * Time: 9:20 AM
 */
public interface SubModelPropertyChangeHandler extends EventHandler {
  void onPropertyPropertyChange(String modelName, String propertyName);
}