text:
<?xml version="1.0"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.cmmi</groupId>
		<artifactId>cmmi-core</artifactId>
		<version>1.0.0</version>
	</parent>

	<groupId>com.cmmi</groupId>
	<artifactId>cmmi-core-shared</artifactId>
	<version>1.0.0</version>
	<packaging>jar</packaging>

	<name>cmmi-core-shared</name>
	<url>http://maven.apache.org</url>

	<description>CMMI Modules Core Shared Area</description>

	<dependencies>
		<!-- AOP begin -->
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
		</dependency>
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
		</dependency>
		<!-- AOP end -->

		<dependency>
			<groupId>com.cmmi</groupId>
			<artifactId>cmmi-common-shared</artifactId>
		</dependency>
	</dependencies>

</project>


text:
require "spec_helper"

describe ApplicationController do
  it { should be_a(Supermarket::Authorization) }
  it { should be_a(Supermarket::LocationStorage) }

  describe "a controller which responds to specific formats" do
    controller do
      def index
        respond_to do |format|
          format.json do
            render json: {}
          end
        end
      end

      def show
        respond_to do |format|
          format.html do
            render text: ""
          end
        end
      end

      def edit; end
    end

    it "404s when HTML is requested by JSON is served" do
      get :index

      expect(response.status.to_i).to eql(404)
    end

    it "404s when JSON is requested but HTML is served" do
      get :show, params: { id: 1, format: :json }

      expect(response.status.to_i).to eql(404)
    end

    it "sets the default search context as cookbooks" do
      get :index

      expect(assigns[:search][:name]).to eql("Cookbooks")
      expect(assigns[:search][:path]).to eql(cookbooks_path)
    end
  end

  describe "github integration" do
    before { Feature.deactivate(:github) }
    after { Feature.activate(:github) }

    controller do
      before_action :require_linked_github_account!

      def index
        respond_to do |format|
          format.html do
            render plain: "haha"
          end
        end
      end

      def current_user
        nil
      end
    end

    it "skips the require_linked_github_account! filter if github integration is disabled" do
      get :index

      expect(response).to be_successful
      expect(response.body).to eql("haha")
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
`roles/xroad-ca/` directory contains a collection of scripts to
set up an openssl-based test-CA environment for signing certificates
and providing TSA and OCSP services during development.
The scripts are created for Ubuntu 14.04.

You can initialize the test-CA server automatically [with Ansible.](README.md)
This initializes a new test-CA server if one is listed in `ca-servers` category.
Alternatively, you can initialize the server manually. This is described in chapters 2-4.
If you use Ansible, skip those chapters.
Chapters 1 and 5-7 describe usage of the initialized CA server and are useful for both manual and ansible installation.

To customize test-CA DN details for Ansible installation, specify parameters in a file in group_vars ([read more about group_vars](README.md))

Example group_vars configuration file with all of the test-CA parameters:

```
xroad_ca_dn_country: "SE"
xroad_ca_o: "Customized Test"
xroad_ca_ou: "Customized Test CA OU"
xroad_ca_cn: "Customized Test CA CN"
xroad_ca_ocsp_o: "Customized Test"
xroad_ca_ocsp_ou: "Customized Test OCSP OU"
xroad_ca_ocsp_cn: "Customized Test OCSP CN"
xroad_ca_tsa_o: "Customized Test"
xroad_ca_tsa_ou: "Customized Test TSA OU"
xroad_ca_tsa_cn: "Customized Test TSA CN"
```

**Note that the test-CA created by the scripts is for testing purposes only and is not meant to provide a secure certification authority.**

---------------------------------------------

## 1. Contents of the roles/xroad-ca directory

`files/etc/init` - upstart-jobs for the TSA and OCSP

`files/etc/nginx` - nginx configuration for proxying TSA and OCSP requests

`files/home/ca/CA` - CA configuration, and scripts for signing certificates locally

`files/home/ca/TSA` - the TSA server

`files/usr` - scripts for signing certificates

`templates/init.sh` - script for creating the test-CA environment

---------------------------------------------

## 2. Preliminary requirements

(Ansible does these steps automatically)

1. Install nginx-light on the target machine
2. Create the following users on the target machine
	- `ca`
	- `ocsp`
3. Copy the following directories from the `roles/xroad-ca/files` directory to target machine root
	- `etc`
	- `home`
	- `usr`
4. Copy `roles/xroad-ca/templates/init.sh` to `home/ca/CA/`
5. Add user `ocsp` to group `ca`
6. Grant `ca` ownership and all permissions to files under `/home/ca/CA`
7. Grant read permission for group `ca` to files under `/home/ca/CA`
8. Grant read + execute permissions for group `ca` to directories under `/home/ca/CA`
9. Create a file called `ocsp.log` under `/var/log`
10. Grant `ca` ownership and group `ca` read and write permissions for `ocsp.log`
11. Fill in parameters for CA, OCSP and TSA distinguished names (DN) in `/home/ca/CA/init.sh`:
```
# dn parameters
DN_COUNTRY="{{ xroad_ca_dn_country }}"
DN_CA_O="{{ xroad_ca_o }}"
DN_CA_OU="{{ xroad_ca_ou }}"
DN_CA_CN="{{ xroad_ca_cn }}"
DN_OCSP_O="{{ xroad_ca_ocsp_o }}"
DN_OCSP_OU="{{ xroad_ca_ocsp_ou }}"
DN_OCSP_CN="{{ xroad_ca_ocsp_cn }}"
DN_TSA_O="{{ xroad_ca_tsa_o }}"
DN_TSA_OU="{{ xroad_ca_tsa_ou }}"
DN_TSA_CN="{{ xroad_ca_tsa_cn }}"
```
CA, OCSP and TSA distinguished name field values can be selected freely,
the only limitation being that the value combination should be unique for each three.

Using recognizable and meaningful values helps to distinguish the certification authorities when registering them on the central server.

---------------------------------------------

## 3. Creating the CA environment

(Ansible does this step automatically)

1. As `ca`, run `init.sh` under `/home/ca/CA`

---------------------------------------------

## 4. (Re)start NGINX, OCSP and TSA services

(Ansible does these steps automatically)

1. Before starting the jobs, restart the nginx service to apply the proxy changes
2. start the jobs by calling `sudo /sbin/start ocsp` and `sudo /sbin/start tsa`

The jobs are located in `/etc/init` and are run as `ocsp`.

---------------------------------------------

## 5. About the TSA and OCSP services

Both services use nginx as a proxy to redirect the requests to listened ports:

- requests (POST) to `port 8888` go to `8889` for the openssl process started by the OCSP job
- requests (GET, POST) to `port 8899` go to `localhost:9999` for the python server started by the TSA job

---------------------------------------------

## 6. Configuring the central server to use the test-CA

After the jobs have been successfully started, the test-CA is ready to be used in the test environment.

To configure the central server to use the test-CA:

1. Import the CA, TSA and OCSP certificates from `/home/ca/CA/certs` to the central server
2. Configure the CA to use the test-CA OCSP through `port 8888` on the test-CA machine
3. Configure the TSA to `port 8899` on the test-CA machine

---------------------------------------------

## 7. Signing certificates

NOTE: The test CA setup only accepts DER as input format.

To sign a CSR, you have two options:

### 7.1. Use command `sign` on a file

1. Upload the CSR to test CA server
2. Register the certificate using command `sign` (user needs to have sudo rights)
```
user@some-ca-server:~$ sign sign_csr_20161020_member_FI_GOV_889.der
Using configuration from CA.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 6 (0x6)
        Validity
            Not Before: Oct 20 12:34:52 2016 GMT
            Not After : Oct 15 12:34:52 2036 GMT
        Subject:
            countryName               = FI
            organizationName          = FOONAME
            commonName                = 889
            serialNumber              = FI/cadev-ss1/GOV
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            X509v3 Key Usage: critical
                Non Repudiation
Certificate is to be certified until Oct 15 12:34:52 2036 GMT (7300 days)
Sign the certificate? [y/n]:y
```
The signed certificate is stored in `/home/ca/CA/newcerts/??.pem`, where ?? = index number

### 7.2. Use commands `sign-sign` and `sign-auth` on piped data

You can use SSH to pipe the CSR and signed certificate remotely.
Pick either `sign-sign` or `sign-auth` based on the certificate type.

```
$ cat sign_csr_20161020_member_FI_GOV_901.der | ssh user@some-ca-server sign-sign > sign-cert-901.pem
Using configuration from CA.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 4 (0x4)
        Validity
            Not Before: Oct 20 12:50:35 2016 GMT
            Not After : Oct 15 12:50:35 2036 GMT
        Subject:
            countryName               = FI
            organizationName          = 6
            commonName                = 901
            serialNumber              = FI/cadev-ss1/GOV
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            X509v3 Key Usage: critical
                Non Repudiation
Certificate is to be certified until Oct 15 12:50:35 2036 GMT (7300 days)
Sign the certificate? [y/n]:

1 out of 1 certificate requests certified, commit? [y/n]Write out database with 1 new entries
Data Base Updated
```

If there are issues running the TSA or OCSP jobs, logging information can be found in the upstart-job logs under `/var/log/upstart/<jobname>.log`. Additional information on the OCSP service status is logged in `/var/log/ocsp.log`.

#### TXT_DB error while signing a certificate

If signing fails with error `TXT_DB error number 2`, this is most likely due to the certificate already being signed and registered to CA.
Subject's DN has to be unique, you can't register multiple certificates with identical subject DN's.
You can consider either changing the certificate details or revoking the older certificate (described later).

```
Sign the certificate? [y/n]:y
failed to update database
TXT_DB error number 2
```

### Certificate revocation

To revoke a signed certificate, you can use revoke.sh script from `/home/ca/CA`.
Run the script as a user with sudo rights, from `/home/ca/CA`.
revoke.sh takes the signed certificate filename (.pem) as a parameter.

Examples:
```
$ cd /home/ca/CA/
$ ./revoke.sh /someplace/auth-cert-200.pem
Using configuration from CA.cnf
Revoking Certificate 04.
Data Base Updated

$ ./revoke.sh /someplace/auth-cert-200.pem
Using configuration from CA.cnf
ERROR:Already revoked, serial number 04

$ ./revoke.sh /home/ca/CA/newcerts/05.pem
Using configuration from CA.cnf
Revoking Certificate 05.
Data Base Updated
```


text:
typedef int Data;
typedef struct _node {
    Data data;
    struct _node *next;
} Node;
typedef Node* List;

void createList(List *list, Data *data);
bool isEmpty(const List *list);
void addNode(List *list, Data *data);
void removeNode(List *list, Data *data);
void destoryList(List *list);
void printList(const List *list);

