text:
class FSKTransmitter {
public:
  FSKTransmitter();

  void enable();
  void disable();
  void transmit(const uint8_t *buffer, uint16_t length);
  void tick();

  void mark();
  void space();

  void test(byte idx);

  bool isBusy();

private:
  IOPin<GPIOC, 1>   pinTXMod;
  IOPin<GPIOC, 2>   pinTXEnable;

  const uint8_t * txBuffer;
  uint16_t  txLength;
  uint8_t   bitIndex;
  uint8_t   txShift;
  bool      autoShutdown;
  bool      active;

  void shiftNew();
};


text:
// Copyright: 2010 - 2016 https://github.com/ensime/ensime-server/graphs
// Licence: http://www.gnu.org/licenses/gpl-3.0.en.html
package org.ensime.indexer.lucene

import java.io._

import akka.event.slf4j.SLF4JLogging
import org.apache.lucene.analysis._
import org.apache.lucene.analysis.core._
import org.apache.lucene.analysis.miscellaneous._
import org.apache.lucene.document._
import org.apache.lucene.index._
import org.apache.lucene.search._
import org.apache.lucene.store.FSDirectory
import org.apache.lucene.util._

import scala.collection.JavaConverters._
import scala.collection.mutable

object SimpleLucene {
  private val LuceneVersion = Version.LUCENE_47
}

/**
 * Lightweight convenience wrapper over Lucene that does some sanity
 * checking, sets up per-field `Analyzer`s and gives access to
 * CRUD-like operations. Callers are expected to perform their own
 * marshalling and unmarshalling for Lucene's `Query` and `Document`
 * types.
 *
 * This class is thread safe. Only one instance is allowed **on the
 * operating system** (not just the JVM) for the same path. Lucene
 * manages a file lock to mitigate the risk of this happening.
 *
 * Technical note: Lucene is an excellent INDEX store, but is not
 * a database. Prefer using the DatabaseProvider where possible
 * and only fall back to using the index when SQL doesn't cut it.
 * Excellent examples of using an index are for creating multiple
 * representations of the same column, or for allowing allow/deny
 * filtering rules based on tags.
 */
class SimpleLucene(path: File, analyzers: Map[String, Analyzer]) extends SLF4JLogging {
  import org.ensime.indexer.lucene.SimpleLucene._

  path.mkdirs()

  // http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html
  private val directory = FSDirectory.open(path)

  // our fallback analyzer
  class LowercaseAnalyzer extends Analyzer {
    override protected def createComponents(fieldName: String, reader: Reader) = {
      val source = new KeywordTokenizer(reader)
      val filtered = new LowerCaseFilter(SimpleLucene.LuceneVersion, source)
      new Analyzer.TokenStreamComponents(source, filtered)
    }
  }
  private val analyzer = new PerFieldAnalyzerWrapper(
    new LowercaseAnalyzer,
    analyzers.asJava
  )
  private val config = new IndexWriterConfig(LuceneVersion, analyzer)
  //  config.setRAMBufferSizeMB(512)

  private val writer = new IndexWriter(directory, config)
  writer.commit() // puts a new directory into a valid state

  // nature of the beast is that this becomes stale
  private var lastReader = DirectoryReader.open(directory)
  private def reader() = {
    // non-atomic, but worth it to avoid blocking
    val latest = DirectoryReader.openIfChanged(lastReader)
    if (latest == null) lastReader
    else {
      lastReader = latest
      latest
    }
  }

  def search(query: Query, limit: Int): List[Document] = {
    val searcher = new IndexSearcher(reader())

    // TODO: use FieldCacheTermsFilter for fast restriction by module

    val collector = TopScoreDocCollector.create(limit, true)
    searcher.search(query, collector)

    val results = mutable.ListBuffer.empty[Document]
    for (hit <- collector.topDocs().scoreDocs.take(limit)) {
      val result = searcher.doc(hit.doc)
      results += result
      if (log.isTraceEnabled) {
        val explanation = searcher.explain(query, hit.doc)
        log.trace("" + result + " scored " + explanation)
      }
    }

    assert(results.size <= limit)

    results.toList
  }

  /**
   * Lucene does not offer an out-of-the-box UPDATE, so we have to
   * manually DELETE then CREATE, which is problematic because Lucene
   * DELETE can be extremely slow (plus this is not atomic).
   *
   * It is a **lot** more efficient to do this in batch: expect
   * 10,000 deletes to take about 1 second and inserts about 100ms.
   * Each call to this method constitutes a batch UPDATE operation.
   */
  def update(delete: Seq[Query], create: Seq[Document], commit: Boolean = true): Unit = this.synchronized {
    // Lucene 4.7.2 concurrency bugs: best to synchronise writes
    // https://issues.apache.org/jira/browse/LUCENE-5923

    if (delete.nonEmpty) {
      writer.deleteDocuments(delete.toArray: _*)
      if (commit) writer.commit()
    }

    if (create.nonEmpty) {
      create foreach { doc =>
        writer addDocument doc
      }
      if (commit) writer.commit()
    }
  }

  def create(docs: Seq[Document], commit: Boolean = true): Unit = update(Nil, docs, commit)
  def delete(queries: Seq[Query], commit: Boolean = true): Unit = update(queries, Nil, commit)

  // for manual committing after multiple insertions
  def commit(): Unit = writer.commit()

}

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace Gt\Database\Query;

use Gt\Database\Connection\DefaultSettings;
use Gt\Database\Connection\Driver;
use Gt\Database\Test\GtDatabaseTestCase;
use Gt\Database\Test\Helper\Helper;
use PHPUnit\Framework\TestCase;

class QueryFactoryTest extends TestCase {
	/**
	 * @dataProvider \Gt\Database\Test\Helper\Helper::queryPathExistsProvider
	 */
	public function testFindQueryFilePathExists(
		string $queryName,
		string $directoryOfQueries
	) {
		$queryFactory = new QueryFactory(
			$directoryOfQueries,
			new Driver(new DefaultSettings())
		);
		$queryFilePath = $queryFactory->findQueryFilePath($queryName);
		static::assertFileExists($queryFilePath);
	}

	/** @dataProvider \Gt\Database\Test\Helper\Helper::queryPathNotExistsProvider */
	public function testFindQueryFilePathNotExists(
		string $queryName,
		string $directoryOfQueries
	) {
		$queryFactory = new QueryFactory(
			$directoryOfQueries,
			new Driver(new DefaultSettings())
		);

		self::expectException(QueryNotFoundException::class);
		$queryFactory->findQueryFilePath($queryName);
	}

	/** @dataProvider \Gt\Database\Test\Helper\Helper::queryPathExtensionNotValidProvider */
	public function testFindQueryFilePathWithInvalidExtension(
		string $queryName,
		string $directoryOfQueries
	) {
		$queryFactory = new QueryFactory(
			$directoryOfQueries,
			new Driver(new DefaultSettings())
		);

		self::expectException(QueryFileExtensionException::class);
		$queryFactory->findQueryFilePath($queryName);
	}

	/** @dataProvider \Gt\Database\Test\Helper\Helper::queryPathExistsProvider */
	public function testQueryCreated(
		string $queryName,
		string $directoryOfQueries
	) {
		$queryFactory = new QueryFactory(
			$directoryOfQueries,
			new Driver(new DefaultSettings())
		);
		$query = $queryFactory->create($queryName);
		static::assertInstanceOf(Query::class, $query);
	}

