text:
<?php

declare(strict_types=1);

/**
 * This file is part of Narrowspark Framework.
 *
 * (c) Daniel Bannert <d.bannert@anolilab.de>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Narrowspark\TestingHelper\Traits;

use Narrowspark\TestingHelper\Constraint\ArraySubset;
use PHPUnit\Framework\Assert as PhpUnitAssert;
use SebastianBergmann\RecursionContext\InvalidArgumentException;

trait AssertJsonTrait
{
    /**
     * Assert that the element exists in the json.
     *
     * @param string $needle
     * @param array  $haystack
     * @param string $message
     *
     * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
     * @throws \Exception
     *
     * @return void
     */
    public static function assertInJson(string $needle, array $haystack, string $message = ''): void
    {
        if ($message === '') {
            $message = "Expected the array to contain the element '{$needle}'.";
        }

        $array = \json_decode($needle, true);

        if (\json_last_error() !== \JSON_ERROR_NONE) {
            throw new InvalidArgumentException("Invalid json provided: '{$needle}'.");
        }

        PhpUnitAssert::assertThat($array, new ArraySubset($haystack), $message);
    }
}


text:
The `ami` plugins all use a conventional directory structure, modelled on theoutput from `quickscrape`. This used to be called a `quickscrape` directory, then `quickscrapeNorma` and now simply `contemtmine` or `cmdir` . (These names are still in flux, sorry). The flags `-q` and `qsN`, etc will become obsolete.

## contentMine directory

The commonest type of `contentMine` directory comes from the result of a `quickscrape` scrape, typically like:
```
http_www.trialsjournal.com_content_16_1_1
├── 1745-6215-16-1-1.gif
├── fulltext.html
├── fulltext.pdf
├── fulltext.xml
├── results.json
└── scholarly.html
```
The article URL creates the `contentMine` directory name. Note, however, that there is no standard naming structure.
 * `fulltext.html` is raw HTML (and may sometimes be difficult to parse)
 * `fulltext.pdf` is the current PDF (some publishers replace a provisional one with a final one)
 * `fulltext.xml` is the XML. There may be several DTDs used. We have encountered at least: 'nlm` ('JATS`); 'BMC`; `Elsevier`; `ISO12083` ans probably several more.
 * `results.json` a summary/manifest of rhe files and metadata
 * `*.gif`, etc. Images, supplemental data, etc. We may put this in subdirectories soon.

 None of these are perfect for analysing so we have to create normalised, structured documents (`scholarly.html`); This is done by `norma` applying an `XSL` stylesheet to the `XML`.

 The `contentMine` directory is used directly by `ami` plugins. The software knows the reserved files names that are allowed  in the director and how to process them. At present only the `scholarly.html` can be input to `ami`, but in the futire we shall also allow `figure*.svg` and other data types. We usually require both a `contentMine` directory and an `input` file such as:
 ```
 ami-regex -q http_www.trialsjournal.com_content_16_1_1 -i scholarly.html --r.regex regex/consort0.xml
 ```
 where we are applying `regex/consort0.xml` to the input file (`scholarly.html`) within a given `contentMine` directory.

 Note that all the resources for a given article or other document are kept within a single directory whose structure is controlled.

 ## results directory

 All `ami` plugins generate their results in a special subdirectory `results`. A typical structure is:
 ```
└── 15_1_511_test
    ├── fulltext.html
    ├── fulltext.pdf
    ├── fulltext.xml
    ├── results
    │   └── regex
    │       └── consort0
    │           └── results.xml
    ├── results.json
    └── scholarly.html
 ```
Here `ami-regex` has generated a `results` directory, used its name for a subdirectory (`regex`) , made a sub-subdirectory for the option (the regex name `consort0`), and then written `results.xml` within it.

When several plugins are used , each with one or more options, we can get a structure like:
```
└── contentminedir
    ├── fulltext.html
    ├── fulltext.pdf
    ├── fulltext.xml
    ├── results
    │   └── plugin1
    │       └── option11
    │           └── results.xml
    │       └── option12
    │           └── results.xml
    │   └── plugin2
    │       └── option21
    │           └── results.xml
    │       └── option22
    │           └── results.xml
    ├── results.json
    └── scholarly.html
```
This makes it easy to hold all the results in one place, which not only avoids the chanceof losing files, but also allows comparison and composiyion between different output. For example we could compare the variation of `sequences` with `species`

## `expected` directory

`expected` subdirectory provides regression tests which make sure that the same result is created by later versions of software. It also acts as an illustrator of the types of output. So
```
└── 15_1_511_test
    ├── expected
    │   └── regex
    │       └── consort0
    │           └── results.xml
    ├── fulltext.html
    ├── fulltext.pdf
    ├── fulltext.xml
    ├── results
    │   └── regex
    │       └── consort0
    │           └── results.xml
    ├── results.json
    └── scholarly.html
```
here `expected` has the same structure and content as `results`.

## `results.xml` files

All output is in `results.xml` which are structured as a `<results>` element with `<result>` children.

### `ami-word` and `count`s

Here is `ami-word`:
```
<?xml version="1.0" encoding="UTF-8"?>
<results title="frequencies">
 <result title="frequency" word="smoking" count="71"/>
 <result title="frequency" word="smokers" count="23"/>
 <result title="frequency" word="quit" count="20"/>
 <result title="frequency" word="researcher" count="18"/>
 <result title="frequency" word="calls" count="17"/>
 <result title="frequency" word="letter" count="16"/>
 <result title="frequency" word="approaches" count="14"/>
 <result title="frequency" word="contact" count="14"/>
 <result title="frequency" word="single" count="13"/>
 <result title="frequency" word="invitations" count="13"/>
 <result title="frequency" word="likely" count="13"/>
 <result title="frequency" word="attempt" count="12"/>
 <result title="frequency" word="minutes" count="12"/>
 <result title="frequency" word="cut" count="12"/>
 <result title="frequency" word="sent" count="12"/>
 <result title="frequency" word="reach" count="12"/>
 <result title="frequency" word="nicotine" count="11"/>
```
The `results` element has a `title` corresponding to the `option` selected (the `frequencies`) .

However different plugins will give different information, currently as follows:

### `regex`

```
 <result pre="-specific LBP (NSLBP), a " name0="diagnose" value0="diagnosis"
     post="based on exclusion of a specific cause o" xpath="/html[1]/body[1]/div[9]/p[1]"/>
 <result pre="tion health, to alter or " name0="diagnose" value0="diagnose"
     post="the course of a health condition, or to " xpath="/html[1]/body[1]/div[10]/table[1]/tbody[1]/tr[2]/td[2]/p[1]"/>
 <result pre="re proposed to describe, " name0="stratify" value0="stratify,"
     post="and compare reports on patients with chr" xpath="/html[1]/body[1]/div[10]/div[4]/p[4]"/>
 <result pre="ble researchers were not " name0="exclude" value0="excluded"
     post="from this list, convenience sampling was" xpath="/html[1]/body[1]/div[10]/div[7]/div[2]/p[1]"/>
     ...
```
Unlike word-counting, the regex (and manyn other plugins) locate a precise word or phrase in the document. It's very valuable to know where this is so we give two mechanisms:

### `xpath` locators

 * XPath can precisely define the element which provides the content for the match; the `xpath` value allows us to recover it.
 * the text before (`pre`) and after (`post`) the match can be used to find the actual position. This is very good for variable running text, but less good in tables.

 For all matches of words and prases we provide `xpath`, `post` and `pre`

### names and matched values (`sequence` and `species`)