int main(void) {
    List list = NULL;
    Data data = 1;

    if (isEmpty(&list)) {
        createList(&list, &data);
    }

    addNode(&list, &data);
    addNode(&list, &data);
    printList(&list);

    destoryList(&list);
    printf("%d\n", isEmpty(&list) ? 1 : 0);

    return 0;
}

void createList(List *list, Data *data) {
    if (*list == NULL) {
        *list = (List)malloc(sizeof(Node));
        (*list)->data = *data;
        (*list) ->next = NULL;
    } else {
        fprintf(stderr, "List is not empty.\n");
    }
}

bool isEmpty(const List *list) {
    return *list == NULL;
}

void addNode(List *list, Data *data) {
    Node *current = *list;
    Node *item;

    for (; current->next != NULL; current = current->next);
    item = (Node*)malloc(sizeof(Node));
    item->data = *data;
    item->next = NULL;
    current->next = item;
}

void removeNode(List *list, Data *data) {
    for (Node **current = list; *current != NULL; current = &((*current)->next)) {
        if ((*current)->data == *data) {
            Node *item = *current;
            *current = (*current)->next;
            free(item);
        }
    }
}

void destoryList(List *list) {
    for (Node *item = *list, *temp; item != NULL; ) {
       temp = item->next;
       free(item);
       item = temp;
    }
    *list = NULL; // empty
}

void printList(const List *list) {
    for (Node *current = *list; current != NULL; current = current->next) {
        printf("%d ", current->data);
    }
    putchar('\n');
}


text:
<?php

namespace Scienta\DoctrineJsonFunctions\Tests\Query\Functions\Mariadb;

use Scienta\DoctrineJsonFunctions\Tests\Query\MariadbTestCase;

class JsonExistsTest extends MariadbTestCase
{
    public function testJsonExists()
    {
        $this->assertDqlProducesSql(
            "SELECT JSON_EXISTS('{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}', '$.key2[10]') from Scienta\DoctrineJsonFunctions\Tests\Entities\Blank b",
            "SELECT JSON_EXISTS('{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}', '$.key2[10]') AS sclr_0 FROM Blank b0_"
        );
    }
}


text:
cd $TOP
git clone -b refresh-v0.6 https://github.com/lowRISC/buildroot.git
cd buildroot
cp configs/lowrisc_defconfig .config
make


text:
jest.dontMock('../Store');
jest.dontMock('object-assign');

describe('Store', function() {

  var Store = require('../Store');
  var mockStore;

  mockStore = new Store({
    testMethod: function(){
      return true;
    }
  },function(payload){
    switch(payload.actionType) {
      case 'ADD_TEST':
        return true;
      break;
    }
  });

  it('should return a new instance with methods attached via the methods argument', function() {

    expect(mockStore.testMethod).toBeDefined();

  });

  it('should attach the supplied callback to the new instance', function() {

    expect(mockStore.callback).toBeDefined();

  });

  it('should be merged with EventEmitter', function() {

    expect("on" in mockStore).toEqual(true);
    expect("removeListener" in mockStore).toEqual(true);
    expect("emit" in mockStore).toEqual(true);

  });

  it('should create a mixin property', function() {

    expect(mockStore.mixin).toBeDefined();

  });

  it('should return a dispatcherID when getDispatchToken is called', function() {

    mockStore.dispatcherID = 5;
    expect(mockStore.getDispatchToken()).toEqual(5);

  });

  it('should throw if a supplied method is named "callback"', function() {

    expect(function() {
      Store.constructor({
        callback: function(){
          return true;
        }
      },function(payload){});
    }).toThrow();

  });

  it('should throw if a supplied method is named "mixin"', function() {

    expect(function() {
      Store.constructor({
        mixin: function(){
          return true;
        }
      },function(payload){});
    }).toThrow();

  });

});


text:
namespace $.$$ {
	export class $mol_plot_ruler_hor extends $.$mol_plot_ruler_hor {
		dimensions_axis() {
			return this.dimensions_pane().x
		}

		viewport_axis() {
			return new this.$.$mol_vector_range(0, this.size_real().x)
		}

		scale_axis() {
			return this.scale()[0]
		}

		scale_step() {
			return this.scale()[0]
		}

		shift_axis() {
			return this.shift()[0]
		}

		curve() {
			const [shift] = this.shift()
			const [scale] = this.scale()

			return this.axis_points().map( point => {
				let scaled = Math.round( point * scale + shift )
				scaled = Math.max( Number.MIN_SAFE_INTEGER, Math.min( scaled, Number.MAX_SAFE_INTEGER ) )
				return `M ${ scaled } 1000 V 0`
			}).join( ' ' )
		}

		label_pos_x( index : number ) {
			return (this.axis_points()[index] * this.scale()[0] + this.shift()[0]).toFixed(3)
		}

		background_y() {
			return String(this.size_real()[1] - this.font_size())
		}

		title_pos_y() {
			return String(this.size_real()[1])
		}

		background_height() {
			return String(this.font_size())
		}
	}
}


text:
* Update PUBLISH_NODE_VERSION to 10.7.0

# 9.0.1 (2018-10-11)
* Update PUBLISH_NODE_VERSION to 10.7.0

# 9.0.0 (2018-10-04)

* Run es5 getter codemod

# 8.0.0 (2018-09-20)

Dependencies:
* **Updated** core dependencies to be compatible with ember 3.3.
* **Updated** third-party dependencies to be compatible with ember 3.3.

Addon:
* **Updated**  Ember core module import paths to match Ember.js new Modules API.
* **Replaced**  Ember.Logger with the native console.

Testing:
* **Removed** `helpers/resolver.js`, `helpers/start-app.js`, `helpers/destroy-app.js` as they are not needed with Ember new testing API.
* **Updated** `test-helper.js` to align with Ember's new testing API.
* **Added** Ember 3.3 scenario to ember-try config.

# 7.0.5 (2018-08-20)

* **Fixed** Travis API key.

# 7.0.4 (2018-07-20)

* **Fixed** Travis API key.

# 7.0.3 (2018-04-26)
* **Updated** ember-component validator to work with Ember CLI 3.2.0

# 7.0.2 (2018-03-09)
* **Updated** `ember-spread` devDependency to `^5.0.0`

# 7.0.1 (2018-03-09)
* **Updated** pull request template
* **Added** issue template
* **Updated** to `pr-bumper` version `3`
* **Updated** to node 8
* **Added** slack integration
* **Updated** `ember-frost-test` to `^4.0.1`
* **Updated** `ember-test-utils` to `^8.1.1`
* **Updated** `ember-cli-frost-blueprints` to `^5.0.2`
* **Added** `package-lock.json` file

# 7.0.0 (2018-02-19)
* **Updated** test helper to now be provided from `addon-test-support`. For example, the `createComponent` test helper previously available at `dummy/tests/helpers/ember-prop-types` is now available via `ember-prop-types/test-support/utils`

# 6.0.1 (2018-01-03)

* Update `ember-spread` devDependency to ^4.0.1

# 6.0.0 (2018-01-03)
* Update `ember-cli-google-fonts` to `^2.16.2`
* Pin `ember-cli-htmlbars-inline-precompile` to `0.3.12`
* Pin `ember-get-config` to `0.2.2`
* Move `ember-string-ishtmlsafe-polyfill` to dependency
* Remove `npm-install-security-check` dependency
* Pin `prism` Bower dependency to `1.6.0`
* Remove useLintTree ember-cli-mocha configuration
* Upgrade `ember-frost-test` to `^4.0.0`
* Install `ember-cli-frost-blueprints@^5.0.1`
* Git ignore _package-lock.json_ file until officially support Node 8
* Upgrade `ember-spread` to `^3.0.1`

# 5.0.3 (2017-12-27)

We experienced an issue with our release version strategy and this release should not have occurred.  It should have been part of `6.0.0`

# 5.0.2 (2017-11-22)
* **Updated** to use latest version of `ember-frost-test`
* **Updated** to use latest version of `ember-test-utils`
* **Added** `bower` package since it is no longer included by Ember CLI
* **Updated** lint to skip linting of line length in `CHANGELOG.md` file

# 5.0.1 (2017-11-02)

* Update `ember-spread` to Ember CLI 2.12.3 compatible version as part of reversion from Ember CLI 2.16.1 to 2.12.3

# 5.0.0 (2017-11-02)

## WARNING: THIS REVERTS EMBER CLI 2.16.1 BACK TO 2.12.3

We apologize for this change. Unfortunately, due to the internal needs of our organization this became a required action.

The 2.16.1 changes are now located in the `ember-cli-2.16.1` branch and will hopefully be contained in a versioned release again in the future.

# 4.1.0 (2017-10-30)
* **Added** regexp type

# 4.0.1 (2017-10-11)
* **Updated** to Ember CLI 2.16.1

# 4.0.0 (2017-09-27)
* **Updated** to Ember CLI version 2.15.1 (uses babel 6)
* **Updated** imports to ember javascript modules syntax
* **Added** eslint rule to require usage of new modules syntax (will remove once added to ember-test-utils)
* **Updated** test helpers to now come from `addon-test-support`
* **Updated** `ember-cli-code-coverage` and configured reporters
* **Removed** `ember-string-ishtmlsafe-polyfill` - If running Ember CLI < 2.8 then add back to your consuming addon/app.

# 3.14.2 (2017-09-25)

- Adds a fallback for Object.assign for browsers that don't support it (i.e. IE).

# 3.14.1 (2017-08-02)

* Install `ember-string-ishtmlsafe-polyfill` to address #139

# 3.14.0 (2017-08-02)
Update string validation to support Ember SafeString objects. Fixes #128.

# 3.13.4 (2017-07-10)

* Fix ember-component validator usage in `ember#lts-2-8` branch of Ember

# 3.13.3 (2017-07-10)

Upgrade ember-cli to 2.12.3

# 3.13.2 (2017-07-04)

* **Upgrade** `ember-get-config`

# 3.13.1 (2017-07-04)
* **Fix** HTMLBars linting

# 3.13.0 (2017-06-23)
* **Added** date type

# 3.12.3 (2017-06-01)
 fixed error with nameOfType if typedef does not return a function string

# 3.12.2 (2017-05-30)

- Fixed a regression in the execution order of getDefaultProps introduced in #118

# 3.12.1 (2017-05-10)

* **Updated** the secure auth tokens in `.travis.yml`

# 3.12.0 (2017-04-24)

* **Fixed** build.

# 3.11.0 (2017-04-03)
- Log typeOf value when asserting type

# 3.10.4

* **Upgraded** `ember-get-config`.

# 3.10.3

* **Fixed** `EmberComponent` prop type to work properly with Glimmer 2.

# 3.10.2

* **Upgraded** to test against Ember 2.11.

# 3.10.1

* Attempt to fix publishing of dummy app to `gh-pages` branch.

# 3.10.0