	public function testSelectsCorrectFile() {
		$queryCollectionData = Helper::queryCollectionPathExistsProvider();
		$queryCollectionPath = $queryCollectionData[0][1];

		$queryFactory = new QueryFactory(
			$queryCollectionPath,
			new Driver(new DefaultSettings())
		);

		$queryNames = [
			uniqid("q1-"),
			uniqid("q2-"),
			uniqid("q3-"),
			uniqid("q4-")
		];
		$queryFileList = [];
		foreach($queryNames as $queryName) {
			$queryPath = $queryCollectionPath . "/$queryName.sql";
			touch($queryPath);

			$query = $queryFactory->create($queryName);
			static::assertNotContains($query->getFilePath(), $queryFileList);
			$queryFileList[$queryName] = $query->getFilePath();
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="colorPrimary">#00bcd4</color>
    <color name="colorPrimaryDark">#0097a7</color>
    <color name="colorAccent">#ffb300</color>

</resources>


text:
//
//  LCStatusFrameModel.m
//  LCMogoWeiboDemo
//
//  Created by 李策 on 16/4/25.
//  Copyright © 2016年 李策. All rights reserved.
//

#import "LCStatusFrameModel.h"
#import "LCPhotosView.h"
/**
 *  头像高宽
 */
NSUInteger const iconWidth = 40;
/**
 *  间距
 */
NSUInteger const BigMargin = 5;
/**
 *  昵称距离头像上边的高度
 */
NSUInteger const SmallMargin = 3;
/**
 *  左右间距
 */
NSUInteger const MaxMargin = 10;
@implementation LCStatusFrameModel
- (void)setStatusModel:(LCStatusesModel *)statusModel{
    _statusModel = statusModel;
    //头像
    CGFloat iconX = MaxMargin;
    CGFloat iconY = 0;
    self.iconViewF = CGRectMake(iconX, iconY, iconWidth, iconWidth);
   //昵称
    CGSize nameSize = [statusModel.userMessage.name sizeWithFont:kMidTextFont];
    CGFloat nameH = nameSize.height;
    CGFloat nameW = nameSize.width;
    CGFloat nameX = CGRectGetMaxX(self.iconViewF) + BigMargin;
    CGFloat nameY = SmallMargin;
    self.nameLabelF = CGRectMake(nameX, nameY, nameW, nameH);
    //vip图片
    if ([statusModel.userMessage isVip]) {
        self.vipViewF = CGRectMake(CGRectGetMaxX(self.nameLabelF), nameY, nameH, nameH);
    }

    /**时间*/
    NSDictionary *dictTime = @{NSFontAttributeName:kSmallTextFont};
    CGSize timeSize = [statusModel.created_at sizeWithAttributes:dictTime];
    CGFloat timeX = nameX;
    CGFloat timeY = CGRectGetMaxY(self.iconViewF) - timeSize.height - SmallMargin;

    self.timeLabelF = CGRectMake(timeX, timeY, timeSize.width, timeSize.height);

    /**来源*/
    CGFloat sourceX = CGRectGetMaxX(self.timeLabelF) + BigMargin;
    CGFloat sourceY = timeY;

    CGSize sourceSize = [statusModel.source sizeWithAttributes:dictTime];

    self.sourceLabelF = CGRectMake(sourceX, sourceY, sourceSize.width, sourceSize.height);

    /**正文*/
    CGFloat textX = iconX;
    CGFloat textY = MAX(CGRectGetMaxY(self.iconViewF), CGRectGetMaxY(self.timeLabelF)) + BigMargin;
    /**
     *  需要正则表达式
     */
//【晚安】借时光之手,暖一束花开。借一方晴空,拥抱阳光。亲爱的,晚安
//    CGSize textSize = [statusModel.textString sizeWithFont:kMidTextFont maxW:SCREEN_WIDTH - 20];
    CGSize textSize = [statusModel.attributedText boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 20, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
    self.contentLabelF = CGRectMake(textX, textY, textSize.width, textSize.height);
    /**微博图片*/
    CGFloat originalH = 0;
    if (statusModel.pic_urls.count) {
//#warning 计算原创微博配图Size

        CGSize picSize = [LCPhotosView photosViewSizeWithCount:(int)statusModel.pic_urls.count];

        CGFloat picX = iconX;
        CGFloat picY = CGRectGetMaxY(self.contentLabelF) + BigMargin;
        CGFloat picW = picSize.width;
        CGFloat picH = picSize.height;
        self.photoViewF = CGRectMake(picX, picY, picW, picH);
        originalH = CGRectGetMaxY(self.photoViewF) + BigMargin;
    }else{
        originalH = CGRectGetMaxY(self.contentLabelF) + BigMargin;
    }

    self.originalViewF = CGRectMake(0, MaxMargin + kBorderCellLineThickness, SCREEN_WIDTH - 2 * MaxMargin, originalH);
    CGFloat toolBarY = 0;
    if (statusModel.retweeted_status) {
        /**转发微博正文*/

        CGFloat retweetTextLabelX = iconX;
        CGFloat retweetTextLabelY = MaxMargin;
//        NSString *contentText = [NSString stringWithFormat:@"%@ : %@",statusModel.retweeted_status.userMessage.name , statusModel.retweeted_status.textString];
//        CGSize retTextSize = [contentText sizeWithFont:kMidTextFont maxW:SCREEN_WIDTH - 20];

        CGSize retTextSize = [statusModel.retweeted_attributedText boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 20, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;

        self.retweetTextLabelF = CGRectMake(retweetTextLabelX, retweetTextLabelY, retTextSize.width, retTextSize.height);
        /**转发配图*/
        CGFloat retweetViewH = 0;
        if (statusModel.retweeted_status.pic_urls.count) {

//#warning 计算转发微博配图Size
            CGSize retPicSize = [LCPhotosView photosViewSizeWithCount:(int)statusModel.retweeted_status.pic_urls.count];

            CGFloat retPicX = iconX;
            CGFloat retPicY = CGRectGetMaxY(self.retweetTextLabelF) + MaxMargin;
            CGFloat retPicW = retPicSize.width;
            CGFloat retPicH = retPicSize.height;
            self.retweetPhotosViewF = CGRectMake(retPicX, retPicY, retPicW, retPicH);
            retweetViewH = CGRectGetMaxY(self.retweetPhotosViewF) + MaxMargin;
        }else{
            retweetViewH = CGRectGetMaxY(self.retweetTextLabelF) + MaxMargin;
        }
        /**转发微博整体*/
        CGFloat retweetViewX = 0;
        CGFloat retweetViewY = CGRectGetMaxY(self.originalViewF);
        CGFloat retweetViewW =[UIScreen mainScreen].bounds.size.width;
        self.retweetViewF = CGRectMake(retweetViewX, retweetViewY, retweetViewW, retweetViewH);
        /**toolBarY的高度*/
        toolBarY = CGRectGetMaxY(self.retweetViewF);
    }else{
        /**toolBarY的高度*/
        toolBarY = CGRectGetMaxY(self.originalViewF);
    }

    CGFloat toolBarX = 0;
    CGFloat toolBarW = [UIScreen mainScreen].bounds.size.width;
    CGFloat toolBarH = 35;
    self.toolBarF = CGRectMake(toolBarX, toolBarY, toolBarW, toolBarH);

    /**cell高度*/
    self.cellHeight = CGRectGetMaxY(self.toolBarF);
}
@end


text:
require_relative "spec_helper"

def app
  ApplicationController
end

describe ApplicationController do
  it "responds with a welcome message" do
    get '/'
    expect(last_response.status).to eq(200)
    expect(last_response.body).to include("Sinatra Fave Reads")
  end
end


text:
id: optimizing-performance
title: Optimizing Performance
permalink: docs/optimizing-performance.html
redirect_from: "docs/advanced-performance.html"
---

Internally, React uses several clever techniques to minimize the number of costly DOM operations required to update the UI. For many applications, using React will lead to a fast user interface without doing much work to specifically optimize for performance. Nevertheless, there are several ways you can speed up your React application.

## Use the Production Build

If you're benchmarking or experiencing performance problems in your React apps, make sure you're testing with the minified production build.

By default, React includes many helpful warnings. These warnings are very useful in development. However, they make React larger and slower so you should make sure to use the production version when you deploy the app.

If you aren't sure whether your build process is set up correctly, you can check it by installing [React Developer Tools for Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi). If you visit a site with React in production mode, the icon will have a dark background:

If you visit a site with React in development mode, the icon will have a red background:

It is expected that you use the development mode when working on your app, and the production mode when deploying your app to the users.

You can find instructions for building your app for production below.

### Create React App

If your project is built with [Create React App](https://github.com/facebookincubator/create-react-app), run:

```
npm run build
```

This will create a production build of your app in the `build/` folder of your project.

Remember that this is only necessary before deploying to production. For normal development, use `npm start`.

### Single-File Builds

We offer production-ready versions of React and React DOM as single files:

```html
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
```

Remember that only React files ending with `.production.min.js` are suitable for production.

### Brunch

For the most efficient Brunch production build, install the [`uglify-js-brunch`](https://github.com/brunch/uglify-js-brunch) plugin:

```
# If you use npm
npm install --save-dev uglify-js-brunch

# If you use Yarn
yarn add --dev uglify-js-brunch
```

Then, to create a production build, add the `-p` flag to the `build` command:

```
brunch build -p
```

Remember that you only need to do this for production builds. You shouldn't pass `-p` flag or apply this plugin in development because it will hide useful React warnings, and make the builds much slower.

### Browserify

For the most efficient Browserify production build, install a few plugins:

```
# If you use npm
npm install --save-dev envify uglify-js uglifyify

# If you use Yarn
yarn add --dev envify uglify-js uglifyify
```

To create a production build, make sure that you add these transforms **(the order matters)**:

* The [`envify`](https://github.com/hughsk/envify) transform ensures the right build environment is set. Make it global (`-g`).
* The [`uglifyify`](https://github.com/hughsk/uglifyify) transform removes development imports. Make it global too (`-g`).
* Finally, the resulting bundle is piped to [`uglify-js`](https://github.com/mishoo/UglifyJS2) for mangling ([read why](https://github.com/hughsk/uglifyify#motivationusage)).

For example:

```
browserify ./index.js \
  -g [ envify --NODE_ENV production ] \
  -g uglifyify \
  | uglifyjs --compress --mangle > ./bundle.js
```

>**Note:**
>
>The package name is `uglify-js`, but the binary it provides is called `uglifyjs`.

>This is not a typo.

Remember that you only need to do this for production builds. You shouldn't apply these plugins in development because they will hide useful React warnings, and make the builds much slower.

### Rollup

For the most efficient Rollup production build, install a few plugins:

```
# If you use npm
npm install --save-dev rollup-plugin-commonjs rollup-plugin-replace rollup-plugin-uglify

# If you use Yarn
yarn add --dev rollup-plugin-commonjs rollup-plugin-replace rollup-plugin-uglify
```

To create a production build, make sure that you add these plugins **(the order matters)**:

* The [`replace`](https://github.com/rollup/rollup-plugin-replace) plugin ensures the right build environment is set.
* The [`commonjs`](https://github.com/rollup/rollup-plugin-commonjs) plugin provides support for CommonJS in Rollup.
* The [`uglify`](https://github.com/TrySound/rollup-plugin-uglify) plugin compresses and mangles the final bundle.

```js
plugins: [
  // ...
  require('rollup-plugin-replace')({
    'process.env.NODE_ENV': JSON.stringify('production')
  }),
  require('rollup-plugin-commonjs')(),
  require('rollup-plugin-uglify')(),
  // ...
]
```

For a complete setup example [see this gist](https://gist.github.com/Rich-Harris/cb14f4bc0670c47d00d191565be36bf0).

Remember that you only need to do this for production builds. You shouldn't apply the `uglify` plugin or the `replace` plugin with `'production'` value in development because they will hide useful React warnings, and make the builds much slower.

### webpack

>**Note:**
>
>If you're using Create React App, please follow [the instructions above](#create-react-app).

>This section is only relevant if you configure webpack directly.

For the most efficient webpack production build, make sure to include these plugins in your production configuration:

```js
new webpack.DefinePlugin({
  'process.env': {
    NODE_ENV: JSON.stringify('production')
  }
}),
new webpack.optimize.UglifyJsPlugin()
```

You can learn more about this in [webpack documentation](https://webpack.js.org/guides/production-build/).

Remember that you only need to do this for production builds. You shouldn't apply `UglifyJsPlugin` or `DefinePlugin` with `'production'` value in development because they will hide useful React warnings, and make the builds much slower.

## Profiling Components with the Chrome Performance Tab

In the **development** mode, you can visualize how components mount, update, and unmount, using the performance tools in supported browsers. For example:

To do this in Chrome:

1. Load your app with `?react_perf` in the query string (for example, `http://localhost:3000/?react_perf`).

2. Open the Chrome DevTools **[Performance](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/timeline-tool)** tab and press **Record**.

3. Perform the actions you want to profile. Don't record more than 20 seconds or Chrome might hang.

4. Stop recording.

5. React events will be grouped under the **User Timing** label.

Note that **the numbers are relative so components will render faster in production**. Still, this should help you realize when unrelated UI gets updated by mistake, and how deep and how often your UI updates occur.

Currently Chrome, Edge, and IE are the only browsers supporting this feature, but we use the standard [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API) so we expect more browsers to add support for it.

## Avoid Reconciliation

React builds and maintains an internal representation of the rendered UI. It includes the React elements you return from your components. This representation lets React avoid creating DOM nodes and accessing existing ones beyond necessity, as that can be slower than operations on JavaScript objects. Sometimes it is referred to as a "virtual DOM", but it works the same way on React Native.

When a component's props or state change, React decides whether an actual DOM update is necessary by comparing the newly returned element with the previously rendered one. When they are not equal, React will update the DOM.

In some cases, your component can speed all of this up by overriding the lifecycle function `shouldComponentUpdate`, which is triggered before the re-rendering process starts. The default implementation of this function returns `true`, leaving React to perform the update:

```javascript
shouldComponentUpdate(nextProps, nextState) {
  return true;
}
```

If you know that in some situations your component doesn't need to update, you can return `false` from `shouldComponentUpdate` instead, to skip the whole rendering process, including calling `render()` on this component and below.

## shouldComponentUpdate In Action

Here's a subtree of components. For each one, `SCU` indicates what `shouldComponentUpdate` returned, and `vDOMEq` indicates whether the rendered React elements were equivalent. Finally, the circle's color indicates whether the component had to be reconciled or not.

Since `shouldComponentUpdate` returned `false` for the subtree rooted at C2, React did not attempt to render C2, and thus didn't even have to invoke `shouldComponentUpdate` on C4 and C5.

For C1 and C3, `shouldComponentUpdate` returned `true`, so React had to go down to the leaves and check them. For C6 `shouldComponentUpdate` returned `true`, and since the rendered elements weren't equivalent React had to update the DOM.

The last interesting case is C8. React had to render this component, but since the React elements it returned were equal to the previously rendered ones, it didn't have to update the DOM.

Note that React only had to do DOM mutations for C6, which was inevitable. For C8, it bailed out by comparing the rendered React elements, and for C2's subtree and C7, it didn't even have to compare the elements as we bailed out on `shouldComponentUpdate`, and `render` was not called.

## Examples

If the only way your component ever changes is when the `props.color` or the `state.count` variable changes, you could have `shouldComponentUpdate` check that:

```javascript
class CounterButton extends React.Component {
  constructor(props) {
    super(props);
    this.state = {count: 1};
  }

  shouldComponentUpdate(nextProps, nextState) {
    if (this.props.color !== nextProps.color) {
      return true;
    }
    if (this.state.count !== nextState.count) {
      return true;
    }
    return false;
  }

  render() {
    return (
      <button
        color={this.props.color}
        onClick={() => this.setState(state => ({count: state.count + 1}))}>
        Count: {this.state.count}
      </button>
    );
  }
}
```

In this code, `shouldComponentUpdate` is just checking if there is any change in `props.color` or `state.count`. If those values don't change, the component doesn't update. If your component got more complex, you could use a similar pattern of doing a "shallow comparison" between all the fields of `props` and `state` to determine if the component should update. This pattern is common enough that React provides a helper to use this logic - just inherit from `React.PureComponent`. So this code is a simpler way to achieve the same thing:

```js
class CounterButton extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {count: 1};
  }

  render() {
    return (
      <button
        color={this.props.color}
        onClick={() => this.setState(state => ({count: state.count + 1}))}>
        Count: {this.state.count}
      </button>
    );
  }
}
```

Most of the time, you can use `React.PureComponent` instead of writing your own `shouldComponentUpdate`. It only does a shallow comparison, so you can't use it if the props or state may have been mutated in a way that a shallow comparison would miss.

This can be a problem with more complex data structures. For example, let's say you want a `ListOfWords` component to render a comma-separated list of words, with a parent `WordAdder` component that lets you click a button to add a word to the list. This code does *not* work correctly:

```javascript
class ListOfWords extends React.PureComponent {
  render() {
    return <div>{this.props.words.join(',')}</div>;
  }
}

class WordAdder extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      words: ['marklar']
    };
    this.handleClick = this.handleClick.bind(this);
  }

  handleClick() {
    // This section is bad style and causes a bug
    const words = this.state.words;
    words.push('marklar');
    this.setState({words: words});
  }

  render() {
    return (
      <div>
        <button onClick={this.handleClick} />
        <ListOfWords words={this.state.words} />
      </div>
    );
  }
}
```

The problem is that `PureComponent` will do a simple comparison between the old and new values of `this.props.words`. Since this code mutates the `words` array in the `handleClick` method of `WordAdder`, the old and new values of `this.props.words` will compare as equal, even though the actual words in the array have changed. The `ListOfWords` will thus not update even though it has new words that should be rendered.

## The Power Of Not Mutating Data

The simplest way to avoid this problem is to avoid mutating values that you are using as props or state. For example, the `handleClick` method above could be rewritten using `concat` as:

```javascript
handleClick() {
  this.setState(prevState => ({
    words: prevState.words.concat(['marklar'])
  }));
}
```

ES6 supports a [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator) for arrays which can make this easier. If you're using Create React App, this syntax is available by default.

```js
handleClick() {
  this.setState(prevState => ({
    words: [...prevState.words, 'marklar'],
  }));
};
```

You can also rewrite code that mutates objects to avoid mutation, in a similar way. For example, let's say we have an object named `colormap` and we want to write a function that changes `colormap.right` to be `'blue'`. We could write:

```js
function updateColorMap(colormap) {
  colormap.right = 'blue';
}
```

To write this without mutating the original object, we can use [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) method:

```js
function updateColorMap(colormap) {
  return Object.assign({}, colormap, {right: 'blue'});
}
```

`updateColorMap` now returns a new object, rather than mutating the old one. `Object.assign` is in ES6 and requires a polyfill.

There is a JavaScript proposal to add [object spread properties](https://github.com/sebmarkbage/ecmascript-rest-spread) to make it easier to update objects without mutation as well:

```js
function updateColorMap(colormap) {
  return {...colormap, right: 'blue'};
}
```

If you're using Create React App, both `Object.assign` and the object spread syntax are available by default.

## Using Immutable Data Structures

[Immutable.js](https://github.com/facebook/immutable-js) is another way to solve this problem. It provides immutable, persistent collections that work via structural sharing:

* *Immutable*: once created, a collection cannot be altered at another point in time.
* *Persistent*: new collections can be created from a previous collection and a mutation such as set. The original collection is still valid after the new collection is created.
* *Structural Sharing*: new collections are created using as much of the same structure as the original collection as possible, reducing copying to a minimum to improve performance.

Immutability makes tracking changes cheap. A change will always result in a new object so we only need to check if the reference to the object has changed. For example, in this regular JavaScript code:

```javascript
const x = { foo: 'bar' };
const y = x;
y.foo = 'baz';
x === y; // true
```

Although `y` was edited, since it's a reference to the same object as `x`, this comparison returns `true`. You can write similar code with immutable.js:

```javascript
const SomeRecord = Immutable.Record({ foo: null });
const x = new SomeRecord({ foo: 'bar' });
const y = x.set('foo', 'baz');
const z = x.set('foo', 'bar');
x === y; // false
x === z; // true
```

In this case, since a new reference is returned when mutating `x`, we can use a reference equality check `(x === y)` to verify that the new value stored in `y` is different than the original value stored in `x`.

Two other libraries that can help use immutable data are [seamless-immutable](https://github.com/rtfeldman/seamless-immutable) and [immutability-helper](https://github.com/kolodny/immutability-helper).

Immutable data structures provide you with a cheap way to track changes on objects, which is all we need to implement `shouldComponentUpdate`. This can often provide you with a nice performance boost.


text:
<iframe id="forum_embed"
  src="javascript:void(0)"
  scrolling="no"
  frameborder="0"
  width="900"
  height="700">
</iframe>
<script type="text/javascript">
  document.getElementById('forum_embed').src =
     'https://groups.google.com/forum/embed/?place=forum/example42-puppet-modules'
     + '&showsearch=true&showpopout=true&showtabs=false'
     + '&parenturl=' + encodeURIComponent(window.location.href);
</script>


text:
package org.jspare.jsdbc.model;

import java.util.Map;

import org.jspare.jsdbc.exception.JsdbcException;
import org.jspare.jsdbc.stereotype.Entity;
import org.jspare.jsdbc.stereotype.EntityUtils;

import lombok.Data;

/**
 * Instantiates a new query.
 */

/**
 * Instantiates a new query.
 */
@Data
public class Query {

	/** The filter. */
	private final Filter filter = new Filter();

	/** The domain. */
	private Domain domain;

	/**
	 * Of.
	 *
	 * @param clazz
	 *            the clazz
	 * @return the query
	 */
	public static Query of(Class<?> clazz) {

		return new Query().forEntity(clazz);
	}

	/**
	 * For domain.
	 *
	 * @param domain
	 *            the domain
	 * @param target
	 *            the target
	 * @return the query
	 */
	public Query forDomain(Domain domain, Class<?> target) {

		this.domain = domain.clazzDomain(target);
		return this;
	}

	/**
	 * For entity.
	 *
	 * @param clazz
	 *            the clazz
	 * @return the query
	 */
	public Query forEntity(Class<?> clazz) {

		if (EntityUtils.isEntityData(clazz)) {

			Entity entity = clazz.getAnnotation(Entity.class);
			this.domain = Domain.of(entity.domain()).clazzDomain(clazz);
		}
		return this;
	}

	/**
	 * For entity.
	 *
	 * @param data
	 *            the data
	 * @return the query
	 * @throws JsdbcException
	 *             the jsdbc exception
	 */
	public Query forEntity(Object data) throws JsdbcException {

		if (EntityUtils.isEntityData(data)) {
			Entity entity = data.getClass().getAnnotation(Entity.class);
			this.domain = Domain.of(entity.domain()).clazzDomain(data.getClass());
			return byKey(EntityUtils.findKeyByEntity(entity, data));
		}
		return this;
	}

	/**
	 * Where.
	 *
	 * @param condition
	 *            the condition
	 * @return the query
	 */
	public Query where(Condition condition) {
		this.filter.getConditions().add(condition);
		return this;
	}

	/**
	 * Where.
	 *
	 * @param parameters
	 *            the parameters
	 * @return the query
	 */
	public Query where(Map<String, String> parameters) {
		this.filter.getWhere().putAll(parameters);
		return this;
	}

	/**
	 * Where.
	 *
	 * @param key
	 *            the key
	 * @param value
	 *            the value
	 * @return the query
	 */
	public Query where(String key, String value) {
		this.filter.getWhere().put(key, value);
		return this;
	}

	/**
	 * Select.
	 *
	 * @param select
	 *            the select
	 * @return the query
	 */
	public Query select(String select) {
		this.filter.select(select);
		return this;
	}

	/**
	 * By key.
	 *
	 * @param key
	 *            the key
	 * @return the query
	 */
	public Query byKey(String key) {
		this.filter.byKey(key);
		return this;
	}
}


text:
( function () {

	class SSRrPass extends THREE.Pass {

		constructor( {
			renderer,
			scene,
			camera,
			width,
			height,
			selects,
			encoding,
			morphTargets = false
		} ) {

			super();
			this.width = width !== undefined ? width : 512;
			this.height = height !== undefined ? height : 512;
			this.clear = true;
			this.renderer = renderer;
			this.scene = scene;
			this.camera = camera;
			this.output = 0; // this.output = 1;

			this.ior = THREE.SSRrShader.uniforms.ior.value;
			this.maxDistance = THREE.SSRrShader.uniforms.maxDistance.value;
			this.surfDist = THREE.SSRrShader.uniforms.surfDist.value;
			this.encoding = encoding;
			this.tempColor = new THREE.Color();
			this.selects = selects;
			this._specular = THREE.SSRrShader.defines.SPECULAR;
			Object.defineProperty( this, 'specular', {
				get() {

					return this._specular;

				},

				set( val ) {

					if ( this._specular === val ) return;
					this._specular = val;
					this.ssrrMaterial.defines.SPECULAR = val;
					this.ssrrMaterial.needsUpdate = true;

				}

			} );
			this._fillHole = THREE.SSRrShader.defines.FILL_HOLE;
			Object.defineProperty( this, 'fillHole', {
				get() {

					return this._fillHole;

				},

				set( val ) {

					if ( this._fillHole === val ) return;
					this._fillHole = val;
					this.ssrrMaterial.defines.FILL_HOLE = val;
					this.ssrrMaterial.needsUpdate = true;

				}

			} );
			this._infiniteThick = THREE.SSRrShader.defines.INFINITE_THICK;
			Object.defineProperty( this, 'infiniteThick', {
				get() {

					return this._infiniteThick;

				},

				set( val ) {

					if ( this._infiniteThick === val ) return;
					this._infiniteThick = val;
					this.ssrrMaterial.defines.INFINITE_THICK = val;
					this.ssrrMaterial.needsUpdate = true;

				}

			} ); // beauty render target with depth buffer

			const depthTexture = new THREE.DepthTexture();
			depthTexture.type = THREE.UnsignedShortType;
			depthTexture.minFilter = THREE.NearestFilter;
			depthTexture.magFilter = THREE.NearestFilter;
			this.beautyRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, {
				minFilter: THREE.NearestFilter,
				magFilter: THREE.NearestFilter,
				format: THREE.RGBAFormat,
				depthTexture: depthTexture,
				depthBuffer: true
			} );
			this.specularRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, {
				// TODO: Can merge with refractiveRenderTarget?
				minFilter: THREE.NearestFilter,
				magFilter: THREE.NearestFilter,
				format: THREE.RGBAFormat
			} ); // normalSelects render target

			const depthTextureSelects = new THREE.DepthTexture();
			depthTextureSelects.type = THREE.UnsignedShortType;
			depthTextureSelects.minFilter = THREE.NearestFilter;
			depthTextureSelects.magFilter = THREE.NearestFilter;
			this.normalSelectsRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, {
				minFilter: THREE.NearestFilter,
				magFilter: THREE.NearestFilter,
				format: THREE.RGBAFormat,
				type: THREE.HalfFloatType,
				depthTexture: depthTextureSelects,
				depthBuffer: true
			} ); // refractive render target

			this.refractiveRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, {
				minFilter: THREE.NearestFilter,
				magFilter: THREE.NearestFilter,
				format: THREE.RGBAFormat
			} ); // ssrr render target

			this.ssrrRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, {
				minFilter: THREE.NearestFilter,
				magFilter: THREE.NearestFilter,
				format: THREE.RGBAFormat
			} ); // ssrr material

			if ( THREE.SSRrShader === undefined ) {

				console.error( 'THREE.SSRrPass: The pass relies on THREE.SSRrShader.' );

			}

			this.ssrrMaterial = new THREE.ShaderMaterial( {
				defines: Object.assign( {}, THREE.SSRrShader.defines, {
					MAX_STEP: Math.sqrt( this.width * this.width + this.height * this.height )
				} ),
				uniforms: THREE.UniformsUtils.clone( THREE.SSRrShader.uniforms ),
				vertexShader: THREE.SSRrShader.vertexShader,
				fragmentShader: THREE.SSRrShader.fragmentShader,
				blending: THREE.NoBlending
			} );
			this.ssrrMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture;
			this.ssrrMaterial.uniforms[ 'tSpecular' ].value = this.specularRenderTarget.texture;
			this.ssrrMaterial.uniforms[ 'tNormalSelects' ].value = this.normalSelectsRenderTarget.texture;
			this.ssrrMaterial.needsUpdate = true;
			this.ssrrMaterial.uniforms[ 'tRefractive' ].value = this.refractiveRenderTarget.texture;
			this.ssrrMaterial.uniforms[ 'tDepth' ].value = this.beautyRenderTarget.depthTexture;
			this.ssrrMaterial.uniforms[ 'tDepthSelects' ].value = this.normalSelectsRenderTarget.depthTexture;
			this.ssrrMaterial.uniforms[ 'cameraNear' ].value = this.camera.near;
			this.ssrrMaterial.uniforms[ 'cameraFar' ].value = this.camera.far;
			this.ssrrMaterial.uniforms[ 'resolution' ].value.set( this.width, this.height );
			this.ssrrMaterial.uniforms[ 'cameraProjectionMatrix' ].value.copy( this.camera.projectionMatrix );
			this.ssrrMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse ); // normal material

			this.normalMaterial = new THREE.MeshNormalMaterial( {
				morphTargets
			} );
			this.normalMaterial.blending = THREE.NoBlending; // refractiveOn material

			this.refractiveOnMaterial = new THREE.MeshBasicMaterial( {
				color: 'white'
			} ); // refractiveOff material

			this.refractiveOffMaterial = new THREE.MeshBasicMaterial( {
				color: 'black'
			} ); // specular material

			this.specularMaterial = new THREE.MeshStandardMaterial( {
				color: 'black',
				metalness: 0,
				roughness: .2
			} ); // material for rendering the depth

			this.depthRenderMaterial = new THREE.ShaderMaterial( {
				defines: Object.assign( {}, THREE.SSRrDepthShader.defines ),
				uniforms: THREE.UniformsUtils.clone( THREE.SSRrDepthShader.uniforms ),
				vertexShader: THREE.SSRrDepthShader.vertexShader,
				fragmentShader: THREE.SSRrDepthShader.fragmentShader,
				blending: THREE.NoBlending
			} );
			this.depthRenderMaterial.uniforms[ 'tDepth' ].value = this.beautyRenderTarget.depthTexture;
			this.depthRenderMaterial.uniforms[ 'cameraNear' ].value = this.camera.near;
			this.depthRenderMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; // material for rendering the content of a render target

			this.copyMaterial = new THREE.ShaderMaterial( {
				uniforms: THREE.UniformsUtils.clone( THREE.CopyShader.uniforms ),
				vertexShader: THREE.CopyShader.vertexShader,
				fragmentShader: THREE.CopyShader.fragmentShader,
				transparent: true,
				depthTest: false,
				depthWrite: false,
				blendSrc: THREE.SrcAlphaFactor,
				blendDst: THREE.OneMinusSrcAlphaFactor,
				blendEquation: THREE.AddEquation,
				blendSrcAlpha: THREE.SrcAlphaFactor,
				blendDstAlpha: THREE.OneMinusSrcAlphaFactor,
				blendEquationAlpha: THREE.AddEquation // premultipliedAlpha:true,

			} );
			this.fsQuad = new THREE.FullScreenQuad( null );
			this.originalClearColor = new THREE.Color();

		}

		dispose() {

			// dispose render targets
			this.beautyRenderTarget.dispose();
			this.specularRenderTarget.dispose();
			this.normalSelectsRenderTarget.dispose();
			this.refractiveRenderTarget.dispose();
			this.ssrrRenderTarget.dispose(); // dispose materials

			this.normalMaterial.dispose();
			this.refractiveOnMaterial.dispose();
			this.refractiveOffMaterial.dispose();
			this.copyMaterial.dispose();
			this.depthRenderMaterial.dispose(); // dipsose full screen quad

			this.fsQuad.dispose();

		}

		render( renderer, writeBuffer
			/*, readBuffer, deltaTime, maskActive */
		) {

			// render beauty and depth
			if ( this.encoding ) this.beautyRenderTarget.texture.encoding = this.encoding;
			renderer.setRenderTarget( this.beautyRenderTarget );
			renderer.clear();
			this.scene.children.forEach( child => {

				if ( this.selects.includes( child ) ) {

					child.visible = false;

				} else {

					child.visible = true;

				}

			} );
			renderer.render( this.scene, this.camera );
			renderer.setRenderTarget( this.specularRenderTarget );
			renderer.clear();
			this.scene.children.forEach( child => {

				if ( this.selects.includes( child ) ) {

					child.visible = true;
					child._SSRrPassBackupMaterial = child.material;
					child.material = this.specularMaterial;

				} else if ( ! child.isLight ) {

					child.visible = false;

				}

			} );
			renderer.render( this.scene, this.camera );
			this.scene.children.forEach( child => {

				if ( this.selects.includes( child ) ) {

					child.material = child._SSRrPassBackupMaterial;

				}

			} ); // render normalSelectss

			this.scene.children.forEach( child => {

				if ( this.selects.includes( child ) ) {

					child.visible = true;

				} else {

					child.visible = false;

				}

			} );
			this.renderOverride( renderer, this.normalMaterial, this.normalSelectsRenderTarget, 0, 0 );
			this.renderRefractive( renderer, this.refractiveOnMaterial, this.refractiveRenderTarget, 0, 0 ); // render SSRr

			this.ssrrMaterial.uniforms[ 'ior' ].value = this.ior;
			this.ssrrMaterial.uniforms[ 'maxDistance' ].value = this.maxDistance;
			this.ssrrMaterial.uniforms[ 'surfDist' ].value = this.surfDist;
			this.ssrrMaterial.uniforms[ 'tSpecular' ].value = this.specularRenderTarget.texture;
			this.renderPass( renderer, this.ssrrMaterial, this.ssrrRenderTarget ); // output result to screen

			switch ( this.output ) {

				case SSRrPass.OUTPUT.Default:
					this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture;
					this.copyMaterial.blending = THREE.NoBlending;
					this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer );
					this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.ssrrRenderTarget.texture;
					this.copyMaterial.blending = THREE.NormalBlending;
					this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				case SSRrPass.OUTPUT.SSRr:
					this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.ssrrRenderTarget.texture;
					this.copyMaterial.blending = THREE.NoBlending;
					this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				case SSRrPass.OUTPUT.Beauty:
					this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture;
					this.copyMaterial.blending = THREE.NoBlending;
					this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				case SSRrPass.OUTPUT.Depth:
					this.depthRenderMaterial.uniforms[ 'tDepth' ].value = this.beautyRenderTarget.depthTexture;
					this.renderPass( renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				case SSRrPass.OUTPUT.DepthSelects:
					this.depthRenderMaterial.uniforms[ 'tDepth' ].value = this.normalSelectsRenderTarget.depthTexture;
					this.renderPass( renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				case SSRrPass.OUTPUT.NormalSelects:
					this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.normalSelectsRenderTarget.texture;
					this.copyMaterial.blending = THREE.NoBlending;
					this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				case SSRrPass.OUTPUT.Refractive:
					this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.refractiveRenderTarget.texture;
					this.copyMaterial.blending = THREE.NoBlending;
					this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				case SSRrPass.OUTPUT.Specular:
					this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.specularRenderTarget.texture;
					this.copyMaterial.blending = THREE.NoBlending;
					this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer );
					break;

				default:
					console.warn( 'THREE.SSRrPass: Unknown output type.' );

			}

		}

		renderPass( renderer, passMaterial, renderTarget, clearColor, clearAlpha ) {

			// save original state
			this.originalClearColor.copy( renderer.getClearColor( this.tempColor ) );
			const originalClearAlpha = renderer.getClearAlpha( this.tempColor );
			const originalAutoClear = renderer.autoClear;
			renderer.setRenderTarget( renderTarget ); // setup pass state

			renderer.autoClear = false;

			if ( clearColor !== undefined && clearColor !== null ) {

				renderer.setClearColor( clearColor );
				renderer.setClearAlpha( clearAlpha || 0.0 );
				renderer.clear();

			}

			this.fsQuad.material = passMaterial;
			this.fsQuad.render( renderer ); // restore original state

			renderer.autoClear = originalAutoClear;
			renderer.setClearColor( this.originalClearColor );
			renderer.setClearAlpha( originalClearAlpha );

		}

		renderOverride( renderer, overrideMaterial, renderTarget, clearColor, clearAlpha ) {

			this.originalClearColor.copy( renderer.getClearColor( this.tempColor ) );
			const originalClearAlpha = renderer.getClearAlpha( this.tempColor );
			const originalAutoClear = renderer.autoClear;
			renderer.setRenderTarget( renderTarget );
			renderer.autoClear = false;
			clearColor = overrideMaterial.clearColor || clearColor;
			clearAlpha = overrideMaterial.clearAlpha || clearAlpha;

			if ( clearColor !== undefined && clearColor !== null ) {

				renderer.setClearColor( clearColor );
				renderer.setClearAlpha( clearAlpha || 0.0 );
				renderer.clear();

			}

			this.scene.overrideMaterial = overrideMaterial;
			renderer.render( this.scene, this.camera );
			this.scene.overrideMaterial = null; // restore original state

			renderer.autoClear = originalAutoClear;
			renderer.setClearColor( this.originalClearColor );
			renderer.setClearAlpha( originalClearAlpha );

		}

		renderRefractive( renderer, overrideMaterial, renderTarget, clearColor, clearAlpha ) {

			this.originalClearColor.copy( renderer.getClearColor( this.tempColor ) );
			const originalClearAlpha = renderer.getClearAlpha( this.tempColor );
			const originalAutoClear = renderer.autoClear;
			renderer.setRenderTarget( renderTarget );
			renderer.autoClear = false;
			clearColor = overrideMaterial.clearColor || clearColor;
			clearAlpha = overrideMaterial.clearAlpha || clearAlpha;

			if ( clearColor !== undefined && clearColor !== null ) {

				renderer.setClearColor( clearColor );
				renderer.setClearAlpha( clearAlpha || 0.0 );
				renderer.clear();

			}

			this.scene.children.forEach( child => {

				child.visible = true;

			} );
			this.scene.traverse( child => {

				child._SSRrPassBackupMaterial = child.material;

				if ( this.selects.includes( child ) ) {

					child.material = this.refractiveOnMaterial;

				} else {

					child.material = this.refractiveOffMaterial;

				}

			} );
			this.scene._SSRrPassBackupBackground = this.scene.background;
			this.scene.background = null;
			this.scene._SSRrPassBackupFog = this.scene.fog;
			this.scene.fog = null;
			renderer.render( this.scene, this.camera );
			this.scene.fog = this.scene._SSRrPassBackupFog;
			this.scene.background = this.scene._SSRrPassBackupBackground;
			this.scene.traverse( child => {

				child.material = child._SSRrPassBackupMaterial;

			} ); // restore original state

			renderer.autoClear = originalAutoClear;
			renderer.setClearColor( this.originalClearColor );
			renderer.setClearAlpha( originalClearAlpha );

		}

		setSize( width, height ) {

			this.width = width;
			this.height = height;
			this.ssrrMaterial.defines.MAX_STEP = Math.sqrt( width * width + height * height );
			this.ssrrMaterial.needsUpdate = true;
			this.beautyRenderTarget.setSize( width, height );
			this.specularRenderTarget.setSize( width, height );
			this.ssrrRenderTarget.setSize( width, height );
			this.normalSelectsRenderTarget.setSize( width, height );
			this.refractiveRenderTarget.setSize( width, height );
			this.ssrrMaterial.uniforms[ 'resolution' ].value.set( width, height );
			this.ssrrMaterial.uniforms[ 'cameraProjectionMatrix' ].value.copy( this.camera.projectionMatrix );
			this.ssrrMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse );

		}

	}

	SSRrPass.OUTPUT = {
		'Default': 0,
		'SSRr': 1,
		'Beauty': 3,
		'Depth': 4,
		'DepthSelects': 9,
		'NormalSelects': 5,
		'Refractive': 7,
		'Specular': 8
	};

	THREE.SSRrPass = SSRrPass;

} )();


text:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <FrameLayout
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@drawable/bck_base"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp" />

</android.support.v4.widget.DrawerLayout>


text:
package model

var StructTagKey = "model"

var Config Configuration

type Configuration struct {
	Debug bool
}

func (self *Configuration) Name() string {
	return "model"
}

func (self *Configuration) Init() error {
	return nil
}

func (self *Configuration) Close() error {
	return nil
}


text:
__attribute__((visibility("hidden")))
@interface GPUTraceBreakpointActionEditor : NSViewController
{
}

- (id)initWithAction:(id)arg1;

@end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>ECMAScript extensions compatibility table</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,600">
    <link rel="stylesheet" href="../master.css">

      ECMAScript

        567non-standard

      compatibility table

          by
          kangax
          &
          webbedspace

Please note that some of these tests represent existence,
        not functionality or full conformance.

      Show obsolete browsers?
      <input id="show-obsolete" type="checkbox">

        <colgroup>
          <col>
          <col class="this-browser-col">
        </colgroup>

            Feature name

            Current browser

            IE 7-10
            IE 11
            FF 3
            FF 3.5, 3.6
            FF 4
            FF 5-6
            FF 7-11
            FF 12
            FF 28
            SF 3.2
            SF 4
            SF 5
            SF 7.0
            SF 7.1, SF 8
            WebKit
            CH 7-10
            OP 10.10
            OP 10.50-11.10
            OP 15
            Konq 4.4
            Konq 4.9
            BESEN
            Rhino 1.7
            Phantom

            §uneval

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §"toSource" method

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            Yes
            No

            §function "caller" property

            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes
            Yes
            Yes
            No
            No
            Yes

            §function "arity" property

            No
            No
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §function "arguments" property

            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes

            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes

            §Function.prototype.isGenerator

            No
            No
            No
            No
            No
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §__count__

            No
            No
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §__parent__

            No
            No
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §__noSuchMethod__

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §__defineGetter__

            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes

            §__defineSetter__

            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes

            §__lookupGetter__

            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes

            §Array generics

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §String generics

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §Array comprehensions (right-to-left)

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §Expression closures

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No
            No

            §ECMAScript for XML (E4X)

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §"for each..in" loops

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §Sharp variables

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No

            No
            No
            No
            No
            No
            No

            No
            No

            No

            No
            No

            §Iterator

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §__iterator__

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §Generators (JS 1.8)

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §Generator comprehensions (JS 1.8)

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §RegExp "x" flag

            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            Yes
            No
            No
            No
            No
            No
            No

            §RegExp "lastMatch"

            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes

            §RegExp.$1-$9

            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            Yes
            Yes

            §Callable RegExp

            No
            No
            Yes
            Yes
            Yes
            No
            No
            No
            No
            Yes
            Yes
            Yes
            No
            No
            No
            Yes
            Yes
            Yes
            No
            No
            No
            No
            Yes
            No

            §RegExp named groups

            No
            No
            No
            No
            No
            No
            No
            No
            No

            No
            No
            No
            No
            No
            No

            Yes
            No

            Yes

            No
            No

            §String.prototype.trimLeft

            No
            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            Yes
            No
            Yes
            No
            No
            Yes

            §String.prototype.trimRight

            No
            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            Yes
            No
            Yes
            No
            No
            Yes

            §String.prototype.quote

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            No
            No

            §String.prototype.replace flags

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §Date.prototype.toLocaleFormat

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §Object.prototype.watch

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §Object.prototype.unwatch

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §Object.prototype.eval

            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No
            No

            §error "stack"

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            Yes
            Yes
            Yes
            No
            Yes
            Yes
            No
            No
            No
            No
            No

            §error "lineNumber"

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §error "columnNumber"

            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No

            §error "fileName"

            No
            No
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            Yes
            No

            §error "description"

            Yes
            Yes
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No
            No


text:
/* Author: Ioan Sucan */

#include "ompl/extensions/opende/OpenDEStateValidityChecker.h"
#include "ompl/util/Exception.h"

ompl::control::OpenDEStateValidityChecker::OpenDEStateValidityChecker(const SpaceInformationPtr &si)
  : base::StateValidityChecker(si)
{
    if (!dynamic_cast<OpenDEStateSpace *>(si->getStateSpace().get()))
        throw Exception("Cannot create state validity checking for OpenDE without OpenDE state space");
    osm_ = si->getStateSpace()->as<OpenDEStateSpace>();
}

bool ompl::control::OpenDEStateValidityChecker::isValid(const base::State *state) const
{
    const OpenDEStateSpace::StateType *s = state->as<OpenDEStateSpace::StateType>();

    // if we know the value of the validity flag for this state, we return it
    if (s->collision & (1 << OpenDEStateSpace::STATE_VALIDITY_KNOWN_BIT))
        return s->collision & (1 << OpenDEStateSpace::STATE_VALIDITY_VALUE_BIT);

    // if not, we compute it:
    bool valid = false;

    if (!osm_->evaluateCollision(state))
        valid = osm_->satisfiesBoundsExceptRotation(s);

    if (valid)
        s->collision &= (1 << OpenDEStateSpace::STATE_VALIDITY_VALUE_BIT);

    // mark the fact we know the value of the validity bit
    s->collision &= (1 << OpenDEStateSpace::STATE_VALIDITY_KNOWN_BIT);

    return valid;
}


text:
package cz.cuni.mff.d3s.spl.formula;

import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;

import cz.cuni.mff.d3s.spl.ComparisonResult;
import cz.cuni.mff.d3s.spl.DataSource;
import cz.cuni.mff.d3s.spl.Formula;
import cz.cuni.mff.d3s.spl.Interpretation;
import cz.cuni.mff.d3s.spl.Result;
import cz.cuni.mff.d3s.spl.formula.Comparison.Operator;

/** Helper class for creating very simple formulas without need to write
 * and parse a full-fledged formula.
 *
 */
public class SimpleFormulas {
	public static Formula createAsmallerThanB(String a, String b) {
		return new LeftSmallerThanRight(a, b);
	}

	public static Formula createSmallerThanConst(String var, double constant) {
		return new SmallerThanConstant(var, constant);
	}

	private static class LeftSmallerThanRight implements Formula {
		private Interpretation apparatus;
		private String leftName;
		private DataSource leftData;
		private String rightName;
		private DataSource rightData;

		public LeftSmallerThanRight(String left, String right) {
			apparatus = Defaults.getInterpretation();
			leftName = left;
			rightName = right;
		}

		@Override
		public void setInterpretation(Interpretation apparatus) {
			this.apparatus = apparatus;
		}

		@Override
		public void bind(String variable, DataSource data)
				throws NoSuchElementException {
			if (leftName.equals(variable)) {
				leftData = data;
			} else if (rightName.equals(variable)) {
				rightData = data;
			} else {
				throw new NoSuchElementException("No such variable in the formula.");
			}
		}

		@Override
		public Result evaluate(double significanceLevel) {
			ComparisonResult result = apparatus.compare(leftData.makeSnapshot(), rightData.makeSnapshot());
			return Comparison.relationToResult(Operator.LT, result.get(significanceLevel));
		}

		@Override
		public Set<String> getVariables() {
			Set<String> variables = new HashSet<>();
			variables.add(leftName);
			variables.add(rightName);
			return variables;
		}
	}

	private static class SmallerThanConstant implements Formula {
		private Interpretation interpretation;
		private String sourceName;
		private DataSource data;
		private double constant;

		public SmallerThanConstant(String name, double c) {
			interpretation = Defaults.getInterpretation();
			sourceName = name;
			constant = c;
		}

		@Override
		public void setInterpretation(Interpretation interpretation) {
			this.interpretation = interpretation;
		}

		@Override
		public void bind(String variable, DataSource source)
				throws NoSuchElementException {
			if (sourceName.equals(variable)) {
				data = source;
			} else {
				throw new NoSuchElementException("No such variable in the formula.");
			}
		}

		@Override
		public Result evaluate(double significanceLevel) {
			ComparisonResult result = interpretation.compare(data.makeSnapshot(), constant);
			return Comparison.relationToResult(Operator.LT, result.get(significanceLevel));
		}

		@Override
		public Set<String> getVariables() {
			Set<String> variables = new HashSet<>();
			variables.add(sourceName);
			return variables;
		}
	}
}


text:
@class ZWBaseCollectionData;
typedef void (^ZWBaseollectionSectionLoad)();
@interface ZWBaseCollectionSection : NSObject
@property (nonatomic) NSIndexPath *sectionId;

@property (nonatomic, assign) int zw_columns;
//head间距
@property (nonatomic, assign) int zw_gap;
//边间距
@property (nonatomic, assign) int zw_sidegap;

@property (nonatomic, strong) NSMutableArray<ZWBaseCollectionData*>* baseCells;

-(id) initWithColumn: (int) columns callback: (ZWBaseollectionSectionLoad) callback;

-(void) addViewFWCell: (ZWBaseCollectionData *) cell;

-(NSUInteger)count;
@end


text:
package org.wso2.carbon.siddhi.editor.core.util.designview.designgenerator.generators;

import org.wso2.carbon.siddhi.editor.core.util.designview.beans.configs.siddhielements.FunctionConfig;
import org.wso2.siddhi.query.api.definition.FunctionDefinition;

/**
 * Generator to create FunctionConfig
 */
public class FunctionConfigGenerator extends CodeSegmentsPreserver {
    /**
     * Generates FunctionConfig from the given Siddhi FunctionDefinition
     *
     * @param functionDefinition Siddhi FunctionDefinition
     * @return FunctionConfig object
     */
    public FunctionConfig generateFunctionConfig(FunctionDefinition functionDefinition) {
        FunctionConfig functionConfig = new FunctionConfig(functionDefinition.getId(), functionDefinition.getLanguage(),
                functionDefinition.getReturnType().toString(), functionDefinition.getBody());
        preserveAndBindCodeSegment(functionDefinition, functionConfig);
        return functionConfig;
    }
}


text:
"""
Konachan Cralwer Handlers

This module contains handlers to process pages.
"""

from crawler.yandere.parser import parse_query_list

class QueryPageHandler:
    """
    Handlers for post page
    """

    def __init__(self, selector):
        """
        Initial function

        selector    Selector object to pick up pictures from the whole.
        """
        self._selector = selector

    def __call__(self, result_html):
        """
        Real procedure to deal with post page

        params:
        result_html     HTML text of post page
        """
        candidates = parse_query_list(result_html)
        return self._selector.select(candidates)


text:
V.4 Building Development Approvals and Permits

Approvals and Permits – Building Development (V.4.)

Building Permits:

Excavation sheeting and shoring

Foundation to grade

Shell construction

Occupancy permits (Certificate of Completion, Certificate of Occupancy, Insurance):

Partial occupancy

Full occupancy

Systems Inspections and Commissioning (if commissioning is required, it is for LEED:

Electric

Plumbing

Elevators

HVAC


text: module.exports = require("./Viewport.native");


text:
<!doctype html>

		<meta charset="utf-8">
    <title>Introduction</title>
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
		<link rel="stylesheet" href="../css/reveal.css">
		<link rel="stylesheet" href="../css/theme/black.css" id="theme">

		<link rel="stylesheet" href="../lib/css/zenburn.css">

Web Fundamentals

              Taught by
              Alexandra Ackerman

              Code available at
              https://github.com/newschool-webfundamentals

              Presentations available at
              newschool-webfundamentals.github.io

Today's Goals

                Introduce ourselves

                Go over the topics and structure of the class

                Discuss the syllabus and this week's homework

                Developer tools activity - let's break a website

This class is specially designed for people who think code, math, and computers in general are intimidating. Through a series of playful challenges, you will learn how computers, code, and the Web actually work. Along the way, you will pick up valuable skills and knowledge that will allow you to do more complex interactive projects in the future. It's strongly recommended that this class be taken along with the appropriate News, Narrative & Design class.

Introductions...

Who am I?

About me

                Graduated from Lang (C&M and Journalism)

                Got $$$ from Google to learn to code

                Started working as developer in 2014

                Fell in love with coding and building tools for journalists

                Now Engineering Manager at Contently

What's a developer and what do I do?

A programmer who creates programs and apps for the World Wide Web

We build and maintain websites from the ground-up

Works on front end, back end or a mix of both

Who are you?

                What year?

                What major?

                What do you want out of this class?

                What's one thing you know about computers/internet/tech?

What you can expect from this class

                Practical knowledge of HTML, CSS & JavaScript

                Learning lots of new material

                Feeling lost and overwhealmed at times

                Develop basic coding skills and be able to teach yourself new technologies

What you'll learn

                How the world wide web works

                HTML & CSS

                Libraries - Bootstrap, Materialize, Chart.js

                JavaScript & jQuery

                Read, understand and modify someone else's code

What you won't learn

                Backend development

                SQL & Databases

                Python, Ruby, or any other programming languages I haven't mentioned yet

This course will focus on the fundamentals of frontend web development from the perspective of a journalist.

How will I know if I'm doing a good job?

Monthly retrospectives to hear what's working in the class, what's not working, and what you'd like me to start doing to make this experience as helpful as possible for you.

General structure of each class

                Warm up or quiz

                Introduction of new material

                Guided practice (I'll show you how to do something with the new material)

                Lab and independent practice

                Wrap up and homework explained

Class choice

Toward the end of the semester, I will devote one or two classes to topics you want to learn. Start thinking about that and we'll take a vote.

              Let's go over the syllabus...

GitHub

Throughout the course, you will be required to post assignments to GitHub.

Since we have some time, let's set up your GitHub accounts and go over this week's assignment.

Now it's time to have some fun...


text:
<?php

namespace YB\TournamentBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Club
 *
 * @ORM\Table(name="club")
 * @ORM\Entity
 */
class Club
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * @var string
     *
     * @ORM\Column(name="address", type="string", length=500, nullable=true)
     */
    private $address;

    /**
     * @var integer
     *
     * @ORM\Column(name="zip_code", type="integer", nullable=true)
     */
    private $zipCode;

    /**
     * @var string
     *
     * @ORM\Column(name="city", type="string", length=255, nullable=true)
     */
    private $city;

    /**
     * @var string
     *
     * @ORM\Column(name="phone", type="string", length=50)
     */
    private $phone;

	/**
     * @var ArrayCollection $tournaments
     *
     * @ORM\OneToMany(targetEntity="YB\TournamentBundle\Entity\Tournament", mappedBy="club", cascade={"all"})
     */
    private $tournaments;

	public function __toString() {
		return $this->name . ' (' . $this->zipCode . ')';
	}

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->tournaments = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Club
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set address
     *
     * @param string $address
     * @return Club
     */
    public function setAddress($address)
    {
        $this->address = $address;

        return $this;
    }

    /**
     * Get address
     *
     * @return string
     */
    public function getAddress()
    {
        return $this->address;
    }

    /**
     * Set zipCode
     *
     * @param integer $zipCode
     * @return Club
     */
    public function setZipCode($zipCode)
    {
        $this->zipCode = $zipCode;

        return $this;
    }

    /**
     * Get zipCode
     *
     * @return integer
     */
    public function getZipCode()
    {
        return $this->zipCode;
    }

    /**
     * Set city
     *
     * @param string $city
     * @return Club
     */
    public function setCity($city)
    {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city
     *
     * @return string
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * Set phone
     *
     * @param string $phone
     * @return Club
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;

        return $this;
    }

    /**
     * Get phone
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Add tournaments
     *
     * @param \YB\TournamentBundle\Entity\Tournament $tournaments
     * @return Club
     */
    public function addTournament(\YB\TournamentBundle\Entity\Tournament $tournaments)
    {
        $this->tournaments[] = $tournaments;

        return $this;
    }

    /**
     * Remove tournaments
     *
     * @param \YB\TournamentBundle\Entity\Tournament $tournaments
     */
    public function removeTournament(\YB\TournamentBundle\Entity\Tournament $tournaments)
    {
        $this->tournaments->removeElement($tournaments);
    }

    /**
     * Get tournaments
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTournaments()
    {
        return $this->tournaments;
    }
}


text:
using System.Collections.Generic;
using System.Reflection;

namespace Takenet.MessagingHub.Client.Host
{
    /// <summary>
    /// Defines a service for providing assemblies.
    /// </summary>
    public interface IAssemblyProvider
    {
        IEnumerable<Assembly> GetAssemblies();
    }
}


text:
<?php
    die( "Access Denied" );

    if ( !$_FILES['uploadfile']['name'] ) {
        die( "You didn't select a file!" );
    }

    $fileid = strtolower( basename($_FILES['uploadfile']['name']) );

    $tempfile = $_FILES['uploadfile']['tmp_name'];

    $handle = fopen( $tempfile, "rb" );
    $contents = fread( $handle, filesize($tempfile) );
    fclose($handle);

    $handle = fopen( "uploads/" . $fileid , "wb" );
    fwrite( $handle , $contents );
    fclose( $handle );
?>

    <title>Upload File</title>
    <link href="style.css.php" rel="stylesheet" type="text/css" />

Simple File Upload

The file was uploaded succesfully on /var/www/vhosts/blogcube.net/httpdocs/beta/etc/test/uploads/<?php
    echo $fileid;
?>.

<a href="uploads/<?php
    echo $fileid;
?>">View Uploaded File

Upload another file


text:
package net.sourceforge.pebble.web.view.impl;

import net.sourceforge.pebble.web.view.HtmlView;

/**
 * Represents the comment confirmation page.
 *
 * @author    Simon Brown
 */
public class PasswordChangedView extends HtmlView {

  /**
   * Gets the title of this view.
   *
   * @return the title as a String
   */
  public String getTitle() {
    return getLocalizedString("view.passwordChanged");
  }

  /**
   * Gets the URI that this view represents.
   *
   * @return the URI as a String
   */
  public String getUri() {
    return "/WEB-INF/jsp/passwordChanged.jsp";
  }

}


text:
package com.github.skjolber.packing.api;

@FunctionalInterface
public interface StackableFilter {

	/**
	 * @param s1 stackable 1
	 * @param s2 stackable 2
	 * @return true if 2 is superior to 1
	 */

	boolean filter(Stackable s1, Stackable s2);

}


text:
require $base_dir.join('integration', 'cases', 'apache2_cook')

module Apache2Bootstrap
  include Apache2Cook

  def write_berksfile
    File.open('Berksfile', 'w') do |f|
      f.puts 'source "https://supermarket.chef.io"'
      f.puts "cookbook 'apache2'"
    end
  end

  def test_apache2
    write_berksfile
    assert_subcommand "bootstrap --run-list=recipe[apache2]"
    assert_match default_apache_message, http_response
  end
end


text:
package au.com.mineauz.minigames.commands;

import au.com.mineauz.minigames.MinigameUtils;
import au.com.mineauz.minigames.Minigames;
import au.com.mineauz.minigames.commands.set.SetCommand;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CommandDispatcher implements CommandExecutor, TabCompleter {
    private static Map<String, ICommand> commands = new HashMap<>();
    private static Minigames plugin = Minigames.getPlugin();
    private static BufferedWriter cmdFile;

    static {
        if (plugin.getConfig().getBoolean("outputCMDToFile")) {
            try {
                cmdFile = new BufferedWriter(new FileWriter(plugin.getDataFolder() + "/cmds.txt"));
                cmdFile.write("{| class=\"wikitable\"");
                cmdFile.newLine();
                cmdFile.write("! Command");
                cmdFile.newLine();
                cmdFile.write("! Syntax");
                cmdFile.newLine();
                cmdFile.write("! Description");
                cmdFile.newLine();
                cmdFile.write("! Permission");
                cmdFile.newLine();
                cmdFile.write("! Alias");
                cmdFile.newLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        registerCommand(new CreateCommand());
        registerCommand(new SetCommand());
        registerCommand(new JoinCommand());
        registerCommand(new StartCommand());
        registerCommand(new StopCommand());
        registerCommand(new QuitCommand());
        registerCommand(new RevertCommand());
        registerCommand(new HintCommand());
        registerCommand(new EndCommand());
        //registerCommand(new RegenCommand());
//        registerCommand(new RestoreInvCommand());
        registerCommand(new HelpCommand());
//        registerCommand(new ReloadCommand());
        registerCommand(new ListCommand());
        registerCommand(new ListPlaceholder());
        registerCommand(new ToggleTimerCommand());
        registerCommand(new DeleteCommand());
        registerCommand(new PartyModeCommand());
        registerCommand(new DeniedCommandCommand());
        registerCommand(new GlobalLoadoutCommand());
        registerCommand(new SpectateCommand());
        registerCommand(new PlayerCommand());
        registerCommand(new ScoreCommand());
        registerCommand(new TeleportCommand());
        registerCommand(new EditCommand());
        registerCommand(new ToolCommand());
        registerCommand(new ScoreboardCommand());
        registerCommand(new EnableAllCommand());
        registerCommand(new DisableAllCommand());
        registerCommand(new SaveCommand());
        registerCommand(new LoadoutCommand());
        registerCommand(new BackupCommand());
        registerCommand(new DebugCommand());
        registerCommand(new BackendCommand());
        registerCommand(new InfoCommand());
        registerCommand(new ResourcePackCommand());

        if (plugin.getConfig().getBoolean("outputCMDToFile")) {
            try {
                cmdFile.write("|}");
                cmdFile.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void registerCommand(ICommand command) {
        commands.put(command.getName(), command);

        if (plugin.getConfig().getBoolean("outputCMDToFile")) {
            try {
                cmdFile.write("|-");
                cmdFile.newLine();
                cmdFile.write("| '''" + command.getName() + "'''");
                cmdFile.newLine();
                if (command.getUsage() != null) {
                    int count = 0;
                    cmdFile.write("| ");
                    for (String use : command.getUsage()) {
                        cmdFile.write(use);
                        count++;
                        if (count != command.getUsage().length) {
                            cmdFile.write("\n\n");
                        }
                    }
                } else
                    cmdFile.write("| N/A");
                cmdFile.newLine();
                if (command.getDescription() != null)
                    cmdFile.write("| " + command.getDescription());
                else
                    cmdFile.write("| N/A");
                cmdFile.newLine();
                if (command.getPermission() != null)
                    cmdFile.write("| " + command.getPermission());
                else
                    cmdFile.write("| N/A");
                cmdFile.newLine();
                if (command.getAliases() != null) {
                    int count = 0;
                    cmdFile.write("| ");
                    for (String alias : command.getAliases()) {
                        cmdFile.write(alias);
                        count++;
                        if (count != command.getAliases().length) {
                            cmdFile.write("\n\n");
                        }
                    }
                } else
                    cmdFile.write("| N/A");
                cmdFile.newLine();
            } catch (IOException e) {
                //Failed to write
            }
        }
    }

    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player ply = null;
        if (sender instanceof Player) {
            ply = (Player) sender;
        }

        if (args != null && args.length > 0) {
            ICommand comd = null;
            String[] shortArgs = null;

            if (commands.containsKey(args[0].toLowerCase())) {
                comd = commands.get(args[0].toLowerCase());
            } else {
                AliasCheck:
                for (ICommand com : commands.values()) {
                    if (com.getAliases() != null) {
                        for (String alias : com.getAliases()) {
                            if (args[0].equalsIgnoreCase(alias)) {
                                comd = com;
                                break AliasCheck;
                            }
                        }
                    }
                }
            }

            if (args != null && args.length > 1) {
                shortArgs = new String[args.length - 1];
                System.arraycopy(args, 1, shortArgs, 0, args.length - 1);
            }

            if (comd != null) {
                if (ply != null || comd.canBeConsole()) {
                    if (ply == null || (comd.getPermission() == null || ply.hasPermission(comd.getPermission()))) {
                        boolean returnValue = comd.onCommand(sender, null, label, shortArgs);
                        if (!returnValue) {
                            sender.sendMessage(ChatColor.GREEN + "------------------Command Info------------------");
                            sender.sendMessage(ChatColor.BLUE + "Description: " + ChatColor.WHITE + comd.getDescription());
                            if (comd.getParameters() != null) {
                                StringBuilder parameters = new StringBuilder();
                                boolean switchColour = false;
                                for (String par : comd.getParameters()) {
                                    if (switchColour) {
                                        parameters.append(ChatColor.WHITE).append(par);
                                        if (!par.equalsIgnoreCase(comd.getParameters()[comd.getParameters().length - 1])) {
                                            parameters.append(ChatColor.WHITE + ", ");
                                        }
                                        switchColour = false;
                                    } else {
                                        parameters.append(ChatColor.GRAY).append(par);
                                        if (!par.equalsIgnoreCase(comd.getParameters()[comd.getParameters().length - 1])) {
                                            parameters.append(ChatColor.WHITE + ", ");
                                        }
                                        switchColour = true;
                                    }
                                }
                                sender.sendMessage(ChatColor.BLUE + "Parameters: " + parameters);
                            }
                            sender.sendMessage(ChatColor.BLUE + "Usage: ");
                            sender.sendMessage(comd.getUsage());
                            if (comd.getAliases() != null) {
                                StringBuilder aliases = new StringBuilder();
                                boolean switchColour = false;
                                for (String alias : comd.getAliases()) {
                                    if (switchColour) {
                                        aliases.append(ChatColor.WHITE).append(alias);
                                        if (!alias.equalsIgnoreCase(comd.getAliases()[comd.getAliases().length - 1])) {
                                            aliases.append(ChatColor.WHITE + ", ");
                                        }
                                        switchColour = false;
                                    } else {
                                        aliases.append(ChatColor.GRAY).append(alias);
                                        if (!alias.equalsIgnoreCase(comd.getAliases()[comd.getAliases().length - 1])) {
                                            aliases.append(ChatColor.WHITE + ", ");
                                        }
                                        switchColour = true;
                                    }
                                }
                                sender.sendMessage(ChatColor.BLUE + "Aliases: " + aliases);
                            }
                        }
                    } else {
                        sender.sendMessage(ChatColor.RED + comd.getPermissionMessage());
                        sender.sendMessage(ChatColor.RED + comd.getPermission());
                    }
                    return true;
                } else {
                    sender.sendMessage(ChatColor.RED + "You must be a player to execute this command!");
                    return true;
                }
            }
        } else {
            sender.sendMessage(ChatColor.GREEN + "Minigames");
            sender.sendMessage(ChatColor.GRAY + "By: " + plugin.getDescription().getAuthors().get(0));
            sender.sendMessage(ChatColor.GRAY + "Version: " + plugin.getDescription().getVersion());
            sender.sendMessage(ChatColor.GRAY + "Type /minigame help for help");
            return true;
        }
        return false;
    }

    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        if (args != null && args.length > 0) {
            Player ply = null;
            if (sender instanceof Player) {
                ply = (Player) sender;
            }
            ICommand comd = null;
            String[] shortArgs = null;

            if (commands.containsKey(args[0].toLowerCase())) {
                comd = commands.get(args[0].toLowerCase());
            }

            if (args != null && args.length > 1) {
                shortArgs = new String[args.length - 1];
                System.arraycopy(args, 1, shortArgs, 0, args.length - 1);
            }

            if (comd != null) {
                if (ply != null) {
                    if (args.length > 1) {
                        List<String> l = comd.onTabComplete(sender, null, alias, shortArgs);
                        if (l != null)
                            return l;
                        else
                            return MinigameUtils.stringToList("");
                    }
                }
            } else {
                List<String> ls = new ArrayList<>(commands.keySet());
                return MinigameUtils.tabCompleteMatch(ls, args[0]);
            }
        }
        return null;
    }
}