A regex can extract multiple name-value pairs  and hence we hace `name0` and `value0` (for some regexes we might have `name1` and `value1`, etc. This looks a bit clunky, but it seems necessary. For single matches, e.g. for `sequences` and `species` the result is often anonymous and we don't need an explicit `name` Here are both:
```
<?xml version="1.0" encoding="UTF-8"?>
<results title="dna">
 <result pre="used by Sweet et al, 2010; (357F) (" exact="5'-CCTACGGGAGGCAGCAG-3'"
     post=") and (518R) (5'ATTACCGCGGCTGCTGG-3'), a segment o" xpath="/html[1]/body[1]/div[1]/div[5]/div[3]/p[1]" name="dna"/>
 <result pre="-CCTACGGGAGGCAGCAG-3') and (518R) (" exact="5'ATTACCGCGGCTGCTGG-3'"
     post="), a segment of the bacterial 16S rRNA gene was am" xpath="/html[1]/body[1]/div[1]/div[5]/div[3]/p[1]" name="dna"/>
 <result pre="ythell [ 18]; forward primer CilF (" exact="5'-TGGTAGTGTATTGGACWACCA-3'"
     post=") with a 36 bp GC clamp [ 31] attached to the 5' e" xpath="/html[1]/body[1]/div[1]/div[5]/div[4]/p[1]" name="dna"/>
 <result pre=" and the reverse primer CilDGGE-r (" exact="5'-TGAAAACATCCTTGGCAACTG-3'"
     post="). PCR reaction mixtures were made up to 10 μl vol" xpath="/html[1]/body[1]/div[1]/div[5]/div[4]/p[1]" name="dna"/>
 <result pre="mples using the primers BrB-F-171 (" exact="5'-TCAAACCCGACTTTACGGAAG-3'"
     post=") and BrB-R-1721 (5'-TGCAGGTTCACCTACGGAAAC-3') [ 3" xpath="/html[1]/body[1]/div[1]/div[5]/div[4]/p[3]" name="dna"/>
 <result pre="CGACTTTACGGAAG-3') and BrB-R-1721 (" exact="5'-TGCAGGTTCACCTACGGAAAC-3'"
     post=") [ 34]. These primers were designed to amplify th" xpath="/html[1]/body[1]/div[1]/div[5]/div[4]/p[3]" name="dna"/>
</results>
```
Note the `pre` and `post` and `xpath` as before. `exact` is the exact sequence matched - and there is no name.

The same is true for species:
```
<results title="binomial">
 <result pre="ntimicrobial activity (assessed on " exact="Vibrio harveyi" match="Vibrio harveyi"
     post=" cultures) was limited in both H and WSU samples (" name="binomial"/>
 <result pre="ia genus Vibrio, including; " exact="V. harveyi" match="Vibrio harveyi"
     post=" [ 14], V. mediterranei [ 7], V. owensii" name="binomial"/>
 <result pre="ncluding; V. harveyi [ 14], " exact="V. mediterranei" match="Vibrio mediterranei"
     post=" [ 7], V. owensii [ 15] and V. coralliil" name="binomial"/>
 <result pre=" 14], V. mediterranei [ 7], " exact="V. owensii" match="Vibrio owensii"
     post=" [ 15] and V. coralliilyticus [ 10]. Furthe" name="binomial"/>
```
Here we keep the `exact` but add an additional field `match` which is the "translation" of the exact match to the semantic form. As before the result is formally anonymous.

### `identifier`

Finally we have identifiers, which are really just a set of regexes, withe possibility of being looked up.
```
<results title="clin.isrctn">
 <result pre="andomized Controlled Trial Number (" exact="ISRCTN): 13837944"
     post=", UK Clinical Research Network (UKCRN) Study ID: 8" xpath="/html[1]/body[1]/div[8]/p[4]" name="clin.isrctn"/>
</results>
```
The id scheme is encapsulated in the `title` and again we have an anonymous value.

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace ExchangeRatesWebsite\Tests\Web;

class IndexControllerTest extends WebTestCase
{
    public function testIndexOk()
    {
        $this->client->request('GET', '/');
        $this->assertTrue($this->client->getResponse()->isOk());
    }
}


text:
import React from 'react';
import PropTypes from 'prop-types';

import RefHolder from '../models/ref-holder';
import GitTabContainer from '../containers/git-tab-container';

export default class GitTabItem extends React.Component {
  static propTypes = {
    repository: PropTypes.object.isRequired,
  }

  static uriPattern = 'atom-github://dock-item/git'

  static buildURI() {
    return this.uriPattern;
  }

  constructor(props) {
    super(props);

    this.refController = new RefHolder();
  }

  render() {
    return (
      <GitTabContainer
        controllerRef={this.refController}
        {...this.props}
      />
    );
  }

  serialize() {
    return {
      deserializer: 'GitDockItem',
      uri: this.getURI(),
    };
  }

  getTitle() {
    return 'Git';
  }

  getIconName() {
    return 'git-commit';
  }

  getDefaultLocation() {
    return 'right';
  }

  getPreferredWidth() {
    return 400;
  }

  getURI() {
    return this.constructor.uriPattern;
  }

  getWorkingDirectory() {
    return this.props.repository.getWorkingDirectoryPath();
  }

  // Forwarded to the controller instance when one is present

  rememberLastFocus(...args) {
    return this.refController.map(c => c.rememberLastFocus(...args));
  }

  restoreFocus(...args) {
    return this.refController.map(c => c.restoreFocus(...args));
  }

  hasFocus(...args) {
    return this.refController.map(c => c.hasFocus(...args));
  }

  focus() {
    return this.refController.map(c => c.restoreFocus());
  }

  focusAndSelectStagingItem(...args) {
    return this.refController.map(c => c.focusAndSelectStagingItem(...args));
  }

  focusAndSelectCommitPreviewButton() {
    return this.refController.map(c => c.focusAndSelectCommitPreviewButton());
  }

  quietlySelectItem(...args) {
    return this.refController.map(c => c.quietlySelectItem(...args));
  }

  focusAndSelectRecentCommit() {
    return this.refController.map(c => c.focusAndSelectRecentCommit());
  }
}


text:
/**
 * \file CRunner.h
 * \date Apr 1, 2010
 * \author samael
 */

#ifndef CRUNNER_H_
#define CRUNNER_H_

#include <string>
#include <utility>
#include <unistd.h>
#include <netinet/in.h>
#include "CTcpServer.h"
#include "CMutex.h"
#include "CWaitCondition.h"
#include "AWorkerActor.h"
#include "IWorkerStealer.h"

namespace wolf
{

struct PData;

/**
 * The runner which is responsible for worker executions.
 */
class CRunner
{
public:
	typedef enum State {
		NOT_READY,
		READY,
		WORKING,
		END
	} State;

	CRunner(in_port_t master_port, in_port_t runner_port, IWorkerStealer *ws,
			const std::string &appname = "default");
	~CRunner();
	void run();

	int id() const { return _id; }
	std::vector<CTcpSocket *> runnerSocks();
	void connectRunner(const CHostAddress &addr);
	void runnerConnected(CTcpSocket *runnersock);
	void startWorking();
	void putWorker(uint32_t wseq, AWorkerActor *worker,
			CTcpSocket *sender);
	std::pair<uint32_t, AWorkerActor *> takeWorker();
	void workerStealFailed(CTcpSocket *sender);
	void sendWorkerFinished(uint32_t wseq, AWorkerActor *worker);
	void sendWorker(CTcpSocket *sock, uint32_t nworkers);
	void sendWorkerSteal(CTcpSocket *sock, uint32_t nworkers);
	void shutdown();

private:
	CRunner(const CRunner &UNUSED(o)): _id(0), _state(NOT_READY), _statemx(),
	_statewcond(), _mport(0), _rport(0), _stealer(NULL), _appname(), _rserver(),
	_d(NULL) {}
	CRunner& operator=(const CRunner &UNUSED(o)) { return *this; }

private:
	int _id;							// Runner id.
	State _state;						// Runner state.
	CMutex _statemx;				// Runner state mutex.
	CWaitCondition _statewcond;	// Runner state cond variable.
	in_port_t _mport, _rport;			// Master/Runner ports.
	IWorkerStealer *_stealer;			// Stealer.
	std::string _appname;				// DSM appname.
	CTcpServer _rserver;			// Runner tcp server.
	PData *_d;
};

}

#endif /* CRUNNER_H_ */


text:
package docs.http;

// import com.hazelcast.config.AttributeConfig;
// import com.hazelcast.config.Config;
// import com.hazelcast.config.IndexConfig;
// import com.hazelcast.config.IndexType;
// import com.hazelcast.config.SerializerConfig;
// import com.hazelcast.core.Hazelcast;
// import com.hazelcast.core.HazelcastInstance;
//
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
// import org.springframework.session.MapSession;
// import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository;
// import org.springframework.session.hazelcast.HazelcastSessionSerializer;
// import org.springframework.session.hazelcast.PrincipalNameExtractor;
// import
// org.springframework.session.hazelcast.config.annotation.web.http.EnableHazelcastHttpSession;

// tag::config[]
// @EnableHazelcastHttpSession // <1>
// @Configuration
// public class HazelcastHttpSessionConfig {
//
// @Bean
// public HazelcastInstance hazelcastInstance() {
// Config config = new Config();
// AttributeConfig attributeConfig = new AttributeConfig()
// .setName(HazelcastIndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
// .setExtractorClassName(PrincipalNameExtractor.class.getName());
// config.getMapConfig(HazelcastIndexedSessionRepository.DEFAULT_SESSION_MAP_NAME) // <2>
// .addAttributeConfig(attributeConfig).addIndexConfig(
// new IndexConfig(IndexType.HASH,
// HazelcastIndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE));
// SerializerConfig serializerConfig = new SerializerConfig();
// serializerConfig.setImplementation(new
// HazelcastSessionSerializer()).setTypeClass(MapSession.class);
// config.getSerializationConfig().addSerializerConfig(serializerConfig); // <3>
// return Hazelcast.newHazelcastInstance(config); // <4>
// }
//
// }
// end::config[]


text:
import { ArticleService, Articles, Page } from '../article.service';
import { Component } from "@angular/core";
import { catchError, debounceTime, distinctUntilChanged, tap, switchMap } from 'rxjs/operators';
import { Observable, of, Subject } from "rxjs";

@Component( {
    selector: 'search-form',
    templateUrl: './search-form.component.html',
    styleUrls: ['./search-form.component.css'],
    providers: [ArticleService]
} )

export class SearchFormComponent {
    topic: string = "";
    searching = false;
    noSuggestions = false;
    error = false;
    pages: Page[];

    constructor( private articleService: ArticleService ) { }

    suggestions$ = ( searchText$: Subject<string> ) => searchText$.pipe(
        debounceTime( 500 ),
        distinctUntilChanged(),
        tap( st => {
            this.searching = true;
            this.noSuggestions = false;
            this.error = false;
        } ),
        switchMap( st => this.articleService.findSuggestions( st ) ),
        tap( r => { this.searching = false; if ( this.topic.trim().length > 0 && r.length == 0 ) this.noSuggestions = true; } ),
        catchError(() => {
            this.error = true;
            return of( [] );
        } )
    );

    onSubmit() {
        this.articleService.findArticles( this.topic )
            .subscribe( pages => {
                this.pages = new Array<Page>();
                for ( var property in pages ) {
                    this.pages.push( pages[property] );
                }
            }
        );
    }
}


text:
/**
 * app-start.js
 *
 * Author: Brayan Cruces, Diego Jara
 *
 * Project: Magical Hasse Flow v1
 *
 * JS de inicialización de Framework7
 *
 */

// Iniciamos el app
var myApp = new Framework7({
    animateNavBackIcon:true,
    swipePanel: 'left',

    // Habilitar Material Design
    material: true,
});

// Expose Internal DOM library
var $$ = Dom7;

// Add main view
var mainView = myApp.addView('.view-main', {
});

// Show/hide preloader for remote ajax loaded pages
// Probably should be removed on a production/local app
$$(document).on('ajaxStart', function (e) {
    myApp.showIndicator();
});
$$(document).on('ajaxComplete', function () {
    myApp.hideIndicator();
});

/* PANELES */

$$('.open-left-panel').on('click', function (e) {
        // 'left' position to open Left panel
        myApp.openPanel('left');
    });

$$('.panel-close').on('click', function (e) {
	myApp.closePanel();
});

// Add main View
var mainView = myApp.addView('.view-main', {
    // Enable dynamic Navbar
    dynamicNavbar: true,
    // Enable Dom Cache so we can use all inline pages
    domCache: true
});

/* ===== Pickers ===== */

var myPickerElements = myApp.picker({
    input: '#picker-elementos',
    cols: [
       {
         values: ['5', '6', '7','8','9','10','11','12','13','14','15']
       }
     ],
    toolbarCloseText:'Listo'
});

var myPickerRelacion = myApp.picker({
    input: '#picker-relacion',
    cols: [
       {
         values: ['a > b', 'a < b', 'a ≥ b', 'a ≤ b', 'a / b', 'a | b']
       }
     ],
    toolbarCloseText:'Listo'
});


text:
<?php

namespace yii\base;

use ReflectionClass;
use Yii;

/**
 * Widget is the base class for widgets.
 *
 * For more details and usage information on Widget, see the [guide article on widgets](guide:structure-widgets).
 *
 * @property string|null $id ID of the widget. Note that the type of this property differs in getter and
 * setter. See [[getId()]] and [[setId()]] for details.
 * @property \yii\web\View $view The view object that can be used to render views or view files. Note that the
 * type of this property differs in getter and setter. See [[getView()]] and [[setView()]] for details.
 * @property-read string $viewPath The directory containing the view files for this widget.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class Widget extends Component implements ViewContextInterface
{
    /**
     * @event Event an event that is triggered when the widget is initialized via [[init()]].
     * @since 2.0.11
     */
    const EVENT_INIT = 'init';
    /**
     * @event WidgetEvent an event raised right before executing a widget.
     * You may set [[WidgetEvent::isValid]] to be false to cancel the widget execution.
     * @since 2.0.11
     */
    const EVENT_BEFORE_RUN = 'beforeRun';
    /**
     * @event WidgetEvent an event raised right after executing a widget.
     * @since 2.0.11
     */
    const EVENT_AFTER_RUN = 'afterRun';

    /**
     * @var int a counter used to generate [[id]] for widgets.
     * @internal
     */
    public static $counter = 0;
    /**
     * @var string the prefix to the automatically generated widget IDs.
     * @see getId()
     */
    public static $autoIdPrefix = 'w';
    /**
     * @var Widget[] the widgets that are currently being rendered (not ended). This property
     * is maintained by [[begin()]] and [[end()]] methods.
     * @internal
     */
    public static $stack = [];

    /**
     * Initializes the object.
     * This method is called at the end of the constructor.
     * The default implementation will trigger an [[EVENT_INIT]] event.
     */
    public function init()
    {
        parent::init();
        $this->trigger(self::EVENT_INIT);
    }

    /**
     * Begins a widget.
     * This method creates an instance of the calling class. It will apply the configuration
     * to the created instance. A matching [[end()]] call should be called later.
     * As some widgets may use output buffering, the [[end()]] call should be made in the same view
     * to avoid breaking the nesting of output buffers.
     * @param array $config name-value pairs that will be used to initialize the object properties
     * @return static the newly created widget instance
     * @see end()
     */
    public static function begin($config = [])
    {
        $config['class'] = get_called_class();
        /* @var $widget Widget */
        $widget = Yii::createObject($config);
        self::$stack[] = $widget;

        return $widget;
    }

    /**
     * Ends a widget.
     * Note that the rendering result of the widget is directly echoed out.
     * @return static the widget instance that is ended.
     * @throws InvalidCallException if [[begin()]] and [[end()]] calls are not properly nested
     * @see begin()
     */
    public static function end()
    {
        if (!empty(self::$stack)) {
            $widget = array_pop(self::$stack);

            $calledClass = get_called_class();
            if (Yii::$container->has($calledClass) && isset(Yii::$container->getDefinitions()[$calledClass]['class'])) {
                $calledClass = Yii::$container->getDefinitions()[$calledClass]['class'];
            }

            if (get_class($widget) === $calledClass) {
                /* @var $widget Widget */
                if ($widget->beforeRun()) {
                    $result = $widget->run();
                    $result = $widget->afterRun($result);
                    echo $result;
                }

                return $widget;
            }

            throw new InvalidCallException('Expecting end() of ' . get_class($widget) . ', found ' . get_called_class());
        }

        throw new InvalidCallException('Unexpected ' . get_called_class() . '::end() call. A matching begin() is not found.');
    }

    /**
     * Creates a widget instance and runs it.
     * The widget rendering result is returned by this method.
     * @param array $config name-value pairs that will be used to initialize the object properties
     * @return string the rendering result of the widget.
     * @throws \Throwable
     */
    public static function widget($config = [])
    {
        ob_start();
        ob_implicit_flush(false);
        try {
            /* @var $widget Widget */
            $config['class'] = get_called_class();
            $widget = Yii::createObject($config);
            $out = '';
            if ($widget->beforeRun()) {
                $result = $widget->run();
                $out = $widget->afterRun($result);
            }
        } catch (\Exception $e) {
            // close the output buffer opened above if it has not been closed already
            if (ob_get_level() > 0) {
                ob_end_clean();
            }
            throw $e;
        } catch (\Throwable $e) {
            // close the output buffer opened above if it has not been closed already
            if (ob_get_level() > 0) {
                ob_end_clean();
            }
            throw $e;
        }

        return ob_get_clean() . $out;
    }

    private $_id;

    /**
     * Returns the ID of the widget.
     * @param bool $autoGenerate whether to generate an ID if it is not set previously
     * @return string|null ID of the widget.
     */
    public function getId($autoGenerate = true)
    {
        if ($autoGenerate && $this->_id === null) {
            $this->_id = static::$autoIdPrefix . static::$counter++;
        }

        return $this->_id;
    }

    /**
     * Sets the ID of the widget.
     * @param string $value id of the widget.
     */
    public function setId($value)
    {
        $this->_id = $value;
    }

    private $_view;

    /**
     * Returns the view object that can be used to render views or view files.
     * The [[render()]] and [[renderFile()]] methods will use
     * this view object to implement the actual view rendering.
     * If not set, it will default to the "view" application component.
     * @return \yii\web\View the view object that can be used to render views or view files.
     */
    public function getView()
    {
        if ($this->_view === null) {
            $this->_view = Yii::$app->getView();
        }

        return $this->_view;
    }

    /**
     * Sets the view object to be used by this widget.
     * @param View $view the view object that can be used to render views or view files.
     */
    public function setView($view)
    {
        $this->_view = $view;
    }

    /**
     * Executes the widget.
     *
     * @return string|void the rendering result may be directly "echoed" or returned as a string
     */
    public function run()
    {
    }

    /**
     * Renders a view.
     *
     * The view to be rendered can be specified in one of the following formats:
     *
     * - [path alias](guide:concept-aliases) (e.g. "@app/views/site/index");
     * - absolute path within application (e.g. "//site/index"): the view name starts with double slashes.
     *   The actual view file will be looked for under the [[Application::viewPath|view path]] of the application.
     * - absolute path within module (e.g. "/site/index"): the view name starts with a single slash.
     *   The actual view file will be looked for under the [[Module::viewPath|view path]] of the currently
     *   active module.
     * - relative path (e.g. "index"): the actual view file will be looked for under [[viewPath]].
     *
     * If the view name does not contain a file extension, it will use the default one `.php`.
     *
     * @param string $view the view name.
     * @param array $params the parameters (name-value pairs) that should be made available in the view.
     * @return string the rendering result.
     * @throws InvalidArgumentException if the view file does not exist.
     */
    public function render($view, $params = [])
    {
        return $this->getView()->render($view, $params, $this);
    }

    /**
     * Renders a view file.
     * @param string $file the view file to be rendered. This can be either a file path or a [path alias](guide:concept-aliases).
     * @param array $params the parameters (name-value pairs) that should be made available in the view.
     * @return string the rendering result.
     * @throws InvalidArgumentException if the view file does not exist.
     */
    public function renderFile($file, $params = [])
    {
        return $this->getView()->renderFile($file, $params, $this);
    }

    /**
     * Returns the directory containing the view files for this widget.
     * The default implementation returns the 'views' subdirectory under the directory containing the widget class file.
     * @return string the directory containing the view files for this widget.
     */
    public function getViewPath()
    {
        $class = new ReflectionClass($this);

        return dirname($class->getFileName()) . DIRECTORY_SEPARATOR . 'views';
    }

    /**
     * This method is invoked right before the widget is executed.
     *
     * The method will trigger the [[EVENT_BEFORE_RUN]] event. The return value of the method
     * will determine whether the widget should continue to run.
     *
     * When overriding this method, make sure you call the parent implementation like the following:
     *
     * ```php
     * public function beforeRun()
     * {
     *     if (!parent::beforeRun()) {
     *         return false;
     *     }
     *
     *     // your custom code here
     *
     *     return true; // or false to not run the widget
     * }
     * ```
     *
     * @return bool whether the widget should continue to be executed.
     * @since 2.0.11
     */
    public function beforeRun()
    {
        $event = new WidgetEvent();
        $this->trigger(self::EVENT_BEFORE_RUN, $event);
        return $event->isValid;
    }

    /**
     * This method is invoked right after a widget is executed.
     *
     * The method will trigger the [[EVENT_AFTER_RUN]] event. The return value of the method
     * will be used as the widget return value.
     *
     * If you override this method, your code should look like the following:
     *
     * ```php
     * public function afterRun($result)
     * {
     *     $result = parent::afterRun($result);
     *     // your custom code here
     *     return $result;
     * }
     * ```
     *
     * @param mixed $result the widget return result.
     * @return mixed the processed widget result.
     * @since 2.0.11
     */
    public function afterRun($result)
    {
        $event = new WidgetEvent();
        $event->result = $result;
        $this->trigger(self::EVENT_AFTER_RUN, $event);
        return $event->result;
    }
}