* **Added** additional builds to CI to make sure addon works with latest versions of Ember.
* **Removed** files from npm package that aren't necessary (all of the various config files).
* **Updated** dependencies to latest versions.

# 3.9.0

* **Added** new `updatable` option to all types to flag components that shouldn't allow updates. By default all properties will allow updates so specifying `updatable: true` isn't necessary.

# 3.8.0

* **Added** `EmberComponent` prop-type for properties that come from the `{{component}}` helper.

# 3.7.1
* **Fixed** typo in dummy app.

# 3.7.0

* **Added** new alternative API for the following types:

  * `any`
  * `array`
  * `bool`
  * `element`
  * `EmberObject`
  * `func`
  * `null`
  * `number`
  * `object`
  * `string`
  * `symbol`

  **Example of new API with `any` type**

  ```js
  bar: PropTypes.any(), // Same as PropTypes.any
  baz: PropTypes.any({required: true}), // Same as PropTypes.any.isRequired
  foo: PropTypes.any({required: false}) // same as PropTypes.any
  ```

  > NOTE: If you update an addon to use this new API, consumers of your addon will also need to be upgraded to the version of `ember-prop-types` that includes this API. Otherwise they'll see errors as `PropTypes.any()` won't work due to the fact `any` will be an object rather than a function.

* **Added** new optional argument to the following types:

  * `arrayOf`
  * `instanceOf`
  * `oneOf`
  * `oneOfType`
  * `shape`

  **Example of new optional argument with `arrayOf` type**

  ```js
  baz: PropTypes.arrayOf(PropTypes.string, {required: true}), // Same as PropTypes.arrayOf(PropTypes.string).isRequired
  foo: PropTypes.arrayOf(PropTypes.string, {required: false}) // same as PropTypes.arrayOf(PropTypes.string)
  ```

# 3.6.0

* **Added** the ability to enable/disable validation from an environment configuration setting, allowing consumers to control which environments `ember-prop-types` warnings/errors appear in. Below is an example of how to explicitly enable validation:

  ```js
  'ember-prop-types': {
    validate: true
  }
  ```

  > Note: Without explicitly adding this setting things will continue to work as they did before in which validation is enabled for all environments except *production*.

* **Fixed** validation error messages when `throwErrors` is set to true to match error messages when errors are not thrown (logging warnings instead).

# 3.5.0

* **Added** ability to validate properties on initialized that are nested under a single property via something like [ember-spread](https://github.com/ciena-blueplanet/ember-spread).

# 3.4.0

* **Added** the ability to configure validation errors to be throw as errors instead of logged as warnings. To enable this feature simply add the following to `config/environment.js`:

  ```js
  'ember-prop-types': {
    throwErrors: true
  }
  ```

# 3.3.0

* **Added** opt-in validation checks when properties that are spec'd in `propTypes` are updated. To enable this feature simply add the following to `config/environment.js`:

  ```js
  'ember-prop-types': {
    validateOnUpdate: true
  }
  ```

# 3.2.1

* **Fixed** bug where defaults weren't being applied when consumer passes in `undefined` for a property with defaults.

# 3.2.0

* **Added** more detailed messaging for sub-property validations when using `PropTypes.arrayOf` or `PropTypes.shape`

# 3.1.1

* **Fixed** a bug in the `PropTypes.arrayOf` validator when used in conjunction with the `PropTypes.shape` validator.

# 3.1.0

* **Fixed** https://github.com/ciena-blueplanet/ember-prop-types/issues/76
* **Refactored** tests
* **Updated** test tools

# 3.0.2

* Improved demo by adding license, link to Github repository, contributors, syntax highlighting, and a brief summary.

# 3.0.1

* **Added** dummy app for better documentation.

# 3.0.0

* Support cases where components and mixins both use this mixin.

# 2.5.11

* **Added** pull request template.

# 2.5.10

* **Added** `npm-install-security-check` as a dependency to make consumers more security conscious.

# 2.5.9

* Updated CI configuration to not run npm scripts on install.

# 2.5.8

* Cleaned up README to pass default config for remark-lint and better organized badges.
* Updated dev dependencies.

# 2.5.7

* Addressed the following security vulnerability: https://nodesecurity.io/advisories/118.

# 2.5.6

* **Updated** Travis configuration to test addon against older versions of Ember.

# 2.5.5

* Only import polyfill for CI and not for consuming apps. Apps that want Symbol can pay as they go.

# 2.5.4

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 2.5.3

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 2.5.2

* **Fixed** issue when `Ember.assign` does not exist to fallback on `Object.assign` then `Ember.merge`.

# 2.5.1

* **Addedd** missing prop-types to README.
* **Upgraded** `ember-get-config` to latest version.

# 2.5.0

* **Added** `element` prop-type.

# 2.4.2

* **Added** `symbol` prop-type.

# 2.4.1

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 2.4.0

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 2.3.1

* **Fixed** `shape` prop-type to not error when non-required props in shape are not present.

# 2.3.0

* **Added** `arrayOf` prop-type.

# 2.2.8

* Split source code up into separate modules as a first step in refactoring and improving implementation.

# 2.2.7

* **Added** tests for `oneOf` prop-type.

# 2.2.6

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 2.2.5

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 2.2.4

* **Added** tests for `instanceOf` prop-type.

# 2.2.3

* **Added** tests for `shape` prop-type and commented out tests that exercise issue #24.

# 2.2.2

* **Added** a bunch of tests to help prevent future regressions and verify addon does what it advertises.

# 2.2.1

- Finishes the removal of lodash as a dependency
- Removed Object.assign to fix cases where browsers don't support the latest ES6 syntax

# 2.2.0

- Removed lodash as a dependency to avoid lodash as a downstream requirement
- Replaced lodash functions with equivalent Ember/ES6/custom functions

# 2.1.0

* **Changed** from `ember-lodash` to `ember-lodash-shim`.

# 2.0.1

* Updated dependencies to the latest versions.

# 2.0.0

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 1.5.0

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`

# 1.4.0

No CHANGELOG section found in Pull Request description.
Use a `# CHANGELOG` section in your Pull Request description to auto-populate the `CHANGELOG.md`


text:
var path = require('path');
var e6 = require('./e6.js');

var dirname = process.argv[2];
var ext = process.argv[3];

e6(dirname, ext, function (err, files) {
  if (err) return console.log(err);
  files.forEach(function (file) {
    console.log(file);
  });
});


text:
<!DOCTYPE html>

    <title>Sheldon's Blog</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../stylesheets/default.css">
    <link rel="stylesheet" type="text/css" href="../stylesheets/blog-code.css">
    <link rel="stylesheet" type="text/css" href="../stylesheets/t6-oop-concepts.css">
    <link rel="stylesheet" href="../font-awesome-4.3.0/css/font-awesome.min.css">
    <link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

      About Me
      Blog
      Projects

Inheritance vs Composition

2015-04-23

Inheritance

          Inheritance is when you have one class that is based on another class. For instance, if you created a class to represent an animal, you might then decide to create a dog class that is derived from the animal class. In Ruby, you'd do this by using the following code:

            def Animal
            def eat
            puts "Animal eats"
            end

            def sleep
            puts "Animal sleeps"
            end
            end

            def Dog < Animal
            def bark
            puts "Dog Barks"
            end
            end

          The two classes now have an parent-child relationship. This is also known as an "is-a" relationship, Dog is-a type of Animal. The Dog class gains the methods defined in the Animal class, it does not need to define them on its own. It can also choose to override the methods in the Animal class, choosing its own implementation for those methods. Any new methods defined in Dog belong to it and any classes that may derive from it in the future. In Ruby, each child can only have one parent, but there are other languages that allow more than one parent, this is called multiple inheritance.

Composition

          Composition is when you use instance variables that are actually other objects. So instead of inheriting methods from another class, you can simply create an instance of that class and call the methods that you need. You can more or less the same benefits of inheritance, with out having a parent-child relationship.

            def Animal
            def eat
            puts "Animal eats"
            end

            def sleep
            puts "Animal sleeps"
            end
            end

            def Dog < Animal
            @animal = Animal.new

            def eat
            @animal.eat
            end

            def sleep
            @animal.sleep
            end

            def bark
            puts "Dog Barks"
            end
            end

Which one to use?

          With composition you have to write code to define the methods you want to use from another class. This means you need to write additional code, that wouldn't be necessary if you used inheritance. However, with inheritance you can't pick and choose which methods you want implemented, you have to take them all and override the ones you want changed. If you only want some methods (or maybe just a few) implemented from another class, you are probably better off using composition.


text:
const express = require('express');
const path = require('path');

const app = express();

app.use(express.static('assets'));

app.listen(process.env.PORT || 8080);


text:
require('Utilities');

function Client_PresentMenuUI(rootParent, setMaxSize, setScrollable, game)
	Game = game;
	SubmitBtn = nil;

	setMaxSize(450, 280);

	vert = UI.CreateVerticalLayoutGroup(rootParent);

	if (game.Us == nil) then
		UI.CreateLabel(vert).SetText("You cannot gift armies since you're not in the game");
		return;
	end

	local row1 = UI.CreateHorizontalLayoutGroup(vert);
	UI.CreateLabel(row1).SetText("Gift armies to this player: ");
	TargetPlayerBtn = UI.CreateButton(row1).SetText("Select player...").SetOnClick(TargetPlayerClicked);

	local row2 = UI.CreateHorizontalLayoutGroup(vert);
	UI.CreateLabel(row2).SetText("Gift armies from this territory: ");
	TargetTerritoryBtn = UI.CreateButton(row2).SetText("Select source territory...").SetOnClick(TargetTerritoryClicked);

end

function TargetPlayerClicked()
	local players = filter(Game.Game.Players, function (p) return p.ID ~= Game.Us.ID end);
	local options = map(players, PlayerButton);
	UI.PromptFromList("Select the player you'd like to give armies to", options);
end
function PlayerButton(player)
	local name = player.DisplayName(nil, false);
	local ret = {};
	ret["text"] = name;
	ret["selected"] = function()
		TargetPlayerBtn.SetText(name);
		TargetPlayerID = player.ID;
	end
	return ret;
end

function TargetTerritoryClicked()
	local options = map(filter(Game.LatestStanding.Territories, function(t) return t.OwnerPlayerID == Game.Us.ID end), TerritoryButton);
	UI.PromptFromList("Select the territory you'd like to take armies from", options);
end
function TerritoryButton(terr)
	local name = Game.Map.Territories[terr.ID].Name;
	local ret = {};
	ret["text"] = name;
	ret["selected"] = function()
		TargetTerritoryBtn.SetText(name);
		TargetTerritoryID = terr.ID;

		CheckCreateFinalStep();
	end
	return ret;
end

function CheckCreateFinalStep()
	if (SubmitBtn == nil) then

		local row3 = UI.CreateHorizontalLayoutGroup(vert);
		UI.CreateLabel(row3).SetText("How many armies would you like to gift: ");
		NumArmiesInput = UI.CreateNumberInputField(row3).SetSliderMinValue(1);

		SubmitBtn = UI.CreateButton(vert).SetText("Gift").SetOnClick(SubmitClicked);
	end

	local maxArmies = Game.LatestStanding.Territories[TargetTerritoryID].NumArmies.NumArmies;
	NumArmiesInput.SetSliderMaxValue(maxArmies).SetValue(maxArmies);
end

function SubmitClicked()
	local msg = 'Gifting ' .. NumArmiesInput.GetValue() .. ' armies from ' .. Game.Map.Territories[TargetTerritoryID].Name .. ' to ' .. Game.Game.Players[TargetPlayerID].DisplayName(nil, false);

	local payload = 'GiftArmies_' .. NumArmiesInput.GetValue() .. ',' .. TargetTerritoryID .. ',' .. TargetPlayerID;

	local orders = Game.Orders;
	table.insert(orders, WL.GameOrderCustom.Create(Game.Us.ID, msg, payload));
	Game.Orders = orders;
end


text:
<?php

namespace App\Domain\User\Command;

use App\Domain\Entity\User\UserRepository;
use App\Domain\User\UserFinder;

abstract class UserCommandHandler
{
    use UserFinder;

    public function __construct(UserRepository $userRepository)
    {
        $this->userRepository = $userRepository;
    }
}


text:
//
//  XWSquareButton.m
//  百思不得姐
//
//  Created by longxianwen on 15/9/8.
//  Copyright (c) 2015年 longxianwen. All rights reserved.
//  我--footView--方块按钮

#import "XWSquareButton.h"
#import <UIButton+WebCache.h>

@implementation XWSquareButton

- (instancetype)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame])
    {
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:13];

        [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

        //设置带有分隔线的背景图片
        [self setBackgroundImage:[UIImage imageNamed:@"mainCellBackground"] forState:UIControlStateNormal];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];

    //设置图片位置

    self.imageView.width = self.width * 0.5;
    self.imageView.height = self.imageView.width;
    self.imageView.y = self.height * 0.1;
    self.imageView.centerX  = self.width * 0.5;

    //设置位子文字
    self.titleLabel.width = self.width;
    self.titleLabel.x = 0;
    self.titleLabel.y = CGRectGetMaxY(self.imageView.frame);
    self.titleLabel.height = self.height -  self.titleLabel.y;

}

- (void)setSquareButton:(XWSquare *)squareButton
{
    _squareButton = squareButton;

    //设置数据
    [self setTitle:_squareButton.name forState:UIControlStateNormal];

    [self sd_setImageWithURL:[NSURL URLWithString:_squareButton.icon] forState:UIControlStateNormal];

    /*
     //下载图片
     [[SDWebImageManager sharedManager]downloadImageWithURL:[NSURL URLWithString:square.icon] options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {

     [btn setImage:image forState:UIControlStateNormal];

     }];
     */
}

@end


text:
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<title>Tests that a unique origin is NOT created for XML tree viewer when script is enabled</title>
<script>
  setup({single_test: true});

  function checkSourceXML() {
    done();
  }

  function onload() {
    xmlWindow = window.open('resources/sample.xml');
    xmlWindow.onload = checkSourceXML;
  }
</script>
<body onload="onload();">


text:
package org.hl7.fhir.dstu3.model;

// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1

import java.util.*;

import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.ChildOrder;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
 * A length - a value with a unit that is a physical distance.
 */
@DatatypeDef(name="Distance")
public class Distance extends Quantity implements ICompositeType {

    private static final long serialVersionUID = 0L;

  /**
   * Constructor
   */
    public Distance() {
      super();
    }

      protected void listChildren(List<Property> childrenList) {
        super.listChildren(childrenList);
      }

      @Override
      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
        switch (hash) {
        default: return super.getProperty(hash, name, checkValid);
        }

      }

      @Override
      public Base setProperty(int hash, String name, Base value) throws FHIRException {
        switch (hash) {
        default: return super.setProperty(hash, name, value);
        }

      }

      @Override
      public Base setProperty(String name, Base value) throws FHIRException {
          return super.setProperty(name, value);
      }

      @Override
      public Base makeProperty(int hash, String name) throws FHIRException {
        switch (hash) {
        default: return super.makeProperty(hash, name);
        }

      }

      @Override
      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
        switch (hash) {
        default: return super.getTypesForProperty(hash, name);
        }

      }

      @Override
      public Base addChild(String name) throws FHIRException {
          return super.addChild(name);
      }

  public String fhirType() {
    return "Distance";

  }

      public Distance copy() {
        Distance dst = new Distance();
        copyValues(dst);
        return dst;
      }

      protected Distance typedCopy() {
        return copy();
      }

      @Override
      public boolean equalsDeep(Base other) {
        if (!super.equalsDeep(other))
          return false;
        if (!(other instanceof Distance))
          return false;
        Distance o = (Distance) other;
        return true;
      }

      @Override
      public boolean equalsShallow(Base other) {
        if (!super.equalsShallow(other))
          return false;
        if (!(other instanceof Distance))
          return false;
        Distance o = (Distance) other;
        return true;
      }

      public boolean isEmpty() {
        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty();
      }

}


text:
@interface YHToastTextElement ()
{
    YYTextLayout* _textLayout;
    CGRect _toastRect;
}
@end

@implementation YHToastTextElement
- (instancetype) init
{
    self = [super init];
    if (!self) {
        return self;
    }
    _toastContentFont = [UIFont systemFontOfSize:14];
    return self;
}

- (NSAttributedString*) readableContentText
{
    if ([_textLayout.text isKindOfClass:[NSAttributedString class]]) {
        return [[NSAttributedString alloc] initWithString:(_textLayout.text.string.length?_textLayout.text.string:@"")];
    } else
    {
        return [[NSAttributedString alloc] initWithString:@""];
    }
}

- (NSMutableAttributedString*) buildContentText
{
    NSString* output = @"请升级APP查看该消息!";
    NSMutableAttributedString* mAStr = [[NSMutableAttributedString alloc] initWithString:output];
    mAStr.yy_color = [UIColor whiteColor];
    return mAStr;
}

- (NSMutableAttributedString*) __buildToastText
{
    YYTextBorder* boarder = [YYTextBorder borderWithFillColor:[UIColor flatWhiteColorDark] cornerRadius:4];
    boarder.insets = UIEdgeInsetsMake(-2, -2, -3, -2);
    NSMutableAttributedString* mAStr = [self buildContentText];
    mAStr.yy_font = _toastContentFont;
    mAStr.yy_textBackgroundBorder = boarder;
    return mAStr;
}

- (BOOL) showNickLabel
{
    return NO;
}
- (void) prepareLayouts:(CGFloat *)cellHeight
{
    [super prepareLayouts:cellHeight];
    CGRect contentRect =  [UIScreen mainScreen].bounds;
    contentRect = CGRectCenter(contentRect, _estimateContentRect.size);
    contentRect.origin.y = _estimateContentRect.origin.y;
    NSMutableAttributedString* str = [self __buildToastText];

    YYTextLayout* layout = [YYTextLayout layoutWithContainerSize:contentRect.size text:str];
    CGSize size  = layout.textBoundingSize;
    _textLayout = layout;
    size.height += 4;
    size.width += 4;
    *cellHeight += size.height;

    CGRect restRect;
    CGRectDivide(contentRect, &_toastRect, &restRect, size.height, CGRectMinYEdge);
    _avatarRect = CGRectZero;
    _bubbleRect = CGRectZero;
}

- (void) layoutCell:(YHToastMessageCell *)cell
{
    [super layoutCell:cell];
    cell.textContentLabel.frame = _toastRect;
}

- (void) willBeginHandleResponser:(YHToastMessageCell*)cell
{
    [super willBeginHandleResponser:cell];
    cell.textContentLabel.textLayout = _textLayout;
    cell.textContentLabel.textAlignment = NSTextAlignmentCenter;
}

- (void) didBeginHandleResponser:(YHToastMessageCell *)cell
{
    [super didBeginHandleResponser:cell];
}

- (void) willRegsinHandleResponser:(YHToastMessageCell *)cell
{
    [super willRegsinHandleResponser:cell];
}

- (void) didRegsinHandleResponser:(YHToastMessageCell *)cell
{
    [super didRegsinHandleResponser:cell];
}
@end


text:
var center = require('center');
var nav = require('nav');
var fs = require('fs');
var insertCss = require('insert-css');

var css = fs.readFileSync(__dirname + '/start-menu.css');
insertCss(css);