text:
cask 'font-iceland' do
  version :latest
  sha256 :no_check

  # github.com/google/fonts was verified as official when first introduced to the cask
  url 'https://github.com/google/fonts/raw/master/ofl/iceland/Iceland-Regular.ttf'
  name 'Iceland'
  homepage 'http://www.google.com/fonts/specimen/Iceland'

  font 'Iceland-Regular.ttf'
end


text:
# has-banner [![NPM version](https://img.shields.io/npm/v/has-banner.svg)](https://www.npmjs.com/package/has-banner) [![Build Status](https://img.shields.io/travis/jonschlinkert/has-banner.svg)](https://travis-ci.org/jonschlinkert/has-banner)

> Returns true if a file has a banner code comment. Used for linting.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install has-banner --save
```

## Usage

```js
var hasBanner = require('has-banner');

hasBanner('');
//=> 'true'

hasBanner('a/*! Copyright whatever */');
//=> 'false'
```

Pass an array of keywords to disqualify banners (`jshint` and `global` are already included)

```js
hasBanner('/*! jshint:foo */');
//=> false

hasBanner('/*! foo */', ['foo']);
//=> false
```

## Related projects

* [add-banner](https://www.npmjs.com/package/add-banner): Add a banner to a string. Banners are just Lo-Dash/underscore templates, if a custom one… [more](https://www.npmjs.com/package/add-banner) | [homepage](https://github.com/jonschlinkert/add-banner)
* [strip-banner](https://www.npmjs.com/package/strip-banner): Strip banners from code. | [homepage](https://github.com/jonschlinkert/strip-banner)
* [update-banner](https://www.npmjs.com/package/update-banner): Add or update a banner in a string. | [homepage](https://github.com/jonschlinkert/update-banner)
* [write-banner](https://www.npmjs.com/package/write-banner): Add a banner to any file. | [homepage](https://github.com/jonschlinkert/write-banner)

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/has-banner/issues/new).

## Building docs

Generate readme and API documentation with [verb](https://github.com/verbose/verb):

```sh
$ npm install verb && npm run docs
```

Or, if [verb](https://github.com/verbose/verb) is installed globally:

```sh
$ verb
```

## Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

## Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the [MIT license](https://github.com/jonschlinkert/has-banner/blob/master/LICENSE).

***

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 20, 2016._


text:
angular.module('googleChartApp', [])
  .controller('MainCtrl', [function() {
    var self = this;
    self.pieChartData = [
      {label: 'First', value: 25},
      {label: 'Second', value: 54},
      {label: 'Third', value: 75}
    ];

    self.pieChartConfig = {
      title: 'One Two Three Chart',
      firstColumnHeader: 'Counter',
      secondColumnHeader: 'Actual Value'
    };

    self.changeData = function() {
      self.pieChartData[1].value = 25;
    };
  }]);


text:
/*
* @Author: Vinxce
* @Date:   2015-10-26 20:14:36
* @Last Modified by:   Vinxce
* @Last Modified time: 2015-10-28 10:16:05
*/

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var passportLocalMongoose = require('passport-local-mongoose');

var allFields = 'id salt hash username email activated actCode rank socketId';

var Account = new Schema({
    username: {type: String, required: true, index: { unique: true}},
    email: {type: String, required: true, index: { unique: true}},
    activated: Boolean,
    actCode: String,
    socketId: String, //Current assigned socket
    rank: Number //0 - player, 1 - moderator, 2 - admin
});

Account.statics.findByName = function(name, cb) {
	return this.findOne({ username: name}, allFields, cb);
}

Account.statics.findByEmail = function(email, cb) {
	return this.findOne({ email: email}, allFields, cb);
}

Account.statics.activate = function(actCode, cb) {
	return this.findOneAndUpdate({ 'actCode': actCode }, { activated: true }, cb);
}

Account.plugin(passportLocalMongoose, {
	usernameQueryFields: ['username']
});

module.exports = mongoose.model('Account', Account);


text:
// http://docs.phonegap.com/en/2.8.0/guide_plugin-development_ios_index.md.html#Developing%20a%20Plugin%20on%20iOS

/*
 *
 *   - (void)myMethod:(CDVInvokedUrlCommand*)command;
 *
 */

#import <Foundation/Foundation.h>

#import <Cordova/CDVPlugin.h>
#import <StarIO/SMPort.h>
#import <StarIO_Extension/StarIoExtManager.h>

@interface StarIOPlugin : CDVPlugin <StarIoExtManagerDelegate> {}

@property (nonatomic) StarIoExtManager *starIoExtManager;

- (void)init:(CDVInvokedUrlCommand *)command;
- (void)portDiscovery:(CDVInvokedUrlCommand *)command;
- (void)checkStatus:(CDVInvokedUrlCommand *)command;
- (void)connect:(CDVInvokedUrlCommand *)command;
- (void)printReceipt:(CDVInvokedUrlCommand *)command;
@end


text:
(function () {
    'use strict';

    angular.module('app.controllers', []);

    // common
    require('./base.controller');
    require('./sidebar.controller');

    // login
    require('./auth/auth.controller');

    // client
    require('./client/client.controller');
    require('./client/client.create.controller');
    require('./client/client.view.controller');

    // employee
    require('./employee/employee.controller');
    require('./employee/employee.create.controller');
    require('./employee/employee.view.controller');

    // product
    require('./product/product.controller');
    require('./product/product.create.controller');
    require('./product/product.view.controller');

    // operator
    require('./operator/operator.controller');
    require('./operator/operator.create.controller');
    require('./operator/operator.view.controller');

    // profile
    require('./profile/profile.controller');
    require('./profile/profile.create.controller');
    require('./profile/profile.view.controller');

    // payment
    require('./payment/payment.controller');
    require('./payment/payment.create.controller');
    require('./payment/payment.view.controller');

    // consortium
    require('./consortium/consortium.controller');
    require('./consortium/consortium.create.controller');
    require('./consortium/consortium.view.controller');

})();


text:
package test.poa;

import static org.junit.Assert.assertTrue;

import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POAPackage.*;

import java.util.concurrent.CountDownLatch;

final class TestPOAManagerCommon extends test.common.TestBase {
    final static class TestHoldingState extends Thread {
        private Test test_;

        private final CountDownLatch startLatch = new CountDownLatch(1);
        public volatile Result result = null;

        public enum Result { SUCCESS, FAILURE, ERROR };

        TestHoldingState(Test test) {
            test_ = test;
        }

        public void run() {
            startLatch.countDown();
            try {
                test_.aMethod();
                result = Result.SUCCESS;
            } catch (TRANSIENT ex) {
                result = Result.FAILURE;
                return;
            } catch (SystemException ex) {
                result = Result.ERROR;
                System.err.println("Unexpected: " + ex);
                ex.printStackTrace();
            }
        }

        public void waitForStart() {
            do {
                try {
                    startLatch.await();
                    return;
                } catch (InterruptedException e) {
                }
            } while (true);
        }

        public void waitForEnd() {
            while (isAlive()) {
                try {
                    join();
                } catch (java.lang.InterruptedException e) {
                }
            }
        }
    }

    TestPOAManagerCommon(POAManagerProxy manager, TestInfo[] info) {
        for (int i = 0; i < info.length; i++) {
            try {
                manager.activate();
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            info[i].obj.aMethod();

            //
            // Try discard_request with wait completion == true,
            // shouldn't work since the discard_request call is done
            // through the POAManagerProxy.
            //
            try {
                manager.discard_requests(true);
                assertTrue(false);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            } catch (org.omg.CORBA.BAD_INV_ORDER e) {
                // Expected, ensure the state didn't change
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.ACTIVE);
            }

            //
            // Test discard_requests when active.
            //
            try {
                manager.discard_requests(false);
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.DISCARDING);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            try {
                info[i].obj.aMethod();
                assertTrue(false);
            } catch (TRANSIENT ex) {
                // Expected
            }

            try {
                manager.activate();
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            info[i].obj.aMethod();

            //
            // Try hold_request with wait completion == true,
            // shouldn't work since the hold_request call is done
            // through the POAManagerProxy.
            //
            try {
                manager.hold_requests(true);
                assertTrue(false);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            } catch (org.omg.CORBA.BAD_INV_ORDER e) {
                // Expected, ensure the state didn't change
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.ACTIVE);
            }

            //
            // Test hold_requests when active.
            //
            try {
                manager.hold_requests(false);
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.HOLDING);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            TestHoldingState t = new TestHoldingState(info[i].obj);
            t.start();
            t.waitForStart();

            try {
                manager.activate();
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }
            t.waitForEnd();
            assertTrue(t.result == TestHoldingState.Result.SUCCESS);

            //
            // Test discard_requests when holding.
            //
            try {
                manager.hold_requests(false);
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.HOLDING);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            t = new TestHoldingState(info[i].obj);
            t.start();
            t.waitForStart();
            try {
                manager.discard_requests(false);
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.DISCARDING);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            try {
                info[i].obj.aMethod();
                assertTrue(false);
            } catch (TRANSIENT ex) {
                // Expected
            }

            t.waitForEnd();
            //
            // Queued call should have been discarded.
            //
            assertTrue(t.result == TestHoldingState.Result.FAILURE);

            //
            // Test hold_requests when discarding.
            //
            try {
                manager.hold_requests(false);
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.HOLDING);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            t = new TestHoldingState(info[i].obj);
            t.start();
            t.waitForStart();

            try {
                manager.activate();
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            }

            t.waitForEnd();
            assertTrue(t.result == TestHoldingState.Result.SUCCESS);

            //
            // Try deactivate with wait completion == true,
            // shouldn't work since the hold_request call is done
            // through the POAManagerProxy.
            //
            try {
                manager.deactivate(true, true);
                assertTrue(false);
            } catch (test.poa.POAManagerProxyPackage.AdapterInactive ex) {
                assertTrue(false);
            } catch (org.omg.CORBA.BAD_INV_ORDER e) {
                // Expected, ensure the state didn't change
                assertTrue(manager.get_state() == test.poa.POAManagerProxyPackage.State.ACTIVE);
            }
        }
    }
}


text:
import numpy as np
from Takhsis import *

def CreateInitialLeague(CostFunction, nteams, nmain, nsubs, dim, domain, initial_domain):
    lower_bound, upper_bound = domain
    initial_lower_bound, initial_upper_bound = initial_domain

    if initial_lower_bound != None and initial_upper_bound != None:
        lower_bound = initial_lower_bound
        upper_bound = initial_upper_bound

    # League is splitted into two matrices, representing main and subs players of each team
    league_main = np.random.uniform(lower_bound,upper_bound,nteams*nmain*dim).reshape(nteams,nmain,dim)
    league_subs = np.random.uniform(lower_bound,upper_bound,nteams*nsubs*dim).reshape(nteams,nsubs,dim)

    # Fitness arrays
    fitness_main = np.apply_along_axis(CostFunction, 2, league_main)
    fitness_subs = np.apply_along_axis(CostFunction, 2, league_subs)
    initial_evals = nteams*nmain + nteams*nsubs

    # Now the 'Takhsis' is called for having the players sorted according to their fitness
    league_main,league_subs,fitness_main,fitness_subs = Takhsis(league_main, league_subs, fitness_main, fitness_subs)

    return league_main,league_subs,fitness_main,fitness_subs,initial_evals


text:
package diffboat.api;

import java.io.IOException;

import diffboat.model.Article;

public interface ArticleBuilder
{
    /**
     * Extract an article of a given URL.
     *
     * @param url
     *            Encoded URL to extract the {@link Article} from.
     * @return The same instance but with the URL defined to extract the article.
     */
    ArticleBuilder extractFrom(String url);

    /**
     * Return html instead of plain text.
     *
     * @return The same instance with the result defined as HTML.
     */
    ArticleBuilder asHtml();

    /**
     * Doesn't strip any inline ads.
     *
     * @return The same instance but with option to does not strip any inline ads.
     */
    ArticleBuilder dontStripAds();

    /**
     * Generate tags for the extracted story.
     *
     * @return The same instance configured to generate the tags of the article.
     */
    ArticleBuilder withTags();

    /**
     * Find the comments and identify count, link, etc.
     *
     * @return The same instance configured to find comments, links, etc.
     */
    ArticleBuilder withComments();

    /**
     * Returns a summary text of the article.
     *
     * @return The same instance configured to return a summary of the article.
     */
    ArticleBuilder withSummary();

    /**
     * Overrides the default API timeout of 5000ms.
     *
     * @param timeout
     *            The timeout in milliseconds.
     * @return The same instance configured the timeout.
     */
    ArticleBuilder withTimeout(long timeout);

    /**
     * Returns the {@link Article} according with the options defined. The default option is plain text output without comments but with a summary.
     *
     * @return the {@link Article} with the options defined. The default option is plain text output without comments but with a summary.
     * @throws IOException
     *             If the service is down or if there isn't a Internet connection.
     */
    Article analyze() throws IOException;
}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/compute/v1/compute.proto

namespace Google\Cloud\Compute\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A policy that specifies how requests intended for the route's backends are shadowed to a separate mirrored backend service. Loadbalancer does not wait for responses from the shadow service. Prior to sending traffic to the shadow service, the host / authority header is suffixed with -shadow.
 *
 * Generated from protobuf message google.cloud.compute.v1.RequestMirrorPolicy
 */
class RequestMirrorPolicy extends \Google\Protobuf\Internal\Message
{
    /**
     * The full or partial URL to the BackendService resource being mirrored to.
     *
     * Generated from protobuf field optional string backend_service = 306946058;
     */
    private $backend_service = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $backend_service
     *           The full or partial URL to the BackendService resource being mirrored to.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * The full or partial URL to the BackendService resource being mirrored to.
     *
     * Generated from protobuf field optional string backend_service = 306946058;
     * @return string
     */
    public function getBackendService()
    {
        return isset($this->backend_service) ? $this->backend_service : '';
    }

    public function hasBackendService()
    {
        return isset($this->backend_service);
    }

    public function clearBackendService()
    {
        unset($this->backend_service);
    }

    /**
     * The full or partial URL to the BackendService resource being mirrored to.
     *
     * Generated from protobuf field optional string backend_service = 306946058;
     * @param string $var
     * @return $this
     */
    public function setBackendService($var)
    {
        GPBUtil::checkString($var, True);
        $this->backend_service = $var;

        return $this;
    }

}


text:
package com.shinoow.abyssalcraft.common.blocks;

import java.util.Random;

import net.minecraft.block.BlockBush;
import net.minecraft.block.IGrowable;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;

import com.shinoow.abyssalcraft.AbyssalCraft;
import com.shinoow.abyssalcraft.common.world.gen.WorldGenDrT;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class Dreadsapling extends BlockBush implements IGrowable {

	public Dreadsapling()
	{
		super();
		float f = 0.4F;
		setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
		setCreativeTab(AbyssalCraft.tabDecoration);
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void registerBlockIcons(IIconRegister par1IconRegister)
	{
		blockIcon = par1IconRegister.registerIcon(AbyssalCraft.modid + ":" + "DrTS");
	}

	@Override
	public void updateTick(World world, int i, int j, int k, Random random)
	{
		if(world.isRemote)
		{
			super.updateTick(world, i, j, k, random);

			if(world.getBlockLightValue(i, j + 1, k) >= 9 && random.nextInt(7) == 0)
			{
				int l = world.getBlockMetadata(i, j, k);
				if((l & 8) == 0)
				{
					world.setBlockMetadataWithNotify(i, j, k, l | 8, l);
				} else
				{
					growTree(world, i, j, k, random);
				}
			}
		}
	}

	public void growTree(World world, int i, int j, int k, Random random)
	{
		int l = world.getBlockMetadata(i, j, k) & 3;
		world.setBlock(i, j, k, Blocks.air, 0, l);
		Object obj = null;
		obj = new WorldGenDrT(true);
		if(!((WorldGenerator) obj).generate(world, random, i, j, k))
		{
			world.setBlock(i, j, k, this, l, l);
		}
	}

	public void fertilize(World world, int x, int y, int z)
	{

	}

	@Override
	public boolean func_149851_a(World var1, int var2, int var3, int var4,
			boolean var5) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean func_149852_a(World var1, Random var2, int var3, int var4,
			int var5) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void func_149853_b(World var1, Random var2, int var3, int var4,
			int var5) {
		// TODO Auto-generated method stub

	}
}


text:
typedef struct game_state game_state;

struct game_state
{
    int should_quit;

    real32 time_wall;
    real32 time_frame;

    mouse_state mouse;
    keyboard_state keyboard;

    int screen_width;
    int screen_height;

    int initialized;

    shader_program textured;
    shader_program colored;
    shader_program text;
    shader_program visualize_colors;
    shader_program visualize_normals;
    shader_program visualize_texcoords;
    shader_program sky_shader;
    shader_program postfx_test;

    render_queue render_queue;

    text_renderer text_renderer;

    loaded_mesh cube;
    loaded_mesh quad;
    loaded_mesh cup;
    loaded_mesh skybox;

    loaded_texture checker;

    loaded_font deja_vu;
    loaded_font deja_vu_mono;

    material cup_material;
    material text_background;
    material sky_material;
    material postfx;

    terrain terrain;

    vector3 camera_position;
    vector3 camera_pitch_yaw_roll;
    vector3 camera_forward;

    int created_cube_count;
    vector3 created_cube_positions[MAX_CUBES];

    render_target scene_target;

    bool32 display_profiler;
    profiler_frame* frame_stats;
};

void
game_update_and_render(struct game_state* state);

#endif // RACERA_H_INCLUDED


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2017 Evolveum and contributors
  ~
  ~ This work is dual-licensed under the Apache License 2.0
  ~ and European Union Public License. See LICENSE file for details.
  -->

<root xmlns="http://example.com/xml/ns/test/root.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <name>foo</name>
    <foo>
        <foo>FOOBAR</foo>
        <bar>42</bar>
        <barbar>Connan</barbar>
        <barbar>Hogun</barbar>
    </foo>
    <!--
    <password><c:clearValue>supersecret</c:clearValue></password>
     -->
</root>


text:
'use strict';

// MODULES //

var isPositive = require( 'validate.io-positive-primitive' );

// SKEWNESS //

/**
* FUNCTION skewness( lambda )
*	Computes the distribution skewness for a exponential distribution with parameter lambda.
*
* @param {Number} lambda - rate parameter
* @returns {Number} distribution skewness
*/
function skewness( lambda ) {
	if ( !isPositive( lambda ) ) {
		return NaN;
	}
	return 2;
} // end FUNCTION skewness()

// EXPORTS

module.exports =  skewness;


text:
package com.gmind7.bakery.config;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

import com.gmind7.bakery.handler.SSMCacheConfigurationFactory;
import com.google.code.ssm.config.AddressProvider;
import com.google.code.ssm.config.DefaultAddressProvider;
import com.google.code.ssm.providers.CacheClientFactory;
import com.google.code.ssm.providers.CacheConfiguration;
import com.google.code.ssm.providers.spymemcached.MemcacheClientFactoryImpl;
import com.google.code.ssm.spring.SSMCache;
import com.google.code.ssm.spring.SSMCacheManager;

/**
 *
 * @Class Name   : AbstractSSMSpringCacheConfig.java
 * @Description  : @Configuration, @EnableCaching
 * @Modification :
 * @author       : gmind7 <gmind7@gmail.com>
 * @since        : 2013. 12. 30.
 */
public abstract class AbstractSSMSpringCacheConfig {

	@Inject
	private Environment environment;

	@Autowired
	private SSMCacheConfigurationFactory[] cacheConfigurationFactory;

	@Bean
	public SSMCacheManager ssmCacheManager() throws Exception{

		SSMCacheManager ssmCacheManager = new SSMCacheManager();

		Set<SSMCache> cachePool = new HashSet<SSMCache>();

		for (SSMCacheConfigurationFactory cacheFactory : this.cacheConfigurationFactory) {
			Set<SSMCache> cacheMap = cacheFactory.ssmCaches();
			Iterator<SSMCache> iterator = cacheMap.iterator();
			while(iterator.hasNext()){
				cachePool.add((SSMCache)iterator.next());
			}
        }
		ssmCacheManager.setCaches(cachePool);

		return ssmCacheManager;
	}

	@Bean
	public CacheClientFactory cacheClientFactory(){
		return new MemcacheClientFactoryImpl();
	}

	@Bean
	public AddressProvider addressProvider(){
		DefaultAddressProvider defaultAddressProvider = new DefaultAddressProvider();
		defaultAddressProvider.setAddress(environment.getRequiredProperty("memcached.addresses"));
		return defaultAddressProvider;
	}

	@Bean
	public CacheConfiguration configuration(){
		CacheConfiguration cacheConfiguration = new CacheConfiguration();
		cacheConfiguration.setConsistentHashing(true);
		return cacheConfiguration;
	}

	/**
	 * @Bean
	 * @return this.ssmCacheManager();
	 */
	public abstract SSMCacheManager cacheManager();
}


text:
title: "Semi-supervised Classification using Attention-based Regularization on Coarse-resolution Data"
collection: publications
permalink: /publication/2020-05-05-SDM
date: 2020-05-05
venue: 'SIAM International Conference on Data Mining'
---
This paper is about SDM.

[Download paper here](https://epubs.siam.org/doi/10.1137/1.9781611976236.29)

BibTeX:
```
@inproceedings{nayak2020semi,
  title={Semi-supervised Classification using Attention-based Regularization on Coarse-resolution Data},
  author={Nayak, Guruprasad and Ghosh, Rahul and Jia, Xiaowei and Mithafi, Varun and Kumar, Vipin},
  booktitle={Proceedings of the 2020 SIAM International Conference on Data Mining},
  pages={253--261},
  year={2020},
  organization={SIAM}
}
```


text:
from django import forms
from userprofile.models import UserProfile

class UserProfileForm(forms.ModelForm):
    class Meta:
        model = UserProfile
        exclude = ('user','user_type','logins',)


text:
describe 'group operations' do
  it "invokes group operations" do
    puts "create group"
    group = BOX_CLIENT.create_group(TEST_GROUP_NAME)
    expect(group.name).to eq(TEST_GROUP_NAME)

    puts "inspect groups"
    groups = BOX_CLIENT.groups
    test_group = groups.find{|g| g.name == TEST_GROUP_NAME}
    expect(test_group).to_not be_nil

    puts "get group info"
    group_info = BOX_CLIENT.group(test_group)
    expect(group_info.id).to eq(test_group.id)

    puts "update group"
    new_name = "Test Boxr Group Renamed"
    group = BOX_CLIENT.update_group(test_group, new_name)
    expect(group.name).to eq(new_name)
    group = BOX_CLIENT.rename_group(test_group,TEST_GROUP_NAME)
    expect(group.name).to eq(TEST_GROUP_NAME)

    puts "add user to group"
    group_membership = BOX_CLIENT.add_user_to_group(@test_user, test_group)
    expect(group_membership.user.id).to eq(@test_user.id)
    expect(group_membership.group.id).to eq(test_group.id)
    membership = group_membership

    puts "inspect group membership"
    group_membership = BOX_CLIENT.group_membership(membership)
    expect(group_membership.id).to eq(membership.id)

    puts "inspect group memberships"
    group_memberships = BOX_CLIENT.group_memberships(test_group)
    expect(group_memberships.count).to eq(1)
    expect(group_memberships.first.id).to eq(membership.id)

    puts "inspect group memberships for a user"
    group_memberships = BOX_CLIENT.group_memberships_for_user(@test_user)
    expect(group_memberships.count).to eq(1)
    expect(group_memberships.first.id).to eq(membership.id)

    puts "inspect group memberships for me"
    #this is whatever user your developer token is tied to
    group_memberships = BOX_CLIENT.group_memberships_for_me
    expect(group_memberships).to be_a(Array)

    puts "update group membership"
    group_membership = BOX_CLIENT.update_group_membership(membership, :admin)
    expect(group_membership.role).to eq("admin")

    puts "delete group membership"
    result = BOX_CLIENT.delete_group_membership(membership)
    expect(result).to eq({})
    group_memberships = BOX_CLIENT.group_memberships_for_user(@test_user)
    expect(group_memberships.count).to eq(0)

    puts "delete group"
    response = BOX_CLIENT.delete_group(test_group)
    expect(response).to eq({})
  end
end


text:
package com.sean.service.ext;

import java.util.regex.Pattern;

import com.sean.service.entity.ParameterEntity;

/**
 * yyyy-mm-dd日期参数验证
 * @author Sean
 *
 */
public class YYYYMMDDDateChecker implements ParameterChecker
{
	private final Pattern pattern = Pattern.compile("[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}");

	@Override
	public boolean check(String val, ParameterEntity param)
	{
		if (val != null && !val.isEmpty())
		{
			return pattern.matcher(val).matches();
		}
		return false;
	}
}


text:
package gobblin.util;

import java.io.Closeable;

/**
 * A {@link Closeable} that does nothing.
 */
public class NoopCloseable implements Closeable {

  public static NoopCloseable INSTANCE = new NoopCloseable();

  @Override
  public void close() {
    // Do nothing
  }
}


text:
<?php
/**
 * Core component classes.
 *
 * @package BuddyPress
 * @subpackage Core
 * @since 1.7.0
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * BuddyPress User Query class.
 *
 * Used for querying users in a BuddyPress context, in situations where WP_User_Query won't do the trick:
 * Member directories, the Friends component, etc.
 *
 * @since 1.7.0
 *
 * @param array $query {
 *     Query arguments. All items are optional.
 *     @type string            $type                Determines sort order. Select from 'newest', 'active', 'online',
 *                                                  'random', 'popular', 'alphabetical'. Default: 'newest'.
 *     @type int               $per_page            Number of results to return. Default: 0 (no limit).
 *     @type int               $page                Page offset (together with $per_page). Default: 1.
 *     @type int               $user_id             ID of a user. If present, and if the friends component is activated,
 *                                                  results will be limited to the friends of that user. Default: 0.
 *     @type string|bool       $search_terms        Terms to search by. Search happens across xprofile fields. Requires
 *                                                  XProfile component. Default: false.
 *     @type string            $search_wildcard     When searching with $search_terms, set where wildcards around the
 *                                                  term should be positioned. Accepts 'both', 'left', 'right'.
 *                                                  Default: 'both'.
 *     @type array|string|bool $include             An array or comma-separated list of user IDs to which query should
 *                                                  be limited. Default: false.
 *     @type array|string|bool $exclude             An array or comma-separated list of user IDs that will be excluded
 *                                                  from query results. Default: false.
 *     @type array|string|bool $user_ids            An array or comma-separated list of IDs corresponding to the users
 *                                                  that should be returned. When this parameter is passed, it will
 *                                                  override all others; BP User objects will be constructed using these
 *                                                  IDs only. Default: false.
 *     @type array|string      $member_type         Array or comma-separated list of member types to limit results to.
 *     @type array|string      $member_type__in     Array or comma-separated list of member types to limit results to.
 *     @type array|string      $member_type__not_in Array or comma-separated list of member types that will be
 *			                                             excluded from results.
 *     @type string|bool       $meta_key            Limit results to users that have usermeta associated with this meta_key.
 *                                                  Usually used with $meta_value. Default: false.
 *     @type string|bool       $meta_value          When used with $meta_key, limits results to users whose usermeta value
 *                                                  associated with $meta_key matches $meta_value. Default: false.
 *     @type array             $xprofile_query      Filter results by xprofile data. Requires the xprofile component.
 *                                                  See {@see BP_XProfile_Query} for details.
 *     @type bool              $populate_extras     True if you want to fetch extra metadata
 *                                                  about returned users, such as total group and friend counts.
 *     @type string            $count_total         Determines how BP_User_Query will do a count of total users matching
 *                                                  the other filter criteria. Default value is 'count_query', which
 *                                                  does a separate SELECT COUNT query to determine the total.
 *                                                  'sql_count_found_rows' uses SQL_COUNT_FOUND_ROWS and
 *                                                  SELECT FOUND_ROWS(). Pass an empty string to skip the total user
 *                                                  count query.
 * }
 */
class BP_User_Query {

	/** Variables *************************************************************/

	/**
	 * Unaltered params as passed to the constructor.
	 *
	 * @since 1.8.0
	 * @var array
	 */
	public $query_vars_raw = array();

	/**
	 * Array of variables to query with.
	 *
	 * @since 1.7.0
	 * @var array
	 */
	public $query_vars = array();

	/**
	 * List of found users and their respective data.
	 *
	 * @since 1.7.0
	 * @var array
	 */
	public $results = array();

	/**
	 * Total number of found users for the current query.
	 *
	 * @since 1.7.0
	 * @var int
	 */
	public $total_users = 0;

	/**
	 * List of found user IDs.
	 *
	 * @since 1.7.0
	 * @var array
	 */
	public $user_ids = array();

	/**
	 * SQL clauses for the user ID query.
	 *
	 * @since 1.7.0
	 * @var array
	 */
	public $uid_clauses = array();

	/**
	 * SQL table where the user ID is being fetched from.
	 *
	 * @since 2.2.0
	 * @var string
	 */
	public $uid_table = '';

	/**
	 * SQL database column name to order by.
	 *
	 * @since 1.7.0
	 * @var string
	 */
	public $uid_name = '';

	/**
	 * Standard response when the query should not return any rows.
	 *
	 * @since 1.7.0
	 * @var string
	 */
	protected $no_results = array( 'join' => '', 'where' => '0 = 1' );

	/** Methods ***************************************************************/

	/**
	 * Constructor.
	 *
	 * @since 1.7.0
	 *
	 * @param string|array|null $query See {@link BP_User_Query}.
	 */
	public function __construct( $query = null ) {

		// Store the raw query vars for later access.
		$this->query_vars_raw = $query;

		// Allow extending classes to register action/filter hooks.
		$this->setup_hooks();

		if ( ! empty( $this->query_vars_raw ) ) {
			$this->query_vars = wp_parse_args( $this->query_vars_raw, array(
				'type'                => 'newest',
				'per_page'            => 0,
				'page'                => 1,
				'user_id'             => 0,
				'search_terms'        => false,
				'search_wildcard'     => 'both',
				'include'             => false,
				'exclude'             => false,
				'user_ids'            => false,
				'member_type'         => '',
				'member_type__in'     => '',
				'member_type__not_in' => '',
				'meta_key'            => false,
				'meta_value'          => false,
				'xprofile_query'      => false,
				'populate_extras'     => true,
				'count_total'         => 'count_query'
			) );

			/**
			 * Fires before the construction of the BP_User_Query query.
			 *
			 * @since 1.7.0
			 *
			 * @param BP_User_Query $this Current instance of the BP_User_Query. Passed by reference.
			 */
			do_action_ref_array( 'bp_pre_user_query_construct', array( &$this ) );

			// Get user ids
			// If the user_ids param is present, we skip the query.
			if ( false !== $this->query_vars['user_ids'] ) {
				$this->user_ids = wp_parse_id_list( $this->query_vars['user_ids'] );
			} else {
				$this->prepare_user_ids_query();
				$this->do_user_ids_query();
			}
		}

		// Bail if no user IDs were found.
		if ( empty( $this->user_ids ) ) {
			return;
		}

		// Fetch additional data. First, using WP_User_Query.
		$this->do_wp_user_query();

		// Get BuddyPress specific user data.
		$this->populate_extras();
	}

	/**
	 * Allow extending classes to set up action/filter hooks.
	 *
	 * When extending BP_User_Query, you may need to use some of its
	 * internal hooks to modify the output. It's not convenient to call
	 * add_action() or add_filter() in your class constructor, because
	 * BP_User_Query::__construct() contains a fair amount of logic that
	 * you may not want to override in your class. Define this method in
	 * your own class if you need a place where your extending class can
	 * add its hooks early in the query-building process. See
	 * {@link BP_Group_Member_Query::setup_hooks()} for an example.
	 *
	 * @since 1.8.0
	 */
	public function setup_hooks() {}

	/**
	 * Prepare the query for user_ids.
	 *
	 * @since 1.7.0
	 */
	public function prepare_user_ids_query() {
		global $wpdb;

		$bp = buddypress();

		// Default query variables used here.
		$type         = '';
		$per_page     = 0;
		$page         = 1;
		$user_id      = 0;
		$include      = false;
		$search_terms = false;
		$exclude      = false;
		$meta_key     = false;
		$meta_value   = false;

		extract( $this->query_vars );

		// Setup the main SQL query container.
		$sql = array(
			'select'  => '',
			'where'   => array(),
			'orderby' => '',
			'order'   => '',
			'limit'   => ''
		);

		/* TYPE **************************************************************/

		// Determines the sort order, which means it also determines where the
		// user IDs are drawn from (the SELECT and WHERE statements).
		switch ( $type ) {

			// 'online' query happens against the last_activity usermeta key
			// Filter 'bp_user_query_online_interval' to modify the
			// number of minutes used as an interval.
			case 'online' :
				$this->uid_name = 'user_id';
				$this->uid_table = $bp->members->table_name_last_activity;
				$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
				$sql['where'][] = $wpdb->prepare( "u.component = %s AND u.type = 'last_activity'", buddypress()->members->id );

				/**
				 * Filters the threshold for activity timestamp minutes since to indicate online status.
				 *
				 * @since 1.8.0
				 *
				 * @param int $value Amount of minutes for threshold. Default 15.
				 */
				$sql['where'][] = $wpdb->prepare( "u.date_recorded >= DATE_SUB( UTC_TIMESTAMP(), INTERVAL %d MINUTE )", apply_filters( 'bp_user_query_online_interval', 15 ) );
				$sql['orderby'] = "ORDER BY u.date_recorded";
				$sql['order']   = "DESC";

				break;

			// 'active', 'newest', and 'random' queries
			// all happen against the last_activity usermeta key.
			case 'active' :
			case 'newest' :
			case 'random' :
				$this->uid_name = 'user_id';
				$this->uid_table = $bp->members->table_name_last_activity;
				$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
				$sql['where'][] = $wpdb->prepare( "u.component = %s AND u.type = 'last_activity'", buddypress()->members->id );

				if ( 'newest' == $type ) {
					$sql['orderby'] = "ORDER BY u.user_id";
					$sql['order'] = "DESC";
				} elseif ( 'random' == $type ) {
					$sql['orderby'] = "ORDER BY rand()";
				} else {
					$sql['orderby'] = "ORDER BY u.date_recorded";
					$sql['order'] = "DESC";
				}

				break;

			// 'popular' sorts by the 'total_friend_count' usermeta.
			case 'popular' :
				$this->uid_name = 'user_id';
				$this->uid_table = $wpdb->usermeta;
				$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
				$sql['where'][] = $wpdb->prepare( "u.meta_key = %s", bp_get_user_meta_key( 'total_friend_count' ) );
				$sql['orderby'] = "ORDER BY CONVERT(u.meta_value, SIGNED)";
				$sql['order']   = "DESC";

				break;

			// 'alphabetical' sorts depend on the xprofile setup.
			case 'alphabetical' :

				// We prefer to do alphabetical sorts against the display_name field
				// of wp_users, because the table is smaller and better indexed. We
				// can do so if xprofile sync is enabled, or if xprofile is inactive.
				//
				// @todo remove need for bp_is_active() check.
				if ( ! bp_disable_profile_sync() || ! bp_is_active( 'xprofile' ) ) {
					$this->uid_name = 'ID';
					$this->uid_table = $wpdb->users;
					$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
					$sql['orderby'] = "ORDER BY u.display_name";
					$sql['order']   = "ASC";

				// When profile sync is disabled, alphabetical sorts must happen against
				// the xprofile table.
				} else {
					$this->uid_name = 'user_id';
					$this->uid_table = $bp->profile->table_name_data;
					$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
					$sql['where'][] = $wpdb->prepare( "u.field_id = %d", bp_xprofile_fullname_field_id() );
					$sql['orderby'] = "ORDER BY u.value";
					$sql['order']   = "ASC";
				}

				// Alphabetical queries ignore last_activity, while BP uses last_activity
				// to infer spam/deleted/non-activated users. To ensure that these users
				// are filtered out, we add an appropriate sub-query.
				$sql['where'][] = "u.{$this->uid_name} IN ( SELECT ID FROM {$wpdb->users} WHERE " . bp_core_get_status_sql( '' ) . " )";

				break;

			// Any other 'type' falls through.
			default :
				$this->uid_name = 'ID';
				$this->uid_table = $wpdb->users;
				$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";

				// In this case, we assume that a plugin is
				// handling order, so we leave those clauses
				// blank.
				break;
		}

		/* WHERE *************************************************************/

		// 'include' - User ids to include in the results.
		$include     = false !== $include ? wp_parse_id_list( $include ) : array();
		$include_ids = $this->get_include_ids( $include );

		// An array containing nothing but 0 should always fail.
		if ( 1 === count( $include_ids ) && 0 == reset( $include_ids ) ) {
			$sql['where'][] = $this->no_results['where'];
		} elseif ( ! empty( $include_ids ) ) {
			$include_ids    = implode( ',', wp_parse_id_list( $include_ids ) );
			$sql['where'][] = "u.{$this->uid_name} IN ({$include_ids})";
		}

		// 'exclude' - User ids to exclude from the results.
		if ( false !== $exclude ) {
			$exclude_ids    = implode( ',', wp_parse_id_list( $exclude ) );
			$sql['where'][] = "u.{$this->uid_name} NOT IN ({$exclude_ids})";
		}

		// 'user_id' - When a user id is passed, limit to the friends of the user
		// @todo remove need for bp_is_active() check.
		if ( ! empty( $user_id ) && bp_is_active( 'friends' ) ) {
			$friend_ids = friends_get_friend_user_ids( $user_id );
			$friend_ids = implode( ',', wp_parse_id_list( $friend_ids ) );

			if ( ! empty( $friend_ids ) ) {
				$sql['where'][] = "u.{$this->uid_name} IN ({$friend_ids})";

			// If the user has no friends, the query should always
			// return no users.
			} else {
				$sql['where'][] = $this->no_results['where'];
			}
		}

		/* Search Terms ******************************************************/

		// 'search_terms' searches user_login and user_nicename
		// xprofile field matches happen in bp_xprofile_bp_user_query_search().
		if ( false !== $search_terms ) {
			$search_terms = bp_esc_like( wp_kses_normalize_entities( $search_terms ) );

			if ( $search_wildcard === 'left' ) {
				$search_terms_nospace = '%' . $search_terms;
				$search_terms_space   = '%' . $search_terms . ' %';
			} elseif ( $search_wildcard === 'right' ) {
				$search_terms_nospace =        $search_terms . '%';
				$search_terms_space   = '% ' . $search_terms . '%';
			} else {
				$search_terms_nospace = '%' . $search_terms . '%';
				$search_terms_space   = '%' . $search_terms . '%';
			}

			$sql['where']['search'] = $wpdb->prepare(
				"u.{$this->uid_name} IN ( SELECT ID FROM {$wpdb->users} WHERE ( user_login LIKE %s OR user_login LIKE %s OR user_nicename LIKE %s OR user_nicename LIKE %s ) )",
				$search_terms_nospace,
				$search_terms_space,
				$search_terms_nospace,
				$search_terms_space
			);
		}

		// Only use $member_type__in if $member_type is not set.
		if ( empty( $member_type ) && ! empty( $member_type__in ) ) {
			$member_type = $member_type__in;
		}

		// Member types to exclude. Note that this takes precedence over inclusions.
		if ( ! empty( $member_type__not_in ) ) {
			$member_type_clause = $this->get_sql_clause_for_member_types( $member_type__not_in, 'NOT IN' );

		// Member types to include.
		} elseif ( ! empty( $member_type ) ) {
			$member_type_clause = $this->get_sql_clause_for_member_types( $member_type, 'IN' );
		}

		if ( ! empty( $member_type_clause ) ) {
			$sql['where']['member_type'] = $member_type_clause;
		}

		// 'meta_key', 'meta_value' allow usermeta search
		// To avoid global joins, do a separate query.
		if ( false !== $meta_key ) {
			$meta_sql = $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = %s", $meta_key );

			if ( false !== $meta_value ) {
				$meta_sql .= $wpdb->prepare( " AND meta_value = %s", $meta_value );
			}

			$found_user_ids = $wpdb->get_col( $meta_sql );

			if ( ! empty( $found_user_ids ) ) {
				$sql['where'][] = "u.{$this->uid_name} IN (" . implode( ',', wp_parse_id_list( $found_user_ids ) ) . ")";
			} else {
				$sql['where'][] = '1 = 0';
			}
		}

		// 'per_page', 'page' - handles LIMIT.
		if ( !empty( $per_page ) && !empty( $page ) ) {
			$sql['limit'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
		} else {
			$sql['limit'] = '';
		}

		/**
		 * Filters the clauses for the user query.
		 *
		 * @since 2.0.0
		 *
		 * @param array         $sql  Array of SQL clauses to be used in the query.
		 * @param BP_User_Query $this Current BP_User_Query instance.
		 */
		$sql = apply_filters_ref_array( 'bp_user_query_uid_clauses', array( $sql, &$this ) );

		// Assemble the query chunks.
		$this->uid_clauses['select']  = $sql['select'];
		$this->uid_clauses['where']   = ! empty( $sql['where'] ) ? 'WHERE ' . implode( ' AND ', $sql['where'] ) : '';
		$this->uid_clauses['orderby'] = $sql['orderby'];
		$this->uid_clauses['order']   = $sql['order'];
		$this->uid_clauses['limit']   = $sql['limit'];

		/**
		 * Fires before the BP_User_Query query is made.
		 *
		 * @since 1.7.0
		 *
		 * @param BP_User_Query $this Current BP_User_Query instance. Passed by reference.
		 */
		do_action_ref_array( 'bp_pre_user_query', array( &$this ) );
	}

	/**
	 * Query for IDs of users that match the query parameters.
	 *
	 * Perform a database query to specifically get only user IDs, using
	 * existing query variables set previously in the constructor.
	 *
	 * Also used to quickly perform user total counts.
	 *
	 * @since 1.7.0
	 */
	public function do_user_ids_query() {
		global $wpdb;

		// If counting using SQL_CALC_FOUND_ROWS, set it up here.
		if ( 'sql_calc_found_rows' == $this->query_vars['count_total'] ) {
			$this->uid_clauses['select'] = str_replace( 'SELECT', 'SELECT SQL_CALC_FOUND_ROWS', $this->uid_clauses['select'] );
		}

		// Get the specific user ids.
		$this->user_ids = $wpdb->get_col( "{$this->uid_clauses['select']} {$this->uid_clauses['where']} {$this->uid_clauses['orderby']} {$this->uid_clauses['order']} {$this->uid_clauses['limit']}" );

		// Get the total user count.
		if ( 'sql_calc_found_rows' == $this->query_vars['count_total'] ) {

			/**
			 * Filters the found user SQL statements before query.
			 *
			 * If "sql_calc_found_rows" is the provided count_total query var
			 * then the value will be "SELECT FOUND_ROWS()". Otherwise it will
			 * use a "SELECT COUNT()" query statement.
			 *
			 * @since 1.7.0
			 *
			 * @param string        $value SQL statement to select FOUND_ROWS().
			 * @param BP_User_Query $this  Current BP_User_Query instance.
			 */
			$this->total_users = $wpdb->get_var( apply_filters( 'bp_found_user_query', "SELECT FOUND_ROWS()", $this ) );
		} elseif ( 'count_query' == $this->query_vars['count_total'] ) {
			$count_select      = preg_replace( '/^SELECT.*?FROM (\S+) u/', "SELECT COUNT(u.{$this->uid_name}) FROM $1 u", $this->uid_clauses['select'] );

			/** This filter is documented in bp-core/classes/class-bp-user-query.php */
			$this->total_users = $wpdb->get_var( apply_filters( 'bp_found_user_query', "{$count_select} {$this->uid_clauses['where']}", $this ) );
		}
	}

	/**
	 * Use WP_User_Query() to pull data for the user IDs retrieved in the main query.
	 *
	 * @since 1.7.0
	 */
	public function do_wp_user_query() {
		$fields = array( 'ID', 'user_login', 'user_pass', 'user_nicename', 'user_email', 'user_url', 'user_registered', 'user_activation_key', 'user_status', 'display_name' );

		if ( is_multisite() ) {
			$fields[] = 'spam';
			$fields[] = 'deleted';
		}

		/**
		 * Filters the WP User Query arguments before passing into the class.
		 *
		 * @since 1.7.0
		 *
		 * @param array         $value Array of arguments for the user query.
		 * @param BP_User_Query $this  Current BP_User_Query instance.
		 */
		$wp_user_query = new WP_User_Query( apply_filters( 'bp_wp_user_query_args', array(

			// Relevant.
			'fields'      => $fields,
			'include'     => $this->user_ids,

			// Overrides
			'blog_id'     => 0,    // BP does not require blog roles.
			'count_total' => false // We already have a count.

		), $this ) );

		// WP_User_Query doesn't cache the data it pulls from wp_users,
		// and it does not give us a way to save queries by fetching
		// only uncached users. However, BP does cache this data, so
		// we set it here.
		foreach ( $wp_user_query->results as $u ) {
			wp_cache_set( 'bp_core_userdata_' . $u->ID, $u, 'bp' );
		}

		// We calculate total_users using a standalone query, except
		// when a whitelist of user_ids is passed to the constructor.
		// This clause covers the latter situation, and ensures that
		// pagination works when querying by $user_ids.
		if ( empty( $this->total_users ) ) {
			$this->total_users = count( $wp_user_query->results );
		}

		// Reindex for easier matching.
		$r = array();
		foreach ( $wp_user_query->results as $u ) {
			$r[ $u->ID ] = $u;
		}

		// Match up to the user ids from the main query.
		foreach ( $this->user_ids as $key => $uid ) {
			if ( isset( $r[ $uid ] ) ) {
				$r[ $uid ]->ID = (int) $uid;
				$r[ $uid ]->user_status = (int) $r[ $uid ]->user_status;

				$this->results[ $uid ] = $r[ $uid ];

				// The BP template functions expect an 'id'
				// (as opposed to 'ID') property.
				$this->results[ $uid ]->id = (int) $uid;

			// Remove user ID from original user_ids property.
			} else {
				unset( $this->user_ids[ $key ] );
			}
		}
	}

	/**
	 * Fetch the IDs of users to put in the IN clause of the main query.
	 *
	 * By default, returns the value passed to it
	 * ($this->query_vars['include']). Having this abstracted into a
	 * standalone method means that extending classes can override the
	 * logic, parsing together their own user_id limits with the 'include'
	 * ids passed to the class constructor. See {@link BP_Group_Member_Query}
	 * for an example.
	 *
	 * @since 1.8.0
	 *
	 * @param array $include Sanitized array of user IDs, as passed to the 'include'
	 *                       parameter of the class constructor.
	 * @return array The list of users to which the main query should be
	 *               limited.
	 */
	public function get_include_ids( $include = array() ) {
		return $include;
	}

	/**
	 * Perform a database query to populate any extra metadata we might need.
	 *
	 * Different components will hook into the 'bp_user_query_populate_extras'
	 * action to loop in the things they want.
	 *
	 * @since 1.7.0
	 *
	 * @global WPDB $wpdb Global WordPress database access object.
	 */
	public function populate_extras() {
		global $wpdb;

		// Bail if no users.
		if ( empty( $this->user_ids ) || empty( $this->results ) ) {
			return;
		}

		// Bail if the populate_extras flag is set to false
		// In the case of the 'popular' sort type, we force
		// populate_extras to true, because we need the friend counts.
		if ( 'popular' == $this->query_vars['type'] ) {
			$this->query_vars['populate_extras'] = 1;
		}

		if ( ! (bool) $this->query_vars['populate_extras'] ) {
			return;
		}

		// Turn user ID's into a query-usable, comma separated value.
		$user_ids_sql = implode( ',', wp_parse_id_list( $this->user_ids ) );

		/**
		 * Allows users to independently populate custom extras.
		 *
		 * Note that anything you add here should query using $user_ids_sql, to
		 * avoid running multiple queries per user in the loop.
		 *
		 * Two BuddyPress components currently do this:
		 * - XProfile: To override display names.
		 * - Friends:  To set whether or not a user is the current users friend.
		 *
		 * @see bp_xprofile_filter_user_query_populate_extras()
		 * @see bp_friends_filter_user_query_populate_extras()
		 *
		 * @since 1.7.0
		 *
		 * @param BP_User_Query $this         Current BP_User_Query instance.
		 * @param string        $user_ids_sql Comma-separated string of user IDs.
		 */
		do_action_ref_array( 'bp_user_query_populate_extras', array( $this, $user_ids_sql ) );

		// Fetch last_active data from the activity table.
		$last_activities = BP_Core_User::get_last_activity( $this->user_ids );

		// Set a last_activity value for each user, even if it's empty.
		foreach ( $this->results as $user_id => $user ) {
			$user_last_activity = isset( $last_activities[ $user_id ] ) ? $last_activities[ $user_id ]['date_recorded'] : '';
			$this->results[ $user_id ]->last_activity = $user_last_activity;
		}

		// Fetch usermeta data
		// We want the three following pieces of info from usermeta:
		// - friend count
		// - latest update.
		$total_friend_count_key = bp_get_user_meta_key( 'total_friend_count' );
		$bp_latest_update_key   = bp_get_user_meta_key( 'bp_latest_update'   );

		// Total_friend_count must be set for each user, even if its
		// value is 0.
		foreach ( $this->results as $uindex => $user ) {
			$this->results[$uindex]->total_friend_count = 0;
		}

		// Create, prepare, and run the separate usermeta query.
		$user_metas = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, meta_key, meta_value FROM {$wpdb->usermeta} WHERE meta_key IN (%s,%s) AND user_id IN ({$user_ids_sql})", $total_friend_count_key, $bp_latest_update_key ) );

		// The $members_template global expects the index key to be different
		// from the meta_key in some cases, so we rejig things here.
		foreach ( $user_metas as $user_meta ) {
			switch ( $user_meta->meta_key ) {
				case $total_friend_count_key :
					$key = 'total_friend_count';
					break;

				case $bp_latest_update_key :
					$key = 'latest_update';
					break;
			}

			if ( isset( $this->results[ $user_meta->user_id ] ) ) {
				$this->results[ $user_meta->user_id ]->{$key} = $user_meta->meta_value;
			}
		}

		// When meta_key or meta_value have been passed to the query,
		// fetch the resulting values for use in the template functions.
		if ( ! empty( $this->query_vars['meta_key'] ) ) {
			$meta_sql = array(
				'select' => "SELECT user_id, meta_key, meta_value",
				'from'   => "FROM $wpdb->usermeta",
				'where'  => $wpdb->prepare( "WHERE meta_key = %s", $this->query_vars['meta_key'] )
			);

			if ( false !== $this->query_vars['meta_value'] ) {
				$meta_sql['where'] .= $wpdb->prepare( " AND meta_value = %s", $this->query_vars['meta_value'] );
			}

			$metas = $wpdb->get_results( "{$meta_sql['select']} {$meta_sql['from']} {$meta_sql['where']}" );

			if ( ! empty( $metas ) ) {
				foreach ( $metas as $meta ) {
					if ( isset( $this->results[ $meta->user_id ] ) ) {
						$this->results[ $meta->user_id ]->meta_key = $meta->meta_key;

						if ( ! empty( $meta->meta_value ) ) {
							$this->results[ $meta->user_id ]->meta_value = $meta->meta_value;
						}
					}
				}
			}
		}
	}

	/**
	 * Get a SQL clause representing member_type include/exclusion.
	 *
	 * @since 2.4.0
	 *
	 * @param string|array $member_types Array or comma-separated list of member types.
	 * @param string       $operator     'IN' or 'NOT IN'.
	 * @return string
	 */
	protected function get_sql_clause_for_member_types( $member_types, $operator ) {
		global $wpdb;

		// Sanitize.
		if ( 'NOT IN' !== $operator ) {
			$operator = 'IN';
		}

		// Parse and sanitize types.
		if ( ! is_array( $member_types ) ) {
			$member_types = preg_split( '/[,\s+]/', $member_types );
		}

		$types = array();
		foreach ( $member_types as $mt ) {
			if ( bp_get_member_type_object( $mt ) ) {
				$types[] = $mt;
			}
		}

		$tax_query = new WP_Tax_Query( array(
			array(
				'taxonomy' => bp_get_member_type_tax_name(),
				'field'    => 'name',
				'operator' => $operator,
				'terms'    => $types,
			),
		) );

		// Switch to the root blog, where member type taxonomies live.
		$site_id  = bp_get_taxonomy_term_site_id( bp_get_member_type_tax_name() );
		$switched = false;
		if ( $site_id !== get_current_blog_id() ) {
			switch_to_blog( $site_id );
			$switched = true;
		}

		$sql_clauses = $tax_query->get_sql( 'u', $this->uid_name );

		$clause = '';

		// The no_results clauses are the same between IN and NOT IN.
		if ( false !== strpos( $sql_clauses['where'], '0 = 1' ) ) {
			$clause = $this->no_results['where'];

		// The tax_query clause generated for NOT IN can be used almost as-is. We just trim the leading 'AND'.
		} elseif ( 'NOT IN' === $operator ) {
			$clause = preg_replace( '/^\s*AND\s*/', '', $sql_clauses['where'] );

		// IN clauses must be converted to a subquery.
		} elseif ( preg_match( '/' . $wpdb->term_relationships . '\.term_taxonomy_id IN \([0-9, ]+\)/', $sql_clauses['where'], $matches ) ) {
			$clause = "u.{$this->uid_name} IN ( SELECT object_id FROM $wpdb->term_relationships WHERE {$matches[0]} )";
		}

		if ( $switched ) {
			restore_current_blog();
		}

		return $clause;
	}
}


text:
import select
import sys
import locale

class CliInput():
	"""

Class used to parse command-line input. Currently holds presets for formatting options

	"""
	DEFAULT_PRESET = "custom1"
	"""
Default formatting if no options are given.
	"""
	PRESETS = {"custom1":"%Y%m%d_%H%M%S", "linux1":"%b %d %H:%M:%S"}
	"""

List of all possible formatting presets and their values.

	"""
	def __init__(self):
		"""

Empty _\_\_init\_\__ -method.

		"""
		pass


text:
'use strict'

const db = require('APP/db')
const api = module.exports = require('express').Router()

api
  .get('/heartbeat', (req, res) => res.send({ok: true,}))
  .use('/auth', require('./auth'))
  .use('/users', require('./users'))

  .use('/addresses', require('./addresses'))
  .use('/countries', require('./countries'))
  .use('/grape', require('./grapes'))
  .use('/orders', require('./orders'))
  .use('/orderContainers', require('./orderContainers'))
  .use('/products', require('./products'))
  .use('/regions', require('./regions'))
  .use('/reviews', require('./reviews'))
  .use('/warehouse', require('./warehouse'))

// No routes matched? 404.
api.use((req, res) => res.status(404).end())


text:
package com.adaptris.core.services.metadata;

import com.adaptris.annotation.AdapterComponent;
import com.adaptris.annotation.ComponentProfile;
import com.adaptris.annotation.DisplayOrder;
import com.thoughtworks.xstream.annotations.XStreamAlias;

/**
 * Takes a metadata value and converts it to lower case.
 * <p>
 * Each matching metadata key from {@link ReformatMetadata#getMetadataKeyRegexp()} will be changed to lowercase
 * </p>
 *
 * @config metadata-value-to-lower-case
 *
 *
 */
@XStreamAlias("metadata-value-to-lower-case")
@AdapterComponent
@ComponentProfile(summary = "Changes matching metadata into lowercase", tag = "service,metadata")
@DisplayOrder(order = {"metadataKeyRegexp", "metadataLogger"})
public class MetadataValueToLowerCase extends ReformatMetadata {

  public MetadataValueToLowerCase() {
    super();
  }

  @Override
  public String reformat(String toChange, String msgCharset) {
    return toChange.toLowerCase();
  }

}


text:
package com.example.sahilnaran.integration.githubapi.config;

import com.example.sahilnaran.integration.common.IApiClient;
import com.exanple.sahilnaran.integration.BuildConfig;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitApiClient implements IApiClient<Retrofit> {

    @Override
    public Retrofit getClient() {
        String baseUrl = BuildConfig.GITHUB_SERVICE_URL;

        Gson gson = new GsonBuilder()
                .setLenient()
                .create();

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(baseUrl)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();

        return retrofit;
    }
}


text:
@interface MenuVC () <FavoriteVCDelegate>

@property (nonatomic, weak) IBOutlet UIButton *startGame;
@property (nonatomic, weak) IBOutlet UIButton *continueGame;

@end

@implementation MenuVC

- (IBAction)startGamePressed:(id)sender
{
    QuestionVC *questionVC = [[QuestionVC alloc]init];
    [self.navigationController pushViewController:questionVC animated:YES];
    [questionVC startNewGame];
    if ((!self.navigationController)&&(!!self.delegate)){
        [self.delegate stopTimer];
        UINavigationController *mainNC = [[UINavigationController alloc]
                                          initWithRootViewController:questionVC];
        mainNC.navigationBar.translucent = NO;
        self.view.window.rootViewController = mainNC;
    }
}

- (IBAction)continueGamePressed:(id)sender
{
    if (!!self.delegate){
        [self.delegate removeMenu];
    }
    else {
        QuestionVC *questionVC = [[QuestionVC alloc] init];
        [questionVC continuePreviousGame];
        [self.navigationController pushViewController:questionVC animated:YES];
    }
}

- (IBAction)favoritePressed:(id)sender
{
    FavoriteVC *favoriteVC = [[FavoriteVC alloc]initWithQuestions:[[DB standardBase] getAllFavs]
                                                        deletable:YES];
    favoriteVC.delegate = self;
    UINavigationController *const navigationController =
    [[UINavigationController alloc] initWithRootViewController:favoriteVC];
    favoriteVC.navigationItem.title = @"Избранное";
    [self presentViewController:navigationController animated:YES completion:NULL];
}

- (void)favoriteVCdidFinish:(FavoriteVC *)sender
{
    [self dismissViewControllerAnimated:YES completion:NULL];
}

@end


text:
package com.perforce.api;

import java.io.*;

/**
 * Signals that an exception occurred during the process of committing a
 * cacheable object to perforce.
 *
 * @author David Markley
 * @version $Date: 2001/11/05 $ $Revision: #1 $
 * @see Cacheable
 */
public final class CommitException extends PerforceException {

  public CommitException(String msg) {
    super(msg);
  }
}


text:
layout: page
title: "ARTS 2085: Ceramics 2: Handbuilding Statistics"
comments: true
description: "blanks"
keywords: "ARTS,2085,CU,Boulder"
---

#### GRADE AND WORKLOAD STATISTICS

**Percent withdrawn**: 0.75%

**Percent incomplete**: 0.78%

**Average grade** (4.0 scale): 3.37

**Standard deviation in grades** (4.0 scale): 0.19

**Average workload** (raw): 4.61

**Standard deviation in workload** (raw): 0.62

#### COURSE AND INSTRUCTOR RATINGS/INFORMATION

**Average course rating** (6 point scale): 5.26

**Standard deviation in course rating** (6 point scale): 0.43

**Average instructor rating** (6 point scale): 5.39

**Standard deviation in instructor rating** (6 point scale): 0.36

**Instructors**: Scott Chamberlin, Kimberly Dickey, Joseph Manley, Lauren Mayer, Jeanne Quinn, Emily Schroeder, Matt Wedel

#### GENERAL CLASS INFORMATION

**Years provided**: Fall 2006, Spring 2007, Fall 2007, Fall 2008, Spring 2010, Fall 2010, Spring 2011, Fall 2011, Spring 2012, Fall 2012, Fall 2013, Fall 2015, Spring 2016, Fall 2016

**Credits**: 3

**RAP/Honors class?** Neither

**Number of Sections**: 14

**Department**: AAAH

**College**: College of Arts and Sciences

**A&S Division**: Arts and Humanities

**Level**: Lower

**Activity**: STU - Studio


text:
package steno

import (
	"encoding/json"
	"sync"
)

// Global configs
var config Config

// loggersMutex protects accesses to loggers and regexp
var loggersMutex sync.Mutex

// loggers only saves BaseLogger
var loggers = make(map[string]*BaseLogger)

func Init(c *Config) {
	config = *c

	if config.Level == (LogLevel{}) {
		config.Level = LOG_INFO
	}
	if config.Codec == nil {
		config.Codec = NewJsonCodec()
	}
	if config.Sinks == nil {
		config.Sinks = []Sink{}
	}

	for _, sink := range config.Sinks {
		if sink.GetCodec() == nil {
			sink.SetCodec(config.Codec)
		}
	}

	if config.Port > 0 {
		initHttpServer(config.Port)
	}

	for name, _ := range loggers {
		loggers[name] = nil
	}
}

func NewLogger(name string) Logger {
	loggersMutex.Lock()
	defer loggersMutex.Unlock()

	logger := loggers[name]

	if logger == nil {
		baseLogger := new(BaseLogger)

		baseLogger.name = name
		baseLogger.sinks = config.Sinks
		baseLogger.level = computeLevel(name)

		logger = baseLogger
		loggers[name] = logger
	}

	return logger
}

func loggersInJson() string {
	bytes, _ := json.Marshal(loggers)
	return string(bytes)
}


text:
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { DataService } from '../data.service';

@Component({
    selector: 'multi-select-custom-example',
    templateUrl: './multi-select-custom-example.component.html',
    styleUrls: ['./multi-select-custom-example.component.scss']
})
export class MultiSelectCustomExampleComponent implements OnInit {

    githubUsers$: Observable<any[]>;
    selectedUsers = ['anjmao', 'anjmittu', 'anjmendoza'];

    constructor(private dataService: DataService) {
    }

    ngOnInit() {
        this.githubUsers$ = this.dataService.getGithubAccounts('anjm');
    }
}