module.exports = function (items) {
    var div = document.createElement('div');
    div.setAttribute('class', 'start-menu');
    document.body.appendChild(center(div));

    items = items || [
        {name: 'Start', href: '/start'}
    ];
    nav('.start-menu', items);
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Darluca arcuata Ellis & Everh.

### Remarks
null


text:
"use strict";

var _ = require('underscorem')

var schema = require('./../../shared/schema')

function stub(){}

function timestampsType(rel){
	return {type: 'map', key: {type: 'primitive', primitive: 'int'}, value: {type: 'primitive', primitive: 'long'}}
}

schema.addFunction('timestamps', {
	schemaType: timestampsType,
	minParams: 1,
	maxParams: 1,
	callSyntax: 'timestamps(versions)',
	computeSync: function(z, versions){
		var result = {}
		if(versions === undefined){
			return result
		}
		versions.forEach(function(v){
			var ts = z.objectState.getVersionTimestamp(v)
			result[v] = ts
		})
		return result
	}
})


text:
package com.rondhuit.w2v;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.rondhuit.w2v.Word2vec.VocabWordComparator;

public abstract class Corpus {

  protected Config config;
  protected int trainWords = 0;
  protected int vocabSize;
  protected int vocabMaxSize = 1000;
  protected VocabWord[] vocab;
  protected Map<String, Integer> vocabIndexMap;
  protected boolean eoc = true;    // end of corpus

  public Corpus(Config config) throws IOException {
    this.config = config;
  }

  public Corpus(Corpus cloneSrc) throws IOException {
    trainWords = cloneSrc.trainWords;
    vocabSize = cloneSrc.vocabSize;
    vocab = cloneSrc.vocab;
    vocabIndexMap = cloneSrc.vocabIndexMap;
  }

  public boolean endOfCorpus(){
    return eoc;
  }

  public void learnVocab()  throws IOException {
    vocab = new VocabWord[vocabMaxSize];
    vocabIndexMap = new HashMap<String, Integer>();
    vocabSize = 0;
  }

  /**
   * Adds a word to the vocabulary
   * @param word
   * @return
   */
  protected int addWordToVocab(String word){
    vocab[vocabSize] = new VocabWord(word);
    vocabSize++;

    // Reallocate memory if needed
    if(vocabSize + 2 >= vocabMaxSize){
      vocabMaxSize += 1000;
      VocabWord[] temp = new VocabWord[vocabMaxSize];
      System.arraycopy(vocab, 0, temp, 0, vocabSize);
      vocab = temp;
    }
    vocabIndexMap.put(word, vocabSize - 1);
    return vocabSize - 1;
  }

  public int getTrainWords(){
    return trainWords;
  }

  public int getVocabSize(){
    return vocabSize;
  }

  public VocabWord[] getVocab(){
    return vocab;
  }

  public Map<String, Integer> getVocabIndexMap(){
    return vocabIndexMap;
  }

  /**
   *
   */
  public void rewind(int numThreads, int id) throws IOException {
    eoc = false;
  }

  /**
   *
   * @return -3 if end of sentence, -2 if end of corpus, -1 if word not found or index value of the word
   * @throws IOException
   */
  public int readWordIndex() throws IOException {
    String word = nextWord();
    if(word == null){
      if(eoc) return -2;    // end of corpus
      else return -3;       // end of sentence
    }
    else{
      return searchVocab(word);     // index value of the word
    }
  }

  /**
   * Read the next word from the corpus
   * @return next word that is read from the corpus. null will be returned
   * @throws IOException
   */
  public abstract String nextWord() throws IOException;

  /**
   * Close the corpus and it cannot be read any more.
   */
  public void close() throws IOException{
    // do nothing in default
  }

  public void shutdown() throws IOException {
    // do nothing in default
  }

  /**
   * Returns position of a word in the vocabulary; if the word is not found, returns -1
   * @param word
   * @return
   */
  int searchVocab(String word){
    Integer pos = vocabIndexMap.get(word);
    return pos == null ? -1 : pos.intValue();
  }

  /**
   * Sorts the vocabulary by frequency using word counts
   */
  void sortVocab(){
    List<VocabWord> list = new ArrayList<VocabWord>(vocabSize);
    for(int i = 0; i < vocabSize; i++){
      list.add(vocab[i]);
    }
    Collections.sort(list, new VocabWordComparator());

    // re-build vocabIndexMap
    vocabIndexMap.clear();
    final int size = vocabSize;
    trainWords = 0;
    for(int i = 0; i < size; i++){
      // Words occuring less than min_count times will be discarded from the vocab
      if(list.get(i).cn < config.getMinCount()){
        vocabSize--;
      }
      else{
        // Hash will be re-computed, as after the sorting it is not actual
        setVocabIndexMap(list.get(i), i);
      }
    }

    vocab = new VocabWord[vocabSize];
    for(int i = 0; i < vocabSize; i++){
      vocab[i] = new VocabWord(list.get(i).word);
      vocab[i].cn = list.get(i).cn;
    }
  }

  void setVocabIndexMap(VocabWord src, int pos){
    vocabIndexMap.put(src.word, pos);
    trainWords += src.cn;
  }

  /**
   * Create binary Huffman tree using the word counts.
   * Frequent words will have short uniqe binary codes
   */
  void createBinaryTree() {
    int[] point = new int[VocabWord.MAX_CODE_LENGTH];
    char[] code = new char[VocabWord.MAX_CODE_LENGTH];
    int[] count = new int[vocabSize * 2 + 1];
    char[] binary = new char[vocabSize * 2 + 1];
    int[] parentNode = new int[vocabSize * 2 + 1];

    for(int i = 0; i < vocabSize; i++)
      count[i] = vocab[i].cn;
    for(int i = vocabSize; i < vocabSize * 2; i++)
      count[i] = Integer.MAX_VALUE;
    int pos1 = vocabSize - 1;
    int pos2 = vocabSize;
    // Following algorithm constructs the Huffman tree by adding one node at a time
    int min1i, min2i;
    for(int i = 0; i < vocabSize - 1; i++) {
      // First, find two smallest nodes 'min1, min2'
      if (pos1 >= 0) {
        if (count[pos1] < count[pos2]) {
          min1i = pos1;
          pos1--;
        } else {
          min1i = pos2;
          pos2++;
        }
      } else {
        min1i = pos2;
        pos2++;
      }
      if (pos1 >= 0) {
        if (count[pos1] < count[pos2]) {
          min2i = pos1;
          pos1--;
        } else {
          min2i = pos2;
          pos2++;
        }
      } else {
        min2i = pos2;
        pos2++;
      }
      count[vocabSize + i] = count[min1i] + count[min2i];
      parentNode[min1i] = vocabSize + i;
      parentNode[min2i] = vocabSize + i;
      binary[min2i] = 1;
    }
    // Now assign binary code to each vocabulary word
    for(int j = 0; j < vocabSize; j++){
      int k = j;
      int i = 0;
      while (true) {
        code[i] = binary[k];
        point[i] = k;
        i++;
        k = parentNode[k];
        if(k == vocabSize * 2 - 2) break;
      }
      vocab[j].codelen = i;
      vocab[j].point[0] = vocabSize - 2;
      for(k = 0; k < i; k++) {
        vocab[j].code[i - k - 1] = code[k];
        vocab[j].point[i - k] = point[k] - vocabSize;
      }
    }
  }
}


text:
<?php
namespace SimpleSAML\Utils;

/**
 * A class for cryptography-related functions
 *
 * @package SimpleSAMLphp
 */
class Crypto
{

    /**
     * Decrypt data using AES-256-CBC and the key provided as a parameter.
     *
     * @param string $ciphertext The IV and the encrypted data, concatenated.
     * @param string $secret The secret to use to decrypt the data.
     *
     * @return string The decrypted data.
     * @htorws \InvalidArgumentException If $ciphertext is not a string.
     * @throws \SimpleSAML_Error_Exception If the openssl module is not loaded.
     *
     * @see \SimpleSAML\Utils\Crypto::aesDecrypt()
     */
    private static function _aesDecrypt($ciphertext, $secret)
    {
        if (!is_string($ciphertext)) {
            throw new \InvalidArgumentException('Input parameter "$ciphertext" must be a string.');
        }
        if (!function_exists("openssl_decrypt")) {
            throw new \SimpleSAML_Error_Exception("The openssl PHP module is not loaded.");
        }

        $raw    = defined('OPENSSL_RAW_DATA') ? OPENSSL_RAW_DATA : true;
        $key    = openssl_digest($secret, 'sha256');
        $method = 'AES-256-CBC';
        $ivSize = 16;
        $iv     = substr($ciphertext, 0, $ivSize);
        $data   = substr($ciphertext, $ivSize);

        return openssl_decrypt($data, $method, $key, $raw, $iv);
    }

    /**
     * Decrypt data using AES-256-CBC and the system-wide secret salt as key.
     *
     * @param string $ciphertext The IV used and the encrypted data, concatenated.
     *
     * @return string The decrypted data.
     * @htorws \InvalidArgumentException If $ciphertext is not a string.
     * @throws \SimpleSAML_Error_Exception If the openssl module is not loaded.
     *
     * @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
     * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no>
     */
    public static function aesDecrypt($ciphertext)
    {
        return self::_aesDecrypt($ciphertext, Config::getSecretSalt());
    }

    /**
     * Encrypt data using AES-256-CBC and the key provided as a parameter.
     *
     * @param string $data The data to encrypt.
     * @param string $secret The secret to use to encrypt the data.
     *
     * @return string The IV and encrypted data concatenated.
     * @throws \InvalidArgumentException If $data is not a string.
     * @throws \SimpleSAML_Error_Exception If the openssl module is not loaded.
     *
     * @see \SimpleSAML\Utils\Crypto::aesEncrypt()
     */
    private static function _aesEncrypt($data, $secret)
    {
        if (!is_string($data)) {
            throw new \InvalidArgumentException('Input parameter "$data" must be a string.');
        }

        if (!function_exists("openssl_encrypt")) {
            throw new \SimpleSAML_Error_Exception('The openssl PHP module is not loaded.');
        }

        $raw    = defined('OPENSSL_RAW_DATA') ? OPENSSL_RAW_DATA : true;
        $key    = openssl_digest($secret, 'sha256');
        $method = 'AES-256-CBC';
        $ivSize = 16;
        $iv     = substr($key, 0, $ivSize);

        return $iv.openssl_encrypt($data, $method, $key, $raw, $iv);
    }

    /**
     * Encrypt data using AES-256-CBC and the system-wide secret salt as key.
     *
     * @param string $data The data to encrypt.
     *
     * @return string The IV and encrypted data concatenated.
     * @throws \InvalidArgumentException If $data is not a string.
     * @throws \SimpleSAML_Error_Exception If the openssl module is not loaded.
     *
     * @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
     * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no>
     */
    public static function aesEncrypt($data)
    {
        return self::_aesEncrypt($data, Config::getSecretSalt());
    }

    /**
     * Load a private key from metadata.
     *
     * This function loads a private key from a metadata array. It looks for the following elements:
     * - 'privatekey': Name of a private key file in the cert-directory.
     * - 'privatekey_pass': Password for the private key.
     *
     * It returns and array with the following elements:
     * - 'PEM': Data for the private key, in PEM-format.
     * - 'password': Password for the private key.
     *
     * @param \SimpleSAML_Configuration $metadata The metadata array the private key should be loaded from.
     * @param bool                      $required Whether the private key is required. If this is true, a
     * missing key will cause an exception. Defaults to false.
     * @param string                    $prefix The prefix which should be used when reading from the metadata
     * array. Defaults to ''.
     *
     * @return array|NULL Extracted private key, or NULL if no private key is present.
     * @throws \InvalidArgumentException If $required is not boolean or $prefix is not a string.
     * @throws \SimpleSAML_Error_Exception If no private key is found in the metadata, or it was not possible to load
     *     it.
     *
     * @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
     * @author Olav Morken, UNINETT AS <olav.morken@uninett.no>
     */
    public static function loadPrivateKey(\SimpleSAML_Configuration $metadata, $required = false, $prefix = '')
    {
        if (!is_bool($required) || !is_string($prefix)) {
            throw new \InvalidArgumentException('Invalid input parameters.');
        }

        $file = $metadata->getString($prefix.'privatekey', null);
        if ($file === null) {
            // no private key found
            if ($required) {
                throw new \SimpleSAML_Error_Exception('No private key found in metadata.');
            } else {
                return null;
            }
        }

        $file = Config::getCertPath($file);
        $data = @file_get_contents($file);
        if ($data === false) {
            throw new \SimpleSAML_Error_Exception('Unable to load private key from file "'.$file.'"');
        }

        $ret = array(
            'PEM' => $data,
        );

        if ($metadata->hasValue($prefix.'privatekey_pass')) {
            $ret['password'] = $metadata->getString($prefix.'privatekey_pass');
        }

        return $ret;
    }

    /**
     * Get public key or certificate from metadata.
     *
     * This function implements a function to retrieve the public key or certificate from a metadata array.
     *
     * It will search for the following elements in the metadata:
     * - 'certData': The certificate as a base64-encoded string.
     * - 'certificate': A file with a certificate or public key in PEM-format.
     * - 'certFingerprint': The fingerprint of the certificate. Can be a single fingerprint, or an array of multiple
     * valid fingerprints.
     *
     * This function will return an array with these elements:
     * - 'PEM': The public key/certificate in PEM-encoding.
     * - 'certData': The certificate data, base64 encoded, on a single line. (Only present if this is a certificate.)
     * - 'certFingerprint': Array of valid certificate fingerprints. (Only present if this is a certificate.)
     *
     * @param \SimpleSAML_Configuration $metadata The metadata.
     * @param bool                      $required Whether the private key is required. If this is TRUE, a missing key
     *     will cause an exception. Default is FALSE.
     * @param string                    $prefix The prefix which should be used when reading from the metadata array.
     *     Defaults to ''.
     *
     * @return array|NULL Public key or certificate data, or NULL if no public key or certificate was found.
     * @throws \InvalidArgumentException If $metadata is not an instance of \SimpleSAML_Configuration, $required is not
     *     boolean or $prefix is not a string.
     * @throws \SimpleSAML_Error_Exception If no private key is found in the metadata, or it was not possible to load
     *     it.
     *
     * @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
     * @author Olav Morken, UNINETT AS <olav.morken@uninett.no>
     * @author Lasse Birnbaum Jensen
     */
    public static function loadPublicKey(\SimpleSAML_Configuration $metadata, $required = false, $prefix = '')
    {
        if (!is_bool($required) || !is_string($prefix)) {
            throw new \InvalidArgumentException('Invalid input parameters.');
        }

        $keys = $metadata->getPublicKeys(null, false, $prefix);
        if ($keys !== null) {
            foreach ($keys as $key) {
                if ($key['type'] !== 'X509Certificate') {
                    continue;
                }
                if ($key['signing'] !== true) {
                    continue;
                }
                $certData = $key['X509Certificate'];
                $pem = "-----BEGIN CERTIFICATE-----\n".
                    chunk_split($certData, 64).
                    "-----END CERTIFICATE-----\n";
                $certFingerprint = strtolower(sha1(base64_decode($certData)));

                return array(
                    'certData'        => $certData,
                    'PEM'             => $pem,
                    'certFingerprint' => array($certFingerprint),
                );
            }
            // no valid key found
        } elseif ($metadata->hasValue($prefix.'certFingerprint')) {
            // we only have a fingerprint available
            $fps = $metadata->getArrayizeString($prefix.'certFingerprint');

            // normalize fingerprint(s) - lowercase and no colons
            foreach ($fps as &$fp) {
                assert('is_string($fp)');
                $fp = strtolower(str_replace(':', '', $fp));
            }

            // We can't build a full certificate from a fingerprint, and may as well return an array with only the
            //fingerprint(s) immediately.
            return array('certFingerprint' => $fps);
        }

        // no public key/certificate available
        if ($required) {
            throw new \SimpleSAML_Error_Exception('No public key / certificate found in metadata.');
        } else {
            return null;
        }
    }

    /**
     * This function hashes a password with a given algorithm.
     *
     * @param string $password The password to hash.
     * @param string $algorithm The hashing algorithm, uppercase, optionally prepended with 'S' (salted). See
     *     hash_algos() for a complete list of hashing algorithms.
     * @param string $salt An optional salt to use.
     *
     * @return string The hashed password.
     * @throws \InvalidArgumentException If the input parameters are not strings.
     * @throws \SimpleSAML_Error_Exception If the algorithm specified is not supported.
     *
     * @see hash_algos()
     *
     * @author Dyonisius Visser, TERENA <visser@terena.org>
     * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no>
     */
    public static function pwHash($password, $algorithm, $salt = null)
    {
        if (!is_string($algorithm) || !is_string($password)) {
            throw new \InvalidArgumentException('Invalid input parameters.');
        }

        // hash w/o salt
        if (in_array(strtolower($algorithm), hash_algos())) {
            $alg_str = '{'.str_replace('SHA1', 'SHA', $algorithm).'}'; // LDAP compatibility
            $hash = hash(strtolower($algorithm), $password, true);
            return $alg_str.base64_encode($hash);
        }

        // hash w/ salt
        if ($salt === null) { // no salt provided, generate one
            // default 8 byte salt, but 4 byte for LDAP SHA1 hashes
            $bytes = ($algorithm == 'SSHA1') ? 4 : 8;
            $salt = openssl_random_pseudo_bytes($bytes);
        }

        if ($algorithm[0] == 'S' && in_array(substr(strtolower($algorithm), 1), hash_algos())) {
            $alg = substr(strtolower($algorithm), 1); // 'sha256' etc
            $alg_str = '{'.str_replace('SSHA1', 'SSHA', $algorithm).'}'; // LDAP compatibility
            $hash = hash($alg, $password.$salt, true);
            return $alg_str.base64_encode($hash.$salt);
        }

        throw new \SimpleSAML_Error_Exception('Hashing algorithm \''.strtolower($algorithm).'\' is not supported');
    }

    /**
     * This function checks if a password is valid
     *
     * @param string $hash The password as it appears in password file, optionally prepended with algorithm.
     * @param string $password The password to check in clear.
     *
     * @return boolean True if the hash corresponds with the given password, false otherwise.
     * @throws \InvalidArgumentException If the input parameters are not strings.
     * @throws \SimpleSAML_Error_Exception If the algorithm specified is not supported.
     *
     * @author Dyonisius Visser, TERENA <visser@terena.org>
     */
    public static function pwValid($hash, $password)
    {
        if (!is_string($hash) || !is_string($password)) {
            throw new \InvalidArgumentException('Invalid input parameters.');
        }

        // match algorithm string (e.g. '{SSHA256}', '{MD5}')
        if (preg_match('/^{(.*?)}(.*)$/', $hash, $matches)) {

            // LDAP compatibility
            $alg = preg_replace('/^(S?SHA)$/', '${1}1', $matches[1]);

            // hash w/o salt
            if (in_array(strtolower($alg), hash_algos())) {
                return $hash === self::pwHash($password, $alg);
            }

            // hash w/ salt
            if ($alg[0] === 'S' && in_array(substr(strtolower($alg), 1), hash_algos())) {
                $php_alg = substr(strtolower($alg), 1);

                // get hash length of this algorithm to learn how long the salt is
                $hash_length = strlen(hash($php_alg, '', true));
                $salt = substr(base64_decode($matches[2]), $hash_length);
                return ($hash === self::pwHash($password, $alg, $salt));
            }
        } else {
            return $hash === $password;
        }

        throw new \SimpleSAML_Error_Exception('Hashing algorithm \''.strtolower($alg).'\' is not supported');
    }
}


text:
On a birthday cake we often use one candle for each year of age.

But since each candle can be either lit or not lit, we could use them to show a binary representation of your age.
For example, 14 years old is 1110 in binary, so you could represent it with four candles.

{image file-path="img/topics/col_binary_cake.png" alignment="right" alt="An image of a birthday cake with three out of four candles lit."}

Persuade people to start using binary candles on their birthday cake.

- What are the advantages of using binary candles?
- Why do binary candles get better when you get older?
- Are there any disadvantages of using binary candles and how would you overcome them?

(By the way, the traditional system is called unary, or base one. Each candle is worth one times as much as the previous one!)


text:
lua -luatrace test.lua
luatrace.profile


text:
grant &korreksjon_select_role to &korreksjon_sysadm_role;

-- user login grants
grant resource to &korreksjon_sysadm_user ;
grant resource to &korreksjon_select_user ;
grant resource to &korreksjon_app_user ;

-- user role grants
grant &korreksjon_select_role to &korreksjon_select_user;
grant &korreksjon_sysadm_role to &korreksjon_sysadm_user;
grant &korreksjon_app_role to &korreksjon_app_user;

-- table  grants

grant select on schema_version to &korreksjon_select_role;
grant select on schema_version_info to &korreksjon_select_role;
grant select on persistent_property to &korreksjon_select_role;

grant select on status_message to &korreksjon_select_role;
grant select on status to &korreksjon_select_role;
grant select on status_history to &korreksjon_select_role;
grant select on qos_data to &korreksjon_select_role;

grant select on fil to &korreksjon_select_role;
grant select on filcontent to &korreksjon_select_role;

grant select on korreksjon to &korreksjon_select_role;
grant select on korr_tilstander to &korreksjon_select_role;

grant select on work_queue to &korreksjon_select_role;
grant select on work_queue_group to &korreksjon_select_role;
grant select on work_item to &korreksjon_select_role;
grant select on work_item to &korreksjon_select_role;
grant select on menuelement_id_sequence to anvisning_application_role;
grant select on menu_element to anvisning_application_role;

grant select on managed_jobs to &korreksjon_select_role;

grant select, insert on SCHEMA_VERSION to KORREKSJON_APPLICATION_ROLE;
grant select, insert on SCHEMA_VERSION_INFO to KORREKSJON_APPLICATION_ROLE;
grant select, update, insert on PERSISTENT_PROPERTY to KORREKSJON_APPLICATION_ROLE;
grant select, insert on PERSISTENT_PROP_ENDRINGSLOGG to KORREKSJON_APPLICATION_ROLE;
grant select, update, insert on KORREKSJON to KORREKSJON_APPLICATION_ROLE;

grant select, update, insert on MANAGED_JOBS to KORREKSJON_APPLICATION_ROLE;
;

grant insert, update, delete on SCHEMA_VERSION to korreksjon_sysadm_role;
grant insert, update, delete on SCHEMA_VERSION_INFO to korreksjon_sysadm_role;

grant insert, update, delete on PERSISTENT_PROPERTY to korreksjon_sysadm_role;
grant insert, update on PERSISTENT_PROP_ENDRINGSLOGG to korreksjon_sysadm_role;

grant insert, update, delete on WORK_QUEUE_GROUP to korreksjon_sysadm_role;
grant insert, update, delete on WORK_QUEUE to korreksjon_sysadm_role;
grant insert, update, delete on WORK_ITEM to korreksjon_sysadm_role;

grant select, update, insert on MANAGED_JOBS to korreksjon_sysadm_role;
-- sequence grants

grant select, alter on KORREKSJON_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on KORREKSJON_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on HILO_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on HIBERNATE_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on WORK_ITEM_ID_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on WORK_QUEUE_ID_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on WORK_QUEUE_GROUP_ID_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on NIBEUTVEKSLING_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on BESTILLING_NUMMER_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select on BESTILLING_NUMMER_SEQUENCE to KORREKSJON_READONLY_ROLE;

grant select on menuelement_id_sequence to KORREKSJON_APPLICATION_ROLE;
grant select on menuelement_id_sequence to &korreksjon_select_role;
grant select, alter on menuelement_id_sequence to &korreksjon_sysadm_role;

--------- UT AV BOKSEN FOR BRUKER --------------

grant select, insert on SCHEMA_VERSION to KORREKSJON_APPLICATION_ROLE;
grant select, insert on SCHEMA_VERSION_INFO to KORREKSJON_APPLICATION_ROLE;
grant select, update, insert on PERSISTENT_PROPERTY to KORREKSJON_APPLICATION_ROLE;
grant select, update, insert on KORREKSJON to KORREKSJON_APPLICATION_ROLE;
grant select, update, insert on KORR_TILSTANDER to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on SCHEMA_VERSION to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on SCHEMA_VERSION_INFO to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on PERSISTENT_PROPERTY to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on WORK_QUEUE_GROUP to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on WORK_QUEUE to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on WORK_ITEM to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on FIL to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on FILCONTENT to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on QOS_DATA to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on STATUS to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on STATUS_HISTORY to KORREKSJON_APPLICATION_ROLE;
grant select, insert, update on STATUS_MESSAGE to KORREKSJON_APPLICATION_ROLE;

-- sequence grants --

grant select, alter on KORREKSJON_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on KORREKSJON_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on HILO_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on HIBERNATE_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on WORK_ITEM_ID_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on WORK_QUEUE_ID_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on WORK_QUEUE_GROUP_ID_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on NIBEUTVEKSLING_SEQUENCE to KORREKSJON_APPLICATION_ROLE;
grant select, alter on BESTILLING_NUMMER_SEQUENCE to KORREKSJON_APPLICATION_ROLE;


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>100Yuan!</title>

  <link href="style/main.css" rel="stylesheet" type="text/css">
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="apple-touch-icon" href="meta/apple-touch-icon.png">
  <meta name="apple-mobile-web-app-capable" content="yes">

  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0, maximum-scale=1, user-scalable=no, minimal-ui">

100 Yuan!

0

0

Join the bills and get to the 100 Yuan!

少年,努力把这些零钱合成 100元的毛爷爷吧!

	        O(∩_∩)O -->
          Try again

      How to play: Use your arrow keys to move the tiles. When they add up to the next face value, they merge into one!

      玩法: 用 方向键 移动方块. 当拼出下一个面值时 , 就会 合成新的钞票!

    Note: 本人看到2048后突发奇想,闲暇时间所做,博诸君一乐。

    这是本网页的网址http://seastarmanager.github.io/100RMB/

    (仅供娱乐,请勿查水表)

    Created by Seastar. Based on 2048 by  Gabriele Cirulli.

分享到QQ空间新浪微博人人网微信飞信0


text:
package org.cc.dexlib2.immutable;

import com.google.common.collect.ImmutableList;
import org.cc.dexlib2.iface.ExceptionHandler;
import org.cc.dexlib2.iface.MethodImplementation;
import org.cc.dexlib2.iface.TryBlock;
import org.cc.dexlib2.iface.debug.DebugItem;
import org.cc.dexlib2.iface.instruction.Instruction;
import org.cc.dexlib2.immutable.debug.ImmutableDebugItem;
import org.cc.dexlib2.immutable.instruction.ImmutableInstruction;
import org.cc.util.ImmutableUtils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class ImmutableMethodImplementation implements MethodImplementation {
    protected final int registerCount;
    @Nonnull protected final ImmutableList<? extends ImmutableInstruction> instructions;
    @Nonnull protected final ImmutableList<? extends ImmutableTryBlock> tryBlocks;
    @Nonnull protected final ImmutableList<? extends ImmutableDebugItem> debugItems;

    public ImmutableMethodImplementation(int registerCount,
                                         @Nullable Iterable<? extends Instruction> instructions,
                                         @Nullable List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks,
                                         @Nullable Iterable<? extends DebugItem> debugItems) {
        this.registerCount = registerCount;
        this.instructions = ImmutableInstruction.immutableListOf(instructions);
        this.tryBlocks = ImmutableTryBlock.immutableListOf(tryBlocks);
        this.debugItems = ImmutableDebugItem.immutableListOf(debugItems);
    }

    public ImmutableMethodImplementation(int registerCount,
                                         @Nullable ImmutableList<? extends ImmutableInstruction> instructions,
                                         @Nullable ImmutableList<? extends ImmutableTryBlock> tryBlocks,
                                         @Nullable ImmutableList<? extends ImmutableDebugItem> debugItems) {
        this.registerCount = registerCount;
        this.instructions = ImmutableUtils.nullToEmptyList(instructions);
        this.tryBlocks = ImmutableUtils.nullToEmptyList(tryBlocks);
        this.debugItems = ImmutableUtils.nullToEmptyList(debugItems);
    }

    @Nullable
    public static ImmutableMethodImplementation of(@Nullable MethodImplementation methodImplementation) {
        if (methodImplementation == null) {
            return null;
        }
        if (methodImplementation instanceof ImmutableMethodImplementation) {
            return (ImmutableMethodImplementation)methodImplementation;
        }
        return new ImmutableMethodImplementation(
                methodImplementation.getRegisterCount(),
                methodImplementation.getInstructions(),
                methodImplementation.getTryBlocks(),
                methodImplementation.getDebugItems());
    }

    @Override public int getRegisterCount() { return registerCount; }
    @Nonnull @Override public ImmutableList<? extends ImmutableInstruction> getInstructions() { return instructions; }
    @Nonnull @Override public ImmutableList<? extends ImmutableTryBlock> getTryBlocks() { return tryBlocks; }
    @Nonnull @Override public ImmutableList<? extends ImmutableDebugItem> getDebugItems() { return debugItems; }
}


text:
<link rel="import" href="../polymer/polymer.html">

<link rel="import" href="../iron-ajax/iron-ajax.html">
<link rel="import" href="../iron-pages/iron-pages.html">
<link rel="import" href="../iron-icons/iron-icons.html">

<link rel="import" href="../paper-styles/color.html">

<link rel="import" href="../paper-material/paper-material.html">
<link rel="import" href="../paper-dialog/paper-dialog.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">

<link rel="import" href="../paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-listbox/paper-listbox.html">

<link rel="import" href="../paper-tabs/paper-tabs.html">

<link rel="import" href="../strolch-wc-styles/strolch-wc-styles.html">
<link rel="import" href="../strolch-wc-debounced-input/strolch-wc-debounced-input.html">

<link rel="import" href="strolch-wc-inspector-behavior.html">
<link rel="import" href="strolch-wc-inspector-paging-behavior.html">

<dom-module id="strolch-wc-users">

    <template>

                <paper-icon-button class="g-pull-right"
                                   icon="refresh"
                                   title="Refresh"
                                   on-tap="reload"></paper-icon-button>
                <paper-button class="g-pull-right" on-tap="_addUser" raised>Add</paper-button>
                <strolch-wc-debounced-input id="debouncedInput"
                                            class="g-pull-right"
                                            debounced-input="{{searchTerm}}"
                                            disabled="[[arrayFilled(filters)]]"></strolch-wc-debounced-input>

        <paper-material elevation="1" class="g-ml-3 g-mr-3">

Username / Name

State

Locale

Roles

History

                <template is="dom-repeat" items="[[dataObj.data]]">

[[item.username]]

[[_getName(item)]]

[[item.userState]]

[[item.locale]]

[[arrayToString(item.roles)]]

                            FirstLogin: [[toLocalDateTime(item.history.firstLogin)]]
 LastLogin:
                            [[toLocalDateTime(item.history.lastLogin)]]
 PasswordChange:
                            [[toLocalDateTime(item.history.lastPasswordChange)]]

                            <paper-icon-button icon="create" title="Edit" on-tap="_editUser"></paper-icon-button>
                            <paper-icon-button icon="lock-outline"
                                               title="Set password"
                                               on-tap="_openPwDlg"></paper-icon-button>
                            <paper-icon-button icon="delete" title="Remove" on-tap="_removeUser"></paper-icon-button>

                </template>

                        <paper-icon-button icon="first-page" on-tap="_toFirstPage"></paper-icon-button>
                        <paper-icon-button icon="chevron-left" on-tap="_toPreviousPage"></paper-icon-button>
                        [[dataObj.offset]] to [[_getEnd(dataObj)]] of [[dataObj.size]] ([[dataObj.dataSetSize]])
                        <paper-icon-button icon="chevron-right" on-tap="_toNextPage"></paper-icon-button>
                        <paper-icon-button icon="last-page" on-tap="_toLastPage"></paper-icon-button>

                    <paper-button on-tap="_setLimit">10</paper-button>
                    <paper-button on-tap="_setLimit">50</paper-button>
                    <paper-button on-tap="_setLimit">100</paper-button>

        </paper-material>

        <paper-dialog id="dlg" modal>

[[dlgTitle]]

[[dlgText]]

                <paper-button dialog-confirm autofocus>Close</paper-button>

        </paper-dialog>

        <paper-dialog id="pwDlg" modal>

Set Password for [[user.username]]

            <paper-input label="Password" value="{{password0}}" type="password"></paper-input>
            <paper-input label="Repeat" value="{{password1}}" type="password"></paper-input>

                <paper-button on-tap="_requireChange">Require Change</paper-button>
                <paper-button on-tap="_clearPassword">Clear</paper-button>
                <paper-button dialog-confirm autofocus>Close</paper-button>
                <paper-button on-tap="_setPassword" autofocus>Save</paper-button>

        </paper-dialog>

        <paper-dialog id="userDlg" modal>

                <template is="dom-if" if="[[isEmptyString(user.userId)]]">New User</template>
                <template is="dom-if" if="[[isNotEmptyString(user.userId)]]">Edit User</template>

                    <paper-input label="UserId" value="{{user.userId}}" readonly></paper-input>
                    <paper-input label="Username"
                                 value="{{user.username}}"
                                 readonly="[[isNotEmptyString(user.userId)]]"></paper-input>

                    <paper-input label="Firstname" value="{{user.firstname}}"></paper-input>
                    <paper-input label="Lastname" value="{{user.lastname}}"></paper-input>

                    <paper-dropdown-menu always-float-label label="Locale" class="custom">
                        <paper-listbox label="Locale"
                                       attr-for-selected="value"
                                       class="dropdown-content"
                                       selected="{{user.locale}}">
                            <paper-item value="en">English</paper-item>
                            <paper-item value="de">German</paper-item>
                            <paper-item value="fr">French</paper-item>
                        </paper-listbox>
                    </paper-dropdown-menu>

                    <paper-dropdown-menu always-float-label label="State" class="custom">
                        <paper-listbox attr-for-selected="value" class="dropdown-content" selected="{{user.userState}}">

                            <paper-item value="NEW">NEW</paper-item>
                            <paper-item value="EXPIRED">EXPIRED</paper-item>
                            <paper-item value="ENABLED">ENABLED</paper-item>
                            <paper-item value="DISABLED">DISABLED</paper-item>
                            <paper-item value="SYSTEM">SYSTEM</paper-item>

                        </paper-listbox>
                    </paper-dropdown-menu>

                    Roles:
                    <paper-listbox always-float-label
                                   label="Roles"
                                   class="dropdown-content"
                                   multi
                                   attr-for-selected="value"
                                   selected-values="{{selectedRoles}}">
                        <template is="dom-repeat" items="[[roles]]">
                            <paper-item value="[[item.position]]">[[item.name]]</paper-item>
                        </template>
                    </paper-listbox>

                    Properties:
                    <template is="dom-repeat" items="[[user.properties]]" as="property">

                                <paper-input value="{{property.key}}"></paper-input>

                                <paper-input value="{{property.value}}"></paper-input>

                                <paper-icon-button icon="clear"
                                                   title="Remove"
                                                   on-tap="_removeProperty"></paper-icon-button>

                    </template>

                    <paper-button class="g-pull-right" on-tap="_addEmptyProperty">Add</paper-button>

                <paper-button dialog-confirm autofocus>Close</paper-button>
                <paper-button on-tap="_addOrUpdateUser" autofocus>Save</paper-button>

        </paper-dialog>

        <iron-ajax id="ajax"
                   content-type="application/json"
                   handle-as="json"
                   on-response="_handleAjaxResponse"
                   on-error="onAjaxError"></iron-ajax>

    </template>

</dom-module>


text:
package com.dmmikkel.brisk.core.template.thymeleaf;

public class SiteContext
        extends org.thymeleaf.context.Context
{
    private String siteKey;

    public String getSiteKey()
    {
        return siteKey;
    }

    public void setSiteKey(String siteKey)
    {
        this.siteKey = siteKey;
    }
}


text:
require 'test_helper'

class ClientTitlesControllerTest < ActionController::TestCase
  setup do
    @client_title = client_titles(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:client_titles)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create client_title" do
    assert_difference('ClientTitle.count') do
      post :create, client_title: { client_id: @client_title.client_id, title_id: @client_title.title_id }
    end

    assert_redirected_to client_title_path(assigns(:client_title))
  end

  test "should show client_title" do
    get :show, id: @client_title
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @client_title
    assert_response :success
  end

  test "should update client_title" do
    put :update, id: @client_title, client_title: { client_id: @client_title.client_id, title_id: @client_title.title_id }
    assert_redirected_to client_title_path(assigns(:client_title))
  end

  test "should destroy client_title" do
    assert_difference('ClientTitle.count', -1) do
      delete :destroy, id: @client_title
    end

    assert_redirected_to client_titles_path
  end
end


text:
/* Game Over State */

Santa.GameOverState = function(game){

};

Santa.GameOverState.prototype = {

	create: function(){
		console.log("game over")

		var GO = new Phaser.Sprite(this.game, 90, 100, 'gameover');
		GO.fixedToCamera = true;
		this.add.existing(GO);
	},

	update: function(){
		if( this.game.keys.ENTER.isDown ){
			//this.game.state.start('MainMenu');
			window.location = "";
		}
	}
};


text:
using System.IO;
using Umbraco.Core.Models;

namespace Umbraco.Core.Persistence.Repositories
{
    public interface IScriptRepository : IReadRepository<string, Script>, IWriteRepository<Script>
    {
        bool ValidateScript(Script script);
        Stream GetFileContentStream(string filepath);
        void SetFileContent(string filepath, Stream content);
        long GetFileSize(string filepath);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.kaixinbook"
    android:versionCode="2"
    android:versionName="2.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="16" />
    <!-- 创建快捷方式权限 -->
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <!-- <uses-permission android:name="android.permission.CALL_PHONE" /> -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <!-- Vpon所需权限 -->
    <uses-permission android:name="android.permission.CAMERA" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="false" />

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name" >
        <activity
            android:name=".BookListActivity"
            android:configChanges="keyboardHidden|orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Read"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name=".InActivity"
            android:screenOrientation="portrait" >
        </activity>
    </application>

</manifest>


text:
 0" >

 0"
			 >

				{{gInfo.header|int2ip}}

						ftp://{{file.host|int2ip}}{{file.path}}

							{{file.name}}

					{{file.size|fileSize}}

 0)">
		Nie znaleziono plików


text:
<?php

$loader = require(__DIR__.'/../vendor/autoload.php');
$loader->add('AspectMock', __DIR__ . '/../src');
$loader->add('demo', __DIR__ . '/_data');
$loader->register();

$kernel = \AspectMock\Kernel::getInstance();
$kernel->init([
    'debug' => true,
    'cacheDir' => __DIR__.'/_data/cache',
    'includePaths' => [__DIR__.'/_data/demo'],
    'interceptFunctions' => true
]);


text:
require File.join(File.dirname(__FILE__), "..", "helpers.rb")

require "sensu/server/process"

describe "Sensu::Server::Handle" do
  include Helpers

  before do
    @server = Sensu::Server::Process.new(options)
    settings = Sensu::Settings.get(options)
    @handlers = settings[:handlers]
    @event_data = Sensu::JSON.dump(event_template)
    @extensions = Sensu::Extensions.get(options)
  end

  it "can handle an event handler error" do
    on_error = @server.handler_error(@handlers[:file], @event_data)
    expect(on_error.arity).to be(1)
  end

  it "can handle an event with a pipe handler" do
    async_wrapper do
      @server.handle_event(@handlers[:file], @event_data)
      timer(1) do
        async_done
      end
    end
    expect(File.exists?("/tmp/sensu_event")).to be(true)
    File.delete("/tmp/sensu_event")
  end

  it "can handle an event with a tcp handler" do
    async_wrapper do
      EM::start_server("127.0.0.1", 1234, Helpers::TestServer) do |server|
        server.expected = @event_data
      end
      @server.handle_event(@handlers[:tcp], @event_data)
    end
  end

  it "can handle an event with a udp handler" do
    async_wrapper do
      EM::open_datagram_socket("127.0.0.1", 1234, Helpers::TestServer) do |server|
        server.expected = @event_data
      end
      @server.handle_event(@handlers[:udp], @event_data)
    end
  end

  it "can handle an event with a transport handler" do
    async_wrapper do
      transport.subscribe(:direct, "events") do |_, payload|
        expect(Sensu::JSON.load(payload)).to eq(Sensu::JSON.load(@event_data))
        async_done
      end
      timer(0.5) do
        @server.setup_transport do
          @server.handle_event(@handlers[:transport], @event_data)
        end
      end
    end
  end

  it "can handle an event with an extension" do
    async_wrapper do
      @server.handle_event(@extensions[:handlers]["debug"], @event_data)
      timer(0.5) do
        async_done
      end
    end
  end
end


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import FieldLabel from './FieldLabel';
import demoFragment from './FieldLabel.demoFragment';

class FieldLabelContainer extends Component {
  static propTypes = {
    component: PropTypes.func.isRequired,
    componentProps: PropTypes.object.isRequired
  };
  render() {
    const { component: DemoComponent, componentProps } = this.props;

    return (
      <div style={{ width: '300px' }}>
        <DemoComponent {...componentProps} />
      </div>
    );
  }
}

export default {
  route: '/field-label',
  title: 'Field Label',
  category: 'Form',
  component: FieldLabel,
  container: FieldLabelContainer,
  initialProps: {
    id: 'id-label',
    label: 'Field Label'
  },
  options: demoFragment
};


text:
'use strict';

var controller = require('../controllers');
var helpers = require('../helpers');

module.exports = function(app, express) {
	// ROUTE FOR RESETTING DB WITH DEMO DATA
	app.get('/api/resetDBWithData', function(req, res){
		controller.user.reset();
		res.send('success');
	});

	// ROUTE FOR DISPLAYING DASHBOARD
	app.get('/api/users/:user_id/clients', function(req,res){
		controller.dashboard.get(req,res);
	});

	// ROUTE FOR CREATING A NEW CLIENT
	app.post('/api/users/:user_id/clients', function(req,res){
		 controller.user.post(req,res);
	});

	// ROUTE FOR DISPLAYING PARTICULAR CLIENT
	app.get('/api/users/:user_id/clients/:client_id', function(req,res){
		controller.client.get(req,res);
	});

  // ROUTE FOR UPDATING A CLIENT
	app.put('/api/users/:user_id/clients/:client_id', controller.client.put);

	// ROUTE FOR GETTING FEED FOR A PARTICULAR CLIENT
	app.get('/api/users/:user_id/clients/:client_id/feed', function(req,res){
		controller.feed.getOneClient(req,res);
	})
};


text:
// COPYRIGHT:     University of California, San Francisco, 2014,
//                All Rights reserved
//
// LICENSE:       This file is distributed under the "Lesser GPL" (LGPL) license.
//                License text is included with the source distribution.
//
//                This file is distributed in the hope that it will be useful,
//                but WITHOUT ANY WARRANTY; without even the implied warranty
//                of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
//                IN NO EVENT SHALL THE COPYRIGHT OWNER OR
//                CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//                INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// AUTHOR:        Mark Tsuchida

#pragma once

#include <cstddef>

namespace mm
{
namespace logging
{
namespace internal
{

enum PacketState
{
   PacketStateEntryFirstLine,
   PacketStateNewLine,
   PacketStateLineContinuation,
};

/**
 * Packet data structure for asynchronous logging
 *
 * This is a fixed-size data structure so that we can minimize the frequency of
 * memory allocation by the logger. Log packets serve as input to log sinks,
 * and are the elements of the queue used to send content to the asynchronous
 * backend.
 */
template <class TMetadata>
class GenericLinePacket
{
public:
   // A reasonable size to break lines into (the vast majority of entry lines
   // fit in this size in practice), allowing for a fixed-size buffer to be
   // used.
   static const std::size_t PacketTextLen = 127;

private:
   PacketState state_;
   TMetadata metadata_;
   char text_[PacketTextLen + 1];

public:
   GenericLinePacket(PacketState packetState,
         typename TMetadata::LoggerDataType loggerData,
         typename TMetadata::EntryDataType entryData,
         typename TMetadata::StampDataType stampData) :
      state_(packetState),
      metadata_(loggerData, entryData, stampData)
   { text_[0] = '\0'; }

   // For C-style access
   char* GetTextBuffer() { return text_; }

   PacketState GetPacketState() const { return state_; }
   const TMetadata& GetMetadataConstRef() const { return metadata_; }
   const char* GetText() const { return text_; }
};

} // namespace internal
} // namespace logging
} // namespace